Commit a8bcac99 authored by Elias Steurer's avatar Elias Steurer 🇩🇪
Browse files

Fix wallpaper autostart and add CriticalError msg

This was caused because we have the wrong base path
- QDir workingDir(QDir::currentPath());
instead of
 - QDir workingDir(QGuiApplication::applicationDirPath());

when we start the app from a different folder.
parent 40b5c547
<RCC>
<qresource prefix="/">
<file>assets/WorkshopPreview.html</file>
<file>assets/fonts/LibreBaskerville-Italic.ttf</file>
<file>assets/fonts/NotoSans-Light.ttf</file>
<file>assets/fonts/NotoSans-Medium.ttf</file>
<file>assets/fonts/NotoSans-Regular.ttf</file>
<file>assets/fonts/NotoSans-Thin.ttf</file>
<file>assets/fonts/Roboto-Light.ttf</file>
<file>assets/fonts/Roboto-Regular.ttf</file>
<file>assets/fonts/Roboto-Thin.ttf</file>
<file>assets/fonts/RobotoMono-Light.ttf</file>
<file>assets/fonts/RobotoMono-Thin.ttf</file>
<file>assets/fonts/NotoSans-Light.ttf</file>
<file>assets/fonts/NotoSans-Medium.ttf</file>
<file>assets/fonts/NotoSans-Regular.ttf</file>
<file>assets/fonts/NotoSans-Thin.ttf</file>
<file>assets/icons/app.ico</file>
<file>assets/icons/brand_github.svg</file>
<file>assets/icons/brand_gitlab.svg</file>
<file>assets/icons/brand_twitch.svg</file>
<file>assets/icons/brand_twitter.svg</file>
<file>assets/icons/exclamation-triangle-solid.svg</file>
<file>assets/icons/font-awsome/close.svg</file>
<file>assets/icons/font-awsome/frown-o.svg</file>
<file>assets/icons/icon_arrow_left.svg</file>
<file>assets/icons/icon_arrow_right.svg</file>
<file>assets/icons/icon_build.svg</file>
<file>assets/icons/icon_cake.afdesign</file>
<file>assets/icons/icon_cake.svg</file>
<file>assets/icons/icon_close.svg</file>
<file>assets/icons/icon_code.svg</file>
<file>assets/icons/icon_community.svg</file>
<file>assets/icons/icon_delete.svg</file>
<file>assets/icons/icon_document.svg</file>
<file>assets/icons/icon_done.svg</file>
<file>assets/icons/icon_download.svg</file>
<file>assets/icons/icon_emptyWidget.svg</file>
<file>assets/icons/icon_folder_open.svg</file>
<file>assets/icons/icon_forum.svg</file>
<file>assets/icons/icon_hand_left.svg</file>
<file>assets/icons/icon_hand_right.svg</file>
<file>assets/icons/icon_heavy_metal.svg</file>
<file>assets/icons/icon_help_center.svg</file>
<file>assets/icons/icon_indicator_down.svg</file>
<file>assets/icons/icon_info.svg</file>
<file>assets/icons/icon_installed.svg</file>
<file>assets/icons/icon_launch.svg</file>
<file>assets/icons/icon_library_music.svg</file>
<file>assets/icons/icon_local_movies.svg</file>
<file>assets/icons/icon_logo_head.svg</file>
<file>assets/icons/icon_monitor.svg</file>
<file>assets/icons/icon_movie.svg</file>
<file>assets/icons/icon_multiple_images.svg</file>
<file>assets/icons/icon_new_releases.svg</file>
<file>assets/icons/icon_open_in_new.svg</file>
<file>assets/icons/icon_pause.svg</file>
<file>assets/icons/icon_people.svg</file>
<file>assets/icons/icon_play.svg</file>
<file>assets/icons/icon_plus.svg</file>
<file>assets/icons/icon_report_problem.svg</file>
<file>assets/icons/icon_scene.svg</file>
<file>assets/icons/icon_screen.svg</file>
<file>assets/icons/icon_search.svg</file>
<file>assets/icons/icon_settings.svg</file>
<file>assets/icons/icon_share.svg</file>
<file>assets/icons/icon_single_image.svg</file>
<file>assets/icons/icon_steam.svg</file>
<file>assets/icons/icon_supervisor_account.svg</file>
<file>assets/icons/icon_thumb_down.svg</file>
<file>assets/icons/icon_thumb_up.svg</file>
<file>assets/icons/icon_time.svg</file>
<file>assets/icons/icon_tv.svg</file>
<file>assets/icons/icon_upload.svg</file>
......@@ -52,95 +72,76 @@
<file>assets/icons/icon_volume_mute.svg</file>
<file>assets/icons/icon_volume_up.svg</file>
<file>assets/icons/icon_widgets.svg</file>
<file>assets/icons/icon_window.svg</file>
<file>assets/icons/monitor_setup.svg</file>
<file>assets/images/FFmpeg_Logo_new.svg</file>
<file>assets/images/Intro.png</file>
<file>assets/images/Intro_PC.png</file>
<file>assets/images/Intro_PC.svg</file>
<file>assets/images/Intro_shine.png</file>
<file>assets/images/ScreenPlayIconStomt.png</file>
<file>assets/images/Stomt_Logo+Wordmark_Mono_BLK.svg</file>
<file>assets/images/Untitled.png</file>
<file>assets/images/Window.svg</file>
<file>assets/images/ava.png</file>
<file>assets/images/hand_give.png</file>
<file>assets/images/mask.svg</file>
<file>assets/images/mask_round.svg</file>
<file>assets/images/mask_workshop.png</file>
<file>assets/images/missingPreview.png</file>
<file>assets/images/noisy-texture-2.png</file>
<file>assets/images/noisy-texture-3.png</file>
<file>assets/images/noisy-texture.png</file>
<file>assets/particle/backgroundGlow.png</file>
<file>assets/particle/dot.png</file>
<file>assets/shader/movingcolorramp.fsh</file>
<file>qtquickcontrols2.conf</file>
<file>assets/icons/icon_screen.svg</file>
<file>assets/icons/icon_close.svg</file>
<file>assets/images/FFmpeg_Logo_new.svg</file>
<file>profiles.json</file>
<file>assets/images/mask_round.svg</file>
<file>assets/icons/icon_launch.svg</file>
<file>assets/icons/brand_twitch.svg</file>
<file>assets/icons/brand_github.svg</file>
<file>assets/icons/brand_gitlab.svg</file>
<file>assets/icons/brand_twitter.svg</file>
<file>assets/icons/icon_done.svg</file>
<file>assets/wizards/example_html.png</file>
<file>assets/wizards/example_qml.png</file>
<file>assets/images/undraw_static_website_0107.svg</file>
<file>assets/licenses/Apache2.txt</file>
<file>assets/licenses/OFL.txt</file>
<file>legal/DataProtection.txt</file>
<file>legal/Font Awesome Free License.txt</file>
<file>legal/OFL.txt</file>
<file>legal/OpenSSL.txt</file>
<file>legal/Qt LGPLv3.txt</file>
<file>legal/gpl-3.0.txt</file>
<file>legal/lgpl-2.1.txt</file>
<file>assets/icons/icon_delete.svg</file>
<file>assets/icons/app.ico</file>
<file>assets/icons/icon_supervisor_account.svg</file>
<file>assets/icons/icon_new_releases.svg</file>
<file>assets/icons/icon_report_problem.svg</file>
<file>assets/icons/icon_help_center.svg</file>
<file>assets/icons/icon_forum.svg</file>
<file>assets/icons/icon_thumb_up.svg</file>
<file>assets/icons/icon_thumb_down.svg</file>
<file>assets/icons/icon_cake.afdesign</file>
<file>assets/icons/icon_window.svg</file>
<file>assets/WorkshopPreview.html</file>
<file>assets/images/ava.png</file>
<file>assets/images/mask.svg</file>
<file>assets/images/mask_workshop.png</file>
<file>assets/images/Untitled.png</file>
<file>translations/ScreenPlay_zh_cn.qm</file>
<file>translations/ScreenPlay_de.qm</file>
<file>translations/ScreenPlay_en.qm</file>
<file>translations/ScreenPlay_es.qm</file>
<file>translations/ScreenPlay_fr.qm</file>
<file>translations/ScreenPlay_ko.qm</file>
<file>translations/ScreenPlay_ru.qm</file>
<file>translations/ScreenPlay_vi.qm</file>
<file>assets/icons/monitor_setup.svg</file>
<file>assets/startinfo/forums.png</file>
<file>assets/startinfo/gitlab.png</file>
<file>assets/startinfo/handbreak.png</file>
<file>assets/startinfo/qml_online.png</file>
<file>assets/startinfo/reddit.png</file>
<file>assets/particle/backgroundGlow.png</file>
<file>assets/particle/dot.png</file>
<file>assets/shader/movingcolorramp.fsh</file>
<file>assets/startinfo/blender.png</file>
<file>assets/startinfo/flaticon.png</file>
<file>assets/startinfo/forums.png</file>
<file>assets/startinfo/freesound.png</file>
<file>assets/startinfo/gimp.png</file>
<file>assets/startinfo/git_extentions.png</file>
<file>assets/startinfo/gitlab.png</file>
<file>assets/startinfo/godot.png</file>
<file>assets/startinfo/handbreak.png</file>
<file>assets/startinfo/inkscape.png</file>
<file>assets/startinfo/kdeenlive.png</file>
<file>assets/startinfo/krita.png</file>
<file>assets/startinfo/obs.png</file>
<file>assets/startinfo/qml_online.png</file>
<file>assets/startinfo/reddit.png</file>
<file>assets/startinfo/shadertoy.png</file>
<file>assets/startinfo/sharex.png</file>
<file>assets/startinfo/unsplash.png</file>
<file>assets/startinfo/vscode.png</file>
<file>assets/wizards/License_All_Rights_Reserved_1.0.txt</file>
<file>assets/wizards/License_Apache_2.0.txt</file>
<file>assets/wizards/License_CC_Attribution_4.0.txt</file>
<file>assets/wizards/License_CC0_1.0.txt</file>
<file>assets/wizards/License_CC_Attribution-NonCommercial-ShareAlike_4.0.txt</file>
<file>assets/wizards/License_CC_Attribution-ShareAlike_4.0.txt</file>
<file>assets/wizards/License_CC_Attribution_4.0.txt</file>
<file>assets/wizards/License_GPL_3.0.txt</file>
<file>assets/wizards/License_CC0_1.0.txt</file>
<file>assets/wizards/License_All_Rights_Reserved_1.0.txt</file>
<file>assets/startinfo/gimp.png</file>
<file>assets/startinfo/godot.png</file>
<file>assets/wizards/example_html.png</file>
<file>assets/wizards/example_qml.png</file>
<file>legal/DataProtection.txt</file>
<file>legal/Font Awesome Free License.txt</file>
<file>legal/OFL.txt</file>
<file>legal/OpenSSL.txt</file>
<file>legal/Qt LGPLv3.txt</file>
<file>legal/gpl-3.0.txt</file>
<file>legal/lgpl-2.1.txt</file>
<file>profiles.json</file>
<file>qtquickcontrols2.conf</file>
<file>translations/ScreenPlay_de.qm</file>
<file>translations/ScreenPlay_en.qm</file>
<file>translations/ScreenPlay_es.qm</file>
<file>translations/ScreenPlay_fr.qm</file>
<file>translations/ScreenPlay_ko.qm</file>
<file>translations/ScreenPlay_ru.qm</file>
<file>translations/ScreenPlay_vi.qm</file>
<file>translations/ScreenPlay_zh_cn.qm</file>
</qresource>
</RCC>
......@@ -153,7 +153,6 @@ void App::init()
m_profileListModel = make_shared<ProfileListModel>(m_globalVariables);
m_settings = make_shared<Settings>(m_globalVariables);
m_mainWindowEngine = make_unique<QQmlApplicationEngine>();
m_screenPlayManager->init(m_globalVariables, m_monitorListModel, m_telemetry, m_settings);
// Only create tracker if user did not disallow!
if (m_settings->anonymousTelemetry()) {
......@@ -189,13 +188,13 @@ void App::init()
emit m_settings->resetInstalledListmodel();
m_settings->setqSetting("ScreenPlayContentPath", localStoragePath.toString());
});
QObject::connect(m_monitorListModel.get(), &MonitorListModel::monitorConfigurationChanged, m_screenPlayManager.get(), &ScreenPlayManager::closeAllWallpapers);
// Init after we have the paths from settings
m_installedListModel->init();
// Set visible if the -silent parameter was not set
if (QApplication::instance()->arguments().contains("-silent")) {
qInfo() << "Starting in silent mode.";
settings()->setSilentStart(true);
}
......@@ -203,6 +202,10 @@ void App::init()
Util::appendToMetricsFile("Screenplay_app_qqmlapplicationengine_load_begin", m_continuousIntegrationMetricsTimer.msecsSinceReference());
m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
Util::appendToMetricsFile("Screenplay_app_qqmlapplicationengine_load_end", m_continuousIntegrationMetricsTimer.msecsSinceReference());
// Must be called last to display a error message on startup by the qml engine
m_screenPlayManager->init(m_globalVariables, m_monitorListModel, m_telemetry, m_settings);
QObject::connect(m_monitorListModel.get(), &MonitorListModel::monitorConfigurationChanged, m_screenPlayManager.get(), &ScreenPlayManager::closeAllWallpapers);
}
/*!
......
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="exclamation-triangle" class="svg-inline--fa fa-exclamation-triangle fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>
\ No newline at end of file
......@@ -85,9 +85,9 @@ ApplicationWindow {
}
function switchPage(name) {
if (nav.currentNavigationName === name){
if(name === "Installed")
ScreenPlay.installedListModel.reset()
if (nav.currentNavigationName === name) {
if (name === "Installed")
ScreenPlay.installedListModel.reset()
return
}
......@@ -111,8 +111,10 @@ ApplicationWindow {
id: dialogSteam
}
Dialogs.MonitorConfiguration {
id: dialogMonitorConfigurationChanged
Dialogs.MonitorConfiguration {}
Dialogs.CriticalError {
mainWindow: window
}
Common.TrayIcon {}
......
......@@ -87,5 +87,6 @@
<file>qml/Create/WizardsFiles/HTMLWidgetMain.html</file>
<file>qml/Common/LicenseSelector.qml</file>
<file>qml/Common/Util.js</file>
<file>qml/Common/Dialogs/CriticalError.qml</file>
</qresource>
</RCC>
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.12
import QtQuick.Window 2.2
import QtGraphicalEffects 1.15
import ScreenPlay 1.0
Dialog {
id: root
modal: true
anchors.centerIn: Overlay.overlay
standardButtons: Dialog.Ok | Dialog.Help
onHelpRequested: {
Qt.openUrlExternally(
"https://forum.screen-play.app/category/7/troubleshooting")
}
property Window mainWindow
property string message
Connections {
target: ScreenPlay.screenPlayManager
function onDisplayErrorPopup(msg) {
root.message = msg
root.mainWindow.show()
root.open()
}
}
contentItem: Item {
width: 600
height: 400
ColumnLayout {
anchors.margins: 20
anchors.fill: parent
spacing: 20
Image {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 150
Layout.preferredHeight: 150
source: "qrc:/assets/icons/exclamation-triangle-solid.svg"
fillMode: Image.PreserveAspectFit
layer {
enabled: true
effect: ColorOverlay {
color: Material.color(Material.DeepOrange)
}
}
}
Text {
text: root.message
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: 20
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
horizontalAlignment: Text.AlignHCenter
font.family: ScreenPlay.settings.font
font.pointSize: 16
color: Material.primaryTextColor
}
}
}
}
......@@ -5,7 +5,6 @@ import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import ScreenPlay 1.0
import ScreenPlay.Enums.FillMode 1.0
import Settings 1.0
......@@ -446,7 +445,7 @@ Item {
SettingsButton {
headline: qsTr("Logs")
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("Debug Messages")
buttonText: qsTr("Show Logs")
onButtonPressed: {
expanderDebug.toggle()
}
......
......@@ -171,6 +171,7 @@ void ScreenPlayManager::createWallpaper(
QObject::connect(wallpaper.get(), &ScreenPlayWallpaper::requestSave, this, &ScreenPlayManager::requestSaveProfiles);
QObject::connect(wallpaper.get(), &ScreenPlayWallpaper::requestClose, this, &ScreenPlayManager::removeApp);
QObject::connect(wallpaper.get(), &ScreenPlayWallpaper::error, this, &ScreenPlayManager::displayErrorPopup);
m_screenPlayWallpapers.append(wallpaper);
m_monitorListModel->setWallpaperActiveMonitor(wallpaper, monitorIndex);
increaseActiveWallpaperCounter();
......@@ -213,6 +214,7 @@ void ScreenPlayManager::createWidget(
QObject::connect(widget.get(), &ScreenPlayWidget::requestSave, this, &ScreenPlayManager::requestSaveProfiles);
QObject::connect(widget.get(), &ScreenPlayWidget::requestClose, this, &ScreenPlayManager::removeApp);
QObject::connect(widget.get(), &ScreenPlayWidget::error, this, &ScreenPlayManager::displayErrorPopup);
increaseActiveWidgetsCounter();
m_screenPlayWidgets.append(widget);
}
......@@ -568,6 +570,8 @@ void ScreenPlayManager::loadProfiles()
return;
}
qInfo() << "Loading profiles " << activeProfilesTmp.size();
for (const QJsonValueRef wallpaper : activeProfilesTmp) {
// TODO right now we limit ourself to one default profile
......@@ -613,8 +617,8 @@ void ScreenPlayManager::loadProfiles()
const auto type = QStringToEnum<InstalledType::InstalledType>(typeString, InstalledType::InstalledType::VideoWallpaper);
const auto fillMode = QStringToEnum<FillMode::FillMode>(fillModeString, FillMode::FillMode::Cover);
qInfo() << "Start wallpaper from profile:" << type << fillMode << monitors << absolutePath;
createWallpaper(type, fillMode, absolutePath, previewImage, file, monitors, volume, playbackRate, properties, false);
monitors.clear();
}
for (const QJsonValueRef widget : wallpaper.toObject().value("widgets").toArray()) {
......@@ -632,6 +636,7 @@ void ScreenPlayManager::loadProfiles()
const auto type = QStringToEnum<InstalledType::InstalledType>(typeString, InstalledType::InstalledType::QMLWidget);
const QJsonObject properties = widgetObj.value("properties").toObject();
qInfo() << "Start widget from profile:" << type << position << absolutePath;
createWidget(type, position, absolutePath, previewImage, properties, false);
}
}
......
......@@ -95,8 +95,8 @@ signals:
void requestSaveProfiles();
void requestRaise();
void profilesSaved();
void monitorConfigurationChanged();
void displayErrorPopup(const QString& msg);
private slots:
void saveProfiles();
......
......@@ -91,7 +91,13 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const QVector<int>& screenNumber,
m_process.setArguments(proArgs);
m_process.setProgram(m_globalVariables->wallpaperExecutablePath().toString());
m_process.startDetached();
const bool success = m_process.startDetached();
qInfo() << "Starting ScreenPlayWallpaper detached: " << (success ? "success" : "failed!");
if (!success) {
qInfo() << m_process.errorString();
emit requestClose(m_appID);
emit error(QString("Could not start Wallpaper: " + m_process.errorString()));
}
}
/*!
......
......@@ -165,6 +165,7 @@ signals:
void requestSave();
void requestClose(const QString& appID);
void error(const QString& msg);
public slots:
void processExit(int exitCode, QProcess::ExitStatus exitStatus);
......
......@@ -62,7 +62,13 @@ ScreenPlayWidget::ScreenPlayWidget(
QObject::connect(&m_process, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) {
qDebug() << "error: " << error;
});
m_process.startDetached();
const bool success = m_process.startDetached();
qInfo() << "Starting ScreenPlayWWidget detached: " << (success ? "success" : "failed!");
if (!success) {
qInfo() << m_process.errorString();
emit requestClose(m_appID);
emit error(QString("Could not start Widget: " + m_process.errorString()));
}
}
/*!
......
......@@ -158,6 +158,7 @@ signals:
void requestSave();
void requestClose(const QString& appID);
void error(const QString& msg);
private:
const std::shared_ptr<GlobalVariables> m_globalVariables;
......
......@@ -170,17 +170,11 @@ void Settings::writeJsonFileFromResource(const QString& filename)
*/
void Settings::setupWidgetAndWindowPaths()
{
QDir workingDir(QDir::currentPath());
QDir baseDir(QDir::currentPath());
QDir workingDir(QGuiApplication::applicationDirPath());
#if defined(Q_OS_WIN)
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget.exe"));
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper.exe"));
#endif
#if defined(Q_OS_LINUX)
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget"));
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/SScreenPlayWallpaper"));
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget" + Util::executableEnding()));
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper" + Util::executableEnding()));
#endif
#if defined(Q_OS_OSX)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment