Qt: Add ISO Browser to Tools menu

This commit is contained in:
Stenzek 2024-12-14 14:04:42 +10:00
parent 726aa67d1b
commit dcaee9b87e
No known key found for this signature in database
6 changed files with 28 additions and 1 deletions

View File

@ -26,6 +26,7 @@ ISOBrowserWindow::ISOBrowserWindow(QWidget* parent) : QWidget(parent)
m_ui.setupUi(this); m_ui.setupUi(this);
m_ui.splitter->setSizes({200, 600}); m_ui.splitter->setSizes({200, 600});
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
enableUi(false);
connect(m_ui.openFile, &QAbstractButton::clicked, this, &ISOBrowserWindow::onOpenFileClicked); connect(m_ui.openFile, &QAbstractButton::clicked, this, &ISOBrowserWindow::onOpenFileClicked);
connect(m_ui.extract, &QAbstractButton::clicked, this, &ISOBrowserWindow::onExtractClicked); connect(m_ui.extract, &QAbstractButton::clicked, this, &ISOBrowserWindow::onExtractClicked);
@ -69,6 +70,7 @@ bool ISOBrowserWindow::tryOpenFile(const QString& path, Error* error /*= nullptr
m_iso = std::move(new_reader); m_iso = std::move(new_reader);
m_ui.openPath->setText(QString::fromStdString(native_path)); m_ui.openPath->setText(QString::fromStdString(native_path));
setWindowTitle(tr("ISO Browser - %1").arg(QtUtils::StringViewToQString(Path::GetFileName(native_path)))); setWindowTitle(tr("ISO Browser - %1").arg(QtUtils::StringViewToQString(Path::GetFileName(native_path))));
enableUi(true);
populateDirectories(); populateDirectories();
populateFiles(QString()); populateFiles(QString());
return true; return true;
@ -248,6 +250,15 @@ QTreeWidgetItem* ISOBrowserWindow::findDirectoryItemForPath(const QString& path,
return nullptr; return nullptr;
} }
void ISOBrowserWindow::enableUi(bool enabled)
{
m_ui.directoryView->setEnabled(enabled);
m_ui.fileView->setEnabled(enabled);
if (!enabled)
m_ui.extract->setEnabled(enabled);
}
void ISOBrowserWindow::populateDirectories() void ISOBrowserWindow::populateDirectories()
{ {
m_ui.directoryView->clear(); m_ui.directoryView->clear();

View File

@ -33,6 +33,7 @@ private Q_SLOTS:
void resizeFileListColumns(); void resizeFileListColumns();
private: private:
void enableUi(bool enabled);
void populateDirectories(); void populateDirectories();
void populateSubdirectories(std::string_view dir, QTreeWidgetItem* parent); void populateSubdirectories(std::string_view dir, QTreeWidgetItem* parent);
void populateFiles(const QString& path); void populateFiles(const QString& path);

View File

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>ISO Browser</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="resources/duckstation-qt.qrc"> <iconset resource="resources/duckstation-qt.qrc">

View File

@ -2008,6 +2008,7 @@ void MainWindow::connectSignals()
connect(m_ui.actionCheckForUpdates, &QAction::triggered, this, &MainWindow::onCheckForUpdatesActionTriggered); connect(m_ui.actionCheckForUpdates, &QAction::triggered, this, &MainWindow::onCheckForUpdatesActionTriggered);
connect(m_ui.actionMemoryCardEditor, &QAction::triggered, this, &MainWindow::onToolsMemoryCardEditorTriggered); connect(m_ui.actionMemoryCardEditor, &QAction::triggered, this, &MainWindow::onToolsMemoryCardEditorTriggered);
connect(m_ui.actionMemoryScanner, &QAction::triggered, this, &MainWindow::onToolsMemoryScannerTriggered); connect(m_ui.actionMemoryScanner, &QAction::triggered, this, &MainWindow::onToolsMemoryScannerTriggered);
connect(m_ui.actionISOBrowser, &QAction::triggered, this, &MainWindow::onToolsISOBrowserTriggered);
connect(m_ui.actionCoverDownloader, &QAction::triggered, this, &MainWindow::onToolsCoverDownloaderTriggered); connect(m_ui.actionCoverDownloader, &QAction::triggered, this, &MainWindow::onToolsCoverDownloaderTriggered);
connect(m_ui.actionMediaCapture, &QAction::toggled, this, &MainWindow::onToolsMediaCaptureToggled); connect(m_ui.actionMediaCapture, &QAction::toggled, this, &MainWindow::onToolsMediaCaptureToggled);
connect(m_ui.actionCaptureGPUFrame, &QAction::triggered, g_emu_thread, &EmuThread::captureGPUFrameDump); connect(m_ui.actionCaptureGPUFrame, &QAction::triggered, g_emu_thread, &EmuThread::captureGPUFrameDump);
@ -2710,6 +2711,13 @@ void MainWindow::onToolsMemoryScannerTriggered()
QtUtils::ShowOrRaiseWindow(m_memory_scanner_window); QtUtils::ShowOrRaiseWindow(m_memory_scanner_window);
} }
void MainWindow::onToolsISOBrowserTriggered()
{
ISOBrowserWindow* ib = new ISOBrowserWindow();
ib->setAttribute(Qt::WA_DeleteOnClose);
ib->show();
}
void MainWindow::openCPUDebugger() void MainWindow::openCPUDebugger()
{ {
if (!m_debugger_window) if (!m_debugger_window)

View File

@ -186,6 +186,7 @@ private Q_SLOTS:
void onCheckForUpdatesActionTriggered(); void onCheckForUpdatesActionTriggered();
void onToolsMemoryCardEditorTriggered(); void onToolsMemoryCardEditorTriggered();
void onToolsMemoryScannerTriggered(); void onToolsMemoryScannerTriggered();
void onToolsISOBrowserTriggered();
void onToolsCoverDownloaderTriggered(); void onToolsCoverDownloaderTriggered();
void onToolsMediaCaptureToggled(bool checked); void onToolsMediaCaptureToggled(bool checked);
void onToolsOpenDataDirectoryTriggered(); void onToolsOpenDataDirectoryTriggered();

View File

@ -229,6 +229,7 @@
<addaction name="actionCoverDownloader"/> <addaction name="actionCoverDownloader"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionMemoryScanner"/> <addaction name="actionMemoryScanner"/>
<addaction name="actionISOBrowser"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionMediaCapture"/> <addaction name="actionMediaCapture"/>
<addaction name="actionCaptureGPUFrame"/> <addaction name="actionCaptureGPUFrame"/>
@ -961,6 +962,11 @@
<string>Log To File</string> <string>Log To File</string>
</property> </property>
</action> </action>
<action name="actionISOBrowser">
<property name="text">
<string>ISO Browser</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="resources/duckstation-qt.qrc"/> <include location="resources/duckstation-qt.qrc"/>