mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-25 12:13:00 +01:00
Move sdk from qml to cpp
This commit is contained in:
parent
964b63f604
commit
152cdeba92
@ -3,12 +3,13 @@
|
||||
#include <QStringList>
|
||||
|
||||
#include "src/spwidgetmainwindow.h"
|
||||
#include "../ScreenPlaySDK/screenplaysdk.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
|
||||
ScreenPlaySDK sdk;
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
|
||||
@ -21,5 +22,8 @@ int main(int argc, char* argv[])
|
||||
SPWidgetmainwindow spwmw(argumentList.at(1), argumentList.at(2));
|
||||
//SPWidgetmainwindow spwmw("D:/672870/xkcd","asasasasd" );
|
||||
|
||||
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &spwmw, &SPWidgetmainwindow::destroyThis);
|
||||
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &spwmw, &SPWidgetmainwindow::messageReceived);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -19,6 +19,24 @@ SOURCES += \
|
||||
RESOURCES += \
|
||||
SPWidgetResources.qrc
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../../ThirdParty/ \
|
||||
$$PWD/../../src/ \
|
||||
|
||||
include(../ScreenPlaySDK/Screenplaysdk.pri)
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -lScreenplaysdkd
|
||||
install_it.path = $${OUT_PWD}/debug/
|
||||
QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK/debug
|
||||
} else {
|
||||
LIBS += -lScreenplaysdk
|
||||
install_it.path = $${OUT_PWD}/release/
|
||||
QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK/release
|
||||
}
|
||||
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"
|
||||
|
@ -8,7 +8,7 @@ Item {
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
id:bgColor
|
||||
id: bgColor
|
||||
anchors.fill: parent
|
||||
color: "white"
|
||||
//color: "#1A1F22"
|
||||
@ -23,7 +23,6 @@ Item {
|
||||
fillMode: Image.Tile
|
||||
}
|
||||
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
@ -35,31 +34,6 @@ Item {
|
||||
onPositionChanged: {
|
||||
backend.setPos(mouse.x, mouse.y)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ScreenPlaySDK {
|
||||
id: spSDK
|
||||
contentType: "ScreenPlayWindow"
|
||||
appID: backend.appID
|
||||
|
||||
onIncommingMessageError: {
|
||||
|
||||
}
|
||||
onIncommingMessage: {
|
||||
var obj2 = 'import QtQuick 2.9; Item {Component.onCompleted: sceneLoader.item.'
|
||||
+ key + ' = ' + value + '; }'
|
||||
var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
|
||||
newObject.destroy(10000)
|
||||
}
|
||||
|
||||
onSdkConnected: {
|
||||
|
||||
}
|
||||
|
||||
onSdkDisconnected: {
|
||||
Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
@ -69,6 +43,13 @@ Item {
|
||||
loader.source = Qt.resolvedUrl("file:///" + source)
|
||||
print(loader.source)
|
||||
}
|
||||
|
||||
onQmlSceneValueReceived: {
|
||||
var obj2 = 'import QtQuick 2.9; Item {Component.onCompleted: loader.item.'
|
||||
+ key + ' = ' + value + '; }'
|
||||
var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
|
||||
newObject.destroy(10000)
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "spwidgetmainwindow.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
SPWidgetmainwindow::SPWidgetmainwindow(QString projectPath, QString appid, QScreen* parent)
|
||||
: QWindow(parent)
|
||||
{
|
||||
@ -52,6 +54,16 @@ void SPWidgetmainwindow::setSize(QSize size)
|
||||
m_quickRenderer.data()->setHeight(size.height());
|
||||
}
|
||||
|
||||
void SPWidgetmainwindow::destroyThis()
|
||||
{
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
void SPWidgetmainwindow::messageReceived(QString key, QString value)
|
||||
{
|
||||
emit qmlSceneValueReceived(key, value);
|
||||
}
|
||||
|
||||
void SPWidgetmainwindow::setPos(int xPos, int yPos)
|
||||
{
|
||||
|
||||
|
@ -46,9 +46,12 @@ signals:
|
||||
void typeChanged(QString type);
|
||||
void projectConfigChanged(QString projectConfig);
|
||||
void setWidgetSource(QString source);
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user