diff --git a/ScreenPlayWidget/SPWidgetResources.qrc b/ScreenPlayWidget/SPWidgetResources.qrc
index 466227d4..8fd2a28a 100644
--- a/ScreenPlayWidget/SPWidgetResources.qrc
+++ b/ScreenPlayWidget/SPWidgetResources.qrc
@@ -1,6 +1,7 @@
- main.qml
assets/image/noisy-texture-3.png
+ test.qml
+ mainWidget.qml
diff --git a/ScreenPlayWidget/ScreenPlayWidget.pro b/ScreenPlayWidget/ScreenPlayWidget.pro
index 3c519690..1a80bef4 100644
--- a/ScreenPlayWidget/ScreenPlayWidget.pro
+++ b/ScreenPlayWidget/ScreenPlayWidget.pro
@@ -1,21 +1,15 @@
QT += quick qml quickcontrols2 core widgets gui
CONFIG += c++17
CONFIG += qtquickcompiler
-# The following define makes your compiler emit warnings if you use
-# any feature of Qt which as been marked deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
-# You can also make your code fail to compile if you use deprecated APIs.
-# In order to do so, uncomment the following line.
-# You can also select to disable deprecated APIs only up to a certain version of Qt.
-#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-
SOURCES += \
main.cpp \
src/widgetwindow.cpp
+HEADERS += \
+ src/widgetwindow.h
+
RESOURCES += \
SPWidgetResources.qrc
@@ -26,8 +20,8 @@ INCLUDEPATH += \
include(../ScreenPlaySDK/Screenplaysdk.pri)
macx: {
-QMAKE_LIBDIR += $$OUT_PWD/
-install_it.path = $${OUT_PWD}/../ScreenPlaySDK
+ QMAKE_LIBDIR += $$OUT_PWD/
+ install_it.path = $${OUT_PWD}/../ScreenPlaySDK
}
!macx: {
@@ -42,19 +36,3 @@ install_it.path = $${OUT_PWD}/../ScreenPlaySDK
}
QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK
}
-
-
-
-# Additional import path used to resolve QML modules just for Qt Quick Designer
-# QML_DESIGNER_IMPORT_PATH =
-QT_QUICK_CONTROLS_STYLE = "Material"
-
-# Additional import path used to resolve QML modules in Qt Creator's code model
-QML_IMPORT_PATH =
-
-# Additional import path used to resolve QML modules just for Qt Quick Designer
-QML_DESIGNER_IMPORT_PATH =
-
-
-HEADERS += \
- src/widgetwindow.h
diff --git a/ScreenPlayWidget/main.cpp b/ScreenPlayWidget/main.cpp
index f98b190a..669bb735 100644
--- a/ScreenPlayWidget/main.cpp
+++ b/ScreenPlayWidget/main.cpp
@@ -14,12 +14,10 @@ int main(int argc, char* argv[])
QStringList argumentList = app.arguments();
- // If we start with only one argument (app path)
- // It means we want to test a single widget
+ // If we start with only one argument (app path),
+ // it means we want to test a single widget
if (argumentList.length() == 1) {
- // Todo generic widget
- WidgetWindow spwmw("D:/672870/xkcd","appid" );
-
+ WidgetWindow spwmw("test","appid" );
return app.exec();
}
diff --git a/ScreenPlayWidget/main.qml b/ScreenPlayWidget/mainWidget.qml
similarity index 69%
rename from ScreenPlayWidget/main.qml
rename to ScreenPlayWidget/mainWidget.qml
index d0488715..26e26f93 100644
--- a/ScreenPlayWidget/main.qml
+++ b/ScreenPlayWidget/mainWidget.qml
@@ -1,7 +1,8 @@
import QtQuick 2.12
-import net.aimber.screenplaysdk 1.0
import QtQuick.Controls 2.3
+import net.aimber.screenplaysdk 1.0
+
Item {
id: mainWindow
visible: true
@@ -22,27 +23,54 @@ Item {
opacity: .05
fillMode: Image.Tile
}
+ Loader {
+ id: loader
+ anchors.fill: parent
+ asynchronous: true
+ source: {
+ Qt.resolvedUrl(window.sourcePath)
+ }
+
+ onStatusChanged: {
+ if (loader.status === Loader.Ready) {
+
+ }
+ }
+ }
MouseArea {
id: mouseArea
anchors.fill: parent
onPressed: {
- backend.setClickPos(Qt.point(mouse.x, mouse.y))
+ window.setClickPos(Qt.point(mouse.x, mouse.y))
}
onPositionChanged: {
- backend.setPos(mouse.x, mouse.y)
+ window.setPos(mouse.x, mouse.y)
}
+ onClicked: {
+
+ if (mouse.button === Qt.RightButton) {
+ contextMenu.popup()
+ }
+ }
+ }
+ Menu {
+ id: contextMenu
+
+ MenuItem {
+ text: qsTr("Close Widget")
+ onClicked: {
+ Qt.quit()
+ }
+ }
+
}
Connections {
- target: backend
+ target: window
- onSetWidgetSource: {
- loader.source = Qt.resolvedUrl("file:///" + source)
- print(loader.source)
- }
onQmlSceneValueReceived: {
var obj2 = 'import QtQuick 2.12; Item {Component.onCompleted: loader.item.'
@@ -52,14 +80,5 @@ Item {
}
}
- Loader {
- id: loader
- anchors.fill: parent
- asynchronous: true
- onStatusChanged: {
- if (loader.status === Loader.Ready) {
- }
- }
- }
}
diff --git a/ScreenPlayWidget/src/widgetwindow.cpp b/ScreenPlayWidget/src/widgetwindow.cpp
index 1e391ee6..25ceed52 100644
--- a/ScreenPlayWidget/src/widgetwindow.cpp
+++ b/ScreenPlayWidget/src/widgetwindow.cpp
@@ -13,32 +13,39 @@ WidgetWindow::WidgetWindow(QString projectPath, QString appid, QObject* parent)
m_window.setWidth(300);
m_window.setHeight(300);
m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::BypassWindowManagerHint | Qt::SplashScreen);
-
- QFile configTmp;
- QJsonDocument configJsonDocument;
- QJsonParseError parseError;
-
- configTmp.setFileName(projectPath + "/project.json");
- configTmp.open(QIODevice::ReadOnly | QIODevice::Text);
- m_projectConfig = configTmp.readAll();
- configJsonDocument = QJsonDocument::fromJson(m_projectConfig.toUtf8(), &parseError);
-
- if (!(parseError.error == QJsonParseError::NoError)) {
- qWarning("Settings Json Parse Error ");
- }
- m_project = configJsonDocument.object();
- QString fullPath = projectPath + "/" + m_project.value("file").toString();
-
- m_window.rootContext()->setContextProperty("backend", this);
+ m_window.rootContext()->setContextProperty("window", this);
m_window.setColor(Qt::transparent);
- m_window.setSource(QUrl("qrc:/main.qml"));
#ifdef Q_OS_WIN
SetWindowBlur(m_hwnd);
#endif
+
+ if (projectPath != "test") {
+ QFile configTmp;
+ QJsonDocument configJsonDocument;
+ QJsonParseError parseError;
+
+ configTmp.setFileName(projectPath + "/project.json");
+ configTmp.open(QIODevice::ReadOnly | QIODevice::Text);
+ m_projectConfig = configTmp.readAll();
+ configJsonDocument = QJsonDocument::fromJson(m_projectConfig.toUtf8(), &parseError);
+
+ if (!(parseError.error == QJsonParseError::NoError)) {
+ qWarning("Settings Json Parse Error ");
+ }
+
+ m_project = configJsonDocument.object();
+ QString fullPath = "file:///" + projectPath + "/" + m_project.value("file").toString();
+ setSourcePath(fullPath);
+ } else {
+ setSourcePath("qrc:/test.qml");
+ }
+ // Instead of setting "renderType: Text.NativeRendering" every time
+ // we can set it here once :)
+ m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
+ m_window.setSource(QUrl("qrc:/mainWidget.qml"));
m_window.show();
- emit setWidgetSource(fullPath);
}
void WidgetWindow::setSize(QSize size)
diff --git a/ScreenPlayWidget/src/widgetwindow.h b/ScreenPlayWidget/src/widgetwindow.h
index c2458af8..d42967ef 100644
--- a/ScreenPlayWidget/src/widgetwindow.h
+++ b/ScreenPlayWidget/src/widgetwindow.h
@@ -8,6 +8,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -28,6 +29,7 @@ public:
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(QString projectConfig READ projectConfig WRITE setProjectConfig NOTIFY projectConfigChanged)
+ Q_PROPERTY(QString sourcePath READ sourcePath WRITE setSourcePath NOTIFY sourcePathChanged)
QString appID() const
{
@@ -44,17 +46,24 @@ public:
return m_projectConfig;
}
+ QString sourcePath() const
+ {
+ return m_sourcePath;
+ }
+
signals:
void appIDChanged(QString appID);
void typeChanged(QString type);
void projectConfigChanged(QString projectConfig);
- void setWidgetSource(QString source);
+ void sourcePathChanged(QString sourcePath);
+
void qmlSceneValueReceived(QString key, QString value);
public slots:
void setSize(QSize size);
void destroyThis();
void messageReceived(QString key, QString value);
+
void setAppID(QString appID)
{
if (m_appID == appID)
@@ -85,15 +94,25 @@ public slots:
#ifdef Q_OS_WIN
void SetWindowBlur(HWND hWnd);
#endif
+ void setSourcePath(QString sourcePath)
+ {
+ if (m_sourcePath == sourcePath)
+ return;
+
+ m_sourcePath = sourcePath;
+ emit sourcePathChanged(m_sourcePath);
+ }
+
private:
QString m_appID;
QString m_type = "qmlWidget";
QString m_projectConfig;
QJsonObject m_project;
- #ifdef Q_OS_WIN
+#ifdef Q_OS_WIN
HWND m_hwnd;
- #endif
+#endif
QPoint m_clickPos = { 0, 0 };
QQuickView m_window;
+ QString m_sourcePath;
};
diff --git a/ScreenPlayWidget/test.qml b/ScreenPlayWidget/test.qml
new file mode 100644
index 00000000..7ef167a3
--- /dev/null
+++ b/ScreenPlayWidget/test.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.12
+
+Rectangle {
+ anchors.fill: parent
+ color: "#80000000"
+
+ Text {
+ id: name
+ text: qsTr("This is a empty test widget. You can change the source in test.qml")
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ anchors.fill: parent
+ anchors.margins: 10
+ color: "white"
+ }
+
+}
+
+
+
+/*##^## Designer {
+ D{i:0;autoSize:true;height:480;width:640}
+}
+ ##^##*/
diff --git a/ScreenPlayWindow/SPWResources.qrc b/ScreenPlayWindow/SPWResources.qrc
index 69145a82..daab8893 100644
--- a/ScreenPlayWindow/SPWResources.qrc
+++ b/ScreenPlayWindow/SPWResources.qrc
@@ -1,5 +1,6 @@
- qml/main.qml
+ mainWindow.qml
+ test.qml
diff --git a/ScreenPlayWindow/ScreenPlayWindow.pro b/ScreenPlayWindow/ScreenPlayWindow.pro
index 462b1d1b..d51ba147 100644
--- a/ScreenPlayWindow/ScreenPlayWindow.pro
+++ b/ScreenPlayWindow/ScreenPlayWindow.pro
@@ -2,22 +2,28 @@ TEMPLATE = app
QT += qml quick quickcontrols2 widgets core webengine
CONFIG += c++17
-msvc: LIBS += -luser32
+DEFINES += QT_DEPRECATED_WARNINGS
+
TARGETPATH = ScreenPlayWindow
SOURCES += \
- #src/SPWmainwindow.cpp \
main.cpp \
src/basewindow.cpp \
- src/windowsdesktopproperties.cpp \
- src/winwindow.cpp
HEADERS += \
- #src/SPWmainwindow.h \
src/basewindow.h \
- src/windowsdesktopproperties.h \
- src/winwindow.h
+win32 {
+ LIBS += -luser32
+ SOURCES += \
+ src/windowsdesktopproperties.cpp \
+ src/winwindow.cpp
+
+ HEADERS += \
+ src/windowsdesktopproperties.h \
+ src/winwindow.h
+
+}
RESOURCES += \
SPWResources.qrc
@@ -62,19 +68,3 @@ macx: {
index.html
}
-
-# Additional import path used to resolve QML modules in Qt Creator's code model
-QML_IMPORT_PATH =
-
-# Additional import path used to resolve QML modules just for Qt Quick Designer
-QML_DESIGNER_IMPORT_PATH =
-QT_QUICK_CONTROLS_STYLE = "Material"
-
-# The following define makes your compiler emit warnings if you use
-# any feature of Qt which as been marked deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-
-
diff --git a/ScreenPlayWindow/main.cpp b/ScreenPlayWindow/main.cpp
index 768246c9..de2c5fd7 100644
--- a/ScreenPlayWindow/main.cpp
+++ b/ScreenPlayWindow/main.cpp
@@ -1,13 +1,20 @@
-#include "../ScreenPlaySDK/screenplaysdk.h"
+#include
+#include
+#include
+#include
+#include
#if defined(Q_OS_WIN)
#include "src/winwindow.h"
#endif
-#include
-#include
-#include
-#include
+#if defined(Q_OS_OSX)
+
+// TODO MAC OSX PORT HERE
+
+#endif
+
+#include "../ScreenPlaySDK/screenplaysdk.h"
int main(int argc, char* argv[])
{
@@ -15,15 +22,22 @@ int main(int argc, char* argv[])
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
- QStringList argumentList = app.arguments();
+
+ // This gives us nice clickable output in QtCreator
+ qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
+
+ // Qt < 6.0 needs this init QtWebEngine
QtWebEngine::initialize();
// If we start with only one argument (app path)
// It means we want to test a single wallpaper
+ QStringList argumentList = app.arguments();
if (argumentList.length() == 1) {
QVector list;
list.append(0);
- WinWindow window(list, "D:/672870/_tmp_135011", "appid", "1");
+#if defined(Q_OS_WIN)
+ WinWindow window(list, "test", "appid", "1");
+#endif
return app.exec();
}
@@ -66,5 +80,13 @@ int main(int argc, char* argv[])
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &WinWindow::messageReceived);
#endif
+#if defined(Q_OS_OSX)
+
+ // TODO MAC OSX PORT HERE
+ // QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &TODO, &TODO::destroyThis);
+ // QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &TODO, &TODO::messageReceived);
+
+#endif
+
return app.exec();
}
diff --git a/ScreenPlayWindow/qml/main.qml b/ScreenPlayWindow/qml/main.qml
deleted file mode 100644
index e9637ced..00000000
--- a/ScreenPlayWindow/qml/main.qml
+++ /dev/null
@@ -1,167 +0,0 @@
-import QtQuick 2.12
-import QtWebEngine 1.7
-import net.aimber.wallpaper 1.0
-
-Rectangle {
- anchors.fill: parent
- color: desktopProperties.color
-
- property bool canFadeIn: true
-
- Component.onCompleted: {
- WebEngine.settings.allowRunningInsecureContent = true
- WebEngine.settings.accelerated2dCanvasEnabled = true
- WebEngine.settings.javascriptCanOpenWindows = false
- WebEngine.settings.printElementBackgrounds = false
- WebEngine.settings.showScrollBars = false
- WebEngine.settings.playbackRequiresUserGesture = false
-
- switch (window.type) {
- case Wallpaper.WallpaperType.Video:
- webView.enabled = true
- webView.url = Qt.resolvedUrl("file:///" + window.getApplicationPath(
- ) + "/index.html")
-
- break
- case Wallpaper.WallpaperType.Html:
- webView.enabled = true
- webView.url = Qt.resolvedUrl("file:///" + window.fullContentPath)
- break
- case Wallpaper.WallpaperType.ThreeJSScene:
- webView.enabled = true
- break
- case Wallpaper.WallpaperType.Qml:
- loader.source = Qt.resolvedUrl("file:///" + window.fullContentPath)
- break
- }
- fadeIn()
- }
-
- function fadeIn() {
- window.setVisible(true)
- if (canFadeIn) {
- animFadeIn.start()
- } else {
- imgCover.opacity = 0
- }
- }
-
- WebEngineView {
- id: webView
- enabled: false
- anchors.fill: parent
- onLoadProgressChanged: {
- if (loadProgress === 100) {
-
- var src = ""
- src += "var videoPlayer = document.getElementById('videoPlayer');"
- src += "var videoSource = document.getElementById('videoSource');"
- src += "videoSource.src = 'file:///" + window.fullContentPath + "';"
- src += "videoPlayer.load();"
- src += "videoPlayer.volume = " + window.volume + ";"
- src += "videoPlayer.play();"
-
- webView.runJavaScript(src, function () {
- fadeIn()
- })
- }
- }
- }
- Loader {
- id: loader
- anchors.fill: parent
- }
-
- OpacityAnimator {
- id: animFadeIn
- target: imgCover
- from: 1
- to: 0
- duration: 300
- easing.type: Easing.InCubic
- running: true
- }
-
- Image {
- id: imgCover
- anchors.fill: parent
- source: Qt.resolvedUrl("file:///" + desktopProperties.wallpaperPath)
- Component.onCompleted: {
- switch (desktopProperties.wallpaperStyle) {
- case 10:
- imgCover.fillMode = Image.PreserveAspectCrop
- break
- case 6:
- imgCover.fillMode = Image.PreserveAspectFit
- break
- case 2:
- break
- case 0:
- if (desktopProperties.isTiled) {
- // Tiled
- imgCover.fillMode = Image.Tile
- } else {
- // Center
- imgCover.fillMode = Image.PreserveAspectFit
- imgCover.anchors.centerIn = parent
- imgCover.width = sourceSize.width
- imgCover.height = sourceSize.height
- }
- break
- case 22:
- canFadeIn = false
- break
- }
- }
- }
-
- Connections {
- target: window
-
- onQmlExit: {
- webView.runJavaScript(
- "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;")
- window.destroyThis()
- }
-
- onQmlSceneValueReceived: {
- var obj2 = 'import QtQuick 2.12; Item {Component.onCompleted: loader.item.'
- + key + ' = ' + value + '; }'
- var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
- newObject.destroy(10000)
- }
-
- onLoopsChanged: {
- if (webView.loadProgress === 100) {
- webView.runJavaScript(
- "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.loop = " + loops + ";")
- }
- }
-
- onVolumeChanged: {
- if (webView.loadProgress === 100) {
- webView.runJavaScript(
- "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + volume + ";")
- }
- }
-
- onPlaybackRateChanged: {
- if (webView.loadProgress === 100) {
- webView.runJavaScript(
- "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.playbackRate = " + playbackRate + ";")
- }
- }
-
- onIsPlayingChanged: {
- if (webView.loadProgress === 100) {
- if (isPlaying === "false") {
- webView.runJavaScript(
- "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.play();")
- } else {
- webView.runJavaScript(
- "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.pause();")
- }
- }
- }
- }
-}
diff --git a/ScreenPlayWindow/src/basewindow.cpp b/ScreenPlayWindow/src/basewindow.cpp
index 2aa83b4a..4550a5e2 100644
--- a/ScreenPlayWindow/src/basewindow.cpp
+++ b/ScreenPlayWindow/src/basewindow.cpp
@@ -11,6 +11,12 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent)
qRegisterMetaType();
qmlRegisterType("net.aimber.wallpaper", 1, 0, "Wallpaper");
+ if (projectFilePath == "test") {
+ setType(BaseWindow::WallpaperType::Qml);
+ setFullContentPath("qrc:/test.qml");
+ return;
+ }
+
QFile projectFile;
QJsonDocument configJsonDocument;
QJsonParseError parseError;
@@ -48,7 +54,7 @@ BaseWindow::BaseWindow(QString projectFilePath, QObject* parent)
qFatal("No type was specified inside the json object!");
}
- setFullContentPath(projectFilePath + "/" + projectObject.value("file").toString());
+ setFullContentPath("file:///" + projectFilePath + "/" + projectObject.value("file").toString());
if (projectObject.value("type") == "video") {
setType(BaseWindow::WallpaperType::Video);
diff --git a/ScreenPlayWindow/src/basewindow.h b/ScreenPlayWindow/src/basewindow.h
index c600ab2b..0251c000 100644
--- a/ScreenPlayWindow/src/basewindow.h
+++ b/ScreenPlayWindow/src/basewindow.h
@@ -1,13 +1,13 @@
#pragma once
+#include
+#include
#include
#include
#include
#include
#include
-#include
#include
-#include
#include
class BaseWindow : public QObject {
@@ -81,8 +81,12 @@ signals:
public slots:
virtual void destroyThis() {}
- virtual void setVisible(bool show) {Q_UNUSED(show)}
- virtual void messageReceived(QString key, QString value){Q_UNUSED(key);Q_UNUSED(value)}
+ virtual void setVisible(bool show) { Q_UNUSED(show) }
+ virtual void messageReceived(QString key, QString value)
+ {
+ Q_UNUSED(key);
+ Q_UNUSED(value)
+ }
QString getApplicationPath()
{
diff --git a/ScreenPlayWindow/src/macintegration.cpp b/ScreenPlayWindow/src/macintegration.cpp
index a894be44..82812617 100644
--- a/ScreenPlayWindow/src/macintegration.cpp
+++ b/ScreenPlayWindow/src/macintegration.cpp
@@ -1,7 +1,7 @@
#include "macintegration.h"
#include "macbridge.h"
-MacIntegration::MacIntegration(QObject *parent)
+MacIntegration::MacIntegration(QObject* parent)
: QObject(parent)
{
MacBridge::instance();
diff --git a/ScreenPlayWindow/src/macintegration.h b/ScreenPlayWindow/src/macintegration.h
index 6a72f4ad..ea212cea 100644
--- a/ScreenPlayWindow/src/macintegration.h
+++ b/ScreenPlayWindow/src/macintegration.h
@@ -1,15 +1,10 @@
-#ifndef MACINTEGRATION_H
-#define MACINTEGRATION_H
+#pragma oncer
#include
-
-class MacIntegration : public QObject
-{
+class MacIntegration : public QObject {
Q_OBJECT
public:
- explicit MacIntegration(QObject *parent);
+ explicit MacIntegration(QObject* parent);
void SetBackgroundLevel(QWindow* window);
};
-
-#endif // MACINTEGRATION_H
diff --git a/ScreenPlayWindow/src/winwindow.cpp b/ScreenPlayWindow/src/winwindow.cpp
index d739f08c..f8a48733 100644
--- a/ScreenPlayWindow/src/winwindow.cpp
+++ b/ScreenPlayWindow/src/winwindow.cpp
@@ -17,6 +17,10 @@ WinWindow::WinWindow(QVector& activeScreensList, QString projectPath, QStri
: BaseWindow(projectPath)
{
m_windowHandle = reinterpret_cast(m_window.winId());
+
+ if(!IsWindow(m_windowHandle)){
+ qFatal("Could not get a valid window handle!");
+ }
setAppID(id);
bool ok = false;
@@ -50,16 +54,25 @@ WinWindow::WinWindow(QVector& activeScreensList, QString projectPath, QStri
m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
m_window.rootContext()->setContextProperty("window", this);
m_window.rootContext()->setContextProperty("desktopProperties", &m_windowsDesktopProperties);
- m_window.setSource(QUrl("qrc:/qml/main.qml"));
+ // Instead of setting "renderType: Text.NativeRendering" every time
+ // we can set it here once :)
+ m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
+ m_window.setSource(QUrl("qrc:/mainWindow.qml"));
// Let QML decide when were are read to show the window
- ShowWindow(m_windowHandle, SW_HIDE);
+ //ShowWindow(m_windowHandle, SW_HIDE);
+
}
void WinWindow::setVisible(bool show)
{
+
if (show) {
ShowWindow(m_windowHandle, SW_SHOW);
+ if(!IsWindowVisible(m_windowHandle)){
+ qFatal("Could net set window visible!");
+ }
+
} else {
ShowWindow(m_windowHandle, SW_HIDE);
}
@@ -79,7 +92,6 @@ void WinWindow::destroyThis()
void WinWindow::messageReceived(QString key, QString value)
{
-
}
void WinWindow::calcOffsets()
diff --git a/ScreenPlayWindow/src/winwindow.h b/ScreenPlayWindow/src/winwindow.h
index 86cf72ea..3025956d 100644
--- a/ScreenPlayWindow/src/winwindow.h
+++ b/ScreenPlayWindow/src/winwindow.h
@@ -7,16 +7,15 @@
#include
#include
#include
-#include
-#include
-
-#include "windowsdesktopproperties.h"
#include
#include
+#include
+#include
#include
#include "basewindow.h"
+#include "windowsdesktopproperties.h"
class WinWindow : public BaseWindow {
Q_OBJECT
diff --git a/ScreenPlayWindow/test.qml b/ScreenPlayWindow/test.qml
new file mode 100644
index 00000000..c97b4742
--- /dev/null
+++ b/ScreenPlayWindow/test.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.12
+
+Rectangle {
+ anchors.fill: parent
+ color: Material.color(Material.Grey, Material.Shade800)
+
+ Text {
+ id: name
+ text: qsTr("This is a empty test window. You can change the source in test.qml")
+ font.pointSize: 32
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ anchors.fill: parent
+ anchors.margins: 10
+ color: "white"
+ }
+}
+
+/*##^## Designer {
+ D{i:0;autoSize:true;height:480;width:640}
+}
+ ##^##*/
+