From c8a00c58eb606b68ca2fc8d1432c815a61742b82 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 20 May 2020 02:32:19 +1000 Subject: [PATCH] Qt: Add Remove Disc option to change disc menu --- src/duckstation-qt/mainwindow.cpp | 6 ++++++ src/duckstation-qt/mainwindow.h | 1 + src/duckstation-qt/mainwindow.ui | 6 ++++++ src/duckstation-qt/qthostinterface.cpp | 5 ++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 65913bf3a..2aafb3e29 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -272,6 +272,11 @@ void MainWindow::onChangeDiscFromGameListActionTriggered() switchToGameListView(); } +void MainWindow::onRemoveDiscActionTriggered() +{ + m_host_interface->changeDisc(QString()); +} + static void OpenURL(QWidget* parent, const QUrl& qurl) { if (!QDesktopServices::openUrl(qurl)) @@ -503,6 +508,7 @@ void MainWindow::connectSignals() connect(m_ui.actionChangeDiscFromFile, &QAction::triggered, this, &MainWindow::onChangeDiscFromFileActionTriggered); connect(m_ui.actionChangeDiscFromGameList, &QAction::triggered, this, &MainWindow::onChangeDiscFromGameListActionTriggered); + connect(m_ui.actionRemoveDisc, &QAction::triggered, this, &MainWindow::onRemoveDiscActionTriggered); connect(m_ui.actionAddGameDirectory, &QAction::triggered, [this]() { getSettingsDialog()->getGameListSettingsWidget()->addSearchDirectory(this); }); connect(m_ui.actionPowerOff, &QAction::triggered, m_host_interface, &QtHostInterface::powerOffSystem); diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 6701d6121..49a15c584 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -45,6 +45,7 @@ private Q_SLOTS: void onStartBIOSActionTriggered(); void onChangeDiscFromFileActionTriggered(); void onChangeDiscFromGameListActionTriggered(); + void onRemoveDiscActionTriggered(); void onGitHubRepositoryActionTriggered(); void onIssueTrackerActionTriggered(); void onDiscordServerActionTriggered(); diff --git a/src/duckstation-qt/mainwindow.ui b/src/duckstation-qt/mainwindow.ui index 928182c17..ce4b3bbaa 100644 --- a/src/duckstation-qt/mainwindow.ui +++ b/src/duckstation-qt/mainwindow.ui @@ -47,6 +47,7 @@ + @@ -399,6 +400,11 @@ From Game List... + + + Remove Disc + + Resume State diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index ad0090476..ed7b6705d 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -615,7 +615,10 @@ void QtHostInterface::changeDisc(const QString& new_disc_filename) if (!m_system) return; - m_system->InsertMedia(new_disc_filename.toStdString().c_str()); + if (!new_disc_filename.isEmpty()) + m_system->InsertMedia(new_disc_filename.toStdString().c_str()); + else + m_system->RemoveMedia(); } static QString FormatTimestampForSaveStateMenu(u64 timestamp)