2015-07-05 00:54:30 +01:00
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
|
|
#include <BaseInstance.h>
|
|
|
|
#include <tools/BaseProfiler.h>
|
|
|
|
|
2016-08-06 14:39:29 +01:00
|
|
|
class InstanceWindow;
|
2015-10-23 23:57:54 +01:00
|
|
|
class LaunchController: public Task
|
2015-07-05 00:54:30 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-10-23 23:57:54 +01:00
|
|
|
virtual void executeTask();
|
|
|
|
|
2015-07-05 00:54:30 +01:00
|
|
|
LaunchController(QObject * parent = nullptr);
|
|
|
|
virtual ~LaunchController(){};
|
|
|
|
|
|
|
|
void setInstance(InstancePtr instance)
|
|
|
|
{
|
|
|
|
m_instance = instance;
|
|
|
|
}
|
2016-11-01 00:25:04 +00:00
|
|
|
InstancePtr instance()
|
|
|
|
{
|
|
|
|
return m_instance;
|
|
|
|
}
|
2015-07-05 00:54:30 +01:00
|
|
|
void setOnline(bool online)
|
|
|
|
{
|
|
|
|
m_online = online;
|
|
|
|
}
|
|
|
|
void setProfiler(BaseProfilerFactory *profiler)
|
|
|
|
{
|
|
|
|
m_profiler = profiler;
|
|
|
|
}
|
|
|
|
void setParentWidget(QWidget * widget)
|
|
|
|
{
|
|
|
|
m_parentWidget = widget;
|
|
|
|
}
|
2016-11-01 00:25:04 +00:00
|
|
|
QString id()
|
|
|
|
{
|
|
|
|
return m_instance->id();
|
|
|
|
}
|
2015-07-05 00:54:30 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void login();
|
|
|
|
void launchInstance();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void readyForLaunch();
|
|
|
|
|
2016-11-01 00:25:04 +00:00
|
|
|
void onSucceeded();
|
|
|
|
void onFailed(QString reason);
|
|
|
|
void onProgressRequested(Task *task);
|
|
|
|
|
2015-07-05 00:54:30 +01:00
|
|
|
private:
|
|
|
|
BaseProfilerFactory *m_profiler = nullptr;
|
|
|
|
bool m_online = true;
|
|
|
|
InstancePtr m_instance;
|
|
|
|
QWidget * m_parentWidget = nullptr;
|
2016-08-06 14:39:29 +01:00
|
|
|
InstanceWindow *m_console = nullptr;
|
2015-07-05 00:54:30 +01:00
|
|
|
AuthSessionPtr m_session;
|
2015-07-10 00:11:06 +01:00
|
|
|
std::shared_ptr <LaunchTask> m_launcher;
|
2015-07-05 00:54:30 +01:00
|
|
|
};
|