summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-05-09 01:54:28 +0200
committerPetr Mrázek <peterix@gmail.com>2017-05-09 01:54:28 +0200
commit8fe18cfabc8c42d10e6b4345f80dfd3ea67233d6 (patch)
treef9a6e15dde62a503d27e5f0c2b3c424ee4a6725d /application
parent0f311e12eea395a65f9173df90a5cc557989d2a3 (diff)
downloadMultiMC-8fe18cfabc8c42d10e6b4345f80dfd3ea67233d6.tar
MultiMC-8fe18cfabc8c42d10e6b4345f80dfd3ea67233d6.tar.gz
MultiMC-8fe18cfabc8c42d10e6b4345f80dfd3ea67233d6.tar.lz
MultiMC-8fe18cfabc8c42d10e6b4345f80dfd3ea67233d6.tar.xz
MultiMC-8fe18cfabc8c42d10e6b4345f80dfd3ea67233d6.zip
GH-1882 save UpdateDialog geometry
Diffstat (limited to 'application')
-rw-r--r--application/MainWindow.cpp4
-rw-r--r--application/MultiMC.cpp2
-rw-r--r--application/dialogs/UpdateDialog.cpp7
-rw-r--r--application/dialogs/UpdateDialog.h6
4 files changed, 15 insertions, 4 deletions
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp
index 9ecfbfd0..9eba9c44 100644
--- a/application/MainWindow.cpp
+++ b/application/MainWindow.cpp
@@ -913,7 +913,7 @@ void MainWindow::updateAvailable(GoUpdate::Status status)
updateNotAvailable();
return;
}
- UpdateDialog dlg;
+ UpdateDialog dlg(true, this);
UpdateAction action = (UpdateAction)dlg.exec();
switch (action)
{
@@ -928,7 +928,7 @@ void MainWindow::updateAvailable(GoUpdate::Status status)
void MainWindow::updateNotAvailable()
{
- UpdateDialog dlg(false);
+ UpdateDialog dlg(false, this);
dlg.exec();
}
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 18314371..52755e84 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -807,6 +807,8 @@ void MultiMC::initGlobalSettings()
m_settings->registerSetting("PagedGeometry", "");
+ m_settings->registerSetting("UpdateDialogGeometry", "");
+
// Jar mod nag dialog in version page
m_settings->registerSetting("JarModNagSeen", false);
diff --git a/application/dialogs/UpdateDialog.cpp b/application/dialogs/UpdateDialog.cpp
index 4bf27cf8..c935ec3b 100644
--- a/application/dialogs/UpdateDialog.cpp
+++ b/application/dialogs/UpdateDialog.cpp
@@ -23,6 +23,7 @@ UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), u
ui->btnUpdateLater->setText(tr("Close"));
}
loadChangelog();
+ restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("UpdateDialogGeometry").toByteArray()));
}
UpdateDialog::~UpdateDialog()
@@ -166,3 +167,9 @@ void UpdateDialog::on_btnUpdateNow_clicked()
{
done(UPDATE_NOW);
}
+
+void UpdateDialog::closeEvent(QCloseEvent* evt)
+{
+ MMC->settings()->set("UpdateDialogGeometry", saveGeometry().toBase64());
+ QDialog::closeEvent(evt);
+}
diff --git a/application/dialogs/UpdateDialog.h b/application/dialogs/UpdateDialog.h
index 8a9d9a2b..8099464b 100644
--- a/application/dialogs/UpdateDialog.h
+++ b/application/dialogs/UpdateDialog.h
@@ -43,8 +43,6 @@ public:
explicit UpdateDialog(bool hasUpdate = true, QWidget *parent = 0);
~UpdateDialog();
-private:
- Ui::UpdateDialog *ui;
public slots:
void on_btnUpdateNow_clicked();
void on_btnUpdateLater_clicked();
@@ -58,7 +56,11 @@ public slots:
/// Slot for when the chengelog fails to load...
void changelogFailed(QString reason);
+protected:
+ void closeEvent(QCloseEvent * ) override;
+
private:
+ Ui::UpdateDialog *ui;
QByteArray changelogData;
NetJobPtr dljob;
ChangelogType m_changelogType = CHANGELOG_MARKDOWN;