summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-02-16 11:24:57 -0800
committerPokechu22 <Pokechu022@gmail.com>2021-05-07 15:42:19 -0700
commit83f7c41e318be983879eb18bbce3f7d5585bdcfd (patch)
treedd2bfdaf06616f26b229dfd7a18a38a328c5ba77 /Source/Core
parent05bd15a928a6e9d81653812829d569789ee72718 (diff)
Make the FIFO Player a separate window
This way, it can be focused with the render window behind it, instead of having the main window show up and cover the render window. This is useful for adjusting the object range, among other things.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp25
-rw-r--r--Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.h6
-rw-r--r--Source/Core/DolphinQt/MainWindow.cpp2
3 files changed, 27 insertions, 6 deletions
diff --git a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp
index e4154b6b6c..dc1b4f44b7 100644
--- a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp
+++ b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp
@@ -6,9 +6,13 @@
#include <QCheckBox>
#include <QDialogButtonBox>
+#include <QEvent>
#include <QFileDialog>
#include <QGroupBox>
#include <QHBoxLayout>
+#include <QIcon>
+#include <QKeyEvent>
+#include <QKeySequence>
#include <QLabel>
#include <QPushButton>
#include <QSpinBox>
@@ -26,12 +30,13 @@
#include "DolphinQt/FIFO/FIFOAnalyzer.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/QueueOnObject.h"
+#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
-FIFOPlayerWindow::FIFOPlayerWindow(QWidget* parent) : QDialog(parent)
+FIFOPlayerWindow::FIFOPlayerWindow(QWidget* parent) : QWidget(parent)
{
setWindowTitle(tr("FIFO Player"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+ setWindowIcon(Resources::GetAppIcon());
CreateWidgets();
ConnectWidgets();
@@ -56,6 +61,8 @@ FIFOPlayerWindow::FIFOPlayerWindow(QWidget* parent) : QDialog(parent)
OnEmulationStopped();
m_emu_state = state;
});
+
+ installEventFilter(this);
}
FIFOPlayerWindow::~FIFOPlayerWindow()
@@ -167,7 +174,7 @@ void FIFOPlayerWindow::ConnectWidgets()
connect(m_save, &QPushButton::clicked, this, &FIFOPlayerWindow::SaveRecording);
connect(m_record, &QPushButton::clicked, this, &FIFOPlayerWindow::StartRecording);
connect(m_stop, &QPushButton::clicked, this, &FIFOPlayerWindow::StopRecording);
- connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::reject);
+ connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::hide);
connect(m_early_memory_updates, &QCheckBox::toggled, this,
&FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged);
connect(m_frame_range_from, qOverload<int>(&QSpinBox::valueChanged), this,
@@ -371,3 +378,15 @@ void FIFOPlayerWindow::UpdateControls()
m_save->setEnabled(FifoRecorder::GetInstance().IsRecordingDone());
}
+
+bool FIFOPlayerWindow::eventFilter(QObject* object, QEvent* event)
+{
+ // Close when escape is pressed
+ if (event->type() == QEvent::KeyPress)
+ {
+ if (static_cast<QKeyEvent*>(event)->matches(QKeySequence::Cancel))
+ hide();
+ }
+
+ return false;
+}
diff --git a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.h b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.h
index 10df9b0b96..d6bc8b3600 100644
--- a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.h
+++ b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.h
@@ -4,7 +4,7 @@
#pragma once
-#include <QDialog>
+#include <QWidget>
#include "Core/Core.h"
@@ -15,7 +15,7 @@ class QPushButton;
class QSpinBox;
class FIFOAnalyzer;
-class FIFOPlayerWindow : public QDialog
+class FIFOPlayerWindow : public QWidget
{
Q_OBJECT
public:
@@ -45,6 +45,8 @@ private:
void UpdateInfo();
void UpdateLimits();
+ bool eventFilter(QObject* object, QEvent* event) final override;
+
QLabel* m_info_label;
QPushButton* m_load;
QPushButton* m_save;
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp
index 3261a4b740..61e58eb19f 100644
--- a/Source/Core/DolphinQt/MainWindow.cpp
+++ b/Source/Core/DolphinQt/MainWindow.cpp
@@ -1214,7 +1214,7 @@ void MainWindow::ShowFIFOPlayer()
{
if (!m_fifo_window)
{
- m_fifo_window = new FIFOPlayerWindow(this);
+ m_fifo_window = new FIFOPlayerWindow;
connect(m_fifo_window, &FIFOPlayerWindow::LoadFIFORequested, this,
[this](const QString& path) { StartGame(path, ScanForSecondDisc::No); });
}