Qt: Hook up extract button in ISO browser
This commit is contained in:
parent
ea632665c1
commit
3670c131e3
|
@ -28,6 +28,7 @@ ISOBrowserWindow::ISOBrowserWindow(QWidget* parent) : QWidget(parent)
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
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.directoryView, &QTreeWidget::itemClicked, this, &ISOBrowserWindow::onDirectoryItemClicked);
|
connect(m_ui.directoryView, &QTreeWidget::itemClicked, this, &ISOBrowserWindow::onDirectoryItemClicked);
|
||||||
connect(m_ui.fileView, &QTreeWidget::itemActivated, this, &ISOBrowserWindow::onFileItemActivated);
|
connect(m_ui.fileView, &QTreeWidget::itemActivated, this, &ISOBrowserWindow::onFileItemActivated);
|
||||||
connect(m_ui.fileView, &QTreeWidget::itemSelectionChanged, this, &ISOBrowserWindow::onFileItemSelectionChanged);
|
connect(m_ui.fileView, &QTreeWidget::itemSelectionChanged, this, &ISOBrowserWindow::onFileItemSelectionChanged);
|
||||||
|
@ -102,6 +103,16 @@ void ISOBrowserWindow::onOpenFileClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ISOBrowserWindow::onExtractClicked()
|
||||||
|
{
|
||||||
|
const QList<QTreeWidgetItem*> 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)
|
void ISOBrowserWindow::onDirectoryItemClicked(QTreeWidgetItem* item, int column)
|
||||||
{
|
{
|
||||||
populateFiles(item->data(0, Qt::UserRole).toString());
|
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 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;
|
QTreeWidgetItem* item = new QTreeWidgetItem;
|
||||||
item->setIcon(
|
item->setIcon(
|
||||||
0, QIcon::fromTheme(entry.IsDirectory() ? QStringLiteral("folder-open-line") : QStringLiteral("file-line")));
|
0, QIcon::fromTheme(entry.IsDirectory() ? QStringLiteral("folder-open-line") : QStringLiteral("file-line")));
|
||||||
|
|
|
@ -25,6 +25,7 @@ protected:
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onOpenFileClicked();
|
void onOpenFileClicked();
|
||||||
|
void onExtractClicked();
|
||||||
void onDirectoryItemClicked(QTreeWidgetItem* item, int column);
|
void onDirectoryItemClicked(QTreeWidgetItem* item, int column);
|
||||||
void onFileItemActivated(QTreeWidgetItem* item, int column);
|
void onFileItemActivated(QTreeWidgetItem* item, int column);
|
||||||
void onFileItemSelectionChanged();
|
void onFileItemSelectionChanged();
|
||||||
|
|
Loading…
Reference in New Issue