diff options
author | Petr Mrázek <peterix@gmail.com> | 2019-08-04 03:27:53 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2019-08-04 03:27:53 +0200 |
commit | a3ffa3d6659e00e0762017cf64911db0183a250c (patch) | |
tree | 565b2d69b1d8d7e711682801410ff8a234e3931d /application/pages/instance | |
parent | 7d13e3119801862b9fdf64b11a45c41a64b4fc46 (diff) | |
download | MultiMC-a3ffa3d6659e00e0762017cf64911db0183a250c.tar MultiMC-a3ffa3d6659e00e0762017cf64911db0183a250c.tar.gz MultiMC-a3ffa3d6659e00e0762017cf64911db0183a250c.tar.lz MultiMC-a3ffa3d6659e00e0762017cf64911db0183a250c.tar.xz MultiMC-a3ffa3d6659e00e0762017cf64911db0183a250c.zip |
NOISSUE asynchronous, parallel mod folder listing and mod resolving
Diffstat (limited to 'application/pages/instance')
-rw-r--r-- | application/pages/instance/ModFolderPage.cpp | 26 | ||||
-rw-r--r-- | application/pages/instance/ModFolderPage.h | 8 | ||||
-rw-r--r-- | application/pages/instance/VersionPage.cpp | 2 |
3 files changed, 18 insertions, 18 deletions
diff --git a/application/pages/instance/ModFolderPage.cpp b/application/pages/instance/ModFolderPage.cpp index 03bcaa48..97002824 100644 --- a/application/pages/instance/ModFolderPage.cpp +++ b/application/pages/instance/ModFolderPage.cpp @@ -25,8 +25,8 @@ #include "MultiMC.h" #include "dialogs/CustomMessageBox.h" #include <GuiUtil.h> -#include "minecraft/SimpleModList.h" -#include "minecraft/Mod.h" +#include "minecraft/mod/ModFolderModel.h" +#include "minecraft/mod/Mod.h" #include "minecraft/VersionFilterData.h" #include "minecraft/ComponentList.h" #include <DesktopServices.h> @@ -53,7 +53,7 @@ public: protected: bool lessThan(const QModelIndex & source_left, const QModelIndex & source_right) const override { - SimpleModList *model = qobject_cast<SimpleModList *>(sourceModel()); + ModFolderModel *model = qobject_cast<ModFolderModel *>(sourceModel()); if( !model || !source_left.isValid() || @@ -65,11 +65,11 @@ protected: // we are now guaranteed to have two valid indexes in the same column... we love the provided invariants unconditionally and proceed. - auto column = (SimpleModList::Columns) source_left.column(); + auto column = (ModFolderModel::Columns) source_left.column(); bool invert = false; switch(column) { // GH-2550 - sort by enabled/disabled - case SimpleModList::ActiveColumn: { + case ModFolderModel::ActiveColumn: { auto dataL = source_left.data(Qt::CheckStateRole).toBool(); auto dataR = source_right.data(Qt::CheckStateRole).toBool(); if(dataL != dataR) { @@ -79,10 +79,10 @@ protected: invert = sortOrder() == Qt::DescendingOrder; } // GH-2722 - sort mod names in a way that discards "The" prefixes - case SimpleModList::NameColumn: { - auto dataL = model->data(model->index(source_left.row(), SimpleModList::NameColumn)).toString(); + case ModFolderModel::NameColumn: { + auto dataL = model->data(model->index(source_left.row(), ModFolderModel::NameColumn)).toString(); RemoveThePrefix(dataL); - auto dataR = model->data(model->index(source_right.row(), SimpleModList::NameColumn)).toString(); + auto dataR = model->data(model->index(source_right.row(), ModFolderModel::NameColumn)).toString(); RemoveThePrefix(dataR); auto less = dataL.compare(dataR, sortCaseSensitivity()); @@ -93,9 +93,9 @@ protected: invert = sortOrder() == Qt::DescendingOrder; } // GH-2762 - sort versions by parsing them as versions - case SimpleModList::VersionColumn: { - auto dataL = Version(model->data(model->index(source_left.row(), SimpleModList::VersionColumn)).toString()); - auto dataR = Version(model->data(model->index(source_right.row(), SimpleModList::VersionColumn)).toString()); + case ModFolderModel::VersionColumn: { + auto dataL = Version(model->data(model->index(source_left.row(), ModFolderModel::VersionColumn)).toString()); + auto dataR = Version(model->data(model->index(source_right.row(), ModFolderModel::VersionColumn)).toString()); return invert ? (dataL > dataR) : (dataL < dataR); } default: { @@ -107,7 +107,7 @@ protected: ModFolderPage::ModFolderPage( BaseInstance *inst, - std::shared_ptr<SimpleModList> mods, + std::shared_ptr<ModFolderModel> mods, QString id, QString iconName, QString displayName, @@ -177,7 +177,7 @@ void ModFolderPage::on_filterTextChanged(const QString& newContents) } -CoreModFolderPage::CoreModFolderPage(BaseInstance *inst, std::shared_ptr<SimpleModList> mods, +CoreModFolderPage::CoreModFolderPage(BaseInstance *inst, std::shared_ptr<ModFolderModel> mods, QString id, QString iconName, QString displayName, QString helpPage, QWidget *parent) : ModFolderPage(inst, mods, id, iconName, displayName, helpPage, parent) diff --git a/application/pages/instance/ModFolderPage.h b/application/pages/instance/ModFolderPage.h index a52e1611..a99ab161 100644 --- a/application/pages/instance/ModFolderPage.h +++ b/application/pages/instance/ModFolderPage.h @@ -21,7 +21,7 @@ #include "pages/BasePage.h" #include <MultiMC.h> -class SimpleModList; +class ModFolderModel; namespace Ui { class ModFolderPage; @@ -34,7 +34,7 @@ class ModFolderPage : public QMainWindow, public BasePage public: explicit ModFolderPage( BaseInstance *inst, - std::shared_ptr<SimpleModList> mods, + std::shared_ptr<ModFolderModel> mods, QString id, QString iconName, QString displayName, @@ -78,7 +78,7 @@ protected: protected: Ui::ModFolderPage *ui = nullptr; - std::shared_ptr<SimpleModList> m_mods; + std::shared_ptr<ModFolderModel> m_mods; QSortFilterProxyModel *m_filterModel = nullptr; QString m_iconName; QString m_id; @@ -108,7 +108,7 @@ slots: class CoreModFolderPage : public ModFolderPage { public: - explicit CoreModFolderPage(BaseInstance *inst, std::shared_ptr<SimpleModList> mods, QString id, + explicit CoreModFolderPage(BaseInstance *inst, std::shared_ptr<ModFolderModel> mods, QString id, QString iconName, QString displayName, QString helpPage = "", QWidget *parent = 0); virtual ~CoreModFolderPage() diff --git a/application/pages/instance/VersionPage.cpp b/application/pages/instance/VersionPage.cpp index e129d03d..2acc13c2 100644 --- a/application/pages/instance/VersionPage.cpp +++ b/application/pages/instance/VersionPage.cpp @@ -39,7 +39,7 @@ #include "minecraft/ComponentList.h" #include "minecraft/auth/MojangAccountList.h" -#include "minecraft/Mod.h" +#include "minecraft/mod/Mod.h" #include "icons/IconList.h" #include "Exception.h" #include "Version.h" |