diff options
Diffstat (limited to 'launcher')
22 files changed, 437 insertions, 129 deletions
diff --git a/launcher/InstanceCreationTask.cpp b/launcher/InstanceCreationTask.cpp index 4c37bd7f..24bc5f46 100644 --- a/launcher/InstanceCreationTask.cpp +++ b/launcher/InstanceCreationTask.cpp @@ -9,6 +9,15 @@ InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version) { m_version = version; + m_usingLoader = false; +} + +InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version, QString loader, BaseVersionPtr loaderVersion) +{ + m_version = version; + m_usingLoader = true; + m_loader = loader; + m_loaderVersion = loaderVersion; } void InstanceCreationTask::executeTask() @@ -21,6 +30,8 @@ void InstanceCreationTask::executeTask() auto components = inst.getPackProfile(); components->buildingFromScratch(); components->setComponentVersion("net.minecraft", m_version->descriptor(), true); + if(m_usingLoader) + components->setComponentVersion(m_loader, m_loaderVersion->descriptor(), true); inst.setName(m_instName); inst.setIconKey(m_instIcon); instanceSettings->resumeSave(); diff --git a/launcher/InstanceCreationTask.h b/launcher/InstanceCreationTask.h index 54997116..23367c3f 100644 --- a/launcher/InstanceCreationTask.h +++ b/launcher/InstanceCreationTask.h @@ -12,6 +12,7 @@ class InstanceCreationTask : public InstanceTask Q_OBJECT public: explicit InstanceCreationTask(BaseVersionPtr version); + explicit InstanceCreationTask(BaseVersionPtr version, QString loader, BaseVersionPtr loaderVersion); protected: //! Entry point for tasks. @@ -19,4 +20,7 @@ protected: private: /* data */ BaseVersionPtr m_version; + bool m_usingLoader; + QString m_loader; + BaseVersionPtr m_loaderVersion; }; diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp index 03e942f1..1a13c997 100644 --- a/launcher/InstanceImportTask.cpp +++ b/launcher/InstanceImportTask.cpp @@ -249,6 +249,7 @@ void InstanceImportTask::processFlame() QString forgeVersion; QString fabricVersion; + // TODO: is Quilt relevant here? for(auto &loader: pack.minecraft.modLoaders) { auto id = loader.id; diff --git a/launcher/minecraft/ComponentUpdateTask.cpp b/launcher/minecraft/ComponentUpdateTask.cpp index 8bc05a1b..ff7ed0af 100644 --- a/launcher/minecraft/ComponentUpdateTask.cpp +++ b/launcher/minecraft/ComponentUpdateTask.cpp @@ -591,7 +591,7 @@ void ComponentUpdateTask::resolveDependencies(bool checkOnly) { component->m_version = "3.1.2"; } - else if (add.uid == "net.fabricmc.intermediary") + else if (add.uid == "net.fabricmc.intermediary" || add.uid == "org.quiltmc.hashed") { auto minecraft = std::find_if(components.begin(), components.end(), [](ComponentPtr & cmp){ return cmp->getID() == "net.minecraft"; diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp index d516e555..d53f41e1 100644 --- a/launcher/minecraft/PackProfile.cpp +++ b/launcher/minecraft/PackProfile.cpp @@ -970,3 +970,20 @@ void PackProfile::disableInteraction(bool disable) } } } + +ModAPI::ModLoaderType PackProfile::getModLoader() +{ + if (!getComponentVersion("net.minecraftforge").isEmpty()) + { + return ModAPI::Forge; + } + else if (!getComponentVersion("net.fabricmc.fabric-loader").isEmpty()) + { + return ModAPI::Fabric; + } + else if (!getComponentVersion("org.quiltmc.quilt-loader").isEmpty()) + { + return ModAPI::Quilt; + } + return ModAPI::Unspecified; +} diff --git a/launcher/minecraft/PackProfile.h b/launcher/minecraft/PackProfile.h index 989d1c6a..ab4cd5c8 100644 --- a/launcher/minecraft/PackProfile.h +++ b/launcher/minecraft/PackProfile.h @@ -28,6 +28,7 @@ #include "BaseVersion.h" #include "MojangDownloadInfo.h" #include "net/Mode.h" +#include "modplatform/ModAPI.h" class MinecraftInstance; struct PackProfileData; @@ -117,6 +118,8 @@ public: // todo(merged): is this the best approach void appendComponent(ComponentPtr component); + ModAPI::ModLoaderType getModLoader(); + private: void scheduleSave(); bool saveIsScheduled() const; diff --git a/launcher/minecraft/mod/LocalModParseTask.cpp b/launcher/minecraft/mod/LocalModParseTask.cpp index 757a2187..f01da8ae 100644 --- a/launcher/minecraft/mod/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/LocalModParseTask.cpp @@ -391,7 +391,7 @@ void LocalModParseTask::processAsZip() zip.close(); return; } - else if (zip.setCurrentFile("fabric.mod.json")) + else if (zip.setCurrentFile("fabric.mod.json")) // TODO: Support quilt.mod.json { if (!file.open(QIODevice::ReadOnly)) { diff --git a/launcher/modplatform/ModAPI.h b/launcher/modplatform/ModAPI.h index ae6ac80f..1a562172 100644 --- a/launcher/modplatform/ModAPI.h +++ b/launcher/modplatform/ModAPI.h @@ -15,7 +15,7 @@ class ModAPI { virtual ~ModAPI() = default; // https://docs.curseforge.com/?http#tocS_ModLoaderType - enum ModLoaderType { Any = 0, Forge = 1, Cauldron = 2, LiteLoader = 3, Fabric = 4 }; + enum ModLoaderType { Unspecified = 0, Forge = 1, Cauldron = 2, LiteLoader = 3, Fabric = 4, Quilt = 5 }; struct SearchArgs { int offset; @@ -35,4 +35,22 @@ class ModAPI { }; virtual void getVersions(CallerType* caller, VersionSearchArgs&& args) const = 0; + + static auto getModLoaderString(ModLoaderType type) -> const QString { + switch (type) { + case Unspecified: + break; + case Forge: + return "forge"; + case Cauldron: + return "cauldron"; + case LiteLoader: + return "liteloader"; + case Fabric: + return "fabric"; + case Quilt: + return "quilt"; + } + return ""; + } }; diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp index 2c3adee4..e86b64dd 100644 --- a/launcher/modplatform/flame/FlameModIndex.cpp +++ b/launcher/modplatform/flame/FlameModIndex.cpp @@ -69,6 +69,7 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, for (auto m : modules) { auto fname = Json::requireString(m.toObject(), "foldername"); // FIXME: This does not work properly when a mod supports more than one mod loader, since + // FIXME: This also doesn't deal with Quilt mods at the moment // they bundle the meta files for all of them in the same arquive, even when that version // doesn't support the given mod loader. if (hasFabric) { diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 30952e99..eefa4a85 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -51,23 +51,16 @@ class ModrinthAPI : public NetworkModAPI { return s; } - inline auto getModLoaderString(ModLoaderType modLoader) const -> QString + static auto getModLoaderString(ModLoaderType type) -> const QString { - switch (modLoader) { - case Any: - return "fabric, forge"; - case Forge: - return "forge"; - case Fabric: - return "fabric"; - default: - return ""; - } + if (type == Unspecified) + return "fabric, forge, quilt"; + return ModAPI::getModLoaderString(type); } inline auto validateModLoader(ModLoaderType modLoader) const -> bool { - return modLoader == Any || modLoader == Forge || modLoader == Fabric; + return modLoader == Unspecified || modLoader == Forge || modLoader == Fabric || modLoader == Quilt; } }; diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp index fcb6022d..8113fe85 100644 --- a/launcher/ui/pages/instance/ModFolderPage.cpp +++ b/launcher/ui/pages/instance/ModFolderPage.cpp @@ -56,6 +56,8 @@ #include "minecraft/VersionFilterData.h" #include "minecraft/PackProfile.h" +#include "modplatform/ModAPI.h" + #include "Version.h" #include "ui/dialogs/ProgressDialog.h" #include "tasks/SequentialTask.h" @@ -388,9 +390,8 @@ void ModFolderPage::on_actionInstall_mods_triggered() if(m_inst->typeName() != "Minecraft"){ return; //this is a null instance or a legacy instance } - bool hasFabric = !((MinecraftInstance *)m_inst)->getPackProfile()->getComponentVersion("net.fabricmc.fabric-loader").isEmpty(); - bool hasForge = !((MinecraftInstance *)m_inst)->getPackProfile()->getComponentVersion("net.minecraftforge").isEmpty(); - if (!hasFabric && !hasForge) { + auto profile = ((MinecraftInstance *)m_inst)->getPackProfile(); + if (profile->getModLoader() == ModAPI::Unspecified) { QMessageBox::critical(this,tr("Error"),tr("Please install a mod loader first!")); return; } diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp index ed37dd1a..23e2367b 100644 --- a/launcher/ui/pages/instance/VersionPage.cpp +++ b/launcher/ui/pages/instance/VersionPage.cpp @@ -243,6 +243,9 @@ void VersionPage::updateVersionControls() bool supportsFabric = minecraftVersion >= Version("1.14"); ui->actionInstall_Fabric->setEnabled(controlsEnabled && supportsFabric); + bool supportsQuilt = minecraftVersion >= Version("1.14"); + ui->actionInstall_Quilt->setEnabled(controlsEnabled && supportsQuilt); + bool supportsLiteLoader = minecraftVersion <= Version("1.12.2"); ui->actionInstall_LiteLoader->setEnabled(controlsEnabled && supportsLiteLoader); @@ -392,7 +395,7 @@ void VersionPage::on_actionChange_version_triggered() return; } VersionSelectDialog vselect(list.get(), tr("Change %1 version").arg(name), this); - if (uid == "net.fabricmc.intermediary") + if (uid == "net.fabricmc.intermediary" || uid == "org.quiltmc.hashed") { vselect.setEmptyString(tr("No intermediary mappings versions are currently available.")); vselect.setEmptyErrorString(tr("Couldn't load or download the intermediary mappings version lists!")); @@ -498,6 +501,33 @@ void VersionPage::on_actionInstall_Fabric_triggered() } } +void VersionPage::on_actionInstall_Quilt_triggered() +{ + auto vlist = APPLICATION->metadataIndex()->get("org.quiltmc.quilt-loader"); + if(!vlist) + { + return; + } + VersionSelectDialog vselect(vlist.get(), tr("Select Quilt Loader version"), this); + vselect.setEmptyString(tr("No Quilt Loader versions are currently available.")); + vselect.setEmptyErrorString(tr("Couldn't load or download the Quilt Loader version lists!")); + + auto currentVersion = m_profile->getComponentVersion("org.quiltmc.quilt-loader"); + if(!currentVersion.isEmpty()) + { + vselect.setCurrentVersion(currentVersion); + } + + if (vselect.exec() && vselect.selectedVersion()) + { + auto vsn = vselect.selectedVersion(); + m_profile->setComponentVersion("org.quiltmc.quilt-loader", vsn->descriptor()); + m_profile->resolve(Net::Mode::Online); + preselect(m_profile->rowCount(QModelIndex())-1); + m_container->refreshContainer(); + } +} + void VersionPage::on_actionAdd_Empty_triggered() { NewComponentDialog compdialog(QString(), QString(), this); diff --git a/launcher/ui/pages/instance/VersionPage.h b/launcher/ui/pages/instance/VersionPage.h index 2d37af43..979311fc 100644 --- a/launcher/ui/pages/instance/VersionPage.h +++ b/launcher/ui/pages/instance/VersionPage.h @@ -73,6 +73,7 @@ private slots: void on_actionChange_version_triggered(); void on_actionInstall_Forge_triggered(); void on_actionInstall_Fabric_triggered(); + void on_actionInstall_Quilt_triggered(); void on_actionAdd_Empty_triggered(); void on_actionInstall_LiteLoader_triggered(); void on_actionReload_triggered(); diff --git a/launcher/ui/pages/instance/VersionPage.ui b/launcher/ui/pages/instance/VersionPage.ui index a4990ff3..489f7218 100644 --- a/launcher/ui/pages/instance/VersionPage.ui +++ b/launcher/ui/pages/instance/VersionPage.ui @@ -107,6 +107,7 @@ <addaction name="separator"/> <addaction name="actionInstall_Forge"/> <addaction name="actionInstall_Fabric"/> + <addaction name="actionInstall_Quilt"/> <addaction name="actionInstall_LiteLoader"/> <addaction name="actionInstall_mods"/> <addaction name="separator"/> @@ -192,6 +193,14 @@ <string>Install the Fabric Loader package.</string> </property> </action> + <action name="actionInstall_Quilt"> + <property name="text"> + <string>Install Quilt</string> + </property> + <property name="toolTip"> + <string>Install the Quilt Loader package.</string> + </property> + </action> <action name="actionInstall_LiteLoader"> <property name="text"> <string>Install LiteLoader</string> diff --git a/launcher/ui/pages/modplatform/ModModel.cpp b/launcher/ui/pages/modplatform/ModModel.cpp index 01b5d247..f75d2847 100644 --- a/launcher/ui/pages/modplatform/ModModel.cpp +++ b/launcher/ui/pages/modplatform/ModModel.cpp @@ -61,14 +61,18 @@ auto ListModel::data(const QModelIndex& index, int role) const -> QVariant void ListModel::requestModVersions(ModPlatform::IndexedPack const& current) { + auto profile = (dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))->getPackProfile(); + m_parent->apiProvider()->getVersions(this, - { current.addonId.toString(), getMineVersions(), hasFabric() ? ModAPI::ModLoaderType::Fabric : ModAPI::ModLoaderType::Forge }); + { current.addonId.toString(), getMineVersions(), profile->getModLoader() }); } void ListModel::performPaginatedSearch() { + auto profile = (dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance))->getPackProfile(); + m_parent->apiProvider()->searchMods(this, - { nextSearchOffset, currentSearchTerm, getSorts()[currentSort], hasFabric() ? ModAPI::Fabric : ModAPI::Forge, getMineVersions().at(0) }); + { nextSearchOffset, currentSearchTerm, getSorts()[currentSort], profile->getModLoader(), getMineVersions().at(0) }); } void ListModel::searchWithTerm(const QString& term, const int sort) @@ -218,13 +222,6 @@ void ListModel::versionRequestSucceeded(QJsonDocument doc, QString addonId) } // namespace ModPlatform /******** Helpers ********/ -auto ModPlatform::ListModel::hasFabric() const -> bool -{ - return !(dynamic_cast<MinecraftInstance*>((dynamic_cast<ModPage*>(parent()))->m_instance)) - ->getPackProfile() - ->getComponentVersion("net.fabricmc.fabric-loader") - .isEmpty(); -} auto ModPlatform::ListModel::getMineVersions() const -> QList<QString> { diff --git a/launcher/ui/pages/modplatform/ModModel.h b/launcher/ui/pages/modplatform/ModModel.h index 64cfa71e..dbadbeee 100644 --- a/launcher/ui/pages/modplatform/ModModel.h +++ b/launcher/ui/pages/modplatform/ModModel.h @@ -62,7 +62,6 @@ class ListModel : public QAbstractListModel { void requestLogo(QString file, QString url); - inline auto hasFabric() const -> bool; inline auto getMineVersions() const -> QList<QString>; protected: diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index 3a116d3c..eabd8379 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -68,7 +68,7 @@ void ModPage::onSelectionChanged(QModelIndex first, QModelIndex second) text = name; else text = "<a href=\"" + current.websiteUrl + "\">" + name + "</a>"; - + if (!current.authors.empty()) { auto authorToStr = [](ModPlatform::ModpackAuthor& author) -> QString { if (author.url.isEmpty()) { return author.name; } @@ -128,7 +128,7 @@ void ModPage::onModSelected() void ModPage::retranslate() { - ui->retranslateUi(this); + ui->retranslateUi(this); } void ModPage::updateModVersions() @@ -136,13 +136,14 @@ void ModPage::updateModVersions() auto packProfile = (dynamic_cast<MinecraftInstance*>(m_instance))->getPackProfile(); QString mcVersion = packProfile->getComponentVersion("net.minecraft"); - QString loaderString = (packProfile->getComponentVersion("net.minecraftforge").isEmpty()) ? "fabric" : "forge"; + + QString loaderString = ModAPI::getModLoaderString(packProfile->getModLoader()); for (int i = 0; i < current.versions.size(); i++) { auto version = current.versions[i]; //NOTE: Flame doesn't care about loaderString, so passing it changes nothing. - if (!validateVersion(version, mcVersion, loaderString)) { - continue; + if (!validateVersion(version, mcVersion, loaderString)) { + continue; } ui->versionSelectionBox->addItem(version.version, QVariant(i)); } diff --git a/launcher/ui/pages/modplatform/VanillaPage.cpp b/launcher/ui/pages/modplatform/VanillaPage.cpp index c691128f..207d0130 100644 --- a/launcher/ui/pages/modplatform/VanillaPage.cpp +++ b/launcher/ui/pages/modplatform/VanillaPage.cpp @@ -44,6 +44,7 @@ #include "ui/dialogs/NewInstanceDialog.h" #include "Filter.h" #include "InstanceCreationTask.h" +#include "Version.h" VanillaPage::VanillaPage(NewInstanceDialog *dialog, QWidget *parent) : QWidget(parent), dialog(dialog), ui(new Ui::VanillaPage) @@ -59,6 +60,15 @@ VanillaPage::VanillaPage(NewInstanceDialog *dialog, QWidget *parent) connect(ui->releaseFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged); connect(ui->experimentsFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged); connect(ui->refreshBtn, &QPushButton::clicked, this, &VanillaPage::refresh); + + connect(ui->loaderVersionList, &VersionSelectWidget::selectedVersionChanged, this, &VanillaPage::setSelectedLoaderVersion); + connect(ui->noneFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged); + connect(ui->forgeFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged); + connect(ui->fabricFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged); + connect(ui->quiltFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged); + connect(ui->liteLoaderFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged); + connect(ui->loaderRefreshBtn, &QPushButton::clicked, this, &VanillaPage::loaderRefresh); + } void VanillaPage::openedImpl() @@ -80,6 +90,13 @@ void VanillaPage::refresh() ui->versionList->loadList(); } +void VanillaPage::loaderRefresh() +{ + if(ui->noneFilter->isChecked()) + return; + ui->loaderVersionList->loadList(); +} + void VanillaPage::filterChanged() { QStringList out; @@ -99,6 +116,52 @@ void VanillaPage::filterChanged() ui->versionList->setFilter(BaseVersionList::TypeRole, new RegexpFilter(regexp, false)); } +void VanillaPage::loaderFilterChanged() +{ + auto minecraftVersion = m_selectedVersion->descriptor(); + if(ui->noneFilter->isChecked()) + { + ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // empty list + ui->loaderVersionList->setEmptyString(tr("No mod loader is selected.")); + ui->loaderVersionList->setEmptyMode(VersionListView::String); + return; + } + else if(ui->forgeFilter->isChecked()) + { + ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, minecraftVersion); + m_selectedLoader = "net.minecraftforge"; + } + else if(ui->fabricFilter->isChecked()) + { + // FIXME: dirty hack because the launcher is unaware of Fabric's dependencies + if (Version(minecraftVersion) >= Version("1.14")) // Fabric/Quilt supported + ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, ""); + else // Fabric/Quilt unsupported + ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // clear list + m_selectedLoader = "net.fabricmc.fabric-loader"; + } + else if(ui->quiltFilter->isChecked()) + { + // FIXME: dirty hack because the launcher is unaware of Quilt's dependencies (same as Fabric) + if (Version(minecraftVersion) >= Version("1.14")) // Fabric/Quilt supported + ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, ""); + else // Fabric/Quilt unsupported + ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, "AAA"); // clear list + m_selectedLoader = "org.quiltmc.quilt-loader"; + } + else if(ui->liteLoaderFilter->isChecked()) + { + ui->loaderVersionList->setExactFilter(BaseVersionList::ParentVersionRole, minecraftVersion); + m_selectedLoader = "com.mumfrey.liteloader"; + } + + auto vlist = APPLICATION->metadataIndex()->get(m_selectedLoader); + ui->loaderVersionList->initialize(vlist.get()); + ui->loaderVersionList->selectRecommended(); + suggestCurrent(); + ui->loaderVersionList->setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion)); +} + VanillaPage::~VanillaPage() { delete ui; @@ -119,6 +182,16 @@ BaseVersionPtr VanillaPage::selectedVersion() const return m_selectedVersion; } +BaseVersionPtr VanillaPage::selectedLoaderVersion() const +{ + return m_selectedLoaderVersion; +} + +QString VanillaPage::selectedLoader() const +{ + return m_selectedLoader; +} + void VanillaPage::suggestCurrent() { if (!isOpened) @@ -132,7 +205,15 @@ void VanillaPage::suggestCurrent() return; } - dialog->setSuggestedPack(m_selectedVersion->descriptor(), new InstanceCreationTask(m_selectedVersion)); + // List is empty if either no mod loader is selected, or no versions are available + if(!ui->loaderVersionList->hasVersions()) + dialog->setSuggestedPack(m_selectedVersion->descriptor(), new InstanceCreationTask(m_selectedVersion)); + else + { + dialog->setSuggestedPack(m_selectedVersion->descriptor(), + new InstanceCreationTask(m_selectedVersion, m_selectedLoader, + m_selectedLoaderVersion)); + } dialog->setSuggestedIcon("default"); } @@ -140,4 +221,11 @@ void VanillaPage::setSelectedVersion(BaseVersionPtr version) { m_selectedVersion = version; suggestCurrent(); + loaderFilterChanged(); +} + +void VanillaPage::setSelectedLoaderVersion(BaseVersionPtr version) +{ + m_selectedLoaderVersion = version; + suggestCurrent(); } diff --git a/launcher/ui/pages/modplatform/VanillaPage.h b/launcher/ui/pages/modplatform/VanillaPage.h index 4e7479df..7193597d 100644 --- a/launcher/ui/pages/modplatform/VanillaPage.h +++ b/launcher/ui/pages/modplatform/VanillaPage.h @@ -77,15 +77,20 @@ public: void openedImpl() override; BaseVersionPtr selectedVersion() const; + BaseVersionPtr selectedLoaderVersion() const; + QString selectedLoader() const; public slots: void setSelectedVersion(BaseVersionPtr version); + void setSelectedLoaderVersion(BaseVersionPtr version); private slots: void filterChanged(); + void loaderFilterChanged(); private: void refresh(); + void loaderRefresh(); void suggestCurrent(); private: @@ -94,4 +99,6 @@ private: Ui::VanillaPage *ui = nullptr; bool m_versionSetByUser = false; BaseVersionPtr m_selectedVersion; + BaseVersionPtr m_selectedLoaderVersion; + QString m_selectedLoader; }; diff --git a/launcher/ui/pages/modplatform/VanillaPage.ui b/launcher/ui/pages/modplatform/VanillaPage.ui index 870ff161..43110927 100644 --- a/launcher/ui/pages/modplatform/VanillaPage.ui +++ b/launcher/ui/pages/modplatform/VanillaPage.ui @@ -33,113 +33,231 @@ <string notr="true"/> </attribute> <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="1"> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Filter</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="releaseFilter"> - <property name="text"> - <string>Releases</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="snapshotFilter"> - <property name="text"> - <string>Snapshots</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="oldSnapshotFilter"> - <property name="text"> - <string>Old Snapshots</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> + <item row="2" column="0"> + <widget class="Line" name="line"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="minecraftLayout"> <item> - <widget class="QCheckBox" name="betaFilter"> - <property name="text"> - <string>Betas</string> - </property> - <property name="checkable"> - <bool>true</bool> + <widget class="VersionSelectWidget" name="versionList" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> </widget> </item> <item> - <widget class="QCheckBox" name="alphaFilter"> - <property name="text"> - <string>Alphas</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Filter</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="releaseFilter"> + <property name="text"> + <string>Releases</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="snapshotFilter"> + <property name="text"> + <string>Snapshots</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="oldSnapshotFilter"> + <property name="text"> + <string>Old Snapshots</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="betaFilter"> + <property name="text"> + <string>Betas</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="alphaFilter"> + <property name="text"> + <string>Alphas</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="experimentsFilter"> + <property name="text"> + <string>Experiments</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </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="QPushButton" name="refreshBtn"> + <property name="text"> + <string>Refresh</string> + </property> + </widget> + </item> + </layout> </item> + </layout> + </item> + <item row="4" column="0"> + <layout class="QHBoxLayout" name="loaderLayout"> <item> - <widget class="QCheckBox" name="experimentsFilter"> - <property name="text"> - <string>Experiments</string> - </property> - <property name="checkable"> - <bool>true</bool> + <widget class="VersionSelectWidget" name="loaderVersionList" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> </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="QPushButton" name="refreshBtn"> - <property name="text"> - <string>Refresh</string> - </property> - </widget> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QLabel" name="loaderLabel"> + <property name="text"> + <string>Mod Loader</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="noneFilter"> + <property name="text"> + <string>None</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <attribute name="buttonGroup"> + <string notr="true">loaderBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QRadioButton" name="forgeFilter"> + <property name="text"> + <string>Forge</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">loaderBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QRadioButton" name="fabricFilter"> + <property name="text"> + <string>Fabric</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">loaderBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QRadioButton" name="quiltFilter"> + <property name="text"> + <string>Quilt</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">loaderBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QRadioButton" name="liteLoaderFilter"> + <property name="text"> + <string>LiteLoader</string> + </property> + <attribute name="buttonGroup"> + <string notr="true">loaderBtnGroup</string> + </attribute> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2"> + <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="QPushButton" name="loaderRefreshBtn"> + <property name="text"> + <string>Refresh</string> + </property> + </widget> + </item> + </layout> </item> </layout> </item> - <item row="0" column="0"> - <widget class="VersionSelectWidget" name="versionList" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> </layout> </widget> </widget> @@ -166,4 +284,7 @@ </tabstops> <resources/> <connections/> + <buttongroups> + <buttongroup name="loaderBtnGroup"/> + </buttongroups> </ui> diff --git a/launcher/ui/widgets/VersionSelectWidget.cpp b/launcher/ui/widgets/VersionSelectWidget.cpp index 1209f118..cc4fc6a2 100644 --- a/launcher/ui/widgets/VersionSelectWidget.cpp +++ b/launcher/ui/widgets/VersionSelectWidget.cpp @@ -4,7 +4,6 @@ #include <QVBoxLayout> #include <QHeaderView> -#include "VersionListView.h" #include "VersionProxyModel.h" #include "ui/dialogs/CustomMessageBox.h" @@ -57,6 +56,11 @@ void VersionSelectWidget::setEmptyErrorString(QString emptyErrorString) listView->setEmptyErrorString(emptyErrorString); } +void VersionSelectWidget::setEmptyMode(VersionListView::EmptyMode mode) +{ + listView->setEmptyMode(mode); +} + VersionSelectWidget::~VersionSelectWidget() { } diff --git a/launcher/ui/widgets/VersionSelectWidget.h b/launcher/ui/widgets/VersionSelectWidget.h index 0a649408..f56daa8a 100644 --- a/launcher/ui/widgets/VersionSelectWidget.h +++ b/launcher/ui/widgets/VersionSelectWidget.h @@ -18,6 +18,7 @@ #include <QWidget> #include <QSortFilterProxyModel> #include "BaseVersionList.h" +#include "VersionListView.h" class VersionProxyModel; class VersionListView; @@ -49,6 +50,7 @@ public: void setFilter(BaseVersionList::ModelRoles role, Filter *filter); void setEmptyString(QString emptyString); void setEmptyErrorString(QString emptyErrorString); + void setEmptyMode(VersionListView::EmptyMode mode); void setResizeOn(int column); signals: |