2022-03-03 05:47:10 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
2023-01-03 21:18:22 +05:30
|
|
|
#include "BaseInstance.h"
|
|
|
|
|
2022-03-08 00:52:57 +05:30
|
|
|
#include "modplatform/ModIndex.h"
|
2022-11-25 17:53:46 +05:30
|
|
|
#include "modplatform/ResourceAPI.h"
|
|
|
|
|
|
|
|
#include "ui/pages/modplatform/ResourceModel.h"
|
2022-12-19 00:11:46 +05:30
|
|
|
#include "ui/widgets/ModFilterWidget.h"
|
2022-03-03 05:47:10 +05:30
|
|
|
|
2022-04-03 03:04:26 +05:30
|
|
|
class Version;
|
2022-03-03 05:47:10 +05:30
|
|
|
|
2022-12-17 03:33:52 +05:30
|
|
|
namespace ResourceDownload {
|
|
|
|
|
|
|
|
class ModPage;
|
2022-03-03 05:47:10 +05:30
|
|
|
|
2022-12-17 03:33:52 +05:30
|
|
|
class ModModel : public ResourceModel {
|
2022-03-03 05:47:10 +05:30
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-12-19 00:11:46 +05:30
|
|
|
ModModel(const BaseInstance&, ResourceAPI* api);
|
2022-03-08 00:52:57 +05:30
|
|
|
|
2022-03-08 02:16:18 +05:30
|
|
|
/* Ask the API for more information */
|
2022-12-20 20:45:17 +05:30
|
|
|
void searchWithTerm(const QString& term, unsigned int sort, bool filter_changed);
|
2022-03-03 05:47:10 +05:30
|
|
|
|
2022-12-24 02:48:20 +05:30
|
|
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override = 0;
|
|
|
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override = 0;
|
|
|
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override = 0;
|
2022-03-08 03:59:59 +05:30
|
|
|
|
2022-12-19 00:11:46 +05:30
|
|
|
void setFilter(std::shared_ptr<ModFilterWidget::Filter> filter) { m_filter = filter; }
|
|
|
|
|
2022-11-25 17:53:46 +05:30
|
|
|
public slots:
|
|
|
|
ResourceAPI::SearchArgs createSearchArguments() override;
|
|
|
|
ResourceAPI::VersionSearchArgs createVersionsArguments(QModelIndex&) override;
|
|
|
|
ResourceAPI::ProjectInfoArgs createInfoArguments(QModelIndex&) override;
|
2022-03-03 05:47:10 +05:30
|
|
|
|
|
|
|
protected:
|
2022-12-24 02:48:20 +05:30
|
|
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override = 0;
|
2022-03-03 07:31:23 +05:30
|
|
|
|
2022-03-03 05:47:10 +05:30
|
|
|
protected:
|
2023-01-03 21:18:22 +05:30
|
|
|
const BaseInstance& m_base_instance;
|
|
|
|
|
2022-12-19 00:11:46 +05:30
|
|
|
std::shared_ptr<ModFilterWidget::Filter> m_filter = nullptr;
|
2022-03-03 05:47:10 +05:30
|
|
|
};
|
2022-12-17 03:33:52 +05:30
|
|
|
|
|
|
|
} // namespace ResourceDownload
|