From 6a41353bdcb5586aeeed8074abe101d29c258899 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 26 Nov 2015 16:49:55 +0000 Subject: [PATCH] Remove accidentally duplicated functions. --- src/GUI/QtLauncher.cxx | 64 ++++++------------------------------------ 1 file changed, 9 insertions(+), 55 deletions(-) diff --git a/src/GUI/QtLauncher.cxx b/src/GUI/QtLauncher.cxx index f5be210d1..7c5478e94 100644 --- a/src/GUI/QtLauncher.cxx +++ b/src/GUI/QtLauncher.cxx @@ -309,11 +309,19 @@ namespace flightgear void initApp(int& argc, char** argv) { + sglog().setLogLevels( SG_ALL, SG_INFO ); + initQtResources(); // can't be called from a namespace + static bool qtInitDone = false; + static int s_argc; + if (!qtInitDone) { qtInitDone = true; + s_argc = argc; // QApplication only stores a reference to argc, + // and may crash if it is freed + // http://doc.qt.io/qt-5/qguiapplication.html#QGuiApplication - QApplication* app = new QApplication(argc, argv); + QApplication* app = new QApplication(s_argc, argv); app->setOrganizationName("FlightGear"); app->setApplicationName("FlightGear"); app->setOrganizationDomain("flightgear.org"); @@ -512,60 +520,6 @@ void QtLauncher::setInAppMode() connect(m_ui->runButton, SIGNAL(clicked()), this, SLOT(onApply())); } -void initApp(int& argc, char** argv) -{ - sglog().setLogLevels( SG_ALL, SG_INFO ); - Q_INIT_RESOURCE(resources); - - static bool qtInitDone = false; - static int s_argc; - if (!qtInitDone) { - qtInitDone = true; - s_argc = argc; // QApplication only stores a reference to argc, - // and may crash if it is freed - // http://doc.qt.io/qt-5/qguiapplication.html#QGuiApplication - - QApplication* app = new QApplication(s_argc, argv); - app->setOrganizationName("FlightGear"); - app->setApplicationName("FlightGear"); - app->setOrganizationDomain("flightgear.org"); - - // avoid double Apple menu and other weirdness if both Qt and OSG - // try to initialise various Cocoa structures. - flightgear::WindowBuilder::setPoseAsStandaloneApp(false); - - Qt::KeyboardModifiers mods = app->queryKeyboardModifiers(); - if (mods & Qt::AltModifier) { - qWarning() << "Alt pressed during launch"; - - // wipe out our settings - QSettings settings; - settings.clear(); - - Options::sharedInstance()->addOption("restore-defaults", ""); - } - } -} - -bool runLauncherDialog() -{ - // startup the nav-cache now. This preempts normal startup of - // the cache, but no harm done. (Providing scenery paths are consistent) - - initNavCache(); - - // setup scenery paths now, especially TerraSync path for airport - // parking locations (after they're downloaded) - - QtLauncher dlg; - dlg.exec(); - if (dlg.result() != QDialog::Accepted) { - return false; - } - - return true; -} - void QtLauncher::restoreSettings() { QSettings settings;