1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 19:42:45 +01:00

Merge branch 'refactor/save-configs' into 'master'

Refactor/save configs

See merge request kelteseth/ScreenPlay!32
This commit is contained in:
Elias Steurer 2020-05-19 14:07:04 +00:00
commit c6fca49556
75 changed files with 2071 additions and 714 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17.0 )
cmake_minimum_required(VERSION 3.16.0 )
if(WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows")
@ -38,3 +38,4 @@ add_subdirectory(Common/stomt-qml)
add_subdirectory(Common/qt-breakpad)

@ -1 +1 @@
Subproject commit 9523fa141f98da6587a9da90df8917f55a90d220
Subproject commit 8f40dc7934cb11355489352f67e1f53475327c3e

99
Docs/DeveloperSetup.md Normal file
View File

@ -0,0 +1,99 @@
# Developer Setup
1. Install latest [git + git-lfs](https://git-scm.com/)
2. Clone ScreenPlay
``` bash
git clone --recursive https://gitlab.com/kelteseth/ScreenPlay.git
```
3. Download the latest [__Qt 5.14__](https://www.qt.io/download-qt-installer). Earlier versions are not supported!
4. Start install-dependencies.bat to download dependencies into the Common/ folder
``` bash
//Windows
.\install-dependencies.bat
//Linux
sudo apt install git gcc cmake build-essential libgl1-mesa-dev
chmod +x install-dependencies.sh
.\install-dependencies.sh
```
* This will install these dependencies via __vcpkg__
* libzippp
* nlohmann-json
* openSSL 1.1.1d
* zlib& libzip
* breakpad
* Download these dependencies via __git submodules__
* stomt-qt-sdk
* qt-google-analytics
* qt-breakpad
5. **Follow the steps below for your OS**.
6. Open the CMakeLists.txt via QtCreator. **This can take some time until QtCreator parses all files!**
7. Add a second build step at: Projects -> Build -> Add Build Step -> Select Build -> Select "install" .
<div>
<img width="100%" height="auto" src="../.gitlab/media/QtCreator_install.png">
</div>
8. Add CMake variables
* Add CMAKE_TOOLCHAIN_FILE and VCPKG_TARGET_TRIPLET
* Extras -> Tools -> Kits -> <Your Kit> -> CMake Configuration -> Append this:
* CMAKE_TOOLCHAIN_FILE:STRING=%{CurrentProject:Path}/Common/vcpkg/scripts/buildsystems/vcpkg.cmake
* VCPKG_TARGET_TRIPLET:STRING=x64-windows
* or Linux: x64-linux MacOSX: x64-osx
<div>
<img width="100%" height="auto" src="../.gitlab/media/QtCreator_kit.png">
</div>
9. Check if Ninja is selected
* Extras -> Tools -> Kits -> <Your Kit> -> CMakeGenerator -> Change to:
* Generator: Ninja
* Extra Generator: CodeBlocks
10. Save and close the settings.
11. Press build (the big green play button). This will compile the project and copy all necessary files into your Qt installation.
### Windows
1. [Download and install MSVC 2019 Community](https://visualstudio.microsoft.com/vs/community/)
- Select "Desktop development with C++"
2. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- MSVC 2017 64-bit
- Qt WebEngine
- Developer and Designer Tools
- Cmake
- Ninja
### Linux
1. Install dependencies for your distro:
``` bash
# Debian/Ubuntu
sudo apt install build-essential libgl1-mesa-dev lld ninja-build cmake
# Fedora/RHEL/CentOS (yum)
sudo yum groupinstall "C Development Tools and Libraries"
sudo yum install mesa-libGL-devel
# openSUSE (zypper)
sudo zypper install -t pattern devel_basis
```
2. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- GCC
- Qt WebEngine
### OSX
1. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- Qt WebEngine
- Developer and Designer Tools
- OpenSSL 1.1.1.c Toolkit
- OpenSSL 64-bit binaries
- Cmake
- Ninja
2. Install [homebrew](https://brew.sh/)
- Open a terminal and install clang -> brew install llvm
3. Change your default kit: QtCreator -> Options -> Kits -> Select your default kit (Desktop Qt 5.13.0) -> Change c and c++ Compiler to Apple Clang (x86_64)

42
Docs/ProjectOverview.md Normal file
View File

@ -0,0 +1,42 @@
# Overview
ScreenPlay consists of 5 projects:
1. **ScreenPlay**
* The main ScreenPlay App UI with Create, Installed, Community and Settings
2. **ScreenPlaySDK**
* A SDK used internally in the ScreenPlayWallpaper and ScreenPlayWidget to talk to the main ScreenPlay app via QLocalsockets (Windows Pipes and Unix sockets)
3. **ScreenPlaySysInfo**
* A qml plugin to read CPU, GPU, Network and all sort of statisitcs
4. **ScreenPlayWallpaper**
* The Wallpaper executable that is used for displaying a single wallpaper. This uses ScreenPlaySDK to talk via QLocalsockets with the main ScreenPlayApp.
5. **ScreenPlayWidget**
* The Widget executable that is used for displaying a single widget. This uses ScreenPlaySDK to talk via QLocalsockets with the main ScreenPlayApp .
![ProjectOverview.png](ProjectOverview.png)
### ScreenPlay App Class
ScreenPlay wrapps all classes into a App.h and App.cpp class. This is easier for unit test integration (not implemented yet!). The main app class is used for owning [all other classes via Q_PROPERTY](https://gitlab.com/kelteseth/ScreenPlay/-/blob/master/ScreenPlay/app.h#L39) to be easily accessible in the GUI/QML. We use the [constructor](https://gitlab.com/kelteseth/ScreenPlay/-/blob/master/ScreenPlay/app.cpp#L44) of the App class to initialize all Qt register types, fonts and to check if another ScreenPlay instance is running. The [init()](https://gitlab.com/kelteseth/ScreenPlay/-/blob/master/ScreenPlay/app.cpp#L103) method is used to initialize all other c++ classes in a certain order! It also sets up some events [signal/slots](https://doc.qt.io/qt-5/signalsandslots.html) like when the user changes the UI language.
For all other class documentation please visit [ScreenPlayDeveloperDocs](https://kelteseth.gitlab.io/ScreenPlayDeveloperDocs/)
``` mermaid
graph TD
Main.cpp --> App
App --> QQmlApplicationEngine
App --> GlobalVariables
App --> ScreenPlayManager
ScreenPlayManager --> ScreenPlayWallpaper
ScreenPlayManager --> ScreenPlayWidget
App --> Create
Create--> CreateVideoImport
App --> Util
App --> Settings
App --> SDKConnector
App --> InstalledListModel
InstalledListModel --> ProjectFile
App --> InstalledListFilter
App --> MonitorListModel
MonitorListModel --> Monitor
App --> ProfileListModel
ProfileListModel --> Profile
```

BIN
Docs/ProjectOverview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

132
README.md
View File

@ -11,9 +11,28 @@ ScreenPlay is an open source cross plattform app for displaying Wallpaper, Widge
![Preview](.gitlab/media/preview.mp4)
<br> <h4><a href="https://kelteseth.gitlab.io/ScreenPlayDeveloperDocs/"> Developer C++ Classes Documentation</a> and <a href="https://kelteseth.gitlab.io/ScreenPlayDocs/">Wallpaper And Widgets Guide</a></h4>
<br> <h4><a href=""> </a> and <a href="">Wallpaper And Widgets Guide</a></h4>
</div>
# Contributing for none programmer
Everyone can contribute with code, design, documentation or translation. Visit our [contributing guide](https://kelteseth.gitlab.io/ScreenPlayDocs/contribute/contribute) for more informations.
* If you want to help [translate](https://kelteseth.gitlab.io/ScreenPlayDocs/contribute/translations/)
* If you are a [designer](https://kelteseth.gitlab.io/ScreenPlayDocs/contribute/contribute/#design)
* Help create example app via [HTML/QML/Javascript](https://kelteseth.gitlab.io/ScreenPlayDocs/)
# Contributing for programmer
* If you want to contribute but don't know how to start, take a look at our open issues and WIP merge request.
* If you need help don't hesitate to ask me (Keltseth) via:
* [Create a forum topic with a detailed description](https://forum.screen-play.app/category/2/general-discussion)
* [discord channel general](https://discord.gg/3RygPHZ)
* [Developer setup guide on how to download and compile ScreenPlay yourself.](Docs/DeveloperSetup.md)
* [ScreenPlay project overview](Docs/ProjectOverview.md)
* [Developer C++ Classes Documentation](https://kelteseth.gitlab.io/ScreenPlayDeveloperDocs/)
# Platform support
* ❌ Not working/Not implemented
@ -49,114 +68,3 @@ __If you want to help and add new desktop environments look at ScreenPlayWallpap
</div>
# Contributing
Everyone can contribute with code, design, documentation or translation. Visit our [contributing guide](https://gitlab.com/kelteseth/ScreenPlay/blob/dev/CONTRIBUTING.md) for more informations.
* If you want to help [translate](https://gitlab.com/kelteseth/ScreenPlay/blob/dev/CONTRIBUTING.md#translation)
* If you are a [programmer](https://gitlab.com/kelteseth/ScreenPlay/blob/dev/CONTRIBUTING.md#development)
* If you are a [designer](https://gitlab.com/kelteseth/ScreenPlay/blob/dev/CONTRIBUTING.md#design)
# Getting started
### Basic
1. Install latest [git + git-lfs](https://git-scm.com/)
2. Clone ScreenPlay
``` bash
git clone --recursive https://gitlab.com/kelteseth/ScreenPlay.git
```
3. Download the latest [__Qt 5.14__](https://www.qt.io/download-qt-installer). Earlier versions are not supported!
4. Start install-dependencies.bat to download dependencies into the Common/ folder
``` bash
//Windows
.\install-dependencies.bat
//Linux
sudo apt install git gcc cmake build-essential libgl1-mesa-dev
chmod +x install-dependencies.sh
.\install-dependencies.sh
```
* This will install these dependencies via __vcpkg__
* libzippp
* nlohmann-json
* openSSL 1.1.1d
* zlib& libzip
* breakpad
* Download these dependencies via __git submodules__
* stomt-qt-sdk
* qt-google-analytics
* qt-breakpad
5. **Follow the steps below for your OS**.
6. Open the CMakeLists.txt via QtCreator. **This can take some time until QtCreator parses all files!**
7. Add a second build step at: Projects -> Build -> Add Build Step -> Select Build -> Select "install" .
<div>
<img width="100%" height="auto" src=".gitlab/media/QtCreator_install.png">
</div>
8. Add CMake variables
* Add CMAKE_TOOLCHAIN_FILE and VCPKG_TARGET_TRIPLET
* Extras -> Tools -> Kits -> <Your Kit> -> CMake Configuration -> Append this:
* CMAKE_TOOLCHAIN_FILE:STRING=%{CurrentProject:Path}/ScreenPlay/Common/vcpkg/scripts/buildsystems/vcpkg.cmake
* VCPKG_TARGET_TRIPLET:STRING=x64-windows
* or Linux: x64-linux MacOSX: x64-osx
<div>
<img width="100%" height="auto" src=".gitlab/media/QtCreator_kit.png">
</div>
9. Check if Ninja is selected
* Extras -> Tools -> Kits -> <Your Kit> -> CMakeGenerator -> Change to:
* Generator: Ninja
* Extra Generator: CodeBlocks
10. Save and close the settings.
11. Press build (the big green play button). This will compile the project and copy all necessary files into your Qt installation.
### Windows
1. [Download and install MSVC 2019 Community](https://visualstudio.microsoft.com/vs/community/)
- Select "Desktop development with C++"
2. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- MSVC 2017 64-bit
- Qt WebEngine
- Developer and Designer Tools
- Cmake
- Ninja
### Linux
1. Install dependencies for your distro:
``` bash
# Debian/Ubuntu
sudo apt install build-essential libgl1-mesa-dev lld ninja-build cmake
# Fedora/RHEL/CentOS (yum)
sudo yum groupinstall "C Development Tools and Libraries"
sudo yum install mesa-libGL-devel
# openSUSE (zypper)
sudo zypper install -t pattern devel_basis
```
2. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- GCC
- Qt WebEngine
### OSX
1. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- Qt WebEngine
- Developer and Designer Tools
- OpenSSL 1.1.1.c Toolkit
- OpenSSL 64-bit binaries
- Cmake
- Ninja
2. Install [homebrew](https://brew.sh/)
- Open a terminal and install clang -> brew install llvm
3. Change your default kit: QtCreator -> Options -> Kits -> Select your default kit (Desktop Qt 5.13.0) -> Change c and c++ Compiler to Apple Clang (x86_64)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.16.0)
project(ScreenPlay)
@ -23,7 +23,7 @@ find_package(nlohmann_json CONFIG REQUIRED)
set(src main.cpp
app.cpp
../Common/qt-google-analytics/ganalytics.cpp
src/globalvariables.cpp
src/createimportvideo.cpp
src/installedlistmodel.cpp
src/monitorlistmodel.cpp
@ -60,12 +60,12 @@ set(headers app.h
set(resources Resources.qrc)
add_executable(ScreenPlay ${src} ${headers} ${resources})
add_executable(${PROJECT_NAME} ${src} ${headers} ${resources})
target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}")
target_link_libraries(ScreenPlay PRIVATE
Qt5::Qml
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Quick
Qt5::Gui
Qt5::Widgets

View File

@ -44,14 +44,13 @@ namespace ScreenPlay {
App::App()
: QObject(nullptr)
{
QGuiApplication::setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
QGuiApplication::setOrganizationName("ScreenPlay");
QGuiApplication::setOrganizationDomain("screen-play.app");
QGuiApplication::setApplicationName("ScreenPlay");
QGuiApplication::setApplicationVersion("0.10.1");
QGuiApplication::setQuitOnLastWindowClosed(false);
#ifdef Q_OS_WINDOWS
QtBreakpad::init(QDir::current().absolutePath());
#endif
@ -87,6 +86,18 @@ App::App()
qRegisterMetaType<InstalledListFilter*>();
qRegisterMetaType<MonitorListModel*>();
qRegisterMetaType<ProfileListModel*>();
qRegisterMetaType<Enums::FillMode>();
qRegisterMetaType<Enums::WallpaperType>();
qRegisterMetaType<Enums::WidgetType>();
// Registers the enums from globalvariables.
// Apparently this is the only way for qml to work
// https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/
qmlRegisterUncreatableMetaObject(ScreenPlay::Enums::staticMetaObject,
"ScreenPlayEnums",
1, 0,
"ScreenPlayEnums",
"Error: only enums");
qmlRegisterAnonymousType<GlobalVariables>("ScreenPlay", 1);
qmlRegisterAnonymousType<ScreenPlayManager>("ScreenPlay", 1);
@ -96,7 +107,7 @@ App::App()
qmlRegisterAnonymousType<SDKConnector>("ScreenPlay", 1);
// SDKConnect first to check if another ScreenPlay Instace is running
m_sdkConnector = make_shared<SDKConnector>();
m_sdkConnector = std::make_shared<SDKConnector>();
m_isAnotherScreenPlayInstanceRunning = m_sdkConnector->m_isAnotherScreenPlayInstanceRunning;
}
@ -108,10 +119,12 @@ App::App()
*/
void App::init()
{
using std::make_shared, std::make_unique;
// Util should be created as first so we redirect qDebugs etc. into the log
m_globalVariables = make_shared<GlobalVariables>();
auto* nam = new QNetworkAccessManager(this);
m_util = make_unique<Util>(nam);
m_globalVariables = make_shared<GlobalVariables>();
m_installedListModel = make_shared<InstalledListModel>(m_globalVariables);
m_installedListFilter = make_shared<InstalledListFilter>(m_installedListModel);
m_monitorListModel = make_shared<MonitorListModel>();

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QDir>
@ -31,10 +65,6 @@
#include "src/util.h"
namespace ScreenPlay {
using std::make_unique,
std::unique_ptr,
std::make_shared,
std::shared_ptr;
class App : public QObject {
Q_OBJECT
@ -234,20 +264,20 @@ public slots:
}
private:
unique_ptr<QQmlApplicationEngine> m_mainWindowEngine;
std::unique_ptr<QQmlApplicationEngine> m_mainWindowEngine;
unique_ptr<Create> m_create;
unique_ptr<ScreenPlayManager> m_screenPlayManager;
unique_ptr<Util> m_util;
std::unique_ptr<Create> m_create;
std::unique_ptr<ScreenPlayManager> m_screenPlayManager;
std::unique_ptr<Util> m_util;
shared_ptr<GAnalytics> m_telemetry;
shared_ptr<GlobalVariables> m_globalVariables;
shared_ptr<Settings> m_settings;
shared_ptr<SDKConnector> m_sdkConnector;
std::shared_ptr<GAnalytics> m_telemetry;
std::shared_ptr<GlobalVariables> m_globalVariables;
std::shared_ptr<Settings> m_settings;
std::shared_ptr<SDKConnector> m_sdkConnector;
shared_ptr<InstalledListModel> m_installedListModel;
shared_ptr<MonitorListModel> m_monitorListModel;
shared_ptr<ProfileListModel> m_profileListModel;
shared_ptr<InstalledListFilter> m_installedListFilter;
std::shared_ptr<InstalledListModel> m_installedListModel;
std::shared_ptr<MonitorListModel> m_monitorListModel;
std::shared_ptr<ProfileListModel> m_profileListModel;
std::shared_ptr<InstalledListFilter> m_installedListFilter;
};
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#include <QApplication>
#include "app.h"

View File

@ -15,18 +15,18 @@ import "qml/Common"
import "qml/Installed"
import "qml/Navigation"
import "qml/Workshop"
import "qml/Community"
ApplicationWindow {
id: window
color: {
if(Material.theme === Material.Dark){
if (Material.theme === Material.Dark) {
return Qt.darker(Material.background)
} else {
return Material.background
return Material.background
}
}
// Set visible if the -silent parameter was not set (see app.cpp end of constructor).
visible: false
width: 1400
@ -34,18 +34,17 @@ ApplicationWindow {
title: "ScreenPlay Alpha - V0.10.1"
minimumHeight: 450
minimumWidth: 1050
onVisibilityChanged: {
if(window.visibility === 2){
onVisibilityChanged: {
if (window.visibility === 2) {
switchPage("Installed")
}
}
Material.accent: {
Material.accent: {
return Material.color(Material.Orange)
}
function setTheme(theme){
function setTheme(theme) {
switch (theme) {
case Settings.System:
window.Material.theme = Material.System
@ -112,7 +111,6 @@ ApplicationWindow {
anchors.fill: parent
}
Connections {
target: ScreenPlay.util
function onRequestNavigation(nav) {
@ -331,4 +329,5 @@ ApplicationWindow {
anchors.fill: pageLoader
z: 98
}
}

View File

@ -3,7 +3,8 @@ import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.2
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.3
import QtQuick.XmlListModel 2.0
import QtQuick.XmlListModel 2.15
import ScreenPlay 1.0
GridView {
id: changelogFlickableWrapper
@ -12,40 +13,32 @@ GridView {
flickDeceleration: 5000
cellHeight: 205
cellWidth: 360
clip: true
model: feedModel
onCountChanged: print("count ",count)
Timer {
interval: 200
running: true
repeat: false
onTriggered: {
feedModel.source = "https://screen-play.app/index.php?option=com_content&view=category&layout=blog&id=10&format=feed&type=rss"
}
}
XmlListModel {
id: feedModel
query: "/rss/channel/item"
namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
onProgressChanged: print("progress ",progress)
source: "https://gitlab.com/kelteseth/ScreenPlay/-/tags?&format=atom"
query: "/entry"
XmlRole {
name: "title"
query: "title/string()"
}
XmlRole {
name: "backgroundImage"
query: "description/string()"
name: "content"
query: "content/string()"
}
XmlRole {
name: "link"
query: "link/string()"
}
XmlRole {
name: "pubDate"
query: "pubDate/string()"
}
XmlRole {
name: "category"
query: "category/string()"
name: "updated"
query: "updated/string()"
}
}
@ -98,35 +91,6 @@ GridView {
anchors.margins: 5
radius: 4
Image {
fillMode: Image.PreserveAspectCrop
anchors.fill: parent
source: {
var a = backgroundImage
var r = new RegExp(/<img[^>]+src="([^">]+)"/)
var url = r.exec(a)
return url[1].toString()
}
}
LinearGradient {
visible: true
opacity: .5
anchors.fill: parent
start: Qt.point(0, parent.height)
end: Qt.point(0, parent.height - 150)
gradient: Gradient {
GradientStop {
position: 0.0
color: "#BB000000"
}
GradientStop {
position: 1.0
color: "#00000000"
}
}
}
Text {
id: txtTitle
text: title
@ -137,7 +101,7 @@ GridView {
left: parent.left
margins: 20
}
color: "white"
color: "#333333"
font.family: ScreenPlay.settings.font
font.weight: Font.Normal
font.pointSize: 18
@ -145,9 +109,7 @@ GridView {
}
Text {
id: txtPubDate
text: {
return pubDate.replace("+0000", "")
}
text: updated
anchors {
right: parent.right
rightMargin: 20

View File

@ -76,7 +76,7 @@ Item {
font.family: ScreenPlay.settings.font
opacity: buttonActive ? 1 : .25
font.pointSize: 14
color: Material.theme === Material.Light ? Qt.lighter(Material.foreground) : Qt.darker(Material.foreground)
color: Material.foreground
wrapMode: Text.WrapAnywhere
maximumLineCount: 1

View File

@ -4,7 +4,7 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import QtQuick.Dialogs 1.2
import ScreenPlay 1.0
import Settings 1.0
import "../../../Common"

View File

@ -36,4 +36,34 @@ Item {
CreateWallpaperResult {}
}
Connections {
target: ScreenPlay.create
function onCreateWallpaperStateChanged(state) {
switch (state) {
case CreateImportVideo.AnalyseVideoError:
case CreateImportVideo.AnalyseVideoHasNoVideoStreamError:
case CreateImportVideo.ConvertingPreviewVideoError:
case CreateImportVideo.ConvertingPreviewGifError:
case CreateImportVideo.ConvertingPreviewImageError:
case CreateImportVideo.ConvertingPreviewImageThumbnailError:
case CreateImportVideo.CopyFilesError:
case CreateImportVideo.CreateProjectFileError:
case CreateImportVideo.AbortCleanupError:
case CreateImportVideo.CreateTmpFolderError:
break
}
}
function onProgressChanged(progress) {
var percentage = Math.floor(progress * 100)
if (percentage > 100 || progress > 0.95)
percentage = 100
txtConvertNumber.text = percentage + "%"
}
}
}

View File

@ -6,7 +6,7 @@ import QtQuick.Layouts 1.12
import QtQuick.Controls.Material 2.12
import ScreenPlay 1.0
import Settings 1.0
import ScreenPlayEnums 1.0
import "../Monitors"
import "../Common" as SP
@ -19,8 +19,29 @@ Item {
property real navHeight
property string type
property var typeEnum: ScreenPlayEnums.QMLWallpaper
property string activeScreen
function isWallpaper() {
if (typeEnum === ScreenPlayEnums.VideoWallpaper
|| typeEnum === ScreenPlayEnums.HTMLWallpaper
|| typeEnum === ScreenPlayEnums.QMLWallpaper) {
return true
} else {
return false
}
}
function isWidget() {
if (typeEnum === ScreenPlayEnums.HTMLWidget
|| typeEnum === ScreenPlayEnums.QMLWidget) {
return true
} else {
return false
}
}
function indexOfValue(model, value) {
for (var i = 0; i < model.length; i++) {
@ -47,22 +68,27 @@ Item {
switch (type) {
case "videoWallpaper":
root.typeEnum = ScreenPlayEnums.VideoWallpaper
state = "videoWallpaper"
return
case "htmlWallpaper":
state = "activeScene"
root.typeEnum = ScreenPlayEnums.HTMLWallpaper
return
case "qmlWallpaper":
state = "activeScene"
root.typeEnum = ScreenPlayEnums.QMLWallpaper
return
case "godotWallpaper":
state = "activeScene"
return
case "qmlWidget":
state = "activeWidget"
root.typeEnum = ScreenPlayEnums.QMLWidget
return
case "htmlWidget":
state = "activeWidget"
root.typeEnum = ScreenPlayEnums.HTMLWidget
return
case "standaloneWidget":
state = "activeWidget"
@ -297,19 +323,19 @@ Item {
model: [{
"value": Settings.Stretch,
"value": ScreenPlayEnums.Stretch,
"text": qsTr("Stretch")
}, {
"value": Settings.Fill,
"value": ScreenPlayEnums.Fill,
"text": qsTr("Fill")
}, {
"value": Settings.Contain,
"value": ScreenPlayEnums.Contain,
"text": qsTr("Contain")
}, {
"value": Settings.Cover,
"value": ScreenPlayEnums.Cover,
"text": qsTr("Cover")
}, {
"value": Settings.Scale_Down,
"value": ScreenPlayEnums.Scale_Down,
"text": qsTr("Scale-Down")
}]
}
@ -327,11 +353,12 @@ Item {
icon.width: 16
icon.height: 16
enabled: {
if (type.endsWith("Wallpaper")) {
if (root.isWallpaper()) {
if (monitorSelection.activeMonitors.length > 0) {
return true
}
} else if (type.endsWith("Widget")) {
}
if (root.isWidget()) {
return true
}
return false
@ -344,7 +371,7 @@ Item {
}
onClicked: {
if (type.endsWith("Wallpaper")) {
if (root.isWallpaper()) {
let activeMonitors = monitorSelection.getActiveMonitors(
)
@ -353,17 +380,24 @@ Item {
return
ScreenPlay.screenPlayManager.createWallpaper(
activeMonitors, ScreenPlay.globalVariables.localStoragePath
+ "/" + activeScreen,
root.typeEnum,
cbVideoFillMode.currentValue,
ScreenPlay.globalVariables.localStoragePath + "/" + activeScreen,
ScreenPlay.installedListModel.get(activeScreen).screenPreview,
(Math.round(sliderVolume.value * 100) / 100),
cbVideoFillMode.currentText, type)
} else {
ScreenPlay.installedListModel.get(activeScreen).screenFile,
activeMonitors,
(Math.round( sliderVolume.value * 100) / 100),
true)
}
else if(root.isWidget())
{
ScreenPlay.screenPlayManager.createWidget(
ScreenPlay.globalVariables.localStoragePath
+ "/" + activeScreen,
ScreenPlay.installedListModel.get(
activeScreen).screenPreview, type)
activeScreen).screenPreview,
typeEnum)
}
root.state = "inactive"
monitorSelection.deselectAll()

View File

@ -5,7 +5,8 @@ import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import ScreenPlay 1.0
import Settings 1.0
import ScreenPlayEnums 1.0
import "../Common/" as SP
@ -85,19 +86,19 @@ ColumnLayout {
model: [{
"value": Settings.Stretch,
"value": ScreenPlayEnums.Stretch,
"text": qsTr("Stretch")
}, {
"value": Settings.Fill,
"value": ScreenPlayEnums.Fill,
"text": qsTr("Fill")
}, {
"value": Settings.Contain,
"value": ScreenPlayEnums.Contain,
"text": qsTr("Contain")
}, {
"value": Settings.Cover,
"value": ScreenPlayEnums.Cover,
"text": qsTr("Cover")
}, {
"value": Settings.Scale_Down,
"value": ScreenPlayEnums.Scale_Down,
"text": qsTr("Scale-Down")
}]
}

View File

@ -1,4 +1,5 @@
import QtQuick 2.12
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
@ -18,7 +19,7 @@ Rectangle {
property bool multipleMonitorsSelectable: true
// We preselect the main monitor
property var activeMonitors:[0]
property var activeMonitors: [0]
property alias background: rect.color
property alias radius: rect.radius
@ -30,38 +31,36 @@ Rectangle {
}
Connections {
target: ScreenPlay.monitorListModel
target: ScreenPlay.monitorListModel
function onMonitorReloadCompleted() {
resize()
}
}
function deselectOthers(index){
function deselectOthers(index) {
for (var i = 0; i < rp.count; i++) {
if(i === index){
if (i === index) {
rp.itemAt(i).isSelected = true
continue;
continue
}
rp.itemAt(i).isSelected = false
}
}
function deselectAll(){
function deselectAll() {
for (var i = 0; i < rp.count; i++) {
rp.itemAt(i).isSelected = false
}
getActiveMonitors()
}
function getActiveMonitors(){
function getActiveMonitors() {
rect.activeMonitors = []
for (var i = 0; i < rp.count; i++) {
if(rp.itemAt(i).isSelected){
rect.activeMonitors.push(rp.itemAt(i).index)
}
if (rp.itemAt(i).isSelected) {
rect.activeMonitors.push(rp.itemAt(i).index)
}
}
// Must be called manually. When QML properties are getting altered in js the
// property binding breaks
@ -71,7 +70,7 @@ Rectangle {
function resize() {
var absoluteDesktopSize = ScreenPlay.monitorListModel.getAbsoluteDesktopSize()
var absoluteDesktopSize = ScreenPlay.monitorListModel.getAbsoluteDesktopSize()
var isWidthGreaterThanHeight = false
var windowsDelta = 0
@ -104,44 +103,52 @@ Rectangle {
rp.itemAt(i).width = rp.itemAt(i).width * monitorWidthRationDelta
rp.itemAt(i).x = rp.itemAt(i).x * monitorWidthRationDelta
rp.itemAt(i).y = rp.itemAt(i).y * monitorHeightRationDelta
}
}
Repeater {
id: rp
Flickable {
anchors.fill: parent
model: ScreenPlay.monitorListModel
ScrollBar.vertical: ScrollBar {
snapMode: ScrollBar.SnapOnRelease
}
ScrollBar.horizontal: ScrollBar {
snapMode: ScrollBar.SnapOnRelease
}
Component.onCompleted: rp.itemAt(0).isSelected = true
Repeater {
id: rp
model: ScreenPlay.monitorListModel
delegate: MonitorSelectionItem {
id: delegate
monitorID: m_monitorID
monitorName: m_name
height: m_availableGeometry.height
width: m_availableGeometry.width
x: m_availableGeometry.x
y: m_availableGeometry.y
monitorManufacturer: m_manufacturer
monitorModel: m_model
monitorSize: m_availableGeometry
fontSize: rect.fontSize
index: m_number
previewImage: m_previewImage
Component.onCompleted: rp.itemAt(0).isSelected = true
onMonitorSelected: {
delegate: MonitorSelectionItem {
id: delegate
monitorID: m_monitorID
monitorName: m_name
height: m_availableGeometry.height
width: m_availableGeometry.width
x: m_availableGeometry.x
y: m_availableGeometry.y
monitorManufacturer: m_manufacturer
monitorModel: m_model
monitorSize: m_availableGeometry
fontSize: rect.fontSize
index: m_number
previewImage: m_previewImage
if(!multipleMonitorsSelectable){
deselectOthers(index)
} else {
rp.itemAt(index).isSelected = !rp.itemAt(index).isSelected
onMonitorSelected: {
if (!multipleMonitorsSelectable) {
deselectOthers(index)
} else {
rp.itemAt(index).isSelected = !rp.itemAt(
index).isSelected
}
getActiveMonitors()
requestProjectSettings(index)
}
getActiveMonitors()
requestProjectSettings(index)
}
}
}

View File

@ -4,8 +4,8 @@ import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import ScreenPlay 1.0
import ScreenPlayEnums 1.0
import "../Common/" as SP
Item {
@ -97,10 +97,17 @@ Item {
}
Connections {
target: ScreenPlay.screenPlayManager
function onProjectSettingsListModelFound(li,type) {
function onProjectSettingsListModelResult(found,listModel,type) {
if(!found){
customPropertiesGridView.model = null
videoControlWrapper.state = "hidden"
customPropertiesGridView.state = "hidden"
return
}
videoControlWrapper.state = "visible"
customPropertiesGridView.model = li
if (type === "videoWallpaper") {
customPropertiesGridView.model = listModel
if (type === ScreenPlayEnums.VideoWallpaper) {
customPropertiesGridView.state = "hidden"
videoControlWrapper.state = "visible"
} else {
@ -108,11 +115,6 @@ Item {
videoControlWrapper.state = "hidden"
}
}
function onProjectSettingsListModelNotFound() {
customPropertiesGridView.model = null
videoControlWrapper.state = "hidden"
customPropertiesGridView.state = "hidden"
}
}
}

View File

@ -5,7 +5,7 @@ import QtQuick.Dialogs 1.2
import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import Settings 1.0
import ScreenPlay 1.0
Rectangle {

View File

@ -7,7 +7,8 @@ import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0
import ScreenPlay 1.0
import Settings 1.0
import ScreenPlayEnums 1.0
import "../Common"
@ -321,19 +322,19 @@ Item {
cbVideoFillMode.comboBox.currentValue)
model: [{
"value": Settings.Stretch,
"value": ScreenPlayEnums.Stretch,
"text": qsTr("Stretch")
}, {
"value": Settings.Fill,
"value": ScreenPlayEnums.Fill,
"text": qsTr("Fill")
}, {
"value": Settings.Contain,
"value": ScreenPlayEnums.Contain,
"text": qsTr("Contain")
}, {
"value": Settings.Cover,
"value": ScreenPlayEnums.Cover,
"text": qsTr("Cover")
}, {
"value": Settings.Scale_Down,
"value": ScreenPlayEnums.Scale_Down,
"text": qsTr("Scale-Down")
}]
}

View File

@ -17,7 +17,7 @@ namespace ScreenPlay {
/*!
Constructor.
*/
Create::Create(const shared_ptr<GlobalVariables>& globalVariables, QObject* parent)
Create::Create(const std::shared_ptr<GlobalVariables>& globalVariables, QObject* parent)
: QObject(parent)
, m_globalVariables(globalVariables)

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QDir>
@ -28,9 +62,6 @@
namespace ScreenPlay {
using std::shared_ptr,
std::make_shared;
class Create : public QObject {
Q_OBJECT
@ -40,7 +71,7 @@ class Create : public QObject {
public:
explicit Create(
const shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<GlobalVariables>& globalVariables,
QObject* parent = nullptr);
Create();
@ -137,7 +168,7 @@ private:
CreateImportVideo* m_createImportVideo { nullptr };
QThread* m_createImportVideoThread { nullptr };
const shared_ptr<GlobalVariables> m_globalVariables;
const std::shared_ptr<GlobalVariables> m_globalVariables;
float m_progress { 0.0F };
QString m_workingDir;

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>

View File

@ -0,0 +1,8 @@
#include "globalvariables.h"
namespace ScreenPlay {
ScreenPlay::GlobalVariables::GlobalVariables(QObject* parent)
: QObject(parent)
{
setLocalSettingsPath(QUrl { QStandardPaths::writableLocation(QStandardPaths::DataLocation) });
}
}

View File

@ -1,5 +1,41 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QObject>
#include <QQmlEngine>
#include <QStandardPaths>
#include <QUrl>
#include <QVersionNumber>
@ -15,6 +51,34 @@ namespace ScreenPlay {
*/
namespace Enums {
Q_NAMESPACE
enum class FillMode {
Stretch,
Fill,
Contain,
Cover,
Scale_Down
};
Q_ENUM_NS(FillMode)
enum class WallpaperType {
VideoWallpaper,
QMLWallpaper,
HTMLWallpaper
};
Q_ENUM_NS(WallpaperType)
enum class WidgetType {
QMLWidget,
HTMLWidget
};
Q_ENUM_NS(WidgetType)
}
class GlobalVariables : public QObject {
Q_OBJECT
@ -25,13 +89,13 @@ class GlobalVariables : public QObject {
Q_PROPERTY(QUrl widgetExecutablePath READ widgetExecutablePath WRITE setWidgetExecutablePath NOTIFY widgetExecutablePathChanged)
public:
explicit GlobalVariables(QObject* parent = nullptr)
: QObject(parent)
{
setLocalSettingsPath(QUrl { QStandardPaths::writableLocation(QStandardPaths::DataLocation) });
}
explicit GlobalVariables(QObject* parent = nullptr);
/*!
\property GlobalVariables::localStoragePath
\brief Returns the localStoragePath.
*/
QUrl localStoragePath() const
@ -39,6 +103,7 @@ public:
return m_localStoragePath;
}
/*!
\property GlobalVariables::localSettingsPath
\brief Returns the localSettingsPath.
*/
QUrl localSettingsPath() const
@ -46,6 +111,7 @@ public:
return m_localSettingsPath;
}
/*!
\property GlobalVariables::wallpaperExecutablePath
\brief Returns the wallpaperExecutablePath. This only differes in development builds.
*/
QUrl wallpaperExecutablePath() const
@ -53,6 +119,7 @@ public:
return m_wallpaperExecutablePath;
}
/*!
\property GlobalVariables::widgetExecutablePath
\brief Returns the widgetExecutablePath. This only differes in development builds.
*/
QUrl widgetExecutablePath() const
@ -60,6 +127,7 @@ public:
return m_widgetExecutablePath;
}
/*!
\property GlobalVariables::m_version
\brief Returns the current app version. Not yet used.
*/
QVersionNumber version() const

View File

@ -14,7 +14,7 @@ namespace ScreenPlay {
\brief Sets the default role type to "All" to display all available content. Needs a given
\a ilm (InstalledListModel).
*/
InstalledListFilter::InstalledListFilter(const shared_ptr<InstalledListModel>& ilm)
InstalledListFilter::InstalledListFilter(const std::shared_ptr<InstalledListModel>& ilm)
: QSortFilterProxyModel()
, m_ilm(ilm)
{

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include "installedlistmodel.h"
@ -11,7 +45,7 @@ class InstalledListFilter : public QSortFilterProxyModel {
Q_OBJECT
public:
InstalledListFilter(const shared_ptr<InstalledListModel>& ilm);
InstalledListFilter(const std::shared_ptr<InstalledListModel>& ilm);
public slots:
void sortByRoleType(QString type);
@ -19,6 +53,6 @@ public slots:
void resetFilter();
private:
const shared_ptr<InstalledListModel> m_ilm;
const std::shared_ptr<InstalledListModel> m_ilm;
};
}

View File

@ -16,7 +16,7 @@ namespace ScreenPlay {
\brief Constructor.
*/
InstalledListModel::InstalledListModel(
const shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<GlobalVariables>& globalVariables,
QObject* parent)
: QAbstractListModel(parent)
, m_globalVariables { globalVariables }

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QAbstractListModel>
@ -27,8 +61,6 @@
namespace ScreenPlay {
using std::shared_ptr;
class InstalledListModel : public QAbstractListModel {
Q_OBJECT
@ -36,7 +68,7 @@ class InstalledListModel : public QAbstractListModel {
public:
explicit InstalledListModel(
const shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<GlobalVariables>& globalVariables,
QObject* parent = nullptr);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
@ -89,6 +121,6 @@ private:
QVector<ProjectFile> m_screenPlayFiles;
int m_count { 0 };
const shared_ptr<GlobalVariables>& m_globalVariables;
const std::shared_ptr<GlobalVariables>& m_globalVariables;
};
}

View File

@ -78,16 +78,17 @@ QVariant MonitorListModel::data(const QModelIndex& index, int role) const
auto roleEnum = static_cast<MonitorRole>(role);
if (index.row() < rowCount())
if (row < rowCount())
switch (roleEnum) {
case MonitorRole::AppID:
if (m_monitorList.at(index.row()).m_activeWallpaper) {
return m_monitorList.at(index.row()).m_activeWallpaper->appID();
if (m_monitorList.at(row).m_activeWallpaper) {
return m_monitorList.at(row).m_activeWallpaper->appID();
} else {
return QVariant("");
}
case MonitorRole::MonitorID: {
QScreen* screen = m_monitorList.at(index.row()).m_screen;
QScreen* screen = m_monitorList.at(row).m_screen;
QVariant id = QString::number(screen->size().width())
+ "x" + QString::number(screen->size().height())
@ -97,24 +98,25 @@ QVariant MonitorListModel::data(const QModelIndex& index, int role) const
return id;
}
case MonitorRole::Name:
return m_monitorList.at(index.row()).m_screen->name();
return m_monitorList.at(row).m_screen->name();
case MonitorRole::Size:
return m_monitorList.at(index.row()).m_screen->size();
return m_monitorList.at(row).m_screen->size();
case MonitorRole::AvailableGeometry:
return m_monitorList.at(index.row()).m_availableGeometry;
return m_monitorList.at(row).m_availableGeometry;
case MonitorRole::AvailableVirtualGeometry:
return m_monitorList.at(index.row()).m_screen->availableVirtualGeometry();
return m_monitorList.at(row).m_screen->availableVirtualGeometry();
case MonitorRole::Number:
return m_monitorList.at(index.row()).m_number;
return m_monitorList.at(row).m_number;
case MonitorRole::Geometry:
return m_monitorList.at(index.row()).m_screen->geometry();
return m_monitorList.at(row).m_screen->geometry();
case MonitorRole::Model:
return m_monitorList.at(index.row()).m_screen->model();
return m_monitorList.at(row).m_screen->model();
case MonitorRole::Manufacturer:
return m_monitorList.at(index.row()).m_screen->manufacturer();
return m_monitorList.at(row).m_screen->manufacturer();
case MonitorRole::PreviewImage:
if (m_monitorList.at(index.row()).m_activeWallpaper) {
return m_monitorList.at(index.row()).m_activeWallpaper->previewImage();
if (m_monitorList.at(row).m_activeWallpaper) {
QString absolutePath = m_monitorList.at(row).m_activeWallpaper->absolutePath();
return absolutePath + "/" + m_monitorList.at(row).m_activeWallpaper->previewImage();
} else {
return QVariant("");
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QAbstractListModel>
@ -70,7 +104,8 @@ public:
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
void setWallpaperActiveMonitor(const std::shared_ptr<ScreenPlayWallpaper>& wallpaper,
void setWallpaperActiveMonitor(
const std::shared_ptr<ScreenPlayWallpaper>& wallpaper,
const QVector<int> monitors);
std::optional<QString> getAppIDByMonitorIndex(const int index) const;
@ -109,7 +144,6 @@ private:
private:
QVector<Monitor> m_monitorList;
QVector<QSharedPointer<ProjectSettingsListModel>> m_plm;
};
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QRect>
#include <QString>

View File

@ -20,7 +20,7 @@ namespace ScreenPlay {
/*!
Constructor
*/
ProfileListModel::ProfileListModel(const shared_ptr<GlobalVariables>& globalVariables, QObject* parent)
ProfileListModel::ProfileListModel(const std::shared_ptr<GlobalVariables>& globalVariables, QObject* parent)
: QAbstractListModel(parent)
, m_globalVariables { globalVariables }
{

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include "profile.h"
@ -16,8 +50,6 @@
namespace ScreenPlay {
using std::shared_ptr;
struct Profile;
class ProfileListModel : public QAbstractListModel {
@ -25,7 +57,7 @@ class ProfileListModel : public QAbstractListModel {
public:
explicit ProfileListModel(
const shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<GlobalVariables>& globalVariables,
QObject* parent = nullptr);
enum RoleNames {
@ -41,6 +73,6 @@ public:
private:
QVector<Profile> m_profileList;
const shared_ptr<GlobalVariables>& m_globalVariables;
const std::shared_ptr<GlobalVariables>& m_globalVariables;
};
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QDebug>

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QString>

View File

@ -58,14 +58,16 @@ QVariant ProjectSettingsListModel::data(const QModelIndex& index, int role) cons
if (!index.isValid())
return QVariant();
if (index.row() < rowCount())
const int row = rowCount();
if (row < rowCount())
switch (role) {
case NameRole:
return m_projectSettings.at(index.row()).m_name;
return m_projectSettings.at(row).m_name;
case IsHeadlineRole:
return m_projectSettings.at(index.row()).m_isHeadline;
return m_projectSettings.at(row).m_isHeadline;
case ValueRole:
return m_projectSettings.at(index.row()).m_value;
return m_projectSettings.at(row).m_value;
default:
return QVariant();
}
@ -89,37 +91,25 @@ QHash<int, QByteArray> ProjectSettingsListModel::roleNames() const
*/
void ProjectSettingsListModel::init(QString file)
{
QFile configTmp;
configTmp.setFileName(file);
QJsonDocument configJsonDocument;
QJsonParseError parseError;
QJsonObject obj;
if (auto config = Util::openJsonFileToObject(file)) {
configTmp.open(QIODevice::ReadOnly | QIODevice::Text);
QString config = configTmp.readAll();
configJsonDocument = QJsonDocument::fromJson(config.toUtf8(), &parseError);
QJsonObject obj = *config;
QJsonObject tmpParent;
if (!(parseError.error == QJsonParseError::NoError)) {
qWarning("Settings Json Parse Error ");
return;
}
if (obj.contains("properties")) {
tmpParent = obj.value("properties").toObject();
} else {
return;
}
obj = configJsonDocument.object();
QJsonObject tmpParent;
QJsonObject::iterator itParent, itChild;
for (itParent = tmpParent.begin(); itParent != tmpParent.end(); itParent++) {
QJsonObject tmpChildObj = tmpParent.value(itParent.key()).toObject();
append(itParent.key(), true, "");
if (obj.contains("properties")) {
tmpParent = obj.value("properties").toObject();
} else {
return;
}
QJsonObject::iterator itParent, itChild;
for (itParent = tmpParent.begin(); itParent != tmpParent.end(); itParent++) {
QJsonObject tmpChildObj = tmpParent.value(itParent.key()).toObject();
append(itParent.key(), true, "");
for (itChild = tmpChildObj.begin(); itChild != tmpChildObj.end(); itChild++) {
append(itChild.key(), false, QJsonDocument(tmpChildObj.value(itChild.key()).toObject()).toJson());
for (itChild = tmpChildObj.begin(); itChild != tmpChildObj.end(); itChild++) {
append(itChild.key(), false, QJsonDocument(tmpChildObj.value(itChild.key()).toObject()).toJson());
}
}
}
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QAbstractListModel>
@ -10,6 +44,7 @@
#include <QVector>
#include "projectsettingslistitem.h"
#include "util.h"
namespace ScreenPlay {

View File

@ -15,11 +15,11 @@ namespace ScreenPlay {
\brief Constructor-.
*/
ScreenPlayManager::ScreenPlayManager(
const shared_ptr<GlobalVariables>& globalVariables,
const shared_ptr<MonitorListModel>& mlm,
const shared_ptr<SDKConnector>& sdkc,
const shared_ptr<GAnalytics>& telemetry,
const shared_ptr<Settings>& settings,
const std::shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<MonitorListModel>& mlm,
const std::shared_ptr<SDKConnector>& sdkc,
const std::shared_ptr<GAnalytics>& telemetry,
const std::shared_ptr<Settings>& settings,
QObject* parent)
: QObject { parent }
, m_globalVariables { globalVariables }
@ -28,7 +28,7 @@ ScreenPlayManager::ScreenPlayManager(
, m_telemetry { telemetry }
, m_settings { settings }
{
loadWallpaperProfiles();
loadProfiles();
}
/*!
@ -38,34 +38,35 @@ ScreenPlayManager::ScreenPlayManager(
if we call the method when using via the settings on startup to skip a unnecessary save.
*/
void ScreenPlayManager::createWallpaper(
QVector<int> monitorIndex,
const Enums::WallpaperType type,
const Enums::FillMode fillMode,
const QString& absoluteStoragePath,
const QString& previewImage,
const QString& file,
QVector<int> monitorIndex,
const float volume,
const QString& fillMode,
const QString& type,
const bool saveToProfilesConfigFile)
{
if (m_telemetry) {
m_telemetry->sendEvent("wallpaper", "start");
}
QString path = QUrl(absoluteStoragePath).toLocalFile();
std::sort(monitorIndex.begin(), monitorIndex.end());
QJsonArray monitors;
for (const int index : monitorIndex) {
monitors.append(index);
}
QString path = QUrl::fromUserInput(absoluteStoragePath).toLocalFile();
QString appID = Util::generateRandomString();
std::shared_ptr<ScreenPlayWallpaper> wallpaper;
wallpaper = make_shared<ScreenPlayWallpaper>(
wallpaper = std::make_shared<ScreenPlayWallpaper>(
monitorIndex,
m_globalVariables,
Util::generateRandomString(),
appID,
path,
previewImage,
file,
volume,
fillMode,
type,
@ -77,7 +78,7 @@ void ScreenPlayManager::createWallpaper(
for (auto& wallpaperIterator : m_screenPlayWallpapers) {
if (wallpaperIterator->screenNumber().length() == 1) {
if (monitors.at(0) == wallpaperIterator->screenNumber().at(0)) {
if(!removeWallpaperAt(i)){
if (!removeWallpaperAt(i)) {
qWarning() << "Could not remove wallpaper at index " << i;
}
}
@ -90,35 +91,19 @@ void ScreenPlayManager::createWallpaper(
m_monitorListModel->setWallpaperActiveMonitor(wallpaper, monitorIndex);
increaseActiveWallpaperCounter();
if (saveToProfilesConfigFile && type == "videoWallpaper") {
QJsonObject settings;
settings.insert("monitors", monitors);
settings.insert("type", type);
settings.insert("volume", static_cast<double>(volume));
settings.insert("isLooping", true);
settings.insert("fillMode", fillMode);
settings.insert("previewImage", previewImage);
settings.insert("absolutePath", path);
saveWallpaperProfile("default", settings);
return;
// Do not save on app start
if (saveToProfilesConfigFile) {
saveProfiles();
}
if (saveToProfilesConfigFile && type == "qmlWallpaper") {
QJsonObject settings;
settings.insert("monitors", monitors);
settings.insert("type", type);
settings.insert("previewImage", previewImage);
settings.insert("absolutePath", path);
saveWallpaperProfile("default", settings);
}
}
/*!
\brief Creates a ScreenPlayWidget object via a \a absoluteStoragePath and a \a preview image (relative path).
*/
void ScreenPlayManager::createWidget(const QUrl& absoluteStoragePath, const QString& previewImage, const QString& type)
void ScreenPlayManager::createWidget(
const Enums::WidgetType type,
const QUrl& absoluteStoragePath,
const QString& previewImage)
{
if (m_telemetry) {
m_telemetry->sendEvent("widget", "start");
@ -126,7 +111,7 @@ void ScreenPlayManager::createWidget(const QUrl& absoluteStoragePath, const QStr
increaseActiveWidgetsCounter();
m_screenPlayWidgets.append(
make_unique<ScreenPlayWidget>(
std::make_unique<ScreenPlayWidget>(
Util::generateRandomString(),
m_globalVariables,
absoluteStoragePath.toLocalFile(),
@ -147,36 +132,13 @@ void ScreenPlayManager::removeAllWallpapers()
}
m_sdkconnector->closeAllWallpapers();
m_screenPlayWallpapers.clear();
m_monitorListModel->clearActiveWallpaper();
QString absoluteProfilesFilePath = m_globalVariables->localSettingsPath().toString() + "/profiles.json";
auto configOptional = Util::openJsonFileToObject(absoluteProfilesFilePath);
if (!configOptional) {
qWarning() << "Could not load active profiles.";
return;
}
QJsonObject oldConfig = *configOptional;
QJsonObject oldConfigProfile = oldConfig.value("profiles").toArray().first().toObject();
QJsonObject profileDefault;
profileDefault.insert("widgets", oldConfigProfile.value("widgets").toArray());
profileDefault.insert("appdrawer", oldConfigProfile.value("appdrawer").toArray());
profileDefault.insert("wallpaper", QJsonArray());
profileDefault.insert("name", "default");
QJsonArray profiles;
profiles.append(profileDefault);
QJsonObject newConfig;
newConfig.insert("version", oldConfig.value("version").toString());
newConfig.insert("profiles", profiles);
Util::writeJsonObjectToFile(absoluteProfilesFilePath, newConfig);
saveProfiles();
setActiveWallpaperCounter(0);
} else {
qWarning() << "Trying to remove all wallpapers while m_screenPlayWallpapers is not empty. Count: "<< m_screenPlayWallpapers.size();
qWarning() << "Trying to remove all wallpapers while m_screenPlayWallpapers is not empty. Count: " << m_screenPlayWallpapers.size();
}
}
@ -190,6 +152,7 @@ void ScreenPlayManager::removeAllWidgets()
m_telemetry->sendEvent("widgets", "stopAll");
}
m_sdkconnector->closeAllWidgets();
saveProfiles();
setActiveWidgetsCounter(0);
}
}
@ -199,18 +162,31 @@ void ScreenPlayManager::removeAllWidgets()
given monitor index and then closes the sdk connection, removes the entries in the
monitor list model and decreases the active wallpaper counter property of ScreenPlayManager.
*/
bool ScreenPlayManager::removeWallpaperAt(int at)
bool ScreenPlayManager::removeWallpaperAt(int index)
{
if (m_telemetry) {
m_telemetry->sendEvent("wallpaper", "removeSingleWallpaper");
}
if (auto appID = m_monitorListModel->getAppIDByMonitorIndex(at)) {
m_sdkconnector->closeWallpaper(*appID);
if (auto appID = m_monitorListModel->getAppIDByMonitorIndex(index)) {
if (!saveProfiles()) {
qWarning() << "Could not save profiles.json";
}
if (!m_sdkconnector->closeWallpaper(*appID)) {
qWarning() << "Could not close socket. Abort!";
return false;
}
m_monitorListModel->closeWallpaper(*appID);
decreaseActiveWallpaperCounter();
const QString appIDCopy = *appID;
if (!removeWallpaperByAppID(appIDCopy)) {
qWarning() << "Could not remove Wallpaper " << appIDCopy << " from wallpaper list!";
return false;
}
saveProfiles();
return true;
}
qWarning() << "Could not remove Wallpaper at index:" << index;
return false;
}
@ -219,15 +195,16 @@ bool ScreenPlayManager::removeWallpaperAt(int at)
*/
void ScreenPlayManager::requestProjectSettingsListModelAt(const int index)
{
for (const shared_ptr<ScreenPlayWallpaper>& uPtrWallpaper : qAsConst(m_screenPlayWallpapers)) {
for (const std::shared_ptr<ScreenPlayWallpaper>& uPtrWallpaper : qAsConst(m_screenPlayWallpapers)) {
if (!uPtrWallpaper->screenNumber().empty() && uPtrWallpaper->screenNumber()[0] == index) {
emit projectSettingsListModelFound(
emit projectSettingsListModelResult(
true,
uPtrWallpaper->projectSettingsListModel().get(),
uPtrWallpaper->type());
return;
}
}
emit projectSettingsListModelNotFound();
emit projectSettingsListModelResult(false);
}
/*!
@ -249,7 +226,7 @@ void ScreenPlayManager::setWallpaperValue(const int index, const QString& key, c
*/
void ScreenPlayManager::setAllWallpaperValue(const QString& key, const QString& value)
{
for (const shared_ptr<ScreenPlayWallpaper>& uPtrWallpaper : qAsConst(m_screenPlayWallpapers)) {
for (const std::shared_ptr<ScreenPlayWallpaper>& uPtrWallpaper : qAsConst(m_screenPlayWallpapers)) {
m_sdkconnector->setWallpaperValue(uPtrWallpaper->appID(), key, value);
}
}
@ -257,7 +234,7 @@ void ScreenPlayManager::setAllWallpaperValue(const QString& key, const QString&
/*!
\brief Returns \c a ScreenPlayWallpaper if successful, otherwhise \c std::nullopt.
*/
std::optional<shared_ptr<ScreenPlayWallpaper>> ScreenPlayManager::getWallpaperByAppID(const QString& appID)
std::optional<std::shared_ptr<ScreenPlayWallpaper>> ScreenPlayManager::getWallpaperByAppID(const QString& appID)
{
for (auto& wallpaper : m_screenPlayWallpapers) {
if (wallpaper->appID() == appID) {
@ -271,61 +248,53 @@ std::optional<shared_ptr<ScreenPlayWallpaper>> ScreenPlayManager::getWallpaperBy
\brief Saves a given wallpaper \a newProfileObject to a \a profileName. We ignore the profileName argument
because we currently only support one profile. Returns \c true if successfuly saved to profiles.json, otherwise \c false.
*/
bool ScreenPlayManager::saveWallpaperProfile(const QString& profileName, const QJsonObject& newProfileObject)
bool ScreenPlayManager::saveProfiles()
{
// Remove when implementing profiles
Q_UNUSED(profileName)
QString absoluteProfilesFilePath = m_globalVariables->localSettingsPath().toString() + "/profiles.json";
auto configOptional = Util::openJsonFileToObject(absoluteProfilesFilePath);
QJsonArray wallpaper {};
if (!configOptional) {
qWarning() << "Could not load active profiles.";
return false;
}
QJsonObject oldConfig = *configOptional;
QJsonObject oldConfigProfile = oldConfig.value("profiles").toArray().first().toObject();
QJsonArray oldWallpaperArray = oldConfigProfile.value("wallpaper").toArray();
QJsonArray newWallpaperArray;
if (oldWallpaperArray.empty()) {
newWallpaperArray.append(newProfileObject);
} else {
for (QJsonValueRef wallpaper : oldWallpaperArray) {
QJsonObject entry = wallpaper.toObject();
if (entry.value("monitors").toArray() != newProfileObject.value("monitors").toArray()) {
newWallpaperArray.append(entry);
continue;
}
if ((entry.value("absolutePath").toString() == newProfileObject.value("absolutePath").toString())) {
newWallpaperArray.append(newProfileObject);
}
}
for (const auto activeWallpaper : m_screenPlayWallpapers) {
wallpaper.append(activeWallpaper->getActiveSettingsJson());
}
QJsonObject profileDefault;
profileDefault.insert("widgets", oldConfigProfile.value("widgets").toArray());
profileDefault.insert("appdrawer", oldConfigProfile.value("appdrawer").toArray());
profileDefault.insert("wallpaper", newWallpaperArray);
profileDefault.insert("widgets", QJsonArray {});
profileDefault.insert("appdrawer", QJsonArray {});
profileDefault.insert("wallpaper", wallpaper);
profileDefault.insert("name", "default");
QJsonArray profiles;
profiles.append(profileDefault);
QJsonArray activeProfileList;
activeProfileList.append(profileDefault);
QJsonObject newConfig;
newConfig.insert("version", oldConfig.value("version").toString());
newConfig.insert("profiles", profiles);
QJsonObject profile;
profile.insert("version", "1.0.0");
profile.insert("profiles", activeProfileList);
return Util::writeJsonObjectToFile(absoluteProfilesFilePath, newConfig);
return Util::writeJsonObjectToFile({ m_globalVariables->localSettingsPath().toString() + "/profiles.json" }, profile);
}
bool ScreenPlayManager::removeWallpaperByAppID(const QString& appID)
{
for (auto wallpaper : m_screenPlayWallpapers) {
if (wallpaper->appID() == appID) {
qInfo() << "Remove wallpaper " << wallpaper->file() << "at monitor " << wallpaper->screenNumber();
decreaseActiveWallpaperCounter();
m_screenPlayWallpapers.removeOne(wallpaper);
if (activeWallpaperCounter() != m_screenPlayWallpapers.length()) {
qWarning() << "activeWallpaperCounter value: " << activeWallpaperCounter()
<< "does not match m_screenPlayWallpapers length:" << m_screenPlayWallpapers.length();
return false;
}
return true;
}
}
return false;
}
/*!
\brief Loads all wallpaper from profiles.json when the version number matches and starts the available wallpaper
*/
void ScreenPlayManager::loadWallpaperProfiles()
void ScreenPlayManager::loadProfiles()
{
auto configObj = Util::openJsonFileToObject(m_globalVariables->localSettingsPath().toString() + "/profiles.json");
@ -384,12 +353,15 @@ void ScreenPlayManager::loadWallpaperProfiles()
volume = 1.0f;
QString absolutePath = wallpaperObj.value("absolutePath").toString();
QString fillMode = wallpaperObj.value("fillMode").toString();
QString fillModeString = wallpaperObj.value("fillMode").toString();
QString previewImage = wallpaperObj.value("previewImage").toString();
QString file = wallpaperObj.value("file").toString();
QString type = wallpaperObj.value("type").toString();
QString typeString = wallpaperObj.value("type").toString();
createWallpaper(monitors, absolutePath, previewImage, volume, fillMode, type, false);
auto type = QStringToEnum<Enums::WallpaperType>(typeString, Enums::WallpaperType::VideoWallpaper);
auto fillMode = QStringToEnum<Enums::FillMode>(fillModeString, Enums::FillMode::Cover);
createWallpaper(type, fillMode, absolutePath, previewImage, file, monitors, volume, false);
monitors.clear();
}
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>
@ -23,14 +57,6 @@
namespace ScreenPlay {
using std::shared_ptr,
std::unique_ptr,
std::make_shared,
std::make_unique,
std::vector,
std::size_t,
std::remove_if;
class ScreenPlayManager : public QObject {
Q_OBJECT
@ -39,11 +65,11 @@ class ScreenPlayManager : public QObject {
public:
explicit ScreenPlayManager(
const shared_ptr<GlobalVariables>& globalVariables,
const shared_ptr<MonitorListModel>& mlm,
const shared_ptr<SDKConnector>& sdkc,
const shared_ptr<GAnalytics>& telemetry,
const shared_ptr<Settings>& settings,
const std::shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<MonitorListModel>& mlm,
const std::shared_ptr<SDKConnector>& sdkc,
const std::shared_ptr<GAnalytics>& telemetry,
const std::shared_ptr<Settings>& settings,
QObject* parent = nullptr);
int activeWallpaperCounter() const
@ -57,32 +83,35 @@ public:
}
signals:
void projectSettingsListModelFound(ProjectSettingsListModel* li, const QString& type);
void projectSettingsListModelNotFound();
void projectSettingsListModelResult(const bool found, ProjectSettingsListModel* li = nullptr, const ScreenPlay::Enums::WallpaperType type = ScreenPlay::Enums::WallpaperType::VideoWallpaper);
void activeWallpaperCounterChanged(int activeWallpaperCounter);
void activeWidgetsCounterChanged(int activeWidgetsCounter);
public slots:
void createWallpaper(QVector<int> monitorIndex,
// moc needs full enum namespace info see QTBUG-58454
void createWallpaper(
const ScreenPlay::Enums::WallpaperType type,
const ScreenPlay::Enums::FillMode fillMode,
const QString& absoluteStoragePath,
const QString& previewImage,
const QString& file,
QVector<int> monitorIndex,
const float volume,
const QString& fillMode,
const QString& type, const bool saveToProfilesConfigFile = true);
const bool saveToProfilesConfigFile);
void createWidget(
const ScreenPlay::Enums::WidgetType type,
const QUrl& absoluteStoragePath,
const QString& previewImage,
const QString& type);
const QString& previewImage);
void removeAllWallpapers();
void removeAllWidgets();
bool removeWallpaperAt(const int at = 0);
bool removeWallpaperAt(const int index);
void requestProjectSettingsListModelAt(const int index);
void setWallpaperValue(const int index, const QString& key, const QString& value);
void setAllWallpaperValue(const QString& key, const QString& value);
std::optional<shared_ptr<ScreenPlayWallpaper>> getWallpaperByAppID(const QString& appID);
std::optional<std::shared_ptr<ScreenPlayWallpaper>> getWallpaperByAppID(const QString& appID);
void setActiveWallpaperCounter(int activeWallpaperCounter)
{
@ -133,18 +162,19 @@ public slots:
}
private:
void loadWallpaperProfiles();
bool saveWallpaperProfile(const QString& profileName, const QJsonObject& content);
void loadProfiles();
bool saveProfiles();
[[nodiscard]] bool removeWallpaperByAppID(const QString& appID);
private:
const shared_ptr<GlobalVariables>& m_globalVariables;
const shared_ptr<MonitorListModel>& m_monitorListModel;
const shared_ptr<SDKConnector>& m_sdkconnector;
const shared_ptr<GAnalytics>& m_telemetry;
const shared_ptr<Settings>& m_settings;
const std::shared_ptr<GlobalVariables>& m_globalVariables;
const std::shared_ptr<MonitorListModel>& m_monitorListModel;
const std::shared_ptr<SDKConnector>& m_sdkconnector;
const std::shared_ptr<GAnalytics>& m_telemetry;
const std::shared_ptr<Settings>& m_settings;
QVector<shared_ptr<ScreenPlayWallpaper>> m_screenPlayWallpapers;
QVector<shared_ptr<ScreenPlayWidget>> m_screenPlayWidgets;
QVector<std::shared_ptr<ScreenPlayWallpaper>> m_screenPlayWallpapers;
QVector<std::shared_ptr<ScreenPlayWidget>> m_screenPlayWidgets;
int m_activeWallpaperCounter { 0 };
int m_activeWidgetsCounter { 0 };
};

View File

@ -15,23 +15,27 @@ namespace ScreenPlay {
*/
ScreenPlayWallpaper::ScreenPlayWallpaper(
const QVector<int>& screenNumber,
const shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<GlobalVariables>& globalVariables,
const QString& appID,
const QString& absolutePath,
const QString& previewImage,
const QString& file,
const float volume,
const QString& fillMode,
const QString& type,
const Enums::FillMode fillMode,
const Enums::WallpaperType type,
const bool checkWallpaperVisible,
QObject* parent)
: QObject(parent)
, m_projectSettingsListModel { make_shared<ProjectSettingsListModel>(absolutePath + "/project.json") }
, m_projectSettingsListModel { std::make_shared<ProjectSettingsListModel>(absolutePath + "/project.json") }
, m_globalVariables { globalVariables }
, m_screenNumber { screenNumber }
, m_previewImage { QString { absolutePath + "/" + previewImage } }
, m_previewImage { previewImage }
, m_type { type }
, m_fillMode { fillMode }
, m_appID { appID }
, m_absolutePath { absolutePath }
, m_file { file }
{
QObject::connect(&m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &ScreenPlayWallpaper::processExit);
@ -56,8 +60,8 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
m_absolutePath,
QString { "appID=" + m_appID },
QString::number(static_cast<double>(volume)),
fillMode,
type,
QVariant::fromValue(fillMode).toString(),
QVariant::fromValue(type).toString(),
QString::number(checkWallpaperVisible)
};
@ -68,6 +72,25 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
m_process.startDetached();
}
QJsonObject ScreenPlayWallpaper::getActiveSettingsJson()
{
QJsonArray screenNumber;
for (const int i : m_screenNumber) {
screenNumber.append(i);
}
QJsonObject obj;
obj.insert("file", m_file);
obj.insert("absolutePath", m_absolutePath);
obj.insert("fillMode", QVariant::fromValue(m_fillMode).toString());
obj.insert("isLooping", m_isLooping);
obj.insert("monitors", screenNumber);
obj.insert("previewImage", m_previewImage);
obj.insert("type", QVariant::fromValue(m_type).toString());
obj.insert("volume", m_volume);
return obj;
}
/*!
\brief Prints the exit code if != 0.
*/

View File

@ -1,5 +1,40 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QDebug>
#include <QJsonObject>
#include <QObject>
#include <QProcess>
@ -11,45 +46,55 @@
namespace ScreenPlay {
using std::shared_ptr,
std::make_shared;
class ScreenPlayWallpaper : public QObject {
Q_OBJECT
Q_PROPERTY(QVector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged)
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(bool isLooping READ isLooping WRITE setIsLooping NOTIFY isLoopingChanged)
Q_PROPERTY(QString file READ file WRITE setFile NOTIFY fileChanged)
Q_PROPERTY(QString fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
Q_PROPERTY(QString absolutePath READ absolutePath WRITE setAbsolutePath NOTIFY absolutePathChanged)
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)
Q_PROPERTY(QJsonObject profileJsonObject READ profileJsonObject WRITE setProfileJsonObject NOTIFY profileJsonObjectChanged)
Q_PROPERTY(Enums::FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
Q_PROPERTY(Enums::WallpaperType type READ type WRITE setType NOTIFY typeChanged)
public:
explicit ScreenPlayWallpaper(const QVector<int>& screenNumber,
const shared_ptr<GlobalVariables>& globalVariables,
explicit ScreenPlayWallpaper(
const QVector<int>& screenNumber,
const std::shared_ptr<GlobalVariables>& globalVariables,
const QString& appID,
const QString& absolutePath,
const QString& previewImage,
const QString& file,
const float volume,
const QString& fillMode,
const QString& type,
const Enums::FillMode fillMode,
const Enums::WallpaperType type,
const bool checkWallpaperVisible,
QObject* parent = nullptr);
explicit ScreenPlayWallpaper(
const QVector<int>& screenNumber,
const shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<GlobalVariables>& globalVariables,
const QString& appID,
const QString& absolutePath,
const QString& previewImage,
const QString& type,
const Enums::WallpaperType type,
const QJsonObject& profileJsonObject,
QObject* parent = nullptr);
const shared_ptr<ProjectSettingsListModel>& projectSettingsListModel() const
~ScreenPlayWallpaper()
{
qInfo() << "Remove wallpaper" << absolutePath() << " at monitor: " << screenNumber();
}
QJsonObject getActiveSettingsJson();
const std::shared_ptr<ProjectSettingsListModel>& projectSettingsListModel() const
{
return m_projectSettingsListModel;
}
@ -69,7 +114,7 @@ public:
return m_appID;
}
QString type() const
Enums::WallpaperType type() const
{
return m_type;
}
@ -79,7 +124,7 @@ public:
return m_file;
}
QString fillMode() const
Enums::FillMode fillMode() const
{
return m_fillMode;
}
@ -89,20 +134,27 @@ public:
return m_absolutePath;
}
QJsonObject profileJsonObject() const
float volume() const
{
return m_profileJsonObject;
return m_volume;
}
bool isLooping() const
{
return m_isLooping;
}
signals:
void screenNumberChanged(QVector<int> screenNumber);
void previewImageChanged(QString previewImage);
void appIDChanged(QString appID);
void typeChanged(QString type);
void typeChanged(Enums::WallpaperType type);
void fileChanged(QString file);
void fillModeChanged(QString fillMode);
void fillModeChanged(Enums::FillMode fillMode);
void absolutePathChanged(QString absolutePath);
void profileJsonObjectChanged(QJsonObject profileJsonObject);
void volumeChanged(float volume);
void isLoopingChanged(bool isLooping);
public slots:
void processExit(int exitCode, QProcess::ExitStatus exitStatus);
@ -135,7 +187,7 @@ public slots:
emit appIDChanged(m_appID);
}
void setType(QString type)
void setType(Enums::WallpaperType type)
{
if (m_type == type)
return;
@ -153,7 +205,7 @@ public slots:
emit fileChanged(m_file);
}
void setFillMode(QString fillMode)
void setFillMode(Enums::FillMode fillMode)
{
if (m_fillMode == fillMode)
return;
@ -171,29 +223,42 @@ public slots:
emit absolutePathChanged(m_absolutePath);
}
void setProfileJsonObject(QJsonObject profileJsonObject)
void setVolume(float volume)
{
if (m_profileJsonObject == profileJsonObject)
if (volume < 0.0f || volume > 1.0f)
return;
m_profileJsonObject = profileJsonObject;
emit profileJsonObjectChanged(m_profileJsonObject);
if (qFuzzyCompare(m_volume, volume))
return;
m_volume = volume;
emit volumeChanged(m_volume);
}
void setIsLooping(bool isLooping)
{
if (m_isLooping == isLooping)
return;
m_isLooping = isLooping;
emit isLoopingChanged(m_isLooping);
}
private:
QProcess m_process;
shared_ptr<ProjectSettingsListModel> m_projectSettingsListModel;
const shared_ptr<GlobalVariables>& m_globalVariables;
std::shared_ptr<ProjectSettingsListModel> m_projectSettingsListModel;
const std::shared_ptr<GlobalVariables>& m_globalVariables;
QVector<int> m_screenNumber;
QString m_previewImage;
QString m_type;
Enums::WallpaperType m_type;
Enums::FillMode m_fillMode;
QString m_appID;
QString m_file;
QString m_fillMode;
QString m_absolutePath;
QJsonObject m_profileJsonObject;
QString m_file;
float m_volume { 1.0f };
bool m_isLooping { true };
};
}

View File

@ -13,13 +13,12 @@ namespace ScreenPlay {
/*!
\brief Constructor.
*/
ScreenPlayWidget::ScreenPlayWidget(
const QString& appID,
const shared_ptr<GlobalVariables>& globalVariables,
ScreenPlayWidget::ScreenPlayWidget(const QString& appID,
const std::shared_ptr<GlobalVariables>& globalVariables,
const QString& projectPath,
const QString& previewImage,
const QString& fullPath,
const QString& type)
const Enums::WidgetType type)
: QObject { nullptr }
, m_globalVariables { globalVariables }
, m_projectPath { projectPath }
@ -31,7 +30,7 @@ ScreenPlayWidget::ScreenPlayWidget(
const QStringList proArgs {
m_projectPath,
QString { "appID=" + m_appID },
m_type
QVariant::fromValue(m_type).toString()
};
m_process.setArguments(proArgs);

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QCoreApplication>
@ -12,9 +46,6 @@
namespace ScreenPlay {
using std::shared_ptr,
std::make_shared;
class ScreenPlayWidget : public QObject {
Q_OBJECT
@ -22,18 +53,18 @@ class ScreenPlayWidget : public QObject {
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)
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(Enums::WidgetType type READ type WRITE setType NOTIFY typeChanged)
public:
explicit ScreenPlayWidget(
const QString& appID,
const shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<GlobalVariables>& globalVariables,
const QString& projectPath,
const QString& previewImage,
const QString& fullPath,
const QString& type);
const Enums::WidgetType type);
~ScreenPlayWidget() {}
~ScreenPlayWidget() { }
QString projectPath() const
{
@ -55,7 +86,7 @@ public:
return m_appID;
}
QString type() const
Enums::WidgetType type() const
{
return m_type;
}
@ -97,7 +128,7 @@ public slots:
emit appIDChanged(m_appID);
}
void setType(QString type)
void setType(Enums::WidgetType type)
{
if (m_type == type)
return;
@ -111,17 +142,16 @@ signals:
void previewImageChanged(QString previewImage);
void positionChanged(QPoint position);
void appIDChanged(QString appID);
void typeChanged(QString type);
void typeChanged(Enums::WidgetType type);
private:
QProcess m_process;
const shared_ptr<GlobalVariables>& m_globalVariables;
const std::shared_ptr<GlobalVariables>& m_globalVariables;
QString m_projectPath;
QString m_previewImage;
QString m_appID;
QPoint m_position;
QString m_type;
Enums::WidgetType m_type;
};
}

View File

@ -17,7 +17,7 @@ namespace ScreenPlay {
*/
SDKConnector::SDKConnector(QObject* parent)
: QObject(parent)
, m_server { make_unique<QLocalServer>() }
, m_server { std::make_unique<QLocalServer>() }
{
if (isAnotherScreenPlayInstanceRunning()) {
@ -60,7 +60,7 @@ bool SDKConnector::isAnotherScreenPlayInstanceRunning()
*/
void SDKConnector::newConnection()
{
auto connection = make_shared<SDKConnection>(m_server->nextPendingConnection());
auto connection = std::make_shared<SDKConnection>(m_server->nextPendingConnection());
// Because user can close widgets by pressing x the widgets must send us the event
QObject::connect(connection.get(), &SDKConnection::requestDecreaseWidgetCount, this, &SDKConnector::requestDecreaseWidgetCount);
QObject::connect(connection.get(), &SDKConnection::requestRaise, this, &SDKConnector::requestRaise);
@ -76,6 +76,7 @@ void SDKConnector::closeAllConnections()
client->close();
}
m_clients.clear();
m_clients.squeeze();
}
/*!
@ -131,39 +132,19 @@ void SDKConnector::closeConntectionByType(const QStringList& list)
}
}
/*!
\brief Closes a wallpaper at the given \a index. The native monitor index is used here.
On Windows the monitor 0 is the main display.
*/
void SDKConnector::closeWallpapersAt(int at)
{
for (const shared_ptr<SDKConnection>& refSDKConnection : qAsConst(m_clients)) {
refSDKConnection->close();
if (!refSDKConnection->monitor().empty()) {
if (refSDKConnection->monitor().at(0) == at) {
refSDKConnection->close();
qDebug() << "Wall Closed...!";
} else {
qDebug() << "COULD NOT CLOSE!";
}
} else {
qDebug() << "no wp window ";
}
}
}
/*!
\brief Closes a wallpaper by the given \a appID.
*/
void SDKConnector::closeWallpaper(const QString& appID)
bool SDKConnector::closeWallpaper(const QString& appID)
{
for (auto& item : m_clients) {
if (item->appID() == appID) {
item->close();
m_clients.removeOne(item);
return;
for (auto& client : m_clients) {
if (client->appID() == appID) {
client->close();
m_clients.removeOne(client);
return true;
}
}
return false;
}
/*!

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>
@ -21,11 +55,6 @@
namespace ScreenPlay {
class SDKConnection;
using std::make_unique,
std::unique_ptr,
std::shared_ptr,
std::make_shared;
class SDKConnector : public QObject {
Q_OBJECT
@ -44,14 +73,12 @@ public slots:
void closeAllConnections();
void closeAllWallpapers();
void closeAllWidgets();
void closeWallpapersAt(int at);
void closeWallpaper(const QString& appID);
bool closeWallpaper(const QString& appID);
void setWallpaperValue(QString appID, QString key, QString value);
private:
unique_ptr<QLocalServer> m_server;
QVector<shared_ptr<SDKConnection>> m_clients;
std::unique_ptr<QLocalServer> m_server;
QVector<std::shared_ptr<SDKConnection>> m_clients;
bool isAnotherScreenPlayInstanceRunning();
};
@ -142,9 +169,9 @@ public slots:
qInfo() << "###### Wallpaper created:"
<< "\t AppID:" << m_appID << "\t type: " << m_type;
} else if(msg.startsWith("command=")){
} else if (msg.startsWith("command=")) {
msg.remove("command=");
if(msg == "requestRaise") {
if (msg == "requestRaise") {
qInfo() << "Another ScreenPlay instance reuqested this one to raise!";
emit requestRaise();
}

View File

@ -32,12 +32,12 @@ namespace ScreenPlay {
\endlist
More errorchecking is needed here. For example when the proile or settings json cannot to parsed, use the default settings.
*/
Settings::Settings(const shared_ptr<GlobalVariables>& globalVariables,
Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
QObject* parent)
: QObject(parent)
, m_globalVariables { globalVariables }
{
qRegisterMetaType<Settings::FillMode>("Settings::FillMode");
qRegisterMetaType<Settings::Language>("Settings::Language");
qRegisterMetaType<Settings::Theme>("Settings::Theme");
@ -64,9 +64,9 @@ Settings::Settings(const shared_ptr<GlobalVariables>& globalVariables,
setHighPriorityStart(m_qSettings.value("ScreenPlayExecutable", false).toBool());
if (m_qSettings.contains("VideoFillMode")) {
auto value = m_qSettings.value("VideoFillMode").toString();
setVideoFillMode(QStringToEnum<FillMode>(value, FillMode::Cover));
setVideoFillMode(QStringToEnum<Enums::FillMode>(value, Enums::FillMode::Cover));
} else {
setVideoFillMode(FillMode::Cover);
setVideoFillMode(Enums::FillMode::Cover);
}
if (m_qSettings.contains("Theme")) {

View File

@ -1,10 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QFontDatabase>
#include <QApplication>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
@ -39,24 +73,6 @@
namespace ScreenPlay {
class ActiveProfile;
using std::shared_ptr,
std::make_shared;
template <typename T>
T QStringToEnum(const QString& key, const T defaultValue)
{
auto metaEnum = QMetaEnum::fromType<T>();
bool ok = false;
T wantedEnum = static_cast<T>(metaEnum.keyToValue(key.toUtf8(), &ok));
if (ok) {
return wantedEnum;
}
return defaultValue;
}
class Settings : public QObject {
Q_OBJECT
@ -67,7 +83,7 @@ class Settings : public QObject {
Q_PROPERTY(bool checkWallpaperVisible READ checkWallpaperVisible WRITE setCheckWallpaperVisible NOTIFY checkWallpaperVisibleChanged)
Q_PROPERTY(bool offlineMode READ offlineMode WRITE setOfflineMode NOTIFY offlineModeChanged)
Q_PROPERTY(FillMode videoFillMode READ videoFillMode WRITE setVideoFillMode NOTIFY videoFillModeChanged)
Q_PROPERTY(ScreenPlay::Enums::FillMode videoFillMode READ videoFillMode WRITE setVideoFillMode NOTIFY videoFillModeChanged)
Q_PROPERTY(Language language READ language WRITE setLanguage NOTIFY languageChanged)
Q_PROPERTY(Theme theme READ theme WRITE setTheme NOTIFY themeChanged)
@ -77,18 +93,9 @@ class Settings : public QObject {
public:
explicit Settings(
const shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<GlobalVariables>& globalVariables,
QObject* parent = nullptr);
enum class FillMode {
Stretch,
Fill,
Contain,
Cover,
Scale_Down
};
Q_ENUM(FillMode)
enum class Language {
En,
De,
@ -152,7 +159,7 @@ public:
return m_checkWallpaperVisible;
}
FillMode videoFillMode() const
ScreenPlay::Enums::FillMode videoFillMode() const
{
return m_videoFillMode;
}
@ -189,7 +196,7 @@ signals:
void silentStartChanged(bool silentStart);
void anonymousTelemetryChanged(bool anonymousTelemetry);
void checkWallpaperVisibleChanged(bool checkWallpaperVisible);
void videoFillModeChanged(FillMode videoFillMode);
void videoFillModeChanged(ScreenPlay::Enums::FillMode videoFillMode);
void languageChanged(Language language);
void fontChanged(QString font);
@ -218,7 +225,6 @@ public slots:
settings.sync();
} else {
settings.remove("ScreenPlay");
}
#endif
@ -309,7 +315,7 @@ public slots:
emit checkWallpaperVisibleChanged(m_checkWallpaperVisible);
}
void setVideoFillMode(FillMode videoFillMode)
void setVideoFillMode(ScreenPlay::Enums::FillMode videoFillMode)
{
if (m_videoFillMode == videoFillMode)
return;
@ -345,7 +351,7 @@ public slots:
if (m_theme == theme)
return;
setqSetting("Theme", QVariant::fromValue(theme).toString());
setqSetting("Theme", QVariant::fromValue(theme).toString());
m_theme = theme;
emit themeChanged(m_theme);
@ -358,7 +364,7 @@ private:
QSettings m_qSettings;
QTranslator m_translator;
const shared_ptr<GlobalVariables>& m_globalVariables;
const std::shared_ptr<GlobalVariables>& m_globalVariables;
bool m_autostart { true };
bool m_highPriorityStart { true };
@ -369,9 +375,9 @@ private:
QString m_gitBuildHash;
QString m_decoder;
FillMode m_videoFillMode { FillMode::Cover };
ScreenPlay::Enums::FillMode m_videoFillMode { ScreenPlay::Enums::FillMode::Cover };
Language m_language { Language::En };
Theme m_theme { Theme::System };
QString m_font {"Roboto"};
QString m_font { "Roboto" };
};
}

View File

@ -162,6 +162,7 @@ bool Util::writeJsonObjectToFile(const QString& absoluteFilePath, const QJsonObj
}
QTextStream out(&configTmp);
out.setCodec("UTF-8");
out << QJsonDocument(object).toJson();
configTmp.close();

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QClipboard>
@ -28,6 +62,22 @@
namespace ScreenPlay {
template <typename T>
T QStringToEnum(const QString& key, const T defaultValue)
{
auto metaEnum = QMetaEnum::fromType<T>();
bool ok = false;
T wantedEnum = static_cast<T>(metaEnum.keyToValue(key.toUtf8(), &ok));
if (ok) {
return wantedEnum;
}
return defaultValue;
}
class Util : public QObject {
Q_OBJECT

View File

@ -3,22 +3,24 @@ project(ScreenPlaySDK)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
QML
Widgets
Gui
Network
Core
REQUIRED)
set(src screenplay-sdk_plugin.cpp
screenplaysdk.cpp)
set(headers screenplay-sdk_plugin.h
screenplaysdk.h)
add_library(${PROJECT_NAME} ${src} ${headers})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Gui Qt5::Qml Qt5::Network)
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Core
Qt5::Quick
Qt5::Gui
Qt5::Network)

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QQmlExtensionPlugin>

View File

@ -29,10 +29,20 @@ void ScreenPlaySDK::init()
m_socket.setServerName("ScreenPlay");
connect(&m_socket, &QLocalSocket::connected, this, &ScreenPlaySDK::connected);
connect(&m_socket, &QLocalSocket::disconnected, this, &ScreenPlaySDK::disconnected);
connect(&m_socket, &QLocalSocket::bytesWritten, this, &ScreenPlaySDK::bytesWritten);
connect(&m_socket, &QLocalSocket::readyRead, this, &ScreenPlaySDK::readyRead);
connect(&m_socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error), this, &ScreenPlaySDK::error);
m_socket.connectToServer();
// If the wallpaper never connects it will never get the
// disconnect event. We can savely assume no connection will
// be made after 1 second timeout.
QTimer::singleShot(1000,[this](){
if(m_socket.state() != QLocalSocket::ConnectedState){
m_socket.disconnectFromServer();
emit sdkDisconnected();
}
});
}
ScreenPlaySDK::~ScreenPlaySDK()
@ -56,14 +66,9 @@ void ScreenPlaySDK::disconnected()
emit sdkDisconnected();
}
void ScreenPlaySDK::bytesWritten(qint64 bytes)
{
}
void ScreenPlaySDK::readyRead()
{
QString tmp = m_socket.readAll();
//qDebug() << "SDK MESSAGE RECEIVED: " << tmp;
QJsonParseError err;
auto doc = QJsonDocument::fromJson(QByteArray::fromStdString(tmp.toStdString()), &err);
@ -95,32 +100,14 @@ void ScreenPlaySDK::redirectMessage(QByteArray& msg)
void ScreenPlaySDK::ScreenPlaySDK::redirectMessageOutputToMainWindow(QtMsgType type, const QMessageLogContext& context, const QString& msg)
{
Q_UNUSED(type)
if (global_sdkPtr == nullptr)
return;
QByteArray localMsg = msg.toLocal8Bit();
QByteArray file = "File: " + QByteArray(context.file) + ", ";
QByteArray line = "in line " + QByteArray::number(context.line) + ", ";
//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;
break;
case QtInfoMsg:
//fprintf(stderr, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtWarningMsg:
//fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtCriticalMsg:
//fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
case QtFatalMsg:
//(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
break;
}
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QByteArray>
@ -45,7 +79,6 @@ public:
public slots:
void connected();
void disconnected();
void bytesWritten(qint64 bytes);
void readyRead();
void error(QLocalSocket::LocalSocketError socketError);
void redirectMessage(QByteArray& msg);

View File

@ -6,7 +6,6 @@ set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
QML
Core
REQUIRED)
@ -24,8 +23,11 @@ set(headers screenplaysysinfo_plugin.h
storage.h)
add_library(${PROJECT_NAME} ${src} ${headers})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::Qml)
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Core
Qt5::Quick)
# QML module deployment

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QObject>

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#ifdef Q_OS_WIN
#include <qt_windows.h>

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QObject>

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QQmlExtensionPlugin>

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QAbstractListModel>

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QQuickItem>

View File

@ -7,7 +7,6 @@ set(CMAKE_AUTOMOC ON)
find_package(
Qt5
COMPONENTS Quick
QML
Widgets
Gui
WebEngine
@ -48,7 +47,6 @@ add_executable(${PROJECT_NAME} ${src} ${headers} ${src_plattform} ${headers_pla
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Qml
Qt5::Quick
Qt5::Gui
Qt5::Widgets

View File

@ -1,30 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#include "macbridge.h"
#import <Cocoa/Cocoa.h>
#import <objc/runtime.h>
#include <QApplication>
#include <QWindow>
#import <objc/runtime.h>
MacBridge * MacBridge::bridge = NULL;
MacBridge* MacBridge::bridge = NULL;
MacBridge::MacBridge()
{
}
MacBridge * MacBridge::instance()
MacBridge* MacBridge::instance()
{
if(!bridge)
if (!bridge)
bridge = new MacBridge;
return bridge;
}
void MacBridge::SetBackgroundLevel(QWindow* window)
{
NSView* view = (NSView *) window->winId();
NSView* view = (NSView*)window->winId();
NSWindow* nsWindow = (NSWindow*)[view window];
[nsWindow setLevel:CGWindowLevelForKey(kCGDesktopWindowLevelKey) + 1];
[nsWindow setBackgroundColor: [NSColor blackColor]];
[nsWindow setAcceptsMouseMovedEvents: false];
[nsWindow setMovableByWindowBackground: false];
[nsWindow setBackgroundColor:[NSColor blackColor]];
[nsWindow setAcceptsMouseMovedEvents:false];
[nsWindow setMovableByWindowBackground:false];
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>

View File

@ -129,7 +129,12 @@ void BaseWindow::messageReceived(QString key, QString value)
}
if (key == "fillmode") {
setFillMode(QVariant(value).toString());
// HTML5 Video uses - that c++ enums cannot
if(QVariant(value).toString() == "Scale_Down"){
setFillMode("Scale-Down");
} else {
setFillMode(QVariant(value).toString());
}
return;
}

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>
@ -166,7 +200,6 @@ signals:
void activeScreensListChanged(QVector<int> activeScreensList);
void checkWallpaperVisibleChanged(bool checkWallpaperVisible);
void visualsPausedChanged(bool visualsPaused);
void basePathChanged(QString basePath);
public slots:

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>
@ -13,21 +47,20 @@
#include "basewindow.h"
class LinuxWindow : public BaseWindow
{
class LinuxWindow : public BaseWindow {
Q_OBJECT
public:
explicit LinuxWindow(QVector<int> activeScreensList, QString projectPath, QString id, QString volume, const QString fillmode,const bool checkWallpaperVisible, QObject *parent = nullptr);
explicit LinuxWindow(QVector<int> activeScreensList, QString projectPath, QString id, QString volume, const QString fillmode, const bool checkWallpaperVisible, QObject* parent = nullptr);
signals:
public slots:
void setVisible(bool show) override;
void destroyThis() override;
private:
QQuickView m_window;
void setupWallpaperForOneScreen(int activeScreen);
void setupWallpaperForAllScreens();
void setupWallpaperForMultipleScreens(const QVector<int>& activeScreensList);
};

View File

@ -1,14 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>
class MacBridge : public QObject
{
class MacBridge : public QObject {
Q_OBJECT
private:
static MacBridge* bridge;
MacBridge();
public:
static MacBridge* instance();
static void SetBackgroundLevel(QWindow* window);

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>
@ -14,23 +48,22 @@
#include "basewindow.h"
#include "macintegration.h"
class MacWindow : public BaseWindow
{
class MacWindow : public BaseWindow {
Q_OBJECT
public:
explicit MacWindow(
const QVector<int>& activeScreensList,
const QString& projectPath,
const QString& id,
const QString& volume,
const QString& fillmode);
const QVector<int>& activeScreensList,
const QString& projectPath,
const QString& id,
const QString& volume,
const QString& fillmode);
signals:
public slots:
void setVisible(bool show) override;
void destroyThis() override;
private:
QQuickView m_window;
};

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QColor>

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QApplication>

View File

@ -1,22 +1,29 @@
cmake_minimum_required(VERSION 3.16.0)
project(ScreenPlayWidget)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Qml)
find_package(Qt5Quick)
find_package(Qt5Gui)
find_package(Qt5Widgets)
find_package(Qt5Core)
find_package(
Qt5
COMPONENTS Quick
Widgets
Gui
WebEngine
REQUIRED)
set(src main.cpp
src/widgetwindow.cpp)
set(headers src/widgetwindow.h)
set(resources SPWidgetResources.qrc)
add_executable(ScreenPlayWidget ${src} ${headers} ${resources})
target_link_libraries( ScreenPlayWidget
set(headers
src/widgetwindow.h)
set(resources
SPWidgetResources.qrc)
add_executable(${PROJECT_NAME} ${src} ${headers} ${resources})
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Qml
Qt5::Quick
Qt5::Gui
Qt5::Widgets

View File

@ -1,3 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2020 Elias Steurer (Kelteseth)
** Contact: https://screen-play.app
**
** This file is part of ScreenPlay. ScreenPlay is licensed under a dual license in
** order to ensure its sustainability. When you contribute to ScreenPlay
** you accept that your work will be available under the two following licenses:
**
** $SCREENPLAY_BEGIN_LICENSE$
**
** #### Affero General Public License Usage (AGPLv3)
** Alternatively, this file may be used under the terms of the GNU Affero
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file "ScreenPlay License.md" included in the
** packaging of this App. Please review the following information to
** ensure the GNU Affero Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/agpl-3.0.en.html.
**
** #### Commercial License
** This code is owned by Elias Steurer. By changing/adding to the code you agree to the
** terms written in:
** * Legal/corporate_contributor_license_agreement.md - For corporate contributors
** * Legal/individual_contributor_license_agreement.md - For individual contributors
**
** #### Additional Limitations to the AGPLv3 and Commercial Lincese
** This License does not grant any rights in the trademarks,
** service marks, or logos.
**
**
** $SCREENPLAY_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QDebug>