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;
if (!new_disc_filename.isEmpty())
m_system->InsertMedia(new_disc_filename.toStdString().c_str());
else
m_system->RemoveMedia();
}
static QString FormatTimestampForSaveStateMenu(u64 timestamp)