diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-03-05 14:02:45 -0800 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-03-07 15:59:03 -0800 |
| commit | 0645b4d5792111cc992b85cda6694c95ab43408f (patch) | |
| tree | e1e7755f2fa5f6a3b5e863fa13190a5fb81b96c3 /Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp | |
| parent | 8f6fd912f7ef3d744661cfdd0c9c33d44c223310 (diff) | |
BranchWatchDialog: Fix Misc. Errata
Window icon was missing from QDialog lacking a parent.
Giving the QDialog a parent revealed I had failed to make it properly non-modal, necessitating further changes.
Settings save less often, now only upon destruction.
Construction of BranchWatchDialog is now deferred.
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp b/Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp index f5e6a5acc3..f45da30d20 100644 --- a/Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp +++ b/Source/Core/DolphinQt/Debugger/BranchWatchDialog.cpp @@ -504,15 +504,9 @@ BranchWatchDialog::BranchWatchDialog(Core::System& system, Core::BranchWatch& br restoreGeometry(settings.value(QStringLiteral("branchwatchdialog/geometry")).toByteArray()); } -void BranchWatchDialog::done(int r) +BranchWatchDialog::~BranchWatchDialog() { - if (m_timer->isActive()) - m_timer->stop(); - auto& settings = Settings::GetQSettings(); - settings.setValue(QStringLiteral("branchwatchdialog/geometry"), saveGeometry()); - settings.setValue(QStringLiteral("branchwatchdialog/tableheader/state"), - m_table_view->horizontalHeader()->saveState()); - QDialog::done(r); + SaveSettings(); } static constexpr int BRANCH_WATCH_TOOL_TIMER_DELAY_MS = 100; @@ -523,18 +517,18 @@ static bool TimerCondition(const Core::BranchWatch& branch_watch, Core::State st return branch_watch.GetRecordingActive() && state > Core::State::Paused; } -int BranchWatchDialog::exec() +void BranchWatchDialog::hideEvent(QHideEvent* event) { - if (TimerCondition(m_branch_watch, Core::GetState())) - m_timer->start(BRANCH_WATCH_TOOL_TIMER_DELAY_MS); - return QDialog::exec(); + if (m_timer->isActive()) + m_timer->stop(); + QDialog::hideEvent(event); } -void BranchWatchDialog::open() +void BranchWatchDialog::showEvent(QShowEvent* event) { if (TimerCondition(m_branch_watch, Core::GetState())) m_timer->start(BRANCH_WATCH_TOOL_TIMER_DELAY_MS); - QDialog::open(); + QDialog::showEvent(event); } void BranchWatchDialog::OnStartPause(bool checked) @@ -927,6 +921,14 @@ void BranchWatchDialog::OnTableCopyAddress(QModelIndexList index_list) QApplication::clipboard()->setText(text); } +void BranchWatchDialog::SaveSettings() +{ + auto& settings = Settings::GetQSettings(); + settings.setValue(QStringLiteral("branchwatchdialog/geometry"), saveGeometry()); + settings.setValue(QStringLiteral("branchwatchdialog/tableheader/state"), + m_table_view->horizontalHeader()->saveState()); +} + void BranchWatchDialog::Update() { if (m_branch_watch.GetRecordingPhase() == Core::BranchWatch::Phase::Blacklist) |
