mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +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:
parent
23077d3326
commit
e39f70536b
@ -77,12 +77,8 @@ static inline QList<Core::IOptionsPage*> sortedOptionsPages()
|
||||
return rc;
|
||||
}
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId,
|
||||
const QString &pageId)
|
||||
: QDialog(parent),
|
||||
m_applied(false),
|
||||
m_windowWidth(0),
|
||||
m_windowHeight(0)
|
||||
SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const QString &pageId)
|
||||
: QDialog(parent), m_applied(false)
|
||||
{
|
||||
setupUi(this);
|
||||
#ifdef Q_OS_MAC
|
||||
@ -90,19 +86,28 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId,
|
||||
#else
|
||||
setWindowTitle(tr("Options"));
|
||||
#endif
|
||||
|
||||
QSettings *settings = ICore::instance()->settings();
|
||||
settings->beginGroup("General");
|
||||
|
||||
// restore last displayed category and page
|
||||
// this is done only if no category or page was provided through the constructor
|
||||
QString initialCategory = categoryId;
|
||||
QString initialPage = pageId;
|
||||
qDebug() << "SettingsDialog constructor initial category: " << initialCategory << ", initial page: " << initialPage;
|
||||
qDebug() << "SettingsDialog constructor initial category:" << initialCategory << ", initial page:" << initialPage;
|
||||
if (initialCategory.isEmpty() && initialPage.isEmpty()) {
|
||||
QSettings *settings = ICore::instance()->settings();
|
||||
initialCategory = settings->value("General/LastPreferenceCategory", QVariant(QString())).toString();
|
||||
initialPage = settings->value("General/LastPreferencePage", QVariant(QString())).toString();
|
||||
qDebug() << "SettingsDialog settings initial category: " << initialCategory << ", initial page: " << initialPage;
|
||||
m_windowWidth = settings->value("General/SettingsWindowWidth", 0).toInt();
|
||||
m_windowHeight = settings->value("General/SettingsWindowHeight", 0).toInt();
|
||||
initialCategory = settings->value("LastPreferenceCategory", QVariant(QString())).toString();
|
||||
initialPage = settings->value("LastPreferencePage", QVariant(QString())).toString();
|
||||
qDebug() << "SettingsDialog settings initial category:" << initialCategory << ", initial page: " << initialPage;
|
||||
}
|
||||
if (m_windowWidth > 0 && m_windowHeight > 0)
|
||||
resize(m_windowWidth, m_windowHeight);
|
||||
// restore window size
|
||||
int windowWidth = settings->value("SettingsWindowWidth", 0).toInt();
|
||||
int windowHeight = settings->value("SettingsWindowHeight", 0).toInt();
|
||||
qDebug() << "SettingsDialog window width :" << windowWidth << ", height:" << windowHeight;
|
||||
if (windowWidth > 0 && windowHeight > 0) {
|
||||
resize(windowWidth, windowHeight);
|
||||
}
|
||||
settings->endGroup();
|
||||
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
|
||||
|
@ -46,15 +46,12 @@ class SettingsDialog : public QDialog, public ::Ui::SettingsDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsDialog(QWidget *parent,
|
||||
const QString &initialCategory = QString(),
|
||||
const QString &initialPage = QString());
|
||||
SettingsDialog(QWidget *parent, const QString &initialCategory = QString(), const QString &initialPage = QString());
|
||||
~SettingsDialog();
|
||||
|
||||
// Run the dialog and return true if 'Ok' was choosen or 'Apply' was invoked
|
||||
// at least once
|
||||
// Run the dialog and return true if 'Ok' was choosen or 'Apply' was invoked at least once
|
||||
bool execDialog();
|
||||
void insertPage(IOptionsPage* page);
|
||||
void insertPage(IOptionsPage *page);
|
||||
void deletePage();
|
||||
void updateText(QString text);
|
||||
void disableApplyOk(bool disable);
|
||||
@ -74,17 +71,13 @@ private slots:
|
||||
void apply();
|
||||
void categoryItemSelectedShowChildInstead();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QList<Core::IOptionsPage*> m_pages;
|
||||
QMap<QString, QList<QTreeWidgetItem *> *> m_categoryItemsMap;
|
||||
UAVGadgetInstanceManager *m_instanceManager;
|
||||
bool m_applied;
|
||||
QString m_currentCategory;
|
||||
QString m_currentPage;
|
||||
int m_windowWidth;
|
||||
int m_windowHeight;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Loading…
x
Reference in New Issue
Block a user