From 24ac3da37e3e7ed9b733ff842b16c9815f91e6ff Mon Sep 17 00:00:00 2001 From: Kitteh Date: Wed, 31 Oct 2018 07:53:38 +0000 Subject: [PATCH] [Launcher] Check for WIN32. --- CMakeLists.txt | 4 ++++ KittehPlayer.pro | 4 ++++ src/main.cpp | 6 ++---- src/setenv_mingw.hpp | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07cae5d..8029c46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,10 @@ add_definitions(-DQRC_SOURCE_PATH="${PROJECT_SOURCE_DIR}/src/qml") add_definitions(-DQT_QML_DEBUG) endif(DEVELOP) +if(WIN32) +add_definitions(-DWINDOWS) +endif(WIN32) + add_executable(KittehPlayer ${SOURCES} ${qml_QRC}) # Use the Qml/Quick modules from Qt 5. diff --git a/KittehPlayer.pro b/KittehPlayer.pro index 45b5cf6..0571527 100644 --- a/KittehPlayer.pro +++ b/KittehPlayer.pro @@ -27,6 +27,10 @@ unix { INSTALLS += icon } +win32 { +DEFINES += WINDOWS +} + INSTALLS += target HEADERS += src/mpvobject.h src/filesavedialog.h src/fileopendialog.h diff --git a/src/main.cpp b/src/main.cpp index c3cc013..e883adf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,11 +12,10 @@ #include "filesavedialog.h" #include "mpvobject.h" -#if defined(MINGW) || defined(__MINGW32__) || defined(__MINGW64__) +#ifdef WIN32 #include "setenv_mingw.hpp" #endif - int main( int argc, char *argv[] ) { setenv("QT_QPA_PLATFORMTHEME", "gtk3", 0); @@ -25,7 +24,6 @@ int main( int argc, char *argv[] ) app.setOrganizationName("KittehPlayer"); app.setOrganizationDomain("namedkitten.pw"); app.setApplicationName("KittehPlayer"); - for (int i = 1; i < argc; ++i) { if (!qstrcmp(argv[i], "--update")) { QString program = QProcessEnvironment::systemEnvironment().value("APPDIR", "") + "/usr/bin/appimageupdatetool"; @@ -44,8 +42,8 @@ int main( int argc, char *argv[] ) QString newpath = QProcessEnvironment::systemEnvironment().value("APPDIR", "") + "/usr/bin:" + QProcessEnvironment::systemEnvironment().value("PATH", ""); qDebug() << newpath; setenv("PATH", newpath.toUtf8().constData(), 1); + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL ); qmlRegisterType("player", 1, 0, "MpvObject"); qmlRegisterType("player", 1, 0, "FileOpenDialog"); qmlRegisterType("player", 1, 0, "FileSaveDialog"); diff --git a/src/setenv_mingw.hpp b/src/setenv_mingw.hpp index 1ff325e..78985aa 100644 --- a/src/setenv_mingw.hpp +++ b/src/setenv_mingw.hpp @@ -30,7 +30,6 @@ * DEALINGS IN THE SOFTWARE. * */ -#define _POSIX_C_SOURCE 200809L #include #include