1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-07-08 05:48:09 +02:00

Fix wallpaper enum types

This commit is contained in:
Elias Steurer 2023-12-03 11:43:17 +01:00
parent e2447d3fa4
commit e17e2abd9d
24 changed files with 74 additions and 42 deletions

View File

@ -429,7 +429,7 @@ Item {
description: qsTr("If your ScreenPlay missbehaves this is a good way to look for answers. This shows all logs and warning during runtime.")
buttonText: qsTr("Show Logs")
onButtonPressed: {
const logsPath = StandardPaths.writableLocation(StandardPaths.GenericDataLocation) + "/ScreenPlay/Logs";
const logsPath = QCore.StandardPaths.writableLocation(QCore.StandardPaths.GenericDataLocation) + "/ScreenPlay/Logs";
App.util.openFolderInExplorer(logsPath);
}
}

View File

@ -36,7 +36,7 @@ set(RESOURCES
assets/test_image_andras-vas-Bd7gNnWJBkU-unsplash.jpg)
qt_add_library(${PROJECT_NAME} STATIC)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick)
target_link_libraries(${PROJECT_NAME} PUBLIC Qt6::Core Qt6::Quick ScreenPlayUtilplugin)
target_include_directories(${PROJECT_NAME} PUBLIC src/)
qt_add_qml_module(

View File

@ -5,6 +5,7 @@
#include <QtQml/qqmlextensionplugin.h>
Q_IMPORT_QML_PLUGIN(ScreenPlayShaderPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin)
int main(int argc, char* argv[])
{

View File

@ -106,13 +106,14 @@ target_include_directories(
# 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_include_directories(${PROJECT_NAME}plugin PUBLIC inc/public/ScreenPlayUtil)
target_link_libraries(
${PROJECT_NAME}
PRIVATE Qt6::Core Qt6::Quick
PUBLIC
Qt6::Gui
Qt6::Core
Qt6::Quick
Qt6::Gui
fmt::fmt-header-only
LibArchive::LibArchive
QArchive)

View File

@ -15,7 +15,7 @@ class ContentTypes : public QObject {
QML_ELEMENT
Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
/*!
\brief Global enum for search types. Used in the "Installed" tab.
\brief Used in the "Installed" tab.
*/
public:
ContentTypes(QObject* parent = nullptr);
@ -57,7 +57,7 @@ class Video : public QObject {
public:
Video(QObject* parent = nullptr);
/*!
\brief Global enum for fill mode. This is a c++ representation
\brief This is a c++ representation
of HTML fill modes. We use "_" instead of "-" for scale down,
because c++ forbids "-" in enum names.
*/

View File

@ -80,7 +80,8 @@ qt_add_qml_module(
target_link_libraries(
${PROJECT_NAME}
PRIVATE ScreenPlaySDK
ScreenPlayUtil
ScreenPlayUtil
ScreenPlayUtilplugin
ScreenPlayWeatherplugin
Qt6::Quick
Qt6::Gui

View File

@ -23,10 +23,11 @@ Q_IMPORT_QML_PLUGIN(ScreenPlaySysInfoPlugin)
#endif
Q_IMPORT_QML_PLUGIN(ScreenPlayWeatherPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin)
int main(int argc, char* argv[])
{
using namespace ScreenPlay;
// Lets keep using it until: https://bugreports.qt.io/browse/QTBUG-109401
QtWebEngineQuick::initialize();
@ -83,14 +84,14 @@ int main(int argc, char* argv[])
} else {
// 8 parameter + 1 OS working directory as the first default paramter
if (argumentList.length() != 9) {
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_ArgumentSize);
return static_cast<int>(WallpaperExit::Code::Invalid_ArgumentSize);
}
ScreenPlay::Util util;
const auto activeScreensList = util.parseStringToIntegerList(argumentList.at(1));
if (!activeScreensList.has_value()) {
qCritical("Could not activeScreensList");
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_ActiveScreensList);
return static_cast<int>(WallpaperExit::Code::Invalid_ActiveScreensList);
}
auto installedType = ScreenPlay::ContentTypes::InstalledType::Unknown;
@ -98,26 +99,26 @@ int main(int argc, char* argv[])
installedType = typeOpt.value();
} else {
qCritical() << "Cannot parse Wallpaper type from value" << argumentList.at(6);
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_InstalledType);
return static_cast<int>(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::WallpaperExit::Code::Invalid_CheckWallpaperVisible);
return static_cast<int>(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::WallpaperExit::Code::Invalid_Volume);
return static_cast<int>(WallpaperExit::Code::Invalid_Volume);
}
appID = argumentList.at(3);
if (!appID.startsWith("appID=")) {
qCritical("Invalid appID");
return static_cast<int>(ScreenPlay::WallpaperExit::Code::Invalid_AppID);
return static_cast<int>(WallpaperExit::Code::Invalid_AppID);
}
appID = appID.remove("appID=");
@ -132,11 +133,11 @@ int main(int argc, char* argv[])
}
const auto setupStatus = window->setup();
if (setupStatus != ScreenPlay::WallpaperExit::Code::Ok) {
if (setupStatus != WallpaperExit::Code::Ok) {
return static_cast<int>(setupStatus);
}
const auto startStatus = window->start();
if (startStatus != ScreenPlay::WallpaperExit::Code::Ok) {
if (startStatus != WallpaperExit::Code::Ok) {
return static_cast<int>(startStatus);
}
emit window->qmlStart();

View File

@ -20,7 +20,8 @@ Rectangle {
// macOS only supports h264 via the native Qt MM
if (Qt.platform.os === "osx") {
if ((Wallpaper.videoCodec === Video.VideoCodec.VP8 || Wallpaper.videoCodec === Util.Video.VideoCodec.VP9)) {
print(ContentTypes.InstalledType.VideoWallpaper )
if ((Wallpaper.videoCodec === Video.VideoCodec.VP8 || Wallpaper.videoCodec === Video.VideoCodec.VP9)) {
loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaWebView.qml";
} else {
loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaView.qml";

View File

@ -18,26 +18,27 @@
\brief .
*/
namespace ScreenPlay {
BaseWindow::BaseWindow()
{
QGuiApplication::instance()->installEventFilter(this);
setOSVersion(QSysInfo::productVersion());
}
ScreenPlay::WallpaperExit::Code BaseWindow::setup()
WallpaperExit::Code BaseWindow::setup()
{
if (projectPath() == "test") {
setType(ScreenPlay::ContentTypes::InstalledType::QMLWallpaper);
setProjectSourceFileAbsolute({ "qrc:/qml/ScreenPlayWallpaper/qml/Test.qml" });
setupLiveReloading();
return ScreenPlay::WallpaperExit::Code::Ok;
return WallpaperExit::Code::Ok;
}
ScreenPlay::ProjectFile projectFile;
projectFile.projectJsonFilePath = QFileInfo(projectPath() + "/project.json");
if (!projectFile.init()) {
qWarning() << "Invalid project at " << projectPath();
return ScreenPlay::WallpaperExit::Code::Invalid_Setup_ProjectParsingError;
return WallpaperExit::Code::Invalid_Setup_ProjectParsingError;
}
setType(projectFile.type);
setProjectSourceFile(projectFile.file);
@ -68,7 +69,7 @@ ScreenPlay::WallpaperExit::Code BaseWindow::setup()
sdk()->start();
}
return ScreenPlay::WallpaperExit::Code::Ok;
return WallpaperExit::Code::Ok;
}
/*!
@ -240,5 +241,6 @@ void BaseWindow::setVideoCodec(ScreenPlay::Video::VideoCodec newVideoCodec)
m_videoCodec = newVideoCodec;
emit videoCodecChanged(newVideoCodec);
}
}
#include "moc_basewindow.cpp"

View File

@ -19,15 +19,16 @@
#include <memory>
namespace ScreenPlay {
class BaseWindow : public QObject {
Q_OBJECT
public:
BaseWindow();
virtual ScreenPlay::WallpaperExit::Code setup() final;
virtual WallpaperExit::Code setup() final;
virtual ScreenPlay::WallpaperExit::Code start() = 0;
virtual WallpaperExit::Code start() = 0;
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
@ -357,3 +358,4 @@ protected:
QUrl m_projectSourceFileAbsolute;
ScreenPlay::Video::VideoCodec m_videoCodec = ScreenPlay::Video::VideoCodec::Unknown;
};
}

View File

@ -6,7 +6,8 @@
#include <LayerShellQt/Shell>
#include <LayerShellQt/Window>
ScreenPlay::WallpaperExitCode LinuxWaylandWindow::start()
namespace ScreenPlay {
WallpaperExit::Code LinuxWaylandWindow::start()
{
if (!debugMode()) {
@ -31,7 +32,7 @@ ScreenPlay::WallpaperExitCode LinuxWaylandWindow::start()
}
m_window.show();
return ScreenPlay::WallpaperExitCode::Ok;
return WallpaperExit::Code::Ok;
}
void LinuxWaylandWindow::setupWallpaperForOneScreen(int activeScreen)
@ -59,4 +60,5 @@ void LinuxWaylandWindow::destroyThis()
void LinuxWaylandWindow::terminate()
{
QCoreApplication::quit();
}
}

View File

@ -14,11 +14,12 @@
#include "basewindow.h"
namespace ScreenPlay {
class LinuxWaylandWindow : public BaseWindow {
Q_OBJECT
public:
ScreenPlay::WallpaperExitCode start() override;
WallpaperExit::Code start() override;
signals:
@ -33,3 +34,4 @@ private:
void setupWallpaperForAllScreens();
void setupWallpaperForMultipleScreens(const QVector<int>& activeScreensList);
};
}

View File

@ -24,7 +24,8 @@
#define NAME "xwinwrap"
#define ATOM(a) XInternAtom(display, #a, False)
ScreenPlay::WallpaperExitCode LinuxX11Window::start()
namespace ScreenPlay {
WallpaperExit::Code LinuxX11Window::start()
{
if (!debugMode()) {
@ -111,7 +112,7 @@ ScreenPlay::WallpaperExitCode LinuxX11Window::start()
m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
m_window.setSource(QUrl("qrc:/qml/ScreenPlayWallpaper/qml/Wallpaper.qml"));
m_window.show();
return ScreenPlay::WallpaperExitCode::Ok;
return WallpaperExit::Code::Ok;
}
void LinuxX11Window::setupWallpaperForOneScreen(int activeScreen)
@ -139,4 +140,5 @@ void LinuxX11Window::destroyThis()
void LinuxX11Window::terminate()
{
QCoreApplication::quit();
}
}

View File

@ -13,12 +13,12 @@
#include <QVector>
#include "basewindow.h"
namespace ScreenPlay {
class LinuxX11Window : public BaseWindow {
Q_OBJECT
public:
ScreenPlay::WallpaperExitCode start() override;
WallpaperExit::Code start() override;
signals:
@ -33,3 +33,5 @@ private:
void setupWallpaperForAllScreens();
void setupWallpaperForMultipleScreens(const QVector<int>& activeScreensList);
};
}

View File

@ -4,7 +4,8 @@
#include <QGuiApplication>
ScreenPlay::WallpaperExitCode MacWindow::start()
namespace ScreenPlay {
WallpaperExit::Code MacWindow::start()
{
MacUtils::showDockIcon(false);
@ -31,7 +32,7 @@ ScreenPlay::WallpaperExitCode MacWindow::start()
MacIntegration* macIntegration = new MacIntegration(this);
macIntegration->SetBackgroundLevel(&m_window);
return ScreenPlay::WallpaperExitCode::Ok;
return WallpaperExit::Code::Ok;
}
void MacWindow::setVisible(bool show)
@ -53,5 +54,5 @@ void MacWindow::clearComponentCache()
{
m_window.engine()->clearComponentCache();
}
}
#include "moc_macwindow.cpp"

View File

@ -15,10 +15,11 @@
#include "basewindow.h"
#include "macintegration.h"
namespace ScreenPlay {
class MacWindow : public BaseWindow {
Q_OBJECT
public:
ScreenPlay::WallpaperExitCode start() override;
WallpaperExit::Code start() override;
signals:
@ -31,3 +32,4 @@ public slots:
private:
QQuickView m_window;
};
}

View File

@ -13,7 +13,9 @@
\brief ScreenPlayWindow used for the Windows implementation.
*/
ScreenPlay::WallpaperExit::Code WinWindow::start()
namespace ScreenPlay {
WallpaperExit::Code WinWindow::start()
{
connect(
&m_window, &QQuickView::statusChanged, this, [this](auto status) {
@ -41,7 +43,7 @@ ScreenPlay::WallpaperExit::Code 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::WallpaperExit::Code::Invalid_Start_Windows_HandleError;
return WallpaperExit::Code::Invalid_Start_Windows_HandleError;
}
qRegisterMetaType<WindowsDesktopProperties*>();
qRegisterMetaType<WinWindow*>();
@ -131,7 +133,7 @@ ScreenPlay::WallpaperExit::Code WinWindow::start()
QCoreApplication::postEvent(&m_window, qEvent);
});
});
return ScreenPlay::WallpaperExit::Code::Ok;
return WallpaperExit::Code::Ok;
}
/*!
@ -415,5 +417,6 @@ void WinWindow::checkForFullScreenWindow()
setVisualsPaused(hasFullscreenWindow);
}
}
#include "moc_winwindow.cpp"

View File

@ -20,6 +20,8 @@
#include "windowsdesktopproperties.h"
#include "windowsintegration.h"
namespace ScreenPlay {
class WinWindow : public BaseWindow {
Q_OBJECT
@ -28,7 +30,7 @@ class WinWindow : public BaseWindow {
public:
WindowsDesktopProperties* windowsDesktopProperties() const { return m_windowsDesktopProperties.get(); }
ScreenPlay::WallpaperExit::Code start() override;
WallpaperExit::Code start() override;
public slots:
void setVisible(bool show) override;
@ -67,3 +69,4 @@ private:
QTimer m_reconfigureTimer;
std::unique_ptr<WindowsDesktopProperties> m_windowsDesktopProperties;
};
}

View File

@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(LibArchive REQUIRED)
find_package(
Qt6
COMPONENTS Core Quick
@ -242,7 +243,7 @@ set(RESOURCES
assets/icons/wi-windy.svg)
qt_add_library(${PROJECT_NAME} STATIC)
target_link_libraries(${PROJECT_NAME} PUBLIC ScreenPlayUtil)
target_link_libraries(${PROJECT_NAME} PUBLIC ScreenPlayUtil ScreenPlayUtilplugin)
target_include_directories(${PROJECT_NAME} PUBLIC src/)
qt_add_qml_module(

View File

@ -4,6 +4,7 @@
#include <QtQml/qqmlextensionplugin.h>
Q_IMPORT_QML_PLUGIN(ScreenPlayWeatherPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin)
int main(int argc, char* argv[])
{

View File

@ -40,7 +40,8 @@ qt_add_executable(
target_link_libraries(
${PROJECT_NAME}
PRIVATE ScreenPlaySDK
ScreenPlayUtil
ScreenPlayUtil
ScreenPlayUtilplugin
ScreenPlayWeatherplugin
Qt6::Quick
Qt6::Gui
@ -52,7 +53,7 @@ target_link_libraries(
Qt6::WebEngineQuick)
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE ScreenPlaySysInfoplugin)
target_link_libraries(${PROJECT_NAME} PRIVATE ScreenPlaySysInfoplugin ScreenPlayUtilplugin)
endif()
qt_add_qml_module(

View File

@ -19,6 +19,7 @@ Q_IMPORT_QML_PLUGIN(ScreenPlaySysInfoPlugin)
#endif
Q_IMPORT_QML_PLUGIN(ScreenPlayWeatherPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin)
int main(int argc, char* argv[])
{

View File

@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(LibArchive REQUIRED)
find_package(
Qt6
COMPONENTS Core Quick QuickControls2

View File

@ -6,6 +6,7 @@
#include <QtQml/qqmlextensionplugin.h>
Q_IMPORT_QML_PLUGIN(ScreenPlayWorkshopPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin)
int main(int argc, char* argv[])
{