1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00
This commit is contained in:
kelteseth 2017-06-06 12:51:53 +02:00
parent 2311ca54f2
commit f516ef9fb5
37 changed files with 1472 additions and 118 deletions

View File

@ -0,0 +1,13 @@
{
"Screens":
[
{ "ScreenName1": {"id": "abc", "fillmode": "stretch"} },
{ "ScreenName2": {"id": "xyz"} }
],
"Widgets":
[
{ "WidgetName1": {"id": "abc"} },
{ "WidgetName2": {"id": "aaa"} }
],
"Plays": []
}

View File

@ -12,7 +12,10 @@ SOURCES += main.cpp \
src/backend.cpp \
src/monitorlistmodel.cpp \
src/settings.cpp \
src/packagefilehandler.cpp
src/packagefilehandler.cpp \
src/wallpaper.cpp \
src/profilelistmodel.cpp \
src/profile.cpp
RESOURCES += qml.qrc
@ -23,12 +26,17 @@ HEADERS += \
src/backend.h \
src/monitorlistmodel.h \
src/settings.h \
src/packagefilehandler.h
src/packagefilehandler.h \
src/wallpaper.h \
src/profilelistmodel.h \
src/profile.h
INCLUDEPATH += \
$$PWD/ThirdParty/ \
$$PWD/src/\
INCLUDEPATH += .
CONFIG(debug, debug|release) {
install_it.path = $${OUT_PWD}/debug/
} else {

View File

@ -1 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 310 121" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><path d="M310,5c0,-2.76 -2.24,-5 -5,-5l-300,0c-2.76,0 -5,2.24 -5,5l0,116l310,0l0,-116Z" style="fill:#484848;"/></svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 310 121" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
<path d="M310,2C310,0.896 309.104,0 308,0L2,0C0.896,0 0,0.896 0,2L0,121L310,121L310,2Z" style="fill:rgb(57,57,57);"/>
</svg>

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 580 B

View File

@ -19,11 +19,16 @@
#include "backend.h"
#include "installedlistmodel.h"
#include "monitorlistmodel.h"
#include "packagefilehandler.h"
#include "screenplay.h"
#include "settings.h"
#include "profilelistmodel.h"
int main(int argc, char* argv[])
{
Q_INIT_RESOURCE(qml);
QGuiApplication app(argc, argv);
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
@ -35,12 +40,19 @@ int main(int argc, char* argv[])
InstalledListModel installedListModel;
MonitorListModel monitorListModel;
PackageFileHandler packageFileHandler;
ProfileListModel profileListModel;
// Create settings at the end because for now it depends on
// such things as the profile list model to complete
Settings settings;
monitorListModel.loadMonitors();
QQmlApplicationEngine mainWindow;
mainWindow.rootContext()->setContextProperty("monitorListModel", &monitorListModel);
mainWindow.rootContext()->setContextProperty("installedListModel", &installedListModel);
mainWindow.rootContext()->setContextProperty("settings", &settings);
mainWindow.rootContext()->setContextProperty("packageFileHandler", &packageFileHandler);
mainWindow.rootContext()->setContextProperty("profileListModel", &profileListModel);
mainWindow.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
ScreenPlay sp(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
@ -50,6 +62,10 @@ int main(int argc, char* argv[])
sp.loadQQuickView(QUrl(QStringLiteral("qrc:/qml/Components/ScreenPlay.qml")));
sp.showQQuickView(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
installedListModel.loadScreens();
QObject::connect(&installedListModel, &InstalledListModel::setScreenVisible,
&sp, &ScreenPlay::setVisible);
int status = app.exec();
//Shutdown

View File

@ -8,7 +8,6 @@
<file>qml/Components/ScreenPlay.qml</file>
<file>qml/Components/Settings.qml</file>
<file>qml/Components/Page.qml</file>
<file>qml/Components/Settings/SettingBool.qml</file>
<file>assets/licenses/Apache2.txt</file>
<file>assets/licenses/OFL.txt</file>
<file>assets/fonts/LibreBaskerville-Italic.ttf</file>
@ -36,6 +35,8 @@
<file>qml/Components/Settings/SettingBool.qml</file>
<file>qml/Components/Headline.qml</file>
<file>qtquickcontrols2.conf</file>
<file>qml/Components/FileDropper.qml</file>
<file>qml/Components/Widgets/Window.qml</file>
<file>settings.json</file>
</qresource>
</RCC>

View File

@ -14,9 +14,14 @@ DropArea {
dropper.state = "invisible"
}
Connections {
target: packageFileHandler
onCurrentLoaderStatusChanged:print("aaaaa")
}
onDropped: {
var a= packageFileHandler.loadPackageFromLocalZip(drop.urls,".")
print(LoaderStatus.AllErrors)
print(packageFileHandler.currentLoaderStatus)
if(a === -1) {
dropper.state = "badFile"
@ -71,6 +76,11 @@ DropArea {
target: fill
opacity: 0
}
PropertyChanges {
target: text1
opacity: 0
}
},
State {
name: "badFile"

View File

@ -41,8 +41,7 @@ Page {
}
add: Transition {
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400; }
NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 }
NumberAnimation { properties: "x,y"; from: 100; duration: 1000 }
}
displaced: Transition {

View File

@ -100,7 +100,7 @@ Rectangle {
Text {
id: activeMonitorName
text: qsTr("Monitor Name")
text: qsTr("Monitor Setup")
anchors.right: image.right
anchors.rightMargin: 20 + image.width
horizontalAlignment: Text.AlignRight

View File

@ -4,13 +4,13 @@ import QtAV 1.07
Item {
id:empty
height: parent.height
width: parent.width
anchors.fill: parent
// Loader {
// anchors.fill: parent
// source: "qrc:/qml/Components/Screens/ScreenVideo.qml"
// }
Loader {
anchors.fill: parent
source: "qrc:/qml/Components/Screens/ScreenVideo.qml"
}
Connections {
target: installedListModel
@ -19,6 +19,7 @@ Item {
video.stop()
video.source = absolutePath;
video.play();
print(absolutePath)
}
}

View File

@ -32,7 +32,7 @@ Item {
Rectangle {
id: itemWrapper
color: "white"
radius: 5
radius: 2
anchors {
fill: parent
margins: 5
@ -67,8 +67,8 @@ Item {
antialiasing: true
source: rectangle1
maskSource: mask
}
MouseArea {
anchors.fill: parent
onClicked: {

View File

@ -1,13 +1,18 @@
import QtQuick 2.7
Image {
id: image
Item {
id: screenPlayItemImage
width: 320
height: 121
anchors.bottomMargin: 0
state: "loading"
property string sourceImage: ""
onSourceImageChanged: {
image.source = screenPlayItemImage.sourceImage
}
states: [
State {
name: "loading"
@ -16,6 +21,11 @@ Image {
target: image
opacity: 0
}
PropertyChanges {
target: text1
wrapMode: Text.WrapAnywhere
}
},
State {
name: "loaded"
@ -24,6 +34,11 @@ Image {
target: image
opacity: 1
}
PropertyChanges {
target: text1
opacity: 0
}
}
]
@ -38,25 +53,36 @@ Image {
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
target: text1
property: "opacity"
duration: 300
easing.type: Easing.InOutQuad
}
}
]
Image {
id:image
anchors.fill: parent
antialiasing: false
asynchronous: true
//sourceSize: Qt.size(320,121)
fillMode: Image.PreserveAspectCrop
source: screenPlayItemImage.sourceImage.trim()
onSourceImageChanged: {
image.source = sourceImage
onStatusChanged: {
if (image.status === Image.Ready)
screenPlayItemImage.state = "loaded"
}
}
opacity: 0
anchors.bottomMargin: 0
antialiasing: false
asynchronous: true
fillMode: Image.PreserveAspectCrop
source: sourceImage
anchors.fill: parent
onStatusChanged: {
if (image.status == Image.Ready)
image.state = "loaded"
Text {
id: text1
text: ""
anchors.fill: parent
font.pixelSize: 12
}
}

View File

@ -1,24 +1,26 @@
import QtQuick 2.0
import QtAV 1.07
//import QtAV 1.07
Rectangle {
color: "orange"
height: parent.height
width: parent.width
Connections {
target: installedListModel
onSetScreenToVideo:{
installedListModel.setScreenVisibleFromQml(true)
video.stop()
video.source = absolutePath;
video.play();
}
}
Video {
id: video
anchors.fill: parent
}
// height: parent.height
// width: parent.width
// Connections {
// target: installedListModel
// onSetScreenToVideo:{
// installedListModel.setScreenVisibleFromQml(true)
// video.stop()
// video.source = absolutePath;
// video.play();
// }
// }
// Video {
// id: video
// anchors.fill: parent
// }
}

View File

@ -1,7 +1,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.1
import "Settings/"
@ -17,7 +17,7 @@ Page {
SettingBool {
name: "Autostart"
isChecked: settings.autostart
onCheckboxChanged: settings.setAutostart(checked)
//onCheckboxChanged: settings.setAutostart(checked)
}
Headline {
name: "Misc"

View File

@ -5,7 +5,7 @@ import QtQuick.Layouts 1.3
import "Components"
Window {
ApplicationWindow {
id: window
color: "#eeeeee"
visible: true
@ -13,10 +13,18 @@ Window {
minimumHeight: 768
minimumWidth: 1050
Component.onCompleted: {
setX(Screen.width / 2 - width / 2);
setY(Screen.height / 2 - height / 2);
}
// Fixme: make ui responsive at startup without timer
Timer{
running: true; repeat: false
onTriggered: pageLoader.source = "qrc:/qml/Components/Installed.qml"
}
Loader {
id: pageLoader
anchors {
@ -25,7 +33,33 @@ Window {
bottom: parent.bottom
left: parent.left
}
source: "qrc:/qml/Components/Installed.qml"
onStateChanged: {
if(pageLoader.state === Loader.Loading){
loaderText.visible = true
} else if(pageLoader.state === Loader.Ready){
loaderText.visible = false
}
}
Text {
id: loaderText
visible: true
text: qsTr("Loading...")
anchors.centerIn: parent
font.pixelSize: 32
font.family: font_LibreBaskerville_Italic.name
font.pointSize: 32
font.italic: true
color: "#818181"
FontLoader{
id: font_LibreBaskerville_Italic
source: "qrc:/assets/fonts/LibreBaskerville-Italic.ttf"
}
}
// onSourceChanged: pageLoaderAnim.running = true
// SequentialAnimation {
@ -76,6 +110,7 @@ Window {
onToggleMonitors: {
monitors.state = monitors.state == "active" ? "inactive" : "active"
}
}
Monitors {
@ -85,5 +120,9 @@ Window {
z:98
}
FileDropper {
anchors.fill: parent
z:99
}
}

View File

@ -6,5 +6,8 @@
"renderer": {
"renderer-value": 0,
"renderer-enum" : ["OpenGL","Vulkan", "DirectX11", "DirectX12", "Software"]
}
}
},
"profiles":[
{ "monitorID": "","profile": "" }
]
}

View File

@ -9,3 +9,8 @@ void Backend::getTest()
{
emit setTest();
}
void Backend::exit()
{
qDebug() << "EXIOTTT";
}

View File

@ -2,6 +2,7 @@
#define BACKEND_H
#include <QObject>
#include <QDebug>
class Backend : public QObject
{
@ -14,6 +15,7 @@ signals:
public slots:
void getTest();
void exit();
};
#endif // BACKEND_H

View File

@ -9,13 +9,13 @@ InstalledListModel::InstalledListModel(QObject* parent)
if (!QDir(writablePath).exists()) {
if (!QDir().mkdir(writablePath)) {
qWarning("ERROR: Cloud not create install dir");
return;
}
} else {
_screensPath = writablePath + "/Installed/";
_screensPath = writablePath + "/Wallpaper/";
}
loadScreens();
}
int InstalledListModel::rowCount(const QModelIndex& parent) const
@ -77,7 +77,6 @@ void InstalledListModel::loadScreens()
for (auto&& item : list) {
tmpPath = _screensPath + item.baseName() + "/project.json";
if (!QFile(tmpPath).exists())
continue;
@ -122,3 +121,20 @@ void InstalledListModel::setScreenToVideoFromQml(QString absolutePath)
{
emit setScreenToVideo(absolutePath);
}
ScreenPlayFile::ScreenPlayFile(QJsonObject obj, QString folderName)
{
if (obj.contains("description"))
_description = obj.value("description");
if (obj.contains("file"))
_file = obj.value("file");
if (obj.contains("preview"))
_preview = obj.value("preview");
if (obj.contains("title"))
_title = obj.value("title");
_folderId = folderName;
}

View File

@ -26,8 +26,7 @@ public:
// Basic functionality:
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index,
int role = Qt::DisplayRole) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
void append(const QJsonObject, const QString);
QHash<int, QByteArray> roleNames() const override;
@ -37,7 +36,6 @@ public:
Q_INVOKABLE void setScreenToVideoFromQml(QString absolutePath);
Q_PROPERTY(QString _screensPath READ name CONSTANT)
enum InstalledRole {
TitleRole,
PreviewRole,
@ -64,22 +62,7 @@ class ScreenPlayFile {
public:
ScreenPlayFile();
ScreenPlayFile(QJsonObject obj, QString folderName)
{
if (obj.contains("description"))
_description = obj.value("description");
if (obj.contains("file"))
_file = obj.value("file");
if (obj.contains("preview"))
_preview = obj.value("preview");
if (obj.contains("title"))
_title = obj.value("title");
_folderId = folderName;
}
ScreenPlayFile(QJsonObject obj, QString folderName);
QVariant _description;
QVariant _file;

View File

@ -3,15 +3,7 @@
MonitorListModel::MonitorListModel(QObject *parent)
: QAbstractListModel(parent)
{
for (int i = 0; i < QApplication::screens().count(); i++) {
QScreen* screen = QApplication::screens().at(i);
_monitorList.append(Monitor(screen->manufacturer(),
screen->size(),
screen->availableGeometry(),
// More convenient for the user if the first monitor == 1
i + 1));
}
}
QHash<int, QByteArray> MonitorListModel::roleNames() const
@ -104,6 +96,20 @@ bool MonitorListModel::removeRows(int row, int count, const QModelIndex &parent)
endRemoveRows();
}
void MonitorListModel::loadMonitors()
{
for (int i = 0; i < QApplication::screens().count(); i++) {
QScreen* screen = QApplication::screens().at(i);
_monitorList.append(Monitor(screen->name(),
screen->size(),
screen->availableGeometry(),
// More convenient for the user if the first monitor == 1
i + 1));
}
}
Monitor::Monitor()
{
@ -115,4 +121,6 @@ Monitor::Monitor(QString name, QSize size, QRect availableGeometry, int number)
_size = size;
_availableGeometry = availableGeometry;
_number = number;
// FIXME 5.9: Use device id and manufacturer when 5.9 is available
_id = name + QString::number(size.width()) + QString::number(size.height()) + QString::number(availableGeometry.x()) + QString::number( availableGeometry.y());
}

View File

@ -9,12 +9,14 @@
#include <QScreen>
#include <QDebug>
#include <QApplication>
#include "settings.h"
class Monitor;
class MonitorListModel : public QAbstractListModel
{
Q_OBJECT
friend Settings;
public:
explicit MonitorListModel(QObject *parent = nullptr);
@ -51,6 +53,7 @@ public:
// Remove data:
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
void loadMonitors();
private:
QVector<Monitor> _monitorList;
};
@ -61,6 +64,7 @@ public:
Monitor();
Monitor(QString name, QSize size, QRect availableGeometry, int number);
QString _id;
QString _name;
QSize _size;
QRect _availableGeometry;

6
src/profile.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "profile.h"
Profile::Profile()
{
}

11
src/profile.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef PROFILE_H
#define PROFILE_H
class Profile
{
public:
Profile();
};
#endif // PROFILE_H

56
src/profilelistmodel.cpp Normal file
View File

@ -0,0 +1,56 @@
#include "profilelistmodel.h"
ProfileListModel::ProfileListModel(QObject* parent)
: QAbstractListModel(parent)
{
}
int ProfileListModel::rowCount(const QModelIndex& parent) const
{
// For list models only the root node (an invalid parent) should return the list's size. For all
// other (valid) parents, rowCount() should return 0 so that it does not become a tree model.
if (parent.isValid())
return 0;
return m_profileList.count();
}
QVariant ProfileListModel::data(const QModelIndex& index, int role) const
{
if (!index.isValid())
return QVariant();
int row = index.row();
if (row < 0 || row >= m_profileList.count()) {
return QVariant();
}
switch (role) {
case NameRole:
return QVariant();
}
return QVariant();
}
QHash<int, QByteArray> ProfileListModel::roleNames() const
{
return m_roleNames;
}
void ProfileListModel::loadProfiles()
{
QString writablePath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) ;
if (!QDir(writablePath).exists()) {
if (!QDir().mkdir(writablePath)) {
qWarning("ERROR: Cloud not create install dir");
return;
}
} else {
}
}

35
src/profilelistmodel.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef PROFILELISTMODEL_H
#define PROFILELISTMODEL_H
#include "profile.h"
#include <QAbstractListModel>
#include <QFile>
#include <QStandardPaths>
#include <QString>
#include <QDir>
#include <QVector>
class Profile;
class ProfileListModel : public QAbstractListModel {
Q_OBJECT
public:
explicit ProfileListModel(QObject* parent = 0);
enum RoleNames {
NameRole = Qt::UserRole,
NumberRole = Qt::UserRole + 2
};
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
virtual QHash<int, QByteArray> roleNames() const override;
void loadProfiles();
private:
QHash<int, QByteArray> m_roleNames;
QVector<Profile*> m_profileList;
};
#endif // PROFILELISTMODEL_H

View File

@ -1,17 +1,6 @@
#include "screenplay.h"
BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam)
{
// 0xXXXXXXX "" WorkerW
// ...
// 0xXXXXXXX "" SHELLDLL_DefView
// 0xXXXXXXXX "FolderView" SysListView32
// 0xXXXXXXXX "" WorkerW <---- We want this one
// 0xXXXXXXXX "Program Manager" Progman
if (FindWindowExW(hwnd, nullptr, L"SHELLDLL_DefView", nullptr))
*reinterpret_cast<HWND*>(lparam) = FindWindowExW(nullptr, hwnd, L"WorkerW", nullptr);
return TRUE;
}
ScreenPlay::ScreenPlay(QWindow* parent)
: QWindow(parent)
@ -39,7 +28,7 @@ ScreenPlay::ScreenPlay(int width, int height)
1000, nullptr);
// Get window handle to the worker window and hide it
/*
EnumWindows(SearchForWorkerWindow, reinterpret_cast<LPARAM>(&worker_hwnd));
ShowWindow(worker_hwnd, SW_SHOWDEFAULT);
@ -55,7 +44,7 @@ ScreenPlay::ScreenPlay(int width, int height)
this->show();
//ShowWindow(hwnd, SW_SHOWDEFAULT);
*/
// We do not want to display anything initially
setVisible(false);
}

View File

@ -1,11 +1,11 @@
#ifndef SCREENPLAY_H
#define SCREENPLAY_H
#include <QDebug>
#include <QQmlContext>
#include <QQuickView>
#include <QWindow>
#include <QDebug>
#include <qt_windows.h>
#include <QQmlContext>
class ScreenPlay : public QWindow {
Q_OBJECT
@ -17,10 +17,7 @@ public:
void loadQQuickView(QUrl path);
void showQQuickView(int width, int height);
QQmlContext *context() const;
QQmlContext* context() const;
signals:

View File

@ -4,16 +4,17 @@ Settings::Settings(QObject* parent)
: QObject(parent)
{
QFile configTmp;
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
configTmp.setFileName(appConfigLocation + "/settings.json");
// App Settings
if (!configTmp.exists())
createDefaultConfig();
QJsonDocument configJsonDocument;
QJsonParseError parseError;
QJsonObject configObj;
configTmp.setFileName(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/settings.json");
if (!configTmp.exists()) {
//If we cannot find the settings json file we will create one
createDefaultConfig();
}
configTmp.open(QIODevice::ReadOnly | QIODevice::Text);
QString config = configTmp.readAll();
configJsonDocument = QJsonDocument::fromJson(config.toUtf8(), &parseError);
@ -23,16 +24,54 @@ Settings::Settings(QObject* parent)
}
configObj = configJsonDocument.object();
m_version = configObj.value("version").toVariant();
QString tmp(configObj.value("version").toVariant().toString());
int major, minor, patch;
major = QString(tmp.at(0)).toInt();
minor = QString(tmp.at(2)).toInt();
patch = QString(tmp.at(4)).toInt();
//Checks if the settings file has the same version as ScreeenPlay
if (!(major == m_version.major && minor == m_version.minor && patch == m_version.patch)) {
//TODO Display error message
return;
}
m_autostart = configObj.value("autostart").toBool();
m_highPriorityStart = configObj.value("highPriorityStart").toBool();
m_sendStatistics = configObj.value("sendStatistics").toBool();
m_renderer = static_cast<Renderer>(configObj.value("renderer-value").toInt());
/*
* LOAD ACTIVE PROFILES
*/
QJsonArray activeProfilesTmp;
activeProfilesTmp = configObj.value("profiles").toArray();
int size = activeProfilesTmp.size();
// Only load profiles if we have any
if (size > 0) {
for (int i = 0; i < size; i++) {
QString profile = activeProfilesTmp.at(i).toObject().value("profile").toString();
QString monitorID = activeProfilesTmp.at(i).toObject().value("monitorID").toString();
m_activeProfiles.append(ActiveProfiles(profile, monitorID));
constructWallpaper(profile, monitorID);
}
}
}
void Settings::createNewProfile(int screenNumber)
{
}
void Settings::constructWallpaper(QString profile, QString monitorID)
{
//m_wallpapers.append(Wallpaper( ));
}
void Settings::createDefaultConfig()
{
Q_INIT_RESOURCE(qml);
QFile file(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/settings.json");
QFile defaultSettings(":/settings.json");
@ -46,4 +85,15 @@ void Settings::createDefaultConfig()
out << defaultOut.readAll();
file.close();
defaultSettings.close();
}
ActiveProfiles::ActiveProfiles()
{
}
ActiveProfiles::ActiveProfiles(QString name, QString id)
{
m_name = name;
m_id = id;
}

View File

@ -1,6 +1,7 @@
#ifndef SCREENPLAYSETTINGS_H
#define SCREENPLAYSETTINGS_H
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QJsonArray>
@ -10,19 +11,31 @@
#include <QQmlPropertyMap>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <QVariant>
#include <QDebug>
#include <QVector>
#include <QUrl>
#include "wallpaper.h"
#include "profile.h"
class ActiveProfiles;
class Profile;
class Settings : public QObject {
Q_OBJECT
public:
explicit Settings(QObject* parent = nullptr);
Q_PROPERTY(QVariant version READ version)
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(Renderer renderer READ renderer WRITE setRenderer NOTIFY rendererChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
Q_PROPERTY(Version version READ version)
Q_INVOKABLE void createNewProfile(int screenNumber);
Q_INVOKABLE void constructWallpaper(QString profile, QString monitorID);
enum Renderer {
OpenGL,
@ -30,10 +43,11 @@ public:
};
Q_ENUM(Renderer)
QVariant version() const
{
return m_version;
}
struct Version {
int major = 0;
int minor = 0;
int patch = 0;
};
bool autostart() const
{
@ -55,6 +69,11 @@ public:
return m_sendStatistics;
}
Version version() const
{
return m_version;
}
signals:
void autostartChanged(bool autostart);
@ -115,12 +134,35 @@ public slots:
private:
void createDefaultConfig();
void createProfileConfig();
QVariant m_version = "";
bool m_autostart = true;
bool m_highPriorityStart = true;
Renderer m_renderer = Renderer::OpenGL;
bool m_sendStatistics;
Version m_version;
QVector<Wallpaper> m_wallpapers;
QVector<ActiveProfiles> m_activeProfiles;
};
class ActiveProfiles {
public:
ActiveProfiles();
ActiveProfiles(QString name, QString id);
private:
QString m_name;
QString m_id;
Profile m_profile;
};
enum FillMode {
Stretch,
PreserveAspectFit,
PreserveAspectCrop,
};
#endif // SCREENPLAYSETTINGS_H

161
src/settings.h.CX9396 Normal file
View File

@ -0,0 +1,161 @@
#ifndef SCREENPLAYSETTINGS_H
#define SCREENPLAYSETTINGS_H
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QObject >
#include <QQmlPropertyMap>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <QVariant>
#include <QVector>
#include "wallpaper.h"
class ActiveProfiles;
class Profile;
class Settings : public QObject {
Q_OBJECT
public:
explicit Settings(QObject* parent = nullptr);
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(Renderer renderer READ renderer WRITE setRenderer NOTIFY rendererChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
Q_PROPERTY(Version version READ version)
Q_INVOKABLE void createNewProfile(int screenNumber);
Q_INVOKABLE void constructWallpaper(QString profile, QString monitorID);
enum Renderer {
OpenGL,
Softare,
};
Q_ENUM(Renderer)
struct Version {
int major = 0;
int minor = 0;
int patch = 0;
};
bool autostart() const
{
return m_autostart;
}
bool highPriorityStart() const
{
return m_highPriorityStart;
}
Renderer renderer() const
{
return m_renderer;
}
bool sendStatistics() const
{
return m_sendStatistics;
}
Version version() const
{
return m_version;
}
signals:
void autostartChanged(bool autostart);
void highPriorityStartChanged(bool highPriorityStart);
void rendererChanged(Renderer renderer);
void sendStatisticsChanged(bool sendStatistics);
public slots:
void setAutostart(bool autostart)
{
qDebug() << autostart;
if (m_autostart == autostart)
return;
m_autostart = autostart;
emit autostartChanged(m_autostart);
}
void setHighPriorityStart(bool highPriorityStart)
{
if (m_highPriorityStart == highPriorityStart)
return;
m_highPriorityStart = highPriorityStart;
emit highPriorityStartChanged(m_highPriorityStart);
}
void setRenderer(Renderer renderer)
{
if (m_renderer == renderer)
return;
m_renderer = renderer;
emit rendererChanged(m_renderer);
}
void setsendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
void setSendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
private:
void createDefaultConfig();
void createProfileConfig();
bool m_autostart = true;
bool m_highPriorityStart = true;
Renderer m_renderer = Renderer::OpenGL;
bool m_sendStatistics;
Version m_version;
QVector<Wallpaper> m_wallpapers;
QVector<ActiveProfiles> m_activeProfiles;
};
class ActiveProfiles {
public:
ActiveProfiles();
ActiveProfiles(QString name, QString id);
private:
QString m_name;
QString m_id;
};
enum FillMode {
Stretch,
PreserveAspectFit,
PreserveAspectCrop,
};
#endif // SCREENPLAYSETTINGS_H

161
src/settings.h.mN9396 Normal file
View File

@ -0,0 +1,161 @@
#ifndef SCREENPLAYSETTINGS_H
#define SCREENPLAYSETTINGS_H
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QObject >
#include <QQmlPropertyMap>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <QVariant>
#include <QVector>
#include "wallpaper.h"
class ActiveProfiles;
class Profile;
class Settings : public QObject {
Q_OBJECT
public:
explicit Settings(QObject* parent = nullptr);
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(Renderer renderer READ renderer WRITE setRenderer NOTIFY rendererChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
Q_PROPERTY(Version version READ version)
Q_INVOKABLE void createNewProfile(int screenNumber);
Q_INVOKABLE void constructWallpaper(QString profile, QString monitorID);
enum Renderer {
OpenGL,
Softare,
};
Q_ENUM(Renderer)
struct Version {
int major = 0;
int minor = 0;
int patch = 0;
};
bool autostart() const
{
return m_autostart;
}
bool highPriorityStart() const
{
return m_highPriorityStart;
}
Renderer renderer() const
{
return m_renderer;
}
bool sendStatistics() const
{
return m_sendStatistics;
}
Version version() const
{
return m_version;
}
signals:
void autostartChanged(bool autostart);
void highPriorityStartChanged(bool highPriorityStart);
void rendererChanged(Renderer renderer);
void sendStatisticsChanged(bool sendStatistics);
public slots:
void setAutostart(bool autostart)
{
qDebug() << autostart;
if (m_autostart == autostart)
return;
m_autostart = autostart;
emit autostartChanged(m_autostart);
}
void setHighPriorityStart(bool highPriorityStart)
{
if (m_highPriorityStart == highPriorityStart)
return;
m_highPriorityStart = highPriorityStart;
emit highPriorityStartChanged(m_highPriorityStart);
}
void setRenderer(Renderer renderer)
{
if (m_renderer == renderer)
return;
m_renderer = renderer;
emit rendererChanged(m_renderer);
}
void setsendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
void setSendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
private:
void createDefaultConfig();
void createProfileConfig();
bool m_autostart = true;
bool m_highPriorityStart = true;
Renderer m_renderer = Renderer::OpenGL;
bool m_sendStatistics;
Version m_version;
QVector<Wallpaper> m_wallpapers;
QVector<ActiveProfiles> m_activeProfiles;
};
class ActiveProfiles {
public:
ActiveProfiles();
ActiveProfiles(QString name, QString id);
private:
QString m_name;
QString m_id;
};
enum FillMode {
Stretch,
PreserveAspectFit,
PreserveAspectCrop,
};
#endif // SCREENPLAYSETTINGS_H

161
src/settings.h.pl9396 Normal file
View File

@ -0,0 +1,161 @@
#ifndef SCREENPLAYSETTINGS_H
#define SCREENPLAYSETTINGS_H
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QObject >
#include <QQmlPropertyMap>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <QVariant>
#include <QVector>
#include "wallpaper.h"
class ActiveProfiles;
class Profile;
class Settings : public QObject {
Q_OBJECT
public:
explicit Settings(QObject* parent = nullptr);
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(Renderer renderer READ renderer WRITE setRenderer NOTIFY rendererChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
Q_PROPERTY(Version version READ version)
Q_INVOKABLE void createNewProfile(int screenNumber);
Q_INVOKABLE void constructWallpaper(QString profile, QString monitorID);
enum Renderer {
OpenGL,
Softare,
};
Q_ENUM(Renderer)
struct Version {
int major = 0;
int minor = 0;
int patch = 0;
};
bool autostart() const
{
return m_autostart;
}
bool highPriorityStart() const
{
return m_highPriorityStart;
}
Renderer renderer() const
{
return m_renderer;
}
bool sendStatistics() const
{
return m_sendStatistics;
}
Version version() const
{
return m_version;
}
signals:
void autostartChanged(bool autostart);
void highPriorityStartChanged(bool highPriorityStart);
void rendererChanged(Renderer renderer);
void sendStatisticsChanged(bool sendStatistics);
public slots:
void setAutostart(bool autostart)
{
qDebug() << autostart;
if (m_autostart == autostart)
return;
m_autostart = autostart;
emit autostartChanged(m_autostart);
}
void setHighPriorityStart(bool highPriorityStart)
{
if (m_highPriorityStart == highPriorityStart)
return;
m_highPriorityStart = highPriorityStart;
emit highPriorityStartChanged(m_highPriorityStart);
}
void setRenderer(Renderer renderer)
{
if (m_renderer == renderer)
return;
m_renderer = renderer;
emit rendererChanged(m_renderer);
}
void setsendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
void setSendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
private:
void createDefaultConfig();
void createProfileConfig();
bool m_autostart = true;
bool m_highPriorityStart = true;
Renderer m_renderer = Renderer::OpenGL;
bool m_sendStatistics;
Version m_version;
QVector<Wallpaper> m_wallpapers;
QVector<ActiveProfiles> m_activeProfiles;
};
class ActiveProfiles {
public:
ActiveProfiles();
ActiveProfiles(QString name, QString id);
private:
QString m_name;
QString m_id;
};
enum FillMode {
Stretch,
PreserveAspectFit,
PreserveAspectCrop,
};
#endif // SCREENPLAYSETTINGS_H

161
src/settings.h.vE9396 Normal file
View File

@ -0,0 +1,161 @@
#ifndef SCREENPLAYSETTINGS_H
#define SCREENPLAYSETTINGS_H
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QObject >
#include <QQmlPropertyMap>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <QVariant>
#include <QVector>
#include "wallpaper.h"
class ActiveProfiles;
class Profile;
class Settings : public QObject {
Q_OBJECT
public:
explicit Settings(QObject* parent = nullptr);
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(Renderer renderer READ renderer WRITE setRenderer NOTIFY rendererChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
Q_PROPERTY(Version version READ version)
Q_INVOKABLE void createNewProfile(int screenNumber);
Q_INVOKABLE void constructWallpaper(QString profile, QString monitorID);
enum Renderer {
OpenGL,
Softare,
};
Q_ENUM(Renderer)
struct Version {
int major = 0;
int minor = 0;
int patch = 0;
};
bool autostart() const
{
return m_autostart;
}
bool highPriorityStart() const
{
return m_highPriorityStart;
}
Renderer renderer() const
{
return m_renderer;
}
bool sendStatistics() const
{
return m_sendStatistics;
}
Version version() const
{
return m_version;
}
signals:
void autostartChanged(bool autostart);
void highPriorityStartChanged(bool highPriorityStart);
void rendererChanged(Renderer renderer);
void sendStatisticsChanged(bool sendStatistics);
public slots:
void setAutostart(bool autostart)
{
qDebug() << autostart;
if (m_autostart == autostart)
return;
m_autostart = autostart;
emit autostartChanged(m_autostart);
}
void setHighPriorityStart(bool highPriorityStart)
{
if (m_highPriorityStart == highPriorityStart)
return;
m_highPriorityStart = highPriorityStart;
emit highPriorityStartChanged(m_highPriorityStart);
}
void setRenderer(Renderer renderer)
{
if (m_renderer == renderer)
return;
m_renderer = renderer;
emit rendererChanged(m_renderer);
}
void setsendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
void setSendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
private:
void createDefaultConfig();
void createProfileConfig();
bool m_autostart = true;
bool m_highPriorityStart = true;
Renderer m_renderer = Renderer::OpenGL;
bool m_sendStatistics;
Version m_version;
QVector<Wallpaper> m_wallpapers;
QVector<ActiveProfiles> m_activeProfiles;
};
class ActiveProfiles {
public:
ActiveProfiles();
ActiveProfiles(QString name, QString id);
private:
QString m_name;
QString m_id;
};
enum FillMode {
Stretch,
PreserveAspectFit,
PreserveAspectCrop,
};
#endif // SCREENPLAYSETTINGS_H

163
src/settings.h.yd2772 Normal file
View File

@ -0,0 +1,163 @@
#ifndef SCREENPLAYSETTINGS_H
#define SCREENPLAYSETTINGS_H
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QObject >
#include <QQmlPropertyMap>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <QVariant>
#include <QVector>
#include "wallpaper.h"
class ActiveProfiles;
class Settings : public QObject {
Q_OBJECT
public:
explicit Settings(QObject* parent = nullptr);
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(Renderer renderer READ renderer WRITE setRenderer NOTIFY rendererChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
Q_PROPERTY(Version version READ version)
Q_INVOKABLE void createNewProfile(int screenNumber);
enum Renderer {
OpenGL,
Softare,
};
Q_ENUM(Renderer)
struct Version {
int major = 0;
int minor = 0;
int patch = 0;
};
bool autostart() const
{
return m_autostart;
}
bool highPriorityStart() const
{
return m_highPriorityStart;
}
Renderer renderer() const
{
return m_renderer;
}
bool sendStatistics() const
{
return m_sendStatistics;
}
Version version() const
{
return m_version;
}
signals:
void autostartChanged(bool autostart);
void highPriorityStartChanged(bool highPriorityStart);
void rendererChanged(Renderer renderer);
void sendStatisticsChanged(bool sendStatistics);
public slots:
void setAutostart(bool autostart)
{
qDebug() << autostart;
if (m_autostart == autostart)
return;
m_autostart = autostart;
emit autostartChanged(m_autostart);
}
void setHighPriorityStart(bool highPriorityStart)
{
if (m_highPriorityStart == highPriorityStart)
return;
m_highPriorityStart = highPriorityStart;
emit highPriorityStartChanged(m_highPriorityStart);
}
void setRenderer(Renderer renderer)
{
if (m_renderer == renderer)
return;
m_renderer = renderer;
emit rendererChanged(m_renderer);
}
void setsendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
void setSendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
private:
void createDefaultConfig();
void createProfileConfig();
bool m_autostart = true;
bool m_highPriorityStart = true;
Renderer m_renderer = Renderer::OpenGL;
bool m_sendStatistics;
Version m_version;
QVector<Wallpaper> m_wallpapers;
QVector<ActiveProfiles> m_activeProfiles;
};
class ActiveProfiles {
public:
ActiveProfiles();
ActiveProfiles(QString name, QString id)
{
m_name = name;
m_id = id;
}
QString m_name;
QString m_id;
};
enum FillMode {
Stretch,
PreserveAspectFit,
PreserveAspectCrop,
};
#endif // SCREENPLAYSETTINGS_H

161
src/settings.h.yu9396 Normal file
View File

@ -0,0 +1,161 @@
#ifndef SCREENPLAYSETTINGS_H
#define SCREENPLAYSETTINGS_H
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QObject >
#include <QQmlPropertyMap>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
#include <QVariant>
#include <QVector>
#include "wallpaper.h"
class ActiveProfiles;
class Profile;
class Settings : public QObject {
Q_OBJECT
public:
explicit Settings(QObject* parent = nullptr);
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(Renderer renderer READ renderer WRITE setRenderer NOTIFY rendererChanged)
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
Q_PROPERTY(Version version READ version)
Q_INVOKABLE void createNewProfile(int screenNumber);
Q_INVOKABLE void constructWallpaper(QString profile, QString monitorID);
enum Renderer {
OpenGL,
Softare,
};
Q_ENUM(Renderer)
struct Version {
int major = 0;
int minor = 0;
int patch = 0;
};
bool autostart() const
{
return m_autostart;
}
bool highPriorityStart() const
{
return m_highPriorityStart;
}
Renderer renderer() const
{
return m_renderer;
}
bool sendStatistics() const
{
return m_sendStatistics;
}
Version version() const
{
return m_version;
}
signals:
void autostartChanged(bool autostart);
void highPriorityStartChanged(bool highPriorityStart);
void rendererChanged(Renderer renderer);
void sendStatisticsChanged(bool sendStatistics);
public slots:
void setAutostart(bool autostart)
{
qDebug() << autostart;
if (m_autostart == autostart)
return;
m_autostart = autostart;
emit autostartChanged(m_autostart);
}
void setHighPriorityStart(bool highPriorityStart)
{
if (m_highPriorityStart == highPriorityStart)
return;
m_highPriorityStart = highPriorityStart;
emit highPriorityStartChanged(m_highPriorityStart);
}
void setRenderer(Renderer renderer)
{
if (m_renderer == renderer)
return;
m_renderer = renderer;
emit rendererChanged(m_renderer);
}
void setsendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
void setSendStatistics(bool sendStatistics)
{
if (m_sendStatistics == sendStatistics)
return;
m_sendStatistics = sendStatistics;
emit sendStatisticsChanged(m_sendStatistics);
}
private:
void createDefaultConfig();
void createProfileConfig();
bool m_autostart = true;
bool m_highPriorityStart = true;
Renderer m_renderer = Renderer::OpenGL;
bool m_sendStatistics;
Version m_version;
QVector<Wallpaper> m_wallpapers;
QVector<ActiveProfiles> m_activeProfiles;
};
class ActiveProfiles {
public:
ActiveProfiles();
ActiveProfiles(QString name, QString id);
private:
QString m_name;
QString m_id;
};
enum FillMode {
Stretch,
PreserveAspectFit,
PreserveAspectCrop,
};
#endif // SCREENPLAYSETTINGS_H

27
src/wallpaper.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "wallpaper.h"
BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam)
{
// 0xXXXXXXX "" WorkerW
// ...
// 0xXXXXXXX "" SHELLDLL_DefView
// 0xXXXXXXXX "FolderView" SysListView32
// 0xXXXXXXXX "" WorkerW <---- We want this one
// 0xXXXXXXXX "Program Manager" Progman
if (FindWindowExW(hwnd, nullptr, L"SHELLDLL_DefView", nullptr))
*reinterpret_cast<HWND*>(lparam) = FindWindowExW(nullptr, hwnd, L"WorkerW", nullptr);
return TRUE;
}
Wallpaper::Wallpaper(QWindow* parent)
: QWindow(parent)
{
}
Wallpaper::Wallpaper(QRect rect, float playback, bool isLooping, int fillmode)
{
m_rect = rect;
m_playback = playback;
m_isLooping = isLooping;
m_fillmode = fillmode;
}

33
src/wallpaper.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef WALLPAPER_H
#define WALLPAPER_H
#include <QDebug>
#include <QQmlContext>
#include <QQuickView>
#include <QWindow>
#include <qt_windows.h>
#include <QRect>
class Wallpaper : public QWindow {
Q_OBJECT
public:
explicit Wallpaper(QWindow* parent = 0);
Wallpaper(QRect rect, float playback, bool isLooping, int fillmode);
QQmlContext* context() const;
private:
HWND hwnd = nullptr;
HWND worker_hwnd = nullptr;
QQuickView* quickRenderer = nullptr;
QQmlContext* _context = nullptr;
QRect m_rect;
float m_playback;
bool m_isLooping;
int m_fillmode;
};
#endif // WALLPAPER_H