diff options
| author | Léo Lam <leo@leolam.fr> | 2022-01-13 14:36:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-13 14:36:48 +0100 |
| commit | 21b9e6a34fbd989547f968d4916e07e6a706b80e (patch) | |
| tree | 58c4375bd4d040cd37673be174ef23f460421e89 /Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp | |
| parent | 1cea399e9c74aa82b89090b01d2d4dac4e6f39be (diff) | |
| parent | 29df17d422bd4912987eda501e7d68c312763106 (diff) | |
Merge pull request #10355 from Pokechu22/fifo-player-config
FifoPlayer: Store early memory updates option in the config and allow changing loop option at runtime
Diffstat (limited to 'Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp index c9f9a6ceff..bda4da3d88 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp @@ -24,6 +24,7 @@ #include "Core/FifoPlayer/FifoPlayer.h" #include "Core/FifoPlayer/FifoRecorder.h" +#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h" #include "DolphinQt/FIFO/FIFOAnalyzer.h" #include "DolphinQt/QtUtils/DolphinFileDialog.h" #include "DolphinQt/QtUtils/ModalMessageBox.h" @@ -38,6 +39,7 @@ FIFOPlayerWindow::FIFOPlayerWindow(QWidget* parent) : QWidget(parent) CreateWidgets(); ConnectWidgets(); + AddDescriptions(); UpdateInfo(); @@ -116,11 +118,13 @@ void FIFOPlayerWindow::CreateWidgets() // Playback Options auto* playback_group = new QGroupBox(tr("Playback Options")); auto* playback_layout = new QGridLayout; - m_early_memory_updates = new QCheckBox(tr("Early Memory Updates")); + m_early_memory_updates = new ToolTipCheckBox(tr("Early Memory Updates")); + m_loop = new ToolTipCheckBox(tr("Loop")); playback_layout->addWidget(object_range_group, 0, 0); playback_layout->addWidget(frame_range_group, 0, 1); - playback_layout->addWidget(m_early_memory_updates, 1, 0, 1, -1); + playback_layout->addWidget(m_early_memory_updates, 1, 0); + playback_layout->addWidget(m_loop, 1, 1); playback_group->setLayout(playback_layout); // Recording Options @@ -166,6 +170,12 @@ void FIFOPlayerWindow::CreateWidgets() setLayout(tab_layout); } +void FIFOPlayerWindow::LoadSettings() +{ + m_early_memory_updates->setChecked(Config::Get(Config::MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES)); + m_loop->setChecked(Config::Get(Config::MAIN_FIFOPLAYER_LOOP_REPLAY)); +} + void FIFOPlayerWindow::ConnectWidgets() { connect(m_load, &QPushButton::clicked, this, &FIFOPlayerWindow::LoadRecording); @@ -173,8 +183,9 @@ void FIFOPlayerWindow::ConnectWidgets() connect(m_record, &QPushButton::clicked, this, &FIFOPlayerWindow::StartRecording); connect(m_stop, &QPushButton::clicked, this, &FIFOPlayerWindow::StopRecording); connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::hide); - connect(m_early_memory_updates, &QCheckBox::toggled, this, - &FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged); + connect(m_early_memory_updates, &QCheckBox::toggled, this, &FIFOPlayerWindow::OnConfigChanged); + connect(m_loop, &QCheckBox::toggled, this, &FIFOPlayerWindow::OnConfigChanged); + connect(m_frame_range_from, qOverload<int>(&QSpinBox::valueChanged), this, &FIFOPlayerWindow::OnLimitsChanged); connect(m_frame_range_to, qOverload<int>(&QSpinBox::valueChanged), this, @@ -186,6 +197,21 @@ void FIFOPlayerWindow::ConnectWidgets() &FIFOPlayerWindow::OnLimitsChanged); } +void FIFOPlayerWindow::AddDescriptions() +{ + static const char TR_MEMORY_UPDATES_DESCRIPTION[] = QT_TR_NOOP( + "If enabled, then all memory updates happen at once before the first frame.<br><br>" + "Causes issues with many fifologs, but can be useful for testing.<br><br>" + "<dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>"); + static const char TR_LOOP_DESCRIPTION[] = + QT_TR_NOOP("If unchecked, then playback of the fifolog stops after the final frame.<br><br>" + "This is generally only useful when a frame-dumping option is enabled.<br><br>" + "<dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>"); + + m_early_memory_updates->SetDescription(tr(TR_MEMORY_UPDATES_DESCRIPTION)); + m_loop->SetDescription(tr(TR_LOOP_DESCRIPTION)); +} + void FIFOPlayerWindow::LoadRecording() { QString path = DolphinFileDialog::getOpenFileName(this, tr("Open FIFO log"), QString(), @@ -324,9 +350,11 @@ void FIFOPlayerWindow::OnFIFOLoaded() m_analyzer->Update(); } -void FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged(bool enabled) +void FIFOPlayerWindow::OnConfigChanged() { - FifoPlayer::GetInstance().SetEarlyMemoryUpdates(enabled); + Config::SetBase(Config::MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES, + m_early_memory_updates->isChecked()); + Config::SetBase(Config::MAIN_FIFOPLAYER_LOOP_REPLAY, m_loop->isChecked()); } void FIFOPlayerWindow::OnLimitsChanged() @@ -363,8 +391,6 @@ void FIFOPlayerWindow::UpdateControls() m_object_range_to->setEnabled(is_playing); m_object_range_to_label->setEnabled(is_playing); - m_early_memory_updates->setEnabled(is_playing); - bool enable_frame_record_count = !is_playing && !is_recording; m_frame_record_count_label->setEnabled(enable_frame_record_count); |
