NOISSUE more refactoring

This commit is contained in:
Petr Mrázek
2021-11-21 23:36:55 +01:00
parent 69213b1206
commit 9fc677c2a4
21 changed files with 33 additions and 32 deletions

View File

@ -69,7 +69,7 @@ LoadResult composeLoadResult(LoadResult a, LoadResult b)
return a;
}
static LoadResult loadComponent(ComponentPtr component, shared_qobject_ptr<Task>& 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<Task>
// FIXME: dead code. determine if this can still be useful?
/*
static LoadResult loadPackProfile(ComponentPtr component, shared_qobject_ptr<Task>& 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<Tas
}
*/
static LoadResult loadIndex(shared_qobject_ptr<Task>& 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<Task> 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<Task> 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...

View File

@ -798,17 +798,17 @@ QString MinecraftInstance::getStatusbarDescription()
return description;
}
shared_qobject_ptr<Task> MinecraftInstance::createUpdateTask(Net::Mode mode)
Task::Ptr MinecraftInstance::createUpdateTask(Net::Mode mode)
{
switch (mode)
{
case Net::Mode::Offline:
{
return shared_qobject_ptr<Task>(new MinecraftLoadAndCheck(this));
return Task::Ptr(new MinecraftLoadAndCheck(this));
}
case Net::Mode::Online:
{
return shared_qobject_ptr<Task>(new MinecraftUpdate(this));
return Task::Ptr(new MinecraftUpdate(this));
}
}
return nullptr;

View File

@ -77,7 +77,7 @@ public:
std::shared_ptr<GameOptions> gameOptionsModel() const;
////// Launch stuff //////
shared_qobject_ptr<Task> createUpdateTask(Net::Mode mode) override;
Task::Ptr createUpdateTask(Net::Mode mode) override;
shared_qobject_ptr<LaunchTask> createLaunchTask(AuthSessionPtr account, MinecraftServerTargetPtr serverToJoin) override;
QStringList extraArguments() const override;
QStringList verboseDescription(AuthSessionPtr session, MinecraftServerTargetPtr serverToJoin) override;

View File

@ -41,7 +41,7 @@ private slots:
private:
MinecraftInstance *m_inst = nullptr;
shared_qobject_ptr<Task> m_task;
Task::Ptr m_task;
QString m_preFailure;
QString m_fail_reason;
};

View File

@ -340,7 +340,7 @@ void PackProfile::reload(Net::Mode netmode)
}
}
shared_qobject_ptr<Task> PackProfile::getCurrentTask()
Task::Ptr PackProfile::getCurrentTask()
{
return d->m_updateTask;
}

View File

@ -85,7 +85,7 @@ public:
void resolve(Net::Mode netmode);
/// get current running task...
shared_qobject_ptr<Task> getCurrentTask();
Task::Ptr getCurrentTask();
std::shared_ptr<LaunchProfile> getProfile() const;

View File

@ -35,7 +35,7 @@ struct PackProfileData
ComponentIndex componentIndex;
bool dirty = false;
QTimer m_saveTimer;
shared_qobject_ptr<Task> m_updateTask;
Task::Ptr m_updateTask;
bool loaded = false;
bool interactionDisabled = true;
};

View File

@ -90,7 +90,7 @@ bool LegacyInstance::shouldUseCustomBaseJar() const
}
shared_qobject_ptr<Task> LegacyInstance::createUpdateTask(Net::Mode)
Task::Ptr LegacyInstance::createUpdateTask(Net::Mode)
{
return nullptr;
}

View File

@ -93,7 +93,7 @@ public:
};
virtual bool shouldUpdate() const;
virtual shared_qobject_ptr<Task> createUpdateTask(Net::Mode mode) override;
virtual Task::Ptr createUpdateTask(Net::Mode mode) override;
virtual QString typeName() const override;