diff --git a/launcher/BaseInstance.h b/launcher/BaseInstance.h index 253d2130..fd26bb4f 100644 --- a/launcher/BaseInstance.h +++ b/launcher/BaseInstance.h @@ -143,7 +143,7 @@ public: virtual SettingsObjectPtr settings() const; /// returns a valid update task - virtual shared_qobject_ptr createUpdateTask(Net::Mode mode) = 0; + virtual Task::Ptr createUpdateTask(Net::Mode mode) = 0; /// returns a valid launcher (task container) virtual shared_qobject_ptr createLaunchTask( diff --git a/launcher/BaseVersionList.h b/launcher/BaseVersionList.h index ce7abce1..80a91e8f 100644 --- a/launcher/BaseVersionList.h +++ b/launcher/BaseVersionList.h @@ -63,7 +63,7 @@ public: * The task returned by this function should reset the model when it's done. * \return A pointer to a task that reloads the version list. */ - virtual shared_qobject_ptr getLoadTask() = 0; + virtual Task::Ptr getLoadTask() = 0; //! Checks whether or not the list is loaded. If this returns false, the list should be //loaded. diff --git a/launcher/dialogs/AboutDialog.cpp b/launcher/dialogs/AboutDialog.cpp index 4f2e73e0..501156d0 100644 --- a/launcher/dialogs/AboutDialog.cpp +++ b/launcher/dialogs/AboutDialog.cpp @@ -133,7 +133,7 @@ AboutDialog::~AboutDialog() void AboutDialog::loadPatronList() { - netJob.reset(new NetJob("Patreon Patron List")); + netJob = new NetJob("Patreon Patron List"); netJob->addNetAction(Net::Download::makeByteArray(QUrl("https://files.multimc.org/patrons.txt"), &dataSink)); connect(netJob.get(), &NetJob::succeeded, this, &AboutDialog::patronListLoaded); netJob->start(APPLICATION->network()); diff --git a/launcher/dialogs/LoginDialog.h b/launcher/dialogs/LoginDialog.h index 833cb570..f8101ff5 100644 --- a/launcher/dialogs/LoginDialog.h +++ b/launcher/dialogs/LoginDialog.h @@ -19,6 +19,7 @@ #include #include "minecraft/auth/MinecraftAccount.h" +#include "tasks/Task.h" namespace Ui { @@ -54,5 +55,5 @@ slots: private: Ui::LoginDialog *ui; MinecraftAccountPtr m_account; - shared_qobject_ptr m_loginTask; + Task::Ptr m_loginTask; }; diff --git a/launcher/java/JavaInstallList.cpp b/launcher/java/JavaInstallList.cpp index 0bded03c..07f2bd8c 100644 --- a/launcher/java/JavaInstallList.cpp +++ b/launcher/java/JavaInstallList.cpp @@ -29,13 +29,13 @@ JavaInstallList::JavaInstallList(QObject *parent) : BaseVersionList(parent) { } -shared_qobject_ptr JavaInstallList::getLoadTask() +Task::Ptr JavaInstallList::getLoadTask() { load(); return getCurrentTask(); } -shared_qobject_ptr JavaInstallList::getCurrentTask() +Task::Ptr JavaInstallList::getCurrentTask() { if(m_status == Status::InProgress) { diff --git a/launcher/java/JavaInstallList.h b/launcher/java/JavaInstallList.h index e5c72b17..3c237edf 100644 --- a/launcher/java/JavaInstallList.h +++ b/launcher/java/JavaInstallList.h @@ -40,7 +40,7 @@ class JavaInstallList : public BaseVersionList public: explicit JavaInstallList(QObject *parent = 0); - shared_qobject_ptr getLoadTask() override; + Task::Ptr getLoadTask() override; bool isLoaded() override; const BaseVersionPtr at(int i) const override; int count() const override; @@ -54,7 +54,7 @@ public slots: protected: void load(); - shared_qobject_ptr getCurrentTask(); + Task::Ptr getCurrentTask(); protected: Status m_status = Status::NotDone; diff --git a/launcher/launch/steps/Update.h b/launcher/launch/steps/Update.h index 0c9d91e0..ce40611e 100644 --- a/launcher/launch/steps/Update.h +++ b/launcher/launch/steps/Update.h @@ -39,7 +39,7 @@ private slots: void updateFinished(); private: - shared_qobject_ptr m_updateTask; + Task::Ptr m_updateTask; bool m_aborted = false; Net::Mode m_mode = Net::Mode::Offline; }; diff --git a/launcher/meta/BaseEntity.cpp b/launcher/meta/BaseEntity.cpp index 9aa4a3dd..a9d62fcd 100644 --- a/launcher/meta/BaseEntity.cpp +++ b/launcher/meta/BaseEntity.cpp @@ -154,7 +154,7 @@ bool Meta::BaseEntity::shouldStartRemoteUpdate() const return m_updateStatus != UpdateStatus::InProgress; } -shared_qobject_ptr Meta::BaseEntity::getCurrentTask() +Task::Ptr Meta::BaseEntity::getCurrentTask() { if(m_updateStatus == UpdateStatus::InProgress) { diff --git a/launcher/meta/VersionList.cpp b/launcher/meta/VersionList.cpp index 607007eb..6d23ce9a 100644 --- a/launcher/meta/VersionList.cpp +++ b/launcher/meta/VersionList.cpp @@ -29,7 +29,7 @@ VersionList::VersionList(const QString &uid, QObject *parent) setObjectName("Version list: " + uid); } -shared_qobject_ptr VersionList::getLoadTask() +Task::Ptr VersionList::getLoadTask() { load(Net::Mode::Online); return getCurrentTask(); diff --git a/launcher/meta/VersionList.h b/launcher/meta/VersionList.h index 58cdafe7..378255df 100644 --- a/launcher/meta/VersionList.h +++ b/launcher/meta/VersionList.h @@ -41,7 +41,7 @@ public: VersionPtrRole }; - shared_qobject_ptr getLoadTask() override; + Task::Ptr getLoadTask() override; bool isLoaded() override; const BaseVersionPtr at(int i) const override; int count() const override; diff --git a/launcher/minecraft/ComponentUpdateTask.cpp b/launcher/minecraft/ComponentUpdateTask.cpp index 5c52226b..8bc05a1b 100644 --- a/launcher/minecraft/ComponentUpdateTask.cpp +++ b/launcher/minecraft/ComponentUpdateTask.cpp @@ -69,7 +69,7 @@ LoadResult composeLoadResult(LoadResult a, LoadResult b) return a; } -static LoadResult loadComponent(ComponentPtr component, shared_qobject_ptr& loadTask, Net::Mode netmode) +static LoadResult loadComponent(ComponentPtr component, Task::Ptr& loadTask, Net::Mode netmode) { if(component->m_loaded) { @@ -127,7 +127,7 @@ static LoadResult loadComponent(ComponentPtr component, shared_qobject_ptr // FIXME: dead code. determine if this can still be useful? /* -static LoadResult loadPackProfile(ComponentPtr component, shared_qobject_ptr& loadTask, Net::Mode netmode) +static LoadResult loadPackProfile(ComponentPtr component, Task::Ptr& loadTask, Net::Mode netmode) { if(component->m_loaded) { @@ -152,7 +152,7 @@ static LoadResult loadPackProfile(ComponentPtr component, shared_qobject_ptr& loadTask, Net::Mode netmode) +static LoadResult loadIndex(Task::Ptr& loadTask, Net::Mode netmode) { // FIXME: DECIDE. do we want to run the update task anyway? if(APPLICATION->metadataIndex()->isLoaded()) @@ -180,7 +180,7 @@ void ComponentUpdateTask::loadComponents() // load the main index (it is needed to determine if components can revert) { // FIXME: tear out as a method? or lambda? - shared_qobject_ptr indexLoadTask; + Task::Ptr indexLoadTask; auto singleResult = loadIndex(indexLoadTask, d->netmode); result = composeLoadResult(result, singleResult); if(indexLoadTask) @@ -203,7 +203,7 @@ void ComponentUpdateTask::loadComponents() // load all the components OR their lists... for (auto component: d->m_list->d->components) { - shared_qobject_ptr loadTask; + Task::Ptr loadTask; LoadResult singleResult; RemoteLoadStatus::Type loadType; // FIXME: to do this right, we need to load the lists and decide on which versions to use during dependency resolution. For now, ignore all that... diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index ad8380c1..fe04168f 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -798,17 +798,17 @@ QString MinecraftInstance::getStatusbarDescription() return description; } -shared_qobject_ptr MinecraftInstance::createUpdateTask(Net::Mode mode) +Task::Ptr MinecraftInstance::createUpdateTask(Net::Mode mode) { switch (mode) { case Net::Mode::Offline: { - return shared_qobject_ptr(new MinecraftLoadAndCheck(this)); + return Task::Ptr(new MinecraftLoadAndCheck(this)); } case Net::Mode::Online: { - return shared_qobject_ptr(new MinecraftUpdate(this)); + return Task::Ptr(new MinecraftUpdate(this)); } } return nullptr; diff --git a/launcher/minecraft/MinecraftInstance.h b/launcher/minecraft/MinecraftInstance.h index b11270e6..bb45f37b 100644 --- a/launcher/minecraft/MinecraftInstance.h +++ b/launcher/minecraft/MinecraftInstance.h @@ -77,7 +77,7 @@ public: std::shared_ptr gameOptionsModel() const; ////// Launch stuff ////// - shared_qobject_ptr createUpdateTask(Net::Mode mode) override; + Task::Ptr createUpdateTask(Net::Mode mode) override; shared_qobject_ptr createLaunchTask(AuthSessionPtr account, MinecraftServerTargetPtr serverToJoin) override; QStringList extraArguments() const override; QStringList verboseDescription(AuthSessionPtr session, MinecraftServerTargetPtr serverToJoin) override; diff --git a/launcher/minecraft/MinecraftLoadAndCheck.h b/launcher/minecraft/MinecraftLoadAndCheck.h index 3435b52b..bfeae46b 100644 --- a/launcher/minecraft/MinecraftLoadAndCheck.h +++ b/launcher/minecraft/MinecraftLoadAndCheck.h @@ -41,7 +41,7 @@ private slots: private: MinecraftInstance *m_inst = nullptr; - shared_qobject_ptr m_task; + Task::Ptr m_task; QString m_preFailure; QString m_fail_reason; }; diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp index d6a565c0..59a8f133 100644 --- a/launcher/minecraft/PackProfile.cpp +++ b/launcher/minecraft/PackProfile.cpp @@ -340,7 +340,7 @@ void PackProfile::reload(Net::Mode netmode) } } -shared_qobject_ptr PackProfile::getCurrentTask() +Task::Ptr PackProfile::getCurrentTask() { return d->m_updateTask; } diff --git a/launcher/minecraft/PackProfile.h b/launcher/minecraft/PackProfile.h index 3d6cc6c3..f30deb5a 100644 --- a/launcher/minecraft/PackProfile.h +++ b/launcher/minecraft/PackProfile.h @@ -85,7 +85,7 @@ public: void resolve(Net::Mode netmode); /// get current running task... - shared_qobject_ptr getCurrentTask(); + Task::Ptr getCurrentTask(); std::shared_ptr getProfile() const; diff --git a/launcher/minecraft/PackProfile_p.h b/launcher/minecraft/PackProfile_p.h index 6cd2a4e5..fce921bb 100644 --- a/launcher/minecraft/PackProfile_p.h +++ b/launcher/minecraft/PackProfile_p.h @@ -35,7 +35,7 @@ struct PackProfileData ComponentIndex componentIndex; bool dirty = false; QTimer m_saveTimer; - shared_qobject_ptr m_updateTask; + Task::Ptr m_updateTask; bool loaded = false; bool interactionDisabled = true; }; diff --git a/launcher/minecraft/legacy/LegacyInstance.cpp b/launcher/minecraft/legacy/LegacyInstance.cpp index 9f9bda5a..c2b4309c 100644 --- a/launcher/minecraft/legacy/LegacyInstance.cpp +++ b/launcher/minecraft/legacy/LegacyInstance.cpp @@ -90,7 +90,7 @@ bool LegacyInstance::shouldUseCustomBaseJar() const } -shared_qobject_ptr LegacyInstance::createUpdateTask(Net::Mode) +Task::Ptr LegacyInstance::createUpdateTask(Net::Mode) { return nullptr; } diff --git a/launcher/minecraft/legacy/LegacyInstance.h b/launcher/minecraft/legacy/LegacyInstance.h index ac2a8543..c6680fd0 100644 --- a/launcher/minecraft/legacy/LegacyInstance.h +++ b/launcher/minecraft/legacy/LegacyInstance.h @@ -93,7 +93,7 @@ public: }; virtual bool shouldUpdate() const; - virtual shared_qobject_ptr createUpdateTask(Net::Mode mode) override; + virtual Task::Ptr createUpdateTask(Net::Mode mode) override; virtual QString typeName() const override; diff --git a/launcher/tasks/SequentialTask.cpp b/launcher/tasks/SequentialTask.cpp index f96f2cee..a66b9d78 100644 --- a/launcher/tasks/SequentialTask.cpp +++ b/launcher/tasks/SequentialTask.cpp @@ -4,7 +4,7 @@ SequentialTask::SequentialTask(QObject *parent) : Task(parent), m_currentIndex(- { } -void SequentialTask::addTask(shared_qobject_ptr task) +void SequentialTask::addTask(Task::Ptr task) { m_queue.append(task); } @@ -19,7 +19,7 @@ void SequentialTask::startNext() { if (m_currentIndex != -1) { - shared_qobject_ptr previous = m_queue[m_currentIndex]; + Task::Ptr previous = m_queue[m_currentIndex]; disconnect(previous.get(), 0, this, 0); } m_currentIndex++; @@ -28,7 +28,7 @@ void SequentialTask::startNext() emitSucceeded(); return; } - shared_qobject_ptr next = m_queue[m_currentIndex]; + Task::Ptr next = m_queue[m_currentIndex]; connect(next.get(), SIGNAL(failed(QString)), this, SLOT(subTaskFailed(QString))); connect(next.get(), SIGNAL(status(QString)), this, SLOT(subTaskStatus(QString))); connect(next.get(), SIGNAL(progress(qint64, qint64)), this, SLOT(subTaskProgress(qint64, qint64))); diff --git a/launcher/tasks/SequentialTask.h b/launcher/tasks/SequentialTask.h index e3091176..027744f3 100644 --- a/launcher/tasks/SequentialTask.h +++ b/launcher/tasks/SequentialTask.h @@ -12,7 +12,7 @@ public: explicit SequentialTask(QObject *parent = 0); virtual ~SequentialTask() {}; - void addTask(shared_qobject_ptr task); + void addTask(Task::Ptr task); protected: void executeTask(); @@ -25,6 +25,6 @@ slots: void subTaskProgress(qint64 current, qint64 total); private: - QQueue > m_queue; + QQueue m_queue; int m_currentIndex; };