summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-05-04 13:20:42 +0200
committerPetr Mrázek <peterix@gmail.com>2014-05-04 13:20:42 +0200
commit0902fd5bec9c151ad9098714325e163829d5b662 (patch)
tree16fe856ec879fb28c1c34977596d38442518958b
parentde48f102bd9fbb57594d2dca3edd093edd75cc13 (diff)
downloadMultiMC-0902fd5bec9c151ad9098714325e163829d5b662.tar
MultiMC-0902fd5bec9c151ad9098714325e163829d5b662.tar.gz
MultiMC-0902fd5bec9c151ad9098714325e163829d5b662.tar.lz
MultiMC-0902fd5bec9c151ad9098714325e163829d5b662.tar.xz
MultiMC-0902fd5bec9c151ad9098714325e163829d5b662.zip
Fix version select dialog filtering
-rw-r--r--gui/MainWindow.cpp2
-rw-r--r--gui/dialogs/LegacyModEditDialog.cpp2
-rw-r--r--gui/dialogs/OneSixModEditDialog.cpp4
-rw-r--r--gui/dialogs/VersionSelectDialog.cpp21
-rw-r--r--gui/dialogs/VersionSelectDialog.h3
5 files changed, 13 insertions, 19 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index b0e86249..58491a7e 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -1433,7 +1433,7 @@ void MainWindow::on_actionChangeInstMCVersion_triggered()
VersionSelectDialog vselect(m_selectedInstance->versionList().get(),
tr("Change Minecraft version"), this);
- vselect.setFilter(1, "OneSix");
+ vselect.setFuzzyFilter(1, "*OneSix*");
if (!vselect.exec() || !vselect.selectedVersion())
return;
diff --git a/gui/dialogs/LegacyModEditDialog.cpp b/gui/dialogs/LegacyModEditDialog.cpp
index 66d53ee1..e5039c02 100644
--- a/gui/dialogs/LegacyModEditDialog.cpp
+++ b/gui/dialogs/LegacyModEditDialog.cpp
@@ -208,7 +208,7 @@ void LegacyModEditDialog::on_addCoreBtn_clicked()
void LegacyModEditDialog::on_addForgeBtn_clicked()
{
VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this);
- vselect.setFilter(1, m_inst->intendedVersionId());
+ vselect.setExactFilter(1, m_inst->intendedVersionId());
if (vselect.exec() && vselect.selectedVersion())
{
ForgeVersionPtr forge =
diff --git a/gui/dialogs/OneSixModEditDialog.cpp b/gui/dialogs/OneSixModEditDialog.cpp
index d7791d71..a3598eb9 100644
--- a/gui/dialogs/OneSixModEditDialog.cpp
+++ b/gui/dialogs/OneSixModEditDialog.cpp
@@ -222,7 +222,7 @@ void OneSixModEditDialog::on_forgeBtn_clicked()
reloadInstanceVersion();
}
VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this);
- vselect.setFilter(1, m_inst->currentVersionId());
+ vselect.setExactFilter(1, m_inst->currentVersionId());
vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") +
m_inst->currentVersionId());
if (vselect.exec() && vselect.selectedVersion())
@@ -258,7 +258,7 @@ void OneSixModEditDialog::on_liteloaderBtn_clicked()
}
VersionSelectDialog vselect(MMC->liteloaderlist().get(), tr("Select LiteLoader version"),
this);
- vselect.setFilter(1, m_inst->currentVersionId());
+ vselect.setExactFilter(1, m_inst->currentVersionId());
vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") +
m_inst->currentVersionId());
if (vselect.exec() && vselect.selectedVersion())
diff --git a/gui/dialogs/VersionSelectDialog.cpp b/gui/dialogs/VersionSelectDialog.cpp
index f4d314b6..cae5a732 100644
--- a/gui/dialogs/VersionSelectDialog.cpp
+++ b/gui/dialogs/VersionSelectDialog.cpp
@@ -97,23 +97,16 @@ void VersionSelectDialog::on_refreshButton_clicked()
loadList();
}
-void VersionSelectDialog::setFilter(int column, QString filter)
+void VersionSelectDialog::setExactFilter(int column, QString filter)
{
m_proxyModel->setFilterKeyColumn(column);
// m_proxyModel->setFilterFixedString(filter);
m_proxyModel->setFilterRegExp(QRegExp(QString("^%1$").arg(filter.replace(".", "\\.")),
Qt::CaseInsensitive, QRegExp::RegExp));
- /*
- QStringList filteredTypes;
- if (!ui->filterSnapshotsCheckbox->isChecked())
- filteredTypes += "Snapshot";
- if (!ui->filterMCNostalgiaCheckbox->isChecked())
- filteredTypes += "Nostalgia";
-
- QString regexStr = "^.*$";
- if (filteredTypes.length() > 0)
- regexStr = QString("^((?!%1).)*$").arg(filteredTypes.join('|'));
-
- QLOG_DEBUG() << "Filter:" << regexStr;
- */
+}
+
+void VersionSelectDialog::setFuzzyFilter(int column, QString filter)
+{
+ m_proxyModel->setFilterKeyColumn(column);
+ m_proxyModel->setFilterWildcard(filter);
}
diff --git a/gui/dialogs/VersionSelectDialog.h b/gui/dialogs/VersionSelectDialog.h
index 61fa8ab6..34df4d23 100644
--- a/gui/dialogs/VersionSelectDialog.h
+++ b/gui/dialogs/VersionSelectDialog.h
@@ -43,7 +43,8 @@ public:
BaseVersionPtr selectedVersion() const;
- void setFilter(int column, QString filter);
+ void setFuzzyFilter(int column, QString filter);
+ void setExactFilter(int column, QString filter);
void setEmptyString(QString emptyString);
void setResizeOn(int column);