GH-1053 move launch related things and rename them
This commit is contained in:
		| @@ -53,8 +53,8 @@ private: | ||||
| 	BasePage * m_log_page; | ||||
| }; | ||||
|  | ||||
| ConsoleWindow::ConsoleWindow(std::shared_ptr<BaseLauncher> process, QWidget *parent) | ||||
| 	: QMainWindow(parent), m_proc(process) | ||||
| ConsoleWindow::ConsoleWindow(std::shared_ptr<LaunchTask> proc, QWidget *parent) | ||||
| 	: QMainWindow(parent), m_proc(proc) | ||||
| { | ||||
| 	MultiMCPlatform::fixWM_CLASS(this); | ||||
| 	setAttribute(Qt::WA_DeleteOnClose); | ||||
| @@ -129,8 +129,8 @@ ConsoleWindow::ConsoleWindow(std::shared_ptr<BaseLauncher> process, QWidget *par | ||||
| 	} | ||||
|  | ||||
| 	// Set up signal connections | ||||
| 	connect(m_proc.get(), &BaseLauncher::succeeded, this, &ConsoleWindow::onSucceeded); | ||||
| 	connect(m_proc.get(), &BaseLauncher::failed, this,  &ConsoleWindow::onFailed); | ||||
| 	connect(m_proc.get(), &LaunchTask::succeeded, this, &ConsoleWindow::onSucceeded); | ||||
| 	connect(m_proc.get(), &LaunchTask::failed, this,  &ConsoleWindow::onFailed); | ||||
|  | ||||
| 	setMayClose(false); | ||||
|  | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
|  | ||||
| #include <QMainWindow> | ||||
| #include <QSystemTrayIcon> | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
|  | ||||
| class QPushButton; | ||||
| class PageContainer; | ||||
| @@ -26,7 +26,7 @@ class ConsoleWindow : public QMainWindow | ||||
| 	Q_OBJECT | ||||
|  | ||||
| public: | ||||
| 	explicit ConsoleWindow(std::shared_ptr<BaseLauncher> proc, QWidget *parent = 0); | ||||
| 	explicit ConsoleWindow(std::shared_ptr<LaunchTask> proc, QWidget *parent = 0); | ||||
| 	virtual ~ConsoleWindow(); | ||||
|  | ||||
| 	/** | ||||
| @@ -56,7 +56,7 @@ protected: | ||||
| 	void closeEvent(QCloseEvent *); | ||||
|  | ||||
| private: | ||||
| 	std::shared_ptr<BaseLauncher> m_proc; | ||||
| 	std::shared_ptr<LaunchTask> m_proc; | ||||
| 	bool m_mayclose = true; | ||||
| 	QSystemTrayIcon *m_trayIcon = nullptr; | ||||
| 	PageContainer *m_container = nullptr; | ||||
|   | ||||
| @@ -170,7 +170,7 @@ void LaunchController::launchInstance() | ||||
|  | ||||
| 	m_console = new ConsoleWindow(m_launcher); | ||||
| 	connect(m_console, &ConsoleWindow::isClosing, this, &LaunchController::instanceEnded); | ||||
| 	connect(m_launcher.get(), &BaseLauncher::readyForLaunch, this, &LaunchController::readyForLaunch); | ||||
| 	connect(m_launcher.get(), &LaunchTask::readyForLaunch, this, &LaunchController::readyForLaunch); | ||||
|  | ||||
| 	m_launcher->setHeader("MultiMC version: " + BuildConfig.printableVersionString() + "\n\n"); | ||||
| 	m_launcher->start(); | ||||
|   | ||||
| @@ -45,5 +45,5 @@ private: | ||||
| 	QWidget * m_parentWidget = nullptr; | ||||
| 	ConsoleWindow *m_console = nullptr; | ||||
| 	AuthSessionPtr m_session; | ||||
| 	std::shared_ptr <BaseLauncher> m_launcher; | ||||
| 	std::shared_ptr <LaunchTask> m_launcher; | ||||
| }; | ||||
|   | ||||
| @@ -368,7 +368,7 @@ namespace Ui { | ||||
| #include "Env.h" | ||||
|  | ||||
| #include "BaseInstance.h" | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
| #include "java/JavaUtils.h" | ||||
| #include "JavaCommon.h" | ||||
| #include "InstancePageProvider.h" | ||||
|   | ||||
| @@ -7,11 +7,11 @@ | ||||
| #include <QScrollBar> | ||||
| #include <QShortcut> | ||||
|  | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
| #include <settings/Setting.h> | ||||
| #include "GuiUtil.h" | ||||
|  | ||||
| LogPage::LogPage(std::shared_ptr<BaseLauncher> proc, QWidget *parent) | ||||
| LogPage::LogPage(std::shared_ptr<LaunchTask> proc, QWidget *parent) | ||||
| 	: QWidget(parent), ui(new Ui::LogPage), m_process(proc) | ||||
| { | ||||
| 	ui->setupUi(this); | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
| #include <QWidget> | ||||
|  | ||||
| #include "BaseInstance.h" | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
| #include "BasePage.h" | ||||
| #include <MultiMC.h> | ||||
|  | ||||
| @@ -33,7 +33,7 @@ class LogPage : public QWidget, public BasePage | ||||
| 	Q_OBJECT | ||||
|  | ||||
| public: | ||||
| 	explicit LogPage(std::shared_ptr<BaseLauncher> proc, QWidget *parent = 0); | ||||
| 	explicit LogPage(std::shared_ptr<LaunchTask> proc, QWidget *parent = 0); | ||||
| 	virtual ~LogPage(); | ||||
| 	virtual QString displayName() const override | ||||
| 	{ | ||||
| @@ -77,7 +77,7 @@ private slots: | ||||
|  | ||||
| private: | ||||
| 	Ui::LogPage *ui; | ||||
| 	std::shared_ptr<BaseLauncher> m_process; | ||||
| 	std::shared_ptr<LaunchTask> m_process; | ||||
| 	int m_last_scroll_value = 0; | ||||
| 	bool m_scroll_active = true; | ||||
| 	int m_saved_offset = 0; | ||||
|   | ||||
| @@ -27,7 +27,7 @@ | ||||
|  | ||||
| class QDir; | ||||
| class Task; | ||||
| class BaseLauncher; | ||||
| class LaunchTask; | ||||
| class BaseInstance; | ||||
|  | ||||
| // pointer for lazy people | ||||
| @@ -138,7 +138,7 @@ public: | ||||
| 	virtual std::shared_ptr<Task> createUpdateTask() = 0; | ||||
|  | ||||
| 	/// returns a valid launcher (task container) | ||||
| 	virtual std::shared_ptr<BaseLauncher> createLaunchTask(AuthSessionPtr account) = 0; | ||||
| 	virtual std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr account) = 0; | ||||
|  | ||||
| 	/*! | ||||
| 	 * Returns a task that should be done right before launch | ||||
|   | ||||
| @@ -8,13 +8,7 @@ set(LOGIC_SOURCES | ||||
| 	BaseVersionList.cpp | ||||
| 	InstanceList.h | ||||
| 	InstanceList.cpp | ||||
| 	LoggedProcess.h | ||||
| 	LoggedProcess.cpp | ||||
| 	MessageLevel.cpp | ||||
| 	MessageLevel.h | ||||
| 	BaseVersion.h | ||||
| 	BaseLauncher.h | ||||
| 	BaseLauncher.cpp | ||||
| 	BaseInstance.h | ||||
| 	BaseInstance.cpp | ||||
| 	NullInstance.h | ||||
| @@ -98,6 +92,14 @@ set(LOGIC_SOURCES | ||||
| 	auth/flows/ValidateTask.h | ||||
| 	auth/flows/ValidateTask.cpp | ||||
|  | ||||
| 	# Game launch logic | ||||
| 	launch/LoggedProcess.h | ||||
| 	launch/LoggedProcess.cpp | ||||
| 	launch/MessageLevel.cpp | ||||
| 	launch/MessageLevel.h | ||||
| 	launch/LaunchTask.h | ||||
| 	launch/LaunchTask.cpp | ||||
|  | ||||
| 	# Update system | ||||
| 	updater/GoUpdate.h | ||||
| 	updater/GoUpdate.cpp | ||||
|   | ||||
| @@ -43,7 +43,7 @@ public: | ||||
| 	{ | ||||
| 		return instanceRoot(); | ||||
| 	}; | ||||
| 	virtual std::shared_ptr<BaseLauncher> createLaunchTask(AuthSessionPtr) | ||||
| 	virtual std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr) | ||||
| 	{ | ||||
| 		return nullptr; | ||||
| 	} | ||||
|   | ||||
| @@ -15,7 +15,7 @@ | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
| #include "MessageLevel.h" | ||||
| #include "MMCStrings.h" | ||||
| #include "java/JavaChecker.h" | ||||
| @@ -30,7 +30,7 @@ | ||||
| 
 | ||||
| #define IBUS "@im=ibus" | ||||
| 
 | ||||
| void BaseLauncher::initializeEnvironment() | ||||
| void LaunchTask::initializeEnvironment() | ||||
| { | ||||
| 	// prepare the process environment
 | ||||
| 	QProcessEnvironment rawenv = QProcessEnvironment::systemEnvironment(); | ||||
| @@ -106,37 +106,37 @@ void BaseLauncher::initializeEnvironment() | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::init() | ||||
| void LaunchTask::init() | ||||
| { | ||||
| 	initializeEnvironment(); | ||||
| 
 | ||||
| 	m_process.setProcessEnvironment(m_env); | ||||
| 	connect(&m_process, &LoggedProcess::log, this, &BaseLauncher::on_log); | ||||
| 	connect(&m_process, &LoggedProcess::stateChanged, this, &BaseLauncher::on_state); | ||||
| 	connect(&m_process, &LoggedProcess::log, this, &LaunchTask::on_log); | ||||
| 	connect(&m_process, &LoggedProcess::stateChanged, this, &LaunchTask::on_state); | ||||
| 
 | ||||
| 	m_prelaunchprocess.setProcessEnvironment(m_env); | ||||
| 	connect(&m_prelaunchprocess, &LoggedProcess::log, this, &BaseLauncher::on_log); | ||||
| 	connect(&m_prelaunchprocess, &LoggedProcess::stateChanged, this, &BaseLauncher::on_pre_state); | ||||
| 	connect(&m_prelaunchprocess, &LoggedProcess::log, this, &LaunchTask::on_log); | ||||
| 	connect(&m_prelaunchprocess, &LoggedProcess::stateChanged, this, &LaunchTask::on_pre_state); | ||||
| 
 | ||||
| 	m_postlaunchprocess.setProcessEnvironment(m_env); | ||||
| 	connect(&m_postlaunchprocess, &LoggedProcess::log, this, &BaseLauncher::on_log); | ||||
| 	connect(&m_postlaunchprocess, &LoggedProcess::stateChanged, this, &BaseLauncher::on_post_state); | ||||
| 	connect(&m_postlaunchprocess, &LoggedProcess::log, this, &LaunchTask::on_log); | ||||
| 	connect(&m_postlaunchprocess, &LoggedProcess::stateChanged, this, &LaunchTask::on_post_state); | ||||
| 
 | ||||
| 	m_instance->setRunning(true); | ||||
| } | ||||
| 
 | ||||
| std::shared_ptr<BaseLauncher> BaseLauncher::create(MinecraftInstancePtr inst) | ||||
| std::shared_ptr<LaunchTask> LaunchTask::create(MinecraftInstancePtr inst) | ||||
| { | ||||
| 	std::shared_ptr<BaseLauncher> proc(new BaseLauncher(inst)); | ||||
| 	std::shared_ptr<LaunchTask> proc(new LaunchTask(inst)); | ||||
| 	proc->init(); | ||||
| 	return proc; | ||||
| } | ||||
| 
 | ||||
| BaseLauncher::BaseLauncher(InstancePtr instance): m_instance(instance) | ||||
| LaunchTask::LaunchTask(InstancePtr instance): m_instance(instance) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| QString BaseLauncher::censorPrivateInfo(QString in) | ||||
| QString LaunchTask::censorPrivateInfo(QString in) | ||||
| { | ||||
| 	if (!m_session) | ||||
| 		return in; | ||||
| @@ -159,7 +159,7 @@ QString BaseLauncher::censorPrivateInfo(QString in) | ||||
| } | ||||
| 
 | ||||
| // console window
 | ||||
| MessageLevel::Enum BaseLauncher::guessLevel(const QString &line, MessageLevel::Enum level) | ||||
| MessageLevel::Enum LaunchTask::guessLevel(const QString &line, MessageLevel::Enum level) | ||||
| { | ||||
| 	QRegularExpression re("\\[(?<timestamp>[0-9:]+)\\] \\[[^/]+/(?<level>[^\\]]+)\\]"); | ||||
| 	auto match = re.match(line); | ||||
| @@ -199,7 +199,7 @@ MessageLevel::Enum BaseLauncher::guessLevel(const QString &line, MessageLevel::E | ||||
| 	return level; | ||||
| } | ||||
| 
 | ||||
| QMap<QString, QString> BaseLauncher::getVariables() const | ||||
| QMap<QString, QString> LaunchTask::getVariables() const | ||||
| { | ||||
| 	auto mcInstance = std::dynamic_pointer_cast<MinecraftInstance>(m_instance); | ||||
| 	QMap<QString, QString> out; | ||||
| @@ -212,7 +212,7 @@ QMap<QString, QString> BaseLauncher::getVariables() const | ||||
| 	return out; | ||||
| } | ||||
| 
 | ||||
| QStringList BaseLauncher::javaArguments() const | ||||
| QStringList LaunchTask::javaArguments() const | ||||
| { | ||||
| 	QStringList args; | ||||
| 
 | ||||
| @@ -253,7 +253,7 @@ QStringList BaseLauncher::javaArguments() const | ||||
| 	return args; | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::checkJava() | ||||
| void LaunchTask::checkJava() | ||||
| { | ||||
| 	m_javaPath = m_instance->settings()->get("JavaPath").toString(); | ||||
| 	emit log("Java path is:\n" + m_javaPath + "\n\n"); | ||||
| @@ -278,14 +278,14 @@ void BaseLauncher::checkJava() | ||||
| 		QString errorLog; | ||||
| 		QString version; | ||||
| 		emit log(tr("Checking Java version..."), MessageLevel::MultiMC); | ||||
| 		connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this, &BaseLauncher::checkJavaFinished); | ||||
| 		connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this, &LaunchTask::checkJavaFinished); | ||||
| 		m_JavaChecker->m_path = realJavaPath; | ||||
| 		m_JavaChecker->performCheck(); | ||||
| 	} | ||||
| 	preLaunch(); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::checkJavaFinished(JavaCheckResult result) | ||||
| void LaunchTask::checkJavaFinished(JavaCheckResult result) | ||||
| { | ||||
| 	if(!result.valid) | ||||
| 	{ | ||||
| @@ -308,7 +308,7 @@ void BaseLauncher::checkJavaFinished(JavaCheckResult result) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::executeTask() | ||||
| void LaunchTask::executeTask() | ||||
| { | ||||
| 	printHeader(); | ||||
| 	emit log("Minecraft folder is:\n" + m_process.workingDirectory() + "\n\n"); | ||||
| @@ -316,20 +316,20 @@ void BaseLauncher::executeTask() | ||||
| 	checkJava(); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::launch() | ||||
| void LaunchTask::launch() | ||||
| { | ||||
| 	QString launchString("launch\n"); | ||||
| 	m_process.write(launchString.toUtf8()); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::abort() | ||||
| void LaunchTask::abort() | ||||
| { | ||||
| 	QString launchString("abort\n"); | ||||
| 	m_process.write(launchString.toUtf8()); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void BaseLauncher::setWorkdir(QString path) | ||||
| void LaunchTask::setWorkdir(QString path) | ||||
| { | ||||
| 	QDir mcDir(path); | ||||
| 	m_process.setWorkingDirectory(mcDir.absolutePath()); | ||||
| @@ -337,17 +337,17 @@ void BaseLauncher::setWorkdir(QString path) | ||||
| 	m_postlaunchprocess.setWorkingDirectory(mcDir.absolutePath()); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::printHeader() | ||||
| void LaunchTask::printHeader() | ||||
| { | ||||
| 	emit log(m_header); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::on_log(QStringList lines, MessageLevel::Enum level) | ||||
| void LaunchTask::on_log(QStringList lines, MessageLevel::Enum level) | ||||
| { | ||||
| 	logOutput(lines, level); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::logOutput(const QStringList &lines, MessageLevel::Enum defaultLevel) | ||||
| void LaunchTask::logOutput(const QStringList &lines, MessageLevel::Enum defaultLevel) | ||||
| { | ||||
| 	for (auto & line: lines) | ||||
| 	{ | ||||
| @@ -355,7 +355,7 @@ void BaseLauncher::logOutput(const QStringList &lines, MessageLevel::Enum defaul | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::logOutput(QString line, MessageLevel::Enum level) | ||||
| void LaunchTask::logOutput(QString line, MessageLevel::Enum level) | ||||
| { | ||||
| 	// if the launcher part set a log level, use it
 | ||||
| 	auto innerLevel = MessageLevel::fromLine(line); | ||||
| @@ -376,7 +376,7 @@ void BaseLauncher::logOutput(QString line, MessageLevel::Enum level) | ||||
| 	emit log(line, level); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::preLaunch() | ||||
| void LaunchTask::preLaunch() | ||||
| { | ||||
| 	QString prelaunch_cmd = m_instance->settings()->get("PreLaunchCommand").toString(); | ||||
| 	if (!prelaunch_cmd.isEmpty()) | ||||
| @@ -392,7 +392,7 @@ void BaseLauncher::preLaunch() | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::on_pre_state(LoggedProcess::State state) | ||||
| void LaunchTask::on_pre_state(LoggedProcess::State state) | ||||
| { | ||||
| 	switch(state) | ||||
| 	{ | ||||
| @@ -419,7 +419,7 @@ void BaseLauncher::on_pre_state(LoggedProcess::State state) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::updateInstance() | ||||
| void LaunchTask::updateInstance() | ||||
| { | ||||
| 	m_updateTask = m_instance->createUpdateTask(); | ||||
| 	if(m_updateTask) | ||||
| @@ -431,7 +431,7 @@ void BaseLauncher::updateInstance() | ||||
| 	makeReady(); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::updateFinished() | ||||
| void LaunchTask::updateFinished() | ||||
| { | ||||
| 	if(m_updateTask->successful()) | ||||
| 	{ | ||||
| @@ -445,7 +445,7 @@ void BaseLauncher::updateFinished() | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::doJarModding() | ||||
| void LaunchTask::doJarModding() | ||||
| { | ||||
| 	m_jarModTask = m_instance->createJarModdingTask(); | ||||
| 	if(!m_jarModTask) | ||||
| @@ -457,17 +457,17 @@ void BaseLauncher::doJarModding() | ||||
| 	m_jarModTask->start(); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::jarModdingSucceeded() | ||||
| void LaunchTask::jarModdingSucceeded() | ||||
| { | ||||
| 	makeReady(); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::jarModdingFailed(QString reason) | ||||
| void LaunchTask::jarModdingFailed(QString reason) | ||||
| { | ||||
| 	emitFailed(reason); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::makeReady() | ||||
| void LaunchTask::makeReady() | ||||
| { | ||||
| 	QStringList args = javaArguments(); | ||||
| 	QString allArgs = args.join(", "); | ||||
| @@ -511,7 +511,7 @@ void BaseLauncher::makeReady() | ||||
| 	emit readyForLaunch(); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::on_state(LoggedProcess::State state) | ||||
| void LaunchTask::on_state(LoggedProcess::State state) | ||||
| { | ||||
| 	QProcess::ExitStatus estat = QProcess::NormalExit; | ||||
| 	switch(state) | ||||
| @@ -543,7 +543,7 @@ void BaseLauncher::on_state(LoggedProcess::State state) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::killProcess() | ||||
| void LaunchTask::killProcess() | ||||
| { | ||||
| 	killed = true; | ||||
| 	if (m_prelaunchprocess.state() == LoggedProcess::Running) | ||||
| @@ -560,7 +560,7 @@ void BaseLauncher::killProcess() | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::postLaunch() | ||||
| void LaunchTask::postLaunch() | ||||
| { | ||||
| 	if(killed) | ||||
| 		return; | ||||
| @@ -575,7 +575,7 @@ void BaseLauncher::postLaunch() | ||||
| 	emitSucceeded(); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::on_post_state(LoggedProcess::State state) | ||||
| void LaunchTask::on_post_state(LoggedProcess::State state) | ||||
| { | ||||
| 	switch(state) | ||||
| 	{ | ||||
| @@ -600,21 +600,21 @@ void BaseLauncher::on_post_state(LoggedProcess::State state) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::emitSucceeded() | ||||
| void LaunchTask::emitSucceeded() | ||||
| { | ||||
| 	m_instance->cleanupAfterRun(); | ||||
| 	m_instance->setRunning(false); | ||||
| 	Task::emitSucceeded(); | ||||
| } | ||||
| 
 | ||||
| void BaseLauncher::emitFailed(QString reason) | ||||
| void LaunchTask::emitFailed(QString reason) | ||||
| { | ||||
| 	m_instance->cleanupAfterRun(); | ||||
| 	m_instance->setRunning(false); | ||||
| 	Task::emitFailed(reason); | ||||
| } | ||||
| 
 | ||||
| QString BaseLauncher::substituteVariables(const QString &cmd) const | ||||
| QString LaunchTask::substituteVariables(const QString &cmd) const | ||||
| { | ||||
| 	QString out = cmd; | ||||
| 	auto variables = getVariables(); | ||||
| @@ -630,7 +630,7 @@ QString BaseLauncher::substituteVariables(const QString &cmd) const | ||||
| 	return out; | ||||
| } | ||||
| 
 | ||||
| qint64 BaseLauncher::pid() | ||||
| qint64 LaunchTask::pid() | ||||
| { | ||||
| #ifdef Q_OS_WIN | ||||
| 	struct _PROCESS_INFORMATION *procinfo = m_process.pid(); | ||||
| @@ -32,16 +32,16 @@ class ProcessTask | ||||
| }; | ||||
| 
 | ||||
| class BaseProfilerFactory; | ||||
| class BaseLauncher: public Task | ||||
| class LaunchTask: public Task | ||||
| { | ||||
| 	Q_OBJECT | ||||
| protected: | ||||
| 	explicit BaseLauncher(InstancePtr instance); | ||||
| 	explicit LaunchTask(InstancePtr instance); | ||||
| 	void init(); | ||||
| 
 | ||||
| public: /* methods */ | ||||
| 	static std::shared_ptr<BaseLauncher> create(MinecraftInstancePtr inst); | ||||
| 	virtual ~BaseLauncher() {}; | ||||
| 	static std::shared_ptr<LaunchTask> create(MinecraftInstancePtr inst); | ||||
| 	virtual ~LaunchTask() {}; | ||||
| 
 | ||||
| 	InstancePtr instance() | ||||
| 	{ | ||||
| @@ -24,7 +24,7 @@ | ||||
|  | ||||
| #include "minecraft/LegacyUpdate.h" | ||||
| #include "icons/IconList.h" | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
| #include "minecraft/ModList.h" | ||||
| #include <MMCZip.h> | ||||
|  | ||||
| @@ -96,7 +96,7 @@ std::shared_ptr<Task> LegacyInstance::createUpdateTask() | ||||
| 	return std::shared_ptr<Task>(new LegacyUpdate(this, this)); | ||||
| } | ||||
|  | ||||
| std::shared_ptr<BaseLauncher> LegacyInstance::createLaunchTask(AuthSessionPtr account) | ||||
| std::shared_ptr<LaunchTask> LegacyInstance::createLaunchTask(AuthSessionPtr account) | ||||
| { | ||||
| 	QString launchScript; | ||||
| 	QIcon icon = ENV.icons()->getIcon(iconKey()); | ||||
| @@ -123,7 +123,7 @@ std::shared_ptr<BaseLauncher> LegacyInstance::createLaunchTask(AuthSessionPtr ac | ||||
| 		launchScript += "lwjgl " + lwjgl + "\n"; | ||||
| 		launchScript += "launcher legacy\n"; | ||||
| 	} | ||||
| 	auto process = BaseLauncher::create(std::dynamic_pointer_cast<MinecraftInstance>(getSharedPtr())); | ||||
| 	auto process = LaunchTask::create(std::dynamic_pointer_cast<MinecraftInstance>(getSharedPtr())); | ||||
| 	process->setLaunchScript(launchScript); | ||||
| 	process->setWorkdir(minecraftRoot()); | ||||
| 	process->setLogin(account); | ||||
|   | ||||
| @@ -111,7 +111,7 @@ public: | ||||
| 	virtual void setShouldUpdate(bool val) override; | ||||
| 	virtual std::shared_ptr<Task> createUpdateTask() override; | ||||
|  | ||||
| 	virtual std::shared_ptr<BaseLauncher> createLaunchTask(AuthSessionPtr account) override; | ||||
| 	virtual std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr account) override; | ||||
|  | ||||
| 	virtual std::shared_ptr<Task> createJarModdingTask() override; | ||||
|  | ||||
|   | ||||
| @@ -22,7 +22,7 @@ | ||||
| #include "minecraft/OneSixUpdate.h" | ||||
| #include "minecraft/MinecraftProfile.h" | ||||
| #include "minecraft/VersionBuildError.h" | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
| #include "minecraft/OneSixProfileStrategy.h" | ||||
| #include "MMCZip.h" | ||||
|  | ||||
| @@ -123,7 +123,7 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session) | ||||
| 	return parts; | ||||
| } | ||||
|  | ||||
| std::shared_ptr<BaseLauncher> OneSixInstance::createLaunchTask(AuthSessionPtr session) | ||||
| std::shared_ptr<LaunchTask> OneSixInstance::createLaunchTask(AuthSessionPtr session) | ||||
| { | ||||
| 	QString launchScript; | ||||
| 	QIcon icon = ENV.icons()->getIcon(iconKey()); | ||||
| @@ -230,7 +230,7 @@ std::shared_ptr<BaseLauncher> OneSixInstance::createLaunchTask(AuthSessionPtr se | ||||
| 	} | ||||
| 	launchScript += "launcher onesix\n"; | ||||
|  | ||||
| 	auto process = BaseLauncher::create(std::dynamic_pointer_cast<MinecraftInstance>(getSharedPtr())); | ||||
| 	auto process = LaunchTask::create(std::dynamic_pointer_cast<MinecraftInstance>(getSharedPtr())); | ||||
| 	process->setLaunchScript(launchScript); | ||||
| 	process->setWorkdir(minecraftRoot()); | ||||
| 	process->setLogin(session); | ||||
|   | ||||
| @@ -49,7 +49,7 @@ public: | ||||
| 	virtual QString instanceConfigFolder() const override; | ||||
|  | ||||
| 	virtual std::shared_ptr<Task> createUpdateTask() override; | ||||
| 	virtual std::shared_ptr<BaseLauncher> createLaunchTask(AuthSessionPtr account) override; | ||||
| 	virtual std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr account) override; | ||||
| 	virtual std::shared_ptr<Task> createJarModdingTask() override; | ||||
|  | ||||
| 	virtual void cleanupAfterRun() override; | ||||
|   | ||||
| @@ -7,7 +7,7 @@ BaseProfiler::BaseProfiler(SettingsObjectPtr settings, InstancePtr instance, QOb | ||||
| { | ||||
| } | ||||
|  | ||||
| void BaseProfiler::beginProfiling(std::shared_ptr<BaseLauncher> process) | ||||
| void BaseProfiler::beginProfiling(std::shared_ptr<LaunchTask> process) | ||||
| { | ||||
| 	beginProfilingImpl(process); | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|  | ||||
| class BaseInstance; | ||||
| class SettingsObject; | ||||
| class BaseLauncher; | ||||
| class LaunchTask; | ||||
| class QProcess; | ||||
|  | ||||
| class BaseProfiler : public BaseExternalTool | ||||
| @@ -15,13 +15,13 @@ public: | ||||
|  | ||||
| public | ||||
| slots: | ||||
| 	void beginProfiling(std::shared_ptr<BaseLauncher> process); | ||||
| 	void beginProfiling(std::shared_ptr<LaunchTask> process); | ||||
| 	void abortProfiling(); | ||||
|  | ||||
| protected: | ||||
| 	QProcess *m_profilerProcess; | ||||
|  | ||||
| 	virtual void beginProfilingImpl(std::shared_ptr<BaseLauncher> process) = 0; | ||||
| 	virtual void beginProfilingImpl(std::shared_ptr<LaunchTask> process) = 0; | ||||
| 	virtual void abortProfilingImpl(); | ||||
|  | ||||
| signals: | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| #include <QMessageBox> | ||||
|  | ||||
| #include "settings/SettingsObject.h" | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
| #include "BaseInstance.h" | ||||
|  | ||||
| class JProfiler : public BaseProfiler | ||||
| @@ -18,7 +18,7 @@ private slots: | ||||
| 	void profilerFinished(int exit, QProcess::ExitStatus status); | ||||
|  | ||||
| protected: | ||||
| 	void beginProfilingImpl(std::shared_ptr<BaseLauncher> process); | ||||
| 	void beginProfilingImpl(std::shared_ptr<LaunchTask> process); | ||||
|  | ||||
| private: | ||||
| 	int listeningPort = 0; | ||||
| @@ -48,7 +48,7 @@ void JProfiler::profilerFinished(int exit, QProcess::ExitStatus status) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void JProfiler::beginProfilingImpl(std::shared_ptr<BaseLauncher> process) | ||||
| void JProfiler::beginProfilingImpl(std::shared_ptr<LaunchTask> process) | ||||
| { | ||||
| 	listeningPort = globalSettings->get("JProfilerPort").toInt(); | ||||
| 	QProcess *profiler = new QProcess(this); | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| #include <QStandardPaths> | ||||
|  | ||||
| #include "settings/SettingsObject.h" | ||||
| #include "BaseLauncher.h" | ||||
| #include "launch/LaunchTask.h" | ||||
| #include "BaseInstance.h" | ||||
|  | ||||
| class JVisualVM : public BaseProfiler | ||||
| @@ -18,7 +18,7 @@ private slots: | ||||
| 	void profilerFinished(int exit, QProcess::ExitStatus status); | ||||
|  | ||||
| protected: | ||||
| 	void beginProfilingImpl(std::shared_ptr<BaseLauncher> process); | ||||
| 	void beginProfilingImpl(std::shared_ptr<LaunchTask> process); | ||||
| }; | ||||
|  | ||||
|  | ||||
| @@ -45,7 +45,7 @@ void JVisualVM::profilerFinished(int exit, QProcess::ExitStatus status) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void JVisualVM::beginProfilingImpl(std::shared_ptr<BaseLauncher> process) | ||||
| void JVisualVM::beginProfilingImpl(std::shared_ptr<LaunchTask> process) | ||||
| { | ||||
| 	QProcess *profiler = new QProcess(this); | ||||
| 	QStringList profilerArgs = | ||||
|   | ||||
		Reference in New Issue
	
	Block a user