1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Remove contextProperties

This commit is contained in:
Elias Steurer 2019-09-19 16:16:35 +02:00
parent 90a4dfcbff
commit ef623a8b0b
23 changed files with 362 additions and 166 deletions

View File

@ -1,9 +1,7 @@
#include "app.h"
App::App(int& argc, char** argv)
App::App()
: QObject(nullptr)
, app { std::make_unique<QGuiApplication>(argc, argv) }
, mainWindowEngine{std::make_unique<QQmlApplicationEngine>()}
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setOrganizationName("ScreenPlay");
@ -11,40 +9,42 @@ App::App(int& argc, char** argv)
QGuiApplication::setApplicationName("ScreenPlay");
QGuiApplication::setApplicationVersion("0.3.0");
QGuiApplication::setQuitOnLastWindowClosed(false);
QGuiApplication::setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
qRegisterMetaType<GlobalVariables*>();
qRegisterMetaType<ScreenPlayManager*>();
qRegisterMetaType<Create*>();
qRegisterMetaType<Util*>();
qRegisterMetaType<SDKConnector*>();
qRegisterMetaType<Settings*>();
qRegisterMetaType<InstalledListModel*>();
qRegisterMetaType<InstalledListFilter*>();
qRegisterMetaType<MonitorListModel*>();
qRegisterMetaType<ProfileListModel*>();
}
void App::init()
{
QGuiApplication::setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
// Qt < 6.0 needs this init QtWebEngine
QtWebEngine::initialize();
auto globalVariables = make_shared<GlobalVariables>();
auto installedListModel = make_shared<InstalledListModel>(globalVariables);
auto installedListFilter = make_shared<InstalledListFilter>(installedListModel);
auto monitorListModel = make_shared<MonitorListModel>();
auto profileListModel = make_shared<ProfileListModel>(globalVariables);
auto sdkConnector = make_shared<SDKConnector>();
auto settings = make_shared<Settings>(globalVariables);
QObject::connect(settings.get(), &Settings::resetInstalledListmodel, installedListModel.get(), &InstalledListModel::reset);
m_globalVariables = make_shared<GlobalVariables>();
m_installedListModel = make_shared<InstalledListModel>(m_globalVariables);
m_installedListFilter = make_shared<InstalledListFilter>(m_installedListModel);
m_monitorListModel = make_shared<MonitorListModel>();
m_profileListModel = make_shared<ProfileListModel>(m_globalVariables);
m_sdkConnector = make_shared<SDKConnector>();
m_settings = make_shared<Settings>(m_globalVariables);
QObject::connect(m_settings.get(), &Settings::resetInstalledListmodel, m_installedListModel.get(), &InstalledListModel::reset);
Create create(globalVariables);
Util util {
mainWindowEngine->networkAccessManager()
};
ScreenPlayManager screenPlay {
globalVariables,
monitorListModel,
sdkConnector
};
m_create = std::make_shared<Create>(m_globalVariables);
mainWindowEngine = std::make_unique<QQmlApplicationEngine>();
m_util = std::make_shared<Util>(mainWindowEngine->networkAccessManager());
m_screenPlayManager = std::make_shared<ScreenPlayManager>(m_globalVariables, m_monitorListModel, m_sdkConnector);
// This needs to change in the future because setContextProperty gets depricated in Qt 6
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("globalVariables"), globalVariables.get());
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("screenPlay"), &screenPlay);
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("screenPlayCreate"), &create);
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("utility"), &util);
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("installedListFilter"), installedListFilter.get());
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("monitorListModel"), monitorListModel.get());
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("installedListModel"), installedListModel.get());
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("profileListModel"), profileListModel.get());
mainWindowEngine->rootContext()->setContextProperty(QStringLiteral("screenPlaySettings"), settings.get());
mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
// Instead of setting "renderType: Text.NativeRendering" every time
@ -52,14 +52,8 @@ App::App(int& argc, char** argv)
QQuickWindow::setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
// Set visible if the -silent parameter was not set
QStringList argumentList = app->arguments();
if (!argumentList.contains("-silent")) {
settings->setMainWindowVisible(true);
if (!QGuiApplication::instance()->arguments().contains("-silent")) {
m_settings->setMainWindowVisible(true);
}
installedListModel->init();
}
int App::run()
{
return app->exec();
m_installedListModel->init();
}

View File

@ -39,32 +39,192 @@ using std::make_shared,
class App : public QObject {
Q_OBJECT
Q_PROPERTY(shared_ptr<GlobalVariables> globalVariables READ globalVariables WRITE setGlobalVariables NOTIFY globalVariablesChanged)
public:
explicit App(int &argc, char **argv);
Q_PROPERTY(GlobalVariables* globalVariables READ globalVariables WRITE setGlobalVariables NOTIFY globalVariablesChanged)
Q_PROPERTY(ScreenPlayManager* screenPlayManager READ screenPlayManager WRITE setScreenPlayManager NOTIFY screenPlayManagerChanged)
Q_PROPERTY(Create* create READ create WRITE setCreate NOTIFY createChanged)
Q_PROPERTY(Util* util READ util WRITE setUtil NOTIFY utilChanged)
Q_PROPERTY(Settings* settings READ settings WRITE setSettings NOTIFY settingsChanged)
Q_PROPERTY(SDKConnector* sdkConnector READ sdkConnector WRITE setSdkConnector NOTIFY sdkConnectorChanged)
shared_ptr<GlobalVariables> globalVariables() const
Q_PROPERTY(InstalledListModel* installedListModel READ installedListModel WRITE setInstalledListModel NOTIFY installedListModelChanged)
Q_PROPERTY(InstalledListFilter* installedListFilter READ installedListFilter WRITE setInstalledListFilter NOTIFY installedListFilterChanged)
Q_PROPERTY(MonitorListModel* monitorListModel READ monitorListModel WRITE setMonitorListModel NOTIFY monitorListModelChanged)
Q_PROPERTY(ProfileListModel* profileListModel READ profileListModel WRITE setProfileListModel NOTIFY profileListModelChanged)
public:
explicit App();
void init();
static App* instance()
{
return m_globalVariables;
static App app;
return &app;
}
GlobalVariables* globalVariables() const
{
return m_globalVariables.get();
}
ScreenPlayManager* screenPlayManager() const
{
return m_screenPlayManager.get();
}
Create* create() const
{
return m_create.get();
}
Util* util() const
{
return m_util.get();
}
Settings* settings() const
{
return m_settings.get();
}
InstalledListModel* installedListModel() const
{
return m_installedListModel.get();
}
MonitorListModel* monitorListModel() const
{
return m_monitorListModel.get();
}
ProfileListModel* profileListModel() const
{
return m_profileListModel.get();
}
InstalledListFilter* installedListFilter() const
{
return m_installedListFilter.get();
}
SDKConnector* sdkConnector() const
{
return m_sdkConnector.get();
}
signals:
void globalVariablesChanged(shared_ptr<GlobalVariables> globalVariables);
void globalVariablesChanged(GlobalVariables* globalVariables);
void screenPlayManagerChanged(ScreenPlayManager* screenPlayManager);
void createChanged(Create* create);
void utilChanged(Util* util);
void settingsChanged(Settings* settings);
void installedListModelChanged(InstalledListModel* installedListModel);
void monitorListModelChanged(MonitorListModel* monitorListModel);
void profileListModelChanged(ProfileListModel* profileListModel);
void installedListFilterChanged(InstalledListFilter* installedListFilter);
void sdkConnectorChanged(SDKConnector* sdkConnector);
public slots:
int run();
void setGlobalVariables(shared_ptr<GlobalVariables> globalVariables)
{
if (m_globalVariables == globalVariables)
return;
void setGlobalVariables(GlobalVariables* globalVariables)
{
if (m_globalVariables.get() == globalVariables)
return;
m_globalVariables.reset(globalVariables);
emit globalVariablesChanged(m_globalVariables.get());
}
void setScreenPlayManager(ScreenPlayManager* screenPlayManager)
{
if (m_screenPlayManager.get() == screenPlayManager)
return;
m_screenPlayManager.reset(screenPlayManager);
emit screenPlayManagerChanged(m_screenPlayManager.get());
}
void setCreate(Create* create)
{
if (m_create.get() == create)
return;
m_create.reset(create);
emit createChanged(m_create.get());
}
void setUtil(Util* util)
{
if (m_util.get() == util)
return;
m_util.reset(util);
emit utilChanged(m_util.get());
}
void setSettings(Settings* settings)
{
if (m_settings.get() == settings)
return;
m_settings.reset(settings);
emit settingsChanged(m_settings.get());
}
void setInstalledListModel(InstalledListModel* installedListModel)
{
if (m_installedListModel.get() == installedListModel)
return;
m_installedListModel.reset(installedListModel);
emit installedListModelChanged(m_installedListModel.get());
}
void setMonitorListModel(MonitorListModel* monitorListModel)
{
if (m_monitorListModel.get() == monitorListModel)
return;
m_monitorListModel.reset(monitorListModel);
emit monitorListModelChanged(m_monitorListModel.get());
}
void setProfileListModel(ProfileListModel* profileListModel)
{
if (m_profileListModel.get() == profileListModel)
return;
m_profileListModel.reset(profileListModel);
emit profileListModelChanged(m_profileListModel.get());
}
void setInstalledListFilter(InstalledListFilter* installedListFilter)
{
if (m_installedListFilter.get() == installedListFilter)
return;
m_installedListFilter.reset(installedListFilter);
emit installedListFilterChanged(m_installedListFilter.get());
}
void setSdkConnector(SDKConnector* sdkConnector)
{
if (m_sdkConnector.get() == sdkConnector)
return;
m_sdkConnector.reset(sdkConnector);
emit sdkConnectorChanged(m_sdkConnector.get());
}
m_globalVariables = globalVariables;
emit globalVariablesChanged(m_globalVariables);
}
private:
std::unique_ptr<QGuiApplication> app;
std::unique_ptr<QQmlApplicationEngine> mainWindowEngine;
shared_ptr<GlobalVariables> m_globalVariables;
shared_ptr<ScreenPlayManager> m_screenPlayManager;
shared_ptr<Create> m_create;
shared_ptr<Util> m_util;
shared_ptr<Settings> m_settings;
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;
};

View File

@ -1,7 +1,20 @@
#include "app.h"
#include "app.h"
#include <QGuiApplication>
#include <qqml.h>
int main(int argc, char* argv[])
{
App app(argc,argv);
return app.run();
// Needs to be created before
App* app = App::instance();
QGuiApplication qtGuiApp(argc, argv);
qmlRegisterSingletonType<App>("ScreenPlay", 1, 0, "ScreenPlay", [](QQmlEngine* engine, QJSEngine*) -> QObject* {
engine->setObjectOwnership(App::instance(), QQmlEngine::ObjectOwnership::CppOwnership);
return App::instance();
});
app->init();
return qtGuiApp.exec();
}

View File

@ -5,6 +5,8 @@ import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0
import ScreenPlay 1.0
import "qml/"
import "qml/Monitors"
import "qml/Common"
@ -23,7 +25,7 @@ ApplicationWindow {
minimumWidth: 1050
Component.onCompleted: {
if (!screenPlaySettings.autostart) {
if (! ScreenPlay.settings.autostart) {
show()
}
}
@ -67,7 +69,7 @@ ApplicationWindow {
}
Connections {
target: screenPlaySettings
target: ScreenPlay.settings
onSetMainWindowVisible: {
window.visible = visible
setX(Screen.width / 2 - width / 2)
@ -76,13 +78,13 @@ ApplicationWindow {
}
Connections {
target: utility
target: ScreenPlay.util
onRequestNavigation: {
switchPage(nav)
}
onRequestToggleWallpaperConfiguration: {
monitors.state = monitors.state == "active" ? "inactive" : "active"
screenPlay.requestProjectSettingsListModelAt(0)
ScreenPlay.screenPlayManager.requestProjectSettingsListModelAt(0)
}
}
@ -148,11 +150,11 @@ ApplicationWindow {
if (miMuteAll.isMuted) {
isMuted = false
miMuteAll.text = qsTr("Mute all")
screenPlay.setAllWallpaperValue("muted", "true")
ScreenPlay.screenPlayManager.setAllWallpaperValue("muted", "true")
} else {
isMuted = true
miMuteAll.text = qsTr("Unmute all")
screenPlay.setAllWallpaperValue("muted", "false")
ScreenPlay.screenPlayManager.setAllWallpaperValue("muted", "false")
}
}
}
@ -164,11 +166,11 @@ ApplicationWindow {
if (miStopAll.isPlaying) {
isPlaying = false
miStopAll.text = qsTr("Pause all")
screenPlay.setAllWallpaperValue("isPlaying", "true")
ScreenPlay.screenPlayManager.setAllWallpaperValue("isPlaying", "true")
} else {
isPlaying = true
miStopAll.text = qsTr("Play all")
screenPlay.setAllWallpaperValue("isPlaying", "false")
ScreenPlay.screenPlayManager.setAllWallpaperValue("isPlaying", "false")
}
}
}

View File

@ -4,6 +4,7 @@ import QtQuick.Controls.Material 2.12
import QtQuick.Particles 2.0
import QtGraphicalEffects 1.0
import ScreenPlay 1.0
import ScreenPlay.Create 1.0
import ScreenPlay.QMLUtilities 1.0
@ -22,7 +23,7 @@ Item {
}
function checkFFMPEG(){
if(!utility.ffmpegAvailable){
if(!ScreenPlay.util.ffmpegAvailable){
ffmpegPopup.open()
}
}

View File

@ -73,7 +73,7 @@ Item {
Timer {
id: timerBack
interval: 800
onTriggered: utility.setNavigation("Create")
onTriggered: ScreenPlay.util.setNavigation("Create")
}
}
}

View File

@ -5,7 +5,9 @@ import Qt.labs.platform 1.0
import QtQuick.Controls.Material 2.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
//import RemoteWorkshopCreationStatus 1.0
import ScreenPlay 1.0
Item {
@ -24,7 +26,7 @@ Item {
// First we parse the content of the project file
// TODO: Implement parse error
onProjectFileChanged: {
jsonProjectFile = JSON.parse(screenPlaySettings.loadProject(
jsonProjectFile = JSON.parse(ScreenPlay.settings.loadProject(
projectFile))
}

View File

@ -4,6 +4,8 @@ import QtQuick.Controls 2.3
import Qt.labs.platform 1.0
import QtQuick.Controls.Material 2.2
import ScreenPlay 1.0
import "../Workshop"
Item {
@ -72,7 +74,7 @@ Item {
}
Button {
text: utility.ffmpegAvailable ? qsTr("Import video") : qsTr("FFMPEG Needed for import")
text: ScreenPlay.util.ffmpegAvailable ? qsTr("Import video") : qsTr("FFMPEG Needed for import")
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
@ -83,7 +85,7 @@ Item {
icon.source: "qrc:/assets/icons/icon_upload.svg"
icon.color: "white"
icon.width: 16
enabled: utility.ffmpegAvailable
enabled: ScreenPlay.util.ffmpegAvailable
icon.height: 16
onClicked: fileDialogImportVideo.open()
}
@ -245,7 +247,7 @@ Item {
icon.width: 16
icon.height: 16
onClicked: {
utility.requestNavigation("Workshop")
ScreenPlay.util.requestNavigation("Workshop")
}
}
}

View File

@ -1,6 +1,7 @@
import QtQuick 2.12
import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0
import ScreenPlay 1.0
Item {
id: createWidget
@ -41,7 +42,7 @@ Item {
FolderDialog {
id: folderDialog
onAccepted: {
screenPlayCreate.copyProject("/examples/scenes/empty",
ScreenPlay.create.copyProject("/examples/scenes/empty",
folderDialog.currentFolder)
}
}

View File

@ -5,6 +5,7 @@ import QtQuick.Controls.Material 2.12
import QtQuick.Particles 2.0
import QtGraphicalEffects 1.0
import ScreenPlay 1.0
import ScreenPlay.Create 1.0
import ScreenPlay.QMLUtilities 1.0
@ -17,7 +18,7 @@ Popup {
width: 900
Connections {
target: utility
target: ScreenPlay.util
onAquireFFMPEGStatusChanged: {
switch (aquireFFMPEGStatus) {
@ -72,7 +73,7 @@ Popup {
txtStatus.text = qsTr("All done and ready to go!")
busyIndicator.running = false
column.state = "finishedSuccessful"
utility.setFfmpegAvailable(true)
ScreenPlay.util.setFfmpegAvailable(true)
break
}
}
@ -244,7 +245,7 @@ if you installed ScreenPlay via Steam!
Button {
id:btnDownload
text: qsTr("Download FFMPEG")
onClicked: utility.downloadFFMPEG()
onClicked: ScreenPlay.util.downloadFFMPEG()
highlighted: true
Layout.fillWidth: true
}

View File

@ -4,6 +4,8 @@ import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.3
import Qt.labs.platform 1.0
import QtQuick.Layouts 1.3
import ScreenPlay 1.0
import ScreenPlay.Create 1.0
Item {
@ -61,7 +63,7 @@ Item {
height: txtFFMPEGDebug.paintedHeight
}
Connections {
target: screenPlayCreate
target: ScreenPlay.create
onProcessOutput: {
txtFFMPEGDebug.text = text
}
@ -80,8 +82,8 @@ Item {
margins: 10
}
onClicked: {
utility.setNavigationActive(true)
utility.setNavigation("Create")
ScreenPlay.util.setNavigationActive(true)
ScreenPlay.util.setNavigation("Create")
}
}
states: [

View File

@ -5,6 +5,7 @@ import QtQuick.Controls.Material 2.3
import Qt.labs.platform 1.0
import QtQuick.Layouts 1.12
import ScreenPlay 1.0
import ScreenPlay.Create 1.0
import "../../../Common"
@ -27,7 +28,7 @@ Item {
}
Connections {
target: screenPlayCreate
target: ScreenPlay.create
onCreateWallpaperStateChanged: {
@ -36,7 +37,7 @@ Item {
txtConvert.text = qsTr("Generating preview image...")
break
case CreateImportVideo.ConvertingPreviewImageFinished:
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.jpg"
imgPreview.source = "file:///" + ScreenPlay.create.workingDir + "/preview.jpg"
imgPreview.visible = true
break
case CreateImportVideo.ConvertingPreviewVideo:
@ -46,7 +47,7 @@ Item {
txtConvert.text = qsTr("Generating preview gif...")
break
case CreateImportVideo.ConvertingPreviewGifFinished:
gifPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.gif"
gifPreview.source = "file:///" + ScreenPlay.create.workingDir + "/preview.gif"
imgPreview.visible = false
gifPreview.visible = true
gifPreview.playing = true
@ -55,7 +56,8 @@ Item {
txtConvert.text = qsTr("Converting Audio...")
break
case CreateImportVideo.ConvertingVideo:
txtConvert.text = qsTr("Converting Video... This can take some time!")
txtConvert.text = qsTr(
"Converting Video... This can take some time!")
break
case CreateImportVideo.ConvertingVideoError:
txtConvert.text = qsTr("Converting Video ERROR!")
@ -267,9 +269,9 @@ Item {
Material.background: Material.Red
Material.foreground: "white"
onClicked: {
screenPlayCreate.abortAndCleanup()
utility.setNavigationActive(true)
utility.setNavigation("Create")
ScreenPlay.create.abortAndCleanup()
ScreenPlay.util.setNavigationActive(true)
ScreenPlay.util.setNavigation("Create")
}
}
@ -282,7 +284,7 @@ Item {
onClicked: {
if (conversionFinishedSuccessful) {
screenPlayCreate.saveWallpaper(
ScreenPlay.create.saveWallpaper(
textFieldName.text,
textFieldDescription.text,
wrapperContent.filePath,
@ -290,8 +292,8 @@ Item {
textFieldYoutubeURL.text,
textFieldTags.getTags())
savePopup.open()
installedListModel.reset()
installedListModel.loadInstalledContent()
ScreenPlay.installedListModel.reset()
ScreenPlay.installedListModel.loadInstalledContent()
}
}
}
@ -321,8 +323,8 @@ Item {
id: timerSave
interval: 3000 - Math.random() * 1000
onTriggered: {
utility.setNavigationActive(true)
utility.setNavigation("Create")
ScreenPlay.util.setNavigationActive(true)
ScreenPlay.util.setNavigation("Create")
}
}
}

View File

@ -5,6 +5,7 @@ import QtQuick.Controls.Material 2.3
import Qt.labs.platform 1.0
import QtQuick.Layouts 1.3
import ScreenPlay 1.0
import ScreenPlay.Create 1.0
Item {
@ -17,7 +18,7 @@ Item {
Component.onCompleted: {
state = "in"
utility.setNavigationActive(false)
ScreenPlay.util.setNavigationActive(false)
loader_wrapperContent.setSource(
"qrc:/qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml",
@ -32,7 +33,7 @@ Item {
}
Connections {
target: screenPlayCreate
target: ScreenPlay.create
onCreateWallpaperStateChanged: {
if (state === CreateImportVideo.AnalyseVideoError || state
=== CreateImportVideo.ConvertingVideoError || state
@ -55,7 +56,7 @@ Item {
running: true
repeat: false
onTriggered: {
screenPlayCreate.createWallpaperStart(filePath)
ScreenPlay.create.createWallpaperStart(filePath)
}
}
@ -127,9 +128,9 @@ Item {
id: timerBack
interval: 800
onTriggered: {
screenPlayCreate.abortAndCleanup()
utility.setNavigationActive(true)
utility.setNavigation("Create")
ScreenPlay.create.abortAndCleanup()
ScreenPlay.util.setNavigationActive(true)
ScreenPlay.util.setNavigation("Create")
}
}
}

View File

@ -3,6 +3,8 @@ import QtQuick.Controls 2.5
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
import ScreenPlay 1.0
Item {
id: pageInstalled
state: "out"
@ -15,13 +17,13 @@ Item {
Component.onCompleted: {
pageInstalled.state = "in"
installedListFilter.sortByRoleType("All")
ScreenPlay.installedListFilter.sortByRoleType("All")
checkIsContentInstalled()
}
Action {
shortcut: "F5"
onTriggered: installedListModel.reset()
onTriggered: ScreenPlay.installedListModel.reset()
}
Connections {
@ -31,7 +33,7 @@ Item {
}
}
Connections {
target: installedListModel
target: ScreenPlay.installedListModel
onInstalledLoadingFinished: {
checkIsContentInstalled()
}
@ -43,7 +45,7 @@ Item {
}
function checkIsContentInstalled() {
if (installedListModel.count === 0) {
if (ScreenPlay.installedListModel.count === 0) {
loaderHelp.active = true
gridView.footerItem.isVisible = true
gridView.visible = false
@ -161,11 +163,11 @@ Item {
//Pull to refresh
if (contentY <= -180 && !refresh && !isDragging) {
installedListModel.reset()
ScreenPlay.installedListModel.reset()
}
}
model: installedListFilter
model: ScreenPlay.installedListFilter
delegate: ScreenPlayItem {
id: delegate
@ -187,25 +189,25 @@ Item {
function onPageChanged(name) {
setSidebarActive(false)
if (name === "All") {
installedListFilter.sortByRoleType("All")
ScreenPlay.installedListFilter.sortByRoleType("All")
navAll.state = "active"
navWallpaper.state = "inactive"
navWidgets.state = "inactive"
navScenes.state = "inactive"
} else if (name === "Videos") {
installedListFilter.sortByRoleType("Videos")
ScreenPlay.installedListFilter.sortByRoleType("Videos")
navAll.state = "inactive"
navWallpaper.state = "active"
navWidgets.state = "inactive"
navScenes.state = "inactive"
} else if (name === "Widgets") {
installedListFilter.sortByRoleType("Widgets")
ScreenPlay.installedListFilter.sortByRoleType("Widgets")
navAll.state = "inactive"
navWallpaper.state = "inactive"
navWidgets.state = "active"
navScenes.state = "inactive"
} else if (name === "Scenes") {
installedListFilter.sortByRoleType("Scenes")
ScreenPlay.installedListFilter.sortByRoleType("Scenes")
navAll.state = "inactive"
navWallpaper.state = "inactive"
navWidgets.state = "inactive"
@ -320,9 +322,9 @@ Item {
}
onTextChanged: {
if (txtSearch.text.length === 0) {
installedListFilter.resetFilter()
ScreenPlay.installedListFilter.resetFilter()
} else {
installedListFilter.sortByName(txtSearch.text)
ScreenPlay.installedListFilter.sortByName(txtSearch.text)
}
}

View File

@ -2,7 +2,7 @@ import QtQuick 2.12
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.3
import QtQuick.Controls.Styles 1.4
import ScreenPlay 1.0
Item {
id: screenPlayItem
width: 320
@ -203,7 +203,7 @@ Item {
onClicked: {
if (mouse.button === Qt.LeftButton) {
utility.setSidebarItem(screenPlayItem.screenId, screenPlayItem.type.toString())
ScreenPlay.util.setSidebarItem(screenPlayItem.screenId, screenPlayItem.type.toString())
} else if (mouse.button === Qt.RightButton) {
if (workshopID != 0) {
@ -222,7 +222,7 @@ Item {
MenuItem {
text: qsTr("Open containing folder")
onClicked: {
utility.openFolderInExplorer(absoluteStoragePath)
ScreenPlay.util.openFolderInExplorer(absoluteStoragePath)
}
}
MenuItem {

View File

@ -5,6 +5,8 @@ import QtQuick.Extras 1.4
import QtQuick.Layouts 1.12
import QtQuick.Controls.Material 2.12
import ScreenPlay 1.0
import "../Monitors"
import "../Common" as SP
@ -19,7 +21,7 @@ Item {
property string activeScreen
Connections {
target: utility
target: ScreenPlay.util
onSetSidebarItem: {
@ -65,20 +67,20 @@ Item {
}
onActiveScreenChanged: {
txtHeadline.text = installedListModel.get(activeScreen).screenTitle
txtHeadline.text = ScreenPlay.installedListModel.get(activeScreen).screenTitle
if (installedListModel.get(
if (ScreenPlay.installedListModel.get(
activeScreen).screenPreviewGIF === undefined) {
image.source = Qt.resolvedUrl(
globalVariables.localStoragePath + "/"
+ activeScreen + "/" + installedListModel.get(
ScreenPlay.globalVariables.localStoragePath + "/"
+ activeScreen + "/" + ScreenPlay.installedListModel.get(
activeScreen).screenPreview)
image.playing = false
} else {
image.source = Qt.resolvedUrl(
globalVariables.localStoragePath + "/"
+ activeScreen + "/" + installedListModel.get(
ScreenPlay.globalVariables.localStoragePath + "/"
+ activeScreen + "/" + ScreenPlay.installedListModel.get(
activeScreen).screenPreviewGIF)
image.playing = true
}
@ -332,17 +334,17 @@ Item {
print(activeMonitors)
screenPlay.createWallpaper(
activeMonitors, globalVariables.localStoragePath
activeMonitors, ScreenPlay.globalVariables.localStoragePath
+ "/" + activeScreen,
installedListModel.get(activeScreen).screenPreview,
ScreenPlay.installedListModel.get(activeScreen).screenPreview,
(Math.round(sliderVolume.value * 100) / 100),
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(
), type)
} else {
screenPlay.createWidget(
globalVariables.localStoragePath + "/" + activeScreen,
installedListModel.get(
ScreenPlay.globalVariables.localStoragePath + "/" + activeScreen,
ScreenPlay.installedListModel.get(
activeScreen).screenPreview)
}
sidebar.state = "inactive"

View File

@ -4,6 +4,8 @@ import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import ScreenPlay 1.0
import "../Common/" as SP
ColumnLayout {
@ -16,19 +18,19 @@ ColumnLayout {
SP.Slider {
headline: qsTr("Volume")
onValueChanged: screenPlay.setWallpaperValue(
onValueChanged: ScreenPlay.screenPlayManager.setWallpaperValue(
activeMonitorIndex, "volume", value)
Layout.fillWidth: true
}
SP.Slider {
headline: qsTr("Playback rate")
onValueChanged: screenPlay.setWallpaperValue(
onValueChanged: ScreenPlay.screenPlayManager.setWallpaperValue(
activeMonitorIndex, "playbackRate", value)
Layout.fillWidth: true
}
SP.Slider {
headline: qsTr("Current Video Time")
onValueChanged: screenPlay.setWallpaperValue(
onValueChanged: ScreenPlay.screenPlayManager.setWallpaperValue(
activeMonitorIndex, "currentTime", value)
Layout.fillWidth: true
}
@ -51,7 +53,7 @@ ColumnLayout {
id: settingsComboBox
Layout.fillWidth: true
onActivated: {
screenPlay.setWallpaperValue(
ScreenPlay.screenPlayManager.setWallpaperValue(
activeMonitorIndex, "fillmode",
settingsComboBox.currentText)
}

View File

@ -1,5 +1,6 @@
import QtQuick 2.12
import QtGraphicalEffects 1.0
import ScreenPlay 1.0
Rectangle {
id: rect
@ -26,7 +27,7 @@ Rectangle {
}
Connections {
target: monitorListModel
target: ScreenPlay.monitorListModel
onMonitorReloadCompleted: {
resize()
}
@ -67,7 +68,7 @@ Rectangle {
function resize() {
var absoluteDesktopSize = monitorListModel.getAbsoluteDesktopSize()
var absoluteDesktopSize = ScreenPlay.monitorListModel.getAbsoluteDesktopSize()
var isWidthGreaterThanHeight = false
var windowsDelta = 0
@ -107,7 +108,7 @@ Rectangle {
Repeater {
id: rp
anchors.fill: parent
model: monitorListModel
model: ScreenPlay.monitorListModel
Component.onCompleted: rp.itemAt(0).isSelected = true

View File

@ -4,6 +4,8 @@ import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import ScreenPlay 1.0
import "../Common/" as SP
Item {
@ -18,7 +20,7 @@ Item {
onStateChanged: {
bgMouseArea.focus = monitors.state == "active" ? true : false
if (monitors.state === "active") {
screenPlay.requestProjectSettingsListModelAt(0)
ScreenPlay.screenPlayManager.requestProjectSettingsListModelAt(0)
}
}
@ -91,11 +93,11 @@ Item {
availableHeight: 150
onRequestProjectSettings: {
// This will return in the connection with target: screenPlay
screenPlay.requestProjectSettingsListModelAt(at)
ScreenPlay.screenPlayManager.requestProjectSettingsListModelAt(at)
activeMonitorIndex = at
}
Connections {
target: screenPlay
target: ScreenPlay.screenPlayManager
onProjectSettingsListModelFound: {
videoControlWrapper.state = "visible"
customPropertiesGridView.model = li
@ -131,7 +133,7 @@ Item {
Material.foreground: "white"
enabled: monitorSelection.activeMonitors.length == 1
onClicked: {
screenPlay.removeWallpaperAt(monitorSelection.activeMonitors[0])
ScreenPlay.screenPlayManager.removeWallpaperAt(monitorSelection.activeMonitors[0])
monitorSelection.deselectAll()
}
}
@ -141,7 +143,7 @@ Item {
Material.background: Material.Orange
Material.foreground: "white"
onClicked: {
screenPlay.removeAllWallpapers()
ScreenPlay.screenPlayManager.removeAllWallpapers()
monitors.state = "inactive"
}
}

View File

@ -3,7 +3,7 @@ import QtQuick.Controls 2.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import ScreenPlay 1.0
Item {
id: delegate
focus: true
@ -78,7 +78,7 @@ Item {
onValueChanged: {
var value = Math.round(slider.value * 100) / 100;
txtSliderValue.text = value;
screenPlay.setWallpaperValue(selectedMonitor,txtDescription.text,value)
ScreenPlay.screenPlayManager.setWallpaperValue(selectedMonitor,txtDescription.text,value)
}
}
Text {

View File

@ -2,6 +2,8 @@ import QtQuick 2.12
import QtQuick.Controls 2.3
import QtGraphicalEffects 1.0
import ScreenPlay 1.0
import "../Workshop"
import "../Common"
@ -18,7 +20,7 @@ Rectangle {
property bool navActive: true
Connections {
target: utility
target: ScreenPlay.util
onRequestNavigationActive: {
setActive(isActive)
}
@ -83,7 +85,7 @@ Rectangle {
id: navInstalled
state: "active"
name: "Installed"
amount: installedListModel.count
amount: ScreenPlay.installedListModel.count
iconSource: "qrc:/assets/icons/icon_installed.svg"
onPageClicked: navigation.onPageChanged(name)
}

View File

@ -2,6 +2,8 @@ import QtQuick 2.12
import QtQuick.Controls 2.3
import QtGraphicalEffects 1.0
import ScreenPlay 1.0
import "../Common"
Item {
@ -21,7 +23,7 @@ Item {
}
Connections {
target: screenPlay
target: ScreenPlay.screenPlayManager
onActiveWallpaperCounterChanged:{
rippleEffect.trigger()
}
@ -40,7 +42,7 @@ Item {
Text {
id: txtAmountActiveWallpapers
text: screenPlay.activeWallpaperCounter + screenPlay.activeWidgetsCounter
text: ScreenPlay.screenPlayManager.activeWallpaperCounter + ScreenPlay.screenPlayManager.activeWidgetsCounter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "orange"
@ -59,7 +61,7 @@ Item {
Text {
id: activeMonitorName
text: {
if (screenPlay.activeWallpaperCounter > 0) {
if (ScreenPlay.screenPlayManager.activeWallpaperCounter > 0) {
return qsTr("Configurate active Wallpaper or Widgets")
} else {
return qsTr("No active Wallpaper or Widgets")
@ -81,7 +83,7 @@ Item {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
utility.setToggleWallpaperConfiguration()
ScreenPlay.util.setToggleWallpaperConfiguration()
}
}

View File

@ -5,6 +5,8 @@ import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0
import ScreenPlay 1.0
Item {
id: settingsWrapper
anchors.fill: parent
@ -84,10 +86,10 @@ Item {
SettingBool {
headline: qsTr("Autostart")
description: qsTr("ScreenPlay will start with Windows and will setup your Desktop every time for you.")
isChecked: screenPlaySettings.autostart
isChecked: ScreenPlay.settings.autostart
onCheckboxChanged: {
screenPlaySettings.setAutostart(checked)
screenPlaySettings.writeSingleSettingConfig(
ScreenPlay.settings.setAutostart(checked)
ScreenPlay.settings.writeSingleSettingConfig(
"autostart", checked)
}
}
@ -98,10 +100,10 @@ Item {
available: false
description: qsTr("This options grants ScreenPlay a higher autostart priority than other apps.")
isChecked: screenPlaySettings.highPriorityStart
isChecked: ScreenPlay.settings.highPriorityStart
onCheckboxChanged: {
screenPlaySettings.setHighPriorityStart(checked)
screenPlaySettings.writeSingleSettingConfig(
ScreenPlay.settings.setHighPriorityStart(checked)
ScreenPlay.settings.writeSingleSettingConfig(
"highPriorityStart", checked)
}
}
@ -112,10 +114,10 @@ Item {
available: false
headline: qsTr("Send anonymous crash reports and statistics")
description: qsTr("Help us make ScreenPlay faster and more stable. All collected data is purely anonymous and only used for development purposes!")
isChecked: screenPlaySettings.sendStatistics
isChecked: ScreenPlay.settings.sendStatistics
onCheckboxChanged: {
screenPlaySettings.setSendStatistics(checked)
screenPlaySettings.writeSingleSettingConfig(
ScreenPlay.settings.setSendStatistics(checked)
ScreenPlay.settings.writeSingleSettingConfig(
"sendStatistics", checked)
}
@ -125,7 +127,7 @@ Item {
SettingsButton {
headline: qsTr("Set save location")
description: globalVariables.localStoragePath //qsTr("Choose where to find you content. The default save location is you steam installation")
description: ScreenPlay.globalVariables.localStoragePath //qsTr("Choose where to find you content. The default save location is you steam installation")
buttonText: qsTr("Set location")
onButtonPressed: {
folderDialogSaveLocation.open()
@ -133,7 +135,7 @@ Item {
FolderDialog {
id: folderDialogSaveLocation
onAccepted: {
globalVariables.setLocalStoragePath(
ScreenPlay.globalVariables.setLocalStoragePath(
folderDialogSaveLocation.currentFolder)
}
}
@ -185,7 +187,7 @@ Item {
}
print(key, languageKey)
screenPlaySettings.setqSetting("language", languageKey)
ScreenPlay.settings.setqSetting("language", languageKey)
}
comboBoxListModel: ListModel {
@ -256,10 +258,10 @@ Item {
headline: qsTr("Pause wallpaper while ingame")
available: false
description: qsTr("To maximise your framerates ingame, you can enable this setting to pause all active wallpapers!")
isChecked: screenPlaySettings.pauseWallpaperWhenIngame
isChecked: ScreenPlay.settings.pauseWallpaperWhenIngame
onCheckboxChanged: {
screenPlaySettings.setPauseWallpaperWhenIngame(checked)
screenPlaySettings.writeSingleSettingConfig("setPauseWallpaperWhenIngame",checked)
ScreenPlay.settings.setPauseWallpaperWhenIngame(checked)
ScreenPlay.settings.writeSingleSettingConfig("setPauseWallpaperWhenIngame",checked)
}
}
SettingsHorizontalSeperator {
@ -413,7 +415,7 @@ Item {
font.pointSize: 12
}
Text {
text: qsTr("ScreenPlay Build Version ") + screenPlaySettings.gitBuildHash
text: qsTr("ScreenPlay Build Version ") + ScreenPlay.settings.gitBuildHash
color: "#B5B5B5"
wrapMode: Text.WordWrap
@ -435,7 +437,7 @@ Item {
description: qsTr("ScreenPlay would not be possible without the work of others. A big thank you to: ")
buttonText: qsTr("Licenses")
onButtonPressed: {
utility.requestAllLicenses()
ScreenPlay.util.requestAllLicenses()
expanderCopyright.toggle()
}
}
@ -448,7 +450,7 @@ Item {
Connections {
target: utility
target: ScreenPlay.util
onAllLicenseLoaded: {
expanderCopyright.text = licensesText
}
@ -465,7 +467,7 @@ Item {
}
SettingsExpander {
id:expanderDebug
text: utility.debugMessages
text: ScreenPlay.util.debugMessages
anchors {
left: parent.left
right: parent.right
@ -477,7 +479,7 @@ Item {
description: qsTr("We use you data very carefully to improve ScreenPlay. We do not sell or share this (anonymous) information with others!")
buttonText: qsTr("Privacy")
onButtonPressed: {
utility.requestAllLDataProtection()
ScreenPlay.util.requestAllLDataProtection()
expanderDataProtection.toggle()
}
}
@ -490,7 +492,7 @@ Item {
Connections {
target: utility
target: ScreenPlay.util
onAllDataProtectionLoaded: {
expanderDataProtection.text = dataProtectionText
}