1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

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.

This commit is contained in:
Fredrik Arvidsson 2013-03-03 16:56:52 +01:00
parent 70294ed1ad
commit e2e3089cf5

View File

@ -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;
}