mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-10-06 09:17:07 +02:00
Fix macOS window flags
Fix empty project settings missing value return
This commit is contained in:
parent
51ab622ada
commit
3f6d83e363
@ -23,8 +23,8 @@ int main(int argc, char* argv[])
|
||||
// If we start with only one argument (path, appID, type),
|
||||
// it means we want to test a single widget
|
||||
if (argumentList.length() == 1) {
|
||||
// WidgetWindow spwmw("test", "appid", "qmlWidget", { 0, 0 }, true);
|
||||
WidgetWindow spwmw("C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/2136442401", "appid", "qmlWidget", { 0, 0 }, true);
|
||||
WidgetWindow spwmw("test", "appid", "qmlWidget", { 100, 100 }, true);
|
||||
//WidgetWindow spwmw("C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/2136442401", "appid", "qmlWidget", { 0, 0 }, true);
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
import QtQuick
|
||||
import ScreenPlayWidget
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
implicitWidth: 500
|
||||
implicitHeight: 300
|
||||
color: "#80000000"
|
||||
|
||||
|
||||
Text {
|
||||
id: name
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "widgetwindow.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QSysInfo>
|
||||
|
||||
#include "ScreenPlayUtil/contenttypes.h"
|
||||
#include "ScreenPlayUtil/util.h"
|
||||
@ -38,8 +39,13 @@ WidgetWindow::WidgetWindow(
|
||||
"Error: only enums");
|
||||
|
||||
Qt::WindowFlags flags = m_window.flags();
|
||||
m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::BypassWindowManagerHint | Qt::SplashScreen);
|
||||
m_window.setColor(Qt::transparent);
|
||||
if(QSysInfo::productType() == "macos") {
|
||||
// Setting it as a SlashScreen causes the window to hide on focus lost
|
||||
m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint );
|
||||
} else if(QSysInfo::productType() == "windows") {
|
||||
// Must be splash screen to not show up in the taskbar
|
||||
m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::BypassWindowManagerHint | Qt::SplashScreen);
|
||||
}
|
||||
|
||||
qmlRegisterSingletonInstance<WidgetWindow>("ScreenPlayWidget", 1, 0, "Widget", this);
|
||||
|
||||
@ -56,6 +62,7 @@ WidgetWindow::WidgetWindow(
|
||||
auto projectOpt = ScreenPlayUtil::openJsonFileToObject(m_projectPath + "/project.json");
|
||||
if (!projectOpt.has_value()) {
|
||||
qWarning() << "Unable to parse project file!";
|
||||
return;
|
||||
}
|
||||
|
||||
m_project = projectOpt.value();
|
||||
@ -68,10 +75,12 @@ WidgetWindow::WidgetWindow(
|
||||
qWarning() << "Cannot parse Wallpaper type from value" << m_project.value("type");
|
||||
}
|
||||
}
|
||||
|
||||
m_window.engine()->addImportPath(qGuiApp->applicationDirPath() + "/qml");
|
||||
m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
|
||||
m_window.setResizeMode(QQuickView::ResizeMode::SizeViewToRootObject);
|
||||
m_window.setSource(QUrl("qrc:/qml/ScreenPlayWidget/qml/Widget.qml"));
|
||||
m_window.setColor(Qt::transparent);
|
||||
m_window.setPosition(m_position);
|
||||
|
||||
// Debug mode means we directly start the ScreenPlayWallpaper for easy debugging.
|
||||
@ -102,7 +111,8 @@ WidgetWindow::WidgetWindow(
|
||||
});
|
||||
}
|
||||
|
||||
setupLiveReloading();
|
||||
if (projectPath != "test")
|
||||
setupLiveReloading();
|
||||
}
|
||||
|
||||
void WidgetWindow::setSize(QSize size)
|
||||
@ -209,3 +219,4 @@ void WidgetWindow::setupLiveReloading()
|
||||
QObject::connect(&m_liveReloadLimiter, &QTimer::timeout, this, reloadQMLLambda);
|
||||
m_fileSystemWatcher.addPaths({ projectPath() });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user