From 6be22d8f0b62dcb6827f8964610712e12117cb3d Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 11 Mar 2018 22:33:33 +0100 Subject: [PATCH] Add linux compatiblity --- ScreenPlay.pro | 2 +- ScreenPlay/ScreenPlay.pro | 10 ++++++++++ ScreenPlay/main.cpp | 4 +++- ScreenPlay/src/settings.cpp | 3 +++ ScreenPlay/src/settings.h | 5 +++-- ScreenPlayWindow/SPWmain.cpp | 4 +++- ScreenPlayWindow/src/SPWmainwindow.cpp | 11 ++++++++--- ScreenPlayWindow/src/SPWmainwindow.h | 6 +++++- 8 files changed, 36 insertions(+), 9 deletions(-) diff --git a/ScreenPlay.pro b/ScreenPlay.pro index 902a22ac..493e9a45 100644 --- a/ScreenPlay.pro +++ b/ScreenPlay.pro @@ -3,6 +3,6 @@ SUBDIRS = \ ScreenPlay/ScreenPlay.pro \ ScreenPlaySDK/Screenplaysdk.pro \ ScreenPlayWindow/ScreenPlayWindow.pro \ - ScreenPlayWidget + ScreenPlayWidget/ ScreenPlayWindow.depends = ScreenPlaySDK diff --git a/ScreenPlay/ScreenPlay.pro b/ScreenPlay/ScreenPlay.pro index d859bb44..89433173 100644 --- a/ScreenPlay/ScreenPlay.pro +++ b/ScreenPlay/ScreenPlay.pro @@ -86,3 +86,13 @@ win32 { win32: LIBS += -L$$PWD/ThirdParty/Steam/redistributable_bin/win64/ -lsteam_api64 DEPENDPATH += $$PWD/ThirdParty/Steam/redistributable_bin/win64 } + +unix { + LIBS += -L$$PWD/ThirdParty/steam/redistributable_bin/linux64/ -lsteam_api + DEPENDPATH += $$PWD/ThirdParty/steam/redistributable_bin/linux64 + + INCLUDEPATH += $$PWD/ThirdParty/steam/lib/linux64 + DEPENDPATH += $$PWD/ThirdParty/steam/lib/linux64s + + LIBS += -L$$PWD/ThirdParty/steam/lib/linux64/ -lsdkencryptedappticket +} diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index d8b07811..86399364 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -20,8 +20,10 @@ #include #include #include -#include +#ifdef Q_OS_WIN + #include +#endif #include "qmlutilities.h" #include "installedlistfilter.h" #include "installedlistmodel.h" diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index 7429265d..ae1ab34a 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -234,10 +234,13 @@ void Settings::setScreenPlayWindowPath(const QUrl& screenPlayWindowPath) void Settings::checkForOtherFullscreenApplication() { +#ifdef Q_OS_WIN + HWND hWnd = GetForegroundWindow(); RECT appBounds; RECT rc; GetWindowRect(GetDesktopWindow(), &rc); +#endif // if(hWnd =! (HWND)GetDesktopWindow() && hWnd != (HWND)GetShellWindow()) // { // GetWindowRect(hWnd, &appBounds); diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index 596189a0..ac7f0379 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -28,8 +28,9 @@ #include "projectsettingslistmodel.h" #include "sdkconnector.h" #include "steam/steam_api.h" -#include "qt_windows.h" - +#ifdef Q_OS_WIN + #include +#endif /*! \class Settings \brief Used for: diff --git a/ScreenPlayWindow/SPWmain.cpp b/ScreenPlayWindow/SPWmain.cpp index 5688f8bf..2f48e8b9 100644 --- a/ScreenPlayWindow/SPWmain.cpp +++ b/ScreenPlayWindow/SPWmain.cpp @@ -1,7 +1,9 @@ #include "src/SPWmainwindow.h" #include #include -#include "qt_windows.h" +#ifdef Q_OS_WIN + #include +#endif int main(int argc, char* argv[]) { diff --git a/ScreenPlayWindow/src/SPWmainwindow.cpp b/ScreenPlayWindow/src/SPWmainwindow.cpp index 62e40429..1196a759 100644 --- a/ScreenPlayWindow/src/SPWmainwindow.cpp +++ b/ScreenPlayWindow/src/SPWmainwindow.cpp @@ -1,5 +1,5 @@ #include "SPWmainwindow.h" - +#ifdef Q_OS_WIN BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam) { // 0xXXXXXXX "" WorkerW @@ -12,11 +12,11 @@ BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam) *reinterpret_cast(lparam) = FindWindowExW(nullptr, hwnd, L"WorkerW", nullptr); return TRUE; } - +#endif MainWindow::MainWindow(int i, QString projectPath, QScreen* parent) : QWindow(parent) { - +#ifdef Q_OS_WIN setOpacity(0); m_projectPath = projectPath; @@ -118,12 +118,15 @@ MainWindow::MainWindow(int i, QString projectPath, QScreen* parent) emit playQmlScene(tmpPath); } } + #endif } void MainWindow::init() { setOpacity(0); + #ifdef Q_OS_WIN ShowWindow(m_worker_hwnd, SW_SHOWDEFAULT); ShowWindow(m_hwnd, SW_SHOWDEFAULT); + #endif m_quickRenderer.data()->show(); //this->setVisible(true); setOpacity(0); @@ -143,8 +146,10 @@ void MainWindow::destroyThis() animation->start(); QObject::connect(animation, &QPropertyAnimation::finished, [&]() { + #ifdef Q_OS_WIN ShowWindow(m_worker_hwnd, SW_HIDE); ShowWindow(m_hwnd, SW_HIDE); + #endif QCoreApplication::quit(); }); } diff --git a/ScreenPlayWindow/src/SPWmainwindow.h b/ScreenPlayWindow/src/SPWmainwindow.h index 58d812f3..36705168 100644 --- a/ScreenPlayWindow/src/SPWmainwindow.h +++ b/ScreenPlayWindow/src/SPWmainwindow.h @@ -1,6 +1,8 @@ #pragma once -#include "qt_windows.h" +#ifdef Q_OS_WIN + #include +#endif #include #include #include @@ -50,8 +52,10 @@ signals: void projectConfigChanged(QString projectConfig); private: + #ifdef Q_OS_WIN HWND m_hwnd; HWND m_worker_hwnd; + #endif QSharedPointer m_quickRenderer = nullptr; QUrl m_projectPath; QString m_projectFile;