Only select some paths by default - again!
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
		@@ -248,11 +248,6 @@ void FileIgnoreProxy::setBlockedPaths(QStringList paths)
 | 
			
		||||
    endResetModel();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const SeparatorPrefixTree<'/'>& FileIgnoreProxy::blockedPaths() const
 | 
			
		||||
{
 | 
			
		||||
    return blocked;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool FileIgnoreProxy::filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const
 | 
			
		||||
{
 | 
			
		||||
    Q_UNUSED(source_parent)
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,8 @@ class FileIgnoreProxy : public QSortFilterProxyModel {
 | 
			
		||||
 | 
			
		||||
    void setBlockedPaths(QStringList paths);
 | 
			
		||||
 | 
			
		||||
    const SeparatorPrefixTree<'/'>& blockedPaths() const;
 | 
			
		||||
    inline const SeparatorPrefixTree<'/'>& blockedPaths() const { return blocked; }
 | 
			
		||||
    inline SeparatorPrefixTree<'/'>& blockedPaths() { return blocked; }
 | 
			
		||||
 | 
			
		||||
   protected:
 | 
			
		||||
    bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const;
 | 
			
		||||
 
 | 
			
		||||
@@ -39,11 +39,26 @@ ExportMrPackDialog::ExportMrPackDialog(InstancePtr instance, QWidget* parent)
 | 
			
		||||
    QString root = instance->gameRoot();
 | 
			
		||||
    proxy = new FileIgnoreProxy(root, this);
 | 
			
		||||
    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->setRootIndex(proxy->mapFromSource(model->index(root)));
 | 
			
		||||
    ui->treeView->sortByColumn(0, Qt::AscendingOrder);
 | 
			
		||||
    model->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden);
 | 
			
		||||
 | 
			
		||||
    model->setFilter(filter);
 | 
			
		||||
    model->setRootPath(root);
 | 
			
		||||
 | 
			
		||||
    auto headerView = ui->treeView->header();
 | 
			
		||||
    headerView->setSectionResizeMode(QHeaderView::ResizeToContents);
 | 
			
		||||
    headerView->setSectionResizeMode(0, QHeaderView::Stretch);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user