summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-21 12:06:03 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-23 11:05:33 +0200
commit713744b4dba7a3b5edc4dffd2172312979996448 (patch)
tree480a10cfa1d7fe08c8776d0519cf7c941ebe0263 /gui
parent5afa60dc91cff9f88af42193e46119536b65bcef (diff)
gui/main: enable display scaling. move setenv PATH as own function
Diffstat (limited to 'gui')
-rw-r--r--gui/main.cpp92
1 files changed, 49 insertions, 43 deletions
diff --git a/gui/main.cpp b/gui/main.cpp
index 5b1bb5c7..d1f2786f 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -20,51 +20,9 @@ using namespace options;
#include <cstring>
#ifdef _WIN32
-// workaround QTBUG-38598, allow for launching from another directory
-static void add_program_library_path()
-{
- char* p = _pgmptr;
- char path[MAX_PATH+1];
- strcpy(path, p);
- char* ptr = strrchr(path, '\\');
- if (ptr)
- {
- *ptr = '\0';
- QCoreApplication::addLibraryPath(path);
- }
-}
-#endif
-int main(int argc, char** argv)
+void add_win32_path()
{
-#ifdef _WIN32
- add_program_library_path();
-#elif !defined(__linux)
- // workaround QTBUG-38598
- QCoreApplication::addLibraryPath(".");
-#endif
-
-#if defined(_WIN32) || defined(__APPLE__)
- // qt5 designer-made controls look like shit on 'doze -sh 20140921
- // also our OSX look leaves a lot to be desired -sh 20150726
- {
- const QStringList preferred { "fusion", "windowsvista", "macintosh", "windowsxp" };
- for (const auto& style_name : preferred)
- {
- QStyle* s = QStyleFactory::create(style_name);
- if (s)
- {
- QApplication::setStyle(s);
- break;
- }
- }
- }
-#endif
-
- QApplication::setAttribute(Qt::AA_X11InitThreads, true);
- QApplication app(argc, argv);
-
-#ifdef _WIN32
// see https://software.intel.com/en-us/articles/limitation-to-the-length-of-the-system-path-variable
static char env_path[4096] { '\0', };
{
@@ -113,6 +71,54 @@ int main(int argc, char** argv)
else
qDebug() << "can't set win32 path";
}
+}
+// workaround QTBUG-38598, allow for launching from another directory
+static void add_program_library_path()
+{
+ char* p = _pgmptr;
+ char path[MAX_PATH+1];
+ strcpy(path, p);
+ char* ptr = strrchr(path, '\\');
+ if (ptr)
+ {
+ *ptr = '\0';
+ QCoreApplication::addLibraryPath(path);
+ }
+}
+#endif
+
+int main(int argc, char** argv)
+{
+#ifdef _WIN32
+ add_program_library_path();
+#elif !defined(__linux)
+ // workaround QTBUG-38598
+ QCoreApplication::addLibraryPath(".");
+#endif
+
+#if defined(_WIN32) || defined(__APPLE__)
+ // qt5 designer-made controls look like shit on 'doze -sh 20140921
+ // also our OSX look leaves a lot to be desired -sh 20150726
+ {
+ const QStringList preferred { "fusion", "windowsvista", "macintosh", "windowsxp" };
+ for (const auto& style_name : preferred)
+ {
+ QStyle* s = QStyleFactory::create(style_name);
+ if (s)
+ {
+ QApplication::setStyle(s);
+ break;
+ }
+ }
+ }
+#endif
+
+ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QApplication::setAttribute(Qt::AA_X11InitThreads, true);
+ QApplication app(argc, argv);
+
+#ifdef _WIN32
+ add_win32_path();
#endif
MainWindow::set_working_directory();