From 7a95314e424a0da203c9202c048f0cba0adfc8a6 Mon Sep 17 00:00:00 2001 From: flow Date: Tue, 19 Jul 2022 13:50:02 -0300 Subject: [PATCH] feat(ui): remember mod download dialog's geometry Makes it consistent with other modal dialogs. Signed-off-by: flow --- launcher/Application.cpp | 2 ++ launcher/ui/dialogs/ModDownloadDialog.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 2bd91fd7..5066fd0b 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -680,6 +680,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_settings->registerSetting("UpdateDialogGeometry", ""); + m_settings->registerSetting("ModDownloadGeometry", ""); + // HACK: This code feels so stupid is there a less stupid way of doing this? { m_settings->registerSetting("PastebinURL", ""); diff --git a/launcher/ui/dialogs/ModDownloadDialog.cpp b/launcher/ui/dialogs/ModDownloadDialog.cpp index af6704d9..05f76fbb 100644 --- a/launcher/ui/dialogs/ModDownloadDialog.cpp +++ b/launcher/ui/dialogs/ModDownloadDialog.cpp @@ -81,6 +81,8 @@ ModDownloadDialog::ModDownloadDialog(const std::shared_ptr& mods QMetaObject::connectSlotsByName(this); setWindowModality(Qt::WindowModal); setWindowTitle(dialogTitle()); + + restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("ModDownloadGeometry").toByteArray())); } QString ModDownloadDialog::dialogTitle() @@ -90,6 +92,7 @@ QString ModDownloadDialog::dialogTitle() void ModDownloadDialog::reject() { + APPLICATION->settings()->set("ModDownloadGeometry", saveGeometry().toBase64()); QDialog::reject(); } @@ -116,6 +119,7 @@ void ModDownloadDialog::confirm() void ModDownloadDialog::accept() { + APPLICATION->settings()->set("ModDownloadGeometry", saveGeometry().toBase64()); QDialog::accept(); }