2023-01-19 10:33:49 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
2023-02-03 16:17:47 +01:00
|
|
|
|
2023-02-03 17:03:10 +01:00
|
|
|
#include <QGuiApplication>
|
2018-03-08 22:03:05 +01:00
|
|
|
#include <QQmlApplicationEngine>
|
2023-02-18 14:30:06 +01:00
|
|
|
#include <QString>
|
2018-03-21 18:56:58 +01:00
|
|
|
#include <QStringList>
|
2023-05-25 15:14:16 +02:00
|
|
|
#include <QQmlExtensionPlugin>
|
2023-02-18 14:30:06 +01:00
|
|
|
#include "ScreenPlayWidget/CMakeVariables.h"
|
|
|
|
|
2020-01-10 15:26:25 +01:00
|
|
|
#include "src/widgetwindow.h"
|
2018-03-21 18:56:58 +01:00
|
|
|
|
2022-04-23 20:15:32 +02:00
|
|
|
#if defined(Q_OS_WIN)
|
2022-02-20 17:55:26 +01:00
|
|
|
Q_IMPORT_QML_PLUGIN(ScreenPlaySysInfoPlugin)
|
2022-04-23 20:15:32 +02:00
|
|
|
#endif
|
2023-02-04 17:34:59 +01:00
|
|
|
#if defined(Q_OS_OSX)
|
|
|
|
#include "ScreenPlayUtil/macutils.h"
|
|
|
|
#endif
|
2022-04-23 20:15:32 +02:00
|
|
|
|
|
|
|
Q_IMPORT_QML_PLUGIN(ScreenPlayWeatherPlugin)
|
2022-02-20 17:55:26 +01:00
|
|
|
|
2018-03-21 18:56:58 +01:00
|
|
|
int main(int argc, char* argv[])
|
2018-03-08 22:03:05 +01:00
|
|
|
{
|
2023-01-27 11:12:45 +01:00
|
|
|
|
|
|
|
#if !defined(Q_OS_LINUX)
|
2023-01-28 11:02:10 +01:00
|
|
|
qputenv("QT_MEDIA_BACKEND", "ffmpeg");
|
2023-01-27 11:12:45 +01:00
|
|
|
#endif
|
|
|
|
|
2018-12-01 18:01:17 +01:00
|
|
|
|
2023-02-03 16:17:47 +01:00
|
|
|
QGuiApplication app(argc, argv);
|
2018-03-08 22:03:05 +01:00
|
|
|
|
2021-05-14 12:50:22 +02:00
|
|
|
const QStringList argumentList = app.arguments();
|
2018-03-21 18:56:58 +01:00
|
|
|
|
2020-01-10 15:26:25 +01:00
|
|
|
// If we start with only one argument (path, appID, type),
|
2019-03-27 18:38:36 +01:00
|
|
|
// it means we want to test a single widget
|
2019-03-24 16:52:07 +01:00
|
|
|
if (argumentList.length() == 1) {
|
2023-06-02 10:19:12 +02:00
|
|
|
// WidgetWindow spwmw("test", "appid", "qmlWidget", { 100, 100 }, true);
|
2023-02-18 14:30:06 +01:00
|
|
|
|
|
|
|
QString exampleContentPath = QString(SCREENPLAY_SOURCE_DIR) + "/Content";
|
|
|
|
QStringList contentFolder = {
|
2023-03-25 14:26:17 +01:00
|
|
|
"/widget_weather",
|
2023-03-09 10:19:58 +01:00
|
|
|
"/widget_system_stats", // Note: Windows only
|
2023-03-25 14:26:17 +01:00
|
|
|
"/widget_hello_world",
|
2023-03-09 10:19:58 +01:00
|
|
|
"/widget_countDown",
|
2023-02-18 14:30:06 +01:00
|
|
|
"/widget_analogClock",
|
|
|
|
"/widget_digitalClock",
|
2023-02-25 12:44:46 +01:00
|
|
|
"/widget_rss_reddit",
|
|
|
|
"/widget_rss_dw_news",
|
2023-02-18 14:30:06 +01:00
|
|
|
"/widget_xkcd"
|
|
|
|
};
|
|
|
|
QString projectPath = exampleContentPath + contentFolder.at(0);
|
|
|
|
|
|
|
|
WidgetWindow spwmw(projectPath,
|
|
|
|
"appid",
|
|
|
|
"qmlWidget",
|
|
|
|
{ 0, 0 },
|
|
|
|
true);
|
|
|
|
|
2019-03-24 16:52:07 +01:00
|
|
|
return app.exec();
|
|
|
|
}
|
|
|
|
|
2020-07-13 17:59:20 +02:00
|
|
|
if (argumentList.length() != 6) {
|
2018-03-21 18:56:58 +01:00
|
|
|
return -3;
|
|
|
|
}
|
|
|
|
|
2020-07-13 17:59:20 +02:00
|
|
|
bool okPosX = false;
|
|
|
|
int positionX = QVariant(argumentList.at(4)).toInt(&okPosX);
|
|
|
|
if (!okPosX) {
|
|
|
|
qWarning() << "Could not parse PositionX value to int: " << argumentList.at(4);
|
|
|
|
positionX = 0;
|
|
|
|
}
|
|
|
|
bool okPosY = false;
|
|
|
|
int positionY = QVariant(argumentList.at(5)).toInt(&okPosY);
|
|
|
|
if (!okPosY) {
|
|
|
|
qWarning() << "Could not parse PositionY value to int: " << argumentList.at(5);
|
|
|
|
positionY = 0;
|
|
|
|
}
|
2018-03-08 22:03:05 +01:00
|
|
|
|
2021-05-14 12:50:22 +02:00
|
|
|
WidgetWindow spwmw(
|
|
|
|
argumentList.at(1), // Project path,
|
|
|
|
argumentList.at(2), // AppID
|
|
|
|
argumentList.at(3), // Type
|
|
|
|
QPoint { positionX, positionY });
|
2023-02-18 14:30:06 +01:00
|
|
|
|
2023-02-04 17:34:59 +01:00
|
|
|
#if defined(Q_OS_OSX)
|
|
|
|
MacUtils::showDockIcon(false);
|
|
|
|
#endif
|
2023-02-18 14:30:06 +01:00
|
|
|
|
2018-03-08 22:03:05 +01:00
|
|
|
return app.exec();
|
|
|
|
}
|