Removed const specification
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
f96b135ef7
commit
ae9e8dbafd
@ -1109,9 +1109,10 @@ JavaVersion MinecraftInstance::getJavaVersion()
|
||||
return JavaVersion(settings()->get("JavaVersion").toString());
|
||||
}
|
||||
|
||||
std::shared_ptr<ModFolderModel> MinecraftInstance::loaderModList() const
|
||||
std::shared_ptr<ModFolderModel> MinecraftInstance::loaderModList()
|
||||
{
|
||||
if (!m_loader_mod_list) {
|
||||
if (!m_loader_mod_list)
|
||||
{
|
||||
bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
|
||||
m_loader_mod_list.reset(new ModFolderModel(modsRoot(), this, is_indexed));
|
||||
m_loader_mod_list->disableInteraction(isRunning());
|
||||
@ -1120,9 +1121,10 @@ std::shared_ptr<ModFolderModel> MinecraftInstance::loaderModList() const
|
||||
return m_loader_mod_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<ModFolderModel> MinecraftInstance::coreModList() const
|
||||
std::shared_ptr<ModFolderModel> MinecraftInstance::coreModList()
|
||||
{
|
||||
if (!m_core_mod_list) {
|
||||
if (!m_core_mod_list)
|
||||
{
|
||||
bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
|
||||
m_core_mod_list.reset(new ModFolderModel(coreModsDir(), this, is_indexed));
|
||||
m_core_mod_list->disableInteraction(isRunning());
|
||||
@ -1131,9 +1133,10 @@ std::shared_ptr<ModFolderModel> MinecraftInstance::coreModList() const
|
||||
return m_core_mod_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<ModFolderModel> MinecraftInstance::nilModList() const
|
||||
std::shared_ptr<ModFolderModel> MinecraftInstance::nilModList()
|
||||
{
|
||||
if (!m_nil_mod_list) {
|
||||
if (!m_nil_mod_list)
|
||||
{
|
||||
bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
|
||||
m_nil_mod_list.reset(new ModFolderModel(nilModsDir(), this, is_indexed, false));
|
||||
m_nil_mod_list->disableInteraction(isRunning());
|
||||
@ -1142,41 +1145,46 @@ std::shared_ptr<ModFolderModel> MinecraftInstance::nilModList() const
|
||||
return m_nil_mod_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<ResourcePackFolderModel> MinecraftInstance::resourcePackList() const
|
||||
std::shared_ptr<ResourcePackFolderModel> MinecraftInstance::resourcePackList()
|
||||
{
|
||||
if (!m_resource_pack_list) {
|
||||
if (!m_resource_pack_list)
|
||||
{
|
||||
m_resource_pack_list.reset(new ResourcePackFolderModel(resourcePacksDir(), this));
|
||||
}
|
||||
return m_resource_pack_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<TexturePackFolderModel> MinecraftInstance::texturePackList() const
|
||||
std::shared_ptr<TexturePackFolderModel> MinecraftInstance::texturePackList()
|
||||
{
|
||||
if (!m_texture_pack_list) {
|
||||
if (!m_texture_pack_list)
|
||||
{
|
||||
m_texture_pack_list.reset(new TexturePackFolderModel(texturePacksDir(), this));
|
||||
}
|
||||
return m_texture_pack_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<ShaderPackFolderModel> MinecraftInstance::shaderPackList() const
|
||||
std::shared_ptr<ShaderPackFolderModel> MinecraftInstance::shaderPackList()
|
||||
{
|
||||
if (!m_shader_pack_list) {
|
||||
if (!m_shader_pack_list)
|
||||
{
|
||||
m_shader_pack_list.reset(new ShaderPackFolderModel(shaderPacksDir(), this));
|
||||
}
|
||||
return m_shader_pack_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<WorldList> MinecraftInstance::worldList() const
|
||||
std::shared_ptr<WorldList> MinecraftInstance::worldList()
|
||||
{
|
||||
if (!m_world_list) {
|
||||
if (!m_world_list)
|
||||
{
|
||||
m_world_list.reset(new WorldList(worldDir(), this));
|
||||
}
|
||||
return m_world_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<GameOptions> MinecraftInstance::gameOptionsModel() const
|
||||
std::shared_ptr<GameOptions> MinecraftInstance::gameOptionsModel()
|
||||
{
|
||||
if (!m_game_options) {
|
||||
if (!m_game_options)
|
||||
{
|
||||
m_game_options.reset(new GameOptions(FS::PathCombine(gameRoot(), "options.txt")));
|
||||
}
|
||||
return m_game_options;
|
||||
|
@ -115,14 +115,14 @@ public:
|
||||
std::shared_ptr<PackProfile> getPackProfile() const;
|
||||
|
||||
////// Mod Lists //////
|
||||
std::shared_ptr<ModFolderModel> loaderModList() const;
|
||||
std::shared_ptr<ModFolderModel> coreModList() const;
|
||||
std::shared_ptr<ModFolderModel> nilModList() const;
|
||||
std::shared_ptr<ResourcePackFolderModel> resourcePackList() const;
|
||||
std::shared_ptr<TexturePackFolderModel> texturePackList() const;
|
||||
std::shared_ptr<ShaderPackFolderModel> shaderPackList() const;
|
||||
std::shared_ptr<WorldList> worldList() const;
|
||||
std::shared_ptr<GameOptions> gameOptionsModel() const;
|
||||
std::shared_ptr<ModFolderModel> loaderModList();
|
||||
std::shared_ptr<ModFolderModel> coreModList();
|
||||
std::shared_ptr<ModFolderModel> nilModList();
|
||||
std::shared_ptr<ResourcePackFolderModel> resourcePackList();
|
||||
std::shared_ptr<TexturePackFolderModel> texturePackList();
|
||||
std::shared_ptr<ShaderPackFolderModel> shaderPackList();
|
||||
std::shared_ptr<WorldList> worldList();
|
||||
std::shared_ptr<GameOptions> gameOptionsModel();
|
||||
|
||||
////// Launch stuff //////
|
||||
Task::Ptr createUpdateTask(Net::Mode mode) override;
|
||||
|
@ -45,7 +45,8 @@
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QDebug>
|
||||
|
||||
WorldList::WorldList(const QString& dir, const BaseInstance* instance) : QAbstractListModel(), m_instance(instance), m_dir(dir)
|
||||
WorldList::WorldList(const QString &dir, BaseInstance* instance)
|
||||
: QAbstractListModel(), m_instance(instance), m_dir(dir)
|
||||
{
|
||||
FS::ensureFolderPathExists(m_dir.absolutePath());
|
||||
m_dir.setFilter(QDir::Readable | QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs);
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
IconFileRole
|
||||
};
|
||||
|
||||
WorldList(const QString& dir, const BaseInstance* instance);
|
||||
WorldList(const QString &dir, BaseInstance* instance);
|
||||
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
@ -128,7 +128,7 @@ signals:
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
const BaseInstance* m_instance;
|
||||
BaseInstance* m_instance;
|
||||
QFileSystemWatcher *m_watcher;
|
||||
bool is_watching;
|
||||
QDir m_dir;
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "minecraft/mod/tasks/ModFolderLoadTask.h"
|
||||
#include "modplatform/ModIndex.h"
|
||||
|
||||
ModFolderModel::ModFolderModel(const QString& dir, const BaseInstance* instance, bool is_indexed, bool create_dir)
|
||||
ModFolderModel::ModFolderModel(const QString& dir, BaseInstance* instance, bool is_indexed, bool create_dir)
|
||||
: ResourceFolderModel(QDir(dir), instance, nullptr, create_dir), m_is_indexed(is_indexed)
|
||||
{
|
||||
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::VERSION, SortType::DATE, SortType::PROVIDER };
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
Enable,
|
||||
Toggle
|
||||
};
|
||||
ModFolderModel(const QString& dir, const BaseInstance* instance, bool is_indexed = false, bool create_dir = true);
|
||||
ModFolderModel(const QString &dir, BaseInstance* instance, bool is_indexed = false, bool create_dir = true);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "tasks/Task.h"
|
||||
|
||||
ResourceFolderModel::ResourceFolderModel(QDir dir, const BaseInstance* instance, QObject* parent, bool create_dir)
|
||||
ResourceFolderModel::ResourceFolderModel(QDir dir, BaseInstance* instance, QObject* parent, bool create_dir)
|
||||
: QAbstractListModel(parent), m_dir(dir), m_instance(instance), m_watcher(this)
|
||||
{
|
||||
if (create_dir) {
|
||||
|
@ -26,7 +26,7 @@ class QSortFilterProxyModel;
|
||||
class ResourceFolderModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ResourceFolderModel(QDir, const BaseInstance* instance, QObject* parent = nullptr, bool create_dir = true);
|
||||
ResourceFolderModel(QDir, BaseInstance* instance, QObject* parent = nullptr, bool create_dir = true);
|
||||
~ResourceFolderModel() override;
|
||||
|
||||
/** Starts watching the paths for changes.
|
||||
@ -191,7 +191,7 @@ class ResourceFolderModel : public QAbstractListModel {
|
||||
bool m_can_interact = true;
|
||||
|
||||
QDir m_dir;
|
||||
const BaseInstance* m_instance;
|
||||
BaseInstance* m_instance;
|
||||
QFileSystemWatcher m_watcher;
|
||||
bool m_is_watching = false;
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "minecraft/mod/tasks/BasicFolderLoadTask.h"
|
||||
#include "minecraft/mod/tasks/LocalResourcePackParseTask.h"
|
||||
|
||||
ResourcePackFolderModel::ResourcePackFolderModel(const QString& dir, const BaseInstance* instance)
|
||||
ResourcePackFolderModel::ResourcePackFolderModel(const QString& dir, BaseInstance* instance)
|
||||
: ResourceFolderModel(QDir(dir), instance)
|
||||
{
|
||||
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::PACK_FORMAT, SortType::DATE };
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
explicit ResourcePackFolderModel(const QString& dir, const BaseInstance* instance);
|
||||
explicit ResourcePackFolderModel(const QString &dir, BaseInstance* instance);
|
||||
|
||||
[[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
|
@ -6,5 +6,7 @@ class ShaderPackFolderModel : public ResourceFolderModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ShaderPackFolderModel(const QString& dir, const BaseInstance* instance) : ResourceFolderModel(QDir(dir), instance) {}
|
||||
explicit ShaderPackFolderModel(const QString& dir, BaseInstance* instance)
|
||||
: ResourceFolderModel(QDir(dir), instance)
|
||||
{}
|
||||
};
|
||||
|
@ -39,7 +39,8 @@
|
||||
#include "minecraft/mod/tasks/BasicFolderLoadTask.h"
|
||||
#include "minecraft/mod/tasks/LocalTexturePackParseTask.h"
|
||||
|
||||
TexturePackFolderModel::TexturePackFolderModel(const QString& dir, const BaseInstance* instance) : ResourceFolderModel(QDir(dir), instance)
|
||||
TexturePackFolderModel::TexturePackFolderModel(const QString& dir, BaseInstance* instance)
|
||||
: ResourceFolderModel(QDir(dir), instance)
|
||||
{}
|
||||
|
||||
Task* TexturePackFolderModel::createUpdateTask()
|
||||
|
@ -42,8 +42,8 @@ class TexturePackFolderModel : public ResourceFolderModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TexturePackFolderModel(const QString& dir, const BaseInstance* instance);
|
||||
public:
|
||||
explicit TexturePackFolderModel(const QString &dir, BaseInstance* instance);
|
||||
[[nodiscard]] Task* createUpdateTask() override;
|
||||
[[nodiscard]] Task* createParseTask(Resource&) override;
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
namespace ResourceDownload {
|
||||
|
||||
ModModel::ModModel(BaseInstance const& base_inst, ResourceAPI* api) : ResourceModel(api), m_base_instance(base_inst) {}
|
||||
ModModel::ModModel(BaseInstance& base_inst, ResourceAPI* api) : ResourceModel(api), m_base_instance(base_inst) {}
|
||||
|
||||
/******** Make data requests ********/
|
||||
|
||||
@ -26,7 +26,7 @@ ResourceAPI::SearchArgs ModModel::createSearchArguments()
|
||||
|
||||
std::optional<std::list<Version>> versions{};
|
||||
|
||||
{ // Version filter
|
||||
{ // Version filter
|
||||
if (!m_filter->versions.empty())
|
||||
versions = m_filter->versions;
|
||||
}
|
||||
@ -71,7 +71,7 @@ void ModModel::searchWithTerm(const QString& term, unsigned int sort, bool filte
|
||||
|
||||
bool ModModel::isPackInstalled(ModPlatform::IndexedPack::Ptr pack) const
|
||||
{
|
||||
auto allMods = static_cast<MinecraftInstance const&>(m_base_instance).loaderModList()->allMods();
|
||||
auto allMods = static_cast<MinecraftInstance&>(m_base_instance).loaderModList()->allMods();
|
||||
return std::any_of(allMods.cbegin(), allMods.cend(), [pack](Mod* mod) {
|
||||
if (auto meta = mod->metadata(); meta)
|
||||
return meta->provider == pack->provider && meta->project_id == pack->addonId;
|
||||
|
@ -24,7 +24,7 @@ class ModModel : public ResourceModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModModel(const BaseInstance&, ResourceAPI* api);
|
||||
ModModel(BaseInstance&, ResourceAPI* api);
|
||||
|
||||
/* Ask the API for more information */
|
||||
void searchWithTerm(const QString& term, unsigned int sort, bool filter_changed);
|
||||
@ -45,7 +45,7 @@ class ModModel : public ResourceModel {
|
||||
virtual bool isPackInstalled(ModPlatform::IndexedPack::Ptr) const override;
|
||||
|
||||
protected:
|
||||
const BaseInstance& m_base_instance;
|
||||
BaseInstance& m_base_instance;
|
||||
|
||||
std::shared_ptr<ModFilterWidget::Filter> m_filter = nullptr;
|
||||
};
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace ResourceDownload {
|
||||
|
||||
FlameModModel::FlameModModel(BaseInstance const& base) : ModModel(base, new FlameAPI) {}
|
||||
FlameModModel::FlameModModel(BaseInstance& base) : ModModel(base, new FlameAPI) {}
|
||||
|
||||
void FlameModModel::loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ class FlameModModel : public ModModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FlameModModel(const BaseInstance&);
|
||||
FlameModModel(BaseInstance&);
|
||||
~FlameModModel() override = default;
|
||||
|
||||
private:
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace ResourceDownload {
|
||||
|
||||
ModrinthModModel::ModrinthModModel(BaseInstance const& base) : ModModel(base, new ModrinthAPI) {}
|
||||
ModrinthModModel::ModrinthModModel(BaseInstance& base) : ModModel(base, new ModrinthAPI) {}
|
||||
|
||||
void ModrinthModModel::loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ class ModrinthModModel : public ModModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModrinthModModel(const BaseInstance&);
|
||||
ModrinthModModel(BaseInstance&);
|
||||
~ModrinthModModel() override = default;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user