GH-1882 save UpdateDialog geometry

This commit is contained in:
Petr Mrázek 2017-05-09 01:54:28 +02:00
parent 0f311e12ee
commit 8fe18cfabc
4 changed files with 15 additions and 4 deletions

View File

@ -913,7 +913,7 @@ void MainWindow::updateAvailable(GoUpdate::Status status)
updateNotAvailable(); updateNotAvailable();
return; return;
} }
UpdateDialog dlg; UpdateDialog dlg(true, this);
UpdateAction action = (UpdateAction)dlg.exec(); UpdateAction action = (UpdateAction)dlg.exec();
switch (action) switch (action)
{ {
@ -928,7 +928,7 @@ void MainWindow::updateAvailable(GoUpdate::Status status)
void MainWindow::updateNotAvailable() void MainWindow::updateNotAvailable()
{ {
UpdateDialog dlg(false); UpdateDialog dlg(false, this);
dlg.exec(); dlg.exec();
} }

View File

@ -807,6 +807,8 @@ void MultiMC::initGlobalSettings()
m_settings->registerSetting("PagedGeometry", ""); m_settings->registerSetting("PagedGeometry", "");
m_settings->registerSetting("UpdateDialogGeometry", "");
// Jar mod nag dialog in version page // Jar mod nag dialog in version page
m_settings->registerSetting("JarModNagSeen", false); m_settings->registerSetting("JarModNagSeen", false);

View File

@ -23,6 +23,7 @@ UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), u
ui->btnUpdateLater->setText(tr("Close")); ui->btnUpdateLater->setText(tr("Close"));
} }
loadChangelog(); loadChangelog();
restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("UpdateDialogGeometry").toByteArray()));
} }
UpdateDialog::~UpdateDialog() UpdateDialog::~UpdateDialog()
@ -166,3 +167,9 @@ void UpdateDialog::on_btnUpdateNow_clicked()
{ {
done(UPDATE_NOW); done(UPDATE_NOW);
} }
void UpdateDialog::closeEvent(QCloseEvent* evt)
{
MMC->settings()->set("UpdateDialogGeometry", saveGeometry().toBase64());
QDialog::closeEvent(evt);
}

View File

@ -43,8 +43,6 @@ public:
explicit UpdateDialog(bool hasUpdate = true, QWidget *parent = 0); explicit UpdateDialog(bool hasUpdate = true, QWidget *parent = 0);
~UpdateDialog(); ~UpdateDialog();
private:
Ui::UpdateDialog *ui;
public slots: public slots:
void on_btnUpdateNow_clicked(); void on_btnUpdateNow_clicked();
void on_btnUpdateLater_clicked(); void on_btnUpdateLater_clicked();
@ -58,7 +56,11 @@ public slots:
/// Slot for when the chengelog fails to load... /// Slot for when the chengelog fails to load...
void changelogFailed(QString reason); void changelogFailed(QString reason);
protected:
void closeEvent(QCloseEvent * ) override;
private: private:
Ui::UpdateDialog *ui;
QByteArray changelogData; QByteArray changelogData;
NetJobPtr dljob; NetJobPtr dljob;
ChangelogType m_changelogType = CHANGELOG_MARKDOWN; ChangelogType m_changelogType = CHANGELOG_MARKDOWN;