Only select some paths by default - again!
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
5d5fcae501
commit
2cc9b0df06
@ -248,11 +248,6 @@ void FileIgnoreProxy::setBlockedPaths(QStringList paths)
|
|||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
const SeparatorPrefixTree<'/'>& FileIgnoreProxy::blockedPaths() const
|
|
||||||
{
|
|
||||||
return blocked;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FileIgnoreProxy::filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const
|
bool FileIgnoreProxy::filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(source_parent)
|
Q_UNUSED(source_parent)
|
||||||
|
@ -60,7 +60,8 @@ class FileIgnoreProxy : public QSortFilterProxyModel {
|
|||||||
|
|
||||||
void setBlockedPaths(QStringList paths);
|
void setBlockedPaths(QStringList paths);
|
||||||
|
|
||||||
const SeparatorPrefixTree<'/'>& blockedPaths() const;
|
inline const SeparatorPrefixTree<'/'>& blockedPaths() const { return blocked; }
|
||||||
|
inline SeparatorPrefixTree<'/'>& blockedPaths() { return blocked; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const;
|
bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const;
|
||||||
|
@ -39,11 +39,26 @@ ExportMrPackDialog::ExportMrPackDialog(InstancePtr instance, QWidget* parent)
|
|||||||
QString root = instance->gameRoot();
|
QString root = instance->gameRoot();
|
||||||
proxy = new FileIgnoreProxy(root, this);
|
proxy = new FileIgnoreProxy(root, this);
|
||||||
proxy->setSourceModel(model);
|
proxy->setSourceModel(model);
|
||||||
|
|
||||||
|
QDir::Filters filter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden);
|
||||||
|
|
||||||
|
for (QString file : QDir(root).entryList(filter)) {
|
||||||
|
if (!(file == "mods" || file == "coremods" || file == "datapacks" || file == "config" || file == "options.txt" ||
|
||||||
|
file == "servers.dat"))
|
||||||
|
proxy->blockedPaths().insert(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
QDir modsIndex(instance->gameRoot() + "/mods/.index");
|
||||||
|
if (modsIndex.exists())
|
||||||
|
proxy->blockedPaths().insert("mods/.index");
|
||||||
|
|
||||||
ui->treeView->setModel(proxy);
|
ui->treeView->setModel(proxy);
|
||||||
ui->treeView->setRootIndex(proxy->mapFromSource(model->index(root)));
|
ui->treeView->setRootIndex(proxy->mapFromSource(model->index(root)));
|
||||||
ui->treeView->sortByColumn(0, Qt::AscendingOrder);
|
ui->treeView->sortByColumn(0, Qt::AscendingOrder);
|
||||||
model->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden);
|
|
||||||
|
model->setFilter(filter);
|
||||||
model->setRootPath(root);
|
model->setRootPath(root);
|
||||||
|
|
||||||
auto headerView = ui->treeView->header();
|
auto headerView = ui->treeView->header();
|
||||||
headerView->setSectionResizeMode(QHeaderView::ResizeToContents);
|
headerView->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
headerView->setSectionResizeMode(0, QHeaderView::Stretch);
|
headerView->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||||
|
Loading…
Reference in New Issue
Block a user