diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-25 03:34:51 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-25 03:34:51 -0500 |
| commit | f1b621d0babd33537cde97fc9d53e0dfa0ad5ea5 (patch) | |
| tree | f30bc74456e5b65f5298d9891d95caef9054148e /src | |
| parent | bd191f3a71fbdcb706de9db5c29d615bfa13c174 (diff) | |
save/restore state for loot dialog
Diffstat (limited to 'src')
| -rw-r--r-- | src/lootdialog.cpp | 18 | ||||
| -rw-r--r-- | src/lootdialog.h | 3 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/lootdialog.cpp b/src/lootdialog.cpp index a8f73cdc..9e269fef 100644 --- a/src/lootdialog.cpp +++ b/src/lootdialog.cpp @@ -3,7 +3,6 @@ #include "loot.h" #include "organizercore.h" #include <utility.h> -#include <expanderwidget.h> #include <QWebChannel> using namespace MOBase; @@ -151,6 +150,20 @@ void LootDialog::openReport() shell::Open(path); } +int LootDialog::exec() +{ + auto& s = m_core.settings(); + + GeometrySaver gs(s, this); + s.geometry().restoreState(&m_expander); + + const auto r = QDialog::exec(); + + s.geometry().saveState(&m_expander); + + return r; +} + void LootDialog::accept() { // no-op @@ -193,11 +206,10 @@ void LootDialog::createUI() log::error("can't open '{}', {}", path, f.errorString()); } + m_expander.set(ui->details, ui->detailsPanel); ui->openJsonReport->setEnabled(false); connect(ui->openJsonReport, &QPushButton::clicked, [&]{ openReport(); }); - new ExpanderWidget(ui->details, ui->detailsPanel); - ui->buttons->setStandardButtons(QDialogButtonBox::Cancel); resize(650, 450); diff --git a/src/lootdialog.h b/src/lootdialog.h index fcdeb304..bc8c01fb 100644 --- a/src/lootdialog.h +++ b/src/lootdialog.h @@ -3,6 +3,7 @@ #include <lootcli/lootcli.h> #include <log.h> +#include <expanderwidget.h> namespace Ui { class LootDialog; } @@ -53,11 +54,13 @@ public: void cancel(); void openReport(); + int exec() override; void accept() override; void reject() override; private: std::unique_ptr<Ui::LootDialog> ui; + MOBase::ExpanderWidget m_expander; OrganizerCore& m_core; Loot& m_loot; bool m_finished; |
