From e2e3089cf56b36b2bc5cb236f79af780d816f1bd Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Sun, 3 Mar 2013 16:56:52 +0100 Subject: [PATCH] OP-864 Made OpenPilotGCS.xml the default configuration on first start. If this file is missing for some reason the selection dialog will appear. The configuration can also be set as a command line option. --- .../src/plugins/coreplugin/mainwindow.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp index 000156d70..d21fe199d 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp @@ -91,6 +91,7 @@ using namespace Core; using namespace Core::Internal; static const char *uriListMimeFormatC = "text/uri-list"; +static const char *DEFAULT_CONFIG_FILENAME = "OpenPilotGCS.xml"; enum { debugMainWindow = 0 }; @@ -289,17 +290,17 @@ void MainWindow::extensionsInitialized() directory.cd("default_configurations"); qDebug() << "Looking for default config files in: " + directory.absolutePath(); - bool showDialog = true; + QString filename; if(!commandLine.isEmpty()) { if(QFile::exists(directory.absolutePath() + QDir::separator()+commandLine)) { filename = directory.absolutePath() + QDir::separator()+commandLine; qDebug() << "Load configuration from command line"; settings = new QSettings(filename, XmlConfig::XmlSettingsFormat); - showDialog = false; } - } - if(showDialog) { + } + if(!QFile::exists(directory.absolutePath() + QDir::separator() + DEFAULT_CONFIG_FILENAME)) { + qDebug() << "Default config file " << directory.absolutePath() << QDir::separator() << DEFAULT_CONFIG_FILENAME << " was not found."; importSettings *dialog = new importSettings(this); dialog->loadFiles(directory.absolutePath()); dialog->exec(); @@ -307,6 +308,11 @@ void MainWindow::extensionsInitialized() settings = new QSettings(filename, XmlConfig::XmlSettingsFormat); delete dialog; } + else { + qDebug() << "Default config file " << directory.absolutePath() << QDir::separator() << DEFAULT_CONFIG_FILENAME << " was not loaded."; + settings = new QSettings(directory.absolutePath() + QDir::separator() + + DEFAULT_CONFIG_FILENAME, XmlConfig::XmlSettingsFormat); + } qs = settings; qDebug() << "Load default config from resource " << filename; }