Fix version select dialog filtering
This commit is contained in:
parent
de48f102bd
commit
0902fd5bec
@ -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;
|
||||
|
||||
|
@ -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 =
|
||||
|
@ -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())
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user