refactor!!!: migrate from shared pointers

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2026-01-07 19:16:54 +05:00
parent c64d871a28
commit 549405ab2f
No known key found for this signature in database
GPG key ID: B77C34313AEE1FFF
199 changed files with 742 additions and 709 deletions

View file

@ -56,8 +56,8 @@ class PackProfile;
class MinecraftInstance : public BaseInstance {
Q_OBJECT
public:
MinecraftInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString& rootDir);
virtual ~MinecraftInstance() = default;
MinecraftInstance(SettingsObject* globalSettings, std::unique_ptr<SettingsObject> settings, const QString& rootDir);
virtual ~MinecraftInstance();
virtual void saveNow() override;
void loadSpecificSettings() override;
@ -109,22 +109,22 @@ class MinecraftInstance : public BaseInstance {
void updateRuntimeContext() override;
////// Profile management //////
std::shared_ptr<PackProfile> getPackProfile() const;
PackProfile* getPackProfile() const;
////// Mod Lists //////
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<DataPackFolderModel> dataPackList();
QList<std::shared_ptr<ResourceFolderModel>> resourceLists();
std::shared_ptr<WorldList> worldList();
ModFolderModel* loaderModList();
ModFolderModel* coreModList();
ModFolderModel* nilModList();
ResourcePackFolderModel* resourcePackList();
TexturePackFolderModel* texturePackList();
ShaderPackFolderModel* shaderPackList();
DataPackFolderModel* dataPackList();
QList<ResourceFolderModel*> resourceLists();
WorldList* worldList();
////// Launch stuff //////
QList<Task::Ptr> createUpdateTask() override;
shared_qobject_ptr<LaunchTask> createLaunchTask(AuthSessionPtr account, MinecraftTarget::Ptr targetToJoin) override;
LaunchTask* createLaunchTask(AuthSessionPtr account, MinecraftTarget::Ptr targetToJoin) override;
QStringList extraArguments() override;
QStringList verboseDescription(AuthSessionPtr session, MinecraftTarget::Ptr targetToJoin) override;
QList<Mod*> getJarMods() const;
@ -162,15 +162,13 @@ class MinecraftInstance : public BaseInstance {
QMap<QString, QString> makeProfileVarMapping(std::shared_ptr<LaunchProfile> profile) const;
protected: // data
std::shared_ptr<PackProfile> m_components;
mutable std::shared_ptr<ModFolderModel> m_loader_mod_list;
mutable std::shared_ptr<ModFolderModel> m_core_mod_list;
mutable std::shared_ptr<ModFolderModel> m_nil_mod_list;
mutable std::shared_ptr<ResourcePackFolderModel> m_resource_pack_list;
mutable std::shared_ptr<ShaderPackFolderModel> m_shader_pack_list;
mutable std::shared_ptr<TexturePackFolderModel> m_texture_pack_list;
mutable std::shared_ptr<DataPackFolderModel> m_data_pack_list;
mutable std::shared_ptr<WorldList> m_world_list;
};
using MinecraftInstancePtr = std::shared_ptr<MinecraftInstance>;
std::unique_ptr<PackProfile> m_components;
std::unique_ptr<ModFolderModel> m_loader_mod_list;
std::unique_ptr<ModFolderModel> m_core_mod_list;
std::unique_ptr<ModFolderModel> m_nil_mod_list;
std::unique_ptr<ResourcePackFolderModel> m_resource_pack_list;
std::unique_ptr<ShaderPackFolderModel> m_shader_pack_list;
std::unique_ptr<TexturePackFolderModel> m_texture_pack_list;
std::unique_ptr<DataPackFolderModel> m_data_pack_list;
std::unique_ptr<WorldList> m_world_list;
};