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

OP-857 OP-876 fixed issue that prevented default size of Options dialog to

be taken into account on 1st launch of GCS (with no user settings)
This commit is contained in:
Philippe Renon 2013-03-19 22:08:40 +01:00
parent 936f851166
commit 23077d3326

View File

@ -270,6 +270,7 @@ void MainWindow::extensionsInitialized()
QSettings *qs = m_settings;
QString commandLine;
if (!qs->allKeys().count()) {
// no user settings, so try to load some default ones
foreach(QString str, qApp->arguments()) {
if (str.contains("configfile")) {
qDebug() << "ass";
@ -292,15 +293,17 @@ void MainWindow::extensionsInitialized()
QString filename;
if (!commandLine.isEmpty() && QFile::exists(directory.absolutePath() + QDir::separator() + commandLine)) {
// use file name specified on command line
filename = directory.absolutePath() + QDir::separator() + commandLine;
qDebug() << "Configuration file" << filename << "specified on command line will be loaded.";
}
else if(QFile::exists(directory.absolutePath() + QDir::separator() + DEFAULT_CONFIG_FILENAME)) {
} else if (QFile::exists(directory.absolutePath() + QDir::separator() + DEFAULT_CONFIG_FILENAME)) {
// use default file name
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.";
} else {
// prompt user for default file name
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();
@ -309,7 +312,13 @@ void MainWindow::extensionsInitialized()
qDebug() << "Configuration file" << filename << "was selected and will be loaded.";
}
// create settings from file
qs = new QSettings(filename, XmlConfig::XmlSettingsFormat);
// replace empty settings with new ones
delete m_settings;
m_settings = qs;
qDebug() << "Configuration file" << filename << "was loaded.";
}
@ -900,13 +909,12 @@ void MainWindow::setFocusToEditor()
}
bool MainWindow::showOptionsDialog(const QString &category,
const QString &page,
QWidget *parent)
bool MainWindow::showOptionsDialog(const QString &category, const QString &page, QWidget *parent)
{
emit m_coreImpl->optionsDialogRequested();
if (!parent)
if (!parent) {
parent = this;
}
SettingsDialog dlg(parent, category, page);
return dlg.execDialog();
}