Qt: Add Remove Disc option to change disc menu

This commit is contained in:
Connor McLaughlin 2020-05-20 02:32:19 +10:00
parent fa027d9c2a
commit c8a00c58eb
4 changed files with 17 additions and 1 deletions

View File

@ -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);

View File

@ -45,6 +45,7 @@ private Q_SLOTS:
void onStartBIOSActionTriggered();
void onChangeDiscFromFileActionTriggered();
void onChangeDiscFromGameListActionTriggered();
void onRemoveDiscActionTriggered();
void onGitHubRepositoryActionTriggered();
void onIssueTrackerActionTriggered();
void onDiscordServerActionTriggered();

View File

@ -47,6 +47,7 @@
</property>
<addaction name="actionChangeDiscFromFile"/>
<addaction name="actionChangeDiscFromGameList"/>
<addaction name="actionRemoveDisc"/>
</widget>
<widget class="QMenu" name="menuLoadState">
<property name="title">
@ -399,6 +400,11 @@
<string>From Game List...</string>
</property>
</action>
<action name="actionRemoveDisc">
<property name="text">
<string>Remove Disc</string>
</property>
</action>
<action name="actionResume_State">
<property name="text">
<string>Resume State</string>

View File

@ -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)