1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-14 22:42:34 +02:00

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ScreenPlay/translations/ScreenPlay_de.ts
#	ScreenPlay/translations/ScreenPlay_en.ts
#	ScreenPlay/translations/ScreenPlay_es.ts
#	ScreenPlay/translations/ScreenPlay_fr.ts
#	ScreenPlay/translations/ScreenPlay_ko.ts
#	ScreenPlay/translations/ScreenPlay_pt_br.ts
#	ScreenPlay/translations/ScreenPlay_ru.ts
#	ScreenPlay/translations/ScreenPlay_vi.qm
#	ScreenPlay/translations/ScreenPlay_vi.ts
#	ScreenPlay/translations/ScreenPlay_zh_cn.ts
This commit is contained in:
Elias Steurer 2021-09-04 15:10:35 +02:00
commit 0a602bd10a
20 changed files with 138 additions and 34 deletions

View File

@ -60,6 +60,7 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE)
add_compile_definitions(COMPILE_INFO="${BUILD_DATE} + ${GIT_COMMIT_HASH}")
add_compile_definitions(SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
if(UNIX AND NOT APPLE)
# Fixes QWebEngine linker errors on Ubuntu 20.04
@ -83,6 +84,7 @@ if(WIN32)
add_subdirectory(ScreenPlaySysInfo)
endif()
message(STATUS "[DEFINE] SOURCE_DIR = ${SOURCE_DIR}")
message(STATUS "[DEFINE] BUILD_DATE = ${BUILD_DATE}")
message(STATUS "[DEFINE] GIT_COMMIT_HASH = ${GIT_COMMIT_HASH}")
message(STATUS "[PROJECT] CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")

View File

@ -172,6 +172,21 @@ if(APPLE)
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffprobe
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/)
# tst_ScreenPlay needs ffmpeg in the base path
if(${TESTS_ENABLED})
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffmpeg
${CMAKE_BINARY_DIR}/bin/)
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffprobe
${CMAKE_BINARY_DIR}/bin/)
endif()
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD

Binary file not shown.

View File

@ -15,6 +15,9 @@ Popup {
anchors.centerIn: Overlay.overlay
dim: true
property ScreenPlayWorkshop workshop
property SteamWorkshop steam
Text {
id: txtOffline
@ -22,7 +25,7 @@ Popup {
font.family: ScreenPlay.settings.font
font.pointSize: 21
color: Material.foreground
text: qsTr("You need to run Steam for this :)")
text: qsTr("You need to run Steam for this. steamErrorRestart: %1 - steamErrorAPIInit: %2").arg(steam.steamErrorRestart).arg(steam.steamErrorAPIInit)
}
Button {

View File

@ -10,14 +10,14 @@ Item {
id: root
ScreenPlayWorkshop {
id: workshop
id: ws
Component.onCompleted: {
const success = workshop.init();
const success = ws.init();
if(success){
stackView.push("qrc:/qml/Workshop/SteamWorkshop.qml", {
"workshop": workshop,
"steam": workshop.steamWorkshop
"workshop": ws,
"steam": ws.steamWorkshop
})
} else {
popupOffline.open()
@ -27,6 +27,8 @@ Item {
PopupOffline {
id: popupOffline
workshop: ws
steam: ws.steamWorkshop
}
StackView {
@ -39,8 +41,8 @@ Item {
ignoreUnknownSignals: true
function onOpenSteamProfile(){
stackView.push("qrc:/qml/Workshop/SteamProfile.qml", {
"workshop": workshop,
"steam": workshop.steamWorkshop
"workshop": ws,
"steam": ws.steamWorkshop
})
}
function onRequestWorkshopMainPage(){

View File

@ -153,9 +153,13 @@ void Settings::setupWidgetAndWindowPaths()
#ifdef Q_OS_OSX
workingDir.cdUp();
workingDir.cdUp();
workingDir.cdUp();
// ScreenPlayTest is not bundled in an .app so the working directory
// the the same as the executable.
if (QFileInfo(QCoreApplication::applicationFilePath()).fileName() != "tst_ScreenPlay") {
workingDir.cdUp();
workingDir.cdUp();
workingDir.cdUp();
}
m_globalVariables->setWidgetExecutablePath(QUrl::fromUserInput(workingDir.path() + "/ScreenPlayWidget.app/Contents/MacOS/ScreenPlayWidget").toLocalFile());
m_globalVariables->setWallpaperExecutablePath(QUrl::fromUserInput(workingDir.path() + "/ScreenPlayWallpaper.app/Contents/MacOS/ScreenPlayWallpaper").toLocalFile());
@ -164,11 +168,11 @@ void Settings::setupWidgetAndWindowPaths()
if (!QFileInfo::exists(m_globalVariables->widgetExecutablePath().toString())) {
qInfo() << "widgetExecutablePath:" << m_globalVariables->widgetExecutablePath().toString();
qFatal("widget executable not found!");
qCritical("widget executable not found!");
}
if (!QFileInfo::exists(m_globalVariables->wallpaperExecutablePath().toString())) {
qInfo() << "wallpaperExecutablePath:" << m_globalVariables->wallpaperExecutablePath().toString();
qFatal("wallpaper executable not found!");
qCritical("wallpaper executable not found!");
}
}

View File

@ -55,6 +55,7 @@ private slots:
Q_INIT_RESOURCE(ScreenPlayQML);
Q_INIT_RESOURCE(ScreenPlayAssets);
app.init();
m_window = qobject_cast<QQuickWindow*>(app.mainWindowEngine()->rootObjects().first());
QVERIFY(m_window);
@ -130,10 +131,13 @@ void ScreenPlayTest::import_convert_video()
auto* createWallpaperInit = m_window->findChild<QQuickItem*>("createWallpaperInit");
QVERIFY(createWallpaperInit);
const QString originalVideoPath = QString(SOURCE_DIR) + "/ScreenPlay/assets/tests/video_import.mp4";
qInfo() << originalVideoPath;
QVERIFY(QMetaObject::invokeMethod(createWallpaperInit,
QString("startConvert").toLatin1().constData(),
Qt::ConnectionType::AutoConnection,
Q_ARG(QVariant, "file:///D:/Video Loop/bbb.mp4"),
Q_ARG(QVariant, originalVideoPath),
Q_ARG(QVariant, 1))); // VideoCodec::VP9
QTest::qWait(1000);

View File

@ -150,6 +150,7 @@ public slots:
virtual void destroyThis() { }
virtual void setVisible(bool show) { Q_UNUSED(show) }
virtual void messageReceived(QString key, QString value) final;
virtual void clearComponentCache() {}
virtual void replaceWallpaper(
const QString absolutePath,
const QString file,

View File

@ -63,3 +63,8 @@ void MacWindow::destroyThis()
{
QCoreApplication::quit();
}
void MacWindow::clearComponentCache()
{
m_window.engine()->clearComponentCache();
}

View File

@ -65,6 +65,7 @@ signals:
public slots:
void setVisible(bool show) override;
void destroyThis() override;
void clearComponentCache() override;
private:
QQuickView m_window;

View File

@ -73,7 +73,7 @@ public slots:
void setVisible(bool show) override;
void destroyThis() override;
void terminate();
void clearComponentCache();
void clearComponentCache() override;
void setWindowsDesktopProperties(WindowsDesktopProperties* windowsDesktopProperties)
{

View File

@ -11,7 +11,9 @@ Item {
Connections {
function onQmlExit() {
Widget.setWindowBlur(0);
if(Qt.platform.os === "windows")
Widget.setWindowBlur(0);
animFadeOut.start();
}
@ -136,7 +138,8 @@ Item {
onEntered: imgClose.opacity = 1
onExited: imgClose.opacity = 0.15
onClicked: {
Widget.setWindowBlur(0);
if(Qt.platform.os === "windows")
Widget.setWindowBlur(0);
animFadeOut.start();
}

View File

@ -1,4 +1,3 @@
#pragma once
#include <QByteArray>
#include <QJsonArray>
#include <QString>

View File

@ -121,6 +121,42 @@ void SteamWorkshop::onRequestItemDetailReturned(SteamUGCQueryCompleted_t* pCallb
}
}
bool SteamWorkshop::steamErrorAPIInit() const
{
return m_steamErrorAPIInit;
}
void SteamWorkshop::setSteamErrorAPIInit(bool newSteamErrorAPIInit)
{
if (m_steamErrorAPIInit == newSteamErrorAPIInit)
return;
m_steamErrorAPIInit = newSteamErrorAPIInit;
emit steamErrorAPIInitChanged();
}
void SteamWorkshop::resetSteamErrorAPIInit()
{
setSteamErrorAPIInit({}); // TODO: Adapt to use your actual default value
}
bool SteamWorkshop::steamErrorRestart() const
{
return m_steamErrorRestart;
}
void SteamWorkshop::setSteamErrorRestart(bool newSteamErrorRestart)
{
if (m_steamErrorRestart == newSteamErrorRestart)
return;
m_steamErrorRestart = newSteamErrorRestart;
emit steamErrorRestartChanged();
}
void SteamWorkshop::resetSteamErrorRestart()
{
setSteamErrorRestart({}); // TODO: Adapt to use your actual default value
}
void SteamWorkshop::requestUserItems()
{
if (!checkOnline())

View File

@ -48,6 +48,8 @@ class SteamWorkshop : public QObject {
Q_PROPERTY(SteamWorkshopListModel* workshopProfileListModel READ workshopProfileListModel WRITE setWorkshopProfileListModel NOTIFY workshopProfileListModelChanged)
Q_PROPERTY(UploadListModel* uploadListModel READ uploadListModel NOTIFY uploadListModelChanged)
Q_PROPERTY(SteamAccount* steamAccount READ steamAccount WRITE setSteamAccount NOTIFY steamAccountChanged)
Q_PROPERTY(bool steamErrorRestart READ steamErrorRestart WRITE setSteamErrorRestart RESET resetSteamErrorRestart NOTIFY steamErrorRestartChanged)
Q_PROPERTY(bool steamErrorAPIInit READ steamErrorAPIInit WRITE setSteamErrorAPIInit RESET resetSteamErrorAPIInit NOTIFY steamErrorAPIInitChanged)
public:
SteamWorkshop()
@ -72,6 +74,14 @@ public:
SteamWorkshopListModel* workshopListModel() const { return m_workshopListModel.get(); }
SteamWorkshopListModel* workshopProfileListModel() const { return m_workshopProfileListModel.get(); }
bool steamErrorRestart() const;
void setSteamErrorRestart(bool newSteamErrorRestart);
void resetSteamErrorRestart();
bool steamErrorAPIInit() const;
void setSteamErrorAPIInit(bool newSteamErrorAPIInit);
void resetSteamErrorAPIInit();
public slots:
bool checkOnline();
void bulkUploadToWorkshop(QStringList absoluteStoragePaths);
@ -175,6 +185,10 @@ signals:
void workshopProfileListModelChanged(SteamWorkshopListModel*);
void steamErrorRestartChanged();
void steamErrorAPIInitChanged();
private:
void onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool bIOFailure);
bool queryWorkshopItemFromHandle(SteamWorkshopListModel* listModel, SteamUGCQueryCompleted_t* pCallback);

View File

@ -7,7 +7,6 @@ Workshop::Workshop(QQuickItem* parent)
m_installedListModel = std::make_unique<InstalledListModel>();
m_steamWorkshop = std::make_unique<SteamWorkshop>(672870);
m_installedListModel->init();
qInfo() << "Workshop init";
}
}

View File

@ -1,15 +1,27 @@
## Tools
This folder contains serveral python tools to help with development:
This folder contains serveral python tools to help with development. Depending on your os you have to change the python command to ```python```, ```python3``` or ```python3.9```
#### setup.py
- Installs third party dependencies for all platforms
- Installs third party c++ dependencies for all platforms
- ```python3 setup.py -u=xxx -p=xxx```
#### build.py
- Build ScreenPlay locally
- ```python3 build.py -t=release```
#### clang_format.py
- Invokers clang-format for all .cpp and .h files
#### qdoc.py
- Builds documentation for all projects into Docs/html
#### download_ffmpeg.py
- Donwload ffmpeg for macos only for now
- ```python3 clang_format.py ```
#### qml_format.py
- Calls qmlformat for all qml files
- ```python3 qml_format.py```
#### qdoc.py
- Builds documentation for all projects into Docs/html
- ```python3 qdoc.py```
#### download_ffmpeg.py
- Donwload ffmpeg for macos only for now
- ```python3 download_ffmpeg.py```
#### steam_publish.py
- Upload to steam. This is needed to add some much needed output like git commit to the steam ui for selecting branches
- ```python3 steam_publish.py -u xxx -p xxx```

View File

@ -60,7 +60,7 @@ if platform == "win32":
cmake_target_triplet = "x64-windows"
elif platform == "darwin":
cmake_prefix_path = "~/Qt/" + qt_version + "/clang_64"
deploy_command = "{prefix_path}/bin/macdeployqt {app}.app -qmldir=../../{app}/qml "
deploy_command = "{prefix_path}/bin/macdeployqt {app}.app -qmldir=../../{app}/qml -executable={app}.app/Contents/MacOS/{app}"
cmake_target_triplet = "x64-osx"
elif platform == "linux":
deploy_command = "cqtdeployer -qmldir ../../{app}/qml -bin {app}"
@ -75,21 +75,22 @@ cmake_toolchain_file = (
"'{root_path}/../ScreenPlay-vcpkg/scripts/buildsystems/vcpkg.cmake'").format(root_path=root_path)
print("cmake_toolchain_file: %s " % cmake_toolchain_file)
build_folder = "build-" + cmake_target_triplet + "-" + args.build_type
build_folder = root_path + "/build-" + cmake_target_triplet + "-" + args.build_type
if os.path.isdir(build_folder):
print("Remove previous build folder")
print("Remove previous build folder: " + build_folder)
shutil.rmtree(build_folder)
os.mkdir(build_folder)
os.chdir(root_path + "/" + build_folder)
os.chdir(build_folder)
cmake_configure_command = """cmake ../
-DCMAKE_PREFIX_PATH={prefix_path}
-DCMAKE_BUILD_TYPE={type}
-DCMAKE_TOOLCHAIN_FILE={toolchain}
-DVCPKG_TARGET_TRIPLET={triplet}
-DTESTS_ENABLED=OFF
-DSCREENPLAY_STEAM_DEPLOY=ON
-DSCREENPLAY_STEAM=ON
-G "CodeBlocks - Ninja"
@ -123,13 +124,16 @@ execute(deploy_command.format(
executable_file_ending=executable_file_ending))
if platform == "darwin" and args.sign_build:
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --options \"runtime\" --entitlements \"../../ScreenPlay/entitlements.plist\" \"ScreenPlay.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --options \"runtime\" \"ScreenPlayWallpaper.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --options \"runtime\" \"ScreenPlayWidget.app/\"")
print("Remove workshop build folder (macos only).")
shutil.rmtree(build_folder + "/bin/workshop")
execute("codesign --verify --verbose \"ScreenPlay.app/\"")
execute("codesign --verify --verbose \"ScreenPlayWallpaper.app/\"")
execute("codesign --verify --verbose \"ScreenPlayWidget.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --entitlements \"../../ScreenPlay/entitlements.plist\" --deep \"ScreenPlay.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlayWallpaper.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlayWidget.app/\"")
execute("codesign --verify --verbose=4 \"ScreenPlay.app/\"")
execute("codesign --verify --verbose=4 \"ScreenPlayWallpaper.app/\"")
execute("codesign --verify --verbose=4 \"ScreenPlayWidget.app/\"")
execute("xcnotary notarize ScreenPlay.app -d kelteseth@gmail.com -k ScreenPlay")
execute("xcnotary notarize ScreenPlayWallpaper.app -d kelteseth@gmail.com -k ScreenPlay")