1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Adapt changes for osx

This commit is contained in:
Elias Steurer 2023-01-20 15:55:17 +01:00
parent c5ec7e7bff
commit 9fcae64806
3 changed files with 22 additions and 70 deletions

34
.vscode/launch.json vendored
View File

@ -17,8 +17,19 @@
"MIMode": "lldb"
},
{
"name": "ScreenPlay Windows Debug",
"name": "Wallpaper MacOS (lldb) Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/../build_ScreenPlay_Qt_6.3.2_Clang/bin/ScreenPlayWallpaper.app/Contents/MacOS/ScreenPlayWallpaper",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
},
{
"name": "Windows Debug ScreenPlay",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/../build_ScreenPlay_Qt_6.4.2_MSVC_Debug/bin/ScreenPlay.exe",
@ -34,7 +45,7 @@
"visualizerFile": "${workspaceFolder}/.vscode/qt.natvis.xml"
},
{
"name": "ScreenPlay Windows RelWithDebInfo",
"name": "Windows RelWithDebInfo ScreenPlay",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/../build_ScreenPlay_Qt_6.4.2_MSVC_RelWithDebInfo/bin/ScreenPlay.exe",
@ -48,23 +59,6 @@
}
],
"visualizerFile": "${workspaceFolder}/.vscode/qt.natvis.xml"
},
{
"name": "ScreenPlayWallpaper Windows Debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/../build_ScreenPlay_Qt_6.4.2_MSVC_Debug/bin/ScreenPlayWallpaper.exe",
"args": [],
"preLaunchTask": "CMake: build",
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "Path",
"value": "${env:Path};${workspaceFolder}\\..\\aqt\\6.4.2\\msvc2019_64\\bin\\;${workspaceFolder}\\..\\aqt\\6.4.2\\msvc2019_64\\modules\\;${workspaceFolder}\\..\\aqt\\6.4.2\\msvc2019_64\\qml\\;"
}
],
"visualizerFile": "${workspaceFolder}/.vscode/qt.natvis.xml"
}
]
}

View File

@ -1,47 +1,14 @@
// SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
#include "macwindow.h"
MacWindow::MacWindow(
const QVector<int>& activeScreensList,
const QString& projectFilePath,
const QString& appID,
const QString& volume,
const QString& fillmode,
const QString& type,
const bool checkWallpaperVisible,
const bool debugMode)
: BaseWindow(
activeScreensList,
projectFilePath,
type,
checkWallpaperVisible,
appID,
debugMode)
BaseWindow::ExitCode MacWindow::start()
{
connect(sdk(), &ScreenPlaySDK::sdkDisconnected, this, &MacWindow::destroyThis);
connect(sdk(), &ScreenPlaySDK::incommingMessage, this, &MacWindow::messageReceived);
connect(sdk(), &ScreenPlaySDK::replaceWallpaper, this, &MacWindow::replaceWallpaper);
bool ok = false;
float volumeParsed = volume.toFloat(&ok);
if (!ok) {
qFatal("Could not parse volume");
}
setVolume(volumeParsed);
setFillMode(fillmode);
// Ether for one Screen or for all
if ((QApplication::screens().length() == activeScreensList.length()) && (activeScreensList.length() != 1)) {
// setupWallpaperForAllScreens();
} else if (activeScreensList.length() == 1) {
auto* screen = QGuiApplication::screens().at(activeScreensList.at(0));
m_window.setGeometry(screen->geometry());
} else if (activeScreensList.length() > 1) {
}
auto* screen = QGuiApplication::screens().at(activeScreensList().at(0));
m_window.setGeometry(screen->geometry());
qmlRegisterSingletonInstance<MacWindow>("ScreenPlayWallpaper", 1, 0, "Wallpaper", this);
#if defined(Q_OS_OSX)
QDir workingDir(QGuiApplication::instance()->applicationDirPath());
workingDir.cdUp();
workingDir.cdUp();
@ -50,7 +17,6 @@ MacWindow::MacWindow(
// This folder needs then to be copied into the .app/Contents/MacOS/
// for the deploy version.
m_window.engine()->addImportPath(workingDir.path() + "/qml");
#endif
// WARNING: Setting Window flags must be called *here*!
Qt::WindowFlags flags = m_window.flags();
@ -62,8 +28,7 @@ MacWindow::MacWindow(
MacIntegration* macIntegration = new MacIntegration(this);
macIntegration->SetBackgroundLevel(&m_window);
if (!debugMode)
sdk()->start();
return BaseWindow::ExitCode::Success;
}
void MacWindow::setVisible(bool show)

View File

@ -19,14 +19,7 @@
class MacWindow : public BaseWindow {
Q_OBJECT
public:
explicit MacWindow(const QVector<int>& activeScreensList,
const QString& projectFilePath,
const QString& appID,
const QString& volume,
const QString& fillmode,
const QString& type,
const bool checkWallpaperVisible,
const bool debugMode);
BaseWindow::ExitCode start() override;
signals: