diff options
author | flow <flowlnlnln@gmail.com> | 2022-12-20 12:15:17 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2023-01-13 16:23:07 -0300 |
commit | 36571c5e2237c98e194cff326480ebe3e661c586 (patch) | |
tree | 7a7bb0f1df380ded2ed6be227f61ef01e86c6e77 /launcher/ui/pages/modplatform/ResourceModel.h | |
parent | c8eca4fb8508a22b9d4819d57627dd684f8d98c5 (diff) | |
download | PrismLauncher-36571c5e2237c98e194cff326480ebe3e661c586.tar.gz PrismLauncher-36571c5e2237c98e194cff326480ebe3e661c586.tar.bz2 PrismLauncher-36571c5e2237c98e194cff326480ebe3e661c586.zip |
refactor(RD): clear up sorting methods
This refactors the sorting methods to join every bit of it into a single
list, easing maintanance. It also removes the weird index contraint on
the list of methods by adding an index field to the DS that holds the
method.
Lastly, it puts the available methods on their respective API, so other
resources on the same API can re-use them later on.
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/pages/modplatform/ResourceModel.h')
-rw-r--r-- | launcher/ui/pages/modplatform/ResourceModel.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/launcher/ui/pages/modplatform/ResourceModel.h b/launcher/ui/pages/modplatform/ResourceModel.h index d0b9234b..facff91d 100644 --- a/launcher/ui/pages/modplatform/ResourceModel.h +++ b/launcher/ui/pages/modplatform/ResourceModel.h @@ -6,7 +6,9 @@ #include "QObjectPtr.h" #include "BaseInstance.h" + #include "modplatform/ResourceAPI.h" + #include "tasks/ConcurrentTask.h" class NetJob; @@ -41,6 +43,8 @@ class ResourceModel : public QAbstractListModel { inline void addActiveJob(Task::Ptr ptr) { m_current_job.addTask(ptr); if (!m_current_job.isRunning()) m_current_job.start(); } inline Task const& activeJob() { return m_current_job; } + [[nodiscard]] auto getSortingMethods() const { return m_api->getSortingMethods(); } + public slots: void fetchMore(const QModelIndex& parent) override; // NOTE: Can't use [[nodiscard]] here because of https://bugreports.qt.io/browse/QTBUG-58628 on Qt 5.12 @@ -83,6 +87,7 @@ class ResourceModel : public QAbstractListModel { enum class SearchState { None, CanFetchMore, ResetRequested, Finished } m_search_state = SearchState::None; int m_next_search_offset = 0; QString m_search_term; + unsigned int m_current_sort_index = 0; std::unique_ptr<ResourceAPI> m_api; |