NOISSUE more refactoring
This commit is contained in:
parent
69213b1206
commit
9fc677c2a4
@ -143,7 +143,7 @@ public:
|
||||
virtual SettingsObjectPtr settings() const;
|
||||
|
||||
/// returns a valid update task
|
||||
virtual shared_qobject_ptr<Task> createUpdateTask(Net::Mode mode) = 0;
|
||||
virtual Task::Ptr createUpdateTask(Net::Mode mode) = 0;
|
||||
|
||||
/// returns a valid launcher (task container)
|
||||
virtual shared_qobject_ptr<LaunchTask> createLaunchTask(
|
||||
|
@ -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<Task> getLoadTask() = 0;
|
||||
virtual Task::Ptr getLoadTask() = 0;
|
||||
|
||||
//! Checks whether or not the list is loaded. If this returns false, the list should be
|
||||
//loaded.
|
||||
|
@ -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());
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <QtCore/QEventLoop>
|
||||
|
||||
#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<Task> m_loginTask;
|
||||
Task::Ptr m_loginTask;
|
||||
};
|
||||
|
@ -29,13 +29,13 @@ JavaInstallList::JavaInstallList(QObject *parent) : BaseVersionList(parent)
|
||||
{
|
||||
}
|
||||
|
||||
shared_qobject_ptr<Task> JavaInstallList::getLoadTask()
|
||||
Task::Ptr JavaInstallList::getLoadTask()
|
||||
{
|
||||
load();
|
||||
return getCurrentTask();
|
||||
}
|
||||
|
||||
shared_qobject_ptr<Task> JavaInstallList::getCurrentTask()
|
||||
Task::Ptr JavaInstallList::getCurrentTask()
|
||||
{
|
||||
if(m_status == Status::InProgress)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ class JavaInstallList : public BaseVersionList
|
||||
public:
|
||||
explicit JavaInstallList(QObject *parent = 0);
|
||||
|
||||
shared_qobject_ptr<Task> 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<Task> getCurrentTask();
|
||||
Task::Ptr getCurrentTask();
|
||||
|
||||
protected:
|
||||
Status m_status = Status::NotDone;
|
||||
|
@ -39,7 +39,7 @@ private slots:
|
||||
void updateFinished();
|
||||
|
||||
private:
|
||||
shared_qobject_ptr<Task> m_updateTask;
|
||||
Task::Ptr m_updateTask;
|
||||
bool m_aborted = false;
|
||||
Net::Mode m_mode = Net::Mode::Offline;
|
||||
};
|
||||
|
@ -154,7 +154,7 @@ bool Meta::BaseEntity::shouldStartRemoteUpdate() const
|
||||
return m_updateStatus != UpdateStatus::InProgress;
|
||||
}
|
||||
|
||||
shared_qobject_ptr<Task> Meta::BaseEntity::getCurrentTask()
|
||||
Task::Ptr Meta::BaseEntity::getCurrentTask()
|
||||
{
|
||||
if(m_updateStatus == UpdateStatus::InProgress)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ VersionList::VersionList(const QString &uid, QObject *parent)
|
||||
setObjectName("Version list: " + uid);
|
||||
}
|
||||
|
||||
shared_qobject_ptr<Task> VersionList::getLoadTask()
|
||||
Task::Ptr VersionList::getLoadTask()
|
||||
{
|
||||
load(Net::Mode::Online);
|
||||
return getCurrentTask();
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
VersionPtrRole
|
||||
};
|
||||
|
||||
shared_qobject_ptr<Task> getLoadTask() override;
|
||||
Task::Ptr getLoadTask() override;
|
||||
bool isLoaded() override;
|
||||
const BaseVersionPtr at(int i) const override;
|
||||
int count() const override;
|
||||
|
@ -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...
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -340,7 +340,7 @@ void PackProfile::reload(Net::Mode netmode)
|
||||
}
|
||||
}
|
||||
|
||||
shared_qobject_ptr<Task> PackProfile::getCurrentTask()
|
||||
Task::Ptr PackProfile::getCurrentTask()
|
||||
{
|
||||
return d->m_updateTask;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -90,7 +90,7 @@ bool LegacyInstance::shouldUseCustomBaseJar() const
|
||||
}
|
||||
|
||||
|
||||
shared_qobject_ptr<Task> LegacyInstance::createUpdateTask(Net::Mode)
|
||||
Task::Ptr LegacyInstance::createUpdateTask(Net::Mode)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -4,7 +4,7 @@ SequentialTask::SequentialTask(QObject *parent) : Task(parent), m_currentIndex(-
|
||||
{
|
||||
}
|
||||
|
||||
void SequentialTask::addTask(shared_qobject_ptr<Task> 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<Task> 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<Task> 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)));
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
explicit SequentialTask(QObject *parent = 0);
|
||||
virtual ~SequentialTask() {};
|
||||
|
||||
void addTask(shared_qobject_ptr<Task> task);
|
||||
void addTask(Task::Ptr task);
|
||||
|
||||
protected:
|
||||
void executeTask();
|
||||
@ -25,6 +25,6 @@ slots:
|
||||
void subTaskProgress(qint64 current, qint64 total);
|
||||
|
||||
private:
|
||||
QQueue<shared_qobject_ptr<Task> > m_queue;
|
||||
QQueue<Task::Ptr > m_queue;
|
||||
int m_currentIndex;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user