mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-25 04:02:50 +01:00
WIP refactoring namespace enums into enum classes
This commit is contained in:
parent
dfe9e60c46
commit
d15e670cb3
@ -30,9 +30,9 @@ Rectangle {
|
||||
Button {
|
||||
text: "Exit"
|
||||
onClicked: {
|
||||
Qt.callLater(function () {
|
||||
Wallpaper.terminate();
|
||||
});
|
||||
Qt.callLater(function () {
|
||||
Wallpaper.terminate();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ set(HEADER
|
||||
set(QML
|
||||
# cmake-format: sort
|
||||
main.qml
|
||||
qml/Community/Community.qml
|
||||
qml/Community/CommunityView.qml
|
||||
qml/Community/CommunityNavItem.qml
|
||||
qml/Community/XMLNewsfeed.qml
|
||||
qml/Create/Create.qml
|
||||
qml/Create/CreateView.qml
|
||||
qml/Create/CreateSidebar.qml
|
||||
qml/Create/StartInfo.qml
|
||||
qml/Create/StartInfoLinkImage.qml
|
||||
@ -77,14 +77,14 @@ set(QML
|
||||
qml/Create/Wizards/QMLWidget.qml
|
||||
qml/Create/Wizards/WebsiteWallpaper.qml
|
||||
qml/Create/Wizards/WizardPage.qml
|
||||
qml/Installed/Installed.qml
|
||||
qml/Installed/InstalledView.qml
|
||||
qml/Installed/InstalledNavigation.qml
|
||||
qml/Installed/InstalledWelcomeScreen.qml
|
||||
qml/Installed/ScreenPlayItem.qml
|
||||
qml/Installed/ScreenPlayItemImage.qml
|
||||
qml/Installed/Sidebar.qml
|
||||
qml/Monitors/DefaultVideoControls.qml
|
||||
qml/Monitors/Monitors.qml
|
||||
qml/Monitors/MonitorsView.qml
|
||||
qml/Monitors/MonitorSelection.qml
|
||||
qml/Monitors/MonitorSelectionItem.qml
|
||||
qml/Monitors/MonitorsProjectSettingItem.qml
|
||||
@ -92,7 +92,7 @@ set(QML
|
||||
qml/Navigation/ExitPopup.qml
|
||||
qml/Navigation/Navigation.qml
|
||||
qml/Settings/SettingBool.qml
|
||||
qml/Settings/Settings.qml
|
||||
qml/Settings/SettingsView.qml
|
||||
qml/Settings/SettingsButton.qml
|
||||
qml/Settings/SettingsComboBox.qml
|
||||
qml/Settings/SettingsExpander.qml
|
||||
@ -100,7 +100,7 @@ set(QML
|
||||
qml/Settings/SettingsHorizontalSeperator.qml
|
||||
qml/Settings/SettingsPage.qml
|
||||
qml/TrayIcon.qml
|
||||
qml/Workshop/Workshop.qml)
|
||||
qml/Workshop/WorkshopView.qml)
|
||||
|
||||
set(TS_FILES
|
||||
# cmake-format: sort
|
||||
@ -276,8 +276,20 @@ find_package(
|
||||
Test)
|
||||
|
||||
add_library(ScreenPlayApp STATIC)
|
||||
|
||||
target_include_directories(
|
||||
ScreenPlayApp
|
||||
PUBLIC inc/public/
|
||||
PRIVATE src/)
|
||||
|
||||
# Note making this public is so that *_qmltyperegistrations.cpp
|
||||
# can find the needed include
|
||||
target_include_directories(ScreenPlayApp PUBLIC src/ inc/public/ScreenPlay)
|
||||
|
||||
# ScreenPlayApp is our qml module needed for compiling
|
||||
# of all classes and most importanly for QML_ELEMENT.
|
||||
# So our app is mostly a module that then link to
|
||||
# ScreenPlay executable.
|
||||
qt_add_qml_module(
|
||||
ScreenPlayApp
|
||||
URI
|
||||
@ -335,11 +347,6 @@ if(${SCREENPLAY_TESTS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(
|
||||
ScreenPlayApp
|
||||
PUBLIC inc/public/
|
||||
PRIVATE src/)
|
||||
|
||||
if(WIN32
|
||||
OR UNIX
|
||||
AND NOT APPLE)
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ScreenPlay/createimportstates.h"
|
||||
#include "ScreenPlay/createimportvideo.h"
|
||||
#include "ScreenPlay/globalvariables.h"
|
||||
|
||||
@ -33,6 +34,7 @@ class Create : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
|
||||
|
||||
Q_PROPERTY(QString workingDir READ workingDir WRITE setWorkingDir NOTIFY workingDirChanged)
|
||||
Q_PROPERTY(float progress READ progress WRITE setProgress NOTIFY progressChanged)
|
||||
@ -56,7 +58,7 @@ public:
|
||||
QString ffmpegOutput() const { return m_ffmpegOutput; }
|
||||
|
||||
signals:
|
||||
void createWallpaperStateChanged(ImportVideoState::ImportVideoState state);
|
||||
void createWallpaperStateChanged(Import::State state);
|
||||
void progressChanged(float progress);
|
||||
void abortCreateWallpaper();
|
||||
void workingDirChanged(QString workingDir);
|
||||
@ -113,7 +115,6 @@ public slots:
|
||||
}
|
||||
|
||||
private:
|
||||
void init();
|
||||
void reset();
|
||||
|
||||
private:
|
||||
|
@ -3,17 +3,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
|
||||
namespace ScreenPlay {
|
||||
/*!
|
||||
\namespace ScreenPlay::ImportVideoState
|
||||
\inmodule ScreenPlay
|
||||
\brief Global enum for ImportVideoState.
|
||||
*/
|
||||
namespace ImportVideoState {
|
||||
Q_NAMESPACE
|
||||
|
||||
enum class ImportVideoState {
|
||||
class Import : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
|
||||
public:
|
||||
enum class State {
|
||||
Idle,
|
||||
Started,
|
||||
AnalyseVideo,
|
||||
@ -49,6 +48,6 @@ namespace ImportVideoState {
|
||||
Finished,
|
||||
Failed,
|
||||
};
|
||||
Q_ENUM_NS(ImportVideoState)
|
||||
}
|
||||
Q_ENUM(State)
|
||||
};
|
||||
}
|
||||
|
@ -24,24 +24,27 @@ namespace ScreenPlay {
|
||||
|
||||
class CreateImportVideo : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
|
||||
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
|
||||
Q_PROPERTY(float progress READ progress WRITE setProgress NOTIFY progressChanged)
|
||||
|
||||
public:
|
||||
explicit CreateImportVideo(const QString& videoPath, const QString& exportPath, const QString& codec, const int quality, std::atomic<bool>& interrupt);
|
||||
explicit CreateImportVideo(const QString& videoPath, const QString& exportPath, std::atomic<bool>& interrupt);
|
||||
|
||||
enum class Executable {
|
||||
FFMPEG,
|
||||
FFPROBE
|
||||
};
|
||||
Q_ENUM(Executable)
|
||||
|
||||
float progress() const { return m_progress; }
|
||||
|
||||
bool m_skipAudio { false };
|
||||
|
||||
// If the video is < 1s in duration we cannot create a 5s preview
|
||||
bool m_smallVideo { false };
|
||||
|
||||
// We do not get many infos with this
|
||||
bool m_isWebm { false };
|
||||
|
||||
float m_progress { 0.0F };
|
||||
|
||||
QString m_videoPath;
|
||||
@ -54,13 +57,8 @@ public:
|
||||
int m_length { 0 };
|
||||
int m_framerate { 0 };
|
||||
|
||||
enum class Executable {
|
||||
FFMPEG,
|
||||
FFPROBE
|
||||
};
|
||||
|
||||
signals:
|
||||
void createWallpaperStateChanged(ImportVideoState::ImportVideoState state);
|
||||
void createWallpaperStateChanged(ScreenPlay::Import::State state);
|
||||
void processOutput(QString text);
|
||||
void finished();
|
||||
void abortAndCleanup();
|
||||
@ -104,4 +102,3 @@ private:
|
||||
std::atomic<bool>& m_interrupt;
|
||||
};
|
||||
}
|
||||
Q_DECLARE_METATYPE(ScreenPlay::ImportVideoState::ImportVideoState)
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
InstalledListFilter(const std::shared_ptr<InstalledListModel>& ilm);
|
||||
|
||||
public slots:
|
||||
void sortBySearchType(const ScreenPlay::SearchType::SearchType searchType);
|
||||
void sortBySearchType(const ScreenPlay::ContentTypes::SearchType searchType);
|
||||
void setSortOrder(const Qt::SortOrder sortOrder);
|
||||
void sortByName(const QString& name);
|
||||
void resetFilter();
|
||||
@ -29,7 +29,7 @@ signals:
|
||||
|
||||
private:
|
||||
const std::shared_ptr<InstalledListModel> m_ilm;
|
||||
ScreenPlay::SearchType::SearchType m_searchType = ScreenPlay::SearchType::SearchType::All;
|
||||
ScreenPlay::ContentTypes::SearchType m_searchType = ScreenPlay::ContentTypes::SearchType::All;
|
||||
Qt::SortOrder m_sortOrder = Qt::SortOrder::DescendingOrder;
|
||||
};
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ class MonitorListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
|
||||
|
||||
public:
|
||||
explicit MonitorListModel(QObject* parent = nullptr);
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
Q_ENUM(ProjectSettingsRole)
|
||||
|
||||
QJsonObject getActiveSettingsJson();
|
||||
void init(const InstalledType::InstalledType& type, const QJsonObject& properties);
|
||||
void init(const ContentTypes::InstalledType& type, const QJsonObject& properties);
|
||||
void append(const SettingsItem&& item);
|
||||
|
||||
public slots:
|
||||
|
@ -58,8 +58,8 @@ private slots:
|
||||
public slots:
|
||||
// moc needs full enum namespace info see QTBUG-58454
|
||||
bool createWallpaper(
|
||||
const ScreenPlay::InstalledType::InstalledType type,
|
||||
const ScreenPlay::FillMode::FillMode fillMode,
|
||||
const ScreenPlay::ContentTypes::InstalledType type,
|
||||
const ScreenPlay::Video::FillMode fillMode,
|
||||
const QString& absoluteStoragePath,
|
||||
const QString& previewImage,
|
||||
const QString& file,
|
||||
@ -70,7 +70,7 @@ public slots:
|
||||
const bool saveToProfilesConfigFile);
|
||||
|
||||
bool createWidget(
|
||||
const ScreenPlay::InstalledType::InstalledType type,
|
||||
const ScreenPlay::ContentTypes::InstalledType type,
|
||||
const QPoint& position,
|
||||
const QString& absoluteStoragePath,
|
||||
const QString& previewImage,
|
||||
|
@ -33,8 +33,8 @@ class ScreenPlayWallpaper : public QObject {
|
||||
Q_PROPERTY(QString absolutePath READ absolutePath WRITE setAbsolutePath NOTIFY absolutePathChanged)
|
||||
Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged)
|
||||
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
|
||||
Q_PROPERTY(FillMode::FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
|
||||
Q_PROPERTY(InstalledType::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
Q_PROPERTY(Video::FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
|
||||
Q_PROPERTY(ContentTypes::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
|
||||
public:
|
||||
explicit ScreenPlayWallpaper(
|
||||
@ -46,8 +46,8 @@ public:
|
||||
const QString& file,
|
||||
const float volume,
|
||||
const float playbackRate,
|
||||
const FillMode::FillMode fillMode,
|
||||
const InstalledType::InstalledType type,
|
||||
const Video::FillMode fillMode,
|
||||
const ContentTypes::InstalledType type,
|
||||
const QJsonObject& properties,
|
||||
const std::shared_ptr<Settings>& settings,
|
||||
QObject* parent = nullptr);
|
||||
@ -59,8 +59,8 @@ public:
|
||||
const QString& previewImage,
|
||||
const QString& file,
|
||||
const float volume,
|
||||
const FillMode::FillMode fillMode,
|
||||
const InstalledType::InstalledType type,
|
||||
const Video::FillMode fillMode,
|
||||
const ContentTypes::InstalledType type,
|
||||
const bool checkWallpaperVisible);
|
||||
|
||||
void setSDKConnection(std::unique_ptr<SDKConnection> connection);
|
||||
@ -70,9 +70,9 @@ public:
|
||||
QVector<int> screenNumber() const { return m_screenNumber; }
|
||||
QString previewImage() const { return m_previewImage; }
|
||||
QString appID() const { return m_appID; }
|
||||
InstalledType::InstalledType type() const { return m_type; }
|
||||
ContentTypes::InstalledType type() const { return m_type; }
|
||||
QString file() const { return m_file; }
|
||||
FillMode::FillMode fillMode() const { return m_fillMode; }
|
||||
Video::FillMode fillMode() const { return m_fillMode; }
|
||||
QString absolutePath() const { return m_absolutePath; }
|
||||
float volume() const { return m_volume; }
|
||||
bool isLooping() const { return m_isLooping; }
|
||||
@ -84,9 +84,9 @@ signals:
|
||||
void screenNumberChanged(QVector<int> screenNumber);
|
||||
void previewImageChanged(QString previewImage);
|
||||
void appIDChanged(QString appID);
|
||||
void typeChanged(InstalledType::InstalledType type);
|
||||
void typeChanged(ContentTypes::InstalledType type);
|
||||
void fileChanged(QString file);
|
||||
void fillModeChanged(FillMode::FillMode fillMode);
|
||||
void fillModeChanged(Video::FillMode fillMode);
|
||||
void absolutePathChanged(QString absolutePath);
|
||||
void profileJsonObjectChanged(QJsonObject profileJsonObject);
|
||||
void volumeChanged(float volume);
|
||||
@ -132,7 +132,7 @@ public slots:
|
||||
emit appIDChanged(m_appID);
|
||||
}
|
||||
|
||||
void setType(InstalledType::InstalledType type)
|
||||
void setType(ContentTypes::InstalledType type)
|
||||
{
|
||||
if (m_type == type)
|
||||
return;
|
||||
@ -150,7 +150,7 @@ public slots:
|
||||
emit fileChanged(m_file);
|
||||
}
|
||||
|
||||
void setFillMode(FillMode::FillMode fillMode)
|
||||
void setFillMode(Video::FillMode fillMode)
|
||||
{
|
||||
if (m_fillMode == fillMode)
|
||||
return;
|
||||
@ -219,8 +219,8 @@ private:
|
||||
QVector<int> m_screenNumber;
|
||||
QProcess m_process;
|
||||
QString m_previewImage;
|
||||
InstalledType::InstalledType m_type;
|
||||
FillMode::FillMode m_fillMode;
|
||||
ContentTypes::InstalledType m_type;
|
||||
Video::FillMode m_fillMode;
|
||||
QString m_appID;
|
||||
QString m_absolutePath;
|
||||
QString m_file;
|
||||
|
@ -29,7 +29,7 @@ class ScreenPlayWidget : public QObject {
|
||||
Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged)
|
||||
Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged)
|
||||
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
|
||||
Q_PROPERTY(InstalledType::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
Q_PROPERTY(ContentTypes::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
|
||||
public:
|
||||
explicit ScreenPlayWidget(
|
||||
@ -38,7 +38,7 @@ public:
|
||||
const QPoint& position,
|
||||
const QString& absolutePath,
|
||||
const QString& previewImage, const QJsonObject& properties,
|
||||
const InstalledType::InstalledType type);
|
||||
const ContentTypes::InstalledType type);
|
||||
|
||||
bool start();
|
||||
|
||||
@ -48,7 +48,7 @@ public:
|
||||
QPoint position() const { return m_position; }
|
||||
QString absolutePath() const { return m_absolutePath; }
|
||||
QString appID() const { return m_appID; }
|
||||
InstalledType::InstalledType type() const { return m_type; }
|
||||
ContentTypes::InstalledType type() const { return m_type; }
|
||||
|
||||
void setSDKConnection(std::unique_ptr<SDKConnection> connection);
|
||||
|
||||
@ -85,7 +85,7 @@ public slots:
|
||||
emit appIDChanged(m_appID);
|
||||
}
|
||||
|
||||
void setType(InstalledType::InstalledType type)
|
||||
void setType(ContentTypes::InstalledType type)
|
||||
{
|
||||
if (m_type == type)
|
||||
return;
|
||||
@ -107,7 +107,7 @@ signals:
|
||||
void previewImageChanged(QString previewImage);
|
||||
void positionChanged(QPoint position);
|
||||
void appIDChanged(QString appID);
|
||||
void typeChanged(InstalledType::InstalledType type);
|
||||
void typeChanged(ContentTypes::InstalledType type);
|
||||
void absolutePathChanged(QString absolutePath);
|
||||
|
||||
void requestSave();
|
||||
@ -123,7 +123,7 @@ private:
|
||||
QString m_previewImage;
|
||||
QString m_appID;
|
||||
QPoint m_position;
|
||||
InstalledType::InstalledType m_type;
|
||||
ContentTypes::InstalledType m_type;
|
||||
QString m_absolutePath;
|
||||
QTimer m_pingAliveTimer;
|
||||
QStringList m_appArgumentsList;
|
||||
|
@ -43,7 +43,9 @@ class ActiveProfile;
|
||||
|
||||
class Settings : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
|
||||
|
||||
Q_PROPERTY(bool showDefaultContent READ showDefaultContent WRITE setShowDefaultContent NOTIFY showDefaultContentChanged)
|
||||
Q_PROPERTY(bool anonymousTelemetry READ anonymousTelemetry WRITE setAnonymousTelemetry NOTIFY anonymousTelemetryChanged)
|
||||
@ -54,10 +56,10 @@ class Settings : public QObject {
|
||||
Q_PROPERTY(bool offlineMode READ offlineMode WRITE setOfflineMode NOTIFY offlineModeChanged)
|
||||
Q_PROPERTY(bool steamVersion READ steamVersion WRITE setSteamVersion NOTIFY steamVersionChanged)
|
||||
|
||||
Q_PROPERTY(ScreenPlay::FillMode::FillMode videoFillMode READ videoFillMode WRITE setVideoFillMode NOTIFY videoFillModeChanged)
|
||||
Q_PROPERTY(DesktopEnvironment desktopEnvironment READ desktopEnvironment WRITE setDesktopEnvironment NOTIFY desktopEnvironmentChanged)
|
||||
Q_PROPERTY(Language language READ language WRITE setLanguage NOTIFY languageChanged)
|
||||
Q_PROPERTY(Theme theme READ theme WRITE setTheme NOTIFY themeChanged)
|
||||
Q_PROPERTY(ScreenPlay::Video::FillMode videoFillMode READ videoFillMode WRITE setVideoFillMode NOTIFY videoFillModeChanged)
|
||||
Q_PROPERTY(ScreenPlay::Settings::DesktopEnvironment desktopEnvironment READ desktopEnvironment WRITE setDesktopEnvironment NOTIFY desktopEnvironmentChanged)
|
||||
Q_PROPERTY(ScreenPlay::Settings::Language language READ language WRITE setLanguage NOTIFY languageChanged)
|
||||
Q_PROPERTY(ScreenPlay::Settings::Theme theme READ theme WRITE setTheme NOTIFY themeChanged)
|
||||
|
||||
Q_PROPERTY(QString decoder READ decoder WRITE setDecoder NOTIFY decoderChanged)
|
||||
Q_PROPERTY(QString buildInfos READ buildInfos WRITE setBuildInfos NOTIFY buildInfosChanged)
|
||||
@ -83,6 +85,7 @@ public:
|
||||
Unity,
|
||||
XFCE,
|
||||
};
|
||||
Q_ENUM(DesktopEnvironment)
|
||||
|
||||
enum class Language {
|
||||
En_US,
|
||||
@ -116,12 +119,12 @@ public:
|
||||
bool silentStart() const { return m_silentStart; }
|
||||
bool anonymousTelemetry() const { return m_anonymousTelemetry; }
|
||||
bool checkWallpaperVisible() const { return m_checkWallpaperVisible; }
|
||||
ScreenPlay::FillMode::FillMode videoFillMode() const { return m_videoFillMode; }
|
||||
Language language() const { return m_language; }
|
||||
ScreenPlay::Video::FillMode videoFillMode() const { return m_videoFillMode; }
|
||||
ScreenPlay::Settings::Language language() const { return m_language; }
|
||||
QString font() const { return m_font; }
|
||||
Theme theme() const { return m_theme; }
|
||||
ScreenPlay::Settings::Theme theme() const { return m_theme; }
|
||||
bool steamVersion() const { return m_steamVersion; }
|
||||
DesktopEnvironment desktopEnvironment() const { return m_desktopEnvironment; }
|
||||
ScreenPlay::Settings::DesktopEnvironment desktopEnvironment() const { return m_desktopEnvironment; }
|
||||
const QString& buildInfos() const { return m_buildInfos; }
|
||||
bool showDefaultContent() const { return m_showDefaultContent; }
|
||||
|
||||
@ -137,12 +140,12 @@ signals:
|
||||
void silentStartChanged(bool silentStart);
|
||||
void anonymousTelemetryChanged(bool anonymousTelemetry);
|
||||
void checkWallpaperVisibleChanged(bool checkWallpaperVisible);
|
||||
void videoFillModeChanged(ScreenPlay::FillMode::FillMode videoFillMode);
|
||||
void videoFillModeChanged(ScreenPlay::Video::FillMode videoFillMode);
|
||||
void languageChanged(ScreenPlay::Settings::Language language);
|
||||
void fontChanged(QString font);
|
||||
void themeChanged(ScreenPlay::Settings::Theme theme);
|
||||
void steamVersionChanged(bool steamVersion);
|
||||
void desktopEnvironmentChanged(DesktopEnvironment desktopEnvironment);
|
||||
void desktopEnvironmentChanged(ScreenPlay::Settings::DesktopEnvironment desktopEnvironment);
|
||||
void buildInfosChanged(const QString& buildInfos);
|
||||
void showDefaultContentChanged(bool showDefaultContent);
|
||||
|
||||
@ -152,306 +155,23 @@ public slots:
|
||||
void setupWidgetAndWindowPaths();
|
||||
bool retranslateUI();
|
||||
|
||||
void setShowDefaultContent(bool showDefaultContent)
|
||||
{
|
||||
if (m_showDefaultContent == showDefaultContent)
|
||||
return;
|
||||
m_showDefaultContent = showDefaultContent;
|
||||
emit showDefaultContentChanged(showDefaultContent);
|
||||
}
|
||||
|
||||
void setqSetting(const QString& key, const QVariant& value)
|
||||
{
|
||||
m_qSettings.setValue(key, value);
|
||||
m_qSettings.sync();
|
||||
}
|
||||
|
||||
void setAutostart(bool autostart)
|
||||
{
|
||||
if (desktopEnvironment() == DesktopEnvironment::Windows) {
|
||||
|
||||
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
||||
if (autostart) {
|
||||
settings.setValue("ScreenPlay", QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + " -silent");
|
||||
settings.sync();
|
||||
} else {
|
||||
settings.remove("ScreenPlay");
|
||||
}
|
||||
}
|
||||
if (desktopEnvironment() == DesktopEnvironment::OSX) {
|
||||
const QString plistFileName = "app.screenplay.plist";
|
||||
QFile defaultPListFile(":/qml/ScreenPlayApp/assets/macos/" + plistFileName);
|
||||
defaultPListFile.open(QIODevice::ReadOnly);
|
||||
QString settingsPlistContent = defaultPListFile.readAll();
|
||||
if (!settingsPlistContent.contains("{{SCREENPLAY_PATH}}")) {
|
||||
qCritical() << "Unable to load plist settings template from qrc to set autostart!";
|
||||
return;
|
||||
}
|
||||
|
||||
QDir workingDir(QGuiApplication::applicationDirPath());
|
||||
workingDir.cdUp();
|
||||
workingDir.cdUp();
|
||||
workingDir.cdUp();
|
||||
const QString screenPlayPath = QUrl::fromUserInput(workingDir.path() + "/ScreenPlay.app/Contents/MacOS/ScreenPlay").toLocalFile();
|
||||
settingsPlistContent.replace("{{SCREENPLAY_PATH}}", screenPlayPath);
|
||||
settingsPlistContent.replace("{{SCREENPLAY_AUTOSTART}}", autostart ? "true" : "false");
|
||||
|
||||
const QString homePath = QDir::homePath();
|
||||
QFile settingsPlist(homePath + "/Library/LaunchAgents/" + plistFileName);
|
||||
if (settingsPlist.exists()) {
|
||||
QDomDocument doc;
|
||||
if (!doc.setContent(&settingsPlist)) {
|
||||
settingsPlist.close();
|
||||
return;
|
||||
}
|
||||
settingsPlist.close();
|
||||
|
||||
QDomElement root = doc.firstChildElement();
|
||||
QDomNodeList dictList = root.elementsByTagName("dict");
|
||||
if (dictList.size() > 1 && dictList.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if autostart and corresponding path is set and abort if so. This is needed since osx 13.0 Ventura
|
||||
// because it displays an annoying message every time we change the file.
|
||||
bool isCorrectPath = false;
|
||||
bool isAutostartEnabled = false;
|
||||
QDomNode dictNode = dictList.at(0);
|
||||
if (dictNode.isElement()) {
|
||||
QDomElement dictElement = dictNode.toElement();
|
||||
QDomNodeList keyList = dictElement.elementsByTagName("key");
|
||||
for (int j = 0; j < keyList.size(); j++) {
|
||||
QDomNode keyNode = keyList.at(j);
|
||||
if (keyNode.isElement()) {
|
||||
QDomElement keyElement = keyNode.toElement();
|
||||
if (keyElement.text() == "ProgramArguments") {
|
||||
QDomNode valueNode = keyNode.nextSibling();
|
||||
if (valueNode.isElement()) {
|
||||
QDomElement valueElement = valueNode.toElement();
|
||||
QDomNodeList stringList = valueElement.elementsByTagName("string");
|
||||
if (!stringList.isEmpty()) {
|
||||
QDomNode stringNode = stringList.at(0);
|
||||
if (stringNode.isElement()) {
|
||||
QDomElement stringElement = stringNode.toElement();
|
||||
const QString path = stringElement.text();
|
||||
if (path == screenPlayPath) {
|
||||
isCorrectPath = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dictNode.isElement()) {
|
||||
QDomElement dictElement = dictNode.toElement();
|
||||
QDomNodeList keyList = dictElement.elementsByTagName("key");
|
||||
for (int j = 0; j < keyList.size(); j++) {
|
||||
QDomNode keyNode = keyList.at(j);
|
||||
if (keyNode.isElement()) {
|
||||
QDomElement keyElement = keyNode.toElement();
|
||||
if (keyElement.text() == "RunAtLoad") {
|
||||
QDomNode valueNode = keyNode.nextSibling();
|
||||
if (valueNode.isElement()) {
|
||||
QDomElement valueElement = valueNode.toElement();
|
||||
if (valueElement.tagName() == "true") {
|
||||
isAutostartEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing to do. Autostart has the same value and the path is also correct.
|
||||
if (isAutostartEnabled == autostart && isCorrectPath)
|
||||
return;
|
||||
|
||||
if (!settingsPlist.remove()) {
|
||||
qCritical() << "Unable to remove: " << settingsPlist.fileName();
|
||||
}
|
||||
}
|
||||
|
||||
settingsPlist.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
||||
QTextStream out(&settingsPlist);
|
||||
out.setEncoding(QStringConverter::Utf8);
|
||||
out << settingsPlistContent;
|
||||
settingsPlist.flush();
|
||||
settingsPlist.close();
|
||||
|
||||
qInfo() << "Set autostart enabled: " << autostart;
|
||||
}
|
||||
setqSetting("Autostart", autostart);
|
||||
|
||||
m_autostart = autostart;
|
||||
emit autostartChanged(m_autostart);
|
||||
}
|
||||
|
||||
void setHighPriorityStart(bool highPriorityStart)
|
||||
{
|
||||
if (m_highPriorityStart == highPriorityStart)
|
||||
return;
|
||||
|
||||
setqSetting("HighPriorityStart", highPriorityStart);
|
||||
|
||||
const QString app = "'" + QGuiApplication::applicationDirPath() + "/WindowsServiceHelper.exe" + "'";
|
||||
QStringList args { "-Command", QString("Start-Process %1 -Verb runAs").arg(app), "-ArgumentList" };
|
||||
|
||||
// Because we must use powershell, we need to add an extra 'var' and ,
|
||||
auto appendAsString = [&](const QString& string, const bool isLast = false) {
|
||||
QString arg = "'" + string + "'";
|
||||
if (!isLast)
|
||||
arg += ",";
|
||||
args.append(arg);
|
||||
};
|
||||
|
||||
appendAsString("--t");
|
||||
appendAsString("create");
|
||||
appendAsString("--sn");
|
||||
appendAsString("ScreenPlayService");
|
||||
appendAsString("--dn");
|
||||
appendAsString("ScreenPlayService");
|
||||
appendAsString("--a");
|
||||
appendAsString(QVariant(highPriorityStart).toString(), true);
|
||||
|
||||
QProcess process;
|
||||
process.start(QStringLiteral("powershell"), args);
|
||||
process.waitForFinished(5000);
|
||||
|
||||
m_highPriorityStart = highPriorityStart;
|
||||
emit highPriorityStartChanged(m_highPriorityStart);
|
||||
}
|
||||
|
||||
void setLocalStoragePath(QUrl localStoragePath)
|
||||
{
|
||||
// Remove: "file:///"
|
||||
QJsonValue cleanedPath = QJsonValue(localStoragePath.toString());
|
||||
|
||||
setqSetting("ScreenPlayContentPath", cleanedPath);
|
||||
|
||||
m_globalVariables->setLocalStoragePath(cleanedPath.toString());
|
||||
emit resetInstalledListmodel();
|
||||
}
|
||||
|
||||
void setDecoder(QString decoder)
|
||||
{
|
||||
if (m_decoder == decoder)
|
||||
return;
|
||||
|
||||
m_decoder = decoder;
|
||||
|
||||
emit decoderChanged(m_decoder);
|
||||
}
|
||||
|
||||
void setOfflineMode(bool offlineMode)
|
||||
{
|
||||
if (m_offlineMode == offlineMode)
|
||||
return;
|
||||
|
||||
m_offlineMode = offlineMode;
|
||||
emit offlineModeChanged(m_offlineMode);
|
||||
}
|
||||
|
||||
void setSilentStart(bool silentStart)
|
||||
{
|
||||
if (m_silentStart == silentStart)
|
||||
return;
|
||||
|
||||
m_silentStart = silentStart;
|
||||
emit silentStartChanged(m_silentStart);
|
||||
}
|
||||
|
||||
void setAnonymousTelemetry(bool anonymousTelemetry)
|
||||
{
|
||||
if (m_anonymousTelemetry == anonymousTelemetry)
|
||||
return;
|
||||
|
||||
setqSetting("AnonymousTelemetry", anonymousTelemetry);
|
||||
|
||||
m_anonymousTelemetry = anonymousTelemetry;
|
||||
emit anonymousTelemetryChanged(m_anonymousTelemetry);
|
||||
}
|
||||
|
||||
void setCheckWallpaperVisible(bool checkWallpaperVisible)
|
||||
{
|
||||
if (m_checkWallpaperVisible == checkWallpaperVisible)
|
||||
return;
|
||||
|
||||
setqSetting("CheckWallpaperVisible", checkWallpaperVisible);
|
||||
|
||||
m_checkWallpaperVisible = checkWallpaperVisible;
|
||||
emit checkWallpaperVisibleChanged(m_checkWallpaperVisible);
|
||||
}
|
||||
|
||||
void setVideoFillMode(ScreenPlay::FillMode::FillMode videoFillMode)
|
||||
{
|
||||
if (m_videoFillMode == videoFillMode)
|
||||
return;
|
||||
|
||||
setqSetting("VideoFillMode", QVariant::fromValue(videoFillMode).toString());
|
||||
|
||||
m_videoFillMode = videoFillMode;
|
||||
emit videoFillModeChanged(m_videoFillMode);
|
||||
}
|
||||
|
||||
void setLanguage(ScreenPlay::Settings::Language language)
|
||||
{
|
||||
if (m_language == language)
|
||||
return;
|
||||
|
||||
setqSetting("Language", QVariant::fromValue(language).toString());
|
||||
|
||||
m_language = language;
|
||||
emit languageChanged(m_language);
|
||||
}
|
||||
|
||||
void setFont(QString font)
|
||||
{
|
||||
if (m_font == font)
|
||||
return;
|
||||
|
||||
m_font = font;
|
||||
emit fontChanged(m_font);
|
||||
}
|
||||
|
||||
void setTheme(ScreenPlay::Settings::Theme theme)
|
||||
{
|
||||
if (m_theme == theme)
|
||||
return;
|
||||
|
||||
setqSetting("Theme", QVariant::fromValue(theme).toString());
|
||||
|
||||
m_theme = theme;
|
||||
emit themeChanged(m_theme);
|
||||
}
|
||||
|
||||
void setSteamVersion(bool steamVersion)
|
||||
{
|
||||
if (m_steamVersion == steamVersion)
|
||||
return;
|
||||
|
||||
m_steamVersion = steamVersion;
|
||||
emit steamVersionChanged(m_steamVersion);
|
||||
}
|
||||
|
||||
void setDesktopEnvironment(DesktopEnvironment desktopEnvironment)
|
||||
{
|
||||
if (m_desktopEnvironment == desktopEnvironment)
|
||||
return;
|
||||
|
||||
m_desktopEnvironment = desktopEnvironment;
|
||||
emit desktopEnvironmentChanged(m_desktopEnvironment);
|
||||
}
|
||||
|
||||
void setBuildInfos(const QString& buildInfos)
|
||||
{
|
||||
if (m_buildInfos == buildInfos)
|
||||
return;
|
||||
m_buildInfos = buildInfos;
|
||||
emit buildInfosChanged(m_buildInfos);
|
||||
}
|
||||
void setShowDefaultContent(bool showDefaultContent);
|
||||
void setqSetting(const QString& key, const QVariant& value);
|
||||
void setAutostart(bool autostart);
|
||||
void setHighPriorityStart(bool highPriorityStart);
|
||||
void setLocalStoragePath(QUrl localStoragePath);
|
||||
void setDecoder(QString decoder);
|
||||
void setOfflineMode(bool offlineMode);
|
||||
void setSilentStart(bool silentStart);
|
||||
void setAnonymousTelemetry(bool anonymousTelemetry);
|
||||
void setCheckWallpaperVisible(bool checkWallpaperVisible);
|
||||
void setVideoFillMode(ScreenPlay::Video::FillMode videoFillMode);
|
||||
void setLanguage(ScreenPlay::Settings::Language language);
|
||||
void setFont(QString font);
|
||||
void setTheme(ScreenPlay::Settings::Theme theme);
|
||||
void setSteamVersion(bool steamVersion);
|
||||
void setDesktopEnvironment(DesktopEnvironment desktopEnvironment);
|
||||
void setBuildInfos(const QString& buildInfos);
|
||||
|
||||
private:
|
||||
void restoreDefault(const QString& appConfigLocation, const QString& settingsFileType);
|
||||
@ -473,13 +193,13 @@ private:
|
||||
bool m_anonymousTelemetry { true };
|
||||
bool m_showDefaultContent { true };
|
||||
|
||||
QString m_decoder;
|
||||
ScreenPlay::FillMode::FillMode m_videoFillMode { ScreenPlay::FillMode::FillMode::Cover };
|
||||
Language m_language { Language::En_US };
|
||||
Theme m_theme { Theme::System };
|
||||
ScreenPlay::Video::FillMode m_videoFillMode { ScreenPlay::Video::FillMode::Cover };
|
||||
ScreenPlay::Settings::Language m_language { Language::En_US };
|
||||
ScreenPlay::Settings::Theme m_theme { Theme::System };
|
||||
ScreenPlay::Settings::DesktopEnvironment m_desktopEnvironment { DesktopEnvironment::Unknown };
|
||||
QString m_font { "Roboto" };
|
||||
QString m_decoder;
|
||||
bool m_steamVersion { false };
|
||||
DesktopEnvironment m_desktopEnvironment = DesktopEnvironment::Unknown;
|
||||
QString m_buildInfos;
|
||||
};
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ signals:
|
||||
void requestNavigation(QString nav);
|
||||
void requestNavigationActive(bool isActive);
|
||||
void requestToggleWallpaperConfiguration();
|
||||
void setSidebarItem(QString folderName, ScreenPlay::InstalledType::InstalledType type);
|
||||
void setSidebarItem(QString folderName, ScreenPlay::ContentTypes::InstalledType type);
|
||||
void allLicenseLoaded(QString licensesText);
|
||||
void allDataProtectionLoaded(QString dataProtectionText);
|
||||
void debugMessagesChanged(QString debugMessages);
|
||||
|
@ -7,7 +7,6 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import Settings
|
||||
import ScreenPlayUtil as Util
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import Plausible 1.0
|
||||
@ -22,13 +21,13 @@ ApplicationWindow {
|
||||
|
||||
function setTheme(theme) {
|
||||
switch (theme) {
|
||||
case Settings.System:
|
||||
case Settings.Theme.System:
|
||||
root.Material.theme = Material.System;
|
||||
break;
|
||||
case Settings.Dark:
|
||||
case Settings.Theme.Dark:
|
||||
root.Material.theme = Material.Dark;
|
||||
break;
|
||||
case Settings.Light:
|
||||
case Settings.Theme.Light:
|
||||
root.Material.theme = Material.Light;
|
||||
break;
|
||||
}
|
||||
@ -40,12 +39,12 @@ ApplicationWindow {
|
||||
App.installedListModel.reset();
|
||||
}
|
||||
if (name === "Installed") {
|
||||
stackView.replace("qrc:/qml/ScreenPlayApp/qml/Installed/Installed.qml", {
|
||||
stackView.replace("qrc:/qml/ScreenPlayApp/qml/Installed/InstalledView.qml", {
|
||||
"sidebar": sidebar
|
||||
});
|
||||
return;
|
||||
}
|
||||
stackView.replace("qrc:/qml/ScreenPlayApp/qml/" + name + "/" + name + ".qml", {
|
||||
stackView.replace("qrc:/qml/ScreenPlayApp/qml/" + name + "/" + name + "View.qml", {
|
||||
"modalSource": content
|
||||
});
|
||||
nav.setNavigation(name);
|
||||
@ -105,8 +104,10 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
print("Settings.Language.Pl_PL",Settings.Language.Pl_PL)
|
||||
print(App.settings.theme,Settings.Theme.Light);
|
||||
setTheme(App.settings.theme);
|
||||
stackView.push("qrc:/qml/ScreenPlayApp/qml/Installed/Installed.qml", {
|
||||
stackView.push("qrc:/qml/ScreenPlayApp/qml/Installed/InstalledView.qml", {
|
||||
"sidebar": sidebar
|
||||
});
|
||||
if (!App.settings.silentStart) {
|
||||
@ -132,7 +133,7 @@ ApplicationWindow {
|
||||
modalSource: content
|
||||
}
|
||||
|
||||
Monitors.Monitors {
|
||||
Monitors.MonitorsView {
|
||||
id: monitors
|
||||
modalSource: content
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Controls.Material.impl
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil
|
||||
|
||||
Rectangle {
|
||||
|
@ -6,7 +6,7 @@ import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Controls.Material.impl
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil
|
||||
|
||||
Item {
|
@ -6,7 +6,7 @@ import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Controls.Material.impl
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
|
@ -6,7 +6,7 @@ import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Controls.Material.impl
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil
|
||||
|
||||
Item {
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil
|
||||
|
||||
Item {
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
WizardPage {
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
WizardPage {
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -6,7 +6,7 @@ import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
|
||||
Item {
|
||||
id: wrapperError
|
||||
|
@ -5,8 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
import ScreenPlay.Enums.ImportVideoState
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -5,8 +5,8 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
import ScreenPlay.Enums.ImportVideoState
|
||||
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
|
@ -6,7 +6,7 @@ import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
import "../../"
|
||||
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -5,8 +5,8 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
import ScreenPlay.Enums.ImportVideoState
|
||||
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
|
@ -6,7 +6,7 @@ import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
import "../../"
|
||||
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
WizardPage {
|
||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
WizardPage {
|
||||
|
@ -6,7 +6,7 @@ import QtQuick.Layouts
|
||||
import QtQuick.Window
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Create
|
||||
|
||||
|
||||
FocusScope {
|
||||
id: root
|
||||
|
@ -6,8 +6,6 @@ import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Controls.Material.impl
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
import ScreenPlay.Enums.SearchType
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
|
@ -8,8 +8,6 @@ import QtQuick.Controls.Material.impl
|
||||
import QtCore as QCore
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
import ScreenPlay.Enums.SearchType
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
@ -84,13 +82,11 @@ Item {
|
||||
property bool isDragging: false
|
||||
property bool isScrolling: gridView.verticalVelocity !== 0
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
anchors.fill: parent
|
||||
cellWidth: 340
|
||||
cellHeight: 200
|
||||
cacheBuffer: 160
|
||||
interactive: root.enabled
|
||||
snapMode: GridView.SnapToRow
|
||||
onDragStarted: isDragging = true
|
||||
onDragEnded: isDragging = false
|
||||
model: App.installedListFilter
|
@ -4,7 +4,7 @@ import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
|
@ -6,8 +6,7 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Controls.Material.impl
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Enums.FillMode
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
|
||||
import "../Monitors"
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
|
@ -5,7 +5,6 @@ import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Enums.FillMode
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
ColumnLayout {
|
||||
|
@ -3,7 +3,7 @@ import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Controls.Material
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -6,7 +6,7 @@ import QtQuick.Layouts
|
||||
import QtQuick.Controls.Material.impl
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Util.Popup {
|
@ -1,9 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls.Material
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
|
||||
Control {
|
||||
id: settingsComboBox
|
||||
@ -24,7 +21,7 @@ Control {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
font.pointSize: 12
|
||||
font.family: App.settings.font
|
||||
//font.family: App.settings.font
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
@ -43,7 +40,7 @@ Control {
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
wrapMode: Text.WordWrap
|
||||
font.pointSize: 10
|
||||
font.family: App.settings.font
|
||||
//font.family: App.settings.font
|
||||
|
||||
anchors {
|
||||
top: txtHeadline.bottom
|
||||
@ -61,7 +58,7 @@ Control {
|
||||
implicitWidth: 200
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
font.family: App.settings.font
|
||||
//font.family: App.settings.font
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
|
@ -1,15 +1,13 @@
|
||||
import QtQuick
|
||||
import QtCore as QCore
|
||||
import QtQuick.Dialogs
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import QtQuick.Layouts
|
||||
import QtCore
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import ScreenPlayApp
|
||||
import ScreenPlay
|
||||
import ScreenPlay.Enums.FillMode
|
||||
import Settings
|
||||
import ScreenPlayUtil
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@ -154,53 +152,36 @@ Item {
|
||||
headline: qsTr("Language")
|
||||
description: qsTr("Set the ScreenPlay UI Language")
|
||||
Component.onCompleted: {
|
||||
settingsLanguage.comboBox.currentIndex = root.indexOfValue(settingsLanguage.comboBox.model, App.settings.language);
|
||||
print("as",settingsLanguage.comboBox.currentIndex,settingsLanguage.comboBox.model,App.settings.language )
|
||||
//settingsLanguage.comboBox.currentIndex = root.indexOfValue(settingsLanguage.comboBox.model, App.settings.language);
|
||||
//print(settingsLanguage.comboBox.currentIndex )
|
||||
|
||||
}
|
||||
|
||||
comboBox {
|
||||
model: [{
|
||||
"value": Settings.En_US,
|
||||
"text": "English"
|
||||
}, {
|
||||
"value": Settings.De_DE,
|
||||
"text": "German"
|
||||
}, {
|
||||
"value": Settings.Pl_PL,
|
||||
"text": "Polish"
|
||||
}, {
|
||||
"value": Settings.It_IT,
|
||||
"text": "Italian"
|
||||
}, {
|
||||
"value": Settings.Zh_CN,
|
||||
"text": "Chinese - Simplified"
|
||||
}, {
|
||||
"value": Settings.Ru_RU,
|
||||
"text": "Russian"
|
||||
}, {
|
||||
"value": Settings.Fr_FR,
|
||||
"text": "French"
|
||||
}, {
|
||||
"value": Settings.Es_ES,
|
||||
"text": "Spanish"
|
||||
}, {
|
||||
"value": Settings.Ko_KR,
|
||||
"text": "Korean"
|
||||
}, {
|
||||
"value": Settings.Vi_VN,
|
||||
"text": "Vietnamese"
|
||||
}, {
|
||||
"value": Settings.Pt_BR,
|
||||
"text": "Portuguese (Brazil)"
|
||||
}, {
|
||||
"value": Settings.Tr_TR,
|
||||
"text": "Turkish"
|
||||
}, {
|
||||
"value": Settings.Nl_NL,
|
||||
"text": "Dutch"
|
||||
}]
|
||||
onActivated: {
|
||||
App.settings.setLanguage(settingsLanguage.comboBox.currentValue);
|
||||
App.settings.retranslateUI();
|
||||
model: ListModel {
|
||||
id: lmLangauge
|
||||
ListElement { value: Settings.Language.En_US; text: "English" }
|
||||
ListElement { value: Settings.Language.De_DE; text: "German" }
|
||||
ListElement { value: Settings.Language.Pl_PL; text: "Polish" }
|
||||
ListElement { value: Settings.Language.It_IT; text: "Italian" }
|
||||
ListElement { value: Settings.Language.Zh_CN; text: "Chinese - Simplified" }
|
||||
ListElement { value: Settings.Language.Ru_RU; text: "Russian" }
|
||||
ListElement { value: Settings.Language.Fr_FR; text: "French" }
|
||||
ListElement { value: Settings.Language.Es_ES; text: "Spanish" }
|
||||
ListElement { value: Settings.Language.Ko_KR; text: "Korean" }
|
||||
ListElement { value: Settings.Language.Vi_VN; text: "Vietnamese" }
|
||||
ListElement { value: Settings.Language.Pt_BR; text: "Portuguese (Brazil)" }
|
||||
ListElement { value: Settings.Language.Tr_TR; text: "Turkish" }
|
||||
ListElement { value: Settings.Language.Nl_NL; text: "Dutch" }
|
||||
}
|
||||
onActivated: (index) => {
|
||||
print(index,lmLangauge.get(index),lmLangauge.get(index).value,lmLangauge.get(index).text)
|
||||
print(Settings.Language.Pl_PL)
|
||||
print("onActivated",settingsLanguage.comboBox.currentValue,index)
|
||||
// App.settings.setLanguage(settingsLanguage.comboBox.currentValue);
|
||||
|
||||
//App.settings.retranslateUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,21 +195,17 @@ Item {
|
||||
headline: qsTr("Theme")
|
||||
description: qsTr("Switch dark/light theme")
|
||||
Component.onCompleted: {
|
||||
settingsTheme.comboBox.currentIndex = root.indexOfValue(settingsTheme.comboBox.model, App.settings.theme);
|
||||
//settingsTheme.comboBox.currentIndex = root.indexOfValue(settingsTheme.comboBox.model, App.settings.theme);
|
||||
}
|
||||
|
||||
comboBox {
|
||||
model: [{
|
||||
"value": Settings.System,
|
||||
"text": qsTr("System Default")
|
||||
}, {
|
||||
"value": Settings.Dark,
|
||||
"text": qsTr("Dark")
|
||||
}, {
|
||||
"value": Settings.Light,
|
||||
"text": qsTr("Light")
|
||||
}]
|
||||
model: ListModel {
|
||||
ListElement { value: Settings.Theme.System; text: qsTr("System Default") }
|
||||
ListElement { value: Settings.Theme.Dark; text: qsTr("Dark") }
|
||||
ListElement { value: Settings.Theme.Light; text: qsTr("Light") }
|
||||
}
|
||||
onActivated: {
|
||||
print("onActivated", settingsTheme.comboBox.currentValue,Settings.Theme.Light)
|
||||
App.settings.setTheme(settingsTheme.comboBox.currentValue);
|
||||
}
|
||||
}
|
||||
@ -272,23 +249,17 @@ Item {
|
||||
}
|
||||
|
||||
comboBox {
|
||||
onActivated: App.settings.setVideoFillMode(cbVideoFillMode.comboBox.currentValue)
|
||||
model: [{
|
||||
"value": FillMode.Stretch,
|
||||
"text": qsTr("Stretch")
|
||||
}, {
|
||||
"value": FillMode.Fill,
|
||||
"text": qsTr("Fill")
|
||||
}, {
|
||||
"value": FillMode.Contain,
|
||||
"text": qsTr("Contain")
|
||||
}, {
|
||||
"value": FillMode.Cover,
|
||||
"text": qsTr("Cover")
|
||||
}, {
|
||||
"value": FillMode.Scale_Down,
|
||||
"text": qsTr("Scale-Down")
|
||||
}]
|
||||
model: ListModel {
|
||||
ListElement { value: Settings.FillMode.Stretch; text: qsTr("Stretch") }
|
||||
ListElement { value: Settings.FillMode.Fill; text: qsTr("Fill") }
|
||||
ListElement { value: Settings.FillMode.Contain; text: qsTr("Contain") }
|
||||
ListElement { value: Settings.FillMode.Cover; text: qsTr("Cover") }
|
||||
ListElement { value: Settings.FillMode.Scale_Down; text: qsTr("Scale-Down") }
|
||||
}
|
||||
onActivated: {
|
||||
App.settings.setVideoFillMode(cbVideoFillMode.comboBox.currentValue)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -369,31 +340,31 @@ Item {
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
GrowIconLink {
|
||||
Util.GrowIconLink {
|
||||
iconSource: "qrc:/qml/ScreenPlayApp/assets/icons/brand_github.svg"
|
||||
url: "https://github.com/kelteseth"
|
||||
color: "#333333"
|
||||
}
|
||||
|
||||
GrowIconLink {
|
||||
Util.GrowIconLink {
|
||||
iconSource: "qrc:/qml/ScreenPlayApp/assets/icons/brand_gitlab.svg"
|
||||
url: "https://gitlab.com/kelteseth"
|
||||
color: "#FC6D26"
|
||||
}
|
||||
|
||||
GrowIconLink {
|
||||
Util.GrowIconLink {
|
||||
iconSource: "qrc:/qml/ScreenPlayApp/assets/icons/brand_twitter.svg"
|
||||
url: "https://twitter.com/Kelteseth"
|
||||
color: "#1DA1F2"
|
||||
}
|
||||
|
||||
GrowIconLink {
|
||||
Util.GrowIconLink {
|
||||
iconSource: "qrc:/qml/ScreenPlayApp/assets/icons/brand_twitch.svg"
|
||||
url: "https://www.twitch.tv/kelteseth/"
|
||||
color: "#6441A5"
|
||||
}
|
||||
|
||||
GrowIconLink {
|
||||
Util.GrowIconLink {
|
||||
iconSource: "qrc:/qml/ScreenPlayApp/assets/icons/brand_reddit.svg"
|
||||
url: "https://www.reddit.com/r/ScreenPlayApp/"
|
||||
color: "#FF4500"
|
||||
@ -516,4 +487,7 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -106,7 +106,7 @@ SystemTrayIcon {
|
||||
MenuItem {
|
||||
id: miMuteAll
|
||||
|
||||
property bool isMuted: true
|
||||
property bool isMuted: false
|
||||
|
||||
text: qsTr("Mute all")
|
||||
icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_volume_mute.svg"
|
||||
|
@ -3,7 +3,6 @@ import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Layouts
|
||||
import Settings
|
||||
import ScreenPlay
|
||||
import ScreenPlayWorkshop
|
||||
|
@ -17,9 +17,7 @@ namespace ScreenPlay {
|
||||
|
||||
/*!
|
||||
\module ScreenPlay
|
||||
|
||||
\title ScreenPlay
|
||||
|
||||
\brief Module for ScreenPlay.
|
||||
*/
|
||||
/*!
|
||||
@ -32,32 +30,6 @@ namespace ScreenPlay {
|
||||
\class ScreenPlay::App
|
||||
\inmodule ScreenPlay
|
||||
\brief The App class contains all members for ScreenPlay.
|
||||
|
||||
|
||||
\raw HTML
|
||||
<div class="mermaid">
|
||||
graph TD
|
||||
|
||||
Main.cpp --> App
|
||||
App --> QQmlApplicationEngine
|
||||
App --> GlobalVariables
|
||||
App --> ScreenPlayManager
|
||||
ScreenPlayManager --> ScreenPlayWallpaper
|
||||
ScreenPlayManager --> ScreenPlayWidget
|
||||
App --> Create
|
||||
Create--> CreateVideoImport
|
||||
App --> Util
|
||||
App --> Settings
|
||||
App --> InstalledListModel
|
||||
InstalledListModel --> ProjectFile
|
||||
App --> InstalledListFilter
|
||||
App --> MonitorListModel
|
||||
MonitorListModel --> Monitor
|
||||
App --> ProfileListModel
|
||||
ProfileListModel --> Profile
|
||||
|
||||
</div>
|
||||
\endraw
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -112,30 +84,6 @@ void App::init()
|
||||
"SteamEnums",
|
||||
"Error: only enums");
|
||||
|
||||
// Registers the enums from globalvariables.
|
||||
// Apparently this is the only way for qml to work
|
||||
// https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/
|
||||
qRegisterMetaType<FillMode::FillMode>();
|
||||
qmlRegisterUncreatableMetaObject(ScreenPlay::FillMode::staticMetaObject,
|
||||
"ScreenPlay.Enums.FillMode",
|
||||
1, 0,
|
||||
"FillMode",
|
||||
"Error: only enums");
|
||||
|
||||
qRegisterMetaType<InstalledType::InstalledType>();
|
||||
qmlRegisterUncreatableMetaObject(ScreenPlay::InstalledType::staticMetaObject,
|
||||
"ScreenPlay.Enums.InstalledType",
|
||||
1, 0,
|
||||
"InstalledType",
|
||||
"Error: only enums");
|
||||
|
||||
qRegisterMetaType<SearchType::SearchType>();
|
||||
qmlRegisterUncreatableMetaObject(ScreenPlay::SearchType::staticMetaObject,
|
||||
"ScreenPlay.Enums.SearchType",
|
||||
1, 0,
|
||||
"SearchType",
|
||||
"Error: only enums");
|
||||
|
||||
using std::make_shared, std::make_unique;
|
||||
|
||||
m_globalVariables = make_shared<GlobalVariables>();
|
||||
|
@ -23,7 +23,6 @@ Create::Create(const std::shared_ptr<GlobalVariables>& globalVariables)
|
||||
: QObject(nullptr)
|
||||
, m_globalVariables(globalVariables)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -32,21 +31,6 @@ Create::Create(const std::shared_ptr<GlobalVariables>& globalVariables)
|
||||
Create::Create()
|
||||
: QObject(nullptr)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void Create::init()
|
||||
{
|
||||
qRegisterMetaType<Create::VideoCodec>("Create::VideoCodec");
|
||||
qmlRegisterUncreatableType<Create>("ScreenPlay.Create", 1, 0, "VideoCodec", "Error only for enums");
|
||||
qmlRegisterType<Create>("ScreenPlay.Create", 1, 0, "Create");
|
||||
|
||||
qRegisterMetaType<ImportVideoState::ImportVideoState>("ImportVideoState::ImportVideoState");
|
||||
qmlRegisterUncreatableMetaObject(ScreenPlay::ImportVideoState::staticMetaObject,
|
||||
"ScreenPlay.Enums.ImportVideoState",
|
||||
1, 0,
|
||||
"ImportVideoState",
|
||||
"Error: only enums");
|
||||
}
|
||||
|
||||
void Create::reset()
|
||||
@ -74,7 +58,7 @@ void Create::createWallpaperStart(QString videoPath, Create::VideoCodec codec, c
|
||||
|
||||
if (!installedDir.mkdir(folderName)) {
|
||||
qInfo() << "Unable to create folder with name: " << folderName << " at: " << installedDir;
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CreateTmpFolderError);
|
||||
emit createWallpaperStateChanged(Import::State::CreateTmpFolderError);
|
||||
emit abortCreateWallpaper();
|
||||
return;
|
||||
}
|
||||
@ -103,21 +87,21 @@ void Create::createWallpaperStart(QString videoPath, Create::VideoCodec codec, c
|
||||
Qt::ConnectionType::QueuedConnection);
|
||||
|
||||
if (!import.createWallpaperInfo() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() << "createWallpaperImageThumbnailPreview()";
|
||||
if (!import.createWallpaperImageThumbnailPreview() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() << "createWallpaperImagePreview()";
|
||||
if (!import.createWallpaperImagePreview() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
@ -126,7 +110,7 @@ void Create::createWallpaperStart(QString videoPath, Create::VideoCodec codec, c
|
||||
if (!import.m_isWebm) {
|
||||
qInfo() << "createWallpaperVideoPreview()";
|
||||
if (!import.createWallpaperVideoPreview() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
|
||||
return;
|
||||
@ -135,7 +119,7 @@ void Create::createWallpaperStart(QString videoPath, Create::VideoCodec codec, c
|
||||
|
||||
qInfo() << "createWallpaperGifPreview()";
|
||||
if (!import.createWallpaperGifPreview() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
@ -144,7 +128,7 @@ void Create::createWallpaperStart(QString videoPath, Create::VideoCodec codec, c
|
||||
if (!import.m_skipAudio) {
|
||||
qInfo() << "extractWallpaperAudio()";
|
||||
if (!import.extractWallpaperAudio() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
@ -152,17 +136,17 @@ void Create::createWallpaperStart(QString videoPath, Create::VideoCodec codec, c
|
||||
|
||||
// Skip convert for webm
|
||||
if (import.m_isWebm) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Finished);
|
||||
emit createWallpaperStateChanged(Import::State::Finished);
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() << "createWallpaperVideo()";
|
||||
if (!import.createWallpaperVideo() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Finished);
|
||||
emit createWallpaperStateChanged(Import::State::Finished);
|
||||
});
|
||||
|
||||
QObject::connect(&m_createImportFutureWatcher, &QFutureWatcherBase::finished, this, [this]() {
|
||||
@ -187,7 +171,7 @@ void Create::importH264(QString videoPath)
|
||||
|
||||
if (!installedDir.mkdir(folderName)) {
|
||||
qInfo() << "Unable to create folder with name: " << folderName << " at: " << installedDir;
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CreateTmpFolderError);
|
||||
emit createWallpaperStateChanged(Import::State::CreateTmpFolderError);
|
||||
emit abortCreateWallpaper();
|
||||
return;
|
||||
}
|
||||
@ -203,35 +187,35 @@ void Create::importH264(QString videoPath)
|
||||
Qt::ConnectionType::QueuedConnection);
|
||||
|
||||
if (!import.createWallpaperInfo() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() << "createWallpaperImageThumbnailPreview()";
|
||||
if (!import.createWallpaperImageThumbnailPreview() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() << "createWallpaperImagePreview()";
|
||||
if (!import.createWallpaperImagePreview() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip preview convert for webm
|
||||
if (!import.createWallpaperVideoPreview() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo() << "createWallpaperGifPreview()";
|
||||
if (!import.createWallpaperGifPreview() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
@ -240,13 +224,13 @@ void Create::importH264(QString videoPath)
|
||||
if (!import.m_skipAudio) {
|
||||
qInfo() << "extractWallpaperAudio()";
|
||||
if (!import.extractWallpaperAudio() || m_interrupt) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Failed);
|
||||
emit createWallpaperStateChanged(Import::State::Failed);
|
||||
emit import.abortAndCleanup();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::Finished);
|
||||
emit createWallpaperStateChanged(Import::State::Finished);
|
||||
return;
|
||||
});
|
||||
|
||||
@ -273,7 +257,7 @@ void Create::saveWallpaper(
|
||||
filePath = ScreenPlayUtil::toLocal(filePath);
|
||||
previewImagePath = ScreenPlayUtil::toLocal(previewImagePath);
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CopyFiles);
|
||||
emit createWallpaperStateChanged(Import::State::CopyFiles);
|
||||
|
||||
// Case when the selected users preview image has the same name as
|
||||
// our default "preview.jpg" name. QFile::copy does no override exsisting files
|
||||
@ -282,7 +266,7 @@ void Create::saveWallpaper(
|
||||
if (userSelectedPreviewImage.fileName() == "preview.jpg") {
|
||||
if (!userSelectedPreviewImage.remove()) {
|
||||
qDebug() << "Could remove" << previewImagePath;
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CopyFilesError);
|
||||
emit createWallpaperStateChanged(Import::State::CopyFilesError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,7 +274,7 @@ void Create::saveWallpaper(
|
||||
if (previewImageFile.exists()) {
|
||||
if (!QFile::copy(previewImagePath, m_workingDir + "/" + previewImageFile.fileName())) {
|
||||
qDebug() << "Could not copy" << previewImagePath << " to " << m_workingDir + "/" + previewImageFile.fileName();
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CopyFilesError);
|
||||
emit createWallpaperStateChanged(Import::State::CopyFilesError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -299,12 +283,12 @@ void Create::saveWallpaper(
|
||||
if (filePath.endsWith(".webm") || filePath.endsWith(".mp4")) {
|
||||
if (!QFile::copy(filePath, m_workingDir + "/" + filePathFile.fileName())) {
|
||||
qDebug() << "Could not copy" << filePath << " to " << m_workingDir + "/" + filePathFile.fileName();
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CopyFilesError);
|
||||
emit createWallpaperStateChanged(Import::State::CopyFilesError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CopyFilesFinished);
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CreateProjectFile);
|
||||
emit createWallpaperStateChanged(Import::State::CopyFilesFinished);
|
||||
emit createWallpaperStateChanged(Import::State::CreateProjectFile);
|
||||
|
||||
QJsonObject obj;
|
||||
obj.insert("description", description);
|
||||
@ -326,11 +310,11 @@ void Create::saveWallpaper(
|
||||
}
|
||||
|
||||
if (!Util::writeSettings(std::move(obj), m_workingDir + "/project.json")) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CreateProjectFileError);
|
||||
emit createWallpaperStateChanged(Import::State::CreateProjectFileError);
|
||||
return;
|
||||
}
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::CreateProjectFileFinished);
|
||||
emit createWallpaperStateChanged(Import::State::CreateProjectFileFinished);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
@ -351,7 +335,7 @@ void Create::abortAndCleanup()
|
||||
QDir exportPath(m_workingDir);
|
||||
if (exportPath.exists()) {
|
||||
if (!exportPath.removeRecursively()) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AbortCleanupError);
|
||||
emit createWallpaperStateChanged(Import::State::AbortCleanupError);
|
||||
qWarning() << "Could not delete temp exportPath: " << exportPath;
|
||||
}
|
||||
} else {
|
||||
|
@ -17,13 +17,6 @@ namespace ScreenPlay {
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief This constructor is only needed for calling qRegisterMetaType on CreateImportVideo to register the enums.
|
||||
\code
|
||||
qRegisterMetaType<ImportVideoState::ImportVideoState>("ImportVideoState::ImportVideoState");
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief Creates a CreateImportVideo object to be used in a different thread. A \a videoPath and a \a exportPath are
|
||||
needed for convertion.
|
||||
@ -118,12 +111,12 @@ bool CreateImportVideo::createWallpaperInfo()
|
||||
|
||||
emit processOutput("ffprobe " + ScreenPlayUtil::toString(args));
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideo);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideo);
|
||||
|
||||
const QString ffmpegOut = waitForFinished(args, QProcess::SeparateChannels, Executable::FFPROBE);
|
||||
qInfo() << ffmpegOut;
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideoFinished);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideoFinished);
|
||||
|
||||
auto obj = ScreenPlayUtil::parseQByteArrayToQJsonObject(QByteArray::fromStdString(ffmpegOut.toStdString()));
|
||||
|
||||
@ -133,14 +126,14 @@ bool CreateImportVideo::createWallpaperInfo()
|
||||
|
||||
emit processOutput(ffmpegOut);
|
||||
emit processOutput("Error parsing FFPROBE json output");
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideoError);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideoError);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj->empty()) {
|
||||
qCritical() << "Error! File could not be parsed.";
|
||||
emit processOutput("Error! File could not be parsed.");
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideoError);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideoError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -158,7 +151,7 @@ bool CreateImportVideo::createWallpaperInfo()
|
||||
bool CreateImportVideo::analyzeWebmReadFrames(const QJsonObject& obj)
|
||||
{
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideo);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideo);
|
||||
|
||||
// Number of frames is a string for some reason...
|
||||
if (!obj.value("streams").isArray()) {
|
||||
@ -227,7 +220,7 @@ bool CreateImportVideo::analyzeVideo(const QJsonObject& obj)
|
||||
if (!hasVideoStream) {
|
||||
qDebug() << "Error! File has no video Stream!";
|
||||
emit processOutput("Error! File has no video Stream!");
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideoHasNoVideoStreamError);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideoHasNoVideoStreamError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -243,7 +236,7 @@ bool CreateImportVideo::analyzeVideo(const QJsonObject& obj)
|
||||
emit processOutput("Error parsing number of frames. Is this really a valid video File?");
|
||||
QJsonDocument tmpVideoStreamDoc(videoStream);
|
||||
emit processOutput(tmpVideoStreamDoc.toJson());
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideoError);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideoError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -256,7 +249,7 @@ bool CreateImportVideo::analyzeVideo(const QJsonObject& obj)
|
||||
if (!okParseDuration) {
|
||||
qDebug() << "Error parsing video length. Is this really a valid video File?";
|
||||
emit processOutput("Error parsing video length. Is this really a valid video File?");
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideoError);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideoError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -317,7 +310,7 @@ bool CreateImportVideo::analyzeVideo(const QJsonObject& obj)
|
||||
bool CreateImportVideo::createWallpaperVideoPreview()
|
||||
{
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewVideo);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewVideo);
|
||||
|
||||
QStringList args;
|
||||
args.append("-y");
|
||||
@ -341,13 +334,13 @@ bool CreateImportVideo::createWallpaperVideoPreview()
|
||||
const QString ffmpegOut = waitForFinished(args);
|
||||
const QFile previewVideo(m_exportPath + "/preview.webm");
|
||||
if (!previewVideo.exists() || !(previewVideo.size() > 0)) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewVideoError);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewVideoError);
|
||||
return false;
|
||||
}
|
||||
|
||||
emit processOutput(ffmpegOut);
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewVideoFinished);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewVideoFinished);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -369,7 +362,7 @@ bool CreateImportVideo::createWallpaperVideoPreview()
|
||||
bool CreateImportVideo::createWallpaperGifPreview()
|
||||
{
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewGif);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewGif);
|
||||
|
||||
QStringList args;
|
||||
args.append("-y");
|
||||
@ -390,13 +383,13 @@ bool CreateImportVideo::createWallpaperGifPreview()
|
||||
if (!ffmpegOut.isEmpty()) {
|
||||
const QFile previewGif(m_exportPath + "/preview.gif");
|
||||
if (!previewGif.exists() || !(previewGif.size() > 0)) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewGifError);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewGifError);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
emit processOutput(ffmpegOut);
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewGifFinished);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewGifFinished);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -412,7 +405,7 @@ bool CreateImportVideo::createWallpaperGifPreview()
|
||||
bool CreateImportVideo::createWallpaperImageThumbnailPreview()
|
||||
{
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewImageThumbnail);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewImageThumbnail);
|
||||
|
||||
QStringList args;
|
||||
args.clear();
|
||||
@ -448,13 +441,13 @@ bool CreateImportVideo::createWallpaperImageThumbnailPreview()
|
||||
if (!ffmpegOut.isEmpty()) {
|
||||
const QFile previewImg(m_exportPath + "/previewThumbnail.jpg");
|
||||
if (!previewImg.exists() || !(previewImg.size() > 0)) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewImageThumbnailError);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewImageThumbnailError);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
emit processOutput(ffmpegOut);
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewImageThumbnailFinished);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewImageThumbnailFinished);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -465,7 +458,7 @@ bool CreateImportVideo::createWallpaperImageThumbnailPreview()
|
||||
bool CreateImportVideo::createWallpaperImagePreview()
|
||||
{
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewImage);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewImage);
|
||||
|
||||
QStringList args;
|
||||
args.clear();
|
||||
@ -492,13 +485,13 @@ bool CreateImportVideo::createWallpaperImagePreview()
|
||||
if (!ffmpegOut.isEmpty()) {
|
||||
const QFile previewImg(m_exportPath + "/preview.jpg");
|
||||
if (!previewImg.exists() || !(previewImg.size() > 0)) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewImageError);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewImageError);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
emit processOutput(ffmpegOut);
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingPreviewImageFinished);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingPreviewImageFinished);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -524,13 +517,13 @@ bool CreateImportVideo::createWallpaperImagePreview()
|
||||
*/
|
||||
bool CreateImportVideo::createWallpaperVideo()
|
||||
{
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingVideo);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingVideo);
|
||||
|
||||
connect(m_process.get(), &QProcess::readyReadStandardOutput, this, [&]() {
|
||||
QString tmpOut = m_process->readAllStandardOutput();
|
||||
qInfo() << tmpOut;
|
||||
if (tmpOut.contains("Conversion failed!")) {
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingVideoError);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingVideoError);
|
||||
}
|
||||
const auto tmpList = tmpOut.split(QRegularExpression("\\s+"), Qt::SplitBehaviorFlags::SkipEmptyParts);
|
||||
|
||||
@ -631,11 +624,11 @@ bool CreateImportVideo::createWallpaperVideo()
|
||||
QFile video(convertedFileAbsolutePath);
|
||||
if (!video.exists() || !(video.size() > 0)) {
|
||||
qDebug() << convertedFileAbsolutePath << ffmpegOutput << video.exists() << video.size();
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingVideoError);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingVideoError);
|
||||
return false;
|
||||
}
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingVideoFinished);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingVideoFinished);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -658,7 +651,7 @@ bool CreateImportVideo::createWallpaperVideo()
|
||||
bool CreateImportVideo::extractWallpaperAudio()
|
||||
{
|
||||
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingAudio);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingAudio);
|
||||
|
||||
QStringList args;
|
||||
args.append("-y");
|
||||
@ -679,13 +672,13 @@ bool CreateImportVideo::extractWallpaperAudio()
|
||||
if (!previewImg.exists() || !(previewImg.size() > 0)) {
|
||||
qDebug() << args;
|
||||
qDebug() << tmpErrImg;
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingAudioError);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingAudioError);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
emit processOutput(tmpErrImg);
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::ConvertingAudioFinished);
|
||||
emit createWallpaperStateChanged(Import::State::ConvertingAudioFinished);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -703,7 +696,7 @@ QString CreateImportVideo::waitForFinished(
|
||||
m_process = std::make_unique<QProcess>();
|
||||
QObject::connect(m_process.get(), &QProcess::errorOccurred, [=](QProcess::ProcessError error) {
|
||||
qDebug() << "error enum val = " << error << m_process->errorString();
|
||||
emit createWallpaperStateChanged(ImportVideoState::ImportVideoState::AnalyseVideoError);
|
||||
emit createWallpaperStateChanged(Import::State::AnalyseVideoError);
|
||||
m_process->terminate();
|
||||
if (!m_process->waitForFinished(1000)) {
|
||||
m_process->kill();
|
||||
|
@ -48,9 +48,9 @@ void InstalledListFilter::sortByName(const QString& name)
|
||||
Wallpaper,
|
||||
Widget,
|
||||
*/
|
||||
void InstalledListFilter::sortBySearchType(const ScreenPlay::SearchType::SearchType searchType)
|
||||
void InstalledListFilter::sortBySearchType(const ScreenPlay::ContentTypes::SearchType searchType)
|
||||
{
|
||||
if (searchType == SearchType::SearchType::All) {
|
||||
if (searchType == ContentTypes::SearchType::All) {
|
||||
resetFilter();
|
||||
emit sortChanged();
|
||||
return;
|
||||
|
@ -41,7 +41,7 @@ namespace ScreenPlay {
|
||||
We need to _flatten_ the json to make it work with a flat list model!
|
||||
See \sa getActiveSettingsJson to make the flat list to a hierarchical json object
|
||||
*/
|
||||
void ProjectSettingsListModel::init(const InstalledType::InstalledType& type, const QJsonObject& properties)
|
||||
void ProjectSettingsListModel::init(const ContentTypes::InstalledType& type, const QJsonObject& properties)
|
||||
{
|
||||
|
||||
for (QJsonObject::const_iterator itParent = properties.begin(); itParent != properties.end(); itParent++) {
|
||||
|
@ -98,8 +98,8 @@ void ScreenPlayManager::init(
|
||||
if we call the method when using via the settings on startup to skip a unnecessary save.
|
||||
*/
|
||||
bool ScreenPlayManager::createWallpaper(
|
||||
const InstalledType::InstalledType type,
|
||||
const FillMode::FillMode fillMode,
|
||||
const ContentTypes::InstalledType type,
|
||||
const Video::FillMode fillMode,
|
||||
const QString& absoluteStoragePath,
|
||||
const QString& previewImage,
|
||||
const QString& file,
|
||||
@ -182,7 +182,7 @@ bool ScreenPlayManager::createWallpaper(
|
||||
\brief Creates a ScreenPlayWidget object via a \a absoluteStoragePath and a \a preview image (relative path).
|
||||
*/
|
||||
bool ScreenPlayManager::createWidget(
|
||||
const InstalledType::InstalledType type,
|
||||
const ContentTypes::InstalledType type,
|
||||
const QPoint& position,
|
||||
const QString& absoluteStoragePath,
|
||||
const QString& previewImage,
|
||||
@ -333,10 +333,10 @@ bool ScreenPlayManager::setWallpaperValueAtMonitorIndex(const int index, const Q
|
||||
*/
|
||||
bool ScreenPlayManager::setWallpaperFillModeAtMonitorIndex(const int index, const int fillmode)
|
||||
{
|
||||
const auto fillModeTyped = static_cast<FillMode::FillMode>(fillmode);
|
||||
const auto fillModeTyped = static_cast<Video::FillMode>(fillmode);
|
||||
|
||||
if (auto appID = m_monitorListModel->getAppIDByMonitorIndex(index)) {
|
||||
return setWallpaperValue(*appID, "fillmode", QVariant::fromValue<FillMode::FillMode>(fillModeTyped).toString());
|
||||
return setWallpaperValue(*appID, "fillmode", QVariant::fromValue<Video::FillMode>(fillModeTyped).toString());
|
||||
}
|
||||
|
||||
qWarning() << "Could net get appID from m_monitorListModel!";
|
||||
@ -627,8 +627,8 @@ bool ScreenPlayManager::loadProfiles()
|
||||
const QString typeString = wallpaperObj.value("type").toString();
|
||||
const QJsonObject properties = wallpaperObj.value("properties").toObject();
|
||||
|
||||
const auto type = QStringToEnum<InstalledType::InstalledType>(typeString, InstalledType::InstalledType::VideoWallpaper);
|
||||
const auto fillMode = QStringToEnum<FillMode::FillMode>(fillModeString, FillMode::FillMode::Cover);
|
||||
const auto type = QStringToEnum<ContentTypes::InstalledType>(typeString, ContentTypes::InstalledType::VideoWallpaper);
|
||||
const auto fillMode = QStringToEnum<Video::FillMode>(fillModeString, Video::FillMode::Cover);
|
||||
|
||||
const bool success = createWallpaper(type, fillMode, absolutePath, previewImage, file, monitors, volume, playbackRate, properties, false);
|
||||
|
||||
@ -650,7 +650,7 @@ bool ScreenPlayManager::loadProfiles()
|
||||
const int positionX = widgetObj.value("positionX").toInt(0);
|
||||
const int positionY = widgetObj.value("positionY").toInt(0);
|
||||
const QPoint position { positionX, positionY };
|
||||
const auto type = QStringToEnum<InstalledType::InstalledType>(typeString, InstalledType::InstalledType::QMLWidget);
|
||||
const auto type = QStringToEnum<ContentTypes::InstalledType>(typeString, ContentTypes::InstalledType::QMLWidget);
|
||||
const QJsonObject properties = widgetObj.value("properties").toObject();
|
||||
|
||||
const bool success = createWidget(type, position, absolutePath, previewImage, properties, false);
|
||||
|
@ -25,8 +25,8 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
||||
const QString& file,
|
||||
const float volume,
|
||||
const float playbackRate,
|
||||
const FillMode::FillMode fillMode,
|
||||
const InstalledType::InstalledType type,
|
||||
const Video::FillMode fillMode,
|
||||
const ContentTypes::InstalledType type,
|
||||
const QJsonObject& properties,
|
||||
const std::shared_ptr<Settings>& settings,
|
||||
QObject* parent)
|
||||
@ -48,7 +48,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
||||
m_projectJson = projectOpt.value();
|
||||
}
|
||||
QJsonObject projectSettingsListModelProperties;
|
||||
if (type == InstalledType::InstalledType::VideoWallpaper) {
|
||||
if (type == ContentTypes::InstalledType::VideoWallpaper) {
|
||||
projectSettingsListModelProperties.insert("volume", m_volume);
|
||||
projectSettingsListModelProperties.insert("playbackRate", m_playbackRate);
|
||||
} else {
|
||||
@ -93,10 +93,10 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
||||
};
|
||||
|
||||
// Fixes issue 84 media key overlay in Qt apps
|
||||
if (m_type != InstalledType::InstalledType::GodotWallpaper) {
|
||||
if (m_type != ContentTypes::InstalledType::GodotWallpaper) {
|
||||
m_appArgumentsList.append(" --disable-features=HardwareMediaKeyHandling");
|
||||
}
|
||||
if (m_type == InstalledType::InstalledType::GodotWallpaper) {
|
||||
if (m_type == ContentTypes::InstalledType::GodotWallpaper) {
|
||||
if (m_projectJson.contains("version")) {
|
||||
const quint64 version = m_projectJson.value("version").toInt();
|
||||
const QString packageFileName = QString("project-v%1.zip").arg(version);
|
||||
@ -107,13 +107,13 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
||||
|
||||
bool ScreenPlayWallpaper::start()
|
||||
{
|
||||
if (m_type == InstalledType::InstalledType::GodotWallpaper) {
|
||||
if (m_type == ContentTypes::InstalledType::GodotWallpaper) {
|
||||
if (!exportGodotProject())
|
||||
return false;
|
||||
}
|
||||
|
||||
m_process.setArguments(m_appArgumentsList);
|
||||
if (m_type == InstalledType::InstalledType::GodotWallpaper) {
|
||||
if (m_type == ContentTypes::InstalledType::GodotWallpaper) {
|
||||
m_process.setProgram(m_globalVariables->godotWallpaperExecutablePath().toString());
|
||||
} else {
|
||||
m_process.setProgram(m_globalVariables->wallpaperExecutablePath().toString());
|
||||
@ -145,7 +145,7 @@ QJsonObject ScreenPlayWallpaper::getActiveSettingsJson()
|
||||
|
||||
QJsonObject obj;
|
||||
QJsonObject properties;
|
||||
if (m_type == InstalledType::InstalledType::VideoWallpaper) {
|
||||
if (m_type == ContentTypes::InstalledType::VideoWallpaper) {
|
||||
obj.insert("fillMode", QVariant::fromValue(m_fillMode).toString());
|
||||
obj.insert("isLooping", m_isLooping);
|
||||
obj.insert("volume", m_volume);
|
||||
@ -222,7 +222,7 @@ bool ScreenPlayWallpaper::setWallpaperValue(const QString& key, const QString& v
|
||||
setPlaybackRate(value.toFloat());
|
||||
}
|
||||
if (key == "fillmode") {
|
||||
setFillMode(QStringToEnum<FillMode::FillMode>(value, FillMode::FillMode::Cover));
|
||||
setFillMode(QStringToEnum<Video::FillMode>(value, Video::FillMode::Cover));
|
||||
}
|
||||
|
||||
const bool success = m_connection->sendMessage(QJsonDocument(obj).toJson(QJsonDocument::Compact));
|
||||
@ -273,8 +273,8 @@ bool ScreenPlayWallpaper::replace(
|
||||
const QString& previewImage,
|
||||
const QString& file,
|
||||
const float volume,
|
||||
const FillMode::FillMode fillMode,
|
||||
const InstalledType::InstalledType type,
|
||||
const Video::FillMode fillMode,
|
||||
const ContentTypes::InstalledType type,
|
||||
const bool checkWallpaperVisible)
|
||||
{
|
||||
|
||||
|
@ -21,7 +21,7 @@ ScreenPlayWidget::ScreenPlayWidget(
|
||||
const QString& absolutePath,
|
||||
const QString& previewImage,
|
||||
const QJsonObject& properties,
|
||||
const InstalledType::InstalledType type)
|
||||
const ContentTypes::InstalledType type)
|
||||
: QObject { nullptr }
|
||||
, m_globalVariables { globalVariables }
|
||||
, m_previewImage { previewImage }
|
||||
|
@ -68,12 +68,6 @@ Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
|
||||
setDesktopEnvironment(DesktopEnvironment::Wayland);
|
||||
#endif
|
||||
|
||||
qRegisterMetaType<Settings::Language>("Settings::Language");
|
||||
qRegisterMetaType<Settings::Theme>("Settings::Theme");
|
||||
qRegisterMetaType<Settings::DesktopEnvironment>("Settings::DesktopEnvironment");
|
||||
|
||||
qmlRegisterUncreatableType<Settings>("Settings", 1, 0, "Settings", "Error only for enums");
|
||||
|
||||
// Lets not set the dev version as startup.
|
||||
if (SCREENPLAY_DEPLOY_VERSION)
|
||||
if (desktopEnvironment() == DesktopEnvironment::Windows) {
|
||||
@ -92,9 +86,9 @@ Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
|
||||
setHighPriorityStart(m_qSettings.value("ScreenPlayExecutable", false).toBool());
|
||||
if (m_qSettings.contains("VideoFillMode")) {
|
||||
auto value = m_qSettings.value("VideoFillMode").toString();
|
||||
setVideoFillMode(QStringToEnum<FillMode::FillMode>(value, FillMode::FillMode::Cover));
|
||||
setVideoFillMode(QStringToEnum<Video::FillMode>(value, Video::FillMode::Cover));
|
||||
} else {
|
||||
setVideoFillMode(FillMode::FillMode::Cover);
|
||||
setVideoFillMode(Video::FillMode::Cover);
|
||||
}
|
||||
|
||||
if (m_qSettings.contains("Theme")) {
|
||||
@ -281,13 +275,17 @@ void Settings::initSteamInstalledPath()
|
||||
void Settings::setupLanguage()
|
||||
{
|
||||
QString langCode;
|
||||
if (m_qSettings.value("Language").isNull()) {
|
||||
|
||||
// Note: isNull is true of no "Language" entry _at all_ is set
|
||||
// isEmpty is true if we have an "Language" entry that is empty
|
||||
if (m_qSettings.value("Language").isNull() || m_qSettings.value("Language").toString().isEmpty()) {
|
||||
langCode = QLocale::system().name();
|
||||
// QML enum begin with uppercase: de_DE -> De_DE
|
||||
langCode = langCode.replace(0, 1, langCode.at(0).toUpper());
|
||||
} else {
|
||||
langCode = m_qSettings.value("Language").toString();
|
||||
}
|
||||
QStringList parts = langCode.split('_');
|
||||
|
||||
setLanguage(QStringToEnum<Language>(langCode, Language::En_US));
|
||||
retranslateUI();
|
||||
@ -324,6 +322,307 @@ bool Settings::retranslateUI()
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::setShowDefaultContent(bool showDefaultContent)
|
||||
{
|
||||
if (m_showDefaultContent == showDefaultContent)
|
||||
return;
|
||||
m_showDefaultContent = showDefaultContent;
|
||||
emit showDefaultContentChanged(showDefaultContent);
|
||||
}
|
||||
|
||||
void Settings::setqSetting(const QString& key, const QVariant& value)
|
||||
{
|
||||
m_qSettings.setValue(key, value);
|
||||
m_qSettings.sync();
|
||||
}
|
||||
|
||||
void Settings::setAutostart(bool autostart)
|
||||
{
|
||||
if (desktopEnvironment() == DesktopEnvironment::Windows) {
|
||||
|
||||
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
||||
if (autostart) {
|
||||
settings.setValue("ScreenPlay", QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + " -silent");
|
||||
settings.sync();
|
||||
} else {
|
||||
settings.remove("ScreenPlay");
|
||||
}
|
||||
}
|
||||
if (desktopEnvironment() == DesktopEnvironment::OSX) {
|
||||
const QString plistFileName = "app.screenplay.plist";
|
||||
QFile defaultPListFile(":/qml/ScreenPlayApp/assets/macos/" + plistFileName);
|
||||
defaultPListFile.open(QIODevice::ReadOnly);
|
||||
QString settingsPlistContent = defaultPListFile.readAll();
|
||||
if (!settingsPlistContent.contains("{{SCREENPLAY_PATH}}")) {
|
||||
qCritical() << "Unable to load plist settings template from qrc to set autostart!";
|
||||
return;
|
||||
}
|
||||
|
||||
QDir workingDir(QGuiApplication::applicationDirPath());
|
||||
workingDir.cdUp();
|
||||
workingDir.cdUp();
|
||||
workingDir.cdUp();
|
||||
const QString screenPlayPath = QUrl::fromUserInput(workingDir.path() + "/ScreenPlay.app/Contents/MacOS/ScreenPlay").toLocalFile();
|
||||
settingsPlistContent.replace("{{SCREENPLAY_PATH}}", screenPlayPath);
|
||||
settingsPlistContent.replace("{{SCREENPLAY_AUTOSTART}}", autostart ? "true" : "false");
|
||||
|
||||
const QString homePath = QDir::homePath();
|
||||
QFile settingsPlist(homePath + "/Library/LaunchAgents/" + plistFileName);
|
||||
if (settingsPlist.exists()) {
|
||||
QDomDocument doc;
|
||||
if (!doc.setContent(&settingsPlist)) {
|
||||
settingsPlist.close();
|
||||
return;
|
||||
}
|
||||
settingsPlist.close();
|
||||
|
||||
QDomElement root = doc.firstChildElement();
|
||||
QDomNodeList dictList = root.elementsByTagName("dict");
|
||||
if (dictList.size() > 1 && dictList.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if autostart and corresponding path is set and abort if so. This is needed since osx 13.0 Ventura
|
||||
// because it displays an annoying message every time we change the file.
|
||||
bool isCorrectPath = false;
|
||||
bool isAutostartEnabled = false;
|
||||
QDomNode dictNode = dictList.at(0);
|
||||
if (dictNode.isElement()) {
|
||||
QDomElement dictElement = dictNode.toElement();
|
||||
QDomNodeList keyList = dictElement.elementsByTagName("key");
|
||||
for (int j = 0; j < keyList.size(); j++) {
|
||||
QDomNode keyNode = keyList.at(j);
|
||||
if (keyNode.isElement()) {
|
||||
QDomElement keyElement = keyNode.toElement();
|
||||
if (keyElement.text() == "ProgramArguments") {
|
||||
QDomNode valueNode = keyNode.nextSibling();
|
||||
if (valueNode.isElement()) {
|
||||
QDomElement valueElement = valueNode.toElement();
|
||||
QDomNodeList stringList = valueElement.elementsByTagName("string");
|
||||
if (!stringList.isEmpty()) {
|
||||
QDomNode stringNode = stringList.at(0);
|
||||
if (stringNode.isElement()) {
|
||||
QDomElement stringElement = stringNode.toElement();
|
||||
const QString path = stringElement.text();
|
||||
if (path == screenPlayPath) {
|
||||
isCorrectPath = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dictNode.isElement()) {
|
||||
QDomElement dictElement = dictNode.toElement();
|
||||
QDomNodeList keyList = dictElement.elementsByTagName("key");
|
||||
for (int j = 0; j < keyList.size(); j++) {
|
||||
QDomNode keyNode = keyList.at(j);
|
||||
if (keyNode.isElement()) {
|
||||
QDomElement keyElement = keyNode.toElement();
|
||||
if (keyElement.text() == "RunAtLoad") {
|
||||
QDomNode valueNode = keyNode.nextSibling();
|
||||
if (valueNode.isElement()) {
|
||||
QDomElement valueElement = valueNode.toElement();
|
||||
if (valueElement.tagName() == "true") {
|
||||
isAutostartEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing to do. Autostart has the same value and the path is also correct.
|
||||
if (isAutostartEnabled == autostart && isCorrectPath)
|
||||
return;
|
||||
|
||||
if (!settingsPlist.remove()) {
|
||||
qCritical() << "Unable to remove: " << settingsPlist.fileName();
|
||||
}
|
||||
}
|
||||
|
||||
settingsPlist.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
||||
QTextStream out(&settingsPlist);
|
||||
out.setEncoding(QStringConverter::Utf8);
|
||||
out << settingsPlistContent;
|
||||
settingsPlist.flush();
|
||||
settingsPlist.close();
|
||||
|
||||
qInfo() << "Set autostart enabled: " << autostart;
|
||||
}
|
||||
setqSetting("Autostart", autostart);
|
||||
|
||||
m_autostart = autostart;
|
||||
emit autostartChanged(m_autostart);
|
||||
}
|
||||
|
||||
void Settings::setHighPriorityStart(bool highPriorityStart)
|
||||
{
|
||||
if (m_highPriorityStart == highPriorityStart)
|
||||
return;
|
||||
|
||||
setqSetting("HighPriorityStart", highPriorityStart);
|
||||
|
||||
const QString app = "'" + QGuiApplication::applicationDirPath() + "/WindowsServiceHelper.exe" + "'";
|
||||
QStringList args { "-Command", QString("Start-Process %1 -Verb runAs").arg(app), "-ArgumentList" };
|
||||
|
||||
// Because we must use powershell, we need to add an extra 'var' and ,
|
||||
auto appendAsString = [&](const QString& string, const bool isLast = false) {
|
||||
QString arg = "'" + string + "'";
|
||||
if (!isLast)
|
||||
arg += ",";
|
||||
args.append(arg);
|
||||
};
|
||||
|
||||
appendAsString("--t");
|
||||
appendAsString("create");
|
||||
appendAsString("--sn");
|
||||
appendAsString("ScreenPlayService");
|
||||
appendAsString("--dn");
|
||||
appendAsString("ScreenPlayService");
|
||||
appendAsString("--a");
|
||||
appendAsString(QVariant(highPriorityStart).toString(), true);
|
||||
|
||||
QProcess process;
|
||||
process.start(QStringLiteral("powershell"), args);
|
||||
process.waitForFinished(5000);
|
||||
|
||||
m_highPriorityStart = highPriorityStart;
|
||||
emit highPriorityStartChanged(m_highPriorityStart);
|
||||
}
|
||||
|
||||
void Settings::setLocalStoragePath(QUrl localStoragePath)
|
||||
{
|
||||
// Remove: "file:///"
|
||||
QJsonValue cleanedPath = QJsonValue(localStoragePath.toString());
|
||||
|
||||
setqSetting("ScreenPlayContentPath", cleanedPath);
|
||||
|
||||
m_globalVariables->setLocalStoragePath(cleanedPath.toString());
|
||||
emit resetInstalledListmodel();
|
||||
}
|
||||
|
||||
void Settings::setDecoder(QString decoder)
|
||||
{
|
||||
if (m_decoder == decoder)
|
||||
return;
|
||||
|
||||
m_decoder = decoder;
|
||||
|
||||
emit decoderChanged(m_decoder);
|
||||
}
|
||||
|
||||
void Settings::setOfflineMode(bool offlineMode)
|
||||
{
|
||||
if (m_offlineMode == offlineMode)
|
||||
return;
|
||||
|
||||
m_offlineMode = offlineMode;
|
||||
emit offlineModeChanged(m_offlineMode);
|
||||
}
|
||||
|
||||
void Settings::setSilentStart(bool silentStart)
|
||||
{
|
||||
if (m_silentStart == silentStart)
|
||||
return;
|
||||
|
||||
m_silentStart = silentStart;
|
||||
emit silentStartChanged(m_silentStart);
|
||||
}
|
||||
|
||||
void Settings::setAnonymousTelemetry(bool anonymousTelemetry)
|
||||
{
|
||||
if (m_anonymousTelemetry == anonymousTelemetry)
|
||||
return;
|
||||
|
||||
setqSetting("AnonymousTelemetry", anonymousTelemetry);
|
||||
|
||||
m_anonymousTelemetry = anonymousTelemetry;
|
||||
emit anonymousTelemetryChanged(m_anonymousTelemetry);
|
||||
}
|
||||
|
||||
void Settings::setCheckWallpaperVisible(bool checkWallpaperVisible)
|
||||
{
|
||||
if (m_checkWallpaperVisible == checkWallpaperVisible)
|
||||
return;
|
||||
|
||||
setqSetting("CheckWallpaperVisible", checkWallpaperVisible);
|
||||
|
||||
m_checkWallpaperVisible = checkWallpaperVisible;
|
||||
emit checkWallpaperVisibleChanged(m_checkWallpaperVisible);
|
||||
}
|
||||
|
||||
void Settings::setVideoFillMode(Video::FillMode videoFillMode)
|
||||
{
|
||||
if (m_videoFillMode == videoFillMode)
|
||||
return;
|
||||
|
||||
setqSetting("VideoFillMode", QVariant::fromValue(videoFillMode).toString());
|
||||
|
||||
m_videoFillMode = videoFillMode;
|
||||
emit videoFillModeChanged(m_videoFillMode);
|
||||
}
|
||||
|
||||
void Settings::setLanguage(Language language)
|
||||
{
|
||||
if (m_language == language)
|
||||
return;
|
||||
|
||||
setqSetting("Language", QVariant::fromValue(language).toString());
|
||||
|
||||
m_language = language;
|
||||
emit languageChanged(m_language);
|
||||
}
|
||||
|
||||
void Settings::setFont(QString font)
|
||||
{
|
||||
if (m_font == font)
|
||||
return;
|
||||
|
||||
m_font = font;
|
||||
emit fontChanged(m_font);
|
||||
}
|
||||
|
||||
void Settings::setTheme(Theme theme)
|
||||
{
|
||||
if (m_theme == theme)
|
||||
return;
|
||||
|
||||
setqSetting("Theme", QVariant::fromValue(theme).toString());
|
||||
|
||||
m_theme = theme;
|
||||
emit themeChanged(m_theme);
|
||||
}
|
||||
|
||||
void Settings::setSteamVersion(bool steamVersion)
|
||||
{
|
||||
if (m_steamVersion == steamVersion)
|
||||
return;
|
||||
|
||||
m_steamVersion = steamVersion;
|
||||
emit steamVersionChanged(m_steamVersion);
|
||||
}
|
||||
|
||||
void Settings::setDesktopEnvironment(DesktopEnvironment desktopEnvironment)
|
||||
{
|
||||
if (m_desktopEnvironment == desktopEnvironment)
|
||||
return;
|
||||
|
||||
m_desktopEnvironment = desktopEnvironment;
|
||||
emit desktopEnvironmentChanged(m_desktopEnvironment);
|
||||
}
|
||||
|
||||
void Settings::setBuildInfos(const QString& buildInfos)
|
||||
{
|
||||
if (m_buildInfos == buildInfos)
|
||||
return;
|
||||
m_buildInfos = buildInfos;
|
||||
emit buildInfosChanged(m_buildInfos);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief We must translate between qml langauge code and real ones.
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ void Wizards::createQMLWidget(const QString& title,
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", ScreenPlayUtil::fillArray(tags));
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("type", QVariant::fromValue(InstalledType::InstalledType::QMLWidget).toString());
|
||||
obj.insert("type", QVariant::fromValue(ContentTypes::InstalledType::QMLWidget).toString());
|
||||
obj.insert("file", "main.qml");
|
||||
|
||||
if (!Util::writeFileFromQrc(":/qml/ScreenPlayApp/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
@ -120,7 +120,7 @@ void Wizards::createHTMLWidget(const QString& title,
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", ScreenPlayUtil::fillArray(tags));
|
||||
obj.insert("type", QVariant::fromValue(InstalledType::InstalledType::HTMLWidget).toString());
|
||||
obj.insert("type", QVariant::fromValue(ContentTypes::InstalledType::HTMLWidget).toString());
|
||||
obj.insert("file", "index.html");
|
||||
|
||||
if (!Util::writeFileFromQrc(":/qml/ScreenPlayApp/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
@ -188,7 +188,7 @@ void Wizards::createHTMLWallpaper(
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", ScreenPlayUtil::fillArray(tags));
|
||||
obj.insert("type", QVariant::fromValue(InstalledType::InstalledType::HTMLWallpaper).toString());
|
||||
obj.insert("type", QVariant::fromValue(ContentTypes::InstalledType::HTMLWallpaper).toString());
|
||||
obj.insert("file", "index.html");
|
||||
|
||||
if (!Util::writeFileFromQrc(":/qml/ScreenPlayApp/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
@ -253,7 +253,7 @@ void Wizards::createQMLWallpaper(
|
||||
obj.insert("title", title);
|
||||
obj.insert("createdBy", createdBy);
|
||||
obj.insert("tags", ScreenPlayUtil::fillArray(tags));
|
||||
obj.insert("type", QVariant::fromValue(InstalledType::InstalledType::QMLWallpaper).toString());
|
||||
obj.insert("type", QVariant::fromValue(ContentTypes::InstalledType::QMLWallpaper).toString());
|
||||
obj.insert("file", "main.qml");
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
@ -331,7 +331,7 @@ void Wizards::createGodotWallpaper(
|
||||
obj.insert("godotVersionMajor", godotVersionMajor);
|
||||
obj.insert("godotVersionMinor", godotVersionMinor);
|
||||
obj.insert("tags", ScreenPlayUtil::fillArray(tags));
|
||||
obj.insert("type", QVariant::fromValue(InstalledType::InstalledType::GodotWallpaper).toString());
|
||||
obj.insert("type", QVariant::fromValue(ContentTypes::InstalledType::GodotWallpaper).toString());
|
||||
obj.insert("file", "wallpaper.tscn");
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
@ -413,7 +413,7 @@ void Wizards::createGifWallpaper(
|
||||
obj.insert("file", gifFileName);
|
||||
obj.insert("previewGIF", gifFileName);
|
||||
obj.insert("tags", ScreenPlayUtil::fillArray(tags));
|
||||
obj.insert("type", QVariant::fromValue(InstalledType::InstalledType::GifWallpaper).toString());
|
||||
obj.insert("type", QVariant::fromValue(ContentTypes::InstalledType::GifWallpaper).toString());
|
||||
|
||||
if (!Util::writeFileFromQrc(":/qml/ScreenPlayApp/assets/wizards/" + licenseFile, workingPath + "/" + licenseFile)) {
|
||||
qWarning() << "Could not write " << licenseFile;
|
||||
@ -463,7 +463,7 @@ void Wizards::createWebsiteWallpaper(
|
||||
QJsonObject obj;
|
||||
obj.insert("title", title);
|
||||
obj.insert("tags", ScreenPlayUtil::fillArray(tags));
|
||||
obj.insert("type", QVariant::fromValue(InstalledType::InstalledType::WebsiteWallpaper).toString());
|
||||
obj.insert("type", QVariant::fromValue(ContentTypes::InstalledType::WebsiteWallpaper).toString());
|
||||
obj.insert("url", url.toString());
|
||||
|
||||
if (!previewThumbnail.isEmpty()) {
|
||||
|
@ -114,15 +114,15 @@ void ScreenPlayTest::import_convert_video()
|
||||
QTest::qWait(1000);
|
||||
// Wait for Create::createWallpaperStart
|
||||
{
|
||||
ImportVideoState::ImportVideoState status = ImportVideoState::ImportVideoState::Idle;
|
||||
QObject::connect(app.create(), &Create::createWallpaperStateChanged, this, [&status](ImportVideoState::ImportVideoState state) {
|
||||
Import::State status = Import::State::Idle;
|
||||
QObject::connect(app.create(), &Create::createWallpaperStateChanged, this, [&status](Import::State state) {
|
||||
status = state;
|
||||
});
|
||||
|
||||
while (true) {
|
||||
QSignalSpy videoConvertFinishSpy(app.create(), &Create::createWallpaperStateChanged);
|
||||
if (status == ImportVideoState::ImportVideoState::Finished || status == ImportVideoState::ImportVideoState::Failed) {
|
||||
QVERIFY(status == ImportVideoState::ImportVideoState::Finished);
|
||||
if (status == Import::State::Finished || status == Import::State::Failed) {
|
||||
QVERIFY(status == Import::State::Finished);
|
||||
QTest::qWait(1000); // Wait for the ui to process the event
|
||||
break;
|
||||
}
|
||||
@ -137,15 +137,15 @@ void ScreenPlayTest::import_convert_video()
|
||||
|
||||
// Wait for Create::saveWallpaper
|
||||
{
|
||||
ImportVideoState::ImportVideoState status = ImportVideoState::ImportVideoState::Idle;
|
||||
QObject::connect(app.create(), &Create::createWallpaperStateChanged, this, [&status](ImportVideoState::ImportVideoState state) {
|
||||
Import::State status = Import::State::Idle;
|
||||
QObject::connect(app.create(), &Create::createWallpaperStateChanged, this, [&status](Import::State state) {
|
||||
status = state;
|
||||
});
|
||||
|
||||
while (true) {
|
||||
QSignalSpy videoConvertFinishSpy(app.create(), &Create::createWallpaperStateChanged);
|
||||
if (status == ImportVideoState::ImportVideoState::CreateProjectFileFinished || status == ImportVideoState::ImportVideoState::CreateProjectFileError || status == ImportVideoState::ImportVideoState::CopyFilesError) {
|
||||
QVERIFY(status == ImportVideoState::ImportVideoState::CreateProjectFileFinished);
|
||||
if (status == Import::State::CreateProjectFileFinished || status == Import::State::CreateProjectFileError || status == Import::State::CopyFilesError) {
|
||||
QVERIFY(status == Import::State::CreateProjectFileFinished);
|
||||
QTest::qWait(1000); // Wait for the ui to process the event
|
||||
break;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ set(SOURCES
|
||||
src/contenttypes.cpp
|
||||
src/logginghandler.cpp
|
||||
src/projectfile.cpp
|
||||
src/exitcodes.cpp
|
||||
src/util.cpp)
|
||||
|
||||
set(HEADER
|
||||
@ -98,6 +99,12 @@ target_include_directories(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC inc/public/
|
||||
PRIVATE src/)
|
||||
|
||||
# Note making this public is so thatscreenplayutil_qmltyperegistrations.cpp
|
||||
# can find the #include <contenttypes.h> include
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC inc/public/ScreenPlayUtil)
|
||||
|
||||
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
PRIVATE Qt6::Core Qt6::Quick
|
||||
|
@ -2,16 +2,25 @@
|
||||
|
||||
#pragma once
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
#include <QtCore/qmetatype.h>
|
||||
namespace ScreenPlay {
|
||||
/*!
|
||||
\namespace ScreenPlay::SearchType
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief Global enum for search types. Used in the "Installed" tab.
|
||||
*/
|
||||
namespace SearchType {
|
||||
Q_NAMESPACE
|
||||
|
||||
// We must package everything into a class for
|
||||
// qml to be able to have typed enums. Making
|
||||
// qml enums unscoped as default was a mistake.
|
||||
namespace ScreenPlay {
|
||||
|
||||
class ContentTypes : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
|
||||
/*!
|
||||
\namespace ScreenPlay::SearchType
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief Global enum for search types. Used in the "Installed" tab.
|
||||
*/
|
||||
public:
|
||||
ContentTypes(QObject* parent = nullptr);
|
||||
enum class SearchType {
|
||||
All,
|
||||
Text,
|
||||
@ -19,41 +28,16 @@ namespace SearchType {
|
||||
Wallpaper,
|
||||
Widget,
|
||||
};
|
||||
Q_ENUM_NS(SearchType)
|
||||
|
||||
}
|
||||
/*!
|
||||
\namespace ScreenPlay::FillMode
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief Global enum for fill mode. This is a c++ representation
|
||||
of HTML fill modes. We use "_" instead of "-" for scale down,
|
||||
because c++ forbids "-" in enum names.
|
||||
*/
|
||||
namespace FillMode {
|
||||
Q_NAMESPACE
|
||||
|
||||
enum class FillMode {
|
||||
Stretch,
|
||||
Fill,
|
||||
Contain,
|
||||
Cover,
|
||||
Scale_Down
|
||||
};
|
||||
Q_ENUM_NS(FillMode)
|
||||
|
||||
}
|
||||
/*!
|
||||
\namespace ScreenPlay::InstalledType
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief When changing the enum, one also needs to change:
|
||||
GlobalVariables::getAvailableWallpaper
|
||||
GlobalVariables::getAvailableWidgets
|
||||
Common/Util.js isWallpaper() and isWidget()
|
||||
ScreenPlayWallpaper: BaseWindow::parseWallpaperType()
|
||||
*/
|
||||
namespace InstalledType {
|
||||
Q_NAMESPACE
|
||||
|
||||
Q_ENUM(SearchType)
|
||||
/*!
|
||||
\namespace ScreenPlay::InstalledType
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief When changing the enum, one also needs to change:
|
||||
GlobalVariables::getAvailableWallpaper
|
||||
GlobalVariables::getAvailableWidgets
|
||||
Common/Util.js isWallpaper() and isWidget()
|
||||
ScreenPlayWallpaper: BaseWindow::parseWallpaperType()
|
||||
*/
|
||||
enum class InstalledType {
|
||||
Unknown,
|
||||
// Wallpaper
|
||||
@ -67,21 +51,40 @@ namespace InstalledType {
|
||||
QMLWidget,
|
||||
HTMLWidget,
|
||||
};
|
||||
Q_ENUM_NS(InstalledType)
|
||||
Q_ENUM(InstalledType)
|
||||
};
|
||||
|
||||
}
|
||||
class Video : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
|
||||
public:
|
||||
Video(QObject* parent = nullptr);
|
||||
/*!
|
||||
\namespace ScreenPlay::FillMode
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief Global enum for fill mode. This is a c++ representation
|
||||
of HTML fill modes. We use "_" instead of "-" for scale down,
|
||||
because c++ forbids "-" in enum names.
|
||||
*/
|
||||
enum class FillMode {
|
||||
Stretch,
|
||||
Fill,
|
||||
Contain,
|
||||
Cover,
|
||||
Scale_Down
|
||||
};
|
||||
Q_ENUM(FillMode)
|
||||
|
||||
/*!
|
||||
\namespace ScreenPlay::InstalledType
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief When changing the enum, one also needs to change:
|
||||
GlobalVariables::getAvailableWallpaper
|
||||
GlobalVariables::getAvailableWidgets
|
||||
Common/Util.js isWallpaper() and isWidget()
|
||||
ScreenPlayWallpaper: BaseWindow::parseWallpaperType()
|
||||
*/
|
||||
namespace VideoCodec {
|
||||
Q_NAMESPACE
|
||||
/*!
|
||||
\namespace ScreenPlay::InstalledType
|
||||
\inmodule ScreenPlayUtil
|
||||
\brief When changing the enum, one also needs to change:
|
||||
GlobalVariables::getAvailableWallpaper
|
||||
GlobalVariables::getAvailableWidgets
|
||||
Common/Util.js isWallpaper() and isWidget()
|
||||
ScreenPlayWallpaper: BaseWindow::parseWallpaperType()
|
||||
*/
|
||||
|
||||
enum class VideoCodec {
|
||||
Unknown,
|
||||
@ -91,6 +94,6 @@ namespace VideoCodec {
|
||||
H264,
|
||||
H265
|
||||
};
|
||||
Q_ENUM_NS(VideoCodec)
|
||||
}
|
||||
Q_ENUM(VideoCodec)
|
||||
};
|
||||
}
|
||||
|
@ -1,20 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
|
||||
namespace ScreenPlay {
|
||||
|
||||
Q_NAMESPACE
|
||||
|
||||
enum class WallpaperExitCode {
|
||||
Ok = 0,
|
||||
Invalid_ArgumentSize,
|
||||
Invalid_ActiveScreensList,
|
||||
Invalid_InstalledType,
|
||||
Invalid_CheckWallpaperVisible,
|
||||
Invalid_Volume,
|
||||
Invalid_AppID,
|
||||
Invalid_Setup_ProjectParsingError,
|
||||
Invalid_Setup_Error,
|
||||
Invalid_Start_Windows_HandleError,
|
||||
class WallpaperExit : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
|
||||
public:
|
||||
WallpaperExit(QObject* parent = nullptr);
|
||||
enum class Code {
|
||||
Ok = 0,
|
||||
Invalid_ArgumentSize,
|
||||
Invalid_ActiveScreensList,
|
||||
Invalid_InstalledType,
|
||||
Invalid_CheckWallpaperVisible,
|
||||
Invalid_Volume,
|
||||
Invalid_AppID,
|
||||
Invalid_Setup_ProjectParsingError,
|
||||
Invalid_Setup_Error,
|
||||
Invalid_Start_Windows_HandleError,
|
||||
};
|
||||
Q_ENUM(Code)
|
||||
};
|
||||
Q_ENUM_NS(WallpaperExitCode)
|
||||
}
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ struct ProjectFile {
|
||||
// Website Wallpaper
|
||||
QUrl url;
|
||||
// Video Wallpaper
|
||||
ScreenPlay::VideoCodec::VideoCodec videoCodec;
|
||||
ScreenPlay::Video::VideoCodec videoCodec;
|
||||
|
||||
QVariant publishedFileID { 0 };
|
||||
QStringList tags;
|
||||
|
||||
InstalledType::InstalledType type = InstalledType::InstalledType::Unknown;
|
||||
SearchType::SearchType searchType = SearchType::SearchType::All;
|
||||
ContentTypes::InstalledType type = ContentTypes::InstalledType::Unknown;
|
||||
ContentTypes::SearchType searchType = ContentTypes::SearchType::All;
|
||||
bool isNew = false;
|
||||
bool containsAudio = false;
|
||||
QDateTime lastModified;
|
||||
|
@ -15,9 +15,9 @@
|
||||
namespace ScreenPlayUtil {
|
||||
|
||||
QJsonArray fillArray(const QVector<QString>& items);
|
||||
ScreenPlay::SearchType::SearchType getSearchTypeFromInstalledType(const ScreenPlay::InstalledType::InstalledType type);
|
||||
std::optional<ScreenPlay::InstalledType::InstalledType> getInstalledTypeFromString(const QString& type);
|
||||
std::optional<ScreenPlay::VideoCodec::VideoCodec> getVideoCodecFromString(const QString& type);
|
||||
ScreenPlay::ContentTypes::SearchType getSearchTypeFromInstalledType(const ScreenPlay::ContentTypes::InstalledType type);
|
||||
std::optional<ScreenPlay::ContentTypes::InstalledType> getInstalledTypeFromString(const QString& type);
|
||||
std::optional<ScreenPlay::Video::VideoCodec> getVideoCodecFromString(const QString& type);
|
||||
std::optional<QJsonObject> parseQByteArrayToQJsonObject(const QByteArray& byteArray);
|
||||
std::optional<QJsonObject> openJsonFileToObject(const QString& path);
|
||||
std::optional<QString> openJsonFileToString(const QString& path);
|
||||
@ -36,8 +36,8 @@ QStringList getAvailableWallpaper();
|
||||
QStringList getAvailableWidgets();
|
||||
QStringList getAvailableTypes();
|
||||
QStringList getAvailableFillModes();
|
||||
bool isWallpaper(const ScreenPlay::InstalledType::InstalledType type);
|
||||
bool isWidget(const ScreenPlay::InstalledType::InstalledType type);
|
||||
bool isWallpaper(const ScreenPlay::ContentTypes::InstalledType type);
|
||||
bool isWidget(const ScreenPlay::ContentTypes::InstalledType type);
|
||||
std::optional<QVector<int>> parseStringToIntegerList(const QString string);
|
||||
float roundDecimalPlaces(const float number);
|
||||
}
|
||||
|
@ -1,6 +1,14 @@
|
||||
// SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
||||
#include "ScreenPlayUtil/contenttypes.h"
|
||||
|
||||
namespace ScreenPlayUtil {
|
||||
|
||||
namespace ScreenPlay {
|
||||
ContentTypes::ContentTypes(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
Video::Video(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
9
ScreenPlayUtil/src/exitcodes.cpp
Normal file
9
ScreenPlayUtil/src/exitcodes.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
// SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
||||
#include "ScreenPlayUtil/exitcodes.h"
|
||||
|
||||
namespace ScreenPlay {
|
||||
WallpaperExit::WallpaperExit(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
}
|
@ -37,13 +37,13 @@ bool ProjectFile::init()
|
||||
type = typeParsed.value();
|
||||
|
||||
// File is required. Website Wallpaper doe not have a file, but a url
|
||||
if (!obj.contains("file") && type != ScreenPlay::InstalledType::InstalledType::WebsiteWallpaper)
|
||||
if (!obj.contains("file") && type != ScreenPlay::ContentTypes::InstalledType::WebsiteWallpaper)
|
||||
return false;
|
||||
|
||||
if (type != ScreenPlay::InstalledType::InstalledType::WebsiteWallpaper) {
|
||||
if (type != ScreenPlay::ContentTypes::InstalledType::WebsiteWallpaper) {
|
||||
file = obj.value("file").toString();
|
||||
|
||||
if (type == ScreenPlay::InstalledType::InstalledType::GodotWallpaper) {
|
||||
if (type == ScreenPlay::ContentTypes::InstalledType::GodotWallpaper) {
|
||||
QFileInfo fileInfo(folder.path() + "/wallpaper.tscn");
|
||||
if (!fileInfo.exists()) {
|
||||
qCritical() << "Requested file:" << fileInfo.absoluteFilePath() << "does not exist!";
|
||||
@ -89,10 +89,10 @@ bool ProjectFile::init()
|
||||
}
|
||||
}
|
||||
|
||||
if (type == InstalledType::InstalledType::GifWallpaper) {
|
||||
if (type == ContentTypes::InstalledType::GifWallpaper) {
|
||||
preview = previewGIF;
|
||||
}
|
||||
if (type == ScreenPlay::InstalledType::InstalledType::WebsiteWallpaper) {
|
||||
if (type == ContentTypes::InstalledType::WebsiteWallpaper) {
|
||||
if (url.isEmpty()) {
|
||||
qWarning() << "No url was specified for a websiteWallpaper!";
|
||||
return false;
|
||||
@ -107,18 +107,18 @@ bool ProjectFile::init()
|
||||
} else {
|
||||
qWarning("Invalid videoCodec was specified inside the json object!");
|
||||
}
|
||||
} else if (type == ScreenPlay::InstalledType::InstalledType::VideoWallpaper) {
|
||||
} else if (type == ScreenPlay::ContentTypes::InstalledType::VideoWallpaper) {
|
||||
// qWarning("No videoCodec was specified inside the json object!");
|
||||
if (file.endsWith(".mp4")) {
|
||||
videoCodec = ScreenPlay::VideoCodec::VideoCodec::H264;
|
||||
videoCodec = ScreenPlay::Video::VideoCodec::H264;
|
||||
// qWarning("Eyeball to h264 because of .mp4");
|
||||
} else if (file.endsWith(".webm")) {
|
||||
videoCodec = ScreenPlay::VideoCodec::VideoCodec::VP8;
|
||||
videoCodec = ScreenPlay::Video::VideoCodec::VP8;
|
||||
// qWarning("Eyeball to VP8 because of .webm");
|
||||
}
|
||||
}
|
||||
|
||||
if (type == ScreenPlay::InstalledType::InstalledType::VideoWallpaper) {
|
||||
if (type == ScreenPlay::ContentTypes::InstalledType::VideoWallpaper) {
|
||||
QFileInfo audioFile(folder.absolutePath() + "/audio.mp3");
|
||||
containsAudio = audioFile.exists();
|
||||
}
|
||||
|
@ -204,63 +204,60 @@ QJsonArray fillArray(const QVector<QString>& items)
|
||||
/*!
|
||||
\brief Maps the Search type to an installed type. Used for filtering the installed content.
|
||||
*/
|
||||
ScreenPlay::SearchType::SearchType getSearchTypeFromInstalledType(const ScreenPlay::InstalledType::InstalledType type)
|
||||
ScreenPlay::ContentTypes::SearchType getSearchTypeFromInstalledType(const ScreenPlay::ContentTypes::InstalledType type)
|
||||
{
|
||||
using ScreenPlay::InstalledType::InstalledType;
|
||||
using ScreenPlay::SearchType::SearchType;
|
||||
|
||||
using namespace ScreenPlay;
|
||||
switch (type) {
|
||||
case InstalledType::GodotWallpaper:
|
||||
case InstalledType::HTMLWallpaper:
|
||||
case InstalledType::QMLWallpaper:
|
||||
case InstalledType::GifWallpaper:
|
||||
case InstalledType::WebsiteWallpaper:
|
||||
return SearchType::Scene;
|
||||
case InstalledType::VideoWallpaper:
|
||||
return SearchType::Wallpaper;
|
||||
case InstalledType::HTMLWidget:
|
||||
case InstalledType::QMLWidget:
|
||||
return SearchType::Widget;
|
||||
case InstalledType::Unknown:
|
||||
case ContentTypes::InstalledType::GodotWallpaper:
|
||||
case ContentTypes::InstalledType::HTMLWallpaper:
|
||||
case ContentTypes::InstalledType::QMLWallpaper:
|
||||
case ContentTypes::InstalledType::GifWallpaper:
|
||||
case ContentTypes::InstalledType::WebsiteWallpaper:
|
||||
return ContentTypes::SearchType::Scene;
|
||||
case ContentTypes::InstalledType::VideoWallpaper:
|
||||
return ContentTypes::SearchType::Wallpaper;
|
||||
case ContentTypes::InstalledType::HTMLWidget:
|
||||
case ContentTypes::InstalledType::QMLWidget:
|
||||
return ContentTypes::SearchType::Widget;
|
||||
case ContentTypes::InstalledType::Unknown:
|
||||
default:
|
||||
return SearchType::All;
|
||||
return ContentTypes::SearchType::All;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Maps the installed type from a QString to an enum. Used for parsing the project.json.
|
||||
*/
|
||||
std::optional<ScreenPlay::InstalledType::InstalledType> getInstalledTypeFromString(const QString& type)
|
||||
std::optional<ScreenPlay::ContentTypes::InstalledType> getInstalledTypeFromString(const QString& type)
|
||||
{
|
||||
using ScreenPlay::InstalledType::InstalledType;
|
||||
|
||||
using namespace ScreenPlay;
|
||||
if (type.endsWith("Wallpaper", Qt::CaseInsensitive)) {
|
||||
if (type.startsWith("video", Qt::CaseInsensitive)) {
|
||||
return InstalledType::VideoWallpaper;
|
||||
return ContentTypes::InstalledType::VideoWallpaper;
|
||||
}
|
||||
if (type.startsWith("qml", Qt::CaseInsensitive)) {
|
||||
return InstalledType::QMLWallpaper;
|
||||
return ContentTypes::InstalledType::QMLWallpaper;
|
||||
}
|
||||
if (type.startsWith("html", Qt::CaseInsensitive)) {
|
||||
return InstalledType::HTMLWallpaper;
|
||||
return ContentTypes::InstalledType::HTMLWallpaper;
|
||||
}
|
||||
if (type.startsWith("godot", Qt::CaseInsensitive)) {
|
||||
return InstalledType::GodotWallpaper;
|
||||
return ContentTypes::InstalledType::GodotWallpaper;
|
||||
}
|
||||
if (type.startsWith("website", Qt::CaseInsensitive)) {
|
||||
return InstalledType::WebsiteWallpaper;
|
||||
return ContentTypes::InstalledType::WebsiteWallpaper;
|
||||
}
|
||||
if (type.startsWith("gif", Qt::CaseInsensitive)) {
|
||||
return InstalledType::GifWallpaper;
|
||||
return ContentTypes::InstalledType::GifWallpaper;
|
||||
}
|
||||
}
|
||||
|
||||
if (type.endsWith("Widget", Qt::CaseInsensitive)) {
|
||||
if (type.startsWith("qml", Qt::CaseInsensitive)) {
|
||||
return InstalledType::QMLWidget;
|
||||
return ContentTypes::InstalledType::QMLWidget;
|
||||
}
|
||||
if (type.startsWith("html", Qt::CaseInsensitive)) {
|
||||
return InstalledType::HTMLWidget;
|
||||
return ContentTypes::InstalledType::HTMLWidget;
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,25 +267,25 @@ std::optional<ScreenPlay::InstalledType::InstalledType> getInstalledTypeFromStri
|
||||
/*!
|
||||
\brief Maps the video codec type from a QString to an enum. Used for parsing the project.json.
|
||||
*/
|
||||
std::optional<ScreenPlay::VideoCodec::VideoCodec> getVideoCodecFromString(const QString& type)
|
||||
std::optional<ScreenPlay::Video::VideoCodec> getVideoCodecFromString(const QString& type)
|
||||
{
|
||||
if (type.isEmpty())
|
||||
return std::nullopt;
|
||||
|
||||
if (type.contains("vp8", Qt::CaseInsensitive))
|
||||
return ScreenPlay::VideoCodec::VideoCodec::VP8;
|
||||
return ScreenPlay::Video::VideoCodec::VP8;
|
||||
|
||||
if (type.contains("vp9", Qt::CaseInsensitive))
|
||||
return ScreenPlay::VideoCodec::VideoCodec::VP9;
|
||||
return ScreenPlay::Video::VideoCodec::VP9;
|
||||
|
||||
if (type.contains("av1", Qt::CaseInsensitive))
|
||||
return ScreenPlay::VideoCodec::VideoCodec::AV1;
|
||||
return ScreenPlay::Video::VideoCodec::AV1;
|
||||
|
||||
if (type.contains("h264", Qt::CaseInsensitive))
|
||||
return ScreenPlay::VideoCodec::VideoCodec::H264;
|
||||
return ScreenPlay::Video::VideoCodec::H264;
|
||||
|
||||
if (type.contains("h265", Qt::CaseInsensitive))
|
||||
return ScreenPlay::VideoCodec::VideoCodec::H264;
|
||||
return ScreenPlay::Video::VideoCodec::H264;
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
@ -338,28 +335,26 @@ QStringList getAvailableTypes()
|
||||
/*!
|
||||
\brief Returns true of the given type is a wallpaper.
|
||||
*/
|
||||
bool isWallpaper(const ScreenPlay::InstalledType::InstalledType type)
|
||||
bool isWallpaper(const ScreenPlay::ContentTypes::InstalledType type)
|
||||
{
|
||||
|
||||
using ScreenPlay::InstalledType::InstalledType;
|
||||
|
||||
return (type == InstalledType::VideoWallpaper
|
||||
|| type == InstalledType::QMLWallpaper
|
||||
|| type == InstalledType::HTMLWallpaper
|
||||
|| type == InstalledType::GifWallpaper
|
||||
|| type == InstalledType::WebsiteWallpaper
|
||||
|| type == InstalledType::GodotWallpaper);
|
||||
using namespace ScreenPlay;
|
||||
return (type == ContentTypes::InstalledType::VideoWallpaper
|
||||
|| type == ContentTypes::InstalledType::QMLWallpaper
|
||||
|| type == ContentTypes::InstalledType::HTMLWallpaper
|
||||
|| type == ContentTypes::InstalledType::GifWallpaper
|
||||
|| type == ContentTypes::InstalledType::WebsiteWallpaper
|
||||
|| type == ContentTypes::InstalledType::GodotWallpaper);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns true of the given type is a widget.
|
||||
*/
|
||||
bool isWidget(const ScreenPlay::InstalledType::InstalledType type)
|
||||
bool isWidget(const ScreenPlay::ContentTypes::InstalledType type)
|
||||
{
|
||||
using namespace ScreenPlay;
|
||||
|
||||
using ScreenPlay::InstalledType::InstalledType;
|
||||
|
||||
return (type == InstalledType::QMLWidget || type == InstalledType::HTMLWidget);
|
||||
return (type == ContentTypes::InstalledType::QMLWidget || type == ContentTypes::InstalledType::HTMLWidget);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -77,47 +77,47 @@ int main(int argc, char* argv[])
|
||||
window->setAppID("test");
|
||||
window->setVolume(1);
|
||||
window->setFillMode("cover");
|
||||
window->setType(ScreenPlay::InstalledType::InstalledType::VideoWallpaper);
|
||||
window->setType(ScreenPlay::ContentTypes::InstalledType::VideoWallpaper);
|
||||
window->setCheckWallpaperVisible(true);
|
||||
window->setDebugMode(false);
|
||||
} else {
|
||||
// 8 parameter + 1 OS working directory as the first default paramter
|
||||
if (argumentList.length() != 9) {
|
||||
return static_cast<int>(ScreenPlay::WallpaperExitCode::Invalid_ArgumentSize);
|
||||
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_ArgumentSize);
|
||||
}
|
||||
|
||||
const auto activeScreensList = ScreenPlayUtil::parseStringToIntegerList(argumentList.at(1));
|
||||
|
||||
if (!activeScreensList.has_value()) {
|
||||
qCritical("Could not activeScreensList");
|
||||
return static_cast<int>(ScreenPlay::WallpaperExitCode::Invalid_ActiveScreensList);
|
||||
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_ActiveScreensList);
|
||||
}
|
||||
|
||||
auto installedType = ScreenPlay::InstalledType::InstalledType::Unknown;
|
||||
auto installedType = ScreenPlay::ContentTypes::InstalledType::Unknown;
|
||||
if (auto typeOpt = ScreenPlayUtil::getInstalledTypeFromString(argumentList.at(6))) {
|
||||
installedType = typeOpt.value();
|
||||
} else {
|
||||
qCritical() << "Cannot parse Wallpaper type from value" << argumentList.at(6);
|
||||
return static_cast<int>(ScreenPlay::WallpaperExitCode::Invalid_InstalledType);
|
||||
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_InstalledType);
|
||||
}
|
||||
|
||||
bool okParseCheckWallpaperVisible = false;
|
||||
const bool checkWallpaperVisible = argumentList.at(7).toInt(&okParseCheckWallpaperVisible);
|
||||
if (!okParseCheckWallpaperVisible) {
|
||||
qCritical("Could not parse checkWallpaperVisible");
|
||||
return static_cast<int>(ScreenPlay::WallpaperExitCode::Invalid_CheckWallpaperVisible);
|
||||
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_CheckWallpaperVisible);
|
||||
}
|
||||
bool okParseVolume = 0.0f;
|
||||
const float volume = argumentList.at(4).toFloat(&okParseVolume);
|
||||
if (!okParseVolume) {
|
||||
qCritical("Could not parse Volume");
|
||||
return static_cast<int>(ScreenPlay::WallpaperExitCode::Invalid_Volume);
|
||||
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_Volume);
|
||||
}
|
||||
|
||||
appID = argumentList.at(3);
|
||||
if (!appID.startsWith("appID=")) {
|
||||
qCritical("Invalid appID");
|
||||
return static_cast<int>(ScreenPlay::WallpaperExitCode::Invalid_AppID);
|
||||
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_AppID);
|
||||
}
|
||||
appID = appID.remove("appID=");
|
||||
|
||||
@ -132,11 +132,11 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
const auto setupStatus = window->setup();
|
||||
if (setupStatus != ScreenPlay::WallpaperExitCode::Ok) {
|
||||
if (setupStatus != ScreenPlay::WallpaperExit::Code::Ok) {
|
||||
return static_cast<int>(setupStatus);
|
||||
}
|
||||
const auto startStatus = window->start();
|
||||
if (startStatus != ScreenPlay::WallpaperExitCode::Ok) {
|
||||
if (startStatus != ScreenPlay::WallpaperExit::Code::Ok) {
|
||||
return static_cast<int>(startStatus);
|
||||
}
|
||||
emit window->qmlStart();
|
||||
|
@ -1,6 +1,5 @@
|
||||
import QtQuick
|
||||
import QtWebEngine
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
import ScreenPlayWallpaper
|
||||
|
||||
/*!
|
||||
|
@ -2,9 +2,6 @@ import QtQml
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import ScreenPlayWallpaper
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
import ScreenPlay.Enums.VideoCodec
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
|
@ -21,37 +21,23 @@
|
||||
BaseWindow::BaseWindow()
|
||||
{
|
||||
QGuiApplication::instance()->installEventFilter(this);
|
||||
|
||||
qRegisterMetaType<ScreenPlay::InstalledType::InstalledType>();
|
||||
qmlRegisterUncreatableMetaObject(ScreenPlay::InstalledType::staticMetaObject,
|
||||
"ScreenPlay.Enums.InstalledType",
|
||||
1, 0,
|
||||
"InstalledType",
|
||||
"Error: only enums");
|
||||
|
||||
qmlRegisterUncreatableMetaObject(ScreenPlay::VideoCodec::staticMetaObject,
|
||||
"ScreenPlay.Enums.VideoCodec",
|
||||
1, 0,
|
||||
"VideoCodec",
|
||||
"Error: only enums");
|
||||
|
||||
setOSVersion(QSysInfo::productVersion());
|
||||
}
|
||||
|
||||
ScreenPlay::WallpaperExitCode BaseWindow::setup()
|
||||
ScreenPlay::WallpaperExit::Code BaseWindow::setup()
|
||||
{
|
||||
|
||||
if (projectPath() == "test") {
|
||||
setType(ScreenPlay::InstalledType::InstalledType::QMLWallpaper);
|
||||
setType(ScreenPlay::ContentTypes::InstalledType::QMLWallpaper);
|
||||
setProjectSourceFileAbsolute({ "qrc:/qml/ScreenPlayWallpaper/qml/Test.qml" });
|
||||
setupLiveReloading();
|
||||
return ScreenPlay::WallpaperExitCode::Ok;
|
||||
return ScreenPlay::WallpaperExit::Code::Ok;
|
||||
}
|
||||
ScreenPlay::ProjectFile projectFile;
|
||||
projectFile.projectJsonFilePath = QFileInfo(projectPath() + "/project.json");
|
||||
if (!projectFile.init()) {
|
||||
qWarning() << "Invalid project at " << projectPath();
|
||||
return ScreenPlay::WallpaperExitCode::Invalid_Setup_ProjectParsingError;
|
||||
return ScreenPlay::WallpaperExit::Code::Invalid_Setup_ProjectParsingError;
|
||||
}
|
||||
setType(projectFile.type);
|
||||
setProjectSourceFile(projectFile.file);
|
||||
@ -65,7 +51,7 @@ ScreenPlay::WallpaperExitCode BaseWindow::setup()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_type == ScreenPlay::InstalledType::InstalledType::WebsiteWallpaper) {
|
||||
if (m_type == ScreenPlay::ContentTypes::InstalledType::WebsiteWallpaper) {
|
||||
setProjectSourceFileAbsolute(projectFile.url);
|
||||
} else {
|
||||
setProjectSourceFileAbsolute(QUrl::fromLocalFile(projectPath() + "/" + projectSourceFile()));
|
||||
@ -82,7 +68,7 @@ ScreenPlay::WallpaperExitCode BaseWindow::setup()
|
||||
sdk()->start();
|
||||
}
|
||||
|
||||
return ScreenPlay::WallpaperExitCode::Ok;
|
||||
return ScreenPlay::WallpaperExit::Code::Ok;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -159,7 +145,7 @@ void BaseWindow::replaceWallpaper(
|
||||
const QString type,
|
||||
const bool checkWallpaperVisible)
|
||||
{
|
||||
const ScreenPlay::InstalledType::InstalledType oldType = this->type();
|
||||
const ScreenPlay::ContentTypes::InstalledType oldType = this->type();
|
||||
setCheckWallpaperVisible(checkWallpaperVisible);
|
||||
setVolume(volume);
|
||||
setFillMode(fillMode);
|
||||
@ -174,13 +160,13 @@ void BaseWindow::replaceWallpaper(
|
||||
setProjectSourceFileAbsolute(QUrl::fromUserInput(absolutePath + "/" + file));
|
||||
}
|
||||
|
||||
if (m_type == ScreenPlay::InstalledType::InstalledType::QMLWallpaper || m_type == ScreenPlay::InstalledType::InstalledType::HTMLWallpaper)
|
||||
if (m_type == ScreenPlay::ContentTypes::InstalledType::QMLWallpaper || m_type == ScreenPlay::ContentTypes::InstalledType::HTMLWallpaper)
|
||||
emit reloadQML(oldType);
|
||||
|
||||
if (m_type == ScreenPlay::InstalledType::InstalledType::VideoWallpaper)
|
||||
if (m_type == ScreenPlay::ContentTypes::InstalledType::VideoWallpaper)
|
||||
emit reloadVideo(oldType);
|
||||
|
||||
if (m_type == ScreenPlay::InstalledType::InstalledType::GifWallpaper)
|
||||
if (m_type == ScreenPlay::ContentTypes::InstalledType::GifWallpaper)
|
||||
emit reloadGIF(oldType);
|
||||
}
|
||||
|
||||
@ -242,12 +228,12 @@ void BaseWindow::setupLiveReloading()
|
||||
}
|
||||
}
|
||||
|
||||
ScreenPlay::VideoCodec::VideoCodec BaseWindow::videoCodec() const
|
||||
ScreenPlay::Video::VideoCodec BaseWindow::videoCodec() const
|
||||
{
|
||||
return m_videoCodec;
|
||||
}
|
||||
|
||||
void BaseWindow::setVideoCodec(ScreenPlay::VideoCodec::VideoCodec newVideoCodec)
|
||||
void BaseWindow::setVideoCodec(ScreenPlay::Video::VideoCodec newVideoCodec)
|
||||
{
|
||||
if (m_videoCodec == newVideoCodec)
|
||||
return;
|
||||
|
@ -25,9 +25,9 @@ class BaseWindow : public QObject {
|
||||
public:
|
||||
BaseWindow();
|
||||
|
||||
virtual ScreenPlay::WallpaperExitCode setup() final;
|
||||
virtual ScreenPlay::WallpaperExit::Code setup() final;
|
||||
|
||||
virtual ScreenPlay::WallpaperExitCode start() = 0;
|
||||
virtual ScreenPlay::WallpaperExit::Code start() = 0;
|
||||
|
||||
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
|
||||
Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
|
||||
@ -54,8 +54,8 @@ public:
|
||||
Q_PROPERTY(float playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
|
||||
Q_PROPERTY(float currentTime READ currentTime WRITE setCurrentTime NOTIFY currentTimeChanged)
|
||||
|
||||
Q_PROPERTY(ScreenPlay::InstalledType::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
Q_PROPERTY(ScreenPlay::VideoCodec::VideoCodec videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged)
|
||||
Q_PROPERTY(ScreenPlay::ContentTypes::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
Q_PROPERTY(ScreenPlay::Video::VideoCodec videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged)
|
||||
Q_PROPERTY(QString OSVersion READ OSVersion WRITE setOSVersion NOTIFY OSVersionChanged)
|
||||
|
||||
Q_PROPERTY(ScreenPlaySDK* sdk READ sdk WRITE setSdk NOTIFY sdkChanged)
|
||||
@ -64,7 +64,7 @@ public:
|
||||
float volume() const { return m_volume; }
|
||||
bool isPlaying() const { return m_isPlaying; }
|
||||
float playbackRate() const { return m_playbackRate; }
|
||||
ScreenPlay::InstalledType::InstalledType type() const { return m_type; }
|
||||
ScreenPlay::ContentTypes::InstalledType type() const { return m_type; }
|
||||
QString appID() const { return m_appID; }
|
||||
QString OSVersion() const { return m_OSVersion; }
|
||||
bool muted() const { return m_muted; }
|
||||
@ -82,22 +82,22 @@ public:
|
||||
const QString& projectSourceFile() const { return m_projectSourceFile; }
|
||||
const QUrl& projectSourceFileAbsolute() const { return m_projectSourceFileAbsolute; }
|
||||
|
||||
ScreenPlay::VideoCodec::VideoCodec videoCodec() const;
|
||||
void setVideoCodec(ScreenPlay::VideoCodec::VideoCodec newVideoCodec);
|
||||
ScreenPlay::Video::VideoCodec videoCodec() const;
|
||||
void setVideoCodec(ScreenPlay::Video::VideoCodec newVideoCodec);
|
||||
|
||||
signals:
|
||||
void qmlStart();
|
||||
void qmlExit();
|
||||
void fadeIn();
|
||||
void reloadQML(const ScreenPlay::InstalledType::InstalledType oldType);
|
||||
void reloadVideo(const ScreenPlay::InstalledType::InstalledType oldType);
|
||||
void reloadGIF(const ScreenPlay::InstalledType::InstalledType oldType);
|
||||
void reloadQML(const ScreenPlay::ContentTypes::InstalledType oldType);
|
||||
void reloadVideo(const ScreenPlay::ContentTypes::InstalledType oldType);
|
||||
void reloadGIF(const ScreenPlay::ContentTypes::InstalledType oldType);
|
||||
|
||||
void loopsChanged(bool loops);
|
||||
void volumeChanged(float volume);
|
||||
void isPlayingChanged(bool isPlaying);
|
||||
void playbackRateChanged(float playbackRate);
|
||||
void typeChanged(ScreenPlay::InstalledType::InstalledType type);
|
||||
void typeChanged(ScreenPlay::ContentTypes::InstalledType type);
|
||||
void appIDChanged(QString appID);
|
||||
void qmlSceneValueReceived(QString key, QString value);
|
||||
void OSVersionChanged(QString OSVersion);
|
||||
@ -115,7 +115,7 @@ signals:
|
||||
void projectPathChanged(const QString& rojectPath);
|
||||
void projectSourceFileChanged(const QString& projectSourceFile);
|
||||
void projectSourceFileAbsoluteChanged(const QUrl& rojectSourceFileAbsolute);
|
||||
void videoCodecChanged(ScreenPlay::VideoCodec::VideoCodec codec);
|
||||
void videoCodecChanged(ScreenPlay::Video::VideoCodec codec);
|
||||
|
||||
public slots:
|
||||
void requestFadeIn();
|
||||
@ -173,7 +173,7 @@ public slots:
|
||||
m_playbackRate = playbackRate;
|
||||
emit playbackRateChanged(m_playbackRate);
|
||||
}
|
||||
void setType(ScreenPlay::InstalledType::InstalledType type)
|
||||
void setType(ScreenPlay::ContentTypes::InstalledType type)
|
||||
{
|
||||
if (m_type == type)
|
||||
return;
|
||||
@ -348,12 +348,12 @@ protected:
|
||||
int m_width { 0 };
|
||||
int m_height { 0 };
|
||||
|
||||
ScreenPlay::InstalledType::InstalledType m_type = ScreenPlay::InstalledType::InstalledType::Unknown;
|
||||
ScreenPlay::ContentTypes::InstalledType m_type = ScreenPlay::ContentTypes::InstalledType::Unknown;
|
||||
QVector<int> m_activeScreensList;
|
||||
QFileSystemWatcher m_fileSystemWatcher;
|
||||
QTimer m_liveReloadLimiter;
|
||||
QSysInfo m_sysinfo;
|
||||
std::unique_ptr<ScreenPlaySDK> m_sdk;
|
||||
QUrl m_projectSourceFileAbsolute;
|
||||
ScreenPlay::VideoCodec::VideoCodec m_videoCodec = ScreenPlay::VideoCodec::VideoCodec::Unknown;
|
||||
ScreenPlay::Video::VideoCodec m_videoCodec = ScreenPlay::Video::VideoCodec::Unknown;
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
\brief ScreenPlayWindow used for the Windows implementation.
|
||||
*/
|
||||
|
||||
ScreenPlay::WallpaperExitCode WinWindow::start()
|
||||
ScreenPlay::WallpaperExit::Code WinWindow::start()
|
||||
{
|
||||
connect(
|
||||
&m_window, &QQuickView::statusChanged, this, [this](auto status) {
|
||||
@ -41,7 +41,7 @@ ScreenPlay::WallpaperExitCode WinWindow::start()
|
||||
m_windowsIntegration.setWindowHandle(reinterpret_cast<HWND>(m_window.winId()));
|
||||
if (!IsWindow(m_windowsIntegration.windowHandle())) {
|
||||
qCritical("Could not get a valid window handle!");
|
||||
return ScreenPlay::WallpaperExitCode::Invalid_Start_Windows_HandleError;
|
||||
return ScreenPlay::WallpaperExit::Code::Invalid_Start_Windows_HandleError;
|
||||
}
|
||||
qRegisterMetaType<WindowsDesktopProperties*>();
|
||||
qRegisterMetaType<WinWindow*>();
|
||||
@ -105,8 +105,8 @@ ScreenPlay::WallpaperExitCode WinWindow::start()
|
||||
|
||||
// Handle the mouse event
|
||||
// For example, logging the mouse button and position
|
||||
qDebug() << "Mouse event: Button=" << mouseButton << ", Type=" << type
|
||||
<< ", Position=(" << p.x << ", " << p.y << ")" << globalPos << localPos << button;
|
||||
// qDebug() << "Mouse event: Button=" << mouseButton << ", Type=" << type
|
||||
// << ", Position=(" << p.x << ", " << p.y << ")" << globalPos << localPos << button;
|
||||
// Post the event to the target widget
|
||||
QCoreApplication::postEvent(&m_window, qEvent);
|
||||
});
|
||||
@ -125,13 +125,13 @@ ScreenPlay::WallpaperExitCode WinWindow::start()
|
||||
|
||||
// Handle the keyboard event
|
||||
// For example, logging the key press
|
||||
qDebug() << "Keyboard event: Key=" << vkCode << ", Type=" << (keyDown ? "KeyDown" : "KeyUp") << qEvent;
|
||||
// qDebug() << "Keyboard event: Key=" << vkCode << ", Type=" << (keyDown ? "KeyDown" : "KeyUp") << qEvent;
|
||||
|
||||
// Post the event to the target widget
|
||||
QCoreApplication::postEvent(&m_window, qEvent);
|
||||
});
|
||||
});
|
||||
return ScreenPlay::WallpaperExitCode::Ok;
|
||||
return ScreenPlay::WallpaperExit::Code::Ok;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -170,6 +170,9 @@ void WinWindow::setupWallpaperForOneScreen(int activeScreen)
|
||||
m_window.setHeight(height);
|
||||
};
|
||||
WindowsIntegration::MonitorResult monitor = m_windowsIntegration.setupWallpaperForOneScreen(activeScreen, updateWindowSize);
|
||||
if (monitor.status != WindowsIntegration::MonitorResultStatus::Ok) {
|
||||
qCritical("setupWallpaperForOneScreen failed status: ", (int)monitor.status);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -382,7 +385,6 @@ std::tuple<int, QString> WinWindow::mapVirtualKeyToQtKey(UINT vkCode)
|
||||
*/
|
||||
void WinWindow::terminate()
|
||||
{
|
||||
using ScreenPlay::InstalledType::InstalledType;
|
||||
|
||||
ShowWindow(m_windowsIntegration.windowHandle(), SW_HIDE);
|
||||
|
||||
|
@ -28,7 +28,7 @@ class WinWindow : public BaseWindow {
|
||||
public:
|
||||
WindowsDesktopProperties* windowsDesktopProperties() const { return m_windowsDesktopProperties.get(); }
|
||||
|
||||
ScreenPlay::WallpaperExitCode start() override;
|
||||
ScreenPlay::WallpaperExit::Code start() override;
|
||||
|
||||
public slots:
|
||||
void setVisible(bool show) override;
|
||||
|
@ -2,7 +2,7 @@ import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtWebEngine
|
||||
import ScreenPlayWidget
|
||||
import ScreenPlay.Enums.InstalledType
|
||||
|
||||
import ScreenPlayUtil as Util
|
||||
|
||||
Item {
|
||||
|
@ -32,14 +32,6 @@ WidgetWindow::WidgetWindow(
|
||||
, m_sdk { std::make_unique<ScreenPlaySDK>(appID, type) }
|
||||
, m_debugMode { debugMode }
|
||||
{
|
||||
|
||||
qRegisterMetaType<ScreenPlay::InstalledType::InstalledType>();
|
||||
qmlRegisterUncreatableMetaObject(ScreenPlay::InstalledType::staticMetaObject,
|
||||
"ScreenPlay.Enums.InstalledType",
|
||||
1, 0,
|
||||
"InstalledType",
|
||||
"Error: only enums");
|
||||
|
||||
Qt::WindowFlags flags = m_window.flags();
|
||||
if (QSysInfo::productType() == "macos") {
|
||||
// Setting it as a SlashScreen causes the window to hide on focus lost
|
||||
@ -58,7 +50,7 @@ WidgetWindow::WidgetWindow(
|
||||
|
||||
if (projectPath == "test") {
|
||||
setProjectSourceFileAbsolute({ "qrc:/qml/ScreenPlayWidget/qml/Test.qml" });
|
||||
setType(ScreenPlay::InstalledType::InstalledType::QMLWidget);
|
||||
setType(ScreenPlay::ContentTypes::InstalledType::QMLWidget);
|
||||
} else {
|
||||
setProjectPath(projectPath);
|
||||
auto projectOpt = ScreenPlayUtil::openJsonFileToObject(m_projectPath + "/project.json");
|
||||
|
@ -43,14 +43,14 @@ public:
|
||||
Q_PROPERTY(QString projectSourceFile READ projectSourceFile WRITE setProjectSourceFile NOTIFY projectSourceFileChanged)
|
||||
Q_PROPERTY(QUrl projectSourceFileAbsolute READ projectSourceFileAbsolute WRITE setProjectSourceFileAbsolute NOTIFY projectSourceFileAbsoluteChanged)
|
||||
Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged)
|
||||
Q_PROPERTY(ScreenPlay::InstalledType::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
Q_PROPERTY(ScreenPlay::ContentTypes::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
Q_PROPERTY(ScreenPlaySDK* sdk READ sdk WRITE setSdk NOTIFY sdkChanged)
|
||||
Q_PROPERTY(bool debugMode READ debugMode WRITE setDebugMode NOTIFY debugModeChanged)
|
||||
|
||||
QString appID() const { return m_appID; }
|
||||
QPoint position() const { return m_position; }
|
||||
const QString& projectPath() const { return m_projectPath; }
|
||||
ScreenPlay::InstalledType::InstalledType type() const { return m_type; }
|
||||
ScreenPlay::ContentTypes::InstalledType type() const { return m_type; }
|
||||
const QString& projectSourceFile() const { return m_projectSourceFile; }
|
||||
const QUrl& projectSourceFileAbsolute() const { return m_projectSourceFileAbsolute; }
|
||||
ScreenPlaySDK* sdk() const { return m_sdk.get(); }
|
||||
@ -58,12 +58,12 @@ public:
|
||||
|
||||
signals:
|
||||
void qmlExit();
|
||||
void reloadQML(const ScreenPlay::InstalledType::InstalledType oldType);
|
||||
void reloadQML(const ScreenPlay::ContentTypes::InstalledType oldType);
|
||||
void appIDChanged(QString appID);
|
||||
void qmlSceneValueReceived(QString key, QString value);
|
||||
void positionChanged(QPoint position);
|
||||
void projectPathChanged(const QString& projectPath);
|
||||
void typeChanged(ScreenPlay::InstalledType::InstalledType);
|
||||
void typeChanged(ScreenPlay::ContentTypes::InstalledType);
|
||||
void projectSourceFileChanged(const QString& projectSourceFile);
|
||||
void projectSourceFileAbsoluteChanged(const QUrl& projectSourceFileAbsolute);
|
||||
void sdkChanged(ScreenPlaySDK* sdk);
|
||||
@ -111,7 +111,7 @@ public slots:
|
||||
emit projectPathChanged(m_projectPath);
|
||||
}
|
||||
|
||||
void setType(ScreenPlay::InstalledType::InstalledType Type)
|
||||
void setType(ScreenPlay::ContentTypes::InstalledType Type)
|
||||
{
|
||||
if (m_type == Type)
|
||||
return;
|
||||
@ -165,7 +165,7 @@ private:
|
||||
QQuickView m_window;
|
||||
std::unique_ptr<ScreenPlaySDK> m_sdk;
|
||||
QTimer m_positionMessageLimiter;
|
||||
ScreenPlay::InstalledType::InstalledType m_type;
|
||||
ScreenPlay::ContentTypes::InstalledType m_type;
|
||||
QFileSystemWatcher m_fileSystemWatcher;
|
||||
QTimer m_liveReloadLimiter;
|
||||
QUrl m_projectSourceFileAbsolute;
|
||||
|
@ -3,7 +3,6 @@ import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import QtQuick.Layouts
|
||||
import Settings
|
||||
import ScreenPlay
|
||||
|
||||
Item {
|
||||
|
Loading…
Reference in New Issue
Block a user