mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Merge remote-tracking branch 'origin/thread/OP-864_Remove_Configuration_Prompt' into filnet/OP-857_various_gcs_ui_polishing
This commit is contained in:
commit
936f851166
@ -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 };
|
||||
|
||||
@ -267,7 +268,6 @@ void MainWindow::modeChanged(Core::IMode */*mode*/)
|
||||
void MainWindow::extensionsInitialized()
|
||||
{
|
||||
QSettings *qs = m_settings;
|
||||
QSettings *settings;
|
||||
QString commandLine;
|
||||
if ( ! qs->allKeys().count() ) {
|
||||
foreach(QString str, qApp->arguments()) {
|
||||
@ -288,27 +288,29 @@ void MainWindow::extensionsInitialized()
|
||||
#endif
|
||||
directory.cd("default_configurations");
|
||||
|
||||
qDebug() << "Looking for default config files in: " + directory.absolutePath();
|
||||
bool showDialog = true;
|
||||
qDebug() << "Looking for configuration files in:" << directory.absolutePath();
|
||||
|
||||
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(!commandLine.isEmpty() && QFile::exists(directory.absolutePath() + QDir::separator() + commandLine)) {
|
||||
filename = directory.absolutePath() + QDir::separator() + commandLine;
|
||||
qDebug() << "Configuration file" << filename << "specified on command line will be loaded.";
|
||||
}
|
||||
if(showDialog) {
|
||||
else if(QFile::exists(directory.absolutePath() + QDir::separator() + DEFAULT_CONFIG_FILENAME)) {
|
||||
filename = directory.absolutePath() + QDir::separator() + DEFAULT_CONFIG_FILENAME;
|
||||
qDebug() << "Default configuration file" << filename << "will be loaded.";
|
||||
}
|
||||
else {
|
||||
qDebug() << "Default configuration file " << directory.absolutePath() << QDir::separator() << DEFAULT_CONFIG_FILENAME << "was not found.";
|
||||
importSettings *dialog = new importSettings(this);
|
||||
dialog->loadFiles(directory.absolutePath());
|
||||
dialog->exec();
|
||||
filename = dialog->choosenConfig();
|
||||
settings = new QSettings(filename, XmlConfig::XmlSettingsFormat);
|
||||
delete dialog;
|
||||
qDebug() << "Configuration file" << filename << "was selected and will be loaded.";
|
||||
}
|
||||
qs = settings;
|
||||
qDebug() << "Load default config from resource " << filename;
|
||||
|
||||
qs = new QSettings(filename, XmlConfig::XmlSettingsFormat);
|
||||
qDebug() << "Configuration file" << filename << "was loaded.";
|
||||
}
|
||||
|
||||
qs->beginGroup("General");
|
||||
|
Loading…
Reference in New Issue
Block a user