diff --git a/.gitignore b/.gitignore index 4a25be9c..4f0a731a 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,7 @@ Thumbs.db !ScreenPlay/ThirdParty/** !ScreenPlay/translations/** -/build-*/** \ No newline at end of file +/build-*/** +*_qmlcache.qrc +ScreenPlay/ThirdParty/.DS_Store +*.DS_Store diff --git a/ScreenPlay.pro b/ScreenPlay.pro index 8345e1c9..99ef953c 100644 --- a/ScreenPlay.pro +++ b/ScreenPlay.pro @@ -6,6 +6,7 @@ SUBDIRS = \ ScreenPlayWindow/ScreenPlayWindow.pro \ ScreenPlay/ThirdParty/stomt-qt-sdk/sdk/stomt-qt-sdk.pro \ ScreenPlayWidget/ScreenPlayWidget.pro \ +#ScreenPlay/ThirdParty/qt-google-analytics/qt-google-analytics.pro \ ScreenPlayWindow.depends = ScreenPlaySDK ScreenPlayWidget.depends = ScreenPlaySDK diff --git a/ScreenPlay/ScreenPlay.pro b/ScreenPlay/ScreenPlay.pro index 3118e52c..bea1b2ae 100644 --- a/ScreenPlay/ScreenPlay.pro +++ b/ScreenPlay/ScreenPlay.pro @@ -56,16 +56,16 @@ INCLUDEPATH += \ $$PWD/ThirdParty/ \ $$PWD/src/ -include(ThirdParty/qt-google-analytics/qt-google-analytics.pri) -LIBS += -lqt-google-analytics +#include(ThirdParty/qt-google-analytics/qt-google-analytics.pri) +#LIBS += -lqt-google-analytics CONFIG(debug, debug|release) { install_it.path = $${OUT_PWD}/debug/ - QMAKE_LIBDIR += $$OUT_PWD/ThirdParty/qt-google-analytics/debug + #QMAKE_LIBDIR += $$OUT_PWD/ThirdParty/qt-google-analytics/debug } else { install_it.path = $${OUT_PWD}/release/ - QMAKE_LIBDIR += $$OUT_PWD/ThirdParty/qt-google-analytics/release + #QMAKE_LIBDIR += $$OUT_PWD/ThirdParty/qt-google-analytics/release } @@ -119,7 +119,7 @@ win32 { install_it.files += ThirdParty\steam\redistributable_bin\win64\steam_api64.dll } -unix { +unix:!macx { LIBS += -L$$PWD/ThirdParty/steam/redistributable_bin/linux64/ -lsteam_api DEPENDPATH += $$PWD/ThirdParty/steam/redistributable_bin/linux64 @@ -131,6 +131,24 @@ unix { install_it.files += ThirdParty\steam\redistributable_bin\linux64\libsteam_api.so } +macx: { + LIBS += -L$$PWD/ThirdParty/steam/redistributable_bin/osx32/ -lsteam_api + DEPENDPATH += $$PWD/ThirdParty/steam/redistributable_bin/osx32 + + INCLUDEPATH += $$PWD/ThirdParty/steam/ + DEPENDPATH += $$PWD/ThirdParty/steam/ + + LIBS += -L$$PWD/ThirdParty/steam/lib/osx32/ -lsdkencryptedappticket + + steam_data.files += steam_appid.txt + steam_data.path = Contents/MacOS + steam_data_lib.files += $$PWD/ThirdParty/steam/redistributable_bin/osx32/libsteam_api.dylib + steam_data_lib.path = Contents/MacOS/ + QMAKE_BUNDLE_DATA += steam_data + QMAKE_BUNDLE_DATA += steam_data_lib + +} + DISTFILES += \ favicon.ico diff --git a/ScreenPlay/assets/shader/movingcolorramp.fsh b/ScreenPlay/assets/shader/movingcolorramp.fsh index f80af8c0..629716e7 100644 --- a/ScreenPlay/assets/shader/movingcolorramp.fsh +++ b/ScreenPlay/assets/shader/movingcolorramp.fsh @@ -1,5 +1,3 @@ -precision lowp float; - uniform float time; uniform vec2 resolution; diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index 29b514a2..87d740ae 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -25,7 +25,7 @@ #include #endif -#include "ThirdParty/qt-google-analytics/ganalytics.h" +//#include "ThirdParty/qt-google-analytics/ganalytics.h" #include "src/create.h" #include "src/installedlistfilter.h" #include "src/installedlistmodel.h" @@ -90,9 +90,19 @@ int main(int argc, char* argv[]) #ifdef QT_DEBUG qDebug() << "Starting in Debug mode!"; + if (SPWorkingDir.cdUp()) { +#ifdef Q_OS_OSX + settings.setScreenPlayWindowPath(QUrl::fromUserInput(SPWorkingDir.path() + "/../../../ScreenPlayWindow/ScreenPlayWindow.app/Contents/MacOS/ScreenPlayWindow").toLocalFile()); + settings.setScreenPlayWidgetPath(QUrl::fromUserInput(SPWorkingDir.path() + "/../../../ScreenPlayWidget/ScreenPlayWidget.app/Contents/MacOS/ScreenPlayWidget").toLocalFile()); + qDebug() << "Setting ScreenPlayWindow Path to " << settings.getScreenPlayWindowPath(); + qDebug() << "Setting ScreenPlayWdiget Path to " << settings.getScreenPlayWidgetPath(); +#endif + +#ifdef Q_OS_WIN settings.setScreenPlayWindowPath(QUrl(SPWorkingDir.path() + "/ScreenPlayWindow/debug/ScreenPlayWindow.exe")); settings.setScreenPlayWidgetPath(QUrl(SPWorkingDir.path() + "/ScreenPlayWidget/debug/ScreenPlayWidget.exe")); +#endif } // We need to detect the right base path so we can copy later the example projects @@ -138,7 +148,7 @@ int main(int argc, char* argv[]) QQmlApplicationEngine mainWindowEngine; - qmlRegisterType("analytics", 0, 1, "Tracker"); + //qmlRegisterType("analytics", 0, 1, "Tracker"); mainWindowEngine.rootContext()->setContextProperty("screenPlay", &screenPlay); mainWindowEngine.rootContext()->setContextProperty("screenPlayCreate", &create); mainWindowEngine.rootContext()->setContextProperty("utility", &qmlUtil); diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index ffad9c66..ccf7cffc 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -4,7 +4,6 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import Qt.labs.platform 1.0 -import analytics 0.1 import "qml/" import "qml/Installed" @@ -19,26 +18,16 @@ ApplicationWindow { minimumHeight: 788 minimumWidth: 1050 - Tracker { - id: tracker - Component.onCompleted: tracker.sendScreenView("Installed") - trackingID: "UA-43193236-3" - sendInterval: 100 - } + Component.onCompleted: { - tracker.startSession() if (!screenPlaySettings.autostart) { show() } steamWorkshop.initSteam() } - Component.onDestruction: { - tracker.endSession() - } function switchPage(name) { - tracker.sendScreenView(name) if (name === "Create") { pageLoader.visible = false pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml") diff --git a/ScreenPlay/qml/Installed/Installed.qml b/ScreenPlay/qml/Installed/Installed.qml index 32df607f..692f64b7 100644 --- a/ScreenPlay/qml/Installed/Installed.qml +++ b/ScreenPlay/qml/Installed/Installed.qml @@ -3,7 +3,7 @@ import QtQml.Models 2.2 import QtQuick.Controls 2.3 import QtQuick.Controls.Styles 1.4 import QtGraphicalEffects 1.0 -import analytics 0.1 + Item { id: pageInstalled @@ -149,12 +149,6 @@ Item { } } - Tracker { - id: tracker - trackingID: "UA-43193236-3" - sendInterval: 1000 - } - function onPageChanged(name) { setSidebarActive(false) if (name === "All") { diff --git a/ScreenPlay/qml/Installed/ScreenPlayItem.qml b/ScreenPlay/qml/Installed/ScreenPlayItem.qml index ecd3b9ef..972ab2ff 100644 --- a/ScreenPlay/qml/Installed/ScreenPlayItem.qml +++ b/ScreenPlay/qml/Installed/ScreenPlayItem.qml @@ -139,14 +139,14 @@ Item { id: screenPlayItemImage anchors.fill: parent sourceImage: Qt.resolvedUrl( - "file:///" + screenPlayItem.absoluteStoragePath + screenPlayItem.absoluteStoragePath + "/" + screenPreview) sourceImageGIF: { if (screenPreviewGIF === undefined) { return "" } else { return Qt.resolvedUrl( - "file:///" + screenPlayItem.absoluteStoragePath + screenPlayItem.absoluteStoragePath + "/" + screenPreviewGIF) } diff --git a/ScreenPlay/qml/Installed/Sidebar.qml b/ScreenPlay/qml/Installed/Sidebar.qml index ee1455fe..357006cd 100644 --- a/ScreenPlay/qml/Installed/Sidebar.qml +++ b/ScreenPlay/qml/Installed/Sidebar.qml @@ -24,7 +24,7 @@ Item { onActiveScreenChanged: { txtHeadline.text = installedListModel.get(activeScreen).screenTitle image.source = Qt.resolvedUrl( - "file:///" + installedListModel.absoluteStoragePath + "/" + installedListModel.absoluteStoragePath + "/" + activeScreen + "/" + installedListModel.get( activeScreen).screenPreview) } diff --git a/ScreenPlay/qml/Workshop/Workshop.qml b/ScreenPlay/qml/Workshop/Workshop.qml index 41759340..7ff6381f 100644 --- a/ScreenPlay/qml/Workshop/Workshop.qml +++ b/ScreenPlay/qml/Workshop/Workshop.qml @@ -2,7 +2,6 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.2 import QtGraphicalEffects 1.0 -import net.aimber.workshop 1.0 Item { id: workshop diff --git a/ScreenPlay/src/installedlistmodel.cpp b/ScreenPlay/src/installedlistmodel.cpp index 45bbba1e..715b687a 100644 --- a/ScreenPlay/src/installedlistmodel.cpp +++ b/ScreenPlay/src/installedlistmodel.cpp @@ -90,11 +90,11 @@ void InstalledListModel::loadScreens() QJsonDocument jsonProject; QJsonParseError parseError; - QFileInfoList list = QDir(m_absoluteStoragePath.toString()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs); + QFileInfoList list = QDir(m_absoluteStoragePath.toLocalFile()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs); QString tmpPath; for (auto&& item : list) { - tmpPath = m_absoluteStoragePath.toString() + "/" + item.baseName() + "/project.json"; + tmpPath = m_absoluteStoragePath.toLocalFile() + "/" + item.baseName() + "/project.json"; if (!QFile(tmpPath).exists()) continue; diff --git a/ScreenPlay/src/qmlutilities.cpp b/ScreenPlay/src/qmlutilities.cpp index 7c33395d..244a3240 100644 --- a/ScreenPlay/src/qmlutilities.cpp +++ b/ScreenPlay/src/qmlutilities.cpp @@ -29,7 +29,11 @@ QString QMLUtilities::fixWindowsPath(QString url) void QMLUtilities::openFolderInExplorer(QString url) { QProcess explorer; + #ifdef Q_OS_WIN explorer.setProgram("explorer.exe"); + #elif defined(Q_OS_OSX) + explorer.setProgram("open"); + #endif QStringList args; args.append(QDir::toNativeSeparators(url)); explorer.setArguments(args); diff --git a/ScreenPlay/src/screenplay.cpp b/ScreenPlay/src/screenplay.cpp index 8d439d11..88595262 100644 --- a/ScreenPlay/src/screenplay.cpp +++ b/ScreenPlay/src/screenplay.cpp @@ -24,9 +24,9 @@ void ScreenPlay::createWallpaper(int monitorIndex, QUrl absoluteStoragePath, QSt m_settings->increaseActiveWallpaperCounter(); QVector tmpMonitorIndex; tmpMonitorIndex.append(monitorIndex); - m_screenPlayWallpaperList.append(QSharedPointer(new ScreenPlayWallpaper(tmpMonitorIndex, absoluteStoragePath.toString(), previewImage, volume, fillMode, type, this))); + m_screenPlayWallpaperList.append(QSharedPointer(new ScreenPlayWallpaper(tmpMonitorIndex, absoluteStoragePath.toLocalFile(), previewImage, volume, fillMode, type, this))); - m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), absoluteStoragePath.toString() + "/" + previewImage); + m_mlm->setWallpaperActiveMonitor(m_qGuiApplication->screens().at(monitorIndex), absoluteStoragePath.toLocalFile() + "/" + previewImage); } void ScreenPlay::createWidget(QUrl absoluteStoragePath, QString previewImage) @@ -36,9 +36,9 @@ void ScreenPlay::createWidget(QUrl absoluteStoragePath, QString previewImage) return; } - QString fullPath = absoluteStoragePath.toString() + "/" + project.m_file.toString(); + QString fullPath = absoluteStoragePath.toLocalFile() + "/" + project.m_file.toString(); - m_screenPlayWidgetList.append(QSharedPointer(new ScreenPlayWidget(absoluteStoragePath.toString(), previewImage, fullPath, this))); + m_screenPlayWidgetList.append(QSharedPointer(new ScreenPlayWidget(absoluteStoragePath.toLocalFile(), previewImage, fullPath, this))); } void ScreenPlay::removeAllWallpaper() diff --git a/ScreenPlay/src/screenplay.h b/ScreenPlay/src/screenplay.h index 8c4bfbd7..3570a636 100644 --- a/ScreenPlay/src/screenplay.h +++ b/ScreenPlay/src/screenplay.h @@ -96,6 +96,9 @@ public: proArgs.append(parent->m_settings->decoder()); proArgs.append(QString::number(volume)); proArgs.append(fillMode); + + qDebug() << proArgs; + m_process->setArguments(proArgs); m_process->setProgram(parent->settings()->screenPlayWindowPath().toString()); m_process->start(); @@ -212,7 +215,7 @@ public: m_projectPath = projectPath; m_fullPath = fullPath; m_previewImage = previewImage; - m_process = new QProcess(this); + m_process = new QProcess(this); //PLS LESS BEHINDERT @Elias QStringList proArgs; proArgs.append(m_projectPath); @@ -223,9 +226,13 @@ public: if (fullPath.endsWith(".exe")) { m_process->setProgram(fullPath); } else if (fullPath.endsWith(".qml")) { - m_process->setProgram(parent->m_settings->getScreenPlayWidgetPath().toString()); + m_process->setProgram(parent->m_settings->getScreenPlayWidgetPath().path()); } qDebug() << m_process->program(); + connect(m_process,&QProcess::errorOccurred, this, [](QProcess::ProcessError error){ + qDebug() << "error: " << error; + + }); m_process->start(); } diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index 6576c18c..55d79648 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -1,6 +1,6 @@ #include "settings.h" #include - +#include Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, SDKConnector* sdkc, AppId_t steamID, QGuiApplication* app, QObject* parent) : QObject(parent) { @@ -13,10 +13,10 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo m_qGuiApplication = app; QFile configTmp; - QString appConfigLocation = QGuiApplication::applicationDirPath(); - m_localSettingsPath = QUrl(appConfigLocation); + QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation); + m_localSettingsPath = QUrl::fromUserInput(appConfigLocation); if (!QDir(appConfigLocation).exists()) { - if (!QDir().mkdir(appConfigLocation)) { + if (!QDir().mkpath(appConfigLocation)) { qWarning("ERROR: Cloud not create install dir"); return; } @@ -69,7 +69,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo m_localStoragePath = steamTmpUrl.path(); } else { - m_localStoragePath = configObj.value("absoluteStoragePath").toString(); + m_localStoragePath = QUrl::fromUserInput(configObj.value("absoluteStoragePath").toString()); } m_ilm->setabsoluteStoragePath(m_localStoragePath); @@ -92,7 +92,7 @@ Settings::~Settings() QString Settings::loadProject(QString file) { QFile configTmp; - file = file.replace("file:///", ""); + //file = file.replace("file:///", ""); configTmp.setFileName(file); configTmp.open(QIODevice::ReadOnly | QIODevice::Text); return configTmp.readAll(); @@ -104,7 +104,7 @@ void Settings::loadActiveProfiles() QJsonObject configObj; QJsonArray activeProfilesTmp; QFile configTmp; - configTmp.setFileName(m_localSettingsPath.toString() + "/settings.json"); + configTmp.setFileName(m_localSettingsPath.toLocalFile() + "/settings.json"); configTmp.open(QIODevice::ReadOnly | QIODevice::Text); QString config = configTmp.readAll(); @@ -155,7 +155,7 @@ void Settings::writeSingleSettingConfig(QString name, QVariant value) QJsonObject configObj; QFile configTmp; - configTmp.setFileName(m_localSettingsPath.toString() + "/settings.json"); + configTmp.setFileName(m_localSettingsPath.toLocalFile() + "/settings.json"); configTmp.open(QIODevice::ReadOnly | QIODevice::Text); QString config = configTmp.readAll(); configJsonDocument = QJsonDocument::fromJson(config.toUtf8(), &parseError); @@ -264,7 +264,7 @@ void Settings::setPlayAll(bool isPlaying) void Settings::createDefaultConfig() { - QFile file(QGuiApplication::applicationDirPath() + "/settings.json"); + QFile file(m_localSettingsPath.toLocalFile() + "/settings.json"); QFile defaultSettings(":/settings.json"); file.open(QIODevice::WriteOnly | QIODevice::Text); diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index 866fc939..1a61d22b 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -227,7 +227,7 @@ public slots: return; //Remove: "file:///" - QJsonValue cleanedPath = QJsonValue(QString(localStoragePath.toString()).remove(0, 8)); + QJsonValue cleanedPath = QJsonValue(localStoragePath.toString()); // QJsonValue(QString(localStoragePath.toString()).remove(0, 8)); writeSingleSettingConfig("absoluteStoragePath", cleanedPath); diff --git a/ScreenPlay/src/steamworkshop.cpp b/ScreenPlay/src/steamworkshop.cpp index 3d8abb7b..b2ba5778 100644 --- a/ScreenPlay/src/steamworkshop.cpp +++ b/ScreenPlay/src/steamworkshop.cpp @@ -17,6 +17,7 @@ void SteamWorkshop::initSteam() m_steamErrorRestart = true; } + //IF THE FAMILY SHARING IS ENABLED THIS WILL FAIL ! #13 if (!SteamAPI_Init()) { qWarning() << "Could not init steam sdk!"; m_steamErrorAPIInit = true; diff --git a/ScreenPlaySysInfo/cpu.h b/ScreenPlaySysInfo/cpu.h index 8484e43a..c1d32ab7 100644 --- a/ScreenPlaySysInfo/cpu.h +++ b/ScreenPlaySysInfo/cpu.h @@ -9,8 +9,9 @@ #endif // https://github.com/rainmeter/rainmeter/blob/master/Library/MeasureCPU.cpp - +#ifdef Q_OS_WIN typedef LONG(WINAPI* FPNTQSI)(UINT, PVOID, ULONG, PULONG); +#endif class CPU : public QObject { Q_OBJECT @@ -69,10 +70,10 @@ private: double m_OldTime[2]; - static FPNTQSI c_NtQuerySystemInformation; + //static FPNTQSI c_NtQuerySystemInformation; static int c_NumOfProcessors; - static ULONG c_BufferSize; + //static ULONG c_BufferSize; int m_tickRate = 500; QTimer m_updateTimer; }; diff --git a/ScreenPlayWidget/ScreenPlayWidget.pro b/ScreenPlayWidget/ScreenPlayWidget.pro index 3517fa1e..334d014a 100644 --- a/ScreenPlayWidget/ScreenPlayWidget.pro +++ b/ScreenPlayWidget/ScreenPlayWidget.pro @@ -47,10 +47,6 @@ QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target HEADERS += \ src/spwidgetmainwindow.h diff --git a/ScreenPlayWidget/src/spwidgetmainwindow.h b/ScreenPlayWidget/src/spwidgetmainwindow.h index 7f5ddbf5..ca79fb62 100644 --- a/ScreenPlayWidget/src/spwidgetmainwindow.h +++ b/ScreenPlayWidget/src/spwidgetmainwindow.h @@ -14,7 +14,11 @@ #include #include #include +#ifdef Q_OS_WIN #include +#else +typedef long HWND; +#endif class SPWidgetmainwindow : public QWindow { Q_OBJECT diff --git a/ScreenPlayWindow/ScreenPlayWindow.pro b/ScreenPlayWindow/ScreenPlayWindow.pro index 800bf885..ce720180 100644 --- a/ScreenPlayWindow/ScreenPlayWindow.pro +++ b/ScreenPlayWindow/ScreenPlayWindow.pro @@ -12,6 +12,14 @@ SOURCES += \ HEADERS += \ src/SPWmainwindow.h +macx: { +QMAKE_LFLAGS += -framework Cocoa +SOURCES += src/macintegration.cpp +HEADERS += src/macintegration.h \ + src/macbridge.h +OBJECTIVE_SOURCES += src/MacBridge.mm +} + RESOURCES += \ SPWResources.qrc @@ -22,24 +30,37 @@ INCLUDEPATH += \ include(../ScreenPlaySDK/Screenplaysdk.pri) +macx: { +QMAKE_LIBDIR += $$OUT_PWD/ +install_it.path = $${OUT_PWD}/../ScreenPlaySDK +} -CONFIG(debug, debug|release) { -LIBS += -lScreenplaysdkd - install_it.path = $${OUT_PWD}/debug/ - QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK/debug - } else { -LIBS += -lScreenplaysdk - install_it.path = $${OUT_PWD}/release/ - QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK/release - } -QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK +!macx: { + CONFIG(debug, debug|release) { + LIBS += -lScreenplaysdkd + install_it.path = $${OUT_PWD}/debug/ + QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK/debug + } else { + LIBS += -lScreenplaysdk + install_it.path = $${OUT_PWD}/release/ + QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK/release + } + QMAKE_LIBDIR += $$OUT_PWD/../ScreenPlaySDK +} +macx: { + html_data.files = index.html + html_data.path = Contents/MacOS + QMAKE_BUNDLE_DATA += html_data +} + +!macx: { install_it.files += index.html \ - INSTALLS += install_it - DISTFILES += \ index.html +} + # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = @@ -54,9 +75,5 @@ QT_QUICK_CONTROLS_STYLE = "Material" # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target diff --git a/ScreenPlayWindow/index.html b/ScreenPlayWindow/index.html index dc605d98..6fa89cd3 100644 --- a/ScreenPlayWindow/index.html +++ b/ScreenPlayWindow/index.html @@ -3,16 +3,19 @@ diff --git a/ScreenPlayWindow/src/MacBridge.mm b/ScreenPlayWindow/src/MacBridge.mm new file mode 100644 index 00000000..0a36010a --- /dev/null +++ b/ScreenPlayWindow/src/MacBridge.mm @@ -0,0 +1,30 @@ +#include "macbridge.h" +#import +#import +#include +#include + +MacBridge * MacBridge::bridge = NULL; + +MacBridge::MacBridge() +{ + +} + +MacBridge * MacBridge::instance() +{ + if(!bridge) + bridge = new MacBridge; + return bridge; +} + +void MacBridge::SetBackgroundLevel(QWindow* window) +{ + NSView* view = (NSView *) window->winId(); + NSWindow* nsWindow = (NSWindow*)[view window]; + + [nsWindow setLevel:CGWindowLevelForKey(kCGDesktopWindowLevelKey) + 1]; + [nsWindow setBackgroundColor: [NSColor blackColor]]; + [nsWindow setAcceptsMouseMovedEvents: false]; + [nsWindow setMovableByWindowBackground: false]; +} diff --git a/ScreenPlayWindow/src/SPWmainwindow.cpp b/ScreenPlayWindow/src/SPWmainwindow.cpp index 9dee8250..052eddca 100644 --- a/ScreenPlayWindow/src/SPWmainwindow.cpp +++ b/ScreenPlayWindow/src/SPWmainwindow.cpp @@ -1,4 +1,5 @@ #include "SPWmainwindow.h" +#include "macintegration.h" #ifdef Q_OS_WIN BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam) @@ -15,11 +16,13 @@ BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam) } #endif +//for mac https://github.com/silvansky/QtMacApp/search?q=myprivate&unscoped_q=myprivate + MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder, QString volume, QString fillmode, QScreen* parent) : QWindow(parent) { -#ifdef Q_OS_WIN + m_appID = id; m_screenNumber.insert(0, i); @@ -89,6 +92,8 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder, } } + #ifdef Q_OS_WIN + m_hwnd = (HWND)this->winId(); HWND progman_hwnd = FindWindowW(L"Progman", L"Program Manager"); @@ -116,6 +121,17 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder, SetWindowLongPtr(m_hwnd, GWL_STYLE, WS_CHILDWINDOW | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU | WS_POPUP); SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_NOACTIVATE | WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW); + #endif + +#ifdef Q_OS_MACOS + //debug + this->setWidth(screen->size().width()); + this->setHeight(screen->size().height()); + int x = screen->geometry().x(); + int y = screen->geometry().y(); + this->setX(screen->geometry().x());// + offsetX); + this->setY(screen->geometry().y());// + offsetY);#endif +#endif Qt::WindowFlags flags = this->flags(); this->setFlags(flags | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint); @@ -136,7 +152,14 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder, } }); + setVisible(true); + + +#ifdef Q_OS_MACOS + MacIntegration* integration = new MacIntegration(this); + integration->SetBackgroundLevel(this); #endif + } void MainWindow::init() { diff --git a/ScreenPlayWindow/src/macbridge.h b/ScreenPlayWindow/src/macbridge.h new file mode 100644 index 00000000..b572807f --- /dev/null +++ b/ScreenPlayWindow/src/macbridge.h @@ -0,0 +1,15 @@ +#pragma once + +#include + +class MacBridge : public QObject +{ + Q_OBJECT + +private: + static MacBridge* bridge; + MacBridge(); +public: + static MacBridge* instance(); + static void SetBackgroundLevel(QWindow* window); +}; diff --git a/ScreenPlayWindow/src/macintegration.cpp b/ScreenPlayWindow/src/macintegration.cpp new file mode 100644 index 00000000..a894be44 --- /dev/null +++ b/ScreenPlayWindow/src/macintegration.cpp @@ -0,0 +1,13 @@ +#include "macintegration.h" +#include "macbridge.h" + +MacIntegration::MacIntegration(QObject *parent) + : QObject(parent) +{ + MacBridge::instance(); +} + +void MacIntegration::SetBackgroundLevel(QWindow* window) +{ + MacBridge::SetBackgroundLevel(window); +} diff --git a/ScreenPlayWindow/src/macintegration.h b/ScreenPlayWindow/src/macintegration.h new file mode 100644 index 00000000..6a72f4ad --- /dev/null +++ b/ScreenPlayWindow/src/macintegration.h @@ -0,0 +1,15 @@ +#ifndef MACINTEGRATION_H +#define MACINTEGRATION_H + +#include + + +class MacIntegration : public QObject +{ + Q_OBJECT +public: + explicit MacIntegration(QObject *parent); + void SetBackgroundLevel(QWindow* window); +}; + +#endif // MACINTEGRATION_H