diff --git a/src/duckstation-qt/isobrowserwindow.cpp b/src/duckstation-qt/isobrowserwindow.cpp index cb15c820c..82dc2f8ca 100644 --- a/src/duckstation-qt/isobrowserwindow.cpp +++ b/src/duckstation-qt/isobrowserwindow.cpp @@ -28,6 +28,7 @@ ISOBrowserWindow::ISOBrowserWindow(QWidget* parent) : QWidget(parent) setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); connect(m_ui.openFile, &QAbstractButton::clicked, this, &ISOBrowserWindow::onOpenFileClicked); + connect(m_ui.extract, &QAbstractButton::clicked, this, &ISOBrowserWindow::onExtractClicked); connect(m_ui.directoryView, &QTreeWidget::itemClicked, this, &ISOBrowserWindow::onDirectoryItemClicked); connect(m_ui.fileView, &QTreeWidget::itemActivated, this, &ISOBrowserWindow::onFileItemActivated); connect(m_ui.fileView, &QTreeWidget::itemSelectionChanged, this, &ISOBrowserWindow::onFileItemSelectionChanged); @@ -102,6 +103,16 @@ void ISOBrowserWindow::onOpenFileClicked() } } +void ISOBrowserWindow::onExtractClicked() +{ + const QList items = m_ui.fileView->selectedItems(); + if (items.isEmpty()) + return; + + const QString path = items.front()->data(0, Qt::UserRole).toString(); + extractFile(path); +} + void ISOBrowserWindow::onDirectoryItemClicked(QTreeWidgetItem* item, int column) { populateFiles(item->data(0, Qt::UserRole).toString()); @@ -295,8 +306,6 @@ void ISOBrowserWindow::populateFiles(const QString& path) } const auto add_entry = [this](const std::string& full_path, const IsoReader::ISODirectoryEntry& entry) { - const std::string_view filename = Path::GetFileName(full_path); - QTreeWidgetItem* item = new QTreeWidgetItem; item->setIcon( 0, QIcon::fromTheme(entry.IsDirectory() ? QStringLiteral("folder-open-line") : QStringLiteral("file-line"))); diff --git a/src/duckstation-qt/isobrowserwindow.h b/src/duckstation-qt/isobrowserwindow.h index 6e67c8c03..c13141bbb 100644 --- a/src/duckstation-qt/isobrowserwindow.h +++ b/src/duckstation-qt/isobrowserwindow.h @@ -25,6 +25,7 @@ protected: private Q_SLOTS: void onOpenFileClicked(); + void onExtractClicked(); void onDirectoryItemClicked(QTreeWidgetItem* item, int column); void onFileItemActivated(QTreeWidgetItem* item, int column); void onFileItemSelectionChanged();