fix: 'All' filter working and get around CF API capabilities
This commit is contained in:
@@ -9,7 +9,7 @@ FilterModsDialog::FilterModsDialog(Version def, QWidget* parent)
|
||||
m_mcVersion_buttons.addButton(ui->strictVersionButton, VersionButtonID::Strict);
|
||||
m_mcVersion_buttons.addButton(ui->majorVersionButton, VersionButtonID::Major);
|
||||
m_mcVersion_buttons.addButton(ui->allVersionsButton, VersionButtonID::All);
|
||||
m_mcVersion_buttons.addButton(ui->betweenVersionsButton, VersionButtonID::Between);
|
||||
//m_mcVersion_buttons.addButton(ui->betweenVersionsButton, VersionButtonID::Between);
|
||||
|
||||
connect(&m_mcVersion_buttons, SIGNAL(idClicked(int)), this, SLOT(onVersionFilterChanged(int)));
|
||||
|
||||
@@ -31,18 +31,38 @@ int FilterModsDialog::execWithInstance(MinecraftInstance* instance)
|
||||
tr("Major varsion match (= %1.%2.x)").arg(mcVersionSplit[0], mcVersionSplit[1]));
|
||||
ui->allVersionsButton->setText(
|
||||
tr("Any version match"));
|
||||
ui->betweenVersionsButton->setText(
|
||||
tr("Between two versions"));
|
||||
//ui->betweenVersionsButton->setText(
|
||||
// tr("Between two versions"));
|
||||
|
||||
int ret = QDialog::exec();
|
||||
m_instance = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FilterModsDialog::disableVersionButton(VersionButtonID id)
|
||||
{
|
||||
switch(id){
|
||||
case(VersionButtonID::Strict):
|
||||
ui->strictVersionButton->setEnabled(false);
|
||||
break;
|
||||
case(VersionButtonID::Major):
|
||||
ui->majorVersionButton->setEnabled(false);
|
||||
break;
|
||||
case(VersionButtonID::All):
|
||||
ui->allVersionsButton->setEnabled(false);
|
||||
break;
|
||||
case(VersionButtonID::Between):
|
||||
// ui->betweenVersionsButton->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FilterModsDialog::onVersionFilterChanged(int id)
|
||||
{
|
||||
ui->lowerVersionComboBox->setEnabled(id == VersionButtonID::Between);
|
||||
ui->upperVersionComboBox->setEnabled(id == VersionButtonID::Between);
|
||||
//ui->lowerVersionComboBox->setEnabled(id == VersionButtonID::Between);
|
||||
//ui->upperVersionComboBox->setEnabled(id == VersionButtonID::Between);
|
||||
|
||||
auto versionSplit = mcVersionStr().split(".");
|
||||
int index = 0;
|
||||
@@ -60,6 +80,7 @@ void FilterModsDialog::onVersionFilterChanged(int id)
|
||||
}
|
||||
break;
|
||||
case(VersionButtonID::All):
|
||||
// Empty list to avoid enumerating all versions :P
|
||||
break;
|
||||
case(VersionButtonID::Between):
|
||||
// TODO
|
||||
|
@@ -17,6 +17,13 @@ class FilterModsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum VersionButtonID {
|
||||
Strict = 0,
|
||||
Major = 1,
|
||||
All = 2,
|
||||
Between = 3
|
||||
};
|
||||
|
||||
struct Filter {
|
||||
std::list<Version> versions;
|
||||
};
|
||||
@@ -29,16 +36,12 @@ public:
|
||||
|
||||
int execWithInstance(MinecraftInstance* instance);
|
||||
|
||||
/// By default all buttons are enabled
|
||||
void disableVersionButton(VersionButtonID);
|
||||
|
||||
auto getFilter() -> std::shared_ptr<Filter> { return m_filter; }
|
||||
|
||||
private:
|
||||
enum VersionButtonID {
|
||||
Strict = 0,
|
||||
Major = 1,
|
||||
All = 2,
|
||||
Between = 3
|
||||
};
|
||||
|
||||
inline auto mcVersionStr() const -> QString { return m_instance ? m_instance->getPackProfile()->getComponentVersion("net.minecraft") : ""; }
|
||||
inline auto mcVersion() const -> Version { return { mcVersionStr() }; }
|
||||
|
||||
|
@@ -10,15 +10,17 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>345</width>
|
||||
<height>323</height>
|
||||
<height>169</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Copy Instance</string>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/toolbar/copy</normaloff>:/icons/toolbar/copy</iconset>
|
||||
<property name="windowTitle">
|
||||
<string>Filter options</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
@@ -78,59 +80,11 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="betweenVersionsButton">
|
||||
<property name="text">
|
||||
<string>BetweenVersions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="fromLabel">
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="lowerVersionComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="toLabel">
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="upperVersionComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
|
Reference in New Issue
Block a user