From 3f6006ce6e97dacf2100fdb8aacb827316353869 Mon Sep 17 00:00:00 2001 From: Edwin Mons Date: Fri, 5 Feb 2016 16:37:04 +0100 Subject: Move QApplication instantiation in QtUI/main.cpp down If there is no X11 display set, bits in libqxcb as used by the plaform integration bits called by QApplication will trigger an abort. Moving this down to just before where the app object is needed allows --help or --version even if there's no DISPLAY, and also improves runtime of these GUI-less operations quite a bit. Test-Information: Test platform Debian 8 x64 with Qt5 Starting swift-im with DISPLAY set works as expected Asking for --version or --help without DISPLAY now works Actually starting the UI still aborts. Change-Id: Id8eeee90598fe2a8e3b26ba042835a0ea928932f diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp index e4efce9..2b8716c 100644 --- a/Swift/QtUI/main.cpp +++ b/Swift/QtUI/main.cpp @@ -28,8 +28,6 @@ #include "QtSwiftUtil.h" int main(int argc, char* argv[]) { - QApplication app(argc, argv); - Swift::PlatformApplicationPathProvider applicationPathProvider(SWIFT_APPLICATION_NAME); Swift::CrashReporter crashReporter(applicationPathProvider.getDataDir() / "crashes"); @@ -84,6 +82,9 @@ int main(int argc, char* argv[]) { qtTranslator.load(QString(SWIFT_APPLICATION_NAME).toLower() + "_" + QLocale::system().name(), P2QSTRING(Swift::pathToString(someTranslationPath))); #endif } + + QApplication app(argc, argv); + app.installTranslator(&qtTranslator); QtTranslator swiftTranslator; Swift::Translator::setInstance(&swiftTranslator); -- cgit v0.10.2-6-g49f6