1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-24 11:42:52 +01:00

Add Godot export_presets to wizard to fix package of pck file

Update godot-cpp

Format all files

Fix Godot wallpaper setup on primary screen
This commit is contained in:
Elias Steurer 2023-11-17 13:37:47 +01:00
parent 11faefdbfd
commit 7ea263dc2f
18 changed files with 274 additions and 273 deletions

View File

@ -12,7 +12,7 @@ config_version=5
config/name="Fjord"
run/main_scene="res://wallpaper.tscn"
config/features=PackedStringArray("4.1", "Mobile")
config/features=PackedStringArray("4.2", "Mobile")
config/icon="res://icon.svg"
[rendering]

View File

@ -60,6 +60,7 @@ set(QML
qml/Create/StartInfoLinkImage.qml
qml/Create/Wizard.qml
qml/Create/Wizards/GifWallpaper.qml
qml/Create/Wizards/GodotWallpaper.qml
qml/Create/Wizards/HTMLWallpaper.qml
qml/Create/Wizards/HTMLWidget.qml
qml/Create/Wizards/Importh264/Importh264.qml
@ -73,14 +74,14 @@ set(QML
qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml
qml/Create/Wizards/ImportWebm/ImportWebmInit.qml
qml/Create/Wizards/QMLWallpaper.qml
qml/Create/Wizards/GodotWallpaper.qml
qml/Create/Wizards/QMLWidget.qml
qml/Create/Wizards/WebsiteWallpaper.qml
qml/Create/Wizards/WizardPage.qml
qml/Create/WizardsFiles/QMLWallpaperMain.qml
qml/Create/WizardsFiles/QMLWidgetMain.qml
qml/Create/WizardsFiles/Godot_v5/export_presets.cfg
qml/Create/WizardsFiles/Godot_v5/project.godot
qml/Create/WizardsFiles/Godot_v5/wallpaper.tscn
qml/Create/WizardsFiles/QMLWallpaperMain.qml
qml/Create/WizardsFiles/QMLWidgetMain.qml
qml/Installed/Installed.qml
qml/Installed/InstalledNavigation.qml
qml/Installed/InstalledWelcomeScreen.qml
@ -149,6 +150,7 @@ set(RESOURCES
assets/icons/icon_document.svg
assets/icons/icon_done.svg
assets/icons/icon_download.svg
assets/icons/icon_edit.svg
assets/icons/icon_emptyWidget.svg
assets/icons/icon_folder_open.svg
assets/icons/icon_forum.svg
@ -185,7 +187,6 @@ set(RESOURCES
assets/icons/icon_widgets.svg
assets/icons/icon_window.svg
assets/icons/item_banner_new.svg
assets/icons/icon_edit.svg
assets/icons/monitor_setup.svg
assets/icons/steam_default_avatar.png
assets/images/Early_Access.png

View File

@ -84,7 +84,6 @@ public slots:
const QString& previewThumbnail,
const QVector<QString>& tags);
void createGodotWallpaper(
const QString& title,
const QString& licenseName,

View File

@ -23,40 +23,36 @@ ApplicationWindow {
function setTheme(theme) {
switch (theme) {
case Settings.System:
root.Material.theme = Material.System
break
root.Material.theme = Material.System;
break;
case Settings.Dark:
root.Material.theme = Material.Dark
break
root.Material.theme = Material.Dark;
break;
case Settings.Light:
root.Material.theme = Material.Light
break
root.Material.theme = Material.Light;
break;
}
}
function switchPage(name) {
if (nav.currentNavigationName === name) {
if (name === "Installed")
App.installedListModel.reset()
App.installedListModel.reset();
}
if (name === "Installed") {
stackView.replace(
"qrc:/qml/ScreenPlayApp/qml/Installed/Installed.qml", {
"sidebar": sidebar
})
return
stackView.replace("qrc:/qml/ScreenPlayApp/qml/Installed/Installed.qml", {
"sidebar": sidebar
});
return;
}
stackView.replace(
"qrc:/qml/ScreenPlayApp/qml/" + name + "/" + name + ".qml",
{
"modalSource": content
})
nav.setNavigation(name)
sidebar.state = "inactive"
stackView.replace("qrc:/qml/ScreenPlayApp/qml/" + name + "/" + name + ".qml", {
"modalSource": content
});
nav.setNavigation(name);
sidebar.state = "inactive";
}
color: Material.theme === Material.Dark ? Qt.darker(
Material.background) : Material.background
color: Material.theme === Material.Dark ? Qt.darker(Material.background) : Material.background
// Set visible if the -silent parameter was not set (see app.cpp end of constructor).
visible: false
width: 1400
@ -78,28 +74,25 @@ ApplicationWindow {
Material.accent: Material.color(Material.Orange)
onVisibilityChanged: {
if (root.visibility !== 2)
return
return;
}
onClosing: close => {
close.accepted = false
if (App.screenPlayManager.activeWallpaperCounter === 0
&& App.screenPlayManager.activeWidgetsCounter === 0) {
App.exit()
}
const alwaysMinimize = settings.value("alwaysMinimize", null)
if (alwaysMinimize === null) {
console.error(
"Unable to retreive alwaysMinimize setting")
}
if (alwaysMinimize === "true") {
root.hide()
App.showDockIcon(false)
return
}
exitDialog.open()
}
close.accepted = false;
if (App.screenPlayManager.activeWallpaperCounter === 0 && App.screenPlayManager.activeWidgetsCounter === 0) {
App.exit();
}
const alwaysMinimize = settings.value("alwaysMinimize", null);
if (alwaysMinimize === null) {
console.error("Unable to retreive alwaysMinimize setting");
}
if (alwaysMinimize === "true") {
root.hide();
App.showDockIcon(false);
return;
}
exitDialog.open();
}
QCore.Settings {
id: settings
@ -112,13 +105,13 @@ ApplicationWindow {
}
Component.onCompleted: {
setTheme(App.settings.theme)
setTheme(App.settings.theme);
stackView.push("qrc:/qml/ScreenPlayApp/qml/Installed/Installed.qml", {
"sidebar": sidebar
})
"sidebar": sidebar
});
if (!App.settings.silentStart) {
App.showDockIcon(true)
root.show()
App.showDockIcon(true);
root.show();
}
App.installedListModel.reset();
}
@ -150,7 +143,7 @@ ApplicationWindow {
Connections {
function onThemeChanged(theme) {
setTheme(theme)
setTheme(theme);
}
target: App.settings
@ -158,7 +151,7 @@ ApplicationWindow {
Connections {
function onRequestNavigation(nav) {
switchPage(nav)
switchPage(nav);
}
target: App.util
@ -166,18 +159,16 @@ ApplicationWindow {
Connections {
function onRequestRaise() {
App.showDockIcon(true)
root.show()
App.showDockIcon(true);
root.show();
}
function onActiveWidgetsCounterChanged() {
plausible.pageView(
"widget/count/" + App.screenPlayManager.activeWidgetsCounter)
plausible.pageView("widget/count/" + App.screenPlayManager.activeWidgetsCounter);
}
function onActiveWallpaperCounterChanged() {
plausible.pageView(
"wallpaper/count/" + App.screenPlayManager.activeWallpaperCounter)
plausible.pageView("wallpaper/count/" + App.screenPlayManager.activeWallpaperCounter);
}
target: App.screenPlayManager
@ -235,16 +226,16 @@ ApplicationWindow {
Connections {
function onSetSidebarActive(active) {
if (active)
sidebar.state = "active"
sidebar.state = "active";
else
sidebar.state = "inactive"
sidebar.state = "inactive";
}
function onSetNavigationItem(pos) {
if (pos === 0)
nav.onPageChanged("Create")
nav.onPageChanged("Create");
else
nav.onPageChanged("Workshop")
nav.onPageChanged("Workshop");
}
target: stackView.currentItem
@ -273,8 +264,8 @@ ApplicationWindow {
}
onChangePage: function (name) {
monitors.close()
switchPage(name)
monitors.close();
switchPage(name);
}
}
}

View File

@ -92,7 +92,6 @@ Rectangle {
objectName: ""
}
ListElement {
headline: qsTr("QML Wallpaper")
source: "qrc:/qml/ScreenPlayApp/qml/Create/Wizards/QMLWallpaper.qml"

View File

@ -0,0 +1,15 @@
[preset.0]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false

View File

@ -25,23 +25,23 @@ Item {
function checkIsContentInstalled() {
if (App.installedListModel.count === 0) {
loaderHelp.active = true
gridView.footerItem.isVisible = true
gridView.visible = false
navWrapper.visible = false
loaderHelp.active = true;
gridView.footerItem.isVisible = true;
gridView.visible = false;
navWrapper.visible = false;
} else {
loaderHelp.active = false
gridView.footerItem.isVisible = false
refresh = false
gridView.contentY = -82
gridView.visible = true
navWrapper.visible = true
loaderHelp.active = false;
gridView.footerItem.isVisible = false;
refresh = false;
gridView.contentY = -82;
gridView.visible = true;
navWrapper.visible = true;
}
}
StackView.onActivated: {
navWrapper.state = "in"
checkIsContentInstalled()
navWrapper.state = "in";
checkIsContentInstalled();
}
Action {
@ -51,12 +51,12 @@ Item {
Connections {
function onInstalledLoadingFinished() {
checkIsContentInstalled()
checkIsContentInstalled();
}
function onCountChanged(count) {
if (count === 0)
checkIsContentInstalled()
checkIsContentInstalled();
}
target: App.installedListModel
@ -71,7 +71,7 @@ Item {
Connections {
function onSortChanged() {
gridView.positionViewAtBeginning()
gridView.positionViewAtBeginning();
}
target: App.installedListFilter
@ -85,8 +85,6 @@ Item {
property bool isScrolling: gridView.verticalVelocity !== 0
boundsBehavior: Flickable.DragOverBounds
maximumFlickVelocity: 3000
flickDeceleration: 7500
anchors.fill: parent
cellWidth: 340
cellHeight: 200
@ -128,12 +126,12 @@ Item {
}
onContentYChanged: {
if (contentY <= -180)
gridView.headerItem.isVisible = true
gridView.headerItem.isVisible = true;
else
gridView.headerItem.isVisible = false
gridView.headerItem.isVisible = false;
//Pull to refresh
if (contentY <= -180 && !refresh && !isDragging)
App.installedListModel.reset()
App.installedListModel.reset();
}
anchors {
@ -150,11 +148,11 @@ Item {
opacity: 0
onIsVisibleChanged: {
if (isVisible) {
txtHeader.color = Material.accent
txtHeader.text = qsTr("Refreshing!")
txtHeader.color = Material.accent;
txtHeader.text = qsTr("Refreshing!");
} else {
txtHeader.color = "gray"
txtHeader.text = qsTr("Pull to refresh!")
txtHeader.color = "gray";
txtHeader.text = qsTr("Pull to refresh!");
}
}
@ -162,7 +160,7 @@ Item {
interval: 150
running: true
onTriggered: {
animFadeIn.start()
animFadeIn.start();
}
}
@ -206,7 +204,7 @@ Item {
interval: 400
running: true
onTriggered: {
animFadeInTxtFooter.start()
animFadeInTxtFooter.start();
}
}
@ -236,23 +234,23 @@ Item {
isScrolling: gridView.isScrolling
onOpenContextMenu: function (position) {
// Set the menu to the current item informations
contextMenu.publishedFileID = delegate.publishedFileID
contextMenu.absoluteStoragePath = delegate.absoluteStoragePath
contextMenu.fileName = delegate.customTitle
contextMenu.type = delegate.type
print(delegate.publishedFileID)
if(contextMenu.godotItem)
contextMenu.godotItem.destroy()
const pos = delegate.mapToItem(root, position.x, position.y)
contextMenu.publishedFileID = delegate.publishedFileID;
contextMenu.absoluteStoragePath = delegate.absoluteStoragePath;
contextMenu.fileName = delegate.customTitle;
contextMenu.type = delegate.type;
print(delegate.publishedFileID);
if (contextMenu.godotItem)
contextMenu.godotItem.destroy();
const pos = delegate.mapToItem(root, position.x, position.y);
// Disable duplicate opening. The can happen if we
// call popup when we are in the closing animtion.
if (contextMenu.visible || contextMenu.opened)
return
return;
if (delegate.type === InstalledType.GodotWallpaper) {
contextMenu.godotItem = editGodotWallpaperComp.createObject()
contextMenu.insertItem(0, contextMenu.godotItem)
contextMenu.godotItem = editGodotWallpaperComp.createObject();
contextMenu.insertItem(0, contextMenu.godotItem);
}
contextMenu.popup(pos.x, pos.y)
contextMenu.popup(pos.x, pos.y);
}
}
@ -269,7 +267,7 @@ Item {
enabled: contextMenu.type === InstalledType.GodotWallpaper
icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_edit.svg"
onClicked: {
App.util.openGodotEditor(contextMenu.absoluteStoragePath)
App.util.openGodotEditor(contextMenu.absoluteStoragePath);
}
}
}
@ -290,7 +288,7 @@ Item {
objectName: "openFolder"
icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_folder_open.svg"
onClicked: {
App.util.openFolderInExplorer(contextMenu.absoluteStoragePath)
App.util.openFolderInExplorer(contextMenu.absoluteStoragePath);
}
}
@ -299,12 +297,10 @@ Item {
objectName: enabled ? "removeItem" : "removeWorkshopItem"
icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_import_export_.svg"
onClicked: {
exportFileDialog.absoluteStoragePath = contextMenu.absoluteStoragePath
let urlFileName = QCore.StandardPaths.writableLocation(
QCore.StandardPaths.DesktopLocation) + "/"
+ contextMenu.fileName + ".screenplay"
exportFileDialog.currentFile = urlFileName
exportFileDialog.open()
exportFileDialog.absoluteStoragePath = contextMenu.absoluteStoragePath;
let urlFileName = QCore.StandardPaths.writableLocation(QCore.StandardPaths.DesktopLocation) + "/" + contextMenu.fileName + ".screenplay";
exportFileDialog.currentFile = urlFileName;
exportFileDialog.open();
}
}
@ -312,21 +308,18 @@ Item {
text: enabled ? qsTr("Remove Item") : qsTr("Remove via Workshop")
objectName: enabled ? "removeItem" : "removeWorkshopItem"
icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_delete.svg"
enabled: contextMenu.publishedFileID === 0
|| !App.settings.steamVersion
enabled: contextMenu.publishedFileID === 0 || !App.settings.steamVersion
onClicked: {
deleteDialog.open()
deleteDialog.open();
}
}
MenuItem {
text: qsTr("Open Workshop Page")
enabled: contextMenu.publishedFileID !== 0
&& App.settings.steamVersion
enabled: contextMenu.publishedFileID !== 0 && App.settings.steamVersion
icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_steam.svg"
onClicked: {
Qt.openUrlExternally(
"steam://url/CommunityFilePage/" + contextMenu.publishedFileID)
Qt.openUrlExternally("steam://url/CommunityFilePage/" + contextMenu.publishedFileID);
}
}
}
@ -339,9 +332,8 @@ Item {
modalSource: root.modalSource
anchors.centerIn: Overlay.overlay
onAccepted: {
root.sidebar.clear()
App.installedListModel.deinstallItemAt(
contextMenu.absoluteStoragePath)
root.sidebar.clear();
App.installedListModel.deinstallItemAt(contextMenu.absoluteStoragePath);
}
}
@ -350,7 +342,7 @@ Item {
fileMode: FileDialog.SaveFile
property string absoluteStoragePath
onAccepted: {
exportFileProgressDialog.open()
exportFileProgressDialog.open();
}
}
@ -363,9 +355,7 @@ Item {
modalSource: root.modalSource
closePolicy: Popup.NoAutoClose
onOpened: {
const success = App.util.exportProject(
exportFileDialog.absoluteStoragePath,
exportFileDialog.currentFile)
const success = App.util.exportProject(exportFileDialog.absoluteStoragePath, exportFileDialog.currentFile);
}
onClosed: exportProgressBar.value = 0
ColumnLayout {
@ -390,10 +380,10 @@ Item {
id: exportConnections
target: App.util
function onCompressionProgressChanged(file, proc, total, br, bt) {
exportProgressBar.value = (br * 100 / bt)
exportProgressBar.value = (br * 100 / bt);
}
function onCompressionFinished() {
exportFileProgressDialog.close()
exportFileProgressDialog.close();
}
}
}
@ -413,31 +403,29 @@ Item {
anchors.fill: parent
property string filePath
onEntered: function (drag) {
dropPopup.open()
dropPopup.open();
}
onDropped: function (drop) {
dropPopup.close()
dropArea.enabled = false
dropPopup.close();
dropArea.enabled = false;
if (drop.urls.length > 1) {
importProjectErrorDialog.title = qsTr(
"We only support adding one item at once.")
importProjectErrorDialog.open()
return
importProjectErrorDialog.title = qsTr("We only support adding one item at once.");
importProjectErrorDialog.open();
return;
}
var file = ""
var file = "";
// Convert url to string
file = "" + drop.urls[0]
file = "" + drop.urls[0];
if (!file.endsWith('.screenplay')) {
importProjectErrorDialog.title = qsTr(
"File type not supported. We only support '.screenplay' files.")
importProjectErrorDialog.open()
return
importProjectErrorDialog.title = qsTr("File type not supported. We only support '.screenplay' files.");
importProjectErrorDialog.open();
return;
}
importDialog.open()
dropArea.filePath = file
importDialog.open();
dropArea.filePath = file;
}
onExited: {
dropPopup.close()
dropPopup.close();
}
Util.Dialog {
@ -458,11 +446,9 @@ Item {
closePolicy: Popup.NoAutoClose
onClosed: importProgressBar.value = 0
onOpened: {
const success = App.util.importProject(
dropArea.filePath,
App.globalVariables.localStoragePath)
print("finished", success)
dropArea.filePath = ""
const success = App.util.importProject(dropArea.filePath, App.globalVariables.localStoragePath);
print("finished", success);
dropArea.filePath = "";
}
ColumnLayout {
width: parent.width
@ -484,10 +470,10 @@ Item {
id: importConnections
target: App.util
function onExtractionProgressChanged(file, proc, total, br, bt) {
importProgressBar.value = (br * 100 / bt)
importProgressBar.value = (br * 100 / bt);
}
function onExtractionFinished() {
importDialog.close()
importDialog.close();
}
}
}
@ -503,8 +489,8 @@ Item {
modal: true
onOpened: fileDropAnimation.state = "fileDrop"
onClosed: {
fileDropAnimation.state = ""
dropArea.enabled = true
fileDropAnimation.state = "";
dropArea.enabled = true;
}
Util.FileDropAnimation {

View File

@ -13,7 +13,7 @@ Rectangle {
id: root
property string currentNavigationName: "Installed"
property var navArray: [navCreate, navWorkshop, navInstalled,navCommunity, navSettings]
property var navArray: [navCreate, navWorkshop, navInstalled, navCommunity, navSettings]
property bool navActive: true
property Item modalSource
property int iconWidth: 16
@ -30,11 +30,10 @@ Rectangle {
}
function setNavigation(name) {
for (var i = 0; i < navArray.length; i++) {
print(navArray[i].objectName)
if (navArray[i].objectName === name) {
navArray[i].state = "active";
root.currentNavigationName = name;
tabBar.currentIndex = navArray[i].index
tabBar.currentIndex = navArray[i].index;
} else {
navArray[i].state = "inactive";
}

View File

@ -14,23 +14,22 @@ SystemTrayIcon {
onActivated: function (reason) {
switch (reason) {
case SystemTrayIcon.Unknown:
break
break;
case SystemTrayIcon.Context:
break
break;
case SystemTrayIcon.DoubleClick:
window.show()
break
window.show();
break;
case SystemTrayIcon.Trigger:
break
break;
case SystemTrayIcon.MiddleClick:
break
break;
}
}
function open(){
App.showDockIcon(true)
window.show()
function open() {
App.showDockIcon(true);
window.show();
}
menu: Menu {
@ -38,16 +37,16 @@ SystemTrayIcon {
id: miOpenScreenPlay
text: qsTr("Open ScreenPlay")
onTriggered: {
root.open()
root.open();
}
}
MenuItem {
id: miChangeWallpaperSettings
text: qsTr("Change Wallpaper settings")
onTriggered: {
root.open()
root.open();
App.util.setNavigation("Installed");
App.util.setToggleWallpaperConfiguration()
App.util.setToggleWallpaperConfiguration();
}
}
MenuItem {
@ -57,7 +56,7 @@ SystemTrayIcon {
MenuItem {
text: qsTr("Browse Workshop")
onTriggered: {
root.open()
root.open();
App.util.setNavigation("Workshop");
}
}
@ -66,7 +65,7 @@ SystemTrayIcon {
id: miCreate
text: qsTr("Create new Wallpaper or Widgets")
onTriggered: {
root.open()
root.open();
App.util.setNavigation("Create");
}
}
@ -74,7 +73,7 @@ SystemTrayIcon {
id: miSettings
text: qsTr("Settings")
onTriggered: {
root.open()
root.open();
App.util.setNavigation("Settings");
}
}
@ -85,14 +84,13 @@ SystemTrayIcon {
MenuItem {
text: qsTr("Forums")
onTriggered: {
Qt.openUrlExternally("https://forum.screen-play.app/")
Qt.openUrlExternally("https://forum.screen-play.app/");
}
}
MenuItem {
text: qsTr("Frequently Asked Questions (FAQ)")
onTriggered: {
Qt.openUrlExternally(
"https://kelteseth.gitlab.io/ScreenPlayDocs/Frequently%20Asked%20Questions/")
Qt.openUrlExternally("https://kelteseth.gitlab.io/ScreenPlayDocs/Frequently%20Asked%20Questions/");
}
}
MenuItem {
@ -106,13 +104,13 @@ SystemTrayIcon {
text: qsTr("Mute all")
onTriggered: {
if (miMuteAll.isMuted) {
isMuted = false
miMuteAll.text = qsTr("Mute all")
App.screenPlayManager.setAllWallpaperValue("muted", "true")
isMuted = false;
miMuteAll.text = qsTr("Mute all");
App.screenPlayManager.setAllWallpaperValue("muted", "true");
} else {
isMuted = true
miMuteAll.text = qsTr("Unmute all")
App.screenPlayManager.setAllWallpaperValue("muted", "false")
isMuted = true;
miMuteAll.text = qsTr("Unmute all");
App.screenPlayManager.setAllWallpaperValue("muted", "false");
}
}
}
@ -125,15 +123,13 @@ SystemTrayIcon {
text: qsTr("Pause all")
onTriggered: {
if (miStopAll.isPlaying) {
isPlaying = false
miStopAll.text = qsTr("Pause all")
App.screenPlayManager.setAllWallpaperValue("isPlaying",
"true")
isPlaying = false;
miStopAll.text = qsTr("Pause all");
App.screenPlayManager.setAllWallpaperValue("isPlaying", "true");
} else {
isPlaying = true
miStopAll.text = qsTr("Play all")
App.screenPlayManager.setAllWallpaperValue("isPlaying",
"false")
isPlaying = true;
miStopAll.text = qsTr("Play all");
App.screenPlayManager.setAllWallpaperValue("isPlaying", "false");
}
}
}

View File

@ -114,7 +114,7 @@ void MonitorListModel::loadMonitors()
#ifdef Q_OS_WIN
QModelIndex index;
auto monitors = WindowsIntegration().GetAllMonitors();
auto monitors = WindowsIntegration().getAllMonitors();
// This offset lets us center the monitor selection view in the center
int offsetX = 0;
@ -131,7 +131,7 @@ void MonitorListModel::loadMonitors()
}
}
for(int i = 0; auto& monitor : monitors) {
for (int i = 0; auto& monitor : monitors) {
const int width = std::abs(monitor.position.right - monitor.position.left);
const int height = std::abs(monitor.position.top - monitor.position.bottom);
const int x = monitor.position.left;

View File

@ -289,7 +289,6 @@ void Wizards::createQMLWallpaper(
});
}
/*!
\brief .
*/
@ -337,18 +336,26 @@ void Wizards::createGodotWallpaper(
return;
}
if (!Util::writeSettings(obj, workingPath + "/project.json")) {
emit widgetCreationFinished(WizardResult::WriteProjectFileError);
return;
}
if (!Util::writeFileFromQrc(":/qml/ScreenPlayApp/qml/Create/WizardsFiles/Godot_v5/project.godot", workingPath + "/project.godot")) {
qWarning() << "Could not write main.qml";
qWarning() << "Could not write project.godot";
return;
}
if (!Util::writeFileFromQrc(":/qml/ScreenPlayApp/qml/Create/WizardsFiles/Godot_v5/wallpaper.tscn", workingPath + "/wallpaper.tscn")) {
qWarning() << "Could not write main.qml";
qWarning() << "Could not write wallpaper.tscn";
return;
}
// This presets file is needed for the export. Because we do only export
// package files, it does not matter that we hardcode "Windows Desktop" as
// export preset.
if (!Util::writeFileFromQrc(":/qml/ScreenPlayApp/qml/Create/WizardsFiles/Godot_v5/export_presets.cfg", workingPath + "/export_presets.cfg")) {
qWarning() << "Could not write export_presets.cfg";
return;
}

View File

@ -32,16 +32,15 @@ project(ScreenPlayGodotWallpaper LANGUAGES CXX)
# Create our library
add_library(${PROJECT_NAME} SHARED)
# Runs after compilation
# Enable executing python scripts
# Runs after compilation Enable executing python scripts
find_package(Python COMPONENTS Interpreter)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Tools"
COMMAND "${Python_EXECUTABLE}" "build_godot.py" "--build_path" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
COMMENT "Running post-build step"
)
COMMENT "Running post-build step")
# LIB_ARCH is the architecture being built. It is set to the build system's architecture. For macOS, we build a universal library (both
# arm64 and x86_64).

@ -1 +1 @@
Subproject commit c1196a1ab0a1ca166d0e5e2f08f9fe4156118c5e
Subproject commit c4b7b08c917e4dd41e4a53d28660b7358e60d7b1

View File

@ -74,18 +74,26 @@ bool ScreenPlayGodotWallpaper::configureWindowGeometry()
bool ScreenPlayGodotWallpaper::init(int activeScreen)
{
auto* displayServer = DisplayServer::get_singleton();
{
int64_t handle_int = displayServer->window_get_native_handle(godot::DisplayServer::HandleType::WINDOW_HANDLE, activeScreen);
HWND hwnd = reinterpret_cast<HWND>(static_cast<intptr_t>(handle_int));
m_windowsIntegration.setWindowHandle(hwnd);
int64_t handle_int = displayServer->window_get_native_handle(godot::DisplayServer::HandleType::WINDOW_HANDLE);
HWND hwnd = reinterpret_cast<HWND>(handle_int);
m_windowsIntegration.setWindowHandle(hwnd);
ShowWindow(m_windowsIntegration.windowHandle(), SW_HIDE);
if (!IsWindow(hwnd)) {
UtilityFunctions::print("ScreenPlayGodotWallpaper::init Could not get a valid window handle !", activeScreen, handle_int);
UtilityFunctions::print("init hwnd: ", (int64_t)hwnd, activeScreen, handle_int);
std::vector<Monitor> monitors = m_windowsIntegration.getAllMonitors();
for (const auto& monitor : monitors) {
UtilityFunctions::print(monitor.toString().c_str());
}
return false;
}
hideFromTaskbar(m_windowsIntegration.windowHandle());
if (!configureWindowGeometry()) {
return false;
}
ShowWindow(m_windowsIntegration.windowHandle(), SW_HIDE);
hideFromTaskbar(m_windowsIntegration.windowHandle());
auto updateWindowSize = [&displayServer](const int width, const int height) {
displayServer->window_set_size(godot::Vector2((real_t)width, (real_t)height));
};
@ -101,38 +109,38 @@ bool ScreenPlayGodotWallpaper::init(int activeScreen)
SetWindowText(m_windowsIntegration.windowHandle(), windowTitle.c_str());
ShowWindow(m_windowsIntegration.windowHandle(), SW_SHOW);
m_windowsIntegration.setupWindowMouseHook();
// m_windowsIntegration.setupWindowMouseHook();
// Set up the mouse event handler
m_windowsIntegration.setMouseEventHandler([this](DWORD mouseButton, UINT type, POINT p) {
Ref<InputEventMouseButton> mouse_event;
Ref<InputEventMouseMotion> motion_event;
switch (type) {
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
mouse_event.instantiate();
mouse_event->set_position(Vector2(p.x, p.y));
mouse_event->set_global_position(Vector2(p.x, p.y)); // Assuming global == local for this context
mouse_event->set_button_index(
type == WM_LBUTTONDOWN || type == WM_LBUTTONUP ? MOUSE_BUTTON_LEFT : MOUSE_BUTTON_RIGHT);
mouse_event->set_pressed(type == WM_LBUTTONDOWN || type == WM_RBUTTONDOWN);
break;
case WM_MOUSEMOVE:
motion_event.instantiate();
motion_event->set_position(Vector2(p.x, p.y));
motion_event->set_global_position(Vector2(p.x, p.y));
break;
// Add more cases as needed
}
// m_windowsIntegration.setMouseEventHandler([this](DWORD mouseButton, UINT type, POINT p) {
// Ref<InputEventMouseButton> mouse_event;
// Ref<InputEventMouseMotion> motion_event;
// switch (type) {
// case WM_LBUTTONDOWN:
// case WM_LBUTTONUP:
// case WM_RBUTTONDOWN:
// case WM_RBUTTONUP:
// mouse_event.instantiate();
// mouse_event->set_position(Vector2(p.x, p.y));
// mouse_event->set_global_position(Vector2(p.x, p.y)); // Assuming global == local for this context
// mouse_event->set_button_index(
// type == WM_LBUTTONDOWN || type == WM_LBUTTONUP ? MOUSE_BUTTON_LEFT : MOUSE_BUTTON_RIGHT);
// mouse_event->set_pressed(type == WM_LBUTTONDOWN || type == WM_RBUTTONDOWN);
// break;
// case WM_MOUSEMOVE:
// motion_event.instantiate();
// motion_event->set_position(Vector2(p.x, p.y));
// motion_event->set_global_position(Vector2(p.x, p.y));
// break;
// // Add more cases as needed
// }
if (mouse_event.is_valid()) {
get_tree()->get_root()->get_viewport()->push_input(mouse_event);
}
if (motion_event.is_valid()) {
get_tree()->get_root()->get_viewport()->push_input(motion_event);
}
});
// if (mouse_event.is_valid()) {
// get_tree()->get_root()->get_viewport()->push_input(mouse_event);
// }
// if (motion_event.is_valid()) {
// get_tree()->get_root()->get_viewport()->push_input(motion_event);
// }
// }); 2
return true;
}
@ -222,18 +230,6 @@ void ScreenPlayGodotWallpaper::messageReceived(const std::string& key, const std
std::cerr << "Out of range: " << oor.what() << std::endl;
}
}
void ScreenPlayGodotWallpaper::set_checkWallpaperVisible(bool visible)
{
m_checkWallpaperVisible = visible;
}
bool ScreenPlayGodotWallpaper::get_screenPlayConnected() const
{
return m_screenPlayConnected;
}
bool ScreenPlayGodotWallpaper::get_pipeConnected() const
{
return m_pipeConnected;
}
bool ScreenPlayGodotWallpaper::exit()
{
// Somehow this gets called at editor startup
@ -247,6 +243,18 @@ bool ScreenPlayGodotWallpaper::exit()
ShowWindow(m_windowsIntegration.windowHandleWorker(), SW_HIDE);
return true;
}
void ScreenPlayGodotWallpaper::set_checkWallpaperVisible(bool visible)
{
m_checkWallpaperVisible = visible;
}
bool ScreenPlayGodotWallpaper::get_screenPlayConnected() const
{
return m_screenPlayConnected;
}
bool ScreenPlayGodotWallpaper::get_pipeConnected() const
{
return m_pipeConnected;
}
bool ScreenPlayGodotWallpaper::get_checkWallpaperVisible() const
{
return m_checkWallpaperVisible;

View File

@ -55,7 +55,7 @@ func _ready():
# yet setup via screenplay_manager.init()
get_tree().quit()
return
Engine.set_max_fps(24)
Engine.set_max_fps(144)
var ok = screen_play_wallpaper.init(screen_play_wallpaper.get_activeScreensList()[0])
if not ok:

View File

@ -216,20 +216,17 @@ Rectangle {
spacing: 20
TextField {
placeholderText: "Edit me"
}
Button {
text: "Exit"
onClicked: {
Qt.callLater(function () {
Wallpaper.terminate();
});
Qt.callLater(function () {
Wallpaper.terminate();
});
}
}
}
MultimediaView {
width: 1000
height: 400

View File

@ -68,7 +68,7 @@ BOOL SearchForWorkerWindow(HWND hwnd, LPARAM lparam)
return TRUE;
}
std::vector<Monitor> WindowsIntegration::GetAllMonitors()
std::vector<Monitor> WindowsIntegration::getAllMonitors()
{
std::vector<Monitor> monitors;
@ -150,7 +150,7 @@ WindowsIntegration::MonitorResult WindowsIntegration::setupWallpaperForOneScreen
return { std::nullopt, MonitorResultStatus::WorkerWindowHandleInvalidError };
}
std::vector<Monitor> monitors = GetAllMonitors();
std::vector<Monitor> monitors = getAllMonitors();
for (const auto& monitor : monitors) {
monitor.print();
if (monitor.index != activeScreen)
@ -212,7 +212,7 @@ WindowsIntegration::MonitorResult WindowsIntegration::setupWallpaperForOneScreen
*/
WindowsIntegration::SpanResult WindowsIntegration::setupWallpaperForMultipleScreens(const std::vector<int>& activeScreens)
{
std::vector<Monitor> monitors = GetAllMonitors();
std::vector<Monitor> monitors = getAllMonitors();
int leftmost = INT_MAX;
int topmost = INT_MAX;
@ -272,7 +272,7 @@ WindowsIntegration::SpanResult WindowsIntegration::setupWallpaperForMultipleScre
*/
WindowsIntegration::SpanResult WindowsIntegration::setupWallpaperForAllScreens()
{
std::vector<Monitor> monitors = GetAllMonitors();
std::vector<Monitor> monitors = getAllMonitors();
int leftmost = INT_MAX;
int topmost = INT_MAX;

View File

@ -7,6 +7,7 @@
// Do not change windows.h order !
#include <algorithm>
#include <format>
#include <functional>
#include <iostream>
#include <optional>
@ -22,16 +23,21 @@ struct Monitor {
RECT position; // Monitor's position and size
SIZE size; // Monitor's width and height
float scaleFactor; // Scale factor (DPI scaling as a factor, e.g., 1.5 for 150% scaling)
std::string toString() const
{
return std::format(
"Monitor Info:\n"
"Monitor ID: {}\n"
"Index: {}\n"
"Position: ({}, {}, {}, {})\n"
"Size: ({}x{})\n"
"Scale Factor: {}\n",
(int64_t)monitorID, index, position.left, position.top,
position.right, position.bottom, size.cx, size.cy, scaleFactor);
}
void print() const
{
std::cout << "Monitor Info:" << std::endl;
std::cout << "Monitor ID: " << monitorID << std::endl;
std::cout << "Index: " << index << std::endl;
std::cout << "Position: (" << position.left << ", " << position.top << ", "
<< position.right << ", " << position.bottom << ")" << std::endl;
std::cout << "Size: (" << size.cx << "x" << size.cy << ")" << std::endl;
std::cout << "Scale Factor: " << scaleFactor << std::endl;
std::cout << toString() << std::endl;
}
};
@ -41,8 +47,6 @@ BOOL CALLBACK GetMonitorByHandle(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcM
BOOL CALLBACK FindTheDesiredWnd(HWND hWnd, LPARAM lParam);
BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam);
struct Point {
int x = 0;
int y = 0;
@ -81,7 +85,7 @@ public:
bool searchWorkerWindowToParentTo();
float getScaling(const int monitorIndex) const;
std::vector<Monitor> GetAllMonitors();
std::vector<Monitor> getAllMonitors();
int GetMonitorIndex(HMONITOR hMonitor);
bool checkForFullScreenWindow(HWND windowHandle);
WindowsIntegration::MonitorResult setupWallpaperForOneScreen(const int activeScreen, std::function<void(int, int)> updateWindowSize);