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