refactor: move general code from mod model to its own model
This aims to continue decoupling other types of resources (e.g. resource packs, shader packs, etc) from mods, so that we don't have to continuously watch our backs for changes to one of them affecting the others. To do so, this creates a more general list model for resources, based on the mods one, that allows you to extend it with functionality for other resources. I had to do some template and preprocessor stuff to get around the QObject limitation of not allowing templated classes, so that's sadge :c On the other hand, I tried cleaning up most general-purpose code in the mod model, and added some documentation, because it looks nice :D Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -42,8 +42,9 @@
|
||||
#include <QRunnable>
|
||||
#include <memory>
|
||||
#include "minecraft/mod/Mod.h"
|
||||
#include "tasks/Task.h"
|
||||
|
||||
class ModFolderLoadTask : public QObject, public QRunnable
|
||||
class ModFolderLoadTask : public Task
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -56,16 +57,15 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
ModFolderLoadTask(QDir& mods_dir, QDir& index_dir, bool is_indexed, bool clean_orphan = false);
|
||||
void run();
|
||||
signals:
|
||||
void succeeded();
|
||||
ModFolderLoadTask(QDir mods_dir, QDir index_dir, bool is_indexed, bool clean_orphan = false);
|
||||
|
||||
void executeTask() override;
|
||||
|
||||
private:
|
||||
void getFromMetadata();
|
||||
|
||||
private:
|
||||
QDir& m_mods_dir, m_index_dir;
|
||||
QDir m_mods_dir, m_index_dir;
|
||||
bool m_is_indexed;
|
||||
bool m_clean_orphan;
|
||||
ResultPtr m_result;
|
||||
|
Reference in New Issue
Block a user