mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +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;
|
using namespace Core::Internal;
|
||||||
|
|
||||||
static const char *uriListMimeFormatC = "text/uri-list";
|
static const char *uriListMimeFormatC = "text/uri-list";
|
||||||
|
static const char *DEFAULT_CONFIG_FILENAME = "OpenPilotGCS.xml";
|
||||||
|
|
||||||
enum { debugMainWindow = 0 };
|
enum { debugMainWindow = 0 };
|
||||||
|
|
||||||
@ -267,7 +268,6 @@ void MainWindow::modeChanged(Core::IMode */*mode*/)
|
|||||||
void MainWindow::extensionsInitialized()
|
void MainWindow::extensionsInitialized()
|
||||||
{
|
{
|
||||||
QSettings *qs = m_settings;
|
QSettings *qs = m_settings;
|
||||||
QSettings *settings;
|
|
||||||
QString commandLine;
|
QString commandLine;
|
||||||
if ( ! qs->allKeys().count() ) {
|
if ( ! qs->allKeys().count() ) {
|
||||||
foreach(QString str, qApp->arguments()) {
|
foreach(QString str, qApp->arguments()) {
|
||||||
@ -288,27 +288,29 @@ void MainWindow::extensionsInitialized()
|
|||||||
#endif
|
#endif
|
||||||
directory.cd("default_configurations");
|
directory.cd("default_configurations");
|
||||||
|
|
||||||
qDebug() << "Looking for default config files in: " + directory.absolutePath();
|
qDebug() << "Looking for configuration files in:" << directory.absolutePath();
|
||||||
bool showDialog = true;
|
|
||||||
QString filename;
|
QString filename;
|
||||||
if(!commandLine.isEmpty()) {
|
if(!commandLine.isEmpty() && QFile::exists(directory.absolutePath() + QDir::separator() + commandLine)) {
|
||||||
if(QFile::exists(directory.absolutePath() + QDir::separator()+commandLine)) {
|
filename = directory.absolutePath() + QDir::separator() + commandLine;
|
||||||
filename = directory.absolutePath() + QDir::separator()+commandLine;
|
qDebug() << "Configuration file" << filename << "specified on command line will be loaded.";
|
||||||
qDebug() << "Load configuration from command line";
|
|
||||||
settings = new QSettings(filename, XmlConfig::XmlSettingsFormat);
|
|
||||||
showDialog = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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);
|
importSettings *dialog = new importSettings(this);
|
||||||
dialog->loadFiles(directory.absolutePath());
|
dialog->loadFiles(directory.absolutePath());
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
filename = dialog->choosenConfig();
|
filename = dialog->choosenConfig();
|
||||||
settings = new QSettings(filename, XmlConfig::XmlSettingsFormat);
|
|
||||||
delete dialog;
|
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");
|
qs->beginGroup("General");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user