mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Fix
This commit is contained in:
parent
e03cfd5b3c
commit
9764238ad1
@ -4,7 +4,7 @@ SUBDIRS += \
|
||||
ScreenPlaySDK/ScreenPlaySDK.pro \
|
||||
ScreenPlayWindow/ScreenPlayWindow.pro \
|
||||
ScreenPlayWidget/ScreenPlayWidget.pro \
|
||||
#ScreenPlay/ThirdParty/stomt-qt-sdk/sdk/stomt-qt-sdk.pro \
|
||||
ScreenPlay/ThirdParty/stomt-qt-sdk/sdk/stomt-qt-sdk.pro \
|
||||
|
||||
ScreenPlayWindow.depends = ScreenPlaySDK
|
||||
ScreenPlayWidget.depends = ScreenPlaySDK
|
||||
|
@ -139,16 +139,13 @@ Item {
|
||||
id: screenPlayItemImage
|
||||
anchors.fill: parent
|
||||
sourceImage: Qt.resolvedUrl(
|
||||
screenPlayItem.absoluteStoragePath
|
||||
+ "/" + screenPreview)
|
||||
screenPlayItem.absoluteStoragePath + "/" + screenPreview)
|
||||
sourceImageGIF: {
|
||||
if (screenPreviewGIF === undefined) {
|
||||
return ""
|
||||
} else {
|
||||
return Qt.resolvedUrl(
|
||||
screenPlayItem.absoluteStoragePath
|
||||
+ "/" + screenPreviewGIF)
|
||||
|
||||
screenPlayItem.absoluteStoragePath + "/" + screenPreviewGIF)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -176,7 +173,6 @@ Item {
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QDebug>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
|
||||
/*!
|
||||
\class Global QML Utilities
|
||||
|
@ -1,37 +1,38 @@
|
||||
#include "screenplay.h"
|
||||
|
||||
ScreenPlay::ScreenPlay(InstalledListModel* ilm, Settings* set, MonitorListModel* mlm, SDKConnector* sdkc, QObject* parent)
|
||||
: QObject{parent},
|
||||
m_ilm{ilm},
|
||||
m_settings{set},
|
||||
m_mlm{mlm},
|
||||
m_qGuiApplication{static_cast<QGuiApplication*>(QGuiApplication::instance())},
|
||||
m_sdkc{sdkc}
|
||||
{}
|
||||
: QObject { parent }
|
||||
, m_ilm { ilm }
|
||||
, m_settings { set }
|
||||
, m_mlm { mlm }
|
||||
, m_qGuiApplication { static_cast<QGuiApplication*>(QGuiApplication::instance()) }
|
||||
, m_sdkc { sdkc }
|
||||
{
|
||||
}
|
||||
|
||||
ScreenPlay::~ScreenPlay()
|
||||
{
|
||||
if(m_ilm) delete m_ilm;
|
||||
if(m_settings) delete m_settings;
|
||||
if(m_mlm) delete m_mlm;
|
||||
if(m_qGuiApplication) delete m_qGuiApplication;
|
||||
if(m_sdkc) delete m_sdkc;
|
||||
if (m_ilm)
|
||||
delete m_ilm;
|
||||
if (m_settings)
|
||||
delete m_settings;
|
||||
if (m_mlm)
|
||||
delete m_mlm;
|
||||
if (m_qGuiApplication)
|
||||
delete m_qGuiApplication;
|
||||
if (m_sdkc)
|
||||
delete m_sdkc;
|
||||
}
|
||||
|
||||
const InstalledListModel* ScreenPlay::listModelInstalled() const noexcept { return m_ilm; }
|
||||
const Settings* ScreenPlay::settings() const noexcept { return m_settings; }
|
||||
const MonitorListModel* ScreenPlay::monitorListModel() const noexcept { return m_mlm; }
|
||||
const QGuiApplication* ScreenPlay::guiApp() const noexcept { return m_qGuiApplication; }
|
||||
const SDKConnector* ScreenPlay::sdkConnector() const noexcept { return m_sdkc; }
|
||||
const std::vector<RefSPWall>& ScreenPlay::spWallList() const noexcept { return m_screenPlayWallpaperList; }
|
||||
const std::vector<RefSPWidget>& ScreenPlay::spWidgetList() const noexcept { return m_screenPlayWidgetList; }
|
||||
const Settings* ScreenPlay::settings() const noexcept { return m_settings; }
|
||||
|
||||
|
||||
void ScreenPlay::createWallpaper(
|
||||
const int monitorIndex, QUrl absoluteStoragePath,
|
||||
const QString& previewImage, const float volume,
|
||||
const QString& fillMode, const QString& type)
|
||||
const int monitorIndex, QUrl absoluteStoragePath,
|
||||
const QString& previewImage, const float volume,
|
||||
const QString& fillMode, const QString& type)
|
||||
{
|
||||
ProjectFile project{};
|
||||
ProjectFile project {};
|
||||
if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) {
|
||||
return;
|
||||
}
|
||||
@ -41,32 +42,30 @@ void ScreenPlay::createWallpaper(
|
||||
m_settings->increaseActiveWallpaperCounter();
|
||||
|
||||
m_screenPlayWallpaperList.emplace_back(
|
||||
RefSPWall::create(
|
||||
std::vector<int>{monitorIndex}, absoluteStoragePath.toLocalFile(),
|
||||
previewImage, volume, fillMode, type, this)
|
||||
);
|
||||
RefSPWall::create(
|
||||
std::vector<int> { monitorIndex }, absoluteStoragePath.toLocalFile(),
|
||||
previewImage, volume, fillMode, type, this));
|
||||
|
||||
m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex),
|
||||
QString{absoluteStoragePath.toLocalFile() + "/" + previewImage});
|
||||
QString { absoluteStoragePath.toLocalFile() + "/" + previewImage });
|
||||
}
|
||||
|
||||
void ScreenPlay::createWidget(QUrl absoluteStoragePath, const QString& previewImage)
|
||||
{
|
||||
ProjectFile project{};
|
||||
ProjectFile project {};
|
||||
if (!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath, &project)) {
|
||||
return;
|
||||
}
|
||||
m_screenPlayWidgetList.emplace_back(
|
||||
RefSPWidget::create(
|
||||
absoluteStoragePath.toLocalFile(), previewImage,
|
||||
QString{absoluteStoragePath.toLocalFile() + "/" + project.m_file.toString()},
|
||||
this)
|
||||
);
|
||||
RefSPWidget::create(
|
||||
absoluteStoragePath.toLocalFile(), previewImage,
|
||||
QString { absoluteStoragePath.toLocalFile() + "/" + project.m_file.toString() },
|
||||
this));
|
||||
}
|
||||
|
||||
void ScreenPlay::removeAllWallpaper() noexcept
|
||||
{
|
||||
if(m_sdkc && m_settings && !m_screenPlayWallpaperList.empty()){
|
||||
if (m_sdkc && m_settings && !m_screenPlayWallpaperList.empty()) {
|
||||
m_sdkc->closeAllWallpapers();
|
||||
m_settings->setActiveWallpaperCounter(0);
|
||||
m_screenPlayWallpaperList.clear();
|
||||
@ -77,12 +76,11 @@ void ScreenPlay::removeAllWallpaper() noexcept
|
||||
|
||||
void ScreenPlay::requestProjectSettingsListModelAt(const int index) const noexcept
|
||||
{
|
||||
for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) {
|
||||
if (!refSPWallpaper.data()->screenNumber().empty() &&
|
||||
refSPWallpaper.data()->screenNumber()[0] == index) { // ??? only at index == 0
|
||||
for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) {
|
||||
if (!refSPWallpaper.data()->screenNumber().empty() && refSPWallpaper.data()->screenNumber()[0] == index) { // ??? only at index == 0
|
||||
emit projectSettingsListModelFound(
|
||||
refSPWallpaper.data()->projectSettingsListModel().data(),
|
||||
refSPWallpaper.data()->type());
|
||||
refSPWallpaper.data()->projectSettingsListModel().data(),
|
||||
refSPWallpaper.data()->type());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -92,9 +90,8 @@ void ScreenPlay::requestProjectSettingsListModelAt(const int index) const noexce
|
||||
void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QString& value) noexcept
|
||||
{
|
||||
Q_ASSERT(static_cast<std::size_t>(at) < m_screenPlayWallpaperList.size() && m_sdkc);
|
||||
for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) {
|
||||
if (!refSPWallpaper.data()->screenNumber().empty() && m_sdkc &&
|
||||
refSPWallpaper.data()->screenNumber()[0] == at) { // ??? only at index == 0
|
||||
for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) {
|
||||
if (!refSPWallpaper.data()->screenNumber().empty() && m_sdkc && refSPWallpaper.data()->screenNumber()[0] == at) { // ??? only at index == 0
|
||||
m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value);
|
||||
return;
|
||||
}
|
||||
@ -104,8 +101,9 @@ void ScreenPlay::setWallpaperValue(const int at, const QString& key, const QStri
|
||||
void ScreenPlay::setAllWallpaperValue(const QString& key, const QString& value) noexcept
|
||||
{
|
||||
Q_ASSERT(m_sdkc);
|
||||
for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) {
|
||||
if(m_sdkc) m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value);
|
||||
for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) {
|
||||
if (m_sdkc)
|
||||
m_sdkc->setWallpaperValue(refSPWallpaper.data()->appID(), key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,41 +111,42 @@ void ScreenPlay::removeWallpaperAt(const int at)
|
||||
{
|
||||
// Q_ASSERT(at < m_screenPlayWallpaperList.size() && m_sdkc);
|
||||
qDebug() << "No of walls in list: " << m_screenPlayWallpaperList.size();
|
||||
if(m_screenPlayWallpaperList.empty()) return; // done here;
|
||||
if (m_screenPlayWallpaperList.empty())
|
||||
return; // done here;
|
||||
|
||||
const auto toRemove = std::remove_if(
|
||||
m_screenPlayWallpaperList.begin(), m_screenPlayWallpaperList.end(),
|
||||
[&](const RefSPWall& refSPWallpaper) noexcept ->bool {
|
||||
const std::vector<int>& screenNumber = refSPWallpaper->screenNumber();
|
||||
qDebug() << "Screen No. :" << screenNumber.size();
|
||||
const bool isFound = !screenNumber.empty();// && screenNumber[0] == at;
|
||||
if(isFound) {
|
||||
// m_mlm
|
||||
m_sdkc->closeWallpapersAt(at); // for waht ???
|
||||
m_settings->decreaseActiveWallpaperCounter();
|
||||
qDebug() << "current wall count... " << m_settings->activeWallpaperCounter();
|
||||
}
|
||||
return isFound;
|
||||
});
|
||||
m_screenPlayWallpaperList.begin(), m_screenPlayWallpaperList.end(),
|
||||
[&](const RefSPWall& refSPWallpaper) noexcept->bool {
|
||||
const std::vector<int>& screenNumber = refSPWallpaper->screenNumber();
|
||||
qDebug() << "Screen No. :" << screenNumber.size();
|
||||
const bool isFound = !screenNumber.empty(); // && screenNumber[0] == at;
|
||||
if (isFound) {
|
||||
// m_mlm
|
||||
m_sdkc->closeWallpapersAt(at); // for waht ???
|
||||
m_settings->decreaseActiveWallpaperCounter();
|
||||
qDebug() << "current wall count... " << m_settings->activeWallpaperCounter();
|
||||
}
|
||||
return isFound;
|
||||
});
|
||||
m_screenPlayWallpaperList.erase(toRemove, m_screenPlayWallpaperList.end());
|
||||
qDebug() << "After removing: No of walls in list: " << m_screenPlayWallpaperList.size();
|
||||
|
||||
}
|
||||
|
||||
std::vector<int> ScreenPlay::getMonitorByAppID(const QString& appID) const
|
||||
{
|
||||
for (const RefSPWall& refSPWallpaper: m_screenPlayWallpaperList) {
|
||||
for (const RefSPWall& refSPWallpaper : m_screenPlayWallpaperList) {
|
||||
if (refSPWallpaper.data()->appID() == appID) {
|
||||
return refSPWallpaper.data()->screenNumber();
|
||||
}
|
||||
}
|
||||
return std::vector<int>{};
|
||||
return std::vector<int> {};
|
||||
}
|
||||
|
||||
QString ScreenPlay::generateID() const
|
||||
{
|
||||
const QString possibleCharacters{
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"};
|
||||
const QString possibleCharacters {
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||
};
|
||||
const int randomStringLength = 32;
|
||||
const auto radomGen = QRandomGenerator::system();
|
||||
|
||||
@ -160,24 +159,23 @@ QString ScreenPlay::generateID() const
|
||||
return randomString;
|
||||
}
|
||||
|
||||
|
||||
ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector<int>& screenNumber, const QString& projectPath,
|
||||
const QString& previewImage, const float volume,
|
||||
const QString& fillMode, const QString& type, ScreenPlay *parent)
|
||||
: QObject{parent},
|
||||
m_screenNumber{std::move(screenNumber)},
|
||||
m_projectPath{projectPath},
|
||||
m_previewImage{previewImage},
|
||||
m_type{type},
|
||||
m_appID{ parent ? parent->generateID() : QString{} },
|
||||
m_process{nullptr},
|
||||
m_projectSettingsListModel{QSharedPointer<ProjectSettingsListModel>::create(projectPath + "/project.json")}
|
||||
const QString& previewImage, const float volume,
|
||||
const QString& fillMode, const QString& type, ScreenPlay* parent)
|
||||
: QObject { parent }
|
||||
, m_screenNumber { std::move(screenNumber) }
|
||||
, m_projectPath { projectPath }
|
||||
, m_previewImage { previewImage }
|
||||
, m_type { type }
|
||||
, m_appID { parent ? parent->generateID() : QString {} }
|
||||
, m_process { nullptr }
|
||||
, m_projectSettingsListModel { QSharedPointer<ProjectSettingsListModel>::create(projectPath + "/project.json") }
|
||||
{
|
||||
QStringList proArgs;
|
||||
proArgs.append(QString::number(m_screenNumber.empty() ? 0 : m_screenNumber[0]));
|
||||
proArgs.append(m_projectPath);
|
||||
proArgs.append("appID=" + m_appID);
|
||||
proArgs.append(parent ? parent->settings()->decoder() : QString{});
|
||||
proArgs.append(parent ? parent->settings()->decoder() : QString {});
|
||||
proArgs.append(QString::number(static_cast<double>(volume)));
|
||||
proArgs.append(fillMode);
|
||||
|
||||
@ -189,14 +187,13 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector<int>& screenNumber, c
|
||||
QProcess* m_process = new QProcess();
|
||||
|
||||
QObject::connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
[=](int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
if (exitCode != 0)
|
||||
qDebug() << "WARNING EXIT CODE: " << exitCode;
|
||||
});
|
||||
[=](int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
if (exitCode != 0)
|
||||
qDebug() << "WARNING EXIT CODE: " << exitCode;
|
||||
});
|
||||
QObject::connect(m_process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) {
|
||||
qDebug() << "EX: " << error;
|
||||
});
|
||||
qDebug() << "EX: " << error;
|
||||
});
|
||||
|
||||
m_process->setArguments(proArgs);
|
||||
m_process->setProgram(parent->settings()->screenPlayWindowPath().toString());
|
||||
@ -205,12 +202,13 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const std::vector<int>& screenNumber, c
|
||||
|
||||
ScreenPlayWallpaper::~ScreenPlayWallpaper()
|
||||
{
|
||||
if(m_process) delete m_process;
|
||||
if (m_process)
|
||||
delete m_process;
|
||||
}
|
||||
|
||||
const std::vector<int>& ScreenPlayWallpaper::screenNumber() const noexcept
|
||||
{
|
||||
return m_screenNumber;
|
||||
return m_screenNumber;
|
||||
}
|
||||
|
||||
const QString& ScreenPlayWallpaper::projectPath() const noexcept
|
||||
@ -241,7 +239,7 @@ const QSharedPointer<ProjectSettingsListModel>& ScreenPlayWallpaper::projectSett
|
||||
void ScreenPlayWallpaper::setScreenNumber(const std::vector<int>& screenNumber) noexcept
|
||||
{
|
||||
if (m_screenNumber == screenNumber)
|
||||
return;
|
||||
return;
|
||||
m_screenNumber = screenNumber;
|
||||
emit screenNumberChanged(m_screenNumber);
|
||||
}
|
||||
@ -249,7 +247,7 @@ void ScreenPlayWallpaper::setScreenNumber(const std::vector<int>& screenNumber)
|
||||
void ScreenPlayWallpaper::setProjectPath(const QString& projectPath) noexcept
|
||||
{
|
||||
if (m_projectPath == projectPath)
|
||||
return;
|
||||
return;
|
||||
|
||||
m_projectPath = projectPath;
|
||||
emit projectPathChanged(m_projectPath);
|
||||
@ -258,7 +256,7 @@ void ScreenPlayWallpaper::setProjectPath(const QString& projectPath) noexcept
|
||||
void ScreenPlayWallpaper::setPreviewImage(const QString& previewImage) noexcept
|
||||
{
|
||||
if (m_previewImage == previewImage)
|
||||
return;
|
||||
return;
|
||||
|
||||
m_previewImage = previewImage;
|
||||
emit previewImageChanged(m_previewImage);
|
||||
@ -267,54 +265,55 @@ void ScreenPlayWallpaper::setPreviewImage(const QString& previewImage) noexcept
|
||||
void ScreenPlayWallpaper::setType(const QString& type) noexcept
|
||||
{
|
||||
if (m_type == type)
|
||||
return;
|
||||
return;
|
||||
|
||||
m_type = type;
|
||||
emit typeChanged(m_type);
|
||||
m_type = type;
|
||||
emit typeChanged(m_type);
|
||||
}
|
||||
|
||||
void ScreenPlayWallpaper::setAppID(const QString& appID) noexcept
|
||||
{
|
||||
if (m_appID == appID)
|
||||
if (m_appID == appID)
|
||||
return;
|
||||
|
||||
m_appID = appID;
|
||||
emit appIDChanged(m_appID);
|
||||
m_appID = appID;
|
||||
emit appIDChanged(m_appID);
|
||||
}
|
||||
|
||||
ScreenPlayWidget::ScreenPlayWidget(const QString& projectPath, const QString& previewImage,
|
||||
const QString& fullPath, ScreenPlay *parent)
|
||||
: m_projectPath{projectPath},
|
||||
m_previewImage{previewImage},
|
||||
m_fullPath{fullPath},
|
||||
m_appID{parent ? parent->generateID() : QString{}},
|
||||
m_position{0, 0},
|
||||
m_process{nullptr}
|
||||
const QString& fullPath, ScreenPlay* parent)
|
||||
: m_projectPath { projectPath }
|
||||
, m_previewImage { previewImage }
|
||||
, m_fullPath { fullPath }
|
||||
, m_appID { parent ? parent->generateID() : QString {} }
|
||||
, m_position { 0, 0 }
|
||||
, m_process { nullptr }
|
||||
{
|
||||
QStringList proArgs;
|
||||
proArgs.append(m_projectPath);
|
||||
proArgs.append(m_appID);
|
||||
QStringList proArgs;
|
||||
proArgs.append(m_projectPath);
|
||||
proArgs.append(m_appID);
|
||||
|
||||
m_process = new QProcess(this); //PLS LESS BEHINDERT @Elias
|
||||
m_process->setArguments(proArgs);
|
||||
m_process = new QProcess(this); //PLS LESS BEHINDERT @Elias
|
||||
m_process->setArguments(proArgs);
|
||||
|
||||
if (fullPath.endsWith(".exe")) {
|
||||
if (fullPath.endsWith(".exe")) {
|
||||
m_process->setProgram(fullPath);
|
||||
} else if (fullPath.endsWith(".qml")) {
|
||||
} else if (fullPath.endsWith(".qml")) {
|
||||
m_process->setProgram(parent->settings()->getScreenPlayWidgetPath().path());
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << m_process->program();
|
||||
qDebug() << m_process->program();
|
||||
|
||||
QObject::connect(m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) {
|
||||
qDebug() << "error: " << error;
|
||||
});
|
||||
m_process->start();
|
||||
QObject::connect(m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) {
|
||||
qDebug() << "error: " << error;
|
||||
});
|
||||
m_process->start();
|
||||
}
|
||||
|
||||
ScreenPlayWidget::~ScreenPlayWidget()
|
||||
{
|
||||
if(m_process) delete m_process;
|
||||
if (m_process)
|
||||
delete m_process;
|
||||
}
|
||||
|
||||
const QString& ScreenPlayWidget::projectPath() const noexcept
|
||||
|
@ -27,36 +27,29 @@ class ScreenPlayWidget;
|
||||
using RefSPWall = QSharedPointer<ScreenPlayWallpaper>;
|
||||
using RefSPWidget = QSharedPointer<ScreenPlayWidget>;
|
||||
|
||||
class ScreenPlay final: public QObject {
|
||||
class ScreenPlay final : public QObject {
|
||||
Q_OBJECT
|
||||
private:
|
||||
InstalledListModel *const m_ilm{nullptr};
|
||||
Settings *const m_settings{nullptr};
|
||||
MonitorListModel *const m_mlm{nullptr};
|
||||
QGuiApplication *const m_qGuiApplication{nullptr};
|
||||
SDKConnector *const m_sdkc{nullptr};
|
||||
std::vector<RefSPWall> m_screenPlayWallpaperList;
|
||||
InstalledListModel* const m_ilm { nullptr };
|
||||
Settings* const m_settings { nullptr };
|
||||
MonitorListModel* const m_mlm { nullptr };
|
||||
QGuiApplication* const m_qGuiApplication { nullptr };
|
||||
SDKConnector* const m_sdkc { nullptr };
|
||||
std::vector<RefSPWall> m_screenPlayWallpaperList;
|
||||
std::vector<RefSPWidget> m_screenPlayWidgetList;
|
||||
|
||||
public:
|
||||
// constructor(s)
|
||||
explicit ScreenPlay(
|
||||
InstalledListModel* ilm, Settings* set,
|
||||
MonitorListModel* mlm, SDKConnector* sdkc,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
// copy and move disable(for now) : remember rule of 1/3/5
|
||||
Q_DISABLE_COPY_MOVE(ScreenPlay)
|
||||
|
||||
// destructor
|
||||
InstalledListModel* ilm, Settings* set,
|
||||
MonitorListModel* mlm, SDKConnector* sdkc,
|
||||
QObject* parent = nullptr);
|
||||
~ScreenPlay();
|
||||
|
||||
// getters
|
||||
const InstalledListModel* listModelInstalled() const noexcept;
|
||||
// copy and move disable(for now) : remember rule of 1/3/5
|
||||
//Q_DISABLE_COPY_MOVE(ScreenPlay)
|
||||
|
||||
const Settings* settings() const noexcept;
|
||||
const MonitorListModel* monitorListModel() const noexcept;
|
||||
const QGuiApplication* guiApp() const noexcept;
|
||||
const SDKConnector* sdkConnector() const noexcept;
|
||||
const std::vector<RefSPWall>& spWallList() const noexcept;
|
||||
const std::vector<RefSPWidget>& spWidgetList() const noexcept;
|
||||
|
||||
@ -67,9 +60,9 @@ signals:
|
||||
|
||||
public slots:
|
||||
void createWallpaper(
|
||||
const int monitorIndex, QUrl absoluteStoragePath,
|
||||
const QString& previewImage, const float volume,
|
||||
const QString& fillMode, const QString& type);
|
||||
const int monitorIndex, QUrl absoluteStoragePath,
|
||||
const QString& previewImage, const float volume,
|
||||
const QString& fillMode, const QString& type);
|
||||
void createWidget(QUrl absoluteStoragePath, const QString& previewImage);
|
||||
void removeAllWallpaper() noexcept;
|
||||
void requestProjectSettingsListModelAt(const int index) const noexcept;
|
||||
@ -85,7 +78,7 @@ public slots:
|
||||
\brief Used for ...
|
||||
*/
|
||||
|
||||
class ScreenPlayWallpaper final: public QObject {
|
||||
class ScreenPlayWallpaper final : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(std::vector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged)
|
||||
@ -100,22 +93,20 @@ private:
|
||||
QString m_previewImage;
|
||||
QString m_type;
|
||||
QString m_appID;
|
||||
QProcess *m_process;
|
||||
QProcess* m_process;
|
||||
QSharedPointer<ProjectSettingsListModel> m_projectSettingsListModel;
|
||||
|
||||
public:
|
||||
// constructor(s)
|
||||
explicit ScreenPlayWallpaper(const std::vector<int>& screenNumber, const QString& projectPath,
|
||||
const QString& previewImage, const float volume, const QString& fillMode,
|
||||
const QString& type, ScreenPlay *parent = nullptr);
|
||||
const QString& previewImage, const float volume, const QString& fillMode,
|
||||
const QString& type, ScreenPlay* parent = nullptr);
|
||||
|
||||
// copy and move disable(for now) : remember rule of 1/3/5
|
||||
Q_DISABLE_COPY_MOVE(ScreenPlayWallpaper)
|
||||
//Q_DISABLE_COPY_MOVE(ScreenPlayWallpaper)
|
||||
|
||||
// destructor
|
||||
~ScreenPlayWallpaper();
|
||||
|
||||
// getters
|
||||
const std::vector<int>& screenNumber() const noexcept;
|
||||
const QString& projectPath() const noexcept;
|
||||
const QString& previewImage() const noexcept;
|
||||
@ -144,7 +135,7 @@ public slots:
|
||||
\brief Used for ...
|
||||
*/
|
||||
|
||||
class ScreenPlayWidget final: public QObject {
|
||||
class ScreenPlayWidget final : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString projectPath READ projectPath WRITE setProjectPath NOTIFY projectPathChanged)
|
||||
@ -159,20 +150,18 @@ private:
|
||||
QString m_fullPath;
|
||||
QString m_appID;
|
||||
QPoint m_position;
|
||||
QProcess *m_process;
|
||||
QProcess* m_process;
|
||||
|
||||
public:
|
||||
// constructor(s)
|
||||
explicit ScreenPlayWidget(const QString& projectPath, const QString& previewImage,
|
||||
const QString& fullPath, ScreenPlay *parent = nullptr);
|
||||
const QString& fullPath, ScreenPlay* parent = nullptr);
|
||||
|
||||
// copy and move disable(for now) : remember rule of 1/3/5
|
||||
Q_DISABLE_COPY_MOVE(ScreenPlayWidget)
|
||||
//Q_DISABLE_COPY_MOVE(ScreenPlayWidget)
|
||||
|
||||
// destructor
|
||||
~ScreenPlayWidget();
|
||||
|
||||
// getters
|
||||
const QString& projectPath() const noexcept;
|
||||
const QString& previewImage() const noexcept;
|
||||
const QString& fullPath() const noexcept;
|
||||
|
@ -41,14 +41,16 @@ class SDKConnection : public QObject {
|
||||
Q_PROPERTY(QVector<int> monitor READ monitor WRITE setMonitor NOTIFY monitorChanged)
|
||||
|
||||
public:
|
||||
explicit SDKConnection(QLocalSocket* socket, QObject* parent = nullptr) : QObject(parent)
|
||||
explicit SDKConnection(QLocalSocket* socket, QObject* parent = nullptr)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
||||
m_socket = socket;
|
||||
connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead);
|
||||
connect(m_socket, &QLocalSocket::disconnected, this, &SDKConnection::close);
|
||||
}
|
||||
~SDKConnection (){
|
||||
~SDKConnection()
|
||||
{
|
||||
|
||||
// We need to call this manually because
|
||||
// sometimes it wont close the connection in
|
||||
@ -85,7 +87,8 @@ public slots:
|
||||
//Only use the first 32 chars for the appID
|
||||
m_appID = msg.remove("appID=").mid(0, 32);
|
||||
msg.remove(m_appID);
|
||||
qDebug() << "###### Wallpaper width APPID created:" << "\n######" << m_appID;
|
||||
qDebug() << "###### Wallpaper width APPID created:"
|
||||
<< "\n######" << m_appID;
|
||||
} else {
|
||||
qDebug() << "### Message from: " << m_appID << "\n###" << msg;
|
||||
}
|
||||
|
@ -101,6 +101,13 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
||||
m_localStoragePath = QUrl::fromUserInput(configObj.value("absoluteStoragePath").toString());
|
||||
}
|
||||
|
||||
|
||||
if (m_qSettings.value("ScreenPlayInstalledPath").isNull()) {
|
||||
m_qSettings.setValue("ScreenPlayInstalledPath", QDir::toNativeSeparators(m_localStoragePath.toString().remove("file:///")));
|
||||
m_qSettings.sync();
|
||||
}
|
||||
|
||||
|
||||
m_ilm->setabsoluteStoragePath(m_localStoragePath);
|
||||
m_plm->m_localStoragePath = m_localStoragePath;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#ifdef Q_OS_WIN
|
||||
#include <qt_windows.h>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class Settings
|
||||
\brief Used for:
|
||||
@ -98,9 +99,6 @@ public:
|
||||
return m_activeWallpaperCounter;
|
||||
}
|
||||
|
||||
QUrl getScreenPlayWindowPath() const;
|
||||
void setScreenPlayWindowPath(const QUrl& screenPlayWindowPath);
|
||||
|
||||
bool pauseWallpaperWhenIngame() const
|
||||
{
|
||||
return m_pauseWallpaperWhenIngame;
|
||||
@ -111,6 +109,9 @@ public:
|
||||
return m_offlineMode;
|
||||
}
|
||||
|
||||
QUrl getScreenPlayWindowPath() const;
|
||||
void setScreenPlayWindowPath(const QUrl& screenPlayWindowPath);
|
||||
|
||||
QUrl getScreenPlayBasePath() const;
|
||||
void setScreenPlayBasePath(QUrl screenPlayBasePath);
|
||||
|
||||
@ -118,6 +119,7 @@ public:
|
||||
void setScreenPlayWidgetPath(const QUrl& screenPlayWidgetPath);
|
||||
|
||||
bool getOfflineMode() const;
|
||||
void loadActiveProfiles();
|
||||
|
||||
signals:
|
||||
void autostartChanged(bool autostart);
|
||||
|
Loading…
Reference in New Issue
Block a user