mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Cleanup
This commit is contained in:
parent
b916734a73
commit
300f98aff0
@ -46,6 +46,7 @@ ApplicationWindow {
|
|||||||
sidebar.state = "inactive"
|
sidebar.state = "inactive"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: screenPlaySettings
|
target: screenPlaySettings
|
||||||
onSetMainWindowVisible: {
|
onSetMainWindowVisible: {
|
||||||
@ -112,11 +113,11 @@ ApplicationWindow {
|
|||||||
if (miMuteAll.isMuted) {
|
if (miMuteAll.isMuted) {
|
||||||
isMuted = false
|
isMuted = false
|
||||||
miMuteAll.text = qsTr("Mute all")
|
miMuteAll.text = qsTr("Mute all")
|
||||||
screenPlaySettings.setMuteAll(false)
|
screenPlay.setWallpaperValue(0, "volume", "1")
|
||||||
} else {
|
} else {
|
||||||
isMuted = true
|
isMuted = true
|
||||||
miMuteAll.text = qsTr("Unmute all")
|
miMuteAll.text = qsTr("Unmute all")
|
||||||
screenPlaySettings.setMuteAll(true)
|
screenPlay.setWallpaperValue(0, "volume", "0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,11 +129,11 @@ ApplicationWindow {
|
|||||||
if (miStopAll.isPlaying) {
|
if (miStopAll.isPlaying) {
|
||||||
isPlaying = false
|
isPlaying = false
|
||||||
miStopAll.text = qsTr("Pause all")
|
miStopAll.text = qsTr("Pause all")
|
||||||
screenPlaySettings.setPlayAll(true)
|
screenPlay.setWallpaperValue(0, "isPlaying", "false")
|
||||||
} else {
|
} else {
|
||||||
isPlaying = true
|
isPlaying = true
|
||||||
miStopAll.text = qsTr("Play all")
|
miStopAll.text = qsTr("Play all")
|
||||||
screenPlaySettings.setPlayAll(false)
|
screenPlay.setWallpaperValue(0, "isPlaying", "true")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,17 +182,6 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loader {
|
|
||||||
// id: pageLoaderCommunity
|
|
||||||
// visible: false
|
|
||||||
// asynchronous: true
|
|
||||||
// anchors {
|
|
||||||
// top: nav.bottom
|
|
||||||
// right: parent.right
|
|
||||||
// bottom: parent.bottom
|
|
||||||
// left: parent.left
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
Loader {
|
Loader {
|
||||||
id: pageLoaderWorkshop
|
id: pageLoaderWorkshop
|
||||||
visible: false
|
visible: false
|
||||||
@ -233,7 +223,7 @@ ApplicationWindow {
|
|||||||
} else {
|
} else {
|
||||||
sidebar.state = "activeWidget"
|
sidebar.state = "activeWidget"
|
||||||
}
|
}
|
||||||
}else if (type === "qmlScene") {
|
} else if (type === "qmlScene") {
|
||||||
if (sidebar.activeScreen == screenId
|
if (sidebar.activeScreen == screenId
|
||||||
&& sidebar.state == "activeScene") {
|
&& sidebar.state == "activeScene") {
|
||||||
sidebar.state = "inactive"
|
sidebar.state = "inactive"
|
||||||
|
@ -183,7 +183,7 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
id: txtHeadlineMonitor
|
id: txtHeadlineMonitor
|
||||||
text: qsTr("Select a Monitor to display the content")
|
text: qsTr("Select a Monitor to display the content")
|
||||||
height: 20
|
height: 50
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
@ -192,7 +192,7 @@ Item {
|
|||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
anchors {
|
anchors {
|
||||||
top: headlineWrapper.bottom
|
top: headlineWrapper.bottom
|
||||||
topMargin: 20
|
margins: 20
|
||||||
right: parent.right
|
right: parent.right
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
@ -289,6 +289,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
visible: false
|
||||||
id: txtComboBoxFillMode
|
id: txtComboBoxFillMode
|
||||||
text: qsTr("Fill Mode")
|
text: qsTr("Fill Mode")
|
||||||
height: 30
|
height: 30
|
||||||
@ -306,6 +307,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
|
visible: false
|
||||||
id: settingsComboBox
|
id: settingsComboBox
|
||||||
width: 200
|
width: 200
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ void InstalledListModel::loadScreens()
|
|||||||
if (!obj.contains("type")) {
|
if (!obj.contains("type")) {
|
||||||
obj.insert("type", "video");
|
obj.insert("type", "video");
|
||||||
}
|
}
|
||||||
if (fileEnding.endsWith(".webm"))
|
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene"))
|
||||||
emit addInstalledItem(obj, item.baseName());
|
emit addInstalledItem(obj, item.baseName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ QHash<int, QByteArray> ProjectSettingsListModel::roleNames() const
|
|||||||
|
|
||||||
void ProjectSettingsListModel::init(QString file)
|
void ProjectSettingsListModel::init(QString file)
|
||||||
{
|
{
|
||||||
qDebug() << file;
|
qDebug() << "ProjectSettingsListModel loading: " << file;
|
||||||
QFile configTmp;
|
QFile configTmp;
|
||||||
configTmp.setFileName(file);
|
configTmp.setFileName(file);
|
||||||
QJsonDocument configJsonDocument;
|
QJsonDocument configJsonDocument;
|
||||||
|
@ -106,6 +106,8 @@ QVector<int> ScreenPlay::getMonitorByAppID(QString appID)
|
|||||||
return m_screenPlayWallpaperList.at(i).data()->screenNumber();
|
return m_screenPlayWallpaperList.at(i).data()->screenNumber();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return QVector<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings* ScreenPlay::settings() const
|
Settings* ScreenPlay::settings() const
|
||||||
|
@ -9,12 +9,16 @@ SDKConnector::SDKConnector(QObject* parent)
|
|||||||
|
|
||||||
m_server = QSharedPointer<QLocalServer>(new QLocalServer(this));
|
m_server = QSharedPointer<QLocalServer>(new QLocalServer(this));
|
||||||
connect(m_server.data(), &QLocalServer::newConnection, this, &SDKConnector::newConnection);
|
connect(m_server.data(), &QLocalServer::newConnection, this, &SDKConnector::newConnection);
|
||||||
|
|
||||||
if (!m_server.data()->listen("ScreenPlay")) {
|
if (!m_server.data()->listen("ScreenPlay")) {
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDKConnector::readyRead()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void SDKConnector::newConnection()
|
void SDKConnector::newConnection()
|
||||||
{
|
{
|
||||||
m_clients.append(QSharedPointer<SDKConnection>(new SDKConnection(m_server.data()->nextPendingConnection())));
|
m_clients.append(QSharedPointer<SDKConnection>(new SDKConnection(m_server.data()->nextPendingConnection())));
|
||||||
@ -77,11 +81,6 @@ void SDKConnector::setSceneValue(QString appID, QString key, QString value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SDKConnection::setSocket(QLocalSocket* socket)
|
|
||||||
{
|
|
||||||
m_socket = socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLocalSocket* SDKConnection::socket() const
|
QLocalSocket* SDKConnection::socket() const
|
||||||
{
|
{
|
||||||
return m_socket;
|
return m_socket;
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void readyRead();
|
||||||
void newConnection();
|
void newConnection();
|
||||||
void closeAllWallpapers();
|
void closeAllWallpapers();
|
||||||
void closeWallpapersAt(int at);
|
void closeWallpapersAt(int at);
|
||||||
@ -56,7 +57,6 @@ public:
|
|||||||
qDebug() << "destroying SDKConnection Object";
|
qDebug() << "destroying SDKConnection Object";
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSocket(QLocalSocket* socket);
|
|
||||||
|
|
||||||
QString appID() const
|
QString appID() const
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "profilelistmodel.h"
|
#include "profilelistmodel.h"
|
||||||
#include "projectsettingslistmodel.h"
|
#include "projectsettingslistmodel.h"
|
||||||
#include "sdkconnector.h"
|
#include "sdkconnector.h"
|
||||||
#include "steam/steam_api.h"
|
#include "../ThirdParty/steam/steam_api.h"
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <qt_windows.h>
|
#include <qt_windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "steamworkshop.h"
|
#include "steamworkshop.h"
|
||||||
|
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include "cstring"
|
||||||
|
|
||||||
SteamWorkshop::SteamWorkshop(QObject* parent)
|
SteamWorkshop::SteamWorkshop(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
@ -97,6 +100,7 @@ void SteamWorkshop::submitWorkshopItem(QString title, QString description, QStri
|
|||||||
if (!jsonObject.contains("workshopid")) {
|
if (!jsonObject.contains("workshopid")) {
|
||||||
jsonObject.insert("workshopid", publishedFileId);
|
jsonObject.insert("workshopid", publishedFileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
projectConfig.close();
|
projectConfig.close();
|
||||||
// Reopen to empty the file via Truncate
|
// Reopen to empty the file via Truncate
|
||||||
projectConfig.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
projectConfig.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
||||||
@ -109,17 +113,21 @@ void SteamWorkshop::submitWorkshopItem(QString title, QString description, QStri
|
|||||||
SteamUGC()->SetItemUpdateLanguage(m_UGCUpdateHandle, QByteArray(language.toLatin1()).data());
|
SteamUGC()->SetItemUpdateLanguage(m_UGCUpdateHandle, QByteArray(language.toLatin1()).data());
|
||||||
SteamUGC()->SetItemContent(m_UGCUpdateHandle, QByteArray(absoluteContentPath.toLatin1()).data());
|
SteamUGC()->SetItemContent(m_UGCUpdateHandle, QByteArray(absoluteContentPath.toLatin1()).data());
|
||||||
SteamUGC()->SetItemPreview(m_UGCUpdateHandle, QByteArray(preview.toLatin1()).data());
|
SteamUGC()->SetItemPreview(m_UGCUpdateHandle, QByteArray(preview.toLatin1()).data());
|
||||||
auto tagList = new QScopedPointer<SteamParamStringArray_t>(new SteamParamStringArray_t);
|
|
||||||
|
|
||||||
//const char** cchKey[5][2000];
|
|
||||||
|
|
||||||
//tagList->data()->m_ppStrings = cchKey;
|
|
||||||
//tagList->data()->m_nNumStrings = 1;
|
|
||||||
//tagList->data()->m_ppStrings[1][0] = QByteArray("asas").data();
|
|
||||||
SteamUGC()->SetItemTags(m_UGCUpdateHandle, tagList->data());
|
|
||||||
|
|
||||||
auto visibility = static_cast<ERemoteStoragePublishedFileVisibility>(remoteStoragePublishedFileVisibility);
|
auto visibility = static_cast<ERemoteStoragePublishedFileVisibility>(remoteStoragePublishedFileVisibility);
|
||||||
SteamUGC()->SetItemVisibility(m_UGCUpdateHandle, visibility);
|
SteamUGC()->SetItemVisibility(m_UGCUpdateHandle, visibility);
|
||||||
|
|
||||||
|
auto tagList = new QScopedPointer<SteamParamStringArray_t>(new SteamParamStringArray_t);
|
||||||
|
|
||||||
|
int numStrings = 2;
|
||||||
|
tagList->data()->m_nNumStrings = numStrings;
|
||||||
|
const char *a[2];
|
||||||
|
a[0] = "Videos";
|
||||||
|
a[1] = "Scenes";
|
||||||
|
|
||||||
|
tagList->data()->m_ppStrings = a;
|
||||||
|
SteamUGC()->SetItemTags(m_UGCUpdateHandle, tagList->data());
|
||||||
|
|
||||||
SteamUGC()->SubmitItemUpdate(m_UGCUpdateHandle, nullptr);
|
SteamUGC()->SubmitItemUpdate(m_UGCUpdateHandle, nullptr);
|
||||||
|
|
||||||
emit remoteWorkshopCreationStatusChanged(RemoteWorkshopCreationStatus::Started);
|
emit remoteWorkshopCreationStatusChanged(RemoteWorkshopCreationStatus::Started);
|
||||||
@ -152,7 +160,6 @@ bool SteamWorkshop::contentFolderExist(QString folder)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SteamWorkshop::subscribeItem(unsigned int id)
|
void SteamWorkshop::subscribeItem(unsigned int id)
|
||||||
{
|
{
|
||||||
SteamUGC()->SubscribeItem(static_cast<unsigned long long>(id));
|
SteamUGC()->SubscribeItem(static_cast<unsigned long long>(id));
|
||||||
@ -178,7 +185,7 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
|
|||||||
if (bIOFailure)
|
if (bIOFailure)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//QtConcurrent::run([this, pCallback]() { });
|
QtConcurrent::run([this, &pCallback]() { });
|
||||||
|
|
||||||
SteamUGCDetails_t details;
|
SteamUGCDetails_t details;
|
||||||
const int urlLength = 200;
|
const int urlLength = 200;
|
||||||
@ -194,10 +201,11 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
|
|||||||
char* pchValue[cchValueSize];
|
char* pchValue[cchValueSize];
|
||||||
|
|
||||||
uint32 results = pCallback->m_unTotalMatchingResults;
|
uint32 results = pCallback->m_unTotalMatchingResults;
|
||||||
|
qDebug() << "ok " << results;
|
||||||
|
|
||||||
for (uint32 i = 0; i < results; i++) {
|
for (uint32 i = 0; i < results; i++) {
|
||||||
if (SteamUGC()->GetQueryUGCResult(pCallback->m_handle, i, &details)) {
|
if (SteamUGC()->GetQueryUGCResult(pCallback->m_handle, i, &details)) {
|
||||||
//qDebug() << "ok " << pCallback;
|
|
||||||
if (SteamUGC()->GetQueryUGCPreviewURL(pCallback->m_handle, i, url, static_cast<uint32>(urlLength))) {
|
if (SteamUGC()->GetQueryUGCPreviewURL(pCallback->m_handle, i, url, static_cast<uint32>(urlLength))) {
|
||||||
QByteArray urlData(url);
|
QByteArray urlData(url);
|
||||||
|
|
||||||
@ -223,7 +231,9 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
|
|||||||
qDebug() << "Loading error!";
|
qDebug() << "Loading error!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamUGC()->ReleaseQueryUGCRequest(pCallback->m_handle);
|
SteamUGC()->ReleaseQueryUGCRequest(pCallback->m_handle);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteamWorkshop::onWorkshopItemInstalled(ItemInstalled_t* itemInstalled)
|
void SteamWorkshop::onWorkshopItemInstalled(ItemInstalled_t* itemInstalled)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "steam/steam_api.h"
|
#include "../ThirdParty/steam/steam_api.h"
|
||||||
#include "steamworkshoplistmodel.h"
|
#include "steamworkshoplistmodel.h"
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
SteamWorkshopListModel::SteamWorkshopListModel(QObject* parent)
|
SteamWorkshopListModel::SteamWorkshopListModel(QObject* parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> SteamWorkshopListModel::roleNames() const
|
QHash<int, QByteArray> SteamWorkshopListModel::roleNames() const
|
||||||
@ -46,7 +45,7 @@ QVariant SteamWorkshopListModel::data(const QModelIndex& index, int role) const
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
if(row < 0 || row >= m_workshopItemList.count()) {
|
if (row < 0 || row >= m_workshopItemList.count()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,13 +67,12 @@ void SteamWorkshopListModel::append(unsigned int id, QString title, QUrl imgUrl,
|
|||||||
{
|
{
|
||||||
int row = 0;
|
int row = 0;
|
||||||
beginInsertRows(QModelIndex(), row, row);
|
beginInsertRows(QModelIndex(), row, row);
|
||||||
m_workshopItemList.append(QSharedPointer<WorkshopItem>(new WorkshopItem(id, title, imgUrl , "", numSubscriptions)));
|
m_workshopItemList.append(QSharedPointer<WorkshopItem>(new WorkshopItem(id, title, imgUrl, "", numSubscriptions)));
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteamWorkshopListModel::addWorkshopItem(WorkshopItem wi)
|
void SteamWorkshopListModel::addWorkshopItem(WorkshopItem wi)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl SteamWorkshopListModel::getBannerUrl()
|
QUrl SteamWorkshopListModel::getBannerUrl()
|
||||||
@ -106,7 +104,6 @@ void SteamWorkshopListModel::setBannerWorkshopItem(unsigned int id, QString titl
|
|||||||
m_workshopBannerItem.m_title = title;
|
m_workshopBannerItem.m_title = title;
|
||||||
m_workshopBannerItem.m_previewImageUrl = imgUrl;
|
m_workshopBannerItem.m_previewImageUrl = imgUrl;
|
||||||
m_workshopBannerItem.m_numSubscriptions = numSubscriptions;
|
m_workshopBannerItem.m_numSubscriptions = numSubscriptions;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SteamWorkshopListModel::setData(const QModelIndex& index, const QVariant& value, int role)
|
bool SteamWorkshopListModel::setData(const QModelIndex& index, const QVariant& value, int role)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
#include "workshopitem.h"
|
#include "workshopitem.h"
|
||||||
|
|
||||||
|
7
ScreenPlaySDK/Screenplaysdk.pri
Normal file
7
ScreenPlaySDK/Screenplaysdk.pri
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
SOURCES += \
|
||||||
|
$$PWD/screenplay-sdk_plugin.cpp \
|
||||||
|
$$PWD/screenplaysdk.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/screenplay-sdk_plugin.h \
|
||||||
|
$$PWD/screenplaysdk.h
|
@ -8,12 +8,12 @@ uri = net.aimber.screenplaysdk
|
|||||||
|
|
||||||
# Input
|
# Input
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
screenplay-sdk_plugin.cpp \
|
$$PWD/screenplay-sdk_plugin.cpp \
|
||||||
screenplaysdk.cpp
|
$$PWD/screenplaysdk.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
screenplay-sdk_plugin.h \
|
$$PWD/screenplay-sdk_plugin.h \
|
||||||
screenplaysdk.h
|
$$PWD/screenplaysdk.h
|
||||||
|
|
||||||
DISTFILES = qmldir
|
DISTFILES = qmldir
|
||||||
|
|
||||||
|
@ -1,21 +1,54 @@
|
|||||||
#include "screenplaysdk.h"
|
#include "screenplaysdk.h"
|
||||||
|
|
||||||
ScreenPlaySDK::ScreenPlaySDK(QQuickItem *parent):
|
// USE THIS ONLY FOR redirectMessageOutputToMainWindow
|
||||||
QQuickItem(parent)
|
static ScreenPlaySDK* global_sdkPtr = nullptr;
|
||||||
{
|
|
||||||
// By default, QQuickItem does not draw anything. If you subclass
|
|
||||||
// QQuickItem to create a visual item, you will need to uncomment the
|
|
||||||
// following line and re-implement updatePaintNode()
|
|
||||||
|
|
||||||
// setFlag(ItemHasContents, true);
|
void redirectMessageOutputToMainWindow(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||||
m_socket = QSharedPointer<QLocalSocket>(new QLocalSocket());
|
{
|
||||||
m_socket.data()->setServerName("ScreenPlay");
|
if (global_sdkPtr == nullptr)
|
||||||
QObject::connect(m_socket.data(), &QLocalSocket::connected, this, &ScreenPlaySDK::connected);
|
return;
|
||||||
QObject::connect(m_socket.data(), &QLocalSocket::disconnected, this, &ScreenPlaySDK::disconnected);
|
|
||||||
QObject::connect(m_socket.data(), &QLocalSocket::bytesWritten, this, &ScreenPlaySDK::bytesWritten);
|
QByteArray localMsg = msg.toLocal8Bit();
|
||||||
QObject::connect(m_socket.data(), &QLocalSocket::readyRead, this, &ScreenPlaySDK::readyRead);
|
QByteArray file = "File: " + QByteArray(context.file) + ", ";
|
||||||
QObject::connect(m_socket.data(), QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error), this, &ScreenPlaySDK::error);
|
QByteArray line = "in line " + QByteArray::number(context.line) + ", ";
|
||||||
m_socket.data()->connectToServer();
|
//QByteArray function = "function " + QByteArray(context.function) + ", Message: ";
|
||||||
|
|
||||||
|
localMsg = file + line + localMsg;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case QtDebugMsg:
|
||||||
|
localMsg = "Debug " /*+ QByteArray::fromStdString(global_sdkPtr->contentType().toStdString()) + " "*/ + localMsg;
|
||||||
|
global_sdkPtr->redirectMessage(localMsg);
|
||||||
|
break;
|
||||||
|
case QtInfoMsg:
|
||||||
|
//fprintf(stderr, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||||
|
break;
|
||||||
|
case QtWarningMsg:
|
||||||
|
//fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||||
|
break;
|
||||||
|
case QtCriticalMsg:
|
||||||
|
//fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||||
|
break;
|
||||||
|
case QtFatalMsg:
|
||||||
|
//(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScreenPlaySDK::ScreenPlaySDK(QQuickItem* parent)
|
||||||
|
: QQuickItem(parent)
|
||||||
|
{
|
||||||
|
global_sdkPtr = this;
|
||||||
|
m_socket.setServerName("ScreenPlay");
|
||||||
|
connect(&m_socket, &QLocalSocket::connected, this, &ScreenPlaySDK::connected);
|
||||||
|
connect(&m_socket, &QLocalSocket::disconnected, this, &ScreenPlaySDK::disconnected);
|
||||||
|
connect(&m_socket, &QLocalSocket::bytesWritten, this, &ScreenPlaySDK::bytesWritten);
|
||||||
|
connect(&m_socket, &QLocalSocket::readyRead, this, &ScreenPlaySDK::readyRead);
|
||||||
|
connect(&m_socket, QOverload<QLocalSocket::LocalSocketError>::of(&QLocalSocket::error), this, &ScreenPlaySDK::error);
|
||||||
|
m_socket.connectToServer();
|
||||||
|
|
||||||
|
// Redirect all messages from this to ScreenPlay
|
||||||
|
qInstallMessageHandler(redirectMessageOutputToMainWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenPlaySDK::~ScreenPlaySDK()
|
ScreenPlaySDK::~ScreenPlaySDK()
|
||||||
@ -36,14 +69,13 @@ void ScreenPlaySDK::disconnected()
|
|||||||
|
|
||||||
void ScreenPlaySDK::bytesWritten(qint64 bytes)
|
void ScreenPlaySDK::bytesWritten(qint64 bytes)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenPlaySDK::readyRead()
|
void ScreenPlaySDK::readyRead()
|
||||||
{
|
{
|
||||||
QString tmp = m_socket.data()->readAll();
|
QString tmp = m_socket.readAll();
|
||||||
QJsonParseError err;
|
QJsonParseError err;
|
||||||
auto doc = QJsonDocument::fromJson(QByteArray::fromStdString(tmp.toStdString()),&err);
|
auto doc = QJsonDocument::fromJson(QByteArray::fromStdString(tmp.toStdString()), &err);
|
||||||
|
|
||||||
if (!(err.error == QJsonParseError::NoError)) {
|
if (!(err.error == QJsonParseError::NoError)) {
|
||||||
emit incommingMessageError(err.errorString());
|
emit incommingMessageError(err.errorString());
|
||||||
@ -59,9 +91,15 @@ void ScreenPlaySDK::readyRead()
|
|||||||
|
|
||||||
void ScreenPlaySDK::error(QLocalSocket::LocalSocketError socketError)
|
void ScreenPlaySDK::error(QLocalSocket::LocalSocketError socketError)
|
||||||
{
|
{
|
||||||
emit sdkSocketError("Error");
|
if (socketError == QLocalSocket::LocalSocketError::ConnectionRefusedError) {
|
||||||
|
QCoreApplication::quit();
|
||||||
if(socketError == QLocalSocket::LocalSocketError::ConnectionRefusedError){
|
}
|
||||||
//QCoreApplication::quit();
|
}
|
||||||
|
|
||||||
|
void ScreenPlaySDK::redirectMessage(QByteArray& msg)
|
||||||
|
{
|
||||||
|
if (isConnected()) {
|
||||||
|
m_socket.write(msg);
|
||||||
|
m_socket.waitForBytesWritten();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,12 @@
|
|||||||
#include <QLocalServer>
|
#include <QLocalServer>
|
||||||
#include <QLocalSocket>
|
#include <QLocalSocket>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QPluginLoader>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QSharedDataPointer>
|
#include <QSharedDataPointer>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
class ScreenPlaySDK : public QQuickItem {
|
class ScreenPlaySDK : public QQuickItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -39,12 +41,14 @@ public:
|
|||||||
return m_appID;
|
return m_appID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void connected();
|
void connected();
|
||||||
void disconnected();
|
void disconnected();
|
||||||
void bytesWritten(qint64 bytes);
|
void bytesWritten(qint64 bytes);
|
||||||
void readyRead();
|
void readyRead();
|
||||||
void error(QLocalSocket::LocalSocketError socketError);
|
void error(QLocalSocket::LocalSocketError socketError);
|
||||||
|
void redirectMessage(QByteArray &msg);
|
||||||
|
|
||||||
void setContentType(QString contentType)
|
void setContentType(QString contentType)
|
||||||
{
|
{
|
||||||
@ -54,9 +58,9 @@ public slots:
|
|||||||
m_contentType = contentType;
|
m_contentType = contentType;
|
||||||
|
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
m_socket.data()->write(QByteArray(m_contentType.toLatin1()));
|
m_socket.write(QByteArray(m_contentType.toLatin1()));
|
||||||
m_socket.data()->flush();
|
m_socket.flush();
|
||||||
m_socket.data()->waitForBytesWritten();
|
m_socket.waitForBytesWritten();
|
||||||
}
|
}
|
||||||
emit contentTypeChanged(m_contentType);
|
emit contentTypeChanged(m_contentType);
|
||||||
}
|
}
|
||||||
@ -78,25 +82,28 @@ public slots:
|
|||||||
m_appID = appID;
|
m_appID = appID;
|
||||||
emit appIDChanged(m_appID);
|
emit appIDChanged(m_appID);
|
||||||
|
|
||||||
m_socket.data()->write(QByteArray(appID.toUtf8()));
|
m_socket.write(QByteArray(appID.toUtf8()));
|
||||||
m_socket.data()->waitForBytesWritten();
|
m_socket.waitForBytesWritten();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//qint64 writeData(const char *data, qint64 c) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void incommingMessage(QString key, QString value);
|
void incommingMessage(QString key, QString value);
|
||||||
void incommingMessageError(QString msg);
|
void incommingMessageError(QString msg);
|
||||||
|
|
||||||
void sdkConnected();
|
void sdkConnected();
|
||||||
void sdkDisconnected();
|
void sdkDisconnected();
|
||||||
void sdkSocketError(QString type);
|
|
||||||
|
|
||||||
void contentTypeChanged(QString contentType);
|
void contentTypeChanged(QString contentType);
|
||||||
void isConnectedChanged(bool isConnected);
|
void isConnectedChanged(bool isConnected);
|
||||||
|
|
||||||
void appIDChanged(QString appID);
|
void appIDChanged(QString appID);
|
||||||
|
void newRedirectMessage(QByteArray &msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<QLocalSocket> m_socket;
|
QLocalSocket m_socket;
|
||||||
|
|
||||||
QString m_contentType = "undefined";
|
QString m_contentType = "undefined";
|
||||||
bool m_isConnected = false;
|
bool m_isConnected = false;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>main.qml</file>
|
<file>main.qml</file>
|
||||||
<file>ScreenVideo.qml</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -1,29 +1,37 @@
|
|||||||
|
#include "../ScreenPlaySDK/screenplaysdk.h"
|
||||||
#include "src/SPWmainwindow.h"
|
#include "src/SPWmainwindow.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
ScreenPlaySDK sdk;
|
||||||
|
|
||||||
|
// 6 parameter + 1 OS working directory default paramter
|
||||||
QStringList argumentList = a.arguments();
|
QStringList argumentList = a.arguments();
|
||||||
|
|
||||||
if (argumentList.length() != 7) {
|
if (argumentList.length() != 7) {
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool canParseMonitorNumber = false;
|
||||||
int monitor = argumentList.at(1).toInt(&ok);
|
int monitor = argumentList.at(1).toInt(&canParseMonitorNumber);
|
||||||
|
|
||||||
if (!ok) {
|
if (!canParseMonitorNumber) {
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Args: which monitor, path to project, wallpaper secret to identify the connected socket
|
// Args: which monitor, (2) path to project, (3)wallpaper secret to identify the connected socket, (4) decoder, (5) volume, (6) fillmode
|
||||||
//MainWindow w(monitor, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5), argumentList.at(6));
|
// See screenplay.h @ScreenPlayWallpaper constructor how the args get created
|
||||||
//MainWindow w(0,"D:/672870/827148653","","","","");
|
// MainWindow w(0,"D:/672870/827148653","","","","");
|
||||||
|
qDebug() << "Starting: " << argumentList.at(2) << argumentList.at(3) << argumentList.at(4) << argumentList.at(5)<< argumentList.at(6);
|
||||||
MainWindow w(monitor, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5), argumentList.at(6));
|
MainWindow w(monitor, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5), argumentList.at(6));
|
||||||
|
|
||||||
|
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &w, &MainWindow::destroyThis);
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
QT += qml quick quickcontrols2 widgets core
|
QT += qml quick quickcontrols2 widgets core
|
||||||
CONFIG += c++17
|
CONFIG += c++17
|
||||||
#CONFIG += qtquickcompiler
|
CONFIG += qtquickcompiler
|
||||||
msvc: LIBS += -luser32
|
msvc: LIBS += -luser32
|
||||||
TARGETPATH = ScreenPlayWindow
|
TARGETPATH = ScreenPlayWindow
|
||||||
|
|
||||||
@ -18,15 +18,19 @@ RESOURCES += \
|
|||||||
|
|
||||||
INCLUDEPATH += \
|
INCLUDEPATH += \
|
||||||
$$PWD/../../ThirdParty/ \
|
$$PWD/../../ThirdParty/ \
|
||||||
$$PWD/../../src/\
|
$$PWD/../../src/ \
|
||||||
|
|
||||||
|
include(../ScreenPlaySDK/Screenplaysdk.pri)
|
||||||
|
LIBS += -lScreenplaysdk
|
||||||
|
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
install_it.path = $${OUT_PWD}/debug/
|
install_it.path = $${OUT_PWD}/debug/
|
||||||
|
QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK/debug
|
||||||
} else {
|
} else {
|
||||||
install_it.path = $${OUT_PWD}/release/
|
install_it.path = $${OUT_PWD}/release/
|
||||||
|
QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK/release
|
||||||
}
|
}
|
||||||
|
QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK
|
||||||
|
|
||||||
install_it.files += index.html \
|
install_it.files += index.html \
|
||||||
|
|
||||||
@ -52,3 +56,5 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
!isEmpty(target.path): INSTALLS += target
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,93 +0,0 @@
|
|||||||
import QtQuick 2.9
|
|
||||||
import QtAV 1.7
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: screenVideoPlayer
|
|
||||||
color: "black"
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
property string videoPath
|
|
||||||
property string decoder: "DXVA" //["CUDA", "VAAPI", "D3D11", "DXVA", "FFmpeg"]
|
|
||||||
property string fillMode
|
|
||||||
onFillModeChanged: {
|
|
||||||
if(fillMode === "Stretch"){
|
|
||||||
videoOut.fillMode = VideoOutput.Stretch
|
|
||||||
} else if(fillMode === "PreserveAspectFit"){
|
|
||||||
videoOut.fillMode = VideoOutput.PreserveAspectFit
|
|
||||||
} else if(fillMode === "PreserveAspectCrop"){
|
|
||||||
videoOut.fillMode = VideoOutput.PreserveAspectCrop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
property bool loops: true
|
|
||||||
property real volume: 0
|
|
||||||
|
|
||||||
onVideoPathChanged: {
|
|
||||||
player.source = Qt.resolvedUrl("file:///" + videoPath)
|
|
||||||
player.play()
|
|
||||||
}
|
|
||||||
|
|
||||||
property bool isPlaying: true
|
|
||||||
|
|
||||||
VideoOutput2 {
|
|
||||||
id: videoOut
|
|
||||||
anchors.fill: parent
|
|
||||||
source: player
|
|
||||||
opengl: true
|
|
||||||
fillMode: VideoOutput.Stretch
|
|
||||||
}
|
|
||||||
|
|
||||||
MediaPlayer {
|
|
||||||
id: player
|
|
||||||
videoCodecPriority: screenVideoPlayer.decoder
|
|
||||||
loops: MediaPlayer.Infinite
|
|
||||||
volume: screenVideoPlayer.volume
|
|
||||||
onPlaybackStateChanged: {
|
|
||||||
if (player.playbackState === MediaPlayer.PlayingState) {
|
|
||||||
state = "playing"
|
|
||||||
mainwindow.init()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: "playing"
|
|
||||||
PropertyChanges {
|
|
||||||
target: player
|
|
||||||
volume: screenVideoPlayer.volume
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "destroy"
|
|
||||||
PropertyChanges {
|
|
||||||
target: player
|
|
||||||
volume: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
transitions: [
|
|
||||||
Transition {
|
|
||||||
from: "*"
|
|
||||||
to: "playing"
|
|
||||||
reversible: true
|
|
||||||
|
|
||||||
NumberAnimation {
|
|
||||||
target: player
|
|
||||||
property: "volume"
|
|
||||||
duration: 1000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Transition {
|
|
||||||
from: "playing"
|
|
||||||
to: "destroy"
|
|
||||||
reversible: true
|
|
||||||
|
|
||||||
NumberAnimation {
|
|
||||||
target: player
|
|
||||||
property: "volume"
|
|
||||||
duration: 200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -17,7 +17,7 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<video id="videoPlayer" oncontextmenu="return false;" width="100%" height="100%" loop muted autoplay>
|
<video id="videoPlayer" oncontextmenu="return false;" width="100%" height="100%" loop autoplay>
|
||||||
<source id="videoSource" src="" type="video/webm" oncontextmenu="return false;" width="100%" height="100%"> Your browser does not support the video tag.
|
<source id="videoSource" src="" type="video/webm" oncontextmenu="return false;" width="100%" height="100%"> Your browser does not support the video tag.
|
||||||
</video>
|
</video>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtWebEngine 1.6
|
import QtWebEngine 1.6
|
||||||
import net.aimber.screenplaysdk 1.0
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@ -9,31 +8,6 @@ Rectangle {
|
|||||||
property string tmpVideoPath
|
property string tmpVideoPath
|
||||||
property var jsonProjectFile
|
property var jsonProjectFile
|
||||||
|
|
||||||
ScreenPlaySDK {
|
|
||||||
id: spSDK
|
|
||||||
contentType: "ScreenPlayWindow"
|
|
||||||
appID: mainwindow.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: {
|
|
||||||
mainwindow.destroyThis()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: mainwindow
|
target: mainwindow
|
||||||
|
|
||||||
@ -44,9 +18,6 @@ Rectangle {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onDecoderChanged: {
|
|
||||||
|
|
||||||
}
|
|
||||||
onFillModeChanged: {
|
onFillModeChanged: {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -54,29 +25,49 @@ Rectangle {
|
|||||||
|
|
||||||
}
|
}
|
||||||
onVolumeChanged: {
|
onVolumeChanged: {
|
||||||
|
if (webView.loadProgress === 100) {
|
||||||
|
webView.runJavaScript(
|
||||||
|
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + volume + ";")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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();")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WebEngineView {
|
WebEngineView {
|
||||||
id: webView
|
id: webView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
url: Qt.resolvedUrl("file:///" + mainwindow.getApplicationPath() + "/index.html")
|
url: Qt.resolvedUrl("file:///" + mainwindow.getApplicationPath(
|
||||||
|
) + "/index.html")
|
||||||
onLoadProgressChanged: {
|
onLoadProgressChanged: {
|
||||||
print(loadProgress)
|
|
||||||
if (loadProgress === 100) {
|
if (loadProgress === 100) {
|
||||||
runJavaScript("var videoPlayer = document.getElementById('videoPlayer');
|
runJavaScript(("
|
||||||
var videoSource = document.getElementById('videoSource');
|
var videoPlayer = document.getElementById('videoPlayer');
|
||||||
videoSource.src = \"file:///" + mainwindow.fullContentPath + "\";
|
var videoSource = document.getElementById('videoSource');
|
||||||
videoPlayer.load();", function(result) { mainwindow.init(); timer.start()});
|
videoSource.src = \"file:///" + mainwindow.fullContentPath + "\";
|
||||||
|
videoPlayer.load();
|
||||||
|
videoPlayer.volume = " + mainwindow.volume + ";"),
|
||||||
|
function (result) {
|
||||||
|
mainwindow.init()
|
||||||
|
timer.start()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onJavaScriptConsoleMessage: print(message)
|
onJavaScriptConsoleMessage: print(message)
|
||||||
settings.allowRunningInsecureContent: true
|
settings.allowRunningInsecureContent: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id:timer
|
id: timer
|
||||||
interval: 200
|
interval: 200
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
curtain.opacity = 0
|
curtain.opacity = 0
|
||||||
@ -86,12 +77,12 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id:curtain
|
id: curtain
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "black"
|
color: "black"
|
||||||
|
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
id:anim
|
id: anim
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
target: curtain
|
target: curtain
|
||||||
from: "1"
|
from: "1"
|
||||||
@ -99,5 +90,4 @@ Rectangle {
|
|||||||
duration: 300
|
duration: 300
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam)
|
|||||||
MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder, QString volume, QString fillmode, QScreen* parent)
|
MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder, QString volume, QString fillmode, QScreen* parent)
|
||||||
: QWindow(parent)
|
: QWindow(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
||||||
setOpacity(0);
|
setOpacity(0);
|
||||||
@ -45,7 +46,7 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
|
|||||||
if (!m_project.contains("type")) {
|
if (!m_project.contains("type")) {
|
||||||
if (m_project.contains("file")) {
|
if (m_project.contains("file")) {
|
||||||
QString fileEnding = m_project.value("file").toString();
|
QString fileEnding = m_project.value("file").toString();
|
||||||
if (fileEnding.endsWith(".mp4") || fileEnding.endsWith(".vp9") || fileEnding.endsWith(".webm")) {
|
if (fileEnding.endsWith(".webm")) {
|
||||||
m_project.insert("type", "video");
|
m_project.insert("type", "video");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +103,6 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Hide first to avoid flickering
|
//Hide first to avoid flickering
|
||||||
|
|
||||||
ShowWindow(m_worker_hwnd, SW_HIDE);
|
ShowWindow(m_worker_hwnd, SW_HIDE);
|
||||||
ShowWindow(m_hwnd, SW_HIDE);
|
ShowWindow(m_hwnd, SW_HIDE);
|
||||||
MoveWindow(m_hwnd, screen->geometry().x() + offsetX, screen->geometry().y() + offsetY, screen->size().width(), screen->size().height(), true);
|
MoveWindow(m_hwnd, screen->geometry().x() + offsetX, screen->geometry().y() + offsetY, screen->size().width(), screen->size().height(), true);
|
||||||
@ -122,7 +122,6 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
|
|||||||
m_quickRenderer.data()->setFlags(flags | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint);
|
m_quickRenderer.data()->setFlags(flags | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint);
|
||||||
m_quickRenderer.data()->show();
|
m_quickRenderer.data()->show();
|
||||||
|
|
||||||
setDecoder(decoder);
|
|
||||||
setVolume(volume.toFloat());
|
setVolume(volume.toFloat());
|
||||||
setFillMode(fillmode);
|
setFillMode(fillmode);
|
||||||
|
|
||||||
@ -132,7 +131,6 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void MainWindow::init()
|
void MainWindow::init()
|
||||||
@ -152,21 +150,33 @@ void MainWindow::setScreenNumber(const QVector<int>& screenNumber)
|
|||||||
{
|
{
|
||||||
m_screenNumber = screenNumber;
|
m_screenNumber = screenNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::connected()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::disconnected()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::bytesWritten(qint64 bytes)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::readyRead()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::error(QLocalSocket::LocalSocketError socketError)
|
||||||
|
{
|
||||||
|
}
|
||||||
void MainWindow::destroyThis()
|
void MainWindow::destroyThis()
|
||||||
{
|
{
|
||||||
QPropertyAnimation* animation = new QPropertyAnimation(this, "opacity");
|
|
||||||
animation->setDuration(500);
|
|
||||||
animation->setStartValue(1);
|
|
||||||
animation->setEndValue(0);
|
|
||||||
animation->start();
|
|
||||||
|
|
||||||
QObject::connect(animation, &QPropertyAnimation::finished, [&]() {
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
ShowWindow(m_worker_hwnd, SW_HIDE);
|
ShowWindow(m_worker_hwnd, SW_HIDE);
|
||||||
ShowWindow(m_hwnd, SW_HIDE);
|
ShowWindow(m_hwnd, SW_HIDE);
|
||||||
#endif
|
#endif
|
||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl MainWindow::projectPath() const
|
QUrl MainWindow::projectPath() const
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QEasingCurve>
|
#include <QEasingCurve>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
#include <QLocalSocket>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
@ -12,40 +13,38 @@
|
|||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
#include <QtGlobal>
|
||||||
#include <QtQuick/QQuickView>
|
#include <QtQuick/QQuickView>
|
||||||
#include <QtQuick/QQuickWindow>
|
#include <QtQuick/QQuickWindow>
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <qt_windows.h>
|
#include <qt_windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class MainWindow : public QWindow {
|
class MainWindow : public QWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(int i, QString projectPath, QString id, QString decoder,QString volume, QString fillmode, QScreen* parent = nullptr);
|
explicit MainWindow(int i, QString projectPath, QString id, QString decoder, QString volume, QString fillmode, QScreen* parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
|
||||||
Q_PROPERTY(QVector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged)
|
Q_PROPERTY(QVector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged)
|
||||||
Q_PROPERTY(QString projectConfig READ projectConfig WRITE setProjectConfig NOTIFY projectConfigChanged)
|
Q_PROPERTY(QString projectConfig READ projectConfig WRITE setProjectConfig NOTIFY projectConfigChanged)
|
||||||
Q_PROPERTY(QString appID READ name WRITE setname NOTIFY nameChanged)
|
Q_PROPERTY(QString appID READ name WRITE setname NOTIFY nameChanged)
|
||||||
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
|
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
|
||||||
|
|
||||||
Q_PROPERTY(QString decoder READ decoder WRITE setDecoder NOTIFY decoderChanged)
|
|
||||||
Q_PROPERTY(QString fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
|
Q_PROPERTY(QString fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
|
||||||
Q_PROPERTY(bool loops READ loops WRITE setLoops NOTIFY loopsChanged)
|
Q_PROPERTY(bool loops READ loops WRITE setLoops NOTIFY loopsChanged)
|
||||||
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
|
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
|
||||||
Q_PROPERTY(QString fullContentPath READ fullContentPath WRITE setFullContentPath NOTIFY fullContentPathChanged)
|
Q_PROPERTY(QString fullContentPath READ fullContentPath WRITE setFullContentPath NOTIFY fullContentPathChanged)
|
||||||
|
Q_PROPERTY(bool isPlaying READ isPlaying WRITE setIsPlaying NOTIFY isPlayingChanged)
|
||||||
|
|
||||||
QString projectConfig() const
|
QString projectConfig() const
|
||||||
{
|
{
|
||||||
return m_projectConfig;
|
return m_projectConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString name() const
|
QString name() const
|
||||||
{
|
{
|
||||||
return m_appID;
|
return m_appID;
|
||||||
@ -64,9 +63,7 @@ public:
|
|||||||
return m_type;
|
return m_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setScreenNumber(const QVector<int> &screenNumber);
|
void setScreenNumber(const QVector<int>& screenNumber);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString fillMode() const
|
QString fillMode() const
|
||||||
{
|
{
|
||||||
@ -83,17 +80,21 @@ public:
|
|||||||
return m_volume;
|
return m_volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString decoder() const
|
|
||||||
{
|
|
||||||
return m_decoder;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString fullContentPath() const
|
QString fullContentPath() const
|
||||||
{
|
{
|
||||||
return m_fullContentPath;
|
return m_fullContentPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isPlaying() const
|
||||||
|
{
|
||||||
|
return m_isPlaying;
|
||||||
|
}
|
||||||
public slots:
|
public slots:
|
||||||
|
void connected();
|
||||||
|
void disconnected();
|
||||||
|
void bytesWritten(qint64 bytes);
|
||||||
|
void readyRead();
|
||||||
|
void error(QLocalSocket::LocalSocketError socketError);
|
||||||
void destroyThis();
|
void destroyThis();
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
@ -106,7 +107,6 @@ public slots:
|
|||||||
emit projectConfigChanged(m_projectConfig);
|
emit projectConfigChanged(m_projectConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setname(QString appID)
|
void setname(QString appID)
|
||||||
{
|
{
|
||||||
if (m_appID == appID)
|
if (m_appID == appID)
|
||||||
@ -153,15 +153,6 @@ public slots:
|
|||||||
emit volumeChanged(m_volume);
|
emit volumeChanged(m_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDecoder(QString decoder)
|
|
||||||
{
|
|
||||||
if (m_decoder == decoder)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_decoder = decoder;
|
|
||||||
emit decoderChanged(m_decoder);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString getApplicationPath();
|
QString getApplicationPath();
|
||||||
|
|
||||||
void setFullContentPath(QString fullContentPath)
|
void setFullContentPath(QString fullContentPath)
|
||||||
@ -173,6 +164,15 @@ public slots:
|
|||||||
emit fullContentPathChanged(m_fullContentPath);
|
emit fullContentPathChanged(m_fullContentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setIsPlaying(bool isPlaying)
|
||||||
|
{
|
||||||
|
if (m_isPlaying == isPlaying)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_isPlaying = isPlaying;
|
||||||
|
emit isPlayingChanged(m_isPlaying);
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void playVideo(QString path);
|
void playVideo(QString path);
|
||||||
void playQmlScene(QString file);
|
void playQmlScene(QString file);
|
||||||
@ -183,20 +183,21 @@ signals:
|
|||||||
void fillModeChanged(QString fillMode);
|
void fillModeChanged(QString fillMode);
|
||||||
void loopsChanged(bool loops);
|
void loopsChanged(bool loops);
|
||||||
void volumeChanged(float volume);
|
void volumeChanged(float volume);
|
||||||
void decoderChanged(QString decoder);
|
|
||||||
|
|
||||||
void fullContentPathChanged(QString fullContentPath);
|
void fullContentPathChanged(QString fullContentPath);
|
||||||
|
|
||||||
|
void isPlayingChanged(bool isPlaying);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
HWND m_hwnd;
|
HWND m_hwnd;
|
||||||
HWND m_worker_hwnd;
|
HWND m_worker_hwnd;
|
||||||
#endif
|
#endif
|
||||||
QSharedPointer<QQuickView> m_quickRenderer = nullptr;
|
QSharedPointer<QQuickView> m_quickRenderer = nullptr;
|
||||||
QUrl m_projectPath;
|
QUrl m_projectPath;
|
||||||
QString m_projectFile;
|
QString m_projectFile;
|
||||||
QJsonObject m_project;
|
QJsonObject m_project;
|
||||||
QString m_projectConfig;
|
QString m_projectConfig;
|
||||||
|
QSharedPointer<QLocalSocket> m_socket;
|
||||||
|
|
||||||
QString m_appID;
|
QString m_appID;
|
||||||
QVector<int> m_screenNumber;
|
QVector<int> m_screenNumber;
|
||||||
@ -204,6 +205,6 @@ private:
|
|||||||
QString m_fillMode;
|
QString m_fillMode;
|
||||||
bool m_loops;
|
bool m_loops;
|
||||||
float m_volume;
|
float m_volume;
|
||||||
QString m_decoder;
|
|
||||||
QString m_fullContentPath;
|
QString m_fullContentPath;
|
||||||
|
bool m_isPlaying;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user