From e03cfd5b3c66bb274ae503efc1f546d2a5d9b2b7 Mon Sep 17 00:00:00 2001 From: Elias Date: Sat, 27 Apr 2019 11:46:37 +0200 Subject: [PATCH 01/15] Add dep install script for windows --- Common/vcpkg | 1 + ScreenPlay/ScreenPlay.pro | 46 +++++++++++----------------------- vcpkg-install-dependencies.bat | 8 ++++++ 3 files changed, 23 insertions(+), 32 deletions(-) create mode 160000 Common/vcpkg create mode 100644 vcpkg-install-dependencies.bat diff --git a/Common/vcpkg b/Common/vcpkg new file mode 160000 index 00000000..0619aaec --- /dev/null +++ b/Common/vcpkg @@ -0,0 +1 @@ +Subproject commit 0619aaec650861d2a15a91cbbf11e0c626a1cf12 diff --git a/ScreenPlay/ScreenPlay.pro b/ScreenPlay/ScreenPlay.pro index c62b7805..dc35b953 100644 --- a/ScreenPlay/ScreenPlay.pro +++ b/ScreenPlay/ScreenPlay.pro @@ -4,11 +4,17 @@ CONFIG += c++17 #CONFIG += qtquickcompiler #DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT -msvc: LIBS += -luser32 TARGETPATH = ScreenPlay ICON = favicon.ico +DEFINES += QT_DEPRECATED_WARNINGS + +DISTFILES += \ + favicon.ico \ + +RESOURCES += Resources.qrc + SOURCES += main.cpp \ src/createimportvideo.cpp \ src/installedlistmodel.cpp \ @@ -25,7 +31,6 @@ SOURCES += main.cpp \ src/qmlutilities.cpp \ src/create.cpp -RESOURCES += Resources.qrc TRANSLATIONS = translations/ScreenPlay_en.ts \ translations/ScreenPlay_de.ts @@ -54,43 +59,21 @@ CONFIG(debug, debug|release) { install_it.path = $${OUT_PWD}/debug/ } else { install_it.path = $${OUT_PWD}/release/ - } +} install_it.files += assets/templates/config.json \ assets/icons/favicon.ico win32 { - install_it.files += ThirdParty/ffmpeg/Windows/avcodec-58.dll \ - ThirdParty/ffmpeg/Windows/avdevice-58.dll \ - ThirdParty/ffmpeg/Windows/avfilter-7.dll \ - ThirdParty/ffmpeg/Windows/avformat-58.dll \ - ThirdParty/ffmpeg/Windows/avutil-56.dll \ - ThirdParty/ffmpeg/Windows/ffmpeg.exe \ - ThirdParty/ffmpeg/Windows/ffplay.exe \ - ThirdParty/ffmpeg/Windows/ffprobe.exe \ - ThirdParty/ffmpeg/Windows/postproc-55.dll \ - ThirdParty/ffmpeg/Windows/swresample-3.dll \ - ThirdParty/ffmpeg/Windows/swscale-5.dll \ - ThirdParty/OpenSSL/libeay32.dll \ - ThirdParty/OpenSSL/ssleay32.dll \ + LIBS += -luser32 + install_it.files += \ + Common/vcpkg/packages/openssl-windows_x64-windows/bin/libeay32.dll \ + Common/vcpkg/packages/openssl-windows_x64-windows/bin/ssleay32.dll \ } -INSTALLS += install_it -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = -# Additional import path used to resolve QML modules just for Qt Quick Designer -# QML_DESIGNER_IMPORT_PATH = -QT_QUICK_CONTROLS_STYLE = "Material" - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which as been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -macx: { +macx { LIBS += -L$$PWD/ThirdParty/steam/redistributable_bin/osx32/ -lsteam_api DEPENDPATH += $$PWD/ThirdParty/steam/redistributable_bin/osx32 @@ -108,6 +91,5 @@ macx: { } -DISTFILES += \ - favicon.ico \ +INSTALLS += install_it diff --git a/vcpkg-install-dependencies.bat b/vcpkg-install-dependencies.bat new file mode 100644 index 00000000..35f3a843 --- /dev/null +++ b/vcpkg-install-dependencies.bat @@ -0,0 +1,8 @@ +setlocal EnableExtensions + +cd Common +git clone https://github.com/Microsoft/vcpkg.git +cd vcpkg +git pull +call bootstrap-vcpkg.bat +vcpkg.exe install openssl:x64-windows From 9764238ad1c6cad7d13f188d6287b3bbc11c543d Mon Sep 17 00:00:00 2001 From: Elias Date: Sat, 27 Apr 2019 11:55:29 +0200 Subject: [PATCH 02/15] Fix --- ScreenPlay.pro | 2 +- ScreenPlay/qml/Installed/ScreenPlayItem.qml | 8 +- ScreenPlay/src/qmlutilities.h | 10 +- ScreenPlay/src/screenplay.cpp | 229 ++++++++++---------- ScreenPlay/src/screenplay.h | 61 +++--- ScreenPlay/src/sdkconnector.h | 9 +- ScreenPlay/src/settings.cpp | 7 + ScreenPlay/src/settings.h | 8 +- 8 files changed, 165 insertions(+), 169 deletions(-) diff --git a/ScreenPlay.pro b/ScreenPlay.pro index 21af9e3d..7237ff1b 100644 --- a/ScreenPlay.pro +++ b/ScreenPlay.pro @@ -4,7 +4,7 @@ SUBDIRS += \ ScreenPlaySDK/ScreenPlaySDK.pro \ ScreenPlayWindow/ScreenPlayWindow.pro \ ScreenPlayWidget/ScreenPlayWidget.pro \ - #ScreenPlay/ThirdParty/stomt-qt-sdk/sdk/stomt-qt-sdk.pro \ + ScreenPlay/ThirdParty/stomt-qt-sdk/sdk/stomt-qt-sdk.pro \ ScreenPlayWindow.depends = ScreenPlaySDK ScreenPlayWidget.depends = ScreenPlaySDK diff --git a/ScreenPlay/qml/Installed/ScreenPlayItem.qml b/ScreenPlay/qml/Installed/ScreenPlayItem.qml index 64fe3dc9..72b4a9f7 100644 --- a/ScreenPlay/qml/Installed/ScreenPlayItem.qml +++ b/ScreenPlay/qml/Installed/ScreenPlayItem.qml @@ -139,16 +139,13 @@ Item { id: screenPlayItemImage anchors.fill: parent sourceImage: Qt.resolvedUrl( - screenPlayItem.absoluteStoragePath - + "/" + screenPreview) + screenPlayItem.absoluteStoragePath + "/" + screenPreview) sourceImageGIF: { if (screenPreviewGIF === undefined) { return "" } else { return Qt.resolvedUrl( - screenPlayItem.absoluteStoragePath - + "/" + screenPreviewGIF) - + screenPlayItem.absoluteStoragePath + "/" + screenPreviewGIF) } } } @@ -176,7 +173,6 @@ Item { left: parent.left bottom: parent.bottom } - } } diff --git a/ScreenPlay/src/qmlutilities.h b/ScreenPlay/src/qmlutilities.h index 71e9c504..2f5d6d9c 100644 --- a/ScreenPlay/src/qmlutilities.h +++ b/ScreenPlay/src/qmlutilities.h @@ -1,11 +1,11 @@ #pragma once -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include /*! \class Global QML Utilities diff --git a/ScreenPlay/src/screenplay.cpp b/ScreenPlay/src/screenplay.cpp index 22aca27a..566ddfe7 100644 --- a/ScreenPlay/src/screenplay.cpp +++ b/ScreenPlay/src/screenplay.cpp @@ -1,37 +1,38 @@ #include "screenplay.h" ScreenPlay::ScreenPlay(InstalledListModel* ilm, Settings* set, MonitorListModel* mlm, SDKConnector* sdkc, QObject* parent) - : QObject{parent}, - m_ilm{ilm}, - m_settings{set}, - m_mlm{mlm}, - m_qGuiApplication{static_cast(QGuiApplication::instance())}, - m_sdkc{sdkc} -{} + : QObject { parent } + , m_ilm { ilm } + , m_settings { set } + , m_mlm { mlm } + , m_qGuiApplication { static_cast(QGuiApplication::instance()) } + , m_sdkc { sdkc } +{ +} ScreenPlay::~ScreenPlay() { - if(m_ilm) delete m_ilm; - if(m_settings) delete m_settings; - if(m_mlm) delete m_mlm; - if(m_qGuiApplication) delete m_qGuiApplication; - if(m_sdkc) delete m_sdkc; + if (m_ilm) + delete m_ilm; + if (m_settings) + delete m_settings; + if (m_mlm) + delete m_mlm; + if (m_qGuiApplication) + delete m_qGuiApplication; + if (m_sdkc) + delete m_sdkc; } -const InstalledListModel* ScreenPlay::listModelInstalled() const noexcept { return m_ilm; } -const Settings* ScreenPlay::settings() const noexcept { return m_settings; } -const MonitorListModel* ScreenPlay::monitorListModel() const noexcept { return m_mlm; } -const QGuiApplication* ScreenPlay::guiApp() const noexcept { return m_qGuiApplication; } -const SDKConnector* ScreenPlay::sdkConnector() const noexcept { return m_sdkc; } -const std::vector& ScreenPlay::spWallList() const noexcept { return m_screenPlayWallpaperList; } -const std::vector& ScreenPlay::spWidgetList() const noexcept { return m_screenPlayWidgetList; } +const Settings* ScreenPlay::settings() const noexcept { return m_settings; } + void ScreenPlay::createWallpaper( - const int monitorIndex, QUrl absoluteStoragePath, - const QString& previewImage, const float volume, - const QString& fillMode, const QString& type) + const int monitorIndex, QUrl absoluteStoragePath, + const QString& previewImage, const float volume, + const QString& fillMode, const QString& type) { - ProjectFile project{}; + ProjectFile project {}; if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { return; } @@ -41,32 +42,30 @@ void ScreenPlay::createWallpaper( m_settings->increaseActiveWallpaperCounter(); m_screenPlayWallpaperList.emplace_back( - RefSPWall::create( - std::vector{monitorIndex}, absoluteStoragePath.toLocalFile(), - previewImage, volume, fillMode, type, this) - ); + RefSPWall::create( + std::vector { monitorIndex }, absoluteStoragePath.toLocalFile(), + previewImage, volume, fillMode, type, this)); m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), - QString{absoluteStoragePath.toLocalFile() + "/" + previewImage}); + QString { absoluteStoragePath.toLocalFile() + "/" + previewImage }); } void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewImage) { - ProjectFile project{}; + ProjectFile project {}; if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { return; } m_screenPlayWidgetList.emplace_back( - RefSPWidget::create( - absoluteStoragePath.toLocalFile(), previewImage, - QString{absoluteStoragePath.toLocalFile() + "/" + project.m_file.toString()}, - this) - ); + RefSPWidget::create( + absoluteStoragePath.toLocalFile(), previewImage, + QString { absoluteStoragePath.toLocalFile() + "/" + project.m_file.toString() }, + this)); } void ScreenPlay::removeAllWallpaper() noexcept { - if(m_sdkc && m_settings && !m_screenPlayWallpaperList.empty()){ + if (m_sdkc && m_settings && !m_screenPlayWallpaperList.empty()) { m_sdkc->closeAllWallpapers(); m_settings->setActiveWallpaperCounter(0); m_screenPlayWallpaperList.clear(); @@ -77,12 +76,11 @@ void ScreenPlay::removeAllWallpaper() noexcept void ScreenPlay::requestProjectSettingsListModelAt(const int index) const noexcept { - for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) { - if (!refSPWallpaper.data()->screenNumber().empty() && - refSPWallpaper.data()->screenNumber()[0] == index) { // ??? only at index == 0 + for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { + if (!refSPWallpaper.data()->screenNumber().empty() && refSPWallpaper.data()->screenNumber()[0] == index) { // ??? only at index == 0 emit projectSettingsListModelFound( - refSPWallpaper.data()->projectSettingsListModel().data(), - refSPWallpaper.data()->type()); + refSPWallpaper.data()->projectSettingsListModel().data(), + refSPWallpaper.data()->type()); return; } } @@ -92,9 +90,8 @@ void ScreenPlay::requestProjectSettingsListModelAt(const int index) const noexce void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) noexcept { Q_ASSERT(static_cast(at) < m_screenPlayWallpaperList.size() && m_sdkc); - for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) { - if (!refSPWallpaper.data()->screenNumber().empty() && m_sdkc && - refSPWallpaper.data()->screenNumber()[0] == at) { // ??? only at index == 0 + for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { + if (!refSPWallpaper.data()->screenNumber().empty() && m_sdkc && refSPWallpaper.data()->screenNumber()[0] == at) { // ??? only at index == 0 m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value); return; } @@ -104,8 +101,9 @@ void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QStri void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) noexcept { Q_ASSERT(m_sdkc); - for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) { - if(m_sdkc) m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value); + for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { + if (m_sdkc) + m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value); } } @@ -113,41 +111,42 @@ void ScreenPlay::removeWallpaperAt(const int at) { // Q_ASSERT(at < m_screenPlayWallpaperList.size() && m_sdkc); qDebug() << "No of walls in list: " << m_screenPlayWallpaperList.size(); - if(m_screenPlayWallpaperList.empty()) return; // done here; + if (m_screenPlayWallpaperList.empty()) + return; // done here; const auto toRemove = std::remove_if( - m_screenPlayWallpaperList.begin(), m_screenPlayWallpaperList.end(), - [&](const RefSPWall& refSPWallpaper) noexcept ->bool { - const std::vector& screenNumber = refSPWallpaper->screenNumber(); - qDebug() << "Screen No. :" << screenNumber.size(); - const bool isFound = !screenNumber.empty();// && screenNumber[0] == at; - if(isFound) { - // m_mlm - m_sdkc->closeWallpapersAt(at); // for waht ??? - m_settings->decreaseActiveWallpaperCounter(); - qDebug() << "current wall count... " << m_settings->activeWallpaperCounter(); - } - return isFound; - }); + m_screenPlayWallpaperList.begin(), m_screenPlayWallpaperList.end(), + [&](const RefSPWall& refSPWallpaper) noexcept->bool { + const std::vector& screenNumber = refSPWallpaper->screenNumber(); + qDebug() << "Screen No. :" << screenNumber.size(); + const bool isFound = !screenNumber.empty(); // && screenNumber[0] == at; + if (isFound) { + // m_mlm + m_sdkc->closeWallpapersAt(at); // for waht ??? + m_settings->decreaseActiveWallpaperCounter(); + qDebug() << "current wall count... " << m_settings->activeWallpaperCounter(); + } + return isFound; + }); m_screenPlayWallpaperList.erase(toRemove, m_screenPlayWallpaperList.end()); qDebug() << "After removing: No of walls in list: " << m_screenPlayWallpaperList.size(); - } std::vector ScreenPlay::getMonitorByAppID(const QString& appID) const { - for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) { + for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { if (refSPWallpaper.data()->appID() == appID) { return refSPWallpaper.data()->screenNumber(); } } - return std::vector{}; + return std::vector {}; } QString ScreenPlay::generateID() const { - const QString possibleCharacters{ - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}; + const QString possibleCharacters { + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + }; const int randomStringLength = 32; const auto radomGen = QRandomGenerator::system(); @@ -160,24 +159,23 @@ QString ScreenPlay::generateID() const return randomString; } - ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector& screenNumber, const QString& projectPath, - const QString& previewImage, const float volume, - const QString& fillMode, const QString& type, ScreenPlay *parent) - : QObject{parent}, - m_screenNumber{std::move(screenNumber)}, - m_projectPath{projectPath}, - m_previewImage{previewImage}, - m_type{type}, - m_appID{ parent ? parent->generateID() : QString{} }, - m_process{nullptr}, - m_projectSettingsListModel{QSharedPointer::create(projectPath + "/project.json")} + const QString& previewImage, const float volume, + const QString& fillMode, const QString& type, ScreenPlay* parent) + : QObject { parent } + , m_screenNumber { std::move(screenNumber) } + , m_projectPath { projectPath } + , m_previewImage { previewImage } + , m_type { type } + , m_appID { parent ? parent->generateID() : QString {} } + , m_process { nullptr } + , m_projectSettingsListModel { QSharedPointer::create(projectPath + "/project.json") } { QStringList proArgs; proArgs.append(QString::number(m_screenNumber.empty() ? 0 : m_screenNumber[0])); proArgs.append(m_projectPath); proArgs.append("appID=" + m_appID); - proArgs.append(parent ? parent->settings()->decoder() : QString{}); + proArgs.append(parent ? parent->settings()->decoder() : QString {}); proArgs.append(QString::number(static_cast(volume))); proArgs.append(fillMode); @@ -189,14 +187,13 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector& screenNumber, c QProcess* m_process = new QProcess(); QObject::connect(m_process, QOverload::of(&QProcess::finished), - [=](int exitCode, QProcess::ExitStatus exitStatus) - { - if (exitCode != 0) - qDebug() << "WARNING EXIT CODE: " << exitCode; - }); + [=](int exitCode, QProcess::ExitStatus exitStatus) { + if (exitCode != 0) + qDebug() << "WARNING EXIT CODE: " << exitCode; + }); QObject::connect(m_process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) { - qDebug() << "EX: " << error; - }); + qDebug() << "EX: " << error; + }); m_process->setArguments(proArgs); m_process->setProgram(parent->settings()->screenPlayWindowPath().toString()); @@ -205,12 +202,13 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector& screenNumber, c ScreenPlayWallpaper::~ScreenPlayWallpaper() { - if(m_process) delete m_process; + if (m_process) + delete m_process; } const std::vector& ScreenPlayWallpaper::screenNumber() const noexcept { - return m_screenNumber; + return m_screenNumber; } const QString& ScreenPlayWallpaper::projectPath() const noexcept @@ -241,7 +239,7 @@ const QSharedPointer& ScreenPlayWallpaper::projectSett void ScreenPlayWallpaper::setScreenNumber(const std::vector& screenNumber) noexcept { if (m_screenNumber == screenNumber) - return; + return; m_screenNumber = screenNumber; emit screenNumberChanged(m_screenNumber); } @@ -249,7 +247,7 @@ void ScreenPlayWallpaper::setScreenNumber(const std::vector& screenNumber) void ScreenPlayWallpaper::setProjectPath(const QString& projectPath) noexcept { if (m_projectPath == projectPath) - return; + return; m_projectPath = projectPath; emit projectPathChanged(m_projectPath); @@ -258,7 +256,7 @@ void ScreenPlayWallpaper::setProjectPath(const QString& projectPath) noexcept void ScreenPlayWallpaper::setPreviewImage(const QString& previewImage) noexcept { if (m_previewImage == previewImage) - return; + return; m_previewImage = previewImage; emit previewImageChanged(m_previewImage); @@ -267,54 +265,55 @@ void ScreenPlayWallpaper::setPreviewImage(const QString& previewImage) noexcept void ScreenPlayWallpaper::setType(const QString& type) noexcept { if (m_type == type) - return; + return; - m_type = type; - emit typeChanged(m_type); + m_type = type; + emit typeChanged(m_type); } void ScreenPlayWallpaper::setAppID(const QString& appID) noexcept { - if (m_appID == appID) + if (m_appID == appID) return; - m_appID = appID; - emit appIDChanged(m_appID); + m_appID = appID; + emit appIDChanged(m_appID); } ScreenPlayWidget::ScreenPlayWidget(const QString& projectPath, const QString& previewImage, - const QString& fullPath, ScreenPlay *parent) - : m_projectPath{projectPath}, - m_previewImage{previewImage}, - m_fullPath{fullPath}, - m_appID{parent ? parent->generateID() : QString{}}, - m_position{0, 0}, - m_process{nullptr} + const QString& fullPath, ScreenPlay* parent) + : m_projectPath { projectPath } + , m_previewImage { previewImage } + , m_fullPath { fullPath } + , m_appID { parent ? parent->generateID() : QString {} } + , m_position { 0, 0 } + , m_process { nullptr } { - QStringList proArgs; - proArgs.append(m_projectPath); - proArgs.append(m_appID); + QStringList proArgs; + proArgs.append(m_projectPath); + proArgs.append(m_appID); - m_process = new QProcess(this); //PLS LESS BEHINDERT @Elias - m_process->setArguments(proArgs); + m_process = new QProcess(this); //PLS LESS BEHINDERT @Elias + m_process->setArguments(proArgs); - if (fullPath.endsWith(".exe")) { + if (fullPath.endsWith(".exe")) { m_process->setProgram(fullPath); - } else if (fullPath.endsWith(".qml")) { + } else if (fullPath.endsWith(".qml")) { m_process->setProgram(parent->settings()->getScreenPlayWidgetPath().path()); - } + } - qDebug() << m_process->program(); + qDebug() << m_process->program(); - QObject::connect(m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) { - qDebug() << "error: " << error; - }); - m_process->start(); + QObject::connect(m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) { + qDebug() << "error: " << error; + }); + m_process->start(); } ScreenPlayWidget::~ScreenPlayWidget() { - if(m_process) delete m_process; + if (m_process) + delete m_process; } const QString& ScreenPlayWidget::projectPath() const noexcept diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplay.h index a7ea0490..1de7d632 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplay.h @@ -27,36 +27,29 @@ class ScreenPlayWidget; using RefSPWall = QSharedPointer; using RefSPWidget = QSharedPointer; -class ScreenPlay final: public QObject { +class ScreenPlay final : public QObject { Q_OBJECT private: - InstalledListModel *const m_ilm{nullptr}; - Settings *const m_settings{nullptr}; - MonitorListModel *const m_mlm{nullptr}; - QGuiApplication *const m_qGuiApplication{nullptr}; - SDKConnector *const m_sdkc{nullptr}; - std::vector m_screenPlayWallpaperList; + InstalledListModel* const m_ilm { nullptr }; + Settings* const m_settings { nullptr }; + MonitorListModel* const m_mlm { nullptr }; + QGuiApplication* const m_qGuiApplication { nullptr }; + SDKConnector* const m_sdkc { nullptr }; + std::vector m_screenPlayWallpaperList; std::vector m_screenPlayWidgetList; public: // constructor(s) explicit ScreenPlay( - InstalledListModel* ilm, Settings* set, - MonitorListModel* mlm, SDKConnector* sdkc, - QObject* parent = nullptr); - - // copy and move disable(for now) : remember rule of 1/3/5 - Q_DISABLE_COPY_MOVE(ScreenPlay) - - // destructor + InstalledListModel* ilm, Settings* set, + MonitorListModel* mlm, SDKConnector* sdkc, + QObject* parent = nullptr); ~ScreenPlay(); - // getters - const InstalledListModel* listModelInstalled() const noexcept; + // copy and move disable(for now) : remember rule of 1/3/5 + //Q_DISABLE_COPY_MOVE(ScreenPlay) + const Settings* settings() const noexcept; - const MonitorListModel* monitorListModel() const noexcept; - const QGuiApplication* guiApp() const noexcept; - const SDKConnector* sdkConnector() const noexcept; const std::vector& spWallList() const noexcept; const std::vector& spWidgetList() const noexcept; @@ -67,9 +60,9 @@ signals: public slots: void createWallpaper( - const int monitorIndex, QUrl absoluteStoragePath, - const QString& previewImage, const float volume, - const QString& fillMode, const QString& type); + const int monitorIndex, QUrl absoluteStoragePath, + const QString& previewImage, const float volume, + const QString& fillMode, const QString& type); void createWidget(QUrl absoluteStoragePath, const QString& previewImage); void removeAllWallpaper() noexcept; void requestProjectSettingsListModelAt(const int index) const noexcept; @@ -85,7 +78,7 @@ public slots: \brief Used for ... */ -class ScreenPlayWallpaper final: public QObject { +class ScreenPlayWallpaper final : public QObject { Q_OBJECT Q_PROPERTY(std::vector screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged) @@ -100,22 +93,20 @@ private: QString m_previewImage; QString m_type; QString m_appID; - QProcess *m_process; + QProcess* m_process; QSharedPointer m_projectSettingsListModel; public: // constructor(s) explicit ScreenPlayWallpaper(const std::vector& screenNumber, const QString& projectPath, - const QString& previewImage, const float volume, const QString& fillMode, - const QString& type, ScreenPlay *parent = nullptr); + const QString& previewImage, const float volume, const QString& fillMode, + const QString& type, ScreenPlay* parent = nullptr); // copy and move disable(for now) : remember rule of 1/3/5 - Q_DISABLE_COPY_MOVE(ScreenPlayWallpaper) + //Q_DISABLE_COPY_MOVE(ScreenPlayWallpaper) - // destructor ~ScreenPlayWallpaper(); - // getters const std::vector& screenNumber() const noexcept; const QString& projectPath() const noexcept; const QString& previewImage() const noexcept; @@ -144,7 +135,7 @@ public slots: \brief Used for ... */ -class ScreenPlayWidget final: public QObject { +class ScreenPlayWidget final : public QObject { Q_OBJECT Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged) @@ -159,20 +150,18 @@ private: QString m_fullPath; QString m_appID; QPoint m_position; - QProcess *m_process; + QProcess* m_process; public: // constructor(s) explicit ScreenPlayWidget(const QString& projectPath, const QString& previewImage, - const QString& fullPath, ScreenPlay *parent = nullptr); + const QString& fullPath, ScreenPlay* parent = nullptr); // copy and move disable(for now) : remember rule of 1/3/5 - Q_DISABLE_COPY_MOVE(ScreenPlayWidget) + //Q_DISABLE_COPY_MOVE(ScreenPlayWidget) - // destructor ~ScreenPlayWidget(); - // getters const QString& projectPath() const noexcept; const QString& previewImage() const noexcept; const QString& fullPath() const noexcept; diff --git a/ScreenPlay/src/sdkconnector.h b/ScreenPlay/src/sdkconnector.h index 8d60311e..4f71efe1 100644 --- a/ScreenPlay/src/sdkconnector.h +++ b/ScreenPlay/src/sdkconnector.h @@ -41,14 +41,16 @@ class SDKConnection : public QObject { Q_PROPERTY(QVector monitor READ monitor WRITE setMonitor NOTIFY monitorChanged) public: - explicit SDKConnection(QLocalSocket* socket, QObject* parent = nullptr) : QObject(parent) + explicit SDKConnection(QLocalSocket* socket, QObject* parent = nullptr) + : QObject(parent) { m_socket = socket; connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead); connect(m_socket, &QLocalSocket::disconnected, this, &SDKConnection::close); } - ~SDKConnection (){ + ~SDKConnection() + { // We need to call this manually because // sometimes it wont close the connection in @@ -85,7 +87,8 @@ public slots: //Only use the first 32 chars for the appID m_appID = msg.remove("appID=").mid(0, 32); msg.remove(m_appID); - qDebug() << "###### Wallpaper width APPID created:" << "\n######" << m_appID; + qDebug() << "###### Wallpaper width APPID created:" + << "\n######" << m_appID; } else { qDebug() << "### Message from: " << m_appID << "\n###" << msg; } diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index eab8b48d..ec801c42 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -101,6 +101,13 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo m_localStoragePath = QUrl::fromUserInput(configObj.value("absoluteStoragePath").toString()); } + + if (m_qSettings.value("ScreenPlayInstalledPath").isNull()) { + m_qSettings.setValue("ScreenPlayInstalledPath", QDir::toNativeSeparators(m_localStoragePath.toString().remove("file:///"))); + m_qSettings.sync(); + } + + m_ilm->setabsoluteStoragePath(m_localStoragePath); m_plm->m_localStoragePath = m_localStoragePath; diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index d0144adc..9cb45a0a 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -35,6 +35,7 @@ #ifdef Q_OS_WIN #include #endif + /*! \class Settings \brief Used for: @@ -98,9 +99,6 @@ public: return m_activeWallpaperCounter; } - QUrl getScreenPlayWindowPath() const; - void setScreenPlayWindowPath(const QUrl& screenPlayWindowPath); - bool pauseWallpaperWhenIngame() const { return m_pauseWallpaperWhenIngame; @@ -111,6 +109,9 @@ public: return m_offlineMode; } + QUrl getScreenPlayWindowPath() const; + void setScreenPlayWindowPath(const QUrl& screenPlayWindowPath); + QUrl getScreenPlayBasePath() const; void setScreenPlayBasePath(QUrl screenPlayBasePath); @@ -118,6 +119,7 @@ public: void setScreenPlayWidgetPath(const QUrl& screenPlayWidgetPath); bool getOfflineMode() const; + void loadActiveProfiles(); signals: void autostartChanged(bool autostart); From fe660f6a0a7693f81dab45f97511bd309a079398 Mon Sep 17 00:00:00 2001 From: Elias Date: Sat, 27 Apr 2019 15:35:19 +0200 Subject: [PATCH 03/15] Add vcpkg --- .gitmodules | 3 +++ Common/vcpkg | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 2d2f882a..769867ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "ScreenPlay/ThirdParty/stomt-qt-sdk"] path = ScreenPlay/ThirdParty/stomt-qt-sdk url = https://github.com/Aimber/stomt-qt-sdk.git +[submodule "Common/vcpkg"] + path = Common/vcpkg + url = https://github.com/Microsoft/vcpkg.git diff --git a/Common/vcpkg b/Common/vcpkg index 0619aaec..745a0aea 160000 --- a/Common/vcpkg +++ b/Common/vcpkg @@ -1 +1 @@ -Subproject commit 0619aaec650861d2a15a91cbbf11e0c626a1cf12 +Subproject commit 745a0aea597771a580d0b0f4886ea1e3a94dbca6 From 736f2e7f7f7bcd3f6ab511b45d704da4a5a7552b Mon Sep 17 00:00:00 2001 From: JeJo Date: Sun, 28 Apr 2019 18:45:42 +0200 Subject: [PATCH 04/15] seperation of wallpaper and widget classes --- ScreenPlay/ScreenPlay.pro | 4 + ScreenPlay/src/screenplay.cpp | 353 +++++-------------------- ScreenPlay/src/screenplay.h | 140 +--------- ScreenPlay/src/screenplaywallpaper.cpp | 125 +++++++++ ScreenPlay/src/screenplaywallpaper.h | 67 +++++ ScreenPlay/src/screenplaywidget.cpp | 110 ++++++++ ScreenPlay/src/screenplaywidget.h | 60 +++++ ScreenPlay/src/settings.h | 1 + 8 files changed, 446 insertions(+), 414 deletions(-) create mode 100644 ScreenPlay/src/screenplaywallpaper.cpp create mode 100644 ScreenPlay/src/screenplaywallpaper.h create mode 100644 ScreenPlay/src/screenplaywidget.cpp create mode 100644 ScreenPlay/src/screenplaywidget.h diff --git a/ScreenPlay/ScreenPlay.pro b/ScreenPlay/ScreenPlay.pro index c62b7805..ad3cc98b 100644 --- a/ScreenPlay/ScreenPlay.pro +++ b/ScreenPlay/ScreenPlay.pro @@ -13,6 +13,8 @@ SOURCES += main.cpp \ src/createimportvideo.cpp \ src/installedlistmodel.cpp \ src/monitorlistmodel.cpp \ + src/screenplaywallpaper.cpp \ + src/screenplaywidget.cpp \ src/settings.cpp \ src/profilelistmodel.cpp \ src/profile.cpp \ @@ -34,6 +36,8 @@ HEADERS += \ src/createimportvideo.h \ src/installedlistmodel.h \ src/monitorlistmodel.h \ + src/screenplaywallpaper.h \ + src/screenplaywidget.h \ src/settings.h \ src/profilelistmodel.h \ src/profile.h \ diff --git a/ScreenPlay/src/screenplay.cpp b/ScreenPlay/src/screenplay.cpp index 22aca27a..7ec00b24 100644 --- a/ScreenPlay/src/screenplay.cpp +++ b/ScreenPlay/src/screenplay.cpp @@ -1,37 +1,45 @@ #include "screenplay.h" +#include "screenplaywallpaper.h" +#include "screenplaywidget.h" ScreenPlay::ScreenPlay(InstalledListModel* ilm, Settings* set, MonitorListModel* mlm, SDKConnector* sdkc, QObject* parent) - : QObject{parent}, - m_ilm{ilm}, - m_settings{set}, - m_mlm{mlm}, - m_qGuiApplication{static_cast(QGuiApplication::instance())}, - m_sdkc{sdkc} -{} + : QObject { parent } + , m_ilm { ilm } + , m_settings { set } + , m_mlm { mlm } + , m_qGuiApplication { static_cast(QGuiApplication::instance()) } + , m_sdkc { sdkc } +{ +} ScreenPlay::~ScreenPlay() { - if(m_ilm) delete m_ilm; - if(m_settings) delete m_settings; - if(m_mlm) delete m_mlm; - if(m_qGuiApplication) delete m_qGuiApplication; - if(m_sdkc) delete m_sdkc; + if (m_ilm) + delete m_ilm; + if (m_settings) + delete m_settings; + if (m_mlm) + delete m_mlm; + if (m_qGuiApplication) + delete m_qGuiApplication; + if (m_sdkc) + delete m_sdkc; } const InstalledListModel* ScreenPlay::listModelInstalled() const noexcept { return m_ilm; } -const Settings* ScreenPlay::settings() const noexcept { return m_settings; } -const MonitorListModel* ScreenPlay::monitorListModel() const noexcept { return m_mlm; } -const QGuiApplication* ScreenPlay::guiApp() const noexcept { return m_qGuiApplication; } +const Settings* ScreenPlay::settings() const noexcept { return m_settings; } +const MonitorListModel* ScreenPlay::monitorListModel() const noexcept { return m_mlm; } +const QGuiApplication* ScreenPlay::guiApp() const noexcept { return m_qGuiApplication; } const SDKConnector* ScreenPlay::sdkConnector() const noexcept { return m_sdkc; } const std::vector& ScreenPlay::spWallList() const noexcept { return m_screenPlayWallpaperList; } const std::vector& ScreenPlay::spWidgetList() const noexcept { return m_screenPlayWidgetList; } void ScreenPlay::createWallpaper( - const int monitorIndex, QUrl absoluteStoragePath, - const QString& previewImage, const float volume, - const QString& fillMode, const QString& type) + const int monitorIndex, QUrl absoluteStoragePath, + const QString& previewImage, const float volume, + const QString& fillMode, const QString& type) { - ProjectFile project{}; + ProjectFile project {}; if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { return; } @@ -41,32 +49,30 @@ void ScreenPlay::createWallpaper( m_settings->increaseActiveWallpaperCounter(); m_screenPlayWallpaperList.emplace_back( - RefSPWall::create( - std::vector{monitorIndex}, absoluteStoragePath.toLocalFile(), - previewImage, volume, fillMode, type, this) - ); + RefSPWall::create( + std::vector { monitorIndex }, absoluteStoragePath.toLocalFile(), + previewImage, volume, fillMode, type, this)); m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), - QString{absoluteStoragePath.toLocalFile() + "/" + previewImage}); + QString { absoluteStoragePath.toLocalFile() + "/" + previewImage }); } void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewImage) { - ProjectFile project{}; + ProjectFile project {}; if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { return; } m_screenPlayWidgetList.emplace_back( - RefSPWidget::create( - absoluteStoragePath.toLocalFile(), previewImage, - QString{absoluteStoragePath.toLocalFile() + "/" + project.m_file.toString()}, - this) - ); + RefSPWidget::create( + absoluteStoragePath.toLocalFile(), previewImage, + QString { absoluteStoragePath.toLocalFile() + "/" + project.m_file.toString() }, + this)); } void ScreenPlay::removeAllWallpaper() noexcept { - if(m_sdkc && m_settings && !m_screenPlayWallpaperList.empty()){ + if (m_sdkc && m_settings && !m_screenPlayWallpaperList.empty()) { m_sdkc->closeAllWallpapers(); m_settings->setActiveWallpaperCounter(0); m_screenPlayWallpaperList.clear(); @@ -77,12 +83,11 @@ void ScreenPlay::removeAllWallpaper() noexcept void ScreenPlay::requestProjectSettingsListModelAt(const int index) const noexcept { - for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) { - if (!refSPWallpaper.data()->screenNumber().empty() && - refSPWallpaper.data()->screenNumber()[0] == index) { // ??? only at index == 0 + for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { + if (!refSPWallpaper.data()->screenNumber().empty() && refSPWallpaper.data()->screenNumber()[0] == index) { // ??? only at index == 0 emit projectSettingsListModelFound( - refSPWallpaper.data()->projectSettingsListModel().data(), - refSPWallpaper.data()->type()); + refSPWallpaper.data()->projectSettingsListModel().data(), + refSPWallpaper.data()->type()); return; } } @@ -92,9 +97,8 @@ void ScreenPlay::requestProjectSettingsListModelAt(const int index) const noexce void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) noexcept { Q_ASSERT(static_cast(at) < m_screenPlayWallpaperList.size() && m_sdkc); - for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) { - if (!refSPWallpaper.data()->screenNumber().empty() && m_sdkc && - refSPWallpaper.data()->screenNumber()[0] == at) { // ??? only at index == 0 + for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { + if (!refSPWallpaper.data()->screenNumber().empty() && m_sdkc && refSPWallpaper.data()->screenNumber()[0] == at) { // ??? only at index == 0 m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value); return; } @@ -104,8 +108,9 @@ void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QStri void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) noexcept { Q_ASSERT(m_sdkc); - for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) { - if(m_sdkc) m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value); + for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { + if (m_sdkc) + m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value); } } @@ -113,41 +118,42 @@ void ScreenPlay::removeWallpaperAt(const int at) { // Q_ASSERT(at < m_screenPlayWallpaperList.size() && m_sdkc); qDebug() << "No of walls in list: " << m_screenPlayWallpaperList.size(); - if(m_screenPlayWallpaperList.empty()) return; // done here; + if (m_screenPlayWallpaperList.empty()) + return; // done here; const auto toRemove = std::remove_if( - m_screenPlayWallpaperList.begin(), m_screenPlayWallpaperList.end(), - [&](const RefSPWall& refSPWallpaper) noexcept ->bool { - const std::vector& screenNumber = refSPWallpaper->screenNumber(); - qDebug() << "Screen No. :" << screenNumber.size(); - const bool isFound = !screenNumber.empty();// && screenNumber[0] == at; - if(isFound) { - // m_mlm - m_sdkc->closeWallpapersAt(at); // for waht ??? - m_settings->decreaseActiveWallpaperCounter(); - qDebug() << "current wall count... " << m_settings->activeWallpaperCounter(); - } - return isFound; - }); + m_screenPlayWallpaperList.begin(), m_screenPlayWallpaperList.end(), + [&](const RefSPWall& refSPWallpaper) noexcept->bool { + const std::vector& screenNumber = refSPWallpaper->screenNumber(); + qDebug() << "Screen No. :" << screenNumber.size(); + const bool isFound = !screenNumber.empty(); // && screenNumber[0] == at; + if (isFound) { + // m_mlm + m_sdkc->closeWallpapersAt(at); // for waht ??? + m_settings->decreaseActiveWallpaperCounter(); + qDebug() << "current wall count... " << m_settings->activeWallpaperCounter(); + } + return isFound; + }); m_screenPlayWallpaperList.erase(toRemove, m_screenPlayWallpaperList.end()); qDebug() << "After removing: No of walls in list: " << m_screenPlayWallpaperList.size(); - } std::vector ScreenPlay::getMonitorByAppID(const QString& appID) const { - for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) { + for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { if (refSPWallpaper.data()->appID() == appID) { return refSPWallpaper.data()->screenNumber(); } } - return std::vector{}; + return std::vector {}; } QString ScreenPlay::generateID() const { - const QString possibleCharacters{ - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}; + const QString possibleCharacters { + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + }; const int randomStringLength = 32; const auto radomGen = QRandomGenerator::system(); @@ -159,230 +165,3 @@ QString ScreenPlay::generateID() const } return randomString; } - - -ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector& screenNumber, const QString& projectPath, - const QString& previewImage, const float volume, - const QString& fillMode, const QString& type, ScreenPlay *parent) - : QObject{parent}, - m_screenNumber{std::move(screenNumber)}, - m_projectPath{projectPath}, - m_previewImage{previewImage}, - m_type{type}, - m_appID{ parent ? parent->generateID() : QString{} }, - m_process{nullptr}, - m_projectSettingsListModel{QSharedPointer::create(projectPath + "/project.json")} -{ - QStringList proArgs; - proArgs.append(QString::number(m_screenNumber.empty() ? 0 : m_screenNumber[0])); - proArgs.append(m_projectPath); - proArgs.append("appID=" + m_appID); - proArgs.append(parent ? parent->settings()->decoder() : QString{}); - proArgs.append(QString::number(static_cast(volume))); - proArgs.append(fillMode); - - qDebug() << proArgs; - - // We do not want to parent the QProcess because the - // Process manages its lifetime and destructing (animation) itself - // via a disconnection from the ScreenPlay SDK - QProcess* m_process = new QProcess(); - - QObject::connect(m_process, QOverload::of(&QProcess::finished), - [=](int exitCode, QProcess::ExitStatus exitStatus) - { - if (exitCode != 0) - qDebug() << "WARNING EXIT CODE: " << exitCode; - }); - QObject::connect(m_process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) { - qDebug() << "EX: " << error; - }); - - m_process->setArguments(proArgs); - m_process->setProgram(parent->settings()->screenPlayWindowPath().toString()); - m_process->start(); -} - -ScreenPlayWallpaper::~ScreenPlayWallpaper() -{ - if(m_process) delete m_process; -} - -const std::vector& ScreenPlayWallpaper::screenNumber() const noexcept -{ - return m_screenNumber; -} - -const QString& ScreenPlayWallpaper::projectPath() const noexcept -{ - return m_projectPath; -} - -const QString& ScreenPlayWallpaper::previewImage() const noexcept -{ - return m_previewImage; -} - -const QString& ScreenPlayWallpaper::type() const noexcept -{ - return m_type; -} - -const QString& ScreenPlayWallpaper::appID() const noexcept -{ - return m_appID; -} - -const QSharedPointer& ScreenPlayWallpaper::projectSettingsListModel() const noexcept -{ - return m_projectSettingsListModel; -} - -void ScreenPlayWallpaper::setScreenNumber(const std::vector& screenNumber) noexcept -{ - if (m_screenNumber == screenNumber) - return; - m_screenNumber = screenNumber; - emit screenNumberChanged(m_screenNumber); -} - -void ScreenPlayWallpaper::setProjectPath(const QString& projectPath) noexcept -{ - if (m_projectPath == projectPath) - return; - - m_projectPath = projectPath; - emit projectPathChanged(m_projectPath); -} - -void ScreenPlayWallpaper::setPreviewImage(const QString& previewImage) noexcept -{ - if (m_previewImage == previewImage) - return; - - m_previewImage = previewImage; - emit previewImageChanged(m_previewImage); -} - -void ScreenPlayWallpaper::setType(const QString& type) noexcept -{ - if (m_type == type) - return; - - m_type = type; - emit typeChanged(m_type); -} - -void ScreenPlayWallpaper::setAppID(const QString& appID) noexcept -{ - if (m_appID == appID) - return; - - m_appID = appID; - emit appIDChanged(m_appID); -} - -ScreenPlayWidget::ScreenPlayWidget(const QString& projectPath, const QString& previewImage, - const QString& fullPath, ScreenPlay *parent) - : m_projectPath{projectPath}, - m_previewImage{previewImage}, - m_fullPath{fullPath}, - m_appID{parent ? parent->generateID() : QString{}}, - m_position{0, 0}, - m_process{nullptr} -{ - QStringList proArgs; - proArgs.append(m_projectPath); - proArgs.append(m_appID); - - m_process = new QProcess(this); //PLS LESS BEHINDERT @Elias - m_process->setArguments(proArgs); - - if (fullPath.endsWith(".exe")) { - m_process->setProgram(fullPath); - } else if (fullPath.endsWith(".qml")) { - m_process->setProgram(parent->settings()->getScreenPlayWidgetPath().path()); - } - - qDebug() << m_process->program(); - - QObject::connect(m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) { - qDebug() << "error: " << error; - }); - m_process->start(); -} - -ScreenPlayWidget::~ScreenPlayWidget() -{ - if(m_process) delete m_process; -} - -const QString& ScreenPlayWidget::projectPath() const noexcept -{ - return m_projectPath; -} - -const QString& ScreenPlayWidget::previewImage() const noexcept -{ - return m_previewImage; -} - -const QString& ScreenPlayWidget::fullPath() const noexcept -{ - return m_fullPath; -} - -const QString& ScreenPlayWidget::appID() const noexcept -{ - return m_appID; -} - -const QPoint& ScreenPlayWidget::position() const noexcept -{ - return m_position; -} - -void ScreenPlayWidget::setProjectPath(const QString& projectPath) noexcept -{ - if (m_projectPath == projectPath) - return; - - m_projectPath = projectPath; - emit projectPathChanged(m_projectPath); -} - -void ScreenPlayWidget::setPreviewImage(const QString& previewImage) noexcept -{ - if (m_previewImage == previewImage) - return; - - m_previewImage = previewImage; - emit previewImageChanged(m_previewImage); -} - -void ScreenPlayWidget::setFullPath(const QString& fullPath) noexcept -{ - if (m_fullPath == fullPath) - return; - - m_fullPath = fullPath; - emit fullPathChanged(m_fullPath); -} - -void ScreenPlayWidget::setAppID(const QString& appID) noexcept -{ - if (m_appID == appID) - return; - - m_appID = appID; - emit appIDChanged(m_appID); -} - -void ScreenPlayWidget::setPosition(const QPoint& position) noexcept -{ - if (m_position == position) - return; - - m_position = position; - emit positionChanged(m_position); -} diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplay.h index a7ea0490..8ac867d2 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplay.h @@ -27,23 +27,23 @@ class ScreenPlayWidget; using RefSPWall = QSharedPointer; using RefSPWidget = QSharedPointer; -class ScreenPlay final: public QObject { +class ScreenPlay final : public QObject { Q_OBJECT private: - InstalledListModel *const m_ilm{nullptr}; - Settings *const m_settings{nullptr}; - MonitorListModel *const m_mlm{nullptr}; - QGuiApplication *const m_qGuiApplication{nullptr}; - SDKConnector *const m_sdkc{nullptr}; - std::vector m_screenPlayWallpaperList; + InstalledListModel* const m_ilm { nullptr }; + Settings* const m_settings { nullptr }; + MonitorListModel* const m_mlm { nullptr }; + QGuiApplication* const m_qGuiApplication { nullptr }; + SDKConnector* const m_sdkc { nullptr }; + std::vector m_screenPlayWallpaperList; std::vector m_screenPlayWidgetList; public: // constructor(s) explicit ScreenPlay( - InstalledListModel* ilm, Settings* set, - MonitorListModel* mlm, SDKConnector* sdkc, - QObject* parent = nullptr); + InstalledListModel* ilm, Settings* set, + MonitorListModel* mlm, SDKConnector* sdkc, + QObject* parent = nullptr); // copy and move disable(for now) : remember rule of 1/3/5 Q_DISABLE_COPY_MOVE(ScreenPlay) @@ -67,9 +67,9 @@ signals: public slots: void createWallpaper( - const int monitorIndex, QUrl absoluteStoragePath, - const QString& previewImage, const float volume, - const QString& fillMode, const QString& type); + const int monitorIndex, QUrl absoluteStoragePath, + const QString& previewImage, const float volume, + const QString& fillMode, const QString& type); void createWidget(QUrl absoluteStoragePath, const QString& previewImage); void removeAllWallpaper() noexcept; void requestProjectSettingsListModelAt(const int index) const noexcept; @@ -79,117 +79,3 @@ public slots: std::vector getMonitorByAppID(const QString& appID) const; QString generateID() const; }; - -/*! - \class ScreenPlayWallpaper - \brief Used for ... -*/ - -class ScreenPlayWallpaper final: public QObject { - Q_OBJECT - - Q_PROPERTY(std::vector screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged) - Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged) - Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged) - Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) - Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) - -private: - std::vector m_screenNumber; - QString m_projectPath; - QString m_previewImage; - QString m_type; - QString m_appID; - QProcess *m_process; - QSharedPointer m_projectSettingsListModel; - -public: - // constructor(s) - explicit ScreenPlayWallpaper(const std::vector& screenNumber, const QString& projectPath, - const QString& previewImage, const float volume, const QString& fillMode, - const QString& type, ScreenPlay *parent = nullptr); - - // copy and move disable(for now) : remember rule of 1/3/5 - Q_DISABLE_COPY_MOVE(ScreenPlayWallpaper) - - // destructor - ~ScreenPlayWallpaper(); - - // getters - const std::vector& screenNumber() const noexcept; - const QString& projectPath() const noexcept; - const QString& previewImage() const noexcept; - const QString& type() const noexcept; - const QString& appID() const noexcept; - const QSharedPointer& projectSettingsListModel() const noexcept; - -signals: - void screenNumberChanged(std::vector screenNumber) const; - void projectPathChanged(QString projectPath) const; - void previewImageChanged(QString previewImage) const; - void typeChanged(QString type) const; - void appIDChanged(QString appID) const; - //void projectSettingsListModelAt(ProjectSettingsListModel* li); ??? not used - -public slots: - void setScreenNumber(const std::vector& screenNumber) noexcept; - void setProjectPath(const QString& projectPath) noexcept; - void setPreviewImage(const QString& previewImage) noexcept; - void setType(const QString& type) noexcept; - void setAppID(const QString& appID) noexcept; -}; - -/*! - \class ScreenPlayWidget - \brief Used for ... -*/ - -class ScreenPlayWidget final: public QObject { - Q_OBJECT - - Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged) - Q_PROPERTY(QString fullPath READ fullPath WRITE setFullPath NOTIFY fullPathChanged) - Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged) - Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged) - Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) - -private: - QString m_projectPath; - QString m_previewImage; - QString m_fullPath; - QString m_appID; - QPoint m_position; - QProcess *m_process; - -public: - // constructor(s) - explicit ScreenPlayWidget(const QString& projectPath, const QString& previewImage, - const QString& fullPath, ScreenPlay *parent = nullptr); - - // copy and move disable(for now) : remember rule of 1/3/5 - Q_DISABLE_COPY_MOVE(ScreenPlayWidget) - - // destructor - ~ScreenPlayWidget(); - - // getters - const QString& projectPath() const noexcept; - const QString& previewImage() const noexcept; - const QString& fullPath() const noexcept; - const QString& appID() const noexcept; - const QPoint& position() const noexcept; - -signals: - void projectPathChanged(QString projectPath) const; - void previewImageChanged(QString previewImage) const; - void fullPathChanged(QString fullPath) const; - void appIDChanged(QString appID) const; - void positionChanged(QPoint position) const; - -public slots: - void setProjectPath(const QString& projectPath) noexcept; - void setPreviewImage(const QString& previewImage) noexcept; - void setFullPath(const QString& fullPath) noexcept; - void setAppID(const QString& appID) noexcept; - void setPosition(const QPoint& position) noexcept; -}; diff --git a/ScreenPlay/src/screenplaywallpaper.cpp b/ScreenPlay/src/screenplaywallpaper.cpp new file mode 100644 index 00000000..f764f9fa --- /dev/null +++ b/ScreenPlay/src/screenplaywallpaper.cpp @@ -0,0 +1,125 @@ +#include "screenplay.h" +#include "screenplaywallpaper.h" + +#include + +ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector& screenNumber, const QString& projectPath, + const QString& previewImage, const float volume, + const QString& fillMode, const QString& type, ScreenPlay* parent) + : QObject { parent } + , m_screenNumber { std::move(screenNumber) } + , m_projectPath { projectPath } + , m_previewImage { previewImage } + , m_type { type } + , m_appID { parent ? parent->generateID() : QString {} } + , m_process { nullptr } + , m_projectSettingsListModel { QSharedPointer::create(projectPath + "/project.json") } +{ + QStringList proArgs; + proArgs.append(QString::number(m_screenNumber.empty() ? 0 : m_screenNumber[0])); + proArgs.append(m_projectPath); + proArgs.append("appID=" + m_appID); + proArgs.append(parent ? parent->settings()->decoder() : QString {}); + proArgs.append(QString::number(static_cast(volume))); + proArgs.append(fillMode); + + qDebug() << proArgs; + + // We do not want to parent the QProcess because the + // Process manages its lifetime and destructing (animation) itself + // via a disconnection from the ScreenPlay SDK + QProcess* m_process = new QProcess(); + + QObject::connect(m_process, QOverload::of(&QProcess::finished), + [=](int exitCode, QProcess::ExitStatus exitStatus) { + if (exitCode != 0) + qDebug() << "WARNING EXIT CODE: " << exitCode; + }); + QObject::connect(m_process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) { + qDebug() << "EX: " << error; + }); + + m_process->setArguments(proArgs); + m_process->setProgram(parent->settings()->screenPlayWindowPath().toString()); + m_process->start(); +} + +ScreenPlayWallpaper::~ScreenPlayWallpaper() +{ + if (m_process) + delete m_process; +} + +const std::vector& ScreenPlayWallpaper::screenNumber() const noexcept +{ + return m_screenNumber; +} + +const QString& ScreenPlayWallpaper::projectPath() const noexcept +{ + return m_projectPath; +} + +const QString& ScreenPlayWallpaper::previewImage() const noexcept +{ + return m_previewImage; +} + +const QString& ScreenPlayWallpaper::type() const noexcept +{ + return m_type; +} + +const QString& ScreenPlayWallpaper::appID() const noexcept +{ + return m_appID; +} + +const QSharedPointer& ScreenPlayWallpaper::projectSettingsListModel() const noexcept +{ + return m_projectSettingsListModel; +} + +void ScreenPlayWallpaper::setScreenNumber(const std::vector& screenNumber) noexcept +{ + if (m_screenNumber == screenNumber) + return; + m_screenNumber = screenNumber; + emit screenNumberChanged(m_screenNumber); +} + +void ScreenPlayWallpaper::setProjectPath(const QString& projectPath) noexcept +{ + if (m_projectPath == projectPath) + return; + + m_projectPath = projectPath; + emit projectPathChanged(m_projectPath); +} + +void ScreenPlayWallpaper::setPreviewImage(const QString& previewImage) noexcept +{ + if (m_previewImage == previewImage) + return; + + m_previewImage = previewImage; + emit previewImageChanged(m_previewImage); +} + +void ScreenPlayWallpaper::setType(const QString& type) noexcept +{ + if (m_type == type) + return; + + m_type = type; + emit typeChanged(m_type); +} + +void ScreenPlayWallpaper::setAppID(const QString& appID) noexcept +{ + if (m_appID == appID) + return; + + m_appID = appID; + emit appIDChanged(m_appID); +} diff --git a/ScreenPlay/src/screenplaywallpaper.h b/ScreenPlay/src/screenplaywallpaper.h new file mode 100644 index 00000000..a2e3d8cf --- /dev/null +++ b/ScreenPlay/src/screenplaywallpaper.h @@ -0,0 +1,67 @@ +#pragma once + +#include + +#include "projectsettingslistmodel.h" + +/*! + \class ScreenPlayWallpaper + \brief Used for ... +*/ + +class ScreenPlay; +class QProcess; + +class ScreenPlayWallpaper final : public QObject { + Q_OBJECT + + Q_PROPERTY(std::vector screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged) + Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged) + Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged) + Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) + Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) + +private: + std::vector m_screenNumber; + QString m_projectPath; + QString m_previewImage; + QString m_type; + QString m_appID; + QProcess* m_process; + QSharedPointer m_projectSettingsListModel; + +public: + // constructor(s) + explicit ScreenPlayWallpaper(const std::vector& screenNumber, const QString& projectPath, + const QString& previewImage, const float volume, const QString& fillMode, + const QString& type, ScreenPlay* parent = nullptr); + + // copy and move disable(for now) : remember rule of 1/3/5 + Q_DISABLE_COPY_MOVE(ScreenPlayWallpaper) + + // destructor + ~ScreenPlayWallpaper(); + + // getters + const std::vector& screenNumber() const noexcept; + const QString& projectPath() const noexcept; + const QString& previewImage() const noexcept; + const QString& type() const noexcept; + const QString& appID() const noexcept; + const QSharedPointer& projectSettingsListModel() const noexcept; + +signals: + void screenNumberChanged(std::vector screenNumber) const; + void projectPathChanged(QString projectPath) const; + void previewImageChanged(QString previewImage) const; + void typeChanged(QString type) const; + void appIDChanged(QString appID) const; + //void projectSettingsListModelAt(ProjectSettingsListModel* li); ??? not used + +public slots: + void setScreenNumber(const std::vector& screenNumber) noexcept; + void setProjectPath(const QString& projectPath) noexcept; + void setPreviewImage(const QString& previewImage) noexcept; + void setType(const QString& type) noexcept; + void setAppID(const QString& appID) noexcept; +}; diff --git a/ScreenPlay/src/screenplaywidget.cpp b/ScreenPlay/src/screenplaywidget.cpp new file mode 100644 index 00000000..e92a0948 --- /dev/null +++ b/ScreenPlay/src/screenplaywidget.cpp @@ -0,0 +1,110 @@ +#include "screenplay.h" +#include "screenplaywidget.h" + +#include + +ScreenPlayWidget::ScreenPlayWidget(const QString& projectPath, const QString& previewImage, + const QString& fullPath, ScreenPlay* parent) + : m_projectPath { projectPath } + , m_previewImage { previewImage } + , m_fullPath { fullPath } + , m_appID { parent ? parent->generateID() : QString {} } + , m_position { 0, 0 } + , m_process { nullptr } +{ + QStringList proArgs; + proArgs.append(m_projectPath); + proArgs.append(m_appID); + + m_process = new QProcess(this); //PLS LESS BEHINDERT @Elias + m_process->setArguments(proArgs); + + if (fullPath.endsWith(".exe")) { + m_process->setProgram(fullPath); + } else if (fullPath.endsWith(".qml")) { + m_process->setProgram(parent->settings()->getScreenPlayWidgetPath().path()); + } + + qDebug() << m_process->program(); + + QObject::connect(m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) { + qDebug() << "error: " << error; + }); + m_process->start(); +} + +ScreenPlayWidget::~ScreenPlayWidget() +{ + if (m_process) + delete m_process; +} + +const QString& ScreenPlayWidget::projectPath() const noexcept +{ + return m_projectPath; +} + +const QString& ScreenPlayWidget::previewImage() const noexcept +{ + return m_previewImage; +} + +const QString& ScreenPlayWidget::fullPath() const noexcept +{ + return m_fullPath; +} + +const QString& ScreenPlayWidget::appID() const noexcept +{ + return m_appID; +} + +const QPoint& ScreenPlayWidget::position() const noexcept +{ + return m_position; +} + +void ScreenPlayWidget::setProjectPath(const QString& projectPath) noexcept +{ + if (m_projectPath == projectPath) + return; + + m_projectPath = projectPath; + emit projectPathChanged(m_projectPath); +} + +void ScreenPlayWidget::setPreviewImage(const QString& previewImage) noexcept +{ + if (m_previewImage == previewImage) + return; + + m_previewImage = previewImage; + emit previewImageChanged(m_previewImage); +} + +void ScreenPlayWidget::setFullPath(const QString& fullPath) noexcept +{ + if (m_fullPath == fullPath) + return; + + m_fullPath = fullPath; + emit fullPathChanged(m_fullPath); +} + +void ScreenPlayWidget::setAppID(const QString& appID) noexcept +{ + if (m_appID == appID) + return; + + m_appID = appID; + emit appIDChanged(m_appID); +} + +void ScreenPlayWidget::setPosition(const QPoint& position) noexcept +{ + if (m_position == position) + return; + + m_position = position; + emit positionChanged(m_position); +} diff --git a/ScreenPlay/src/screenplaywidget.h b/ScreenPlay/src/screenplaywidget.h new file mode 100644 index 00000000..adefbe5e --- /dev/null +++ b/ScreenPlay/src/screenplaywidget.h @@ -0,0 +1,60 @@ +#pragma once + +#include + +/*! + \class ScreenPlayWidget + \brief Used for ... +*/ +class ScreenPlay; +class QProcess; + +class ScreenPlayWidget final : public QObject { + Q_OBJECT + + Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged) + Q_PROPERTY(QString fullPath READ fullPath WRITE setFullPath NOTIFY fullPathChanged) + Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged) + Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged) + Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) + +private: + QString m_projectPath; + QString m_previewImage; + QString m_fullPath; + QString m_appID; + QPoint m_position; + QProcess* m_process; + +public: + // constructor(s) + explicit ScreenPlayWidget(const QString& projectPath, const QString& previewImage, + const QString& fullPath, ScreenPlay* parent = nullptr); + + // copy and move disable(for now) : remember rule of 1/3/5 + Q_DISABLE_COPY_MOVE(ScreenPlayWidget) + + // destructor + ~ScreenPlayWidget(); + + // getters + const QString& projectPath() const noexcept; + const QString& previewImage() const noexcept; + const QString& fullPath() const noexcept; + const QString& appID() const noexcept; + const QPoint& position() const noexcept; + +signals: + void projectPathChanged(QString projectPath) const; + void previewImageChanged(QString previewImage) const; + void fullPathChanged(QString fullPath) const; + void appIDChanged(QString appID) const; + void positionChanged(QPoint position) const; + +public slots: + void setProjectPath(const QString& projectPath) noexcept; + void setPreviewImage(const QString& previewImage) noexcept; + void setFullPath(const QString& fullPath) noexcept; + void setAppID(const QString& appID) noexcept; + void setPosition(const QPoint& position) noexcept; +}; diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index d0144adc..30fa135f 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -290,6 +290,7 @@ public slots: emit offlineModeChanged(m_offlineMode); } + void loadActiveProfiles(); private: void createDefaultConfig(); void setupWidgetAndWindowPaths(); From 355beb1bd55f31c01e36834afc3c1ac9621bfdb2 Mon Sep 17 00:00:00 2001 From: JeJo Date: Sat, 4 May 2019 22:32:13 +0200 Subject: [PATCH 05/15] ScreenPlay Q_DISABLE_COPY_MOVE() macro fix --- ScreenPlay/src/screenplay.h | 6 ++++-- ScreenPlay/src/screenplaywallpaper.h | 4 +++- ScreenPlay/src/screenplaywidget.h | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplay.h index 8ac867d2..19be9983 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplay.h @@ -45,8 +45,10 @@ public: MonitorListModel* mlm, SDKConnector* sdkc, QObject* parent = nullptr); - // copy and move disable(for now) : remember rule of 1/3/5 - Q_DISABLE_COPY_MOVE(ScreenPlay) + // copy and move disabled(for now) : remember rule of 1/3/5 + Q_DISABLE_COPY(ScreenPlay) + ScreenPlay(ScreenPlay&&) = delete; + ScreenPlay& operator=(ScreenPlay&&) = delete; // destructor ~ScreenPlay(); diff --git a/ScreenPlay/src/screenplaywallpaper.h b/ScreenPlay/src/screenplaywallpaper.h index a2e3d8cf..21efdbe2 100644 --- a/ScreenPlay/src/screenplaywallpaper.h +++ b/ScreenPlay/src/screenplaywallpaper.h @@ -37,7 +37,9 @@ public: const QString& type, ScreenPlay* parent = nullptr); // copy and move disable(for now) : remember rule of 1/3/5 - Q_DISABLE_COPY_MOVE(ScreenPlayWallpaper) + Q_DISABLE_COPY(ScreenPlayWallpaper) + ScreenPlayWallpaper(ScreenPlayWallpaper&& rhs); + ScreenPlayWallpaper& operator=(ScreenPlayWallpaper&& rhs); // destructor ~ScreenPlayWallpaper(); diff --git a/ScreenPlay/src/screenplaywidget.h b/ScreenPlay/src/screenplaywidget.h index adefbe5e..262da31f 100644 --- a/ScreenPlay/src/screenplaywidget.h +++ b/ScreenPlay/src/screenplaywidget.h @@ -32,7 +32,10 @@ public: const QString& fullPath, ScreenPlay* parent = nullptr); // copy and move disable(for now) : remember rule of 1/3/5 - Q_DISABLE_COPY_MOVE(ScreenPlayWidget) + //Q_DISABLE_COPY_MOVE(ScreenPlayWidget) + Q_DISABLE_COPY(ScreenPlayWidget) + ScreenPlayWidget(ScreenPlayWidget&&) = delete; + ScreenPlayWidget& operator=(ScreenPlayWidget&&) = delete; // destructor ~ScreenPlayWidget(); From d5705e9c901695b93ca3206df9f8c8acce6d9ff8 Mon Sep 17 00:00:00 2001 From: JeJo Date: Sat, 4 May 2019 22:33:53 +0200 Subject: [PATCH 06/15] ScreenPlay using std::unique_ptr<> --- ScreenPlay/src/screenplay.cpp | 66 +++++++++++++++++------------------ ScreenPlay/src/screenplay.h | 12 +++---- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ScreenPlay/src/screenplay.cpp b/ScreenPlay/src/screenplay.cpp index 7ec00b24..5dd1bd8a 100644 --- a/ScreenPlay/src/screenplay.cpp +++ b/ScreenPlay/src/screenplay.cpp @@ -31,8 +31,8 @@ const Settings* ScreenPlay::settings() const noexcept { return m_settings; } const MonitorListModel* ScreenPlay::monitorListModel() const noexcept { return m_mlm; } const QGuiApplication* ScreenPlay::guiApp() const noexcept { return m_qGuiApplication; } const SDKConnector* ScreenPlay::sdkConnector() const noexcept { return m_sdkc; } -const std::vector& ScreenPlay::spWallList() const noexcept { return m_screenPlayWallpaperList; } -const std::vector& ScreenPlay::spWidgetList() const noexcept { return m_screenPlayWidgetList; } +const std::vector& ScreenPlay::spWallList() const noexcept { return m_screenPlayWallpapers; } +const std::vector& ScreenPlay::spWidgetList() const noexcept { return m_screenPlayWidgets; } void ScreenPlay::createWallpaper( const int monitorIndex, QUrl absoluteStoragePath, @@ -48,8 +48,8 @@ void ScreenPlay::createWallpaper( this->removeWallpaperAt(0); m_settings->increaseActiveWallpaperCounter(); - m_screenPlayWallpaperList.emplace_back( - RefSPWall::create( + m_screenPlayWallpapers.emplace_back( + std::make_unique( std::vector { monitorIndex }, absoluteStoragePath.toLocalFile(), previewImage, volume, fillMode, type, this)); @@ -63,8 +63,8 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewIm if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { return; } - m_screenPlayWidgetList.emplace_back( - RefSPWidget::create( + m_screenPlayWidgets.emplace_back( + std::make_unique( absoluteStoragePath.toLocalFile(), previewImage, QString { absoluteStoragePath.toLocalFile() + "/" + project.m_file.toString() }, this)); @@ -72,10 +72,10 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewIm void ScreenPlay::removeAllWallpaper() noexcept { - if (m_sdkc && m_settings && !m_screenPlayWallpaperList.empty()) { + if (m_sdkc && m_settings && !m_screenPlayWallpapers.empty()) { m_sdkc->closeAllWallpapers(); m_settings->setActiveWallpaperCounter(0); - m_screenPlayWallpaperList.clear(); + m_screenPlayWallpapers.clear(); emit allWallpaperRemoved(); } return; @@ -83,11 +83,11 @@ void ScreenPlay::removeAllWallpaper() noexcept void ScreenPlay::requestProjectSettingsListModelAt(const int index) const noexcept { - for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { - if (!refSPWallpaper.data()->screenNumber().empty() && refSPWallpaper.data()->screenNumber()[0] == index) { // ??? only at index == 0 + for (const UPtrSPWall& uPtrWallpaper : m_screenPlayWallpapers) { + if (!uPtrWallpaper->screenNumber().empty() && uPtrWallpaper->screenNumber()[0] == index) { // ??? only at index == 0 emit projectSettingsListModelFound( - refSPWallpaper.data()->projectSettingsListModel().data(), - refSPWallpaper.data()->type()); + uPtrWallpaper->projectSettingsListModel().data(), + uPtrWallpaper->type()); return; } } @@ -96,10 +96,10 @@ void ScreenPlay::requestProjectSettingsListModelAt(const int index) const noexce void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) noexcept { - Q_ASSERT(static_cast(at) < m_screenPlayWallpaperList.size() && m_sdkc); - for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { - if (!refSPWallpaper.data()->screenNumber().empty() && m_sdkc && refSPWallpaper.data()->screenNumber()[0] == at) { // ??? only at index == 0 - m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value); + Q_ASSERT(static_cast(at) < m_screenPlayWallpapers.size() && m_sdkc); + for (const UPtrSPWall& uPtrWallpaper : m_screenPlayWallpapers) { + if (!uPtrWallpaper->screenNumber().empty() && m_sdkc && uPtrWallpaper->screenNumber()[0] == at) { // ??? only at index == 0 + m_sdkc->setWallpaperValue(uPtrWallpaper->appID(), key, value); return; } } @@ -108,42 +108,42 @@ void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QStri void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) noexcept { Q_ASSERT(m_sdkc); - for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { + for (const UPtrSPWall& uPtrWallpaper : m_screenPlayWallpapers) { if (m_sdkc) - m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value); + m_sdkc->setWallpaperValue(uPtrWallpaper->appID(), key, value); } } void ScreenPlay::removeWallpaperAt(const int at) { - // Q_ASSERT(at < m_screenPlayWallpaperList.size() && m_sdkc); - qDebug() << "No of walls in list: " << m_screenPlayWallpaperList.size(); - if (m_screenPlayWallpaperList.empty()) + Q_ASSERT(m_sdkc); + qDebug() << "No of walls in list: " << m_screenPlayWallpapers.size(); + if (m_screenPlayWallpapers.empty()) return; // done here; - const auto toRemove = std::remove_if( - m_screenPlayWallpaperList.begin(), m_screenPlayWallpaperList.end(), - [&](const RefSPWall& refSPWallpaper) noexcept->bool { - const std::vector& screenNumber = refSPWallpaper->screenNumber(); - qDebug() << "Screen No. :" << screenNumber.size(); - const bool isFound = !screenNumber.empty(); // && screenNumber[0] == at; + const auto wallsToRemove = std::remove_if( + m_screenPlayWallpapers.begin(), m_screenPlayWallpapers.end(), + [&](const UPtrSPWall& uPtrWallpaper) noexcept->bool { + const std::vector& screenNumber = uPtrWallpaper->screenNumber(); + qDebug() << "Screen No. or vector size :" << screenNumber.size(); + const bool isFound = !screenNumber.empty() && screenNumber[0] == at; if (isFound) { // m_mlm - m_sdkc->closeWallpapersAt(at); // for waht ??? + m_sdkc->closeWallpapersAt(at); m_settings->decreaseActiveWallpaperCounter(); qDebug() << "current wall count... " << m_settings->activeWallpaperCounter(); } return isFound; }); - m_screenPlayWallpaperList.erase(toRemove, m_screenPlayWallpaperList.end()); - qDebug() << "After removing: No of walls in list: " << m_screenPlayWallpaperList.size(); + m_screenPlayWallpapers.erase(wallsToRemove, m_screenPlayWallpapers.end()); + qDebug() << "After removing: No of walls in list: " << m_screenPlayWallpapers.size(); } std::vector ScreenPlay::getMonitorByAppID(const QString& appID) const { - for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) { - if (refSPWallpaper.data()->appID() == appID) { - return refSPWallpaper.data()->screenNumber(); + for (const UPtrSPWall& uPtrWallpaper : m_screenPlayWallpapers) { + if (uPtrWallpaper->appID() == appID) { + return uPtrWallpaper->screenNumber(); } } return std::vector {}; diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplay.h index 19be9983..b4dd09e7 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplay.h @@ -24,8 +24,8 @@ class ScreenPlayWallpaper; class ScreenPlayWidget; // convenience types -using RefSPWall = QSharedPointer; -using RefSPWidget = QSharedPointer; +using UPtrSPWall = std::unique_ptr; +using UPtrSPWidget = std::unique_ptr; class ScreenPlay final : public QObject { Q_OBJECT @@ -35,8 +35,8 @@ private: MonitorListModel* const m_mlm { nullptr }; QGuiApplication* const m_qGuiApplication { nullptr }; SDKConnector* const m_sdkc { nullptr }; - std::vector m_screenPlayWallpaperList; - std::vector m_screenPlayWidgetList; + std::vector m_screenPlayWallpapers; + std::vector m_screenPlayWidgets; public: // constructor(s) @@ -59,8 +59,8 @@ public: const MonitorListModel* monitorListModel() const noexcept; const QGuiApplication* guiApp() const noexcept; const SDKConnector* sdkConnector() const noexcept; - const std::vector& spWallList() const noexcept; - const std::vector& spWidgetList() const noexcept; + const std::vector& spWallList() const noexcept; + const std::vector& spWidgetList() const noexcept; signals: void allWallpaperRemoved() const; From 599ad7b1c118748fb910824858f50948f841ab9c Mon Sep 17 00:00:00 2001 From: JeJo Date: Sat, 4 May 2019 22:54:16 +0200 Subject: [PATCH 07/15] Wallpaper and Widget class: bug fix changed QProcess* m_process to simply QProcess m_process. Widget class : QObject{ parent } must be constructed first. --- ScreenPlay/src/screenplaywallpaper.cpp | 36 +++++++++++++------------- ScreenPlay/src/screenplaywallpaper.h | 4 +-- ScreenPlay/src/screenplaywidget.cpp | 28 +++++++++----------- ScreenPlay/src/screenplaywidget.h | 5 ++-- 4 files changed, 35 insertions(+), 38 deletions(-) diff --git a/ScreenPlay/src/screenplaywallpaper.cpp b/ScreenPlay/src/screenplaywallpaper.cpp index f764f9fa..4aa678a4 100644 --- a/ScreenPlay/src/screenplaywallpaper.cpp +++ b/ScreenPlay/src/screenplaywallpaper.cpp @@ -1,7 +1,7 @@ #include "screenplay.h" #include "screenplaywallpaper.h" -#include + ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector& screenNumber, const QString& projectPath, const QString& previewImage, const float volume, @@ -12,42 +12,42 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector& screenNumber, c , m_previewImage { previewImage } , m_type { type } , m_appID { parent ? parent->generateID() : QString {} } - , m_process { nullptr } + , m_process { this } , m_projectSettingsListModel { QSharedPointer::create(projectPath + "/project.json") } { - QStringList proArgs; - proArgs.append(QString::number(m_screenNumber.empty() ? 0 : m_screenNumber[0])); - proArgs.append(m_projectPath); - proArgs.append("appID=" + m_appID); - proArgs.append(parent ? parent->settings()->decoder() : QString {}); - proArgs.append(QString::number(static_cast(volume))); - proArgs.append(fillMode); + const QStringList proArgs { + QString::number(m_screenNumber.empty() ? 0 : m_screenNumber[0]), + m_projectPath, + QString{"appID=" + m_appID}, + parent ? parent->settings()->decoder() : QString {}, + QString::number(static_cast(volume)), + fillMode + }; - qDebug() << proArgs; + qDebug() << "creating ScreenPlayWallpaper...\n" << proArgs; // We do not want to parent the QProcess because the // Process manages its lifetime and destructing (animation) itself // via a disconnection from the ScreenPlay SDK - QProcess* m_process = new QProcess(); + // QProcess m_process = new QProcess(); - QObject::connect(m_process, QOverload::of(&QProcess::finished), + QObject::connect(&m_process, QOverload::of(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus) { if (exitCode != 0) qDebug() << "WARNING EXIT CODE: " << exitCode; }); - QObject::connect(m_process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) { + QObject::connect(&m_process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) { qDebug() << "EX: " << error; }); - m_process->setArguments(proArgs); - m_process->setProgram(parent->settings()->screenPlayWindowPath().toString()); - m_process->start(); + m_process.setArguments(proArgs); + m_process.setProgram(parent->settings()->screenPlayWindowPath().toString()); + m_process.start(); } ScreenPlayWallpaper::~ScreenPlayWallpaper() { - if (m_process) - delete m_process; + //if (m_process) delete m_process; } const std::vector& ScreenPlayWallpaper::screenNumber() const noexcept diff --git a/ScreenPlay/src/screenplaywallpaper.h b/ScreenPlay/src/screenplaywallpaper.h index 21efdbe2..db6c84d5 100644 --- a/ScreenPlay/src/screenplaywallpaper.h +++ b/ScreenPlay/src/screenplaywallpaper.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "projectsettingslistmodel.h" @@ -10,7 +11,6 @@ */ class ScreenPlay; -class QProcess; class ScreenPlayWallpaper final : public QObject { Q_OBJECT @@ -27,7 +27,7 @@ private: QString m_previewImage; QString m_type; QString m_appID; - QProcess* m_process; + QProcess m_process; QSharedPointer m_projectSettingsListModel; public: diff --git a/ScreenPlay/src/screenplaywidget.cpp b/ScreenPlay/src/screenplaywidget.cpp index e92a0948..106ec603 100644 --- a/ScreenPlay/src/screenplaywidget.cpp +++ b/ScreenPlay/src/screenplaywidget.cpp @@ -1,42 +1,38 @@ #include "screenplay.h" #include "screenplaywidget.h" -#include + ScreenPlayWidget::ScreenPlayWidget(const QString& projectPath, const QString& previewImage, const QString& fullPath, ScreenPlay* parent) - : m_projectPath { projectPath } + : QObject{ parent } + , m_projectPath { projectPath } , m_previewImage { previewImage } , m_fullPath { fullPath } , m_appID { parent ? parent->generateID() : QString {} } , m_position { 0, 0 } - , m_process { nullptr } + , m_process { this } //PLS LESS BEHINDERT @Elias { - QStringList proArgs; - proArgs.append(m_projectPath); - proArgs.append(m_appID); - - m_process = new QProcess(this); //PLS LESS BEHINDERT @Elias - m_process->setArguments(proArgs); + const QStringList proArgs{ m_projectPath, m_appID}; + m_process.setArguments(proArgs); if (fullPath.endsWith(".exe")) { - m_process->setProgram(fullPath); + m_process.setProgram(fullPath); } else if (fullPath.endsWith(".qml")) { - m_process->setProgram(parent->settings()->getScreenPlayWidgetPath().path()); + m_process.setProgram(parent->settings()->getScreenPlayWidgetPath().path()); } - qDebug() << m_process->program(); + qDebug() << m_process.program(); - QObject::connect(m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) { + QObject::connect(&m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) { qDebug() << "error: " << error; }); - m_process->start(); + m_process.start(); } ScreenPlayWidget::~ScreenPlayWidget() { - if (m_process) - delete m_process; + //if (m_process) delete m_process; } const QString& ScreenPlayWidget::projectPath() const noexcept diff --git a/ScreenPlay/src/screenplaywidget.h b/ScreenPlay/src/screenplaywidget.h index 262da31f..be79bc57 100644 --- a/ScreenPlay/src/screenplaywidget.h +++ b/ScreenPlay/src/screenplaywidget.h @@ -1,13 +1,14 @@ #pragma once #include +#include +#include /*! \class ScreenPlayWidget \brief Used for ... */ class ScreenPlay; -class QProcess; class ScreenPlayWidget final : public QObject { Q_OBJECT @@ -24,7 +25,7 @@ private: QString m_fullPath; QString m_appID; QPoint m_position; - QProcess* m_process; + QProcess m_process; public: // constructor(s) From 55b3d0f3f3693bc7a08e8c136e195ef8ea27dd79 Mon Sep 17 00:00:00 2001 From: Elias Date: Sun, 9 Jun 2019 12:21:03 +0200 Subject: [PATCH 08/15] Fix scene value set from screenplay to screenplaywindow Add mouse hook for input --- ScreenPlaySDK/screenplaysdk.cpp | 2 +- ScreenPlayWindow/SPWResources.qrc | 1 + ScreenPlayWindow/dot.png | Bin 0 -> 3306 bytes ScreenPlayWindow/mainWindow.qml | 7 ++- ScreenPlayWindow/src/basewindow.cpp | 3 + ScreenPlayWindow/src/basewindow.h | 2 +- ScreenPlayWindow/src/winwindow.cpp | 64 ++++++++++++++++++- ScreenPlayWindow/src/winwindow.h | 4 ++ ScreenPlayWindow/test.qml | 93 ++++++++++++++++++++++++++++ 9 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 ScreenPlayWindow/dot.png diff --git a/ScreenPlaySDK/screenplaysdk.cpp b/ScreenPlaySDK/screenplaysdk.cpp index 47626df7..18b0b332 100644 --- a/ScreenPlaySDK/screenplaysdk.cpp +++ b/ScreenPlaySDK/screenplaysdk.cpp @@ -14,11 +14,11 @@ void redirectMessageOutputToMainWindow(QtMsgType type, const QMessageLogContext& //QByteArray function = "function " + QByteArray(context.function) + ", Message: "; //localMsg = file + line + localMsg; + global_sdkPtr->redirectMessage(localMsg); switch (type) { case QtDebugMsg: //localMsg = " SDK START: " /*+ QByteArray::fromStdString(global_sdkPtr->contentType().toStdString()) + " "*/ + localMsg; - global_sdkPtr->redirectMessage(localMsg); break; case QtInfoMsg: //fprintf(stderr, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); diff --git a/ScreenPlayWindow/SPWResources.qrc b/ScreenPlayWindow/SPWResources.qrc index daab8893..581a72c2 100644 --- a/ScreenPlayWindow/SPWResources.qrc +++ b/ScreenPlayWindow/SPWResources.qrc @@ -2,5 +2,6 @@ mainWindow.qml test.qml + dot.png diff --git a/ScreenPlayWindow/dot.png b/ScreenPlayWindow/dot.png new file mode 100644 index 0000000000000000000000000000000000000000..082a04d18253f8d348320c2068cb02d3635f1b0f GIT binary patch literal 3306 zcmb7Hc{tSH_kYiPkTtZKB8{O!-x-u4V#e5)>_n1fHGUW-~YeQbI!f@+?WRf4gfmnFubQ%fOiNK z>+RzgqzhYZZiPYpZs@|Ckd~^Jcmr==KhwLx-u8E`9K7xZcxl~$p;5v*VcI-^o8BRw z(6F0zP;{P!W zy$N2ye)teSToCj(rY9D6J46=-Q~8}lbD~YC`+CS%x6)sW!^j9EQF(L{`j20YY z@1WwNq+H~Q19DH#{ditDqjl;!UIYESKQ0!OneFd;fu10EyN3~Y^M&X zq;RpwYM=Yxzc%)#aXs5r>uA04qyGA9nL?$?~! zD=#>$(pX`bd`SCTiK+buxW6s=tio9%>yN!Qb$i^U%11K4u8=1<{hPkIH4*(SLhjy! zdlyx|))@GPMQylNqgut~aYau8as$N2N9mhIFS_2+1OFheHfGDRADy_N^hu#bCRSef znNvU6d98}v_xDM|k$)-?o<35$--+x2O*q@9S0{K(j@Oz(c+;x{01!F+TR}i>9)!0y zZ)S*b2+Lc3HW55=QNmEVF7V5fpZi=~P*vq=&r?xe>XJ?xpIkJ`a_zfdr%euh^79ag z14VkQH3p3TGP&b)S4-C4NniLU=z%hA{P=OKu#)Ac^moz&q}1tzL1@!801eW zsp-_)k(ZU8p|^i>7;P*Q8zHD07HRha@3hjPWpev4ZOR!=0YOC2>$WGBOHK=H=1$D=*t6z|2+trWY+v8s6K)T(_ zx`4AsLH+C2{&23_*OOHWHx=N))QQZ2CGQ$$U9Ss|h!3*EYwvOH+LNsaGN;tsf$2S-KrP-fne;NXRti7z-8}wbeJY)Gm8P!@~ms+uJSQZpoGUtf@5JM z8jh4=R-B2db|GS{YpY;k@5cDu)4mB6o+!xT{%fIJ7VWnvEVw_$o`jltG9Mn+8&4WYyo1dWN$s8eYs6XX{ zxe;IIk!x(3Vxdk$y`8=X*VpdnB=a(*DjUCGN7_ktXdW#Nmx#ZpssnSbco$PTKIZP< z9a%kNDN|cn(8CObxGTq@M>$FiqPbEvdLKd5sh7}O-c?(VP5gV|m*3i^z$SQG87t?Z za8QpAGTpO|ns+ZZ;t*4&WB=wW_|AeqNh6?MWd1r8Duw7^g3HWg!4x0M2SnKeI+cyY z$+n6KQ_1Gl_qH4Cm%9;3Tuo)l2V;8>4SaV^W@)w6Tzfvx-QL_std|M4ksh5JmHgv6 zS{I-ISY}}w9jXOd2RArlqhfPc(IYccl|pf^PWf)3QuV+IfwS`+E1moh7XbO?L2K*a z5KWf(I$|)yG+sgn;#!t`aGGRpDTtc);iK=wk~V1s0nR>;X-Q_viOlExg;@iX!H~dI z5s#(^67S28=Wj!f!D6I2dEt#Ct&RzQ=q$eMx)5zRp8b3-)@1}=3M=!>FzgU6JVOi` zc8yA1of>76yn7-8lr!&>#E81^8HT71zLQA-AjlSP5d!t0tyi=sf8oNtlmj85t1XPU zUmj`8*3M-~$}2-yenZ1r)A4MA91dUAv$t$z1nE$#15Doy9A=IuuY%i5qy~P`K1&H@gcT7brv(Yl5gAoe1FAlFh61X zq5Aqw>R(z|RaPZwt$raxDt?7D3()B99i_ij{if>0C!dUHxaa)I>T(()zRg3sMFJ zxz*z{fk@uAYRSqqjqv(zy9u;n&{K<=tUc-sian3DN!QLlz3KhuKm&8A#v5XMBxEfcawU2^7&w4 zJ=Zi+K5jL&DKqdQ$f3z^(z(1*;chHRNmJw^;@jtsT(&E~h*6}NcFv{CS#+5kiwa$y zw5hl)(SaF!+#FA{W2LWcQ@aBAsBai9ab6A}*5^q|?ybHl_JIle&Uf}A{it*TCun|0 zQo427NG|?^k@n=}LiIO5i`7i?wThso*Ws27#?|+nzoD-vF6EHchl&S(g;FO11Ri*O zyc?A{pvLI6yk6d@8g#Mx;ZrL)v*uG`g6w> zyuXcUy^=H6$2V57Ln3o;Pieei%)Hk%F+GzgY0>84407-_a{w(nCVkYm{QUN6{6Z?p zOE3W=?(gk_@|)8lil5(EewO>leGx|)x>-{$L7W)h7X8u>{t<(b?WY+*92jA{*`C?r zU8;+*iS!l^`2|L5+?tz5@vMN`&umEaSkzp#0FE<21DAP()d+1O_fe;4=R%1xRG64+ zLbJ#rbsx4U=A{X%AtcG7k{i^smn_+qR!XDt9=O*Zj0ayv?Cg=H?UlRFGO;<^lti_b z+@1iT-A^+4B6`es^<+Ymz@tg^69 zlbj3RPF<7aD~_3l_r_fnDohdfy}r^)k&UtimVWtiI9_gedCgoZeQ-D8IHW_*P*3$^ z8WZlQGn>cl%YFi)h>i zIswicmc7XgO1Vzza})$BBp@3ZoDTllz}~YdB@3!{xg*kK!D(!CfU1t`W1tY_oX%ge ze;MR%kv(jvH~d=s56ZDyFV|installEventFilter(this); qRegisterMetaType(); qmlRegisterType("net.aimber.wallpaper", 1, 0, "Wallpaper"); @@ -76,3 +78,4 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent) return; } } + diff --git a/ScreenPlayWindow/src/basewindow.h b/ScreenPlayWindow/src/basewindow.h index ac9dde16..3b5e7dc6 100644 --- a/ScreenPlayWindow/src/basewindow.h +++ b/ScreenPlayWindow/src/basewindow.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include class BaseWindow : public QObject { Q_OBJECT diff --git a/ScreenPlayWindow/src/winwindow.cpp b/ScreenPlayWindow/src/winwindow.cpp index 6feba053..c27b962a 100644 --- a/ScreenPlayWindow/src/winwindow.cpp +++ b/ScreenPlayWindow/src/winwindow.cpp @@ -13,6 +13,53 @@ BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam) return TRUE; } +HHOOK mouseHook; + +QQuickView* winGlobalHook = nullptr; + +LRESULT __stdcall MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam) +{ + Qt::MouseButton mouseButton {}; + Qt::MouseButtons mouseButtons {}; + Qt::KeyboardModifier keyboardModifier {}; + QMouseEvent::Type type { QMouseEvent::Type::MouseMove }; + + if (nCode >= 0) { + switch (wParam) { + case WM_LBUTTONDOWN: + mouseButton = Qt::MouseButton::LeftButton; + mouseButtons.setFlag(Qt::LeftButton); + type = QMouseEvent::Type::MouseButtonPress; + break; + case WM_LBUTTONUP: + mouseButton = Qt::MouseButton::LeftButton; + mouseButtons.setFlag(Qt::LeftButton); + type = QMouseEvent::Type::MouseButtonRelease; + break; + case WM_RBUTTONDOWN: + mouseButton = Qt::MouseButton::RightButton; + mouseButtons.setFlag(Qt::RightButton); + type = QMouseEvent::Type::MouseButtonPress; + break; + } + } + + POINT p {}; + QPoint point { 0, 0 }; + if (GetCursorPos(&p)) { + point.setX(p.x); + point.setY(p.y); + } + + auto event = QMouseEvent(type, point, mouseButton, mouseButtons, keyboardModifier); + + auto* app = QApplication::instance(); + + app->sendEvent(winGlobalHook, &event); + + return CallNextHookEx(mouseHook, nCode, wParam, lParam); +} + WinWindow::WinWindow(QVector& activeScreensList, QString projectPath, QString id, QString volume) : BaseWindow(projectPath) { @@ -59,11 +106,17 @@ WinWindow::WinWindow(QVector& activeScreensList, QString projectPath, QStri m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering); m_window.setSource(QUrl("qrc:/mainWindow.qml")); + // MUST be called before setting hook for events! + winGlobalHook = &m_window; + if (!(mouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookCallback, nullptr, 0))) { + qDebug() << "Faild to install mouse hook!"; + } + // FIXME WORKAROUND: // There is a strange bug when we open the ScreenPlayWindow project on its one // that if we set ShowWindow(m_windowHandle, SW_HIDE); we can no longer set // the window visible via set Visible. - if(projectPath != "test"){ + if (projectPath != "test") { // Let QML decide when were are read to show the window ShowWindow(m_windowHandle, SW_HIDE); } @@ -72,10 +125,14 @@ WinWindow::WinWindow(QVector& activeScreensList, QString projectPath, QStri void WinWindow::setVisible(bool show) { if (show) { - ShowWindow(m_windowHandle, SW_SHOW); + if (!ShowWindow(m_windowHandle, SW_SHOW)) { + qDebug() << "Cannot set window handle visible"; + } m_window.show(); } else { - ShowWindow(m_windowHandle, SW_HIDE); + if (!ShowWindow(m_windowHandle, SW_HIDE)) { + qDebug() << "Cannot set window handle hidden"; + } } } @@ -93,6 +150,7 @@ void WinWindow::destroyThis() void WinWindow::messageReceived(QString key, QString value) { + emit qmlSceneValueReceived(key, value); } void WinWindow::calcOffsets() diff --git a/ScreenPlayWindow/src/winwindow.h b/ScreenPlayWindow/src/winwindow.h index 3025956d..d0ceef7a 100644 --- a/ScreenPlayWindow/src/winwindow.h +++ b/ScreenPlayWindow/src/winwindow.h @@ -34,6 +34,10 @@ private: void setupWallpaperForAllScreens(); bool searchWorkerWindowToParentTo(); + +signals: + void qmlSceneValueReceived(const QString key, const QString value); + private: int m_windowOffsetX = 0; int m_windowOffsetY = 0; diff --git a/ScreenPlayWindow/test.qml b/ScreenPlayWindow/test.qml index c97b4742..39fa6de3 100644 --- a/ScreenPlayWindow/test.qml +++ b/ScreenPlayWindow/test.qml @@ -1,10 +1,103 @@ import QtQuick 2.12 import QtQuick.Controls.Material 2.12 +import QtQuick.Particles 2.12 +import QtQuick.Shapes 1.12 Rectangle { + id: root anchors.fill: parent color: Material.color(Material.Grey, Material.Shade800) + property int attStrength: 8000000 + //Emitter + property bool isEnabled: true + property int emitRate: 25 + property int lifeSpan: 5000 + property int size: 4 + property int endSize: 8 + property int sizeVariation: 4 + + //Image + property real imgOpacity: .75 + + MouseArea { + id: ma + anchors.fill: parent + hoverEnabled: true + Component.onCompleted: { + attractor.pointX = parent.width * .5 + attractor.pointY = 0 + } + + onPositionChanged: { + if (ma.pressed) { + setPosition() + } + } + onClicked: { + setPosition() + } + function setPosition() { + attractor.pointX = mouseX - 25 + attractor.pointY = mouseY - 25 + mouseDot.x = mouseX - mouseDot.center + mouseDot.y = mouseY - mouseDot.center + } + } + Rectangle { + id: mouseDot + property int center: mouseDot.width * .5 + width: 10 + height: width + radius: width + color: "orange" + } + + Attractor { + id: attractor + system: particleSystem + affectedParameter: Attractor.Acceleration + strength: root.attStrength + proportionalToDistance: Attractor.InverseQuadratic + } + + ParticleSystem { + id: particleSystem + } + + Emitter { + id: emitter + enabled: root.isEnabled + anchors { + horizontalCenter: parent.horizontalCenter + bottom: parent.bottom + } + + width: parent.width + height: parent.height * .5 + system: particleSystem + emitRate: root.emitRate + lifeSpan: root.lifeSpan + lifeSpanVariation: 1000 + size: root.size + endSize: root.endSize + sizeVariation: root.sizeVariation + velocity: AngleDirection { + angle: -90 + magnitude: 50 + magnitudeVariation: 25 + angleVariation: 10 + } + } + + ImageParticle { + height: 16 + width: 16 + source: "dot.png" + system: particleSystem + opacity: root.imgOpacity + } + Text { id: name text: qsTr("This is a empty test window. You can change the source in test.qml") From 5146a34a7017981c77b218b2428e00c5a8fbb4ef Mon Sep 17 00:00:00 2001 From: Elias Date: Sun, 9 Jun 2019 12:26:11 +0200 Subject: [PATCH 09/15] Add --- ScreenPlay/main.cpp | 5 ++- ScreenPlay/src/screenplay.cpp | 59 +++++++++++++--------------------- ScreenPlay/src/screenplay.h | 7 ++-- ScreenPlay/src/settings.cpp | 20 ++++++------ ScreenPlay/src/settings.h | 22 ++++--------- ScreenPlayWindow/test.qml | 7 ++-- vcpkg-install-dependencies.bat | 3 +- 7 files changed, 52 insertions(+), 71 deletions(-) diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index 7482ddd1..ee22853e 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication::setOrganizationName("Aimber"); + QGuiApplication::setOrganizationName("Kelteseth"); QGuiApplication::setOrganizationDomain("screen-play.app"); QGuiApplication::setApplicationName("ScreenPlay"); QGuiApplication::setApplicationVersion("0.2.0"); @@ -78,6 +78,9 @@ int main(int argc, char* argv[]) // Instead of setting "renderType: Text.NativeRendering" every time // we can set it here once :) auto* window = static_cast(mainWindowEngine.rootObjects().first()); + if(!window) + qFatal("Could not receive window to set font rendering."); + window->setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering); // Set visible if the -silent parameter was not set diff --git a/ScreenPlay/src/screenplay.cpp b/ScreenPlay/src/screenplay.cpp index c4655343..706e6a58 100644 --- a/ScreenPlay/src/screenplay.cpp +++ b/ScreenPlay/src/screenplay.cpp @@ -1,15 +1,15 @@ #include "screenplay.h" -ScreenPlay::ScreenPlay(const shared_ptr &ilm, +ScreenPlay::ScreenPlay(const shared_ptr& ilm, const shared_ptr& settings, - const shared_ptr &mlm, - const shared_ptr& sdkc, + const shared_ptr& mlm, + const shared_ptr& sdkc, QObject* parent) : QObject { parent } - , m_ilm { ilm } + , m_installedListModel { ilm } , m_settings { settings } - , m_mlm { mlm } - , m_sdkc { sdkc } + , m_monitorListModel { mlm } + , m_sdkconnector { sdkc } , m_qGuiApplication { static_cast(QGuiApplication::instance()) } { } @@ -20,12 +20,12 @@ void ScreenPlay::createWallpaper( const QString& fillMode, const QString& type) { ProjectFile project {}; - if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { + if (!m_installedListModel->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { return; } // Remove previous wallpaper, if any - this->removeWallpaperAt(0); + //this->removeWallpaperAt(0); m_settings->increaseActiveWallpaperCounter(); m_screenPlayWallpapers.emplace_back( @@ -40,7 +40,7 @@ void ScreenPlay::createWallpaper( type, this)); - m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), + m_monitorListModel->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), QString { absoluteStoragePath.toLocalFile() + "/" + previewImage }); } @@ -48,7 +48,7 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewIm { ProjectFile project {}; - if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { + if (!m_installedListModel->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) { return; } @@ -64,8 +64,8 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewIm void ScreenPlay::removeAllWallpaper() noexcept { - if (m_sdkc && m_settings && !m_screenPlayWallpapers.empty()) { - m_sdkc->closeAllWallpapers(); + if (m_sdkconnector && m_settings && !m_screenPlayWallpapers.empty()) { + m_sdkconnector->closeAllWallpapers(); m_settings->setActiveWallpaperCounter(0); m_screenPlayWallpapers.clear(); emit allWallpaperRemoved(); @@ -88,10 +88,10 @@ void ScreenPlay::requestProjectSettingsListModelAt(const int index) noexcept void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) noexcept { - Q_ASSERT(static_cast(at) < m_screenPlayWallpapers.size() && m_sdkc); + Q_ASSERT(static_cast(at) < m_screenPlayWallpapers.size() && m_sdkconnector); for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { - if (!uPtrWallpaper->screenNumber().empty() && m_sdkc && uPtrWallpaper->screenNumber()[0] == at) { // ??? only at index == 0 - m_sdkc->setWallpaperValue(uPtrWallpaper->appID(), key, value); + if (!uPtrWallpaper->screenNumber().empty() && m_sdkconnector && uPtrWallpaper->screenNumber()[0] == at) { // ??? only at index == 0 + m_sdkconnector->setWallpaperValue(uPtrWallpaper->appID(), key, value); return; } } @@ -99,47 +99,34 @@ void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QStri void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) noexcept { - Q_ASSERT(m_sdkc); + Q_ASSERT(m_sdkconnector); for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { - if (m_sdkc) - m_sdkc->setWallpaperValue(uPtrWallpaper->appID(), key, value); + if (m_sdkconnector) + m_sdkconnector->setWallpaperValue(uPtrWallpaper->appID(), key, value); } } void ScreenPlay::removeWallpaperAt(const int at) { - Q_ASSERT(m_sdkc); - qDebug() << "No of walls in list: " << m_screenPlayWallpapers.size(); if (m_screenPlayWallpapers.empty()) - return; // done here; + return; const auto wallsToRemove = remove_if( m_screenPlayWallpapers.begin(), m_screenPlayWallpapers.end(), - [&](const unique_ptr& uPtrWallpaper) noexcept->bool { + [&](const unique_ptr& uPtrWallpaper) -> bool { const vector& screenNumber = uPtrWallpaper->screenNumber(); - qDebug() << "Screen No. or vector size :" << screenNumber.size(); const bool isFound = !screenNumber.empty() && screenNumber[0] == at; if (isFound) { - // m_mlm - m_sdkc->closeWallpapersAt(at); + m_sdkconnector->closeWallpapersAt(at); m_settings->decreaseActiveWallpaperCounter(); - qDebug() << "current wall count... " << m_settings->activeWallpaperCounter(); } return isFound; }); + m_screenPlayWallpapers.erase(wallsToRemove, m_screenPlayWallpapers.end()); - qDebug() << "After removing: No of walls in list: " << m_screenPlayWallpapers.size(); } -vector ScreenPlay::getMonitorByAppID(const QString& appID) const -{ - for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { - if (uPtrWallpaper->appID() == appID) { - return uPtrWallpaper->screenNumber(); - } - } - return vector {}; -} + QString ScreenPlay::generateID() const { diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplay.h index aa049ebb..2e463b57 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplay.h @@ -59,14 +59,13 @@ public slots: void setWallpaperValue(const int at, const QString& key, const QString& value) noexcept; void setAllWallpaperValue(const QString& key, const QString& value) noexcept; void removeWallpaperAt(const int at = 0); - vector getMonitorByAppID(const QString& appID) const; QString generateID() const; private: - const shared_ptr m_ilm; + const shared_ptr m_installedListModel; const shared_ptr m_settings; - const shared_ptr m_mlm; - const shared_ptr m_sdkc; + const shared_ptr m_monitorListModel; + const shared_ptr m_sdkconnector; QGuiApplication* const m_qGuiApplication; vector> m_screenPlayWallpapers; diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index 1e4a6978..a6189068 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -17,10 +17,10 @@ Settings::Settings(const shared_ptr& ilm, QObject* parent) : QObject(parent) , m_version(QVersionNumber(0, 0, 1)) - , m_plm(plm) - , m_ilm(ilm) - , m_mlm(mlm) - , m_sdkc(sdkc) + , m_profileListModel(plm) + , m_installedListModel(ilm) + , m_monitorListModel(mlm) + , m_sdkconnector(sdkc) { auto* app = static_cast(QGuiApplication::instance()); @@ -91,10 +91,10 @@ Settings::Settings(const shared_ptr& ilm, configObj = configJsonDocument.object(); QString tmp(configObj.value("version").toVariant().toString()); - int major, minor, patch; - major = QString(tmp.at(0)).toInt(); - minor = QString(tmp.at(2)).toInt(); - patch = QString(tmp.at(4)).toInt(); + + int major = QString(tmp.at(0)).toInt(); + int minor = QString(tmp.at(2)).toInt(); + int patch = QString(tmp.at(4)).toInt(); QVersionNumber fileVersion(major, minor, patch); //Checks if the settings file has the same version as ScreeenPlay @@ -124,8 +124,8 @@ Settings::Settings(const shared_ptr& ilm, m_qSettings.sync(); } - m_ilm->setabsoluteStoragePath(m_localStoragePath); - m_plm->m_localStoragePath = m_localStoragePath; + m_installedListModel->setabsoluteStoragePath(m_localStoragePath); + m_profileListModel->m_localStoragePath = m_localStoragePath; m_autostart = configObj.value("autostart").toBool(); m_highPriorityStart = configObj.value("highPriorityStart").toBool(); diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index 754df55d..b945bb43 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -66,14 +66,6 @@ public: QObject* parent = nullptr); ~Settings() {} - enum LocalCopyResult { - NoError, - CopyError, - NotEnoughDiskSpace, - NameCollision, - }; - Q_ENUM(LocalCopyResult) - QVersionNumber version() const { return m_version; @@ -213,11 +205,11 @@ public slots: writeSingleSettingConfig("absoluteStoragePath", cleanedPath); - m_ilm->setabsoluteStoragePath(cleanedPath.toString()); + m_installedListModel->setabsoluteStoragePath(cleanedPath.toString()); m_localStoragePath = cleanedPath.toString(); emit localStoragePathChanged(cleanedPath.toString()); - m_ilm->reset(); - m_ilm->loadInstalledContent(); + m_installedListModel->reset(); + m_installedListModel->loadInstalledContent(); } void setDecoder(QString decoder) @@ -282,10 +274,10 @@ private: QSettings m_qSettings; QTranslator m_translator; - const shared_ptr m_plm; - const shared_ptr m_ilm; - const shared_ptr m_mlm; - const shared_ptr m_sdkc; + const shared_ptr m_profileListModel; + const shared_ptr m_installedListModel; + const shared_ptr m_monitorListModel; + const shared_ptr m_sdkconnector; QUrl m_localStoragePath; QUrl m_localSettingsPath; diff --git a/ScreenPlayWindow/test.qml b/ScreenPlayWindow/test.qml index 39fa6de3..8466f272 100644 --- a/ScreenPlayWindow/test.qml +++ b/ScreenPlayWindow/test.qml @@ -8,10 +8,10 @@ Rectangle { anchors.fill: parent color: Material.color(Material.Grey, Material.Shade800) - property int attStrength: 8000000 + property int attStrength: 800000 //Emitter property bool isEnabled: true - property int emitRate: 25 + property int emitRate: 250 property int lifeSpan: 5000 property int size: 4 property int endSize: 8 @@ -30,8 +30,8 @@ Rectangle { } onPositionChanged: { + setPosition() if (ma.pressed) { - setPosition() } } onClicked: { @@ -48,6 +48,7 @@ Rectangle { id: mouseDot property int center: mouseDot.width * .5 width: 10 + visible: false height: width radius: width color: "orange" diff --git a/vcpkg-install-dependencies.bat b/vcpkg-install-dependencies.bat index 35f3a843..e51a0ffe 100644 --- a/vcpkg-install-dependencies.bat +++ b/vcpkg-install-dependencies.bat @@ -1,8 +1,7 @@ setlocal EnableExtensions cd Common -git clone https://github.com/Microsoft/vcpkg.git cd vcpkg git pull call bootstrap-vcpkg.bat -vcpkg.exe install openssl:x64-windows +vcpkg.exe install openssl:x64-windows From 90990b827fe717340bffa0abe87be015b7b56f36 Mon Sep 17 00:00:00 2001 From: Elias Date: Mon, 10 Jun 2019 16:03:05 +0200 Subject: [PATCH 10/15] Remove aimber --- ScreenPlay/ScreenPlay.pro | 3 - ScreenPlay/main.cpp | 2 +- ScreenPlay/qml/Create/Create.qml | 2 +- .../CreateWallpaper/CreateWallpaperResult.qml | 2 +- .../CreateWallpaperVideoImportConvert.qml | 2 +- .../CreateWallpaper/CreateWallpaperWizard.qml | 2 +- ScreenPlay/qml/Settings/Settings.qml | 8 +- ScreenPlay/qml/Workshop/Workshop.qml | 2 +- .../qml/Workshop/WorkshopAvailableTest.qml | 2 +- ScreenPlay/src/create.cpp | 8 +- ScreenPlay/src/monitorlistmodel.cpp | 21 +--- ScreenPlay/src/monitorlistmodel.h | 7 +- ScreenPlay/src/profile.cpp | 17 --- ScreenPlay/src/profile.h | 12 ++- ScreenPlay/src/projectfile.cpp | 51 --------- ScreenPlay/src/projectfile.h | 47 +++++++- ScreenPlay/src/projectsettingslistitem.cpp | 19 ---- ScreenPlay/src/projectsettingslistitem.h | 11 +- ScreenPlay/src/projectsettingslistmodel.h | 2 +- ScreenPlay/src/qmlutilities.cpp | 58 ++++++++++ ScreenPlay/src/qmlutilities.h | 6 ++ ScreenPlay/src/screenplay.cpp | 20 ++-- ScreenPlay/src/screenplay.h | 8 +- ScreenPlay/src/settings.cpp | 101 +----------------- ScreenPlay/src/settings.h | 47 +++++--- ScreenPlaySDK/Screenplaysdk.pro | 2 +- ScreenPlaySDK/qmldir | 2 +- ScreenPlaySDK/screenplay-sdk_plugin.cpp | 2 +- ScreenPlaySysInfo/ScreenPlaySysInfo.pro | 2 +- ScreenPlaySysInfo/qmldir | 2 +- .../screenplaysysinfo_plugin.cpp | 2 +- ScreenPlayWidget/mainWidget.qml | 2 +- ScreenPlayWindow/mainWindow.qml | 2 +- ScreenPlayWindow/src/basewindow.cpp | 2 +- ScreenPlayWindow/src/winwindow.cpp | 2 +- 35 files changed, 206 insertions(+), 274 deletions(-) delete mode 100644 ScreenPlay/src/profile.cpp delete mode 100644 ScreenPlay/src/projectfile.cpp delete mode 100644 ScreenPlay/src/projectsettingslistitem.cpp diff --git a/ScreenPlay/ScreenPlay.pro b/ScreenPlay/ScreenPlay.pro index 06fa8625..b02b791f 100644 --- a/ScreenPlay/ScreenPlay.pro +++ b/ScreenPlay/ScreenPlay.pro @@ -23,11 +23,8 @@ SOURCES += main.cpp \ src/screenplaywidget.cpp \ src/settings.cpp \ src/profilelistmodel.cpp \ - src/profile.cpp \ - src/projectfile.cpp \ src/installedlistfilter.cpp \ src/sdkconnector.cpp \ - src/projectsettingslistitem.cpp \ src/projectsettingslistmodel.cpp \ src/screenplay.cpp \ src/qmlutilities.cpp \ diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index ee22853e..9c9d7414 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -78,7 +78,7 @@ int main(int argc, char* argv[]) // Instead of setting "renderType: Text.NativeRendering" every time // we can set it here once :) auto* window = static_cast(mainWindowEngine.rootObjects().first()); - if(!window) + if (!window) qFatal("Could not receive window to set font rendering."); window->setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering); diff --git a/ScreenPlay/qml/Create/Create.qml b/ScreenPlay/qml/Create/Create.qml index 99904655..597f41cd 100644 --- a/ScreenPlay/qml/Create/Create.qml +++ b/ScreenPlay/qml/Create/Create.qml @@ -4,7 +4,7 @@ import QtQuick.Controls.Material 2.2 import QtQuick.Particles 2.0 import QtGraphicalEffects 1.0 -import net.aimber.create 1.0 +import app.screenplay.create 1.0 import "Wizards/CreateWallpaper" diff --git a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml index 77792b09..3abeaee1 100644 --- a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml +++ b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml @@ -4,7 +4,7 @@ import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.3 import Qt.labs.platform 1.0 import QtQuick.Layouts 1.3 -import net.aimber.create 1.0 +import app.screenplay.create 1.0 Item { id: wrapperError diff --git a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml index dff03619..b617bce0 100644 --- a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml +++ b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material 2.3 import Qt.labs.platform 1.0 import QtQuick.Layouts 1.12 -import net.aimber.create 1.0 +import app.screenplay.create 1.0 import "../../../Common" diff --git a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml index d7efd795..576c7f36 100644 --- a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml +++ b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material 2.3 import Qt.labs.platform 1.0 import QtQuick.Layouts 1.3 -import net.aimber.create 1.0 +import app.screenplay.create 1.0 Item { id: createNew diff --git a/ScreenPlay/qml/Settings/Settings.qml b/ScreenPlay/qml/Settings/Settings.qml index 5365b83a..50f7f072 100644 --- a/ScreenPlay/qml/Settings/Settings.qml +++ b/ScreenPlay/qml/Settings/Settings.qml @@ -394,7 +394,7 @@ Item { description: qsTr("ScreenPlay would not be possible without the work of others. A big thank you to: ") buttonText: qsTr("Licenses") onButtonPressed: { - screenPlaySettings.requestAllLicenses() + utility.requestAllLicenses() expanderCopyright.toggle() } } @@ -407,7 +407,7 @@ Item { Connections { - target: screenPlaySettings + target: utility onAllLicenseLoaded: { expanderCopyright.text = licensesText } @@ -420,7 +420,7 @@ Item { description: qsTr("We use you data very carefully to improve ScreenPlay. We do not sell or share this (anonymous) information with others!") buttonText: qsTr("Privacy") onButtonPressed: { - screenPlaySettings.requestAllLDataProtection() + utility.requestAllLDataProtection() expanderDataProtection.toggle() } } @@ -433,7 +433,7 @@ Item { Connections { - target: screenPlaySettings + target: utility onAllDataProtectionLoaded: { expanderDataProtection.text = dataProtectionText } diff --git a/ScreenPlay/qml/Workshop/Workshop.qml b/ScreenPlay/qml/Workshop/Workshop.qml index 7f415371..6a095e56 100644 --- a/ScreenPlay/qml/Workshop/Workshop.qml +++ b/ScreenPlay/qml/Workshop/Workshop.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.2 import QtGraphicalEffects 1.0 -import net.aimber.workshop 1.0 +import app.screenplay.workshop 1.0 Item { id: workshop diff --git a/ScreenPlay/qml/Workshop/WorkshopAvailableTest.qml b/ScreenPlay/qml/Workshop/WorkshopAvailableTest.qml index c74eae4d..32b318f3 100644 --- a/ScreenPlay/qml/Workshop/WorkshopAvailableTest.qml +++ b/ScreenPlay/qml/Workshop/WorkshopAvailableTest.qml @@ -1,5 +1,5 @@ import QtQuick 2.12 -import net.aimber.workshop 1.0 +import app.screenplay.workshop 1.0 Item { diff --git a/ScreenPlay/src/create.cpp b/ScreenPlay/src/create.cpp index 2db981de..a42bb1da 100644 --- a/ScreenPlay/src/create.cpp +++ b/ScreenPlay/src/create.cpp @@ -16,8 +16,8 @@ Create::Create(const shared_ptr& settings, QObject* parent) { qRegisterMetaType(); - qmlRegisterType("net.aimber.create", 1, 0, "Create"); - qmlRegisterType("net.aimber.create", 1, 0, "CreateImportVideo"); + qmlRegisterType("app.screenplay.create", 1, 0, "Create"); + qmlRegisterType("app.screenplay.create", 1, 0, "CreateImportVideo"); } // Constructor for the QMLEngine @@ -26,8 +26,8 @@ Create::Create() , m_settings(nullptr) { qRegisterMetaType(); - qmlRegisterType("net.aimber.create", 1, 0, "Create"); - qmlRegisterType("net.aimber.create", 1, 0, "CreateImportVideo"); + qmlRegisterType("app.screenplay.create", 1, 0, "Create"); + qmlRegisterType("app.screenplay.create", 1, 0, "CreateImportVideo"); } void Create::createWallpaperStart(QString videoPath) diff --git a/ScreenPlay/src/monitorlistmodel.cpp b/ScreenPlay/src/monitorlistmodel.cpp index b24ecf4f..5f5b40e1 100644 --- a/ScreenPlay/src/monitorlistmodel.cpp +++ b/ScreenPlay/src/monitorlistmodel.cpp @@ -2,9 +2,10 @@ MonitorListModel::MonitorListModel(QObject* parent) : QAbstractListModel(parent) + , m_qGuiApplication(static_cast(QGuiApplication::instance())) { loadMonitors(); - m_qGuiApplication = static_cast(QGuiApplication::instance()); + connect(m_qGuiApplication, &QGuiApplication::screenAdded, this, &MonitorListModel::screenAdded); connect(m_qGuiApplication, &QGuiApplication::screenRemoved, this, &MonitorListModel::screenRemoved); } @@ -128,26 +129,16 @@ void MonitorListModel::wallpaperRemoved() { } -bool MonitorListModel::getMonitorListItemAt(int position, Monitor* monitor) -{ - //TODO Reimplement wallpaper replacement - // if (position < 0 && position > m_monitorList.size()) { - // return false; - // } else { - // *monitor = m_monitorList.at(position); - // return true; - // } - return true; -} - void MonitorListModel::screenAdded(QScreen* screen) { + Q_UNUSED(screen) reset(); loadMonitors(); } void MonitorListModel::screenRemoved(QScreen* screen) { + Q_UNUSED(screen) reset(); loadMonitors(); } @@ -186,10 +177,6 @@ void MonitorListModel::reloadMonitors() loadMonitors(); } -Monitor::Monitor() -{ -} - Monitor::Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry, QRect geometry, QScreen* screen) { m_screen = screen; diff --git a/ScreenPlay/src/monitorlistmodel.h b/ScreenPlay/src/monitorlistmodel.h index d998ee21..79cc69da 100644 --- a/ScreenPlay/src/monitorlistmodel.h +++ b/ScreenPlay/src/monitorlistmodel.h @@ -32,7 +32,7 @@ public: QHash roleNames() const override; enum MonitorRole { - IDRole, + IDRole = Qt::UserRole, NameRole, SizeRole, AvailableGeometryRole, @@ -49,7 +49,6 @@ public: int rowCount(const QModelIndex& parent = QModelIndex()) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - bool getMonitorListItemAt(int position, Monitor* monitor); void loadMonitors(); void screenAdded(QScreen* screen); void screenRemoved(QScreen* screen); @@ -65,7 +64,7 @@ public slots: private: QVector m_monitorList; - QGuiApplication* m_qGuiApplication; + const QGuiApplication* const m_qGuiApplication; QVector> m_plm; signals: @@ -75,7 +74,7 @@ signals: struct Monitor { - Monitor(); + Monitor() {} Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry, QRect geometry, QScreen* screen); QString m_id; diff --git a/ScreenPlay/src/profile.cpp b/ScreenPlay/src/profile.cpp deleted file mode 100644 index cdb2fe51..00000000 --- a/ScreenPlay/src/profile.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "profile.h" - -Profile::Profile() -{ - -} - -Profile::Profile(QUrl absolutePath, QString id, QString version, QString wallpaperId, QRect rect, bool isLooping) -{ - m_absolutePath = absolutePath; - m_id = id; - m_version = version; - m_wallpaperId = wallpaperId; - m_rect = rect; - m_isLooping = isLooping; -} - diff --git a/ScreenPlay/src/profile.h b/ScreenPlay/src/profile.h index 8fcedba9..e49a4acf 100644 --- a/ScreenPlay/src/profile.h +++ b/ScreenPlay/src/profile.h @@ -12,8 +12,16 @@ struct Profile { - Profile(); - Profile(QUrl absolutePath, QString id, QString version, QString wallpaperId, QRect rect, bool isLooping); + Profile() {} + Profile(QUrl absolutePath, QString id, QString version, QString wallpaperId, QRect rect, bool isLooping) + { + m_absolutePath = absolutePath; + m_id = id; + m_version = version; + m_wallpaperId = wallpaperId; + m_rect = rect; + m_isLooping = isLooping; + } QUrl m_absolutePath; QString m_id; diff --git a/ScreenPlay/src/projectfile.cpp b/ScreenPlay/src/projectfile.cpp deleted file mode 100644 index f027c681..00000000 --- a/ScreenPlay/src/projectfile.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "projectfile.h" - -ProjectFile::ProjectFile(QJsonObject obj, QString folderName, QUrl absolutePath) -{ - - if (obj.contains("description")) - m_description = obj.value("description"); - - if (obj.contains("file")) - m_file = obj.value("file"); - - if (obj.contains("preview")) - m_preview = obj.value("preview"); - - if (obj.contains("previewGIF")) - m_previewGIF = obj.value("previewGIF"); - - if (obj.contains("title")) - m_title = obj.value("title"); - - if (obj.contains("type")) { - QString tmp = obj.value("type").toString().toLower(); - if (tmp == "video") { - m_type = "video"; - } else if (tmp == "qmlwidget" || tmp == "standalonewidget") { - m_type = "widget"; - } else if (tmp == "qmlscene") { - m_type = "qmlScene"; - } else if (tmp == "html") { - m_type = "html"; - } - } - - if (obj.contains("workshopid")) { - m_workshopID = obj.value("workshopid").toInt(); - } else { - m_workshopID = 0; - } - - m_absoluteStoragePath = QUrl(absolutePath.toString() + "/" + folderName); - - m_folderId = folderName; -} - -ProjectFile::ProjectFile() -{ -} - -ProjectFile::~ProjectFile() -{ -} diff --git a/ScreenPlay/src/projectfile.h b/ScreenPlay/src/projectfile.h index 2337434f..62e86fb3 100644 --- a/ScreenPlay/src/projectfile.h +++ b/ScreenPlay/src/projectfile.h @@ -14,9 +14,50 @@ struct ProjectFile { - explicit ProjectFile(QJsonObject obj, QString folderName, QUrl absolutePath); - ProjectFile(); - ~ProjectFile(); + ProjectFile(QJsonObject obj, QString folderName, QUrl absolutePath) + { + + if (obj.contains("description")) + m_description = obj.value("description"); + + if (obj.contains("file")) + m_file = obj.value("file"); + + if (obj.contains("preview")) + m_preview = obj.value("preview"); + + if (obj.contains("previewGIF")) + m_previewGIF = obj.value("previewGIF"); + + if (obj.contains("title")) + m_title = obj.value("title"); + + if (obj.contains("type")) { + QString tmp = obj.value("type").toString().toLower(); + if (tmp == "video") { + m_type = "video"; + } else if (tmp == "qmlwidget" || tmp == "standalonewidget") { + m_type = "widget"; + } else if (tmp == "qmlscene") { + m_type = "qmlScene"; + } else if (tmp == "html") { + m_type = "html"; + } + } + + if (obj.contains("workshopid")) { + m_workshopID = obj.value("workshopid").toInt(); + } else { + m_workshopID = 0; + } + + m_absoluteStoragePath = QUrl(absolutePath.toString() + "/" + folderName); + + m_folderId = folderName; + } + + ProjectFile() {} + ~ProjectFile() {} QVariant m_description; QVariant m_file; diff --git a/ScreenPlay/src/projectsettingslistitem.cpp b/ScreenPlay/src/projectsettingslistitem.cpp deleted file mode 100644 index d41cc637..00000000 --- a/ScreenPlay/src/projectsettingslistitem.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "projectsettingslistitem.h" - -ProjectSettingsListItem::ProjectSettingsListItem(QString name, bool isHeadline, QVariant value) -{ - m_name = name; - m_isHeadline = isHeadline; - m_value = value; -} - -ProjectSettingsListItem::ProjectSettingsListItem() -{ - -} - -ProjectSettingsListItem::~ProjectSettingsListItem() -{ - -} - diff --git a/ScreenPlay/src/projectsettingslistitem.h b/ScreenPlay/src/projectsettingslistitem.h index bf119270..17a2091a 100644 --- a/ScreenPlay/src/projectsettingslistitem.h +++ b/ScreenPlay/src/projectsettingslistitem.h @@ -12,9 +12,14 @@ struct ProjectSettingsListItem { - ProjectSettingsListItem(QString name, bool isHeadline, QVariant value); - ProjectSettingsListItem(); - ~ProjectSettingsListItem(); + ProjectSettingsListItem(QString name, bool isHeadline, QVariant value) + { + m_name = name; + m_isHeadline = isHeadline; + m_value = value; + } + ProjectSettingsListItem() {} + ~ProjectSettingsListItem() {} QString m_name; bool m_isHeadline; QVariant m_value; diff --git a/ScreenPlay/src/projectsettingslistmodel.h b/ScreenPlay/src/projectsettingslistmodel.h index 332c3a9c..dbd4e963 100644 --- a/ScreenPlay/src/projectsettingslistmodel.h +++ b/ScreenPlay/src/projectsettingslistmodel.h @@ -29,7 +29,7 @@ public: QHash roleNames() const override; enum ProjectSettingsRole { - NameRole, + NameRole = Qt::UserRole, IsHeadlineRole, ValueRole, }; diff --git a/ScreenPlay/src/qmlutilities.cpp b/ScreenPlay/src/qmlutilities.cpp index 244a3240..77c83bb9 100644 --- a/ScreenPlay/src/qmlutilities.cpp +++ b/ScreenPlay/src/qmlutilities.cpp @@ -40,3 +40,61 @@ void QMLUtilities::openFolderInExplorer(QString url) explorer.startDetached(); } +void QMLUtilities::QMLUtilities::requestAllLicenses() +{ + + QtConcurrent::run([this]() { + QString tmp; + QFile file; + QTextStream out(&file); + + file.setFileName(":/legal/Font Awesome Free License.txt"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + tmp += out.readAll(); + file.close(); + + file.setFileName(":/legal/gpl-3.0.txt"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + tmp += out.readAll(); + file.close(); + + file.setFileName(":/legal/gpl-3.0.txt"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + tmp += out.readAll(); + file.close(); + + file.setFileName(":/legal/OFL.txt"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + tmp += out.readAll(); + file.close(); + + file.setFileName(":/legal/OpenSSL.txt"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + tmp += out.readAll(); + file.close(); + + file.setFileName(":/legal/Qt LGPLv3.txt"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + tmp += out.readAll(); + file.close(); + + emit this->allLicenseLoaded(tmp); + }); +} + +void QMLUtilities::QMLUtilities::requestAllLDataProtection() +{ + QtConcurrent::run([this]() { + QString tmp; + QFile file; + QTextStream out(&file); + + file.setFileName(":/legal/DataProtection.txt"); + file.open(QIODevice::ReadOnly | QIODevice::Text); + tmp += out.readAll(); + file.close(); + + emit this->allDataProtectionLoaded(tmp); + }); +} + diff --git a/ScreenPlay/src/qmlutilities.h b/ScreenPlay/src/qmlutilities.h index 2f5d6d9c..f3c39710 100644 --- a/ScreenPlay/src/qmlutilities.h +++ b/ScreenPlay/src/qmlutilities.h @@ -6,6 +6,7 @@ #include #include #include +#include /*! \class Global QML Utilities @@ -26,6 +27,8 @@ signals: void requestNavigationActive(bool isActive); void requestToggleWallpaperConfiguration(); + void allLicenseLoaded(QString licensesText); + void allDataProtectionLoaded(QString dataProtectionText); public slots: void setNavigation(QString nav); void setNavigationActive(bool isActive); @@ -33,5 +36,8 @@ public slots: void setToggleWallpaperConfiguration(); void openFolderInExplorer(QString url); + void requestAllLicenses(); + void requestAllLDataProtection(); + QString fixWindowsPath(QString url); }; diff --git a/ScreenPlay/src/screenplay.cpp b/ScreenPlay/src/screenplay.cpp index 706e6a58..8f566490 100644 --- a/ScreenPlay/src/screenplay.cpp +++ b/ScreenPlay/src/screenplay.cpp @@ -24,8 +24,6 @@ void ScreenPlay::createWallpaper( return; } - // Remove previous wallpaper, if any - //this->removeWallpaperAt(0); m_settings->increaseActiveWallpaperCounter(); m_screenPlayWallpapers.emplace_back( @@ -42,6 +40,8 @@ void ScreenPlay::createWallpaper( m_monitorListModel->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), QString { absoluteStoragePath.toLocalFile() + "/" + previewImage }); + + m_settings->saveWallpaperToConfig(monitorIndex, absoluteStoragePath, type); } void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewImage) @@ -62,9 +62,9 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewIm this)); } -void ScreenPlay::removeAllWallpaper() noexcept +void ScreenPlay::removeAllWallpaper() { - if (m_sdkconnector && m_settings && !m_screenPlayWallpapers.empty()) { + if (m_settings && !m_screenPlayWallpapers.empty()) { m_sdkconnector->closeAllWallpapers(); m_settings->setActiveWallpaperCounter(0); m_screenPlayWallpapers.clear(); @@ -73,7 +73,7 @@ void ScreenPlay::removeAllWallpaper() noexcept return; } -void ScreenPlay::requestProjectSettingsListModelAt(const int index) noexcept +void ScreenPlay::requestProjectSettingsListModelAt(const int index) { for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { if (!uPtrWallpaper->screenNumber().empty() && uPtrWallpaper->screenNumber()[0] == index) { // ??? only at index == 0 @@ -86,7 +86,7 @@ void ScreenPlay::requestProjectSettingsListModelAt(const int index) noexcept emit projectSettingsListModelNotFound(); } -void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) noexcept +void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) { Q_ASSERT(static_cast(at) < m_screenPlayWallpapers.size() && m_sdkconnector); for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { @@ -97,12 +97,10 @@ void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QStri } } -void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) noexcept +void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) { - Q_ASSERT(m_sdkconnector); for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { - if (m_sdkconnector) - m_sdkconnector->setWallpaperValue(uPtrWallpaper->appID(), key, value); + m_sdkconnector->setWallpaperValue(uPtrWallpaper->appID(), key, value); } } @@ -126,8 +124,6 @@ void ScreenPlay::removeWallpaperAt(const int at) m_screenPlayWallpapers.erase(wallsToRemove, m_screenPlayWallpapers.end()); } - - QString ScreenPlay::generateID() const { const QString possibleCharacters { diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplay.h index 2e463b57..633337aa 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplay.h @@ -54,10 +54,10 @@ public slots: const QString& previewImage, const float volume, const QString& fillMode, const QString& type); void createWidget(QUrl absoluteStoragePath, const QString& previewImage); - void removeAllWallpaper() noexcept; - void requestProjectSettingsListModelAt(const int index) noexcept; - void setWallpaperValue(const int at, const QString& key, const QString& value) noexcept; - void setAllWallpaperValue(const QString& key, const QString& value) noexcept; + void removeAllWallpaper(); + void requestProjectSettingsListModelAt(const int index); + void setWallpaperValue(const int at, const QString& key, const QString& value); + void setAllWallpaperValue(const QString& key, const QString& value); void removeWallpaperAt(const int at = 0); QString generateID() const; diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index a6189068..e1300a79 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -134,14 +134,6 @@ Settings::Settings(const shared_ptr& ilm, setupWidgetAndWindowPaths(); } -QString Settings::loadProject(QString file) -{ - QFile configTmp; - //file = file.replace("file:///", ""); - configTmp.setFileName(file); - configTmp.open(QIODevice::ReadOnly | QIODevice::Text); - return configTmp.readAll(); -} void Settings::loadActiveProfiles() { @@ -207,65 +199,11 @@ void Settings::writeSingleSettingConfig(QString name, QVariant value) configTmp.close(); } -void Settings::requestAllLicenses() +void Settings::saveWallpaperToConfig(const int monitorIndex, const QUrl& absoluteStoragePath, const QString& type) { - - QtConcurrent::run([this]() { - QString tmp; - QFile file; - QTextStream out(&file); - - file.setFileName(":/legal/Font Awesome Free License.txt"); - file.open(QIODevice::ReadOnly | QIODevice::Text); - tmp += out.readAll(); - file.close(); - - file.setFileName(":/legal/gpl-3.0.txt"); - file.open(QIODevice::ReadOnly | QIODevice::Text); - tmp += out.readAll(); - file.close(); - - file.setFileName(":/legal/gpl-3.0.txt"); - file.open(QIODevice::ReadOnly | QIODevice::Text); - tmp += out.readAll(); - file.close(); - - file.setFileName(":/legal/OFL.txt"); - file.open(QIODevice::ReadOnly | QIODevice::Text); - tmp += out.readAll(); - file.close(); - - file.setFileName(":/legal/OpenSSL.txt"); - file.open(QIODevice::ReadOnly | QIODevice::Text); - tmp += out.readAll(); - file.close(); - - file.setFileName(":/legal/Qt LGPLv3.txt"); - file.open(QIODevice::ReadOnly | QIODevice::Text); - tmp += out.readAll(); - file.close(); - - emit this->allLicenseLoaded(tmp); - }); } -void Settings::requestAllLDataProtection() -{ - QtConcurrent::run([this]() { - QString tmp; - QFile file; - QTextStream out(&file); - - file.setFileName(":/legal/DataProtection.txt"); - file.open(QIODevice::ReadOnly | QIODevice::Text); - tmp += out.readAll(); - file.close(); - - emit this->allDataProtectionLoaded(tmp); - }); -} - -void Settings::saveWallpaper(int monitorIndex, QUrl absoluteStoragePath, QStringList properties, QString type) +void Settings::removeWallpaperFromConfig(const int monitorIndex) { } @@ -349,38 +287,3 @@ void Settings::setupWidgetAndWindowPaths() } #endif } - -bool Settings::getOfflineMode() const -{ - return m_offlineMode; -} - -QUrl Settings::getScreenPlayWidgetPath() const -{ - return m_screenPlayWidgetPath; -} - -void Settings::setScreenPlayWidgetPath(const QUrl& screenPlayWidgetPath) -{ - m_screenPlayWidgetPath = screenPlayWidgetPath; -} - -QUrl Settings::getScreenPlayBasePath() const -{ - return m_screenPlayBasePath; -} - -void Settings::setScreenPlayBasePath(QUrl screenPlayBasePath) -{ - m_screenPlayBasePath = screenPlayBasePath; -} - -QUrl Settings::getScreenPlayWindowPath() const -{ - return m_screenPlayWindowPath; -} - -void Settings::setScreenPlayWindowPath(const QUrl& screenPlayWindowPath) -{ - m_screenPlayWindowPath = screenPlayWindowPath; -} diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index b945bb43..d674cccb 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -96,16 +96,40 @@ public: return m_offlineMode; } - QUrl getScreenPlayWindowPath() const; - void setScreenPlayWindowPath(const QUrl& screenPlayWindowPath); + QUrl getScreenPlayWindowPath() const + { + return m_screenPlayWindowPath; + } - QUrl getScreenPlayBasePath() const; - void setScreenPlayBasePath(QUrl screenPlayBasePath); + void setScreenPlayWindowPath(const QUrl& screenPlayWindowPath) + { + m_screenPlayWindowPath = screenPlayWindowPath; + } - QUrl getScreenPlayWidgetPath() const; - void setScreenPlayWidgetPath(const QUrl& screenPlayWidgetPath); + QUrl getScreenPlayBasePath() const + { + return m_screenPlayBasePath; + } - bool getOfflineMode() const; + void setScreenPlayBasePath(QUrl screenPlayBasePath) + { + m_screenPlayBasePath = screenPlayBasePath; + } + + QUrl getScreenPlayWidgetPath() const + { + return m_screenPlayWidgetPath; + } + + void setScreenPlayWidgetPath(const QUrl& screenPlayWidgetPath) + { + m_screenPlayWidgetPath = screenPlayWidgetPath; + } + + bool getOfflineMode() const + { + return m_offlineMode; + } signals: void autostartChanged(bool autostart); @@ -118,14 +142,11 @@ signals: void activeWallpaperCounterChanged(int activeWallpaperCounter); void pauseWallpaperWhenIngameChanged(bool pauseWallpaperWhenIngame); void offlineModeChanged(bool offlineMode); - void allLicenseLoaded(QString licensesText); - void allDataProtectionLoaded(QString dataProtectionText); public slots: void writeSingleSettingConfig(QString name, QVariant value); - void requestAllLicenses(); - void requestAllLDataProtection(); - void saveWallpaper(int monitorIndex, QUrl absoluteStoragePath, QStringList properties, QString type); + void saveWallpaperToConfig(const int monitorIndex, const QUrl& absoluteStoragePath, const QString& type); + void removeWallpaperFromConfig(const int monitorIndex); void setqSetting(const QString& key, const QString& value); bool autostart() const @@ -193,8 +214,6 @@ public slots: emit sendStatisticsChanged(m_sendStatistics); } - QString loadProject(QString file); - void setLocalStoragePath(QUrl localStoragePath) { if (m_localStoragePath == localStoragePath) diff --git a/ScreenPlaySDK/Screenplaysdk.pro b/ScreenPlaySDK/Screenplaysdk.pro index 86ecaec9..dec2517f 100644 --- a/ScreenPlaySDK/Screenplaysdk.pro +++ b/ScreenPlaySDK/Screenplaysdk.pro @@ -5,7 +5,7 @@ TARGET = $$qtLibraryTarget($$TARGET) QT += qml quick CONFIG += plugin c++11 -uri = net.aimber.screenplaysdk +uri = app.screenplay.screenplaysdk # Input SOURCES += \ diff --git a/ScreenPlaySDK/qmldir b/ScreenPlaySDK/qmldir index 996d828c..407446e1 100644 --- a/ScreenPlaySDK/qmldir +++ b/ScreenPlaySDK/qmldir @@ -1,2 +1,2 @@ -module net.aimber.screenplaysdk +module app.screenplay.screenplaysdk plugin ScreenPlaySDK diff --git a/ScreenPlaySDK/screenplay-sdk_plugin.cpp b/ScreenPlaySDK/screenplay-sdk_plugin.cpp index 510094cb..05f3157a 100644 --- a/ScreenPlaySDK/screenplay-sdk_plugin.cpp +++ b/ScreenPlaySDK/screenplay-sdk_plugin.cpp @@ -5,7 +5,7 @@ void ScreenPlay_SDKPlugin::registerTypes(const char *uri) { - // @uri net.aimber.screenplaysdk + // @uri app.screenplay.screenplaysdk qmlRegisterType(uri, 1, 0, "ScreenPlaySDK"); } diff --git a/ScreenPlaySysInfo/ScreenPlaySysInfo.pro b/ScreenPlaySysInfo/ScreenPlaySysInfo.pro index 8d7d5f68..eb0a91d9 100644 --- a/ScreenPlaySysInfo/ScreenPlaySysInfo.pro +++ b/ScreenPlaySysInfo/ScreenPlaySysInfo.pro @@ -4,7 +4,7 @@ QT += qml quick CONFIG += plugin c++11 TARGET = $$qtLibraryTarget($$TARGET) -uri = net.aimber.sysinfo +uri = app.screenplay.sysinfo # Input SOURCES += \ diff --git a/ScreenPlaySysInfo/qmldir b/ScreenPlaySysInfo/qmldir index 91ce4148..c4d3e662 100644 --- a/ScreenPlaySysInfo/qmldir +++ b/ScreenPlaySysInfo/qmldir @@ -1,2 +1,2 @@ -module net.aimber.sysinfo +module app.screenplay.sysinfo plugin ScreenPlaySysInfo diff --git a/ScreenPlaySysInfo/screenplaysysinfo_plugin.cpp b/ScreenPlaySysInfo/screenplaysysinfo_plugin.cpp index 250b64ed..2e7ab605 100644 --- a/ScreenPlaySysInfo/screenplaysysinfo_plugin.cpp +++ b/ScreenPlaySysInfo/screenplaysysinfo_plugin.cpp @@ -13,7 +13,7 @@ QObject* ScreenPlaySysInfoSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) void ScreenPlaySysInfoPlugin::registerTypes(const char* uri) { - // @uri net.aimber.sysinfo + // @uri app.screenplay.sysinfo qmlRegisterSingletonType(uri, 1, 0, "SysInfo", ScreenPlaySysInfoSingleton); } diff --git a/ScreenPlayWidget/mainWidget.qml b/ScreenPlayWidget/mainWidget.qml index 26e26f93..6a7c137b 100644 --- a/ScreenPlayWidget/mainWidget.qml +++ b/ScreenPlayWidget/mainWidget.qml @@ -1,7 +1,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.3 -import net.aimber.screenplaysdk 1.0 +import app.screenplay.screenplaysdk 1.0 Item { id: mainWindow diff --git a/ScreenPlayWindow/mainWindow.qml b/ScreenPlayWindow/mainWindow.qml index 129da0b2..28c352a9 100644 --- a/ScreenPlayWindow/mainWindow.qml +++ b/ScreenPlayWindow/mainWindow.qml @@ -1,6 +1,6 @@ import QtQuick 2.12 import QtWebEngine 1.8 -import net.aimber.wallpaper 1.0 +import app.screenplay.wallpaper 1.0 Rectangle { id: root diff --git a/ScreenPlayWindow/src/basewindow.cpp b/ScreenPlayWindow/src/basewindow.cpp index 72d225d3..443ae5bf 100644 --- a/ScreenPlayWindow/src/basewindow.cpp +++ b/ScreenPlayWindow/src/basewindow.cpp @@ -11,7 +11,7 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent) { QApplication::instance()->installEventFilter(this); qRegisterMetaType(); - qmlRegisterType("net.aimber.wallpaper", 1, 0, "Wallpaper"); + qmlRegisterType("app.screenplay.wallpaper", 1, 0, "Wallpaper"); if (projectFilePath == "test") { setType(BaseWindow::WallpaperType::Qml); diff --git a/ScreenPlayWindow/src/winwindow.cpp b/ScreenPlayWindow/src/winwindow.cpp index c27b962a..f568343e 100644 --- a/ScreenPlayWindow/src/winwindow.cpp +++ b/ScreenPlayWindow/src/winwindow.cpp @@ -118,7 +118,7 @@ WinWindow::WinWindow(QVector& activeScreensList, QString projectPath, QStri // the window visible via set Visible. if (projectPath != "test") { // Let QML decide when were are read to show the window - ShowWindow(m_windowHandle, SW_HIDE); + // ShowWindow(m_windowHandle, SW_HIDE); } } From 54f597529a085b9cbf3b49d4c62093f2bdf48ee3 Mon Sep 17 00:00:00 2001 From: Elias Date: Mon, 10 Jun 2019 16:27:17 +0200 Subject: [PATCH 11/15] Cleanup --- ScreenPlay/Resources.qrc | 21 +- ScreenPlay/main.qml | 6 +- ScreenPlay/qml/{ => Common}/Background.qml | 0 .../qml/{Controls => Common}/Slider.qml | 0 ScreenPlay/qml/Community/Community.qml | 2 +- ScreenPlay/qml/Controls/Tag.qml | 5 - ScreenPlay/qml/Controls/TagField.qml | 5 - ScreenPlay/qml/Create/Create.qml | 4 +- .../CreateWallpaper/CreateWallpaperResult.qml | 2 +- .../CreateWallpaperVideoImportConvert.qml | 2 +- .../CreateWallpaper/CreateWallpaperWizard.qml | 2 +- ScreenPlay/qml/FileDropper.qml | 117 --------- ScreenPlay/qml/FileDropperSingleFile.qml | 225 ------------------ ScreenPlay/qml/Installed/Sidebar.qml | 2 +- .../qml/{ => Monitors}/MonitorSelection.qml | 0 .../{ => Monitors}/MonitorSelectionItem.qml | 0 ScreenPlay/qml/{ => Monitors}/Monitors.qml | 2 +- .../MonitorsProjectSettingItem.qml | 0 .../qml/{ => Navigation}/Navigation.qml | 11 +- .../qml/{ => Navigation}/NavigationItem.qml | 0 .../NavigationWallpaperConfiguration.qml | 0 ScreenPlay/qml/Widgets/Window.qml | 59 ----- ScreenPlay/qml/Workshop/Workshop.qml | 2 +- .../qml/Workshop/WorkshopAvailableTest.qml | 2 +- ScreenPlay/src/create.cpp | 8 +- ScreenPlay/src/settings.cpp | 2 - ScreenPlaySDK/Screenplaysdk.pro | 2 +- ScreenPlaySDK/qmldir | 2 +- ScreenPlaySDK/screenplay-sdk_plugin.cpp | 2 +- ScreenPlaySysInfo/ScreenPlaySysInfo.pro | 2 +- ScreenPlaySysInfo/qmldir | 2 +- .../screenplaysysinfo_plugin.cpp | 2 +- ScreenPlayWidget/mainWidget.qml | 2 +- ScreenPlayWindow/mainWindow.qml | 2 +- ScreenPlayWindow/src/basewindow.cpp | 2 +- 35 files changed, 38 insertions(+), 459 deletions(-) rename ScreenPlay/qml/{ => Common}/Background.qml (100%) rename ScreenPlay/qml/{Controls => Common}/Slider.qml (100%) delete mode 100644 ScreenPlay/qml/Controls/Tag.qml delete mode 100644 ScreenPlay/qml/Controls/TagField.qml delete mode 100644 ScreenPlay/qml/FileDropper.qml delete mode 100644 ScreenPlay/qml/FileDropperSingleFile.qml rename ScreenPlay/qml/{ => Monitors}/MonitorSelection.qml (100%) rename ScreenPlay/qml/{ => Monitors}/MonitorSelectionItem.qml (100%) rename ScreenPlay/qml/{ => Monitors}/Monitors.qml (99%) rename ScreenPlay/qml/{ => Monitors}/MonitorsProjectSettingItem.qml (100%) rename ScreenPlay/qml/{ => Navigation}/Navigation.qml (90%) rename ScreenPlay/qml/{ => Navigation}/NavigationItem.qml (100%) rename ScreenPlay/qml/{ => Navigation}/NavigationWallpaperConfiguration.qml (100%) delete mode 100644 ScreenPlay/qml/Widgets/Window.qml diff --git a/ScreenPlay/Resources.qrc b/ScreenPlay/Resources.qrc index 23ba79dd..65880a34 100644 --- a/ScreenPlay/Resources.qrc +++ b/ScreenPlay/Resources.qrc @@ -77,7 +77,6 @@ main.qml qml/Community/Community.qml qml/Community/Feedback.qml - qml/Controls/Slider.qml qml/Create/Create.qml qml/Create/CreateNew.qml qml/Create/CreateUpload.qml @@ -85,21 +84,12 @@ qml/Create/CreateWidget.qml qml/Create/CreateWidgetButton.qml qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml - qml/FileDropper.qml - qml/FileDropperSingleFile.qml qml/Installed/Installed.qml qml/Installed/InstalledNavigation.qml qml/Installed/InstalledUserHelper.qml qml/Installed/ScreenPlayItem.qml qml/Installed/ScreenPlayItemImage.qml qml/Installed/Sidebar.qml - qml/MonitorSelection.qml - qml/MonitorSelectionItem.qml - qml/Monitors.qml - qml/MonitorsProjectSettingItem.qml - qml/Navigation.qml - qml/NavigationItem.qml - qml/NavigationWallpaperConfiguration.qml qml/Settings/SettingBool.qml qml/Settings/Settings.qml qml/Settings/SettingsButton.qml @@ -107,7 +97,6 @@ qml/Settings/SettingsExpander.qml qml/Settings/SettingsHeader.qml qml/Settings/SettingsHorizontalSeperator.qml - qml/Widgets/Window.qml qml/Workshop/Workshop.qml qtquickcontrols2.conf settings.json @@ -115,7 +104,6 @@ translations/ScreenPlay_en.qm qml/Screen/Screen.qml assets/icons/icon_screen.svg - qml/Background.qml qml/Community/XMLNewsfeed.qml qml/Workshop/WorkshopAvailableTest.qml qml/Workshop/WorkshopLoader.qml @@ -125,5 +113,14 @@ qml/Common/Tag.qml assets/icons/icon_close.svg qml/Common/ImageSelector.qml + qml/Common/Slider.qml + qml/Monitors/Monitors.qml + qml/Monitors/MonitorSelection.qml + qml/Monitors/MonitorSelectionItem.qml + qml/Monitors/MonitorsProjectSettingItem.qml + qml/Common/Background.qml + qml/Navigation/Navigation.qml + qml/Navigation/NavigationItem.qml + qml/Navigation/NavigationWallpaperConfiguration.qml diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index 3c1828a1..e49ce3cd 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -5,14 +5,16 @@ import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import Qt.labs.platform 1.0 - import "qml/" +import "qml/Monitors" +import "qml/Common" import "qml/Installed" +import "qml/Navigation" ApplicationWindow { id: window color: "#eeeeee" - // Set visible if the -silent parameter was not set + // Set visible if the -silent parameter was not set (see main.cpp:87). visible: false width: 1400 title: "ScreenPlay 0.2" diff --git a/ScreenPlay/qml/Background.qml b/ScreenPlay/qml/Common/Background.qml similarity index 100% rename from ScreenPlay/qml/Background.qml rename to ScreenPlay/qml/Common/Background.qml diff --git a/ScreenPlay/qml/Controls/Slider.qml b/ScreenPlay/qml/Common/Slider.qml similarity index 100% rename from ScreenPlay/qml/Controls/Slider.qml rename to ScreenPlay/qml/Common/Slider.qml diff --git a/ScreenPlay/qml/Community/Community.qml b/ScreenPlay/qml/Community/Community.qml index 0786941a..be9e9961 100644 --- a/ScreenPlay/qml/Community/Community.qml +++ b/ScreenPlay/qml/Community/Community.qml @@ -224,7 +224,7 @@ Item { icon.width: 16 icon.height: 16 onClicked: Qt.openUrlExternally( - "https://gitlab.com/aimber/ScreenPlay/") + "https://gitlab.com/kelteseth/ScreenPlay/") } Button { text: qsTr("Workshop") diff --git a/ScreenPlay/qml/Controls/Tag.qml b/ScreenPlay/qml/Controls/Tag.qml deleted file mode 100644 index 9c36e13c..00000000 --- a/ScreenPlay/qml/Controls/Tag.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtQuick 2.0 - -Item { - -} diff --git a/ScreenPlay/qml/Controls/TagField.qml b/ScreenPlay/qml/Controls/TagField.qml deleted file mode 100644 index 9c36e13c..00000000 --- a/ScreenPlay/qml/Controls/TagField.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtQuick 2.0 - -Item { - -} diff --git a/ScreenPlay/qml/Create/Create.qml b/ScreenPlay/qml/Create/Create.qml index 597f41cd..73776f44 100644 --- a/ScreenPlay/qml/Create/Create.qml +++ b/ScreenPlay/qml/Create/Create.qml @@ -4,7 +4,7 @@ import QtQuick.Controls.Material 2.2 import QtQuick.Particles 2.0 import QtGraphicalEffects 1.0 -import app.screenplay.create 1.0 +import ScreenPlay.Create 1.0 import "Wizards/CreateWallpaper" @@ -237,7 +237,7 @@ Item { icon.width: 16 icon.height: 16 onClicked: Qt.openUrlExternally( - "https://aimber.gitlab.io/ScreenPlayDocs/") + "https://kelteseth.gitlab.io/ScreenPlayDocs/") } Button { text: qsTr("Forums") diff --git a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml index 3abeaee1..025f7cf5 100644 --- a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml +++ b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml @@ -4,7 +4,7 @@ import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.3 import Qt.labs.platform 1.0 import QtQuick.Layouts 1.3 -import app.screenplay.create 1.0 +import ScreenPlay.Create 1.0 Item { id: wrapperError diff --git a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml index b617bce0..eb7b8211 100644 --- a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml +++ b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material 2.3 import Qt.labs.platform 1.0 import QtQuick.Layouts 1.12 -import app.screenplay.create 1.0 +import ScreenPlay.Create 1.0 import "../../../Common" diff --git a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml index 576c7f36..e85469d2 100644 --- a/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml +++ b/ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material 2.3 import Qt.labs.platform 1.0 import QtQuick.Layouts 1.3 -import app.screenplay.create 1.0 +import ScreenPlay.Create 1.0 Item { id: createNew diff --git a/ScreenPlay/qml/FileDropper.qml b/ScreenPlay/qml/FileDropper.qml deleted file mode 100644 index 1dba9d2e..00000000 --- a/ScreenPlay/qml/FileDropper.qml +++ /dev/null @@ -1,117 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Extras 1.4 -import PackageFileHandler 1.0 - -DropArea { - id:dropper - state:"invisible" - - onEntered: { - dropper.state = "visible" - } - - onExited: { - dropper.state = "invisible" - } - - Connections { - target: packageFileHandler - onCurrentLoaderStatusChanged:{ - - } - } - - onDropped: { - var a= packageFileHandler.loadPackageFromLocalZip(drop.urls,".") - - - if(a === -1) { - dropper.state = "badFile" - timer.start() - } else if(a === 0){ - dropper.state = "invisible" - } - - } - - Timer { - id:timer - interval: 1000 - onTriggered: { - dropper.state = "invisible" - timer.stop() - } - } - - - Rectangle { - id:fill - anchors.fill: parent - opacity: .8 - - Picture { - id: picture - x: 332 - y: 208 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - source: "qrc://assets/icons/icon_settings.svg" - } - } - - Text { - id: text1 - text: qsTr("Bad File!!") - font.pointSize: 24 - opacity: 1 - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - } - states: [ - State { - name: "visible" - }, - State { - name: "invisible" - - PropertyChanges { - target: fill - opacity: 0 - } - - PropertyChanges { - target: text1 - opacity: 0 - } - }, - State { - name: "badFile" - } - ] - - transitions: [ - Transition { - from: "*" - to: "invisible" - - NumberAnimation { - target: fill - property: "opacity" - duration: 200 - easing.type: Easing.OutQuart - } - }, - Transition { - from: "invisible" - to: "visible" - - NumberAnimation { - target: fill - property: "opacity" - duration: 200 - easing.type: Easing.OutQuart - } - } - ] - -} diff --git a/ScreenPlay/qml/FileDropperSingleFile.qml b/ScreenPlay/qml/FileDropperSingleFile.qml deleted file mode 100644 index 31215fb6..00000000 --- a/ScreenPlay/qml/FileDropperSingleFile.qml +++ /dev/null @@ -1,225 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Dialogs 1.2 - -Rectangle { - id: fileDropperSingleFile - - property color background: "white" - property string descriptionTitle: "value" - property url imagePath: "qrc:/assets/icons/icon_plus.svg" - //FIXME in 5.10 with an enum - property bool isVideo: false - property url externalFilePath - property string helpText: "help" - - color: fileDropperSingleFile.background - border.color: "#C2C2C2" - border.width: 2 - radius: 4 - state: "" - - function reset(){ - fileDropperSingleFile.state = "empty" - previewImage.source = "" - videoPreviewLoader.source = "" - } - - onStateChanged: { - if (fileDropperSingleFile.state === "error") { - stateChangedTimer.start() - } - } - Timer { - id: stateChangedTimer - onTriggered: { - fileDropperSingleFile.state = "empty" - } - } - - Image { - id: previewImage - anchors.fill: parent - anchors.margins: 2 - z: 98 - fillMode: Image.PreserveAspectCrop - visible: false - } - - - - Item { - id: column - height: imageIcon.height + txtSplashInput.contentHeight - anchors { - right: parent.right - left: parent.left - verticalCenter: parent.verticalCenter - } - - Image { - id: imageIcon - width: 32 - height: 32 - sourceSize.height: 32 - sourceSize.width: 32 - source: fileDropperSingleFile.imagePath - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - } - } - Text { - id: txtSplashInput - text: descriptionTitle - anchors { - top: imageIcon.bottom - topMargin: 10 - horizontalCenter: parent.horizontalCenter - } - height: 40 - font.pointSize: 12 - color: "#626262" - horizontalAlignment: Text.AlignHCenter - font.family: "Libre Baskerville" - font.italic: true - - } - } - Text { - id: helpTextWrapper - color: "#626262" - anchors.fill: parent - anchors.margins: 20 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.family: "Libre Baskerville" - font.italic: true - wrapMode: Text.WordWrap - font.pointSize: 12 - opacity: 0 - - text: helpText - } - - DropArea { - id: dropper - anchors.fill: parent - focus: true - onEntered: { - fileDropperSingleFile.state = "fileEntered" - } - - onDropped: { - fileDropperSingleFile.state = "fileDropped" - if (drop.hasUrls) { - if (isVideo) { - if (validateVideoFileExtension(drop.urls[0])) { - externalFilePath = drop.urls[0] - videoPreviewLoader.setSource( - "CreateVideoPreviewSmall.qml", { - source: externalFilePath - }) - } - } else { - if (validateImageFileExtension(drop.urls[0])) { - externalFilePath = drop.urls[0] - previewImage.source = drop.urls[0] - previewImage.visible = true - } - } - } - } - - onExited: { - fileDropperSingleFile.state = "empty" - } - - function validateImageFileExtension(filePath) { - var tmp = filePath.split('.').pop() - return tmp === "png" || tmp === "jpg" - } - - function validateVideoFileExtension(filePath) { - var tmp = filePath.split('.').pop() - return tmp === "vp9" || tmp === "mp4" - } - MouseArea { - anchors.fill: parent - focus: true - z: 99 - hoverEnabled: true - onHoveredChanged: { - if (containsMouse && videoPreviewLoader.source.toString() === "") { - fileDropperSingleFile.state = "hover" - } else { - fileDropperSingleFile.state = "" - } - } - } - } - Loader { - id: videoPreviewLoader - asynchronous: true - anchors.fill: parent - anchors.margins: 2 - z: 300 - } - states: [ - State { - name: "fileEntered" - - PropertyChanges { - target: fileDropperSingleFile - color: "#d9d9d9" - } - }, - State { - name: "fileDropped" - - PropertyChanges { - target: fileDropperSingleFile - color: "#ffbf49" - } - }, - State { - name: "empty" - PropertyChanges { - target: fileDropperSingleFile - color: "white" - } - }, - State { - name: "error" - - PropertyChanges { - target: fileDropperSingleFile - color: "#ff4d4d" - } - }, - State { - name: "hover" - PropertyChanges { - target: column - opacity: 0 - } - PropertyChanges { - target: helpTextWrapper - opacity: 1 - } - } - ] - transitions: [ - Transition { - from: "*" - to: "*" - - ColorAnimation { - duration: 200 - } - NumberAnimation { - property: "opacity" - duration: 200 - } - } - ] -} diff --git a/ScreenPlay/qml/Installed/Sidebar.qml b/ScreenPlay/qml/Installed/Sidebar.qml index 6bd9f82a..b50884ad 100644 --- a/ScreenPlay/qml/Installed/Sidebar.qml +++ b/ScreenPlay/qml/Installed/Sidebar.qml @@ -4,7 +4,7 @@ import QtQuick.Controls 2.3 import QtQuick.Extras 1.4 import QtQuick.Controls.Material 2.2 -import "../" +import "../Monitors" Item { id: sidebar diff --git a/ScreenPlay/qml/MonitorSelection.qml b/ScreenPlay/qml/Monitors/MonitorSelection.qml similarity index 100% rename from ScreenPlay/qml/MonitorSelection.qml rename to ScreenPlay/qml/Monitors/MonitorSelection.qml diff --git a/ScreenPlay/qml/MonitorSelectionItem.qml b/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml similarity index 100% rename from ScreenPlay/qml/MonitorSelectionItem.qml rename to ScreenPlay/qml/Monitors/MonitorSelectionItem.qml diff --git a/ScreenPlay/qml/Monitors.qml b/ScreenPlay/qml/Monitors/Monitors.qml similarity index 99% rename from ScreenPlay/qml/Monitors.qml rename to ScreenPlay/qml/Monitors/Monitors.qml index 9b082c13..eb60c588 100644 --- a/ScreenPlay/qml/Monitors.qml +++ b/ScreenPlay/qml/Monitors/Monitors.qml @@ -4,7 +4,7 @@ import QtGraphicalEffects 1.0 import QtQuick.Controls.Material 2.2 import QtQuick.Layouts 1.3 -import "Controls/" as SP +import "../Common/" as SP Item { id: monitors diff --git a/ScreenPlay/qml/MonitorsProjectSettingItem.qml b/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml similarity index 100% rename from ScreenPlay/qml/MonitorsProjectSettingItem.qml rename to ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml diff --git a/ScreenPlay/qml/Navigation.qml b/ScreenPlay/qml/Navigation/Navigation.qml similarity index 90% rename from ScreenPlay/qml/Navigation.qml rename to ScreenPlay/qml/Navigation/Navigation.qml index e1916642..ea03682d 100644 --- a/ScreenPlay/qml/Navigation.qml +++ b/ScreenPlay/qml/Navigation/Navigation.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 2.3 import QtGraphicalEffects 1.0 -import "Workshop" +import "../Workshop" Rectangle { id: navigation @@ -14,7 +14,7 @@ Rectangle { signal changePage(string name) - property var navArray: [navCreate, navWorkshop, navInstalled, navSettings, navCommunity, navScreen] + property var navArray: [navCreate, navWorkshop, navInstalled, navSettings, navCommunity] property bool navActive: true Connections { @@ -86,13 +86,6 @@ Rectangle { onPageClicked: navigation.onPageChanged(name) } - NavigationItem { - id: navScreen - state: "inactive" - name: "Screen" - iconSource: "qrc:/assets/icons/icon_screen.svg" - onPageClicked: navigation.onPageChanged(name) - } NavigationItem { id: navCommunity diff --git a/ScreenPlay/qml/NavigationItem.qml b/ScreenPlay/qml/Navigation/NavigationItem.qml similarity index 100% rename from ScreenPlay/qml/NavigationItem.qml rename to ScreenPlay/qml/Navigation/NavigationItem.qml diff --git a/ScreenPlay/qml/NavigationWallpaperConfiguration.qml b/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml similarity index 100% rename from ScreenPlay/qml/NavigationWallpaperConfiguration.qml rename to ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml diff --git a/ScreenPlay/qml/Widgets/Window.qml b/ScreenPlay/qml/Widgets/Window.qml deleted file mode 100644 index 41973dc0..00000000 --- a/ScreenPlay/qml/Widgets/Window.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.0 -import QtQuick.Window 2.0 - - -Window { - id: mainWindow - visible: true - width: 640 - - height: 480 - //color: "transparent" - flags: Qt.SplashScreen | Qt.ToolTip | Qt.WindowStaysOnBottomHint - - - Rectangle { - id: rectangle - anchors.fill: parent; - color: "#b31f2934" - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - Text { - id: text1 - color: "#ffffff" - text: "empty" - font.pointSize: 29 - } - - - } - - MouseArea { - property variant clickPos: "1,1" - anchors.fill: parent; - - - onPressed: { - clickPos = Qt.point(mouse.x,mouse.y) - } - - onPositionChanged: { - var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y) - var new_x = mainWindow.x + delta.x - var new_y = mainWindow.y + delta.y - if (new_y <= 0) - mainWindow.visibility = Window.Maximized - else - { - if (mainWindow.visibility === Window.Maximized) - mainWindow.visibility = Window.Windowed - mainWindow.x = new_x - mainWindow.y = new_y - } - } - } - -} diff --git a/ScreenPlay/qml/Workshop/Workshop.qml b/ScreenPlay/qml/Workshop/Workshop.qml index 6a095e56..62020569 100644 --- a/ScreenPlay/qml/Workshop/Workshop.qml +++ b/ScreenPlay/qml/Workshop/Workshop.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.2 import QtGraphicalEffects 1.0 -import app.screenplay.workshop 1.0 +import ScreenPlay.Workshop 1.0 Item { id: workshop diff --git a/ScreenPlay/qml/Workshop/WorkshopAvailableTest.qml b/ScreenPlay/qml/Workshop/WorkshopAvailableTest.qml index 32b318f3..2c021fbf 100644 --- a/ScreenPlay/qml/Workshop/WorkshopAvailableTest.qml +++ b/ScreenPlay/qml/Workshop/WorkshopAvailableTest.qml @@ -1,5 +1,5 @@ import QtQuick 2.12 -import app.screenplay.workshop 1.0 +import ScreenPlay.Workshop 1.0 Item { diff --git a/ScreenPlay/src/create.cpp b/ScreenPlay/src/create.cpp index a42bb1da..a6aef077 100644 --- a/ScreenPlay/src/create.cpp +++ b/ScreenPlay/src/create.cpp @@ -16,8 +16,8 @@ Create::Create(const shared_ptr& settings, QObject* parent) { qRegisterMetaType(); - qmlRegisterType("app.screenplay.create", 1, 0, "Create"); - qmlRegisterType("app.screenplay.create", 1, 0, "CreateImportVideo"); + qmlRegisterType("ScreenPlay.Create", 1, 0, "Create"); + qmlRegisterType("ScreenPlay.Create", 1, 0, "CreateImportVideo"); } // Constructor for the QMLEngine @@ -26,8 +26,8 @@ Create::Create() , m_settings(nullptr) { qRegisterMetaType(); - qmlRegisterType("app.screenplay.create", 1, 0, "Create"); - qmlRegisterType("app.screenplay.create", 1, 0, "CreateImportVideo"); + qmlRegisterType("ScreenPlay.Create", 1, 0, "Create"); + qmlRegisterType("ScreenPlay.Create", 1, 0, "CreateImportVideo"); } void Create::createWallpaperStart(QString videoPath) diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index e1300a79..ff56e9df 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -134,7 +134,6 @@ Settings::Settings(const shared_ptr& ilm, setupWidgetAndWindowPaths(); } - void Settings::loadActiveProfiles() { QJsonDocument configJsonDocument; @@ -237,7 +236,6 @@ void Settings::setupWidgetAndWindowPaths() QDir SPBaseDir(QDir::currentPath()); #ifdef QT_DEBUG - qDebug() << "Starting in Debug mode!"; if (SPWorkingDir.cdUp()) { #ifdef Q_OS_OSX diff --git a/ScreenPlaySDK/Screenplaysdk.pro b/ScreenPlaySDK/Screenplaysdk.pro index dec2517f..4ba179f3 100644 --- a/ScreenPlaySDK/Screenplaysdk.pro +++ b/ScreenPlaySDK/Screenplaysdk.pro @@ -5,7 +5,7 @@ TARGET = $$qtLibraryTarget($$TARGET) QT += qml quick CONFIG += plugin c++11 -uri = app.screenplay.screenplaysdk +uri = ScreenPlay.screenplaysdk # Input SOURCES += \ diff --git a/ScreenPlaySDK/qmldir b/ScreenPlaySDK/qmldir index 407446e1..a86567ab 100644 --- a/ScreenPlaySDK/qmldir +++ b/ScreenPlaySDK/qmldir @@ -1,2 +1,2 @@ -module app.screenplay.screenplaysdk +module ScreenPlay.screenplaysdk plugin ScreenPlaySDK diff --git a/ScreenPlaySDK/screenplay-sdk_plugin.cpp b/ScreenPlaySDK/screenplay-sdk_plugin.cpp index 05f3157a..f32c3d9f 100644 --- a/ScreenPlaySDK/screenplay-sdk_plugin.cpp +++ b/ScreenPlaySDK/screenplay-sdk_plugin.cpp @@ -5,7 +5,7 @@ void ScreenPlay_SDKPlugin::registerTypes(const char *uri) { - // @uri app.screenplay.screenplaysdk + // @uri ScreenPlay.screenplaysdk qmlRegisterType(uri, 1, 0, "ScreenPlaySDK"); } diff --git a/ScreenPlaySysInfo/ScreenPlaySysInfo.pro b/ScreenPlaySysInfo/ScreenPlaySysInfo.pro index eb0a91d9..c74599bd 100644 --- a/ScreenPlaySysInfo/ScreenPlaySysInfo.pro +++ b/ScreenPlaySysInfo/ScreenPlaySysInfo.pro @@ -4,7 +4,7 @@ QT += qml quick CONFIG += plugin c++11 TARGET = $$qtLibraryTarget($$TARGET) -uri = app.screenplay.sysinfo +uri = ScreenPlay.Sysinfo # Input SOURCES += \ diff --git a/ScreenPlaySysInfo/qmldir b/ScreenPlaySysInfo/qmldir index c4d3e662..1d57f96e 100644 --- a/ScreenPlaySysInfo/qmldir +++ b/ScreenPlaySysInfo/qmldir @@ -1,2 +1,2 @@ -module app.screenplay.sysinfo +module ScreenPlay.Sysinfo plugin ScreenPlaySysInfo diff --git a/ScreenPlaySysInfo/screenplaysysinfo_plugin.cpp b/ScreenPlaySysInfo/screenplaysysinfo_plugin.cpp index 2e7ab605..c26f0072 100644 --- a/ScreenPlaySysInfo/screenplaysysinfo_plugin.cpp +++ b/ScreenPlaySysInfo/screenplaysysinfo_plugin.cpp @@ -13,7 +13,7 @@ QObject* ScreenPlaySysInfoSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) void ScreenPlaySysInfoPlugin::registerTypes(const char* uri) { - // @uri app.screenplay.sysinfo + // @uri ScreenPlay.Sysinfo qmlRegisterSingletonType(uri, 1, 0, "SysInfo", ScreenPlaySysInfoSingleton); } diff --git a/ScreenPlayWidget/mainWidget.qml b/ScreenPlayWidget/mainWidget.qml index 6a7c137b..29c67c6c 100644 --- a/ScreenPlayWidget/mainWidget.qml +++ b/ScreenPlayWidget/mainWidget.qml @@ -1,7 +1,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.3 -import app.screenplay.screenplaysdk 1.0 +import ScreenPlay.screenplaysdk 1.0 Item { id: mainWindow diff --git a/ScreenPlayWindow/mainWindow.qml b/ScreenPlayWindow/mainWindow.qml index 28c352a9..d307ee3f 100644 --- a/ScreenPlayWindow/mainWindow.qml +++ b/ScreenPlayWindow/mainWindow.qml @@ -1,6 +1,6 @@ import QtQuick 2.12 import QtWebEngine 1.8 -import app.screenplay.wallpaper 1.0 +import ScreenPlay.Wallpaper 1.0 Rectangle { id: root diff --git a/ScreenPlayWindow/src/basewindow.cpp b/ScreenPlayWindow/src/basewindow.cpp index 443ae5bf..e592bc5a 100644 --- a/ScreenPlayWindow/src/basewindow.cpp +++ b/ScreenPlayWindow/src/basewindow.cpp @@ -11,7 +11,7 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent) { QApplication::instance()->installEventFilter(this); qRegisterMetaType(); - qmlRegisterType("app.screenplay.wallpaper", 1, 0, "Wallpaper"); + qmlRegisterType("ScreenPlay.Wallpaper", 1, 0, "Wallpaper"); if (projectFilePath == "test") { setType(BaseWindow::WallpaperType::Qml); From 6495d5e75d7ff98c665e29bb8da21759f93f795c Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 11 Jun 2019 13:40:11 +0200 Subject: [PATCH 12/15] Add RippleEffect --- ScreenPlay/Resources.qrc | 1 + ScreenPlay/qml/Common/RippleEffect.qml | 111 ++++++++++++++++++ ScreenPlay/qml/Navigation/Navigation.qml | 8 +- .../NavigationWallpaperConfiguration.qml | 21 +++- 4 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 ScreenPlay/qml/Common/RippleEffect.qml diff --git a/ScreenPlay/Resources.qrc b/ScreenPlay/Resources.qrc index 65880a34..8f4d0a69 100644 --- a/ScreenPlay/Resources.qrc +++ b/ScreenPlay/Resources.qrc @@ -122,5 +122,6 @@ qml/Navigation/Navigation.qml qml/Navigation/NavigationItem.qml qml/Navigation/NavigationWallpaperConfiguration.qml + qml/Common/RippleEffect.qml diff --git a/ScreenPlay/qml/Common/RippleEffect.qml b/ScreenPlay/qml/Common/RippleEffect.qml new file mode 100644 index 00000000..c976cdcd --- /dev/null +++ b/ScreenPlay/qml/Common/RippleEffect.qml @@ -0,0 +1,111 @@ +/* + * Based on: + * https://github.com/rschiang/material + * (THE BSD 2-CLAUSE LICENSE) + */ + +import QtQuick 2.0 +import QtGraphicalEffects 1.0 + +Item { + id: control + anchors.fill: parent + + property alias radius: mask.radius + property color color: "#de000000" + property var target + property int duration: 600 + + function trigger() { + var wave = ripple.createObject(container, { + "startX": control.width * .5, + "startY": control.height * .5, + "maxRadius": furthestDistance( + control.width * .5, + control.height * .5) + }) + } + + Rectangle { + id: mask + anchors.fill: parent + color: "black" + visible: false + } + + Item { + id: container + anchors.fill: parent + visible: false + } + + OpacityMask { + anchors.fill: parent + source: container + maskSource: mask + } + + Component { + id: ripple + + Rectangle { + id: ink + radius: 0 + opacity: 0.25 + color: control.color + property int startX + property int startY + property int maxRadius: 150 + + x: startX - radius + y: startY - radius + width: radius * 2 + height: radius * 2 + + NumberAnimation { + id: growAnimation + target: ink + property: "radius" + from: 0 + to: maxRadius + duration: 550 + easing.type: Easing.OutCubic + } + + SequentialAnimation { + id: fadeAnimation + NumberAnimation { + target: ink + property: "opacity" + from: 0.25 + to: 0 + duration: control.duration + } + ScriptAction { + script: ink.destroy() + } + } + + Component.onCompleted: { + growAnimation.start() + if (!fadeAnimation.running) + fadeAnimation.start() + } + + function fadeIfApplicable() { + if (!fadeAnimation.running) + fadeAnimation.start() + } + } + } + + + function distance(x1,y1,x2,y2) { + return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)) + } + + function furthestDistance(x,y) { + return Math.max(distance(x, y, 0, 0), distance(x, y, width, height), + distance(x, y, 0, height), distance(x, y, width, 0)) + } +} diff --git a/ScreenPlay/qml/Navigation/Navigation.qml b/ScreenPlay/qml/Navigation/Navigation.qml index ea03682d..9c6c51ef 100644 --- a/ScreenPlay/qml/Navigation/Navigation.qml +++ b/ScreenPlay/qml/Navigation/Navigation.qml @@ -2,8 +2,8 @@ import QtQuick 2.12 import QtQuick.Controls 2.3 import QtGraphicalEffects 1.0 - import "../Workshop" +import "../Common" Rectangle { id: navigation @@ -40,7 +40,8 @@ Rectangle { navigation.changePage(name) - for (var i = 0; i < navArray.length; i++) { + var i = 0 + for (; i < navArray.length; i++) { if (navArray[i].name === name) navArray[i].state = "active" else { @@ -50,7 +51,7 @@ Rectangle { } WorkshopLoader { - id:wl + id: wl } Row { @@ -86,7 +87,6 @@ Rectangle { onPageClicked: navigation.onPageChanged(name) } - NavigationItem { id: navCommunity state: "inactive" diff --git a/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml b/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml index da7207cc..bd93d4c7 100644 --- a/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml +++ b/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml @@ -2,22 +2,37 @@ import QtQuick 2.12 import QtQuick.Controls 2.3 import QtGraphicalEffects 1.0 +import "../Common" + Item { id: navigationWallpaperConfiguration - width: 400 + width: 450 anchors { top: parent.top right: parent.right - rightMargin: 30 bottom: parent.bottom } + RippleEffect { + id:rippleEffect + target: navigationWallpaperConfiguration + + } + + Connections { + target: screenPlaySettings + onActiveWallpaperCounterChanged:{ + rippleEffect.trigger() + } + } + Image { id: image width: 24 height: 24 anchors { + rightMargin: 30 right: parent.right verticalCenter: parent.verticalCenter } @@ -62,7 +77,7 @@ Item { font.family: "Roboto" } MouseArea { - id: mouseArea + id: ma anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { From 36c7b302f581daeeae648d793fff2551f0548b0c Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 11 Jun 2019 13:40:35 +0200 Subject: [PATCH 13/15] Restore property set --- ScreenPlay/src/screenplay.h | 2 +- ScreenPlayWindow/src/basewindow.cpp | 33 ++++++++++++++++++++++++++++- ScreenPlayWindow/src/basewindow.h | 6 +----- ScreenPlayWindow/src/winwindow.cpp | 5 ----- ScreenPlayWindow/src/winwindow.h | 1 - 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplay.h index 633337aa..4ed3777e 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplay.h @@ -67,7 +67,7 @@ private: const shared_ptr m_monitorListModel; const shared_ptr m_sdkconnector; - QGuiApplication* const m_qGuiApplication; + const QGuiApplication* const m_qGuiApplication; vector> m_screenPlayWallpapers; vector> m_screenPlayWidgets; }; diff --git a/ScreenPlayWindow/src/basewindow.cpp b/ScreenPlayWindow/src/basewindow.cpp index e592bc5a..50aa3f33 100644 --- a/ScreenPlayWindow/src/basewindow.cpp +++ b/ScreenPlayWindow/src/basewindow.cpp @@ -3,7 +3,6 @@ BaseWindow::BaseWindow(QObject* parent) : QObject(parent) { - } BaseWindow::BaseWindow(QString projectFilePath, QObject* parent) @@ -79,3 +78,35 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent) } } +void BaseWindow::messageReceived(QString key, QString value) +{ + if (key == "volume") { + bool ok; + float tmp = value.toFloat(&ok); + if (ok) { + setVolume(tmp); + } + return; + } + + if (key == "playbackRate") { + bool ok; + float tmp = value.toFloat(&ok); + if (ok) { + setPlaybackRate(tmp); + } + return; + } + + if (key == "loops") { + bool tmp = QVariant(value).toBool(); + setLoops(tmp); + return; + } + + if (key == "isPlaying") { + bool tmp = QVariant(value).toBool(); + setIsPlaying(tmp); + return; + } +} diff --git a/ScreenPlayWindow/src/basewindow.h b/ScreenPlayWindow/src/basewindow.h index 3b5e7dc6..1fd3698f 100644 --- a/ScreenPlayWindow/src/basewindow.h +++ b/ScreenPlayWindow/src/basewindow.h @@ -82,11 +82,7 @@ signals: public slots: virtual void destroyThis() {} virtual void setVisible(bool show) { Q_UNUSED(show) } - virtual void messageReceived(QString key, QString value) - { - Q_UNUSED(key); - Q_UNUSED(value) - } + virtual void messageReceived(QString key, QString value) final; QString getApplicationPath() { diff --git a/ScreenPlayWindow/src/winwindow.cpp b/ScreenPlayWindow/src/winwindow.cpp index f568343e..898bfb29 100644 --- a/ScreenPlayWindow/src/winwindow.cpp +++ b/ScreenPlayWindow/src/winwindow.cpp @@ -148,11 +148,6 @@ void WinWindow::destroyThis() QCoreApplication::quit(); } -void WinWindow::messageReceived(QString key, QString value) -{ - emit qmlSceneValueReceived(key, value); -} - void WinWindow::calcOffsets() { for (int i = 0; i < QApplication::screens().count(); i++) { diff --git a/ScreenPlayWindow/src/winwindow.h b/ScreenPlayWindow/src/winwindow.h index d0ceef7a..05bf39f0 100644 --- a/ScreenPlayWindow/src/winwindow.h +++ b/ScreenPlayWindow/src/winwindow.h @@ -26,7 +26,6 @@ public: public slots: void setVisible(bool show) override; void destroyThis() override; - void messageReceived(QString key, QString value) override; private: void calcOffsets(); From 1605b642507774dc0998530a7f54e548bdcc170e Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 11 Jun 2019 13:46:19 +0200 Subject: [PATCH 14/15] Add contributing and AGPL --- CONTRIBUTING.md | 8 +- Legal/README.md | 13 + Legal/ScreenPlay License.md | 671 ++++++++++++++++++ ...corporate_contributor_license_agreement.md | 29 + ...ndividual_contributor_license_agreement.md | 25 + 5 files changed, 742 insertions(+), 4 deletions(-) create mode 100644 Legal/README.md create mode 100644 Legal/ScreenPlay License.md create mode 100644 Legal/corporate_contributor_license_agreement.md create mode 100644 Legal/individual_contributor_license_agreement.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index de0c56a4..16abd95d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,11 +6,11 @@ Every changes to ScreenPlay are done via Gitlab issues and merge requests (pull ### Development -1. Accept the [Contributing Agreement](https://gitlab.com/aimber/ScreenPlay). -2. Download and set up ScreenPlay as described in the main [Readme](https://gitlab.com/aimber/ScreenPlay). +1. Accept the [Contributing Agreement](https://gitlab.com/kelteseth/ScreenPlay). +2. Download and set up ScreenPlay as described in the main [Readme](https://gitlab.com/kelteseth/ScreenPlay). 2. Choose an issue to work on: * Your own ideas or thinks you want to improve. Alternatively you can tackle existing open issues: - * You can find simple problems by [searching for problems labeled "Accepting merge requests" sorted by weight.](https://gitlab.com/aimber/ScreenPlay/issues?state=opened&label_name[]=Accepting+merge+requests&assignee_id=0&sort=weight). Low-weight issues will be the easiest to accomplish. + * You can find simple problems by [searching for problems labeled "Accepting merge requests" sorted by weight.](https://gitlab.com/kelteseth/ScreenPlay/issues?state=opened&label_name[]=Accepting+merge+requests&assignee_id=0&sort=weight). Low-weight issues will be the easiest to accomplish. * Make sure that no one else is working on the problem and make sure that we are still interested in a particular post. * You can also make comments and ask for help if you are new or stuck. We will be happy to help you! 3. Add the feature or fix the bug you’ve chosen to work on. @@ -35,7 +35,7 @@ Every changes to ScreenPlay are done via Gitlab issues and merge requests (pull ### Documentation -To contribute to the [documentation](https://aimber.gitlab.io/ScreenPlayDocs/) you only have to press the pen icon on the top right of every page. We mostly use [draw.io]( http://draw.io/) for every diagram because it is free and you can embed the code inside a png when exporting the document. +To contribute to the [documentation](https://kelteseth.gitlab.io/ScreenPlayDocs/) you only have to press the pen icon on the top right of every page. We mostly use [draw.io]( http://draw.io/) for every diagram because it is free and you can embed the code inside a png when exporting the document. ### Translation diff --git a/Legal/README.md b/Legal/README.md new file mode 100644 index 00000000..6e0a10ab --- /dev/null +++ b/Legal/README.md @@ -0,0 +1,13 @@ +## Contributor license agreement + +By submitting code as an individual you agree to the +[individual contributor license agreement](Legal/individual_contributor_license_agreement.md). +By submitting code as an entity you agree to the +[corporate contributor license agreement](Legal/corporate_contributor_license_agreement.md). + +All Documentation content that resides under the [ScreenPlay/docs/ directory]([ScreenPlay/docs) of this +repository is licensed under Creative Commons: +[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). + +## Why +You must agree to our license agreement when contributing to ScreenPlay. ScreenPlay is and always be free software (AGPL V3). For distributing ScreenPlay in various ways like stores we need your permission to use your code under a second license (Commercial dual licensing like the Qt Framework). \ No newline at end of file diff --git a/Legal/ScreenPlay License.md b/Legal/ScreenPlay License.md new file mode 100644 index 00000000..091ad9e5 --- /dev/null +++ b/Legal/ScreenPlay License.md @@ -0,0 +1,671 @@ +See + +* corporate_contributor_license_agreement.md +* individual_contributor_license_agreement.md + +for the commercial License. + +###################################################################### + + + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 1. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/Legal/corporate_contributor_license_agreement.md b/Legal/corporate_contributor_license_agreement.md new file mode 100644 index 00000000..e693e9c7 --- /dev/null +++ b/Legal/corporate_contributor_license_agreement.md @@ -0,0 +1,29 @@ +# Corporate contributor license agreement + +You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Elias Steurer (Kelteseth). Except for the license granted herein to Elias Steurer (Kelteseth) and recipients of software distributed by Elias Steurer (Kelteseth), You reserve all right, title, and interest in and to Your Contributions. + +1. Definitions. + + "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Elias Steurer (Kelteseth). For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + "Contribution" shall mean the code, documentation or other original works of authorship, including any modifications or additions to an existing work, that is submitted by You to Elias Steurer (Kelteseth) for inclusion in, or documentation of, any of the products owned or managed by Elias Steurer (Kelteseth) (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Elias Steurer (Kelteseth) or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Elias Steurer (Kelteseth) for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution." + +2. Grant of Copyright License. + +Subject to the terms and conditions of this Agreement, You hereby grant to Elias Steurer (Kelteseth) and to recipients of software distributed by Elias Steurer (Kelteseth) a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works. + +3. Grant of Patent License. + +Subject to the terms and conditions of this Agreement, You hereby grant to Elias Steurer (Kelteseth) and to recipients of software distributed by Elias Steurer (Kelteseth) a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed. + +4. You represent that You are legally entitled to grant the above license. You represent further that each of Your employees is authorized to submit Contributions on Your behalf, but excluding employees that are designated in writing by You as "Not authorized to submit Contributions on behalf of [name of Your corporation here]." Such designations of exclusion for unauthorized employees are to be submitted via email to legal@screen-play.app. + +5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). + +6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + +7. Should You wish to submit work that is not Your original creation, You may submit it to Elias Steurer (Kelteseth) separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]". + +8. It is Your responsibility to notify screen-play.app when any change is required to the list of designated employees excluded from submitting Contributions on Your behalf per Section 4. Such notification should be sent via email to info@screen-play.app. + +This text is licensed under the [Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/) and the original source is the Google Open Source Programs Office. diff --git a/Legal/individual_contributor_license_agreement.md b/Legal/individual_contributor_license_agreement.md new file mode 100644 index 00000000..23c92560 --- /dev/null +++ b/Legal/individual_contributor_license_agreement.md @@ -0,0 +1,25 @@ +# Individual contributor license agreement + +You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Elias Steurer (Kelteseth). Except for the license granted herein to Elias Steurer (Kelteseth) and recipients of software distributed by Elias Steurer (Kelteseth), You reserve all right, title, and interest in and to Your Contributions. + +1. Definitions. + + "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Elias Steurer (Kelteseth). For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Elias Steurer (Kelteseth) for inclusion in, or documentation of, any of the products owned or managed by Elias Steurer (Kelteseth) (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Elias Steurer (Kelteseth) or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Elias Steurer (Kelteseth) for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution." + +2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Elias Steurer (Kelteseth) and to recipients of software distributed by Elias Steurer (Kelteseth) a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works. + +3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Elias Steurer (Kelteseth) and to recipients of software distributed by Elias Steurer (Kelteseth) a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed. + +4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Elias Steurer (Kelteseth), or that your employer has executed a separate Corporate CLA with Elias Steurer (Kelteseth). + +5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions. + +6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + +7. Should You wish to submit work that is not Your original creation, You may submit it to Elias Steurer (Kelteseth) separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [insert_name_here]". + +8. You agree to notify Elias Steurer (Kelteseth) of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect. + +This text is licensed under the [Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/) and the original source is the Google Open Source Programs Office. From c064952a2d9775cd3cee52e88aa24dd24f9caf78 Mon Sep 17 00:00:00 2001 From: Elias Date: Tue, 11 Jun 2019 15:44:17 +0200 Subject: [PATCH 15/15] Move everything inside the ScreenPlay namespace --- ScreenPlay/ScreenPlay.pro | 4 +- ScreenPlay/main.cpp | 15 +++++-- ScreenPlay/settings.json | 2 +- ScreenPlay/src/create.cpp | 3 +- ScreenPlay/src/create.h | 5 +++ ScreenPlay/src/createimportvideo.cpp | 21 ++++++++-- ScreenPlay/src/createimportvideo.h | 17 ++------ ScreenPlay/src/installedlistfilter.cpp | 3 +- ScreenPlay/src/installedlistfilter.h | 3 +- ScreenPlay/src/installedlistmodel.cpp | 11 +++++ ScreenPlay/src/installedlistmodel.h | 13 +++--- ScreenPlay/src/monitorlistmodel.cpp | 3 +- ScreenPlay/src/monitorlistmodel.h | 3 +- ScreenPlay/src/profile.h | 10 ++++- ScreenPlay/src/profilelistmodel.cpp | 3 ++ ScreenPlay/src/profilelistmodel.h | 3 +- ScreenPlay/src/projectfile.h | 7 +++- ScreenPlay/src/projectsettingslistitem.h | 7 +++- ScreenPlay/src/projectsettingslistmodel.cpp | 3 +- ScreenPlay/src/projectsettingslistmodel.h | 3 +- ScreenPlay/src/qmlutilities.cpp | 18 ++++++-- ScreenPlay/src/qmlutilities.h | 10 +---- .../{screenplay.cpp => screenplaymanager.cpp} | 23 ++++++----- .../src/{screenplay.h => screenplaymanager.h} | 11 +++-- ScreenPlay/src/screenplaywallpaper.cpp | 4 +- ScreenPlay/src/screenplaywallpaper.h | 3 +- ScreenPlay/src/screenplaywidget.cpp | 2 + ScreenPlay/src/screenplaywidget.h | 3 +- ScreenPlay/src/sdkconnector.cpp | 3 +- ScreenPlay/src/sdkconnector.h | 5 ++- ScreenPlay/src/settings.cpp | 3 ++ ScreenPlay/src/settings.h | 41 ++++++++++--------- 32 files changed, 174 insertions(+), 91 deletions(-) rename ScreenPlay/src/{screenplay.cpp => screenplaymanager.cpp} (86%) rename ScreenPlay/src/{screenplay.h => screenplaymanager.h} (93%) diff --git a/ScreenPlay/ScreenPlay.pro b/ScreenPlay/ScreenPlay.pro index b02b791f..ed313dcf 100644 --- a/ScreenPlay/ScreenPlay.pro +++ b/ScreenPlay/ScreenPlay.pro @@ -26,7 +26,7 @@ SOURCES += main.cpp \ src/installedlistfilter.cpp \ src/sdkconnector.cpp \ src/projectsettingslistmodel.cpp \ - src/screenplay.cpp \ + src/screenplaymanager.cpp \ src/qmlutilities.cpp \ src/create.cpp @@ -48,7 +48,7 @@ HEADERS += \ src/sdkconnector.h \ src/projectsettingslistitem.h \ src/projectsettingslistmodel.h \ - src/screenplay.h \ + src/screenplaymanager.h \ src/qmlutilities.h \ src/create.h diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index 9c9d7414..e774a955 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -17,12 +17,21 @@ #include "src/monitorlistmodel.h" #include "src/profilelistmodel.h" #include "src/qmlutilities.h" -#include "src/screenplay.h" +#include "src/screenplaymanager.h" #include "src/sdkconnector.h" #include "src/settings.h" using std::shared_ptr, - std::make_shared; + std::make_shared, + ScreenPlay::QMLUtilities, + ScreenPlay::InstalledListModel, + ScreenPlay::ScreenPlayManager, + ScreenPlay::InstalledListFilter, + ScreenPlay::MonitorListModel, + ScreenPlay::ProfileListModel, + ScreenPlay::SDKConnector, + ScreenPlay::Settings, + ScreenPlay::Create; int main(int argc, char* argv[]) { @@ -54,7 +63,7 @@ int main(int argc, char* argv[]) // such things as the profile list model to complete // It will also set the m_absoluteStoragePath in profileListModel and installedListModel auto settings = make_shared(installedListModel, profileListModel, monitorListModel, sdkConnector); - ScreenPlay screenPlay(installedListModel, settings, monitorListModel, sdkConnector); + ScreenPlayManager screenPlay(installedListModel, settings, monitorListModel, sdkConnector); Create create(settings); // All the list need the default path from the settings diff --git a/ScreenPlay/settings.json b/ScreenPlay/settings.json index fabc340f..2cde80d0 100644 --- a/ScreenPlay/settings.json +++ b/ScreenPlay/settings.json @@ -5,6 +5,6 @@ "sendStatistics" : false, "absoluteStoragePath": "", "profiles":[ - { "monitorID": "","profile": "" } + { "monitorID": "","wallpaper": "" } ] } diff --git a/ScreenPlay/src/create.cpp b/ScreenPlay/src/create.cpp index a6aef077..3eb18a62 100644 --- a/ScreenPlay/src/create.cpp +++ b/ScreenPlay/src/create.cpp @@ -9,7 +9,7 @@ \todo - This class would need to be refactored to be used in more creation types. */ - +namespace ScreenPlay { Create::Create(const shared_ptr& settings, QObject* parent) : QObject(parent) , m_settings(settings) @@ -145,3 +145,4 @@ void Create::abortAndCleanup() }); m_createImportVideoThread->requestInterruption(); } +} diff --git a/ScreenPlay/src/create.h b/ScreenPlay/src/create.h index 21864570..12290423 100644 --- a/ScreenPlay/src/create.h +++ b/ScreenPlay/src/create.h @@ -26,6 +26,10 @@ #include "qmlutilities.h" #include "settings.h" +namespace ScreenPlay { + + + using std::shared_ptr, std::make_shared; @@ -90,3 +94,4 @@ private: float m_progress = 0.0f; QString m_workingDir; }; +} diff --git a/ScreenPlay/src/createimportvideo.cpp b/ScreenPlay/src/createimportvideo.cpp index a58f917f..e5db6f16 100644 --- a/ScreenPlay/src/createimportvideo.cpp +++ b/ScreenPlay/src/createimportvideo.cpp @@ -1,12 +1,25 @@ #include "createimportvideo.h" -#include + +namespace ScreenPlay { + +/*! + \class CreateImportVideo + \brief This class imports (copies) and creates wallaper previews. This + class only exsits as long as the user creates a wallpaper and gets + destroyed if the creation was successful or not. + + The state get propagated via createWallpaperStateChanged(CreateImportVideo::State state); + + \todo + - Maybe: Replace with QThread to avoid running QCoreApplication::processEvents();? +*/ CreateImportVideo::CreateImportVideo(QObject* parent) : QObject(parent) { } -CreateImportVideo::CreateImportVideo(QString videoPath, QString exportPath, QObject* parent) +CreateImportVideo::CreateImportVideo(const QString& videoPath, const QString& exportPath, QObject* parent) : QObject(parent) { m_videoPath = videoPath; @@ -101,7 +114,7 @@ bool CreateImportVideo::createWallpaperInfo() // Get framerate QJsonArray arrSteams = obj.value("streams").toArray(); - if (arrSteams.size() < 1) { + if (arrSteams.empty()) { qDebug() << "Error container does not have any video streams"; return false; } @@ -359,4 +372,4 @@ bool CreateImportVideo::extractWallpaperAudio() return true; } - +} diff --git a/ScreenPlay/src/createimportvideo.h b/ScreenPlay/src/createimportvideo.h index be1fe78c..59b18652 100644 --- a/ScreenPlay/src/createimportvideo.h +++ b/ScreenPlay/src/createimportvideo.h @@ -14,26 +14,16 @@ #include #include #include +#include - -/*! - \class CreateImportVideo - \brief This class imports (copies) and creates wallaper previews. This - class only exsits as long as the user creates a wallpaper and gets - destroyed if the creation was successful or not. - - The state get propagated via createWallpaperStateChanged(CreateImportVideo::State state); - - \todo - - Maybe: Replace with QThread to avoid running QCoreApplication::processEvents();? -*/ +namespace ScreenPlay { class CreateImportVideo : public QObject { Q_OBJECT public: CreateImportVideo(QObject* parent = nullptr); - explicit CreateImportVideo(QString videoPath, QString exportPath, QObject* parent = nullptr); + explicit CreateImportVideo(const QString& videoPath, const QString& exportPath, QObject* parent = nullptr); enum class State { Idle, @@ -91,3 +81,4 @@ public slots: bool createWallpaperImagePreview(); bool extractWallpaperAudio(); }; +} diff --git a/ScreenPlay/src/installedlistfilter.cpp b/ScreenPlay/src/installedlistfilter.cpp index 3b445282..ef96aaed 100644 --- a/ScreenPlay/src/installedlistfilter.cpp +++ b/ScreenPlay/src/installedlistfilter.cpp @@ -9,7 +9,7 @@ - Expand filter functionality */ - +namespace ScreenPlay { InstalledListFilter::InstalledListFilter(const shared_ptr& ilm) : QSortFilterProxyModel() , m_ilm(ilm) @@ -53,3 +53,4 @@ void InstalledListFilter::resetFilter() setFilterWildcard("*"); sort(0); } +} diff --git a/ScreenPlay/src/installedlistfilter.h b/ScreenPlay/src/installedlistfilter.h index 14d2c238..dade146c 100644 --- a/ScreenPlay/src/installedlistfilter.h +++ b/ScreenPlay/src/installedlistfilter.h @@ -4,7 +4,7 @@ #include #include #include "installedlistmodel.h" - +namespace ScreenPlay { using std::shared_ptr; class InstalledListFilter : public QSortFilterProxyModel { @@ -20,3 +20,4 @@ public slots: private: const shared_ptr m_ilm; }; +} diff --git a/ScreenPlay/src/installedlistmodel.cpp b/ScreenPlay/src/installedlistmodel.cpp index dea707bf..fa409d06 100644 --- a/ScreenPlay/src/installedlistmodel.cpp +++ b/ScreenPlay/src/installedlistmodel.cpp @@ -1,5 +1,15 @@ #include "installedlistmodel.h" + +/*! + \class Installed List Model + \brief Lists all installed wallpapers, widgets etc. from a given Path + +*/ + + +namespace ScreenPlay { + InstalledListModel::InstalledListModel(QObject* parent) : QAbstractListModel(parent) { @@ -177,3 +187,4 @@ void InstalledListModel::reset() m_screenPlayFiles.squeeze(); endResetModel(); } +} diff --git a/ScreenPlay/src/installedlistmodel.h b/ScreenPlay/src/installedlistmodel.h index 8bfe27bc..bf34144d 100644 --- a/ScreenPlay/src/installedlistmodel.h +++ b/ScreenPlay/src/installedlistmodel.h @@ -1,7 +1,5 @@ #pragma once -#include "profilelistmodel.h" -#include "projectfile.h" #include #include #include @@ -19,11 +17,11 @@ #include #include -/*! - \class Installed List Model - \brief Lists all installed wallpapers, widgets etc. from a given Path -*/ +#include "profilelistmodel.h" +#include "projectfile.h" + +namespace ScreenPlay { class InstalledListModel : public QAbstractListModel { Q_OBJECT @@ -65,7 +63,7 @@ public slots: QVariantMap get(QString folderId); - void setabsoluteStoragePath(QUrl absoluteStoragePath) + void setabsoluteStoragePath(const QUrl& absoluteStoragePath) { if (m_absoluteStoragePath == absoluteStoragePath) return; @@ -85,3 +83,4 @@ private: QVector m_screenPlayFiles; QUrl m_absoluteStoragePath; }; +} diff --git a/ScreenPlay/src/monitorlistmodel.cpp b/ScreenPlay/src/monitorlistmodel.cpp index 5f5b40e1..7f3b07d8 100644 --- a/ScreenPlay/src/monitorlistmodel.cpp +++ b/ScreenPlay/src/monitorlistmodel.cpp @@ -1,5 +1,5 @@ #include "monitorlistmodel.h" - +namespace ScreenPlay { MonitorListModel::MonitorListModel(QObject* parent) : QAbstractListModel(parent) , m_qGuiApplication(static_cast(QGuiApplication::instance())) @@ -192,3 +192,4 @@ Monitor::Monitor(QString manufacturer, QString model, QString name, QSize size, // because name and manufacturer are allways empty m_id = name + "_" + QString::number(size.width()) + "x" + QString::number(size.height()) + "_" + QString::number(availableGeometry.x()) + "x" + QString::number(availableGeometry.y()); } +} diff --git a/ScreenPlay/src/monitorlistmodel.h b/ScreenPlay/src/monitorlistmodel.h index 79cc69da..fe930ccd 100644 --- a/ScreenPlay/src/monitorlistmodel.h +++ b/ScreenPlay/src/monitorlistmodel.h @@ -20,7 +20,7 @@ - Add event when monitor count changed. */ - +namespace ScreenPlay { struct Monitor; class MonitorListModel : public QAbstractListModel { @@ -93,3 +93,4 @@ struct Monitor { QScreen* m_screen = nullptr; }; +} diff --git a/ScreenPlay/src/profile.h b/ScreenPlay/src/profile.h index e49a4acf..dfe6748b 100644 --- a/ScreenPlay/src/profile.h +++ b/ScreenPlay/src/profile.h @@ -9,11 +9,16 @@ See Profile List Model for more details */ - +namespace ScreenPlay { struct Profile { Profile() {} - Profile(QUrl absolutePath, QString id, QString version, QString wallpaperId, QRect rect, bool isLooping) + Profile(const QUrl& absolutePath, + const QString& id, + const QString& version, + const QString& wallpaperId, + const QRect& rect, + const bool isLooping) { m_absolutePath = absolutePath; m_id = id; @@ -30,3 +35,4 @@ struct Profile { QRect m_rect; bool m_isLooping = true; }; +} diff --git a/ScreenPlay/src/profilelistmodel.cpp b/ScreenPlay/src/profilelistmodel.cpp index db683dcb..d2f068f8 100644 --- a/ScreenPlay/src/profilelistmodel.cpp +++ b/ScreenPlay/src/profilelistmodel.cpp @@ -6,6 +6,8 @@ #include #include +namespace ScreenPlay { + ProfileListModel::ProfileListModel(QObject* parent) : QAbstractListModel(parent) { @@ -112,3 +114,4 @@ bool ProfileListModel::getProfileByName(QString id, Profile* profile) } return false; } +} diff --git a/ScreenPlay/src/profilelistmodel.h b/ScreenPlay/src/profilelistmodel.h index 4e00bd95..16b9f867 100644 --- a/ScreenPlay/src/profilelistmodel.h +++ b/ScreenPlay/src/profilelistmodel.h @@ -17,7 +17,7 @@ - Add a profile for a combination of active wallpaper and widgets! */ - +namespace ScreenPlay { struct Profile; class ProfileListModel : public QAbstractListModel { @@ -42,3 +42,4 @@ private: QHash m_roleNames; QVector m_profileList; }; +} diff --git a/ScreenPlay/src/projectfile.h b/ScreenPlay/src/projectfile.h index 62e86fb3..c76743ce 100644 --- a/ScreenPlay/src/projectfile.h +++ b/ScreenPlay/src/projectfile.h @@ -11,10 +11,14 @@ \brief In ScreenPlay every Wallpaper, Scene or Widget has an project.json to store its configuration */ +namespace ScreenPlay { + struct ProjectFile { - ProjectFile(QJsonObject obj, QString folderName, QUrl absolutePath) + ProjectFile(const QJsonObject& obj, + const QString& folderName, + const QUrl& absolutePath) { if (obj.contains("description")) @@ -72,3 +76,4 @@ struct ProjectFile { QVariantList m_tags; //TODO: Implement me! }; +} diff --git a/ScreenPlay/src/projectsettingslistitem.h b/ScreenPlay/src/projectsettingslistitem.h index 17a2091a..8db11188 100644 --- a/ScreenPlay/src/projectsettingslistitem.h +++ b/ScreenPlay/src/projectsettingslistitem.h @@ -9,10 +9,14 @@ */ +namespace ScreenPlay { struct ProjectSettingsListItem { - ProjectSettingsListItem(QString name, bool isHeadline, QVariant value) + ProjectSettingsListItem( + const QString& name, + const bool isHeadline, + const QVariant& value) { m_name = name; m_isHeadline = isHeadline; @@ -24,3 +28,4 @@ struct ProjectSettingsListItem { bool m_isHeadline; QVariant m_value; }; +} diff --git a/ScreenPlay/src/projectsettingslistmodel.cpp b/ScreenPlay/src/projectsettingslistmodel.cpp index 308b41cb..4cb88e26 100644 --- a/ScreenPlay/src/projectsettingslistmodel.cpp +++ b/ScreenPlay/src/projectsettingslistmodel.cpp @@ -1,5 +1,5 @@ #include "projectsettingslistmodel.h" - +namespace ScreenPlay { ProjectSettingsListModel::ProjectSettingsListModel(QString file, QObject* parent) : QAbstractListModel(parent) { @@ -98,3 +98,4 @@ void ProjectSettingsListModel::append(QString name, bool isHeadline, QVariant va endInsertRows(); } +} diff --git a/ScreenPlay/src/projectsettingslistmodel.h b/ScreenPlay/src/projectsettingslistmodel.h index dbd4e963..3a593348 100644 --- a/ScreenPlay/src/projectsettingslistmodel.h +++ b/ScreenPlay/src/projectsettingslistmodel.h @@ -17,7 +17,7 @@ \brief Reads the project.json for every Wallpaper, Scene or Widget "general" object and displays it for the user to modify */ - +namespace ScreenPlay { class ProjectSettingsListModel : public QAbstractListModel { Q_OBJECT @@ -43,3 +43,4 @@ public slots: private: QVector m_projectSettings; }; +} diff --git a/ScreenPlay/src/qmlutilities.cpp b/ScreenPlay/src/qmlutilities.cpp index 77c83bb9..6104487b 100644 --- a/ScreenPlay/src/qmlutilities.cpp +++ b/ScreenPlay/src/qmlutilities.cpp @@ -2,6 +2,17 @@ #include +namespace ScreenPlay { + +/*! + \class Global QML Utilities + \brief Easy to use global object to use to: + \list + \i Navigate the main menu + \i Open Explorer at a given path + \endlist +*/ + QMLUtilities::QMLUtilities(QObject* parent) : QObject(parent) { @@ -29,11 +40,11 @@ QString QMLUtilities::fixWindowsPath(QString url) void QMLUtilities::openFolderInExplorer(QString url) { QProcess explorer; - #ifdef Q_OS_WIN +#ifdef Q_OS_WIN explorer.setProgram("explorer.exe"); - #elif defined(Q_OS_OSX) +#elif defined(Q_OS_OSX) explorer.setProgram("open"); - #endif +#endif QStringList args; args.append(QDir::toNativeSeparators(url)); explorer.setArguments(args); @@ -98,3 +109,4 @@ void QMLUtilities::QMLUtilities::requestAllLDataProtection() }); } +} diff --git a/ScreenPlay/src/qmlutilities.h b/ScreenPlay/src/qmlutilities.h index f3c39710..44e7c873 100644 --- a/ScreenPlay/src/qmlutilities.h +++ b/ScreenPlay/src/qmlutilities.h @@ -8,14 +8,7 @@ #include #include -/*! - \class Global QML Utilities - \brief Easy to use global object to use to: - \list - \i Navigate the main menu - \i Open Explorer at a given path - \endlist -*/ +namespace ScreenPlay { class QMLUtilities : public QObject { Q_OBJECT @@ -41,3 +34,4 @@ public slots: QString fixWindowsPath(QString url); }; +} diff --git a/ScreenPlay/src/screenplay.cpp b/ScreenPlay/src/screenplaymanager.cpp similarity index 86% rename from ScreenPlay/src/screenplay.cpp rename to ScreenPlay/src/screenplaymanager.cpp index 8f566490..ec6c7c64 100644 --- a/ScreenPlay/src/screenplay.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -1,6 +1,8 @@ -#include "screenplay.h" +#include "screenplaymanager.h" -ScreenPlay::ScreenPlay(const shared_ptr& ilm, +namespace ScreenPlay { + +ScreenPlayManager::ScreenPlayManager(const shared_ptr& ilm, const shared_ptr& settings, const shared_ptr& mlm, const shared_ptr& sdkc, @@ -14,7 +16,7 @@ ScreenPlay::ScreenPlay(const shared_ptr& ilm, { } -void ScreenPlay::createWallpaper( +void ScreenPlayManager::createWallpaper( const int monitorIndex, QUrl absoluteStoragePath, const QString& previewImage, const float volume, const QString& fillMode, const QString& type) @@ -44,7 +46,7 @@ void ScreenPlay::createWallpaper( m_settings->saveWallpaperToConfig(monitorIndex, absoluteStoragePath, type); } -void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewImage) +void ScreenPlayManager::createWidget(QUrl absoluteStoragePath, const QString& previewImage) { ProjectFile project {}; @@ -62,7 +64,7 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewIm this)); } -void ScreenPlay::removeAllWallpaper() +void ScreenPlayManager::removeAllWallpaper() { if (m_settings && !m_screenPlayWallpapers.empty()) { m_sdkconnector->closeAllWallpapers(); @@ -73,7 +75,7 @@ void ScreenPlay::removeAllWallpaper() return; } -void ScreenPlay::requestProjectSettingsListModelAt(const int index) +void ScreenPlayManager::requestProjectSettingsListModelAt(const int index) { for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { if (!uPtrWallpaper->screenNumber().empty() && uPtrWallpaper->screenNumber()[0] == index) { // ??? only at index == 0 @@ -86,7 +88,7 @@ void ScreenPlay::requestProjectSettingsListModelAt(const int index) emit projectSettingsListModelNotFound(); } -void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) +void ScreenPlayManager::setWallpaperValue(const int at, const QString& key, const QString& value) { Q_ASSERT(static_cast(at) < m_screenPlayWallpapers.size() && m_sdkconnector); for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { @@ -97,14 +99,14 @@ void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QStri } } -void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) +void ScreenPlayManager::setAllWallpaperValue(const QString& key, const QString& value) { for (const unique_ptr& uPtrWallpaper : m_screenPlayWallpapers) { m_sdkconnector->setWallpaperValue(uPtrWallpaper->appID(), key, value); } } -void ScreenPlay::removeWallpaperAt(const int at) +void ScreenPlayManager::removeWallpaperAt(const int at) { if (m_screenPlayWallpapers.empty()) return; @@ -124,7 +126,7 @@ void ScreenPlay::removeWallpaperAt(const int at) m_screenPlayWallpapers.erase(wallsToRemove, m_screenPlayWallpapers.end()); } -QString ScreenPlay::generateID() const +QString ScreenPlayManager::generateID() const { const QString possibleCharacters { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" @@ -140,3 +142,4 @@ QString ScreenPlay::generateID() const } return randomString; } +} diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplaymanager.h similarity index 93% rename from ScreenPlay/src/screenplay.h rename to ScreenPlay/src/screenplaymanager.h index 4ed3777e..f69b070b 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplaymanager.h @@ -22,6 +22,9 @@ \brief Used for Creation of Wallpaper, Scenes and Widgets */ + +namespace ScreenPlay { + using std::shared_ptr, std::unique_ptr, std::make_shared, @@ -30,18 +33,18 @@ using std::shared_ptr, std::size_t, std::remove_if; -class ScreenPlay final : public QObject { +class ScreenPlayManager final : public QObject { Q_OBJECT public: - explicit ScreenPlay( + explicit ScreenPlayManager( const shared_ptr& ilm, const shared_ptr& settings, const shared_ptr& mlm, const shared_ptr& sdkc, QObject* parent = nullptr); - ~ScreenPlay() {} + ~ScreenPlayManager() {} signals: void allWallpaperRemoved(); @@ -71,3 +74,5 @@ private: vector> m_screenPlayWallpapers; vector> m_screenPlayWidgets; }; + +} diff --git a/ScreenPlay/src/screenplaywallpaper.cpp b/ScreenPlay/src/screenplaywallpaper.cpp index aa40ad89..6898cd68 100644 --- a/ScreenPlay/src/screenplaywallpaper.cpp +++ b/ScreenPlay/src/screenplaywallpaper.cpp @@ -4,6 +4,7 @@ \class ScreenPlayWallpaper \brief Used for ... */ +namespace ScreenPlay { ScreenPlayWallpaper::ScreenPlayWallpaper(const vector& screenNumber, const shared_ptr& settings, @@ -44,9 +45,10 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const vector& screenNumber, fillMode }; - qDebug() << "Creating ScreenPlayWallpaper " << proArgs; + //qDebug() << "Creating ScreenPlayWallpaper " << proArgs; m_process.setArguments(proArgs); m_process.setProgram(m_settings->screenPlayWindowPath().toString()); m_process.startDetached(); } +} diff --git a/ScreenPlay/src/screenplaywallpaper.h b/ScreenPlay/src/screenplaywallpaper.h index e5621829..242c1ede 100644 --- a/ScreenPlay/src/screenplaywallpaper.h +++ b/ScreenPlay/src/screenplaywallpaper.h @@ -7,7 +7,7 @@ #include "projectsettingslistmodel.h" #include "settings.h" - +namespace ScreenPlay { using std::shared_ptr, std::make_shared, std::vector, @@ -128,3 +128,4 @@ private: QString m_type; const shared_ptr m_settings; }; +} diff --git a/ScreenPlay/src/screenplaywidget.cpp b/ScreenPlay/src/screenplaywidget.cpp index 7800b771..079293cd 100644 --- a/ScreenPlay/src/screenplaywidget.cpp +++ b/ScreenPlay/src/screenplaywidget.cpp @@ -4,6 +4,7 @@ \class ScreenPlayWidget \brief Used for ... */ +namespace ScreenPlay { ScreenPlayWidget::ScreenPlayWidget(const QString& appID, const shared_ptr& settings, const QString& projectPath, @@ -33,3 +34,4 @@ ScreenPlayWidget::ScreenPlayWidget(const QString& appID, const shared_ptr #include "settings.h" - +namespace ScreenPlay { using std::shared_ptr, std::make_shared; @@ -97,3 +97,4 @@ private: QProcess m_process; const shared_ptr m_settings; }; +} diff --git a/ScreenPlay/src/sdkconnector.cpp b/ScreenPlay/src/sdkconnector.cpp index b2251dbf..dc34990b 100644 --- a/ScreenPlay/src/sdkconnector.cpp +++ b/ScreenPlay/src/sdkconnector.cpp @@ -2,7 +2,7 @@ #include #include - +namespace ScreenPlay { SDKConnector::SDKConnector(QObject* parent) : QObject(parent) { @@ -84,3 +84,4 @@ QLocalSocket* SDKConnection::socket() const { return m_socket; } +} diff --git a/ScreenPlay/src/sdkconnector.h b/ScreenPlay/src/sdkconnector.h index 4f71efe1..962fdf9e 100644 --- a/ScreenPlay/src/sdkconnector.h +++ b/ScreenPlay/src/sdkconnector.h @@ -13,6 +13,8 @@ \brief Used for every Wallpaper, Scene or Widget communication via Windows pipes/QLocalSocket */ + +namespace ScreenPlay { class SDKConnection; class SDKConnector : public QObject { @@ -20,8 +22,6 @@ class SDKConnector : public QObject { public: explicit SDKConnector(QObject* parent = nullptr); -signals: - public slots: void readyRead(); void newConnection(); @@ -130,3 +130,4 @@ private: QString m_appID; QVector m_monitor; }; +} diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index ff56e9df..09c835b3 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -10,6 +10,8 @@ */ +namespace ScreenPlay { + Settings::Settings(const shared_ptr& ilm, const shared_ptr& plm, const shared_ptr& mlm, @@ -285,3 +287,4 @@ void Settings::setupWidgetAndWindowPaths() } #endif } +} diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index d674cccb..5e759cbf 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -38,7 +38,7 @@ #ifdef Q_OS_WIN #include #endif - +namespace ScreenPlay { class ActiveProfile; using std::shared_ptr, @@ -47,7 +47,7 @@ using std::shared_ptr, class Settings : public QObject { Q_OBJECT - Q_PROPERTY(QVersionNumber version READ version) + Q_PROPERTY(QVersionNumber version READ version ) Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged) Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged) Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged) @@ -131,23 +131,6 @@ public: return m_offlineMode; } -signals: - void autostartChanged(bool autostart); - void highPriorityStartChanged(bool highPriorityStart); - void sendStatisticsChanged(bool status); - void localStoragePathChanged(QUrl localStoragePath); - void hasWorkshopBannerSeenChanged(bool hasWorkshopBannerSeen); - void decoderChanged(QString decoder); - void setMainWindowVisible(bool visible); - void activeWallpaperCounterChanged(int activeWallpaperCounter); - void pauseWallpaperWhenIngameChanged(bool pauseWallpaperWhenIngame); - void offlineModeChanged(bool offlineMode); - -public slots: - void writeSingleSettingConfig(QString name, QVariant value); - void saveWallpaperToConfig(const int monitorIndex, const QUrl& absoluteStoragePath, const QString& type); - void removeWallpaperFromConfig(const int monitorIndex); - void setqSetting(const QString& key, const QString& value); bool autostart() const { @@ -169,6 +152,25 @@ public slots: return m_decoder; } + +signals: + void autostartChanged(bool autostart); + void highPriorityStartChanged(bool highPriorityStart); + void sendStatisticsChanged(bool status); + void localStoragePathChanged(QUrl localStoragePath); + void hasWorkshopBannerSeenChanged(bool hasWorkshopBannerSeen); + void decoderChanged(QString decoder); + void setMainWindowVisible(bool visible); + void activeWallpaperCounterChanged(int activeWallpaperCounter); + void pauseWallpaperWhenIngameChanged(bool pauseWallpaperWhenIngame); + void offlineModeChanged(bool offlineMode); + +public slots: + void writeSingleSettingConfig(QString name, QVariant value); + void saveWallpaperToConfig(const int monitorIndex, const QUrl& absoluteStoragePath, const QString& type); + void removeWallpaperFromConfig(const int monitorIndex); + void setqSetting(const QString& key, const QString& value); + void setAutostart(bool autostart) { if (m_autostart == autostart) @@ -313,3 +315,4 @@ private: QString m_decoder = ""; int m_activeWallpaperCounter = 0; }; +}