aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs/ExportMrPackDialog.cpp
diff options
context:
space:
mode:
authorTheKodeToad <TheKodeToad@proton.me>2023-03-02 11:25:36 +0000
committerTheKodeToad <TheKodeToad@proton.me>2023-03-02 11:25:36 +0000
commit46cc325f7cc9810abe6e152484a51fed92b1bb52 (patch)
treee13299b694c2cadfa7a009c3b3351fe95e0790eb /launcher/ui/dialogs/ExportMrPackDialog.cpp
parent0fadb5a2be5f8136a4a5f52f7e5602698b53f09e (diff)
downloadPrismLauncher-46cc325f7cc9810abe6e152484a51fed92b1bb52.tar.gz
PrismLauncher-46cc325f7cc9810abe6e152484a51fed92b1bb52.tar.bz2
PrismLauncher-46cc325f7cc9810abe6e152484a51fed92b1bb52.zip
Add file tree
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/ui/dialogs/ExportMrPackDialog.cpp')
-rw-r--r--launcher/ui/dialogs/ExportMrPackDialog.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/launcher/ui/dialogs/ExportMrPackDialog.cpp b/launcher/ui/dialogs/ExportMrPackDialog.cpp
index 735a6245..1a839061 100644
--- a/launcher/ui/dialogs/ExportMrPackDialog.cpp
+++ b/launcher/ui/dialogs/ExportMrPackDialog.cpp
@@ -17,6 +17,7 @@
*/
#include "ExportMrPackDialog.h"
+#include <QFileSystemModel>
#include "ui_ExportMrPackDialog.h"
ExportMrPackDialog::ExportMrPackDialog(InstancePtr instance, QWidget* parent)
@@ -24,15 +25,29 @@ ExportMrPackDialog::ExportMrPackDialog(InstancePtr instance, QWidget* parent)
{
ui->setupUi(this);
ui->name->setText(instance->name());
+
+ auto model = new QFileSystemModel(this);
+ // use the game root - everything outside cannot be exported
+ QString root = instance->gameRoot();
+ proxy = new PackIgnoreProxy(root, this);
+ proxy->setSourceModel(model);
+ ui->treeView->setModel(proxy);
+ ui->treeView->setRootIndex(proxy->mapFromSource(model->index(root)));
+ ui->treeView->sortByColumn(0, Qt::AscendingOrder);
+ model->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden);
+ model->setRootPath(root);
+ auto headerView = ui->treeView->header();
+ headerView->setSectionResizeMode(QHeaderView::ResizeToContents);
+ headerView->setSectionResizeMode(0, QHeaderView::Stretch);
}
-void ExportMrPackDialog::done(int result) {
+void ExportMrPackDialog::done(int result)
+{
if (result != Accepted) {
QDialog::done(result);
return;
}
QDialog::done(result);
-
}
ExportMrPackDialog::~ExportMrPackDialog()