diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-07-10 01:11:06 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-07-10 01:11:06 +0200 |
commit | 8e7caf4e25dc3f56877a504c45d157860215496b (patch) | |
tree | 4ce3ea68190d4b693519ad6f76473b5b8f4da8be | |
parent | 5dd48e89f5a7facf8355641d0caf8deaec2a03ec (diff) | |
download | MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.tar MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.tar.gz MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.tar.lz MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.tar.xz MultiMC-8e7caf4e25dc3f56877a504c45d157860215496b.zip |
GH-1053 move launch related things and rename them
24 files changed, 91 insertions, 89 deletions
diff --git a/application/ConsoleWindow.cpp b/application/ConsoleWindow.cpp index 84140516..35bc9a8a 100644 --- a/application/ConsoleWindow.cpp +++ b/application/ConsoleWindow.cpp @@ -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); diff --git a/application/ConsoleWindow.h b/application/ConsoleWindow.h index 228b58e9..f9e4c89e 100644 --- a/application/ConsoleWindow.h +++ b/application/ConsoleWindow.h @@ -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; diff --git a/application/LaunchInteraction.cpp b/application/LaunchInteraction.cpp index ea966129..8ccc46a4 100644 --- a/application/LaunchInteraction.cpp +++ b/application/LaunchInteraction.cpp @@ -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(); diff --git a/application/LaunchInteraction.h b/application/LaunchInteraction.h index f62d5124..d64c3f6a 100644 --- a/application/LaunchInteraction.h +++ b/application/LaunchInteraction.h @@ -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; }; diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index bd50e06d..0747e442 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -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" diff --git a/application/pages/LogPage.cpp b/application/pages/LogPage.cpp index cdf6b345..77d5d6b8 100644 --- a/application/pages/LogPage.cpp +++ b/application/pages/LogPage.cpp @@ -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); diff --git a/application/pages/LogPage.h b/application/pages/LogPage.h index 0bd74846..f2cd90c3 100644 --- a/application/pages/LogPage.h +++ b/application/pages/LogPage.h @@ -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; diff --git a/logic/BaseInstance.h b/logic/BaseInstance.h index 720385c8..7152ba2d 100644 --- a/logic/BaseInstance.h +++ b/logic/BaseInstance.h @@ -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 diff --git a/logic/CMakeLists.txt b/logic/CMakeLists.txt index 3286b091..53715fa6 100644 --- a/logic/CMakeLists.txt +++ b/logic/CMakeLists.txt @@ -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 diff --git a/logic/NullInstance.h b/logic/NullInstance.h index 0927322e..bad4b4de 100644 --- a/logic/NullInstance.h +++ b/logic/NullInstance.h @@ -43,7 +43,7 @@ public: { return instanceRoot(); }; - virtual std::shared_ptr<BaseLauncher> createLaunchTask(AuthSessionPtr) + virtual std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr) { return nullptr; } diff --git a/logic/BaseLauncher.cpp b/logic/launch/LaunchTask.cpp index 4ab0c41a..83bbba97 100644 --- a/logic/BaseLauncher.cpp +++ b/logic/launch/LaunchTask.cpp @@ -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(); diff --git a/logic/BaseLauncher.h b/logic/launch/LaunchTask.h index f7b52c89..38142189 100644 --- a/logic/BaseLauncher.h +++ b/logic/launch/LaunchTask.h @@ -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() { diff --git a/logic/LoggedProcess.cpp b/logic/launch/LoggedProcess.cpp index 53840621..53840621 100644 --- a/logic/LoggedProcess.cpp +++ b/logic/launch/LoggedProcess.cpp diff --git a/logic/LoggedProcess.h b/logic/launch/LoggedProcess.h index 253be2c1..253be2c1 100644 --- a/logic/LoggedProcess.h +++ b/logic/launch/LoggedProcess.h diff --git a/logic/MessageLevel.cpp b/logic/launch/MessageLevel.cpp index a5191290..a5191290 100644 --- a/logic/MessageLevel.cpp +++ b/logic/launch/MessageLevel.cpp diff --git a/logic/MessageLevel.h b/logic/launch/MessageLevel.h index 0128148d..0128148d 100644 --- a/logic/MessageLevel.h +++ b/logic/launch/MessageLevel.h diff --git a/logic/minecraft/LegacyInstance.cpp b/logic/minecraft/LegacyInstance.cpp index 8431c35b..0991b7b5 100644 --- a/logic/minecraft/LegacyInstance.cpp +++ b/logic/minecraft/LegacyInstance.cpp @@ -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); diff --git a/logic/minecraft/LegacyInstance.h b/logic/minecraft/LegacyInstance.h index 51871876..0930c290 100644 --- a/logic/minecraft/LegacyInstance.h +++ b/logic/minecraft/LegacyInstance.h @@ -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; diff --git a/logic/minecraft/OneSixInstance.cpp b/logic/minecraft/OneSixInstance.cpp index 4af56b54..d66236f4 100644 --- a/logic/minecraft/OneSixInstance.cpp +++ b/logic/minecraft/OneSixInstance.cpp @@ -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); diff --git a/logic/minecraft/OneSixInstance.h b/logic/minecraft/OneSixInstance.h index 46545462..42902366 100644 --- a/logic/minecraft/OneSixInstance.h +++ b/logic/minecraft/OneSixInstance.h @@ -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; diff --git a/logic/tools/BaseProfiler.cpp b/logic/tools/BaseProfiler.cpp index 42ed1d93..5ff0fa44 100644 --- a/logic/tools/BaseProfiler.cpp +++ b/logic/tools/BaseProfiler.cpp @@ -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); } diff --git a/logic/tools/BaseProfiler.h b/logic/tools/BaseProfiler.h index 709c7cb4..5191f7b8 100644 --- a/logic/tools/BaseProfiler.h +++ b/logic/tools/BaseProfiler.h @@ -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: diff --git a/logic/tools/JProfiler.cpp b/logic/tools/JProfiler.cpp index 975345d5..45b33f79 100644 --- a/logic/tools/JProfiler.cpp +++ b/logic/tools/JProfiler.cpp @@ -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); diff --git a/logic/tools/JVisualVM.cpp b/logic/tools/JVisualVM.cpp index a749012b..169967d9 100644 --- a/logic/tools/JVisualVM.cpp +++ b/logic/tools/JVisualVM.cpp @@ -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 = |