@ -57,7 +57,7 @@ ExportInstanceDialog::ExportInstanceDialog(InstancePtr instance, QWidget *parent
|
||||
ui->setupUi(this);
|
||||
auto model = new QFileSystemModel(this);
|
||||
auto root = instance->instanceRoot();
|
||||
proxyModel = new PackIgnoreProxy(root, this);
|
||||
proxyModel = new FileIgnoreProxy(root, this);
|
||||
loadPackIgnore();
|
||||
proxyModel->setSourceModel(model);
|
||||
ui->treeView->setModel(proxyModel);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <QDialog>
|
||||
#include <QModelIndex>
|
||||
#include <memory>
|
||||
#include "PackIgnoreProxy.h"
|
||||
#include "FileIgnoreProxy.h"
|
||||
|
||||
class BaseInstance;
|
||||
typedef std::shared_ptr<BaseInstance> InstancePtr;
|
||||
@ -47,7 +47,7 @@ private:
|
||||
private:
|
||||
Ui::ExportInstanceDialog *ui;
|
||||
InstancePtr m_instance;
|
||||
PackIgnoreProxy * proxyModel;
|
||||
FileIgnoreProxy * proxyModel;
|
||||
|
||||
private slots:
|
||||
void rowsInserted(QModelIndex parent, int top, int bottom);
|
||||
|
@ -37,7 +37,7 @@ ExportMrPackDialog::ExportMrPackDialog(InstancePtr instance, QWidget* parent)
|
||||
auto model = new QFileSystemModel(this);
|
||||
// use the game root - everything outside cannot be exported
|
||||
QString root = instance->gameRoot();
|
||||
proxy = new PackIgnoreProxy(root, this);
|
||||
proxy = new FileIgnoreProxy(root, this);
|
||||
proxy->setSourceModel(model);
|
||||
ui->treeView->setModel(proxy);
|
||||
ui->treeView->setRootIndex(proxy->mapFromSource(model->index(root)));
|
||||
@ -58,16 +58,15 @@ void ExportMrPackDialog::done(int result)
|
||||
{
|
||||
if (result == Accepted) {
|
||||
const QString filename = FS::RemoveInvalidFilenameChars(ui->name->text());
|
||||
const QString output =
|
||||
QFileDialog::getSaveFileName(this, tr("Export %1").arg(ui->name->text()), FS::PathCombine(QDir::homePath(), filename + ".mrpack"),
|
||||
"Modrinth pack (*.mrpack *.zip)", nullptr);
|
||||
const QString output = QFileDialog::getSaveFileName(this, tr("Export %1").arg(ui->name->text()),
|
||||
FS::PathCombine(QDir::homePath(), filename + ".mrpack"),
|
||||
"Modrinth pack (*.mrpack *.zip)", nullptr);
|
||||
|
||||
if (output.isEmpty())
|
||||
return;
|
||||
|
||||
ModrinthPackExportTask task(ui->name->text(), ui->version->text(), ui->summary->text(), instance, output,
|
||||
[this](const QString& path) { return proxy->blockedPaths().covers(path); });
|
||||
|
||||
ProgressDialog progress(this);
|
||||
progress.setSkipButton(true, tr("Abort"));
|
||||
if (progress.execWithTask(&task) != QDialog::Accepted)
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include "BaseInstance.h"
|
||||
#include "PackIgnoreProxy.h"
|
||||
#include "FileIgnoreProxy.h"
|
||||
|
||||
namespace Ui {
|
||||
class ExportMrPackDialog;
|
||||
@ -38,5 +38,5 @@ class ExportMrPackDialog : public QDialog {
|
||||
private:
|
||||
const InstancePtr instance;
|
||||
Ui::ExportMrPackDialog* ui;
|
||||
PackIgnoreProxy* proxy;
|
||||
FileIgnoreProxy* proxy;
|
||||
};
|
||||
|
Reference in New Issue
Block a user