diff options
author | Mateusz Łukasik <mati75@linuxmint.pl> | 2017-11-13 13:23:19 +0100 |
---|---|---|
committer | Mateusz Łukasik <mati75@linuxmint.pl> | 2017-11-13 13:23:19 +0100 |
commit | 257473284e04d45384e8e504d3c69b79872785b0 (patch) | |
tree | 8b851289adcaee8a6523ac946cc69b68571c927d /src/main.cpp | |
parent | 867f979d517190a0aaab06f4180cdd964a48677e (diff) |
New upstream version 17.11.0~ds0
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index eac767c..19b704e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,12 +24,42 @@ #ifdef HDPI_SUPPORT #include "paths.h" #include "hdpisupport.h" + +#if defined(PORTABLE_APP) && defined(Q_OS_WIN) +QString windowsApplicationPath() { + wchar_t my_path[_MAX_PATH+1]; + GetModuleFileName(NULL, my_path,_MAX_PATH); + QString app_path = QString::fromWCharArray(my_path); + if (app_path.isEmpty()) return ""; + QFileInfo fi(app_path); + return fi.absolutePath(); +} #endif +QString hdpiConfig() { + #ifdef PORTABLE_APP + return windowsApplicationPath(); + #else + return Paths::configPath(); + #endif +} +#endif // HDPI_SUPPORT + int main( int argc, char ** argv ) { +#ifdef Q_OS_LINUX + // There a are reports that SMPlayer doesn't work well with + // the KDE global menu, so this should disable it. + qputenv("KDE_NO_GLOBAL_MENU", QByteArray("1")); + //qDebug() << "KDE_NO_GLOBAL_MENU:" << qgetenv("KDE_NO_GLOBAL_MENU"); +#endif + #ifdef HDPI_SUPPORT - HDPISupport * hdpi = new HDPISupport(Paths::configPath()); + QString hdpi_config_path = hdpiConfig(); + HDPISupport * hdpi = 0; + if (!hdpi_config_path.isEmpty()) { + hdpi = new HDPISupport(hdpi_config_path); + } #endif MyApplication a( "smplayer", argc, argv ); @@ -82,6 +112,9 @@ int main( int argc, char ** argv ) } SMPlayer * smplayer = new SMPlayer(config_path); + #ifdef HDPI_SUPPORT + qDebug() << "main: hdpi_config_path:" << hdpi_config_path; + #endif SMPlayer::ExitCode c = smplayer->processArgs( args ); if (c != SMPlayer::NoExit) { return c; @@ -93,7 +126,7 @@ int main( int argc, char ** argv ) delete smplayer; #ifdef HDPI_SUPPORT - delete hdpi; + if (hdpi != 0) delete hdpi; #endif return r; |