mirror of https://github.com/PCSX2/pcsx2.git
Qt: Implement remove disc
This commit is contained in:
parent
5391b529b6
commit
131b92e9fe
|
@ -207,6 +207,7 @@ void MainWindow::connectSignals()
|
|||
connect(m_ui.actionChangeDiscFromFile, &QAction::triggered, this, &MainWindow::onChangeDiscFromFileActionTriggered);
|
||||
connect(m_ui.actionChangeDiscFromDevice, &QAction::triggered, this, &MainWindow::onChangeDiscFromDeviceActionTriggered);
|
||||
connect(m_ui.actionChangeDiscFromGameList, &QAction::triggered, this, &MainWindow::onChangeDiscFromGameListActionTriggered);
|
||||
connect(m_ui.actionRemoveDisc, &QAction::triggered, this, &MainWindow::onRemoveDiscActionTriggered);
|
||||
connect(m_ui.menuChangeDisc, &QMenu::aboutToShow, this, &MainWindow::onChangeDiscMenuAboutToShow);
|
||||
connect(m_ui.menuChangeDisc, &QMenu::aboutToHide, this, &MainWindow::onChangeDiscMenuAboutToHide);
|
||||
connect(m_ui.actionPowerOff, &QAction::triggered, this, [this]() { requestShutdown(true, true); });
|
||||
|
@ -1141,6 +1142,11 @@ void MainWindow::onChangeDiscFromDeviceActionTriggered()
|
|||
g_emu_thread->changeDisc(CDVD_SourceType::Disc, path);
|
||||
}
|
||||
|
||||
void MainWindow::onRemoveDiscActionTriggered()
|
||||
{
|
||||
g_emu_thread->changeDisc(CDVD_SourceType::NoDisc, QString());
|
||||
}
|
||||
|
||||
void MainWindow::onChangeDiscMenuAboutToShow()
|
||||
{
|
||||
// TODO: This is where we would populate the playlist if there is one.
|
||||
|
|
|
@ -118,6 +118,7 @@ private Q_SLOTS:
|
|||
void onChangeDiscFromFileActionTriggered();
|
||||
void onChangeDiscFromGameListActionTriggered();
|
||||
void onChangeDiscFromDeviceActionTriggered();
|
||||
void onRemoveDiscActionTriggered();
|
||||
void onChangeDiscMenuAboutToShow();
|
||||
void onChangeDiscMenuAboutToHide();
|
||||
void onLoadStateMenuAboutToShow();
|
||||
|
|
|
@ -1307,17 +1307,20 @@ bool VMManager::ChangeDisc(CDVD_SourceType source, std::string path)
|
|||
const bool result = DoCDVDopen();
|
||||
if (result)
|
||||
{
|
||||
Host::AddOSDMessage(fmt::format("Disc changed to '{}'.", display_name), 5.0f);
|
||||
if (source == CDVD_SourceType::NoDisc)
|
||||
Host::AddKeyedOSDMessage("ChangeDisc", "Disc removed.", 5.0f);
|
||||
else
|
||||
Host::AddKeyedOSDMessage("ChangeDisc", fmt::format("Disc changed to '{}'.", display_name), 5.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Host::AddOSDMessage(fmt::format("Failed to open new disc image '{}'. Reverting to old image.", display_name), 20.0f);
|
||||
Host::AddKeyedOSDMessage("ChangeDisc", fmt::format("Failed to open new disc image '{}'. Reverting to old image.", display_name), 20.0f);
|
||||
CDVDsys_ChangeSource(old_type);
|
||||
if (!old_path.empty())
|
||||
CDVDsys_SetFile(old_type, std::move(old_path));
|
||||
if (!DoCDVDopen())
|
||||
{
|
||||
Host::AddOSDMessage("Failed to switch back to old disc image. Removing disc.", 20.0f);
|
||||
Host::AddKeyedOSDMessage("ChangeDisc", "Failed to switch back to old disc image. Removing disc.", 20.0f);
|
||||
CDVDsys_ChangeSource(CDVD_SourceType::NoDisc);
|
||||
DoCDVDopen();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue