From 1d468ac35ad88d8c77cc83f25e3704d9bd7df01b Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Wed, 2 Aug 2023 18:35:35 +0200 Subject: chore: reformat Signed-off-by: Sefa Eyeoglu --- launcher/launch/steps/CheckJava.cpp | 67 +++++++++++---------------- launcher/launch/steps/CheckJava.h | 24 ++++------ launcher/launch/steps/LookupServerAddress.cpp | 41 ++++++++-------- launcher/launch/steps/LookupServerAddress.h | 27 +++++------ launcher/launch/steps/PostLaunchCommand.cpp | 30 ++++-------- launcher/launch/steps/PostLaunchCommand.h | 22 ++++----- launcher/launch/steps/PreLaunchCommand.cpp | 30 ++++-------- launcher/launch/steps/PreLaunchCommand.h | 22 ++++----- launcher/launch/steps/QuitAfterGameStop.h | 14 ++---- launcher/launch/steps/TextPrint.cpp | 4 +- launcher/launch/steps/TextPrint.h | 13 +++--- launcher/launch/steps/Update.cpp | 23 +++------ launcher/launch/steps/Update.h | 19 ++++---- 13 files changed, 135 insertions(+), 201 deletions(-) (limited to 'launcher/launch/steps') diff --git a/launcher/launch/steps/CheckJava.cpp b/launcher/launch/steps/CheckJava.cpp index 7d697ba9..7fd8fc33 100644 --- a/launcher/launch/steps/CheckJava.cpp +++ b/launcher/launch/steps/CheckJava.cpp @@ -34,12 +34,12 @@ */ #include "CheckJava.h" -#include "java/JavaUtils.h" -#include #include -#include -#include +#include #include +#include +#include +#include "java/JavaUtils.h" void CheckJava::executeTask() { @@ -49,32 +49,26 @@ void CheckJava::executeTask() bool perInstance = settings->get("OverrideJava").toBool() || settings->get("OverrideJavaLocation").toBool(); auto realJavaPath = QStandardPaths::findExecutable(m_javaPath); - if (realJavaPath.isEmpty()) - { - if (perInstance) - { - emit logLine( - QString("The java binary \"%1\" couldn't be found. Please fix the java path " - "override in the instance's settings or disable it.").arg(m_javaPath), - MessageLevel::Warning); - } - else - { + if (realJavaPath.isEmpty()) { + if (perInstance) { + emit logLine(QString("The java binary \"%1\" couldn't be found. Please fix the java path " + "override in the instance's settings or disable it.") + .arg(m_javaPath), + MessageLevel::Warning); + } else { emit logLine(QString("The java binary \"%1\" couldn't be found. Please set up java in " - "the settings.").arg(m_javaPath), + "the settings.") + .arg(m_javaPath), MessageLevel::Warning); } emitFailed(QString("Java path is not valid.")); return; - } - else - { + } else { emit logLine("Java path is:\n" + m_javaPath + "\n\n", MessageLevel::Launcher); } - if (JavaUtils::getJavaCheckPath().isEmpty()) - { - const char *reason = QT_TR_NOOP("Java checker library could not be found. Please check your installation."); + if (JavaUtils::getJavaCheckPath().isEmpty()) { + const char* reason = QT_TR_NOOP("Java checker library could not be found. Please check your installation."); emit logLine(tr(reason), MessageLevel::Fatal); emitFailed(tr(reason)); return; @@ -94,19 +88,15 @@ void CheckJava::executeTask() m_javaSignature = hash.result().toHex(); // if timestamps are not the same, or something is missing, check! - if (m_javaSignature != storedSignature || storedVersion.size() == 0 - || storedArchitecture.size() == 0 || storedRealArchitecture.size() == 0 - || storedVendor.size() == 0) - { + if (m_javaSignature != storedSignature || storedVersion.size() == 0 || storedArchitecture.size() == 0 || + storedRealArchitecture.size() == 0 || storedVendor.size() == 0) { m_JavaChecker.reset(new JavaChecker); emit logLine(QString("Checking Java version..."), MessageLevel::Launcher); connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this, &CheckJava::checkJavaFinished); m_JavaChecker->m_path = realJavaPath; m_JavaChecker->performCheck(); return; - } - else - { + } else { auto verString = instance->settings()->get("JavaVersion").toString(); auto archString = instance->settings()->get("JavaArchitecture").toString(); auto realArchString = settings->get("JavaRealArchitecture").toString(); @@ -118,10 +108,8 @@ void CheckJava::executeTask() void CheckJava::checkJavaFinished(JavaCheckResult result) { - switch (result.validity) - { - case JavaCheckResult::Validity::Errored: - { + switch (result.validity) { + case JavaCheckResult::Validity::Errored: { // Error message displayed if java can't start emit logLine(QString("Could not start java:"), MessageLevel::Error); emit logLines(result.errorLog.split('\n'), MessageLevel::Error); @@ -129,16 +117,14 @@ void CheckJava::checkJavaFinished(JavaCheckResult result) emitFailed(QString("Could not start java!")); return; } - case JavaCheckResult::Validity::ReturnedInvalidData: - { + case JavaCheckResult::Validity::ReturnedInvalidData: { emit logLine(QString("Java checker returned some invalid data we don't understand:"), MessageLevel::Error); emit logLines(result.outLog.split('\n'), MessageLevel::Warning); emit logLine("\nMinecraft might not start properly.", MessageLevel::Launcher); emitSucceeded(); return; } - case JavaCheckResult::Validity::Valid: - { + case JavaCheckResult::Validity::Valid: { auto instance = m_parent->instance(); printJavaInfo(result.javaVersion.toString(), result.mojangPlatform, result.realPlatform, result.javaVendor); instance->settings()->set("JavaVersion", result.javaVersion.toString()); @@ -152,8 +138,9 @@ void CheckJava::checkJavaFinished(JavaCheckResult result) } } -void CheckJava::printJavaInfo(const QString& version, const QString& architecture, const QString& realArchitecture, const QString & vendor) +void CheckJava::printJavaInfo(const QString& version, const QString& architecture, const QString& realArchitecture, const QString& vendor) { - emit logLine(QString("Java is version %1, using %2 (%3) architecture, from %4.\n\n") - .arg(version, architecture, realArchitecture, vendor), MessageLevel::Launcher); + emit logLine( + QString("Java is version %1, using %2 (%3) architecture, from %4.\n\n").arg(version, architecture, realArchitecture, vendor), + MessageLevel::Launcher); } diff --git a/launcher/launch/steps/CheckJava.h b/launcher/launch/steps/CheckJava.h index bbf06b7c..4436e2a5 100644 --- a/launcher/launch/steps/CheckJava.h +++ b/launcher/launch/steps/CheckJava.h @@ -15,30 +15,26 @@ #pragma once -#include #include #include +#include -class CheckJava: public LaunchStep -{ +class CheckJava : public LaunchStep { Q_OBJECT -public: - explicit CheckJava(LaunchTask *parent) :LaunchStep(parent){}; - virtual ~CheckJava() {}; + public: + explicit CheckJava(LaunchTask* parent) : LaunchStep(parent){}; + virtual ~CheckJava(){}; virtual void executeTask(); - virtual bool canAbort() const - { - return false; - } -private slots: + virtual bool canAbort() const { return false; } + private slots: void checkJavaFinished(JavaCheckResult result); -private: - void printJavaInfo(const QString & version, const QString & architecture, const QString & realArchitecture, const QString & vendor); + private: + void printJavaInfo(const QString& version, const QString& architecture, const QString& realArchitecture, const QString& vendor); void printSystemInfo(bool javaIsKnown, bool javaIs64bit); -private: + private: QString m_javaPath; QString m_javaSignature; JavaCheckerPtr m_JavaChecker; diff --git a/launcher/launch/steps/LookupServerAddress.cpp b/launcher/launch/steps/LookupServerAddress.cpp index c7b8cea4..9bdac203 100644 --- a/launcher/launch/steps/LookupServerAddress.cpp +++ b/launcher/launch/steps/LookupServerAddress.cpp @@ -13,20 +13,18 @@ * limitations under the License. */ - #include "LookupServerAddress.h" #include -LookupServerAddress::LookupServerAddress(LaunchTask *parent) : - LaunchStep(parent), m_dnsLookup(new QDnsLookup(this)) +LookupServerAddress::LookupServerAddress(LaunchTask* parent) : LaunchStep(parent), m_dnsLookup(new QDnsLookup(this)) { connect(m_dnsLookup, &QDnsLookup::finished, this, &LookupServerAddress::on_dnsLookupFinished); m_dnsLookup->setType(QDnsLookup::SRV); } -void LookupServerAddress::setLookupAddress(const QString &lookupAddress) +void LookupServerAddress::setLookupAddress(const QString& lookupAddress) { m_lookupAddress = lookupAddress; m_dnsLookup->setName(QString("_minecraft._tcp.%1").arg(lookupAddress)); @@ -51,41 +49,40 @@ void LookupServerAddress::executeTask() void LookupServerAddress::on_dnsLookupFinished() { - if (isFinished()) - { + if (isFinished()) { // Aborted return; } - if (m_dnsLookup->error() != QDnsLookup::NoError) - { + if (m_dnsLookup->error() != QDnsLookup::NoError) { emit logLine(QString("Failed to resolve server address (this is NOT an error!) %1: %2\n") - .arg(m_dnsLookup->name(), m_dnsLookup->errorString()), MessageLevel::Launcher); - resolve(m_lookupAddress, 25565); // Technically the task failed, however, we don't abort the launch - // and leave it up to minecraft to fail (or maybe not) when connecting + .arg(m_dnsLookup->name(), m_dnsLookup->errorString()), + MessageLevel::Launcher); + resolve(m_lookupAddress, 25565); // Technically the task failed, however, we don't abort the launch + // and leave it up to minecraft to fail (or maybe not) when connecting return; } const auto records = m_dnsLookup->serviceRecords(); - if (records.empty()) - { - emit logLine( - QString("Failed to resolve server address %1: the DNS lookup succeeded, but no records were returned.\n") - .arg(m_dnsLookup->name()), MessageLevel::Warning); - resolve(m_lookupAddress, 25565); // Technically the task failed, however, we don't abort the launch - // and leave it up to minecraft to fail (or maybe not) when connecting + if (records.empty()) { + emit logLine(QString("Failed to resolve server address %1: the DNS lookup succeeded, but no records were returned.\n") + .arg(m_dnsLookup->name()), + MessageLevel::Warning); + resolve(m_lookupAddress, 25565); // Technically the task failed, however, we don't abort the launch + // and leave it up to minecraft to fail (or maybe not) when connecting return; } - const auto &firstRecord = records.at(0); + const auto& firstRecord = records.at(0); quint16 port = firstRecord.port(); - emit logLine(QString("Resolved server address %1 to %2 with port %3\n").arg( - m_dnsLookup->name(), firstRecord.target(), QString::number(port)),MessageLevel::Launcher); + emit logLine( + QString("Resolved server address %1 to %2 with port %3\n").arg(m_dnsLookup->name(), firstRecord.target(), QString::number(port)), + MessageLevel::Launcher); resolve(firstRecord.target(), port); } -void LookupServerAddress::resolve(const QString &address, quint16 port) +void LookupServerAddress::resolve(const QString& address, quint16 port) { m_output->address = address; m_output->port = port; diff --git a/launcher/launch/steps/LookupServerAddress.h b/launcher/launch/steps/LookupServerAddress.h index 5a5c3de1..abd92a5e 100644 --- a/launcher/launch/steps/LookupServerAddress.h +++ b/launcher/launch/steps/LookupServerAddress.h @@ -15,35 +15,32 @@ #pragma once -#include #include +#include #include #include "minecraft/launch/MinecraftServerTarget.h" -class LookupServerAddress: public LaunchStep { -Q_OBJECT -public: - explicit LookupServerAddress(LaunchTask *parent); - virtual ~LookupServerAddress() {}; +class LookupServerAddress : public LaunchStep { + Q_OBJECT + public: + explicit LookupServerAddress(LaunchTask* parent); + virtual ~LookupServerAddress(){}; virtual void executeTask(); virtual bool abort(); - virtual bool canAbort() const - { - return true; - } + virtual bool canAbort() const { return true; } - void setLookupAddress(const QString &lookupAddress); + void setLookupAddress(const QString& lookupAddress); void setOutputAddressPtr(MinecraftServerTargetPtr output); -private slots: + private slots: void on_dnsLookupFinished(); -private: - void resolve(const QString &address, quint16 port); + private: + void resolve(const QString& address, quint16 port); - QDnsLookup *m_dnsLookup; + QDnsLookup* m_dnsLookup; QString m_lookupAddress; MinecraftServerTargetPtr m_output; }; diff --git a/launcher/launch/steps/PostLaunchCommand.cpp b/launcher/launch/steps/PostLaunchCommand.cpp index ccf07f22..2e59de63 100644 --- a/launcher/launch/steps/PostLaunchCommand.cpp +++ b/launcher/launch/steps/PostLaunchCommand.cpp @@ -36,7 +36,7 @@ #include "PostLaunchCommand.h" #include -PostLaunchCommand::PostLaunchCommand(LaunchTask *parent) : LaunchStep(parent) +PostLaunchCommand::PostLaunchCommand(LaunchTask* parent) : LaunchStep(parent) { auto instance = m_parent->instance(); m_command = instance->getPostExitCommand(); @@ -47,7 +47,7 @@ PostLaunchCommand::PostLaunchCommand(LaunchTask *parent) : LaunchStep(parent) void PostLaunchCommand::executeTask() { - //FIXME: where to put this? + // FIXME: where to put this? #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) auto args = QProcess::splitCommand(m_command); m_parent->substituteVariables(args); @@ -65,31 +65,22 @@ void PostLaunchCommand::executeTask() void PostLaunchCommand::on_state(LoggedProcess::State state) { - auto getError = [&]() - { - return tr("Post-Launch command failed with code %1.\n\n").arg(m_process.exitCode()); - }; - switch(state) - { + auto getError = [&]() { return tr("Post-Launch command failed with code %1.\n\n").arg(m_process.exitCode()); }; + switch (state) { case LoggedProcess::Aborted: case LoggedProcess::Crashed: - case LoggedProcess::FailedToStart: - { + case LoggedProcess::FailedToStart: { auto error = getError(); emit logLine(error, MessageLevel::Fatal); emitFailed(error); return; } - case LoggedProcess::Finished: - { - if(m_process.exitCode() != 0) - { + case LoggedProcess::Finished: { + if (m_process.exitCode() != 0) { auto error = getError(); emit logLine(error, MessageLevel::Fatal); emitFailed(error); - } - else - { + } else { emit logLine(tr("Post-Launch command ran successfully.\n\n"), MessageLevel::Launcher); emitSucceeded(); } @@ -99,7 +90,7 @@ void PostLaunchCommand::on_state(LoggedProcess::State state) } } -void PostLaunchCommand::setWorkingDirectory(const QString &wd) +void PostLaunchCommand::setWorkingDirectory(const QString& wd) { m_process.setWorkingDirectory(wd); } @@ -107,8 +98,7 @@ void PostLaunchCommand::setWorkingDirectory(const QString &wd) bool PostLaunchCommand::abort() { auto state = m_process.state(); - if (state == LoggedProcess::Running || state == LoggedProcess::Starting) - { + if (state == LoggedProcess::Running || state == LoggedProcess::Starting) { m_process.kill(); } return true; diff --git a/launcher/launch/steps/PostLaunchCommand.h b/launcher/launch/steps/PostLaunchCommand.h index ab4c494f..578433b8 100644 --- a/launcher/launch/steps/PostLaunchCommand.h +++ b/launcher/launch/steps/PostLaunchCommand.h @@ -15,27 +15,23 @@ #pragma once -#include #include +#include -class PostLaunchCommand: public LaunchStep -{ +class PostLaunchCommand : public LaunchStep { Q_OBJECT -public: - explicit PostLaunchCommand(LaunchTask *parent); - virtual ~PostLaunchCommand() {}; + public: + explicit PostLaunchCommand(LaunchTask* parent); + virtual ~PostLaunchCommand(){}; virtual void executeTask(); virtual bool abort(); - virtual bool canAbort() const - { - return true; - } - void setWorkingDirectory(const QString &wd); -private slots: + virtual bool canAbort() const { return true; } + void setWorkingDirectory(const QString& wd); + private slots: void on_state(LoggedProcess::State state); -private: + private: LoggedProcess m_process; QString m_command; }; diff --git a/launcher/launch/steps/PreLaunchCommand.cpp b/launcher/launch/steps/PreLaunchCommand.cpp index 0b0392cb..a7f36086 100644 --- a/launcher/launch/steps/PreLaunchCommand.cpp +++ b/launcher/launch/steps/PreLaunchCommand.cpp @@ -36,7 +36,7 @@ #include "PreLaunchCommand.h" #include -PreLaunchCommand::PreLaunchCommand(LaunchTask *parent) : LaunchStep(parent) +PreLaunchCommand::PreLaunchCommand(LaunchTask* parent) : LaunchStep(parent) { auto instance = m_parent->instance(); m_command = instance->getPreLaunchCommand(); @@ -47,7 +47,7 @@ PreLaunchCommand::PreLaunchCommand(LaunchTask *parent) : LaunchStep(parent) void PreLaunchCommand::executeTask() { - //FIXME: where to put this? + // FIXME: where to put this? #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) auto args = QProcess::splitCommand(m_command); m_parent->substituteVariables(args); @@ -65,31 +65,22 @@ void PreLaunchCommand::executeTask() void PreLaunchCommand::on_state(LoggedProcess::State state) { - auto getError = [&]() - { - return tr("Pre-Launch command failed with code %1.\n\n").arg(m_process.exitCode()); - }; - switch(state) - { + auto getError = [&]() { return tr("Pre-Launch command failed with code %1.\n\n").arg(m_process.exitCode()); }; + switch (state) { case LoggedProcess::Aborted: case LoggedProcess::Crashed: - case LoggedProcess::FailedToStart: - { + case LoggedProcess::FailedToStart: { auto error = getError(); emit logLine(error, MessageLevel::Fatal); emitFailed(error); return; } - case LoggedProcess::Finished: - { - if(m_process.exitCode() != 0) - { + case LoggedProcess::Finished: { + if (m_process.exitCode() != 0) { auto error = getError(); emit logLine(error, MessageLevel::Fatal); emitFailed(error); - } - else - { + } else { emit logLine(tr("Pre-Launch command ran successfully.\n\n"), MessageLevel::Launcher); emitSucceeded(); } @@ -99,7 +90,7 @@ void PreLaunchCommand::on_state(LoggedProcess::State state) } } -void PreLaunchCommand::setWorkingDirectory(const QString &wd) +void PreLaunchCommand::setWorkingDirectory(const QString& wd) { m_process.setWorkingDirectory(wd); } @@ -107,8 +98,7 @@ void PreLaunchCommand::setWorkingDirectory(const QString &wd) bool PreLaunchCommand::abort() { auto state = m_process.state(); - if (state == LoggedProcess::Running || state == LoggedProcess::Starting) - { + if (state == LoggedProcess::Running || state == LoggedProcess::Starting) { m_process.kill(); } return true; diff --git a/launcher/launch/steps/PreLaunchCommand.h b/launcher/launch/steps/PreLaunchCommand.h index dc069f71..10568ea3 100644 --- a/launcher/launch/steps/PreLaunchCommand.h +++ b/launcher/launch/steps/PreLaunchCommand.h @@ -15,27 +15,23 @@ #pragma once -#include "launch/LaunchStep.h" #include "LoggedProcess.h" +#include "launch/LaunchStep.h" -class PreLaunchCommand: public LaunchStep -{ +class PreLaunchCommand : public LaunchStep { Q_OBJECT -public: - explicit PreLaunchCommand(LaunchTask *parent); - virtual ~PreLaunchCommand() {}; + public: + explicit PreLaunchCommand(LaunchTask* parent); + virtual ~PreLaunchCommand(){}; virtual void executeTask(); virtual bool abort(); - virtual bool canAbort() const - { - return true; - } - void setWorkingDirectory(const QString &wd); -private slots: + virtual bool canAbort() const { return true; } + void setWorkingDirectory(const QString& wd); + private slots: void on_state(LoggedProcess::State state); -private: + private: LoggedProcess m_process; QString m_command; }; diff --git a/launcher/launch/steps/QuitAfterGameStop.h b/launcher/launch/steps/QuitAfterGameStop.h index 1ce14da9..5f5e6304 100644 --- a/launcher/launch/steps/QuitAfterGameStop.h +++ b/launcher/launch/steps/QuitAfterGameStop.h @@ -20,16 +20,12 @@ #include -class QuitAfterGameStop: public LaunchStep -{ +class QuitAfterGameStop : public LaunchStep { Q_OBJECT -public: - explicit QuitAfterGameStop(LaunchTask *parent) :LaunchStep(parent){}; - virtual ~QuitAfterGameStop() {}; + public: + explicit QuitAfterGameStop(LaunchTask* parent) : LaunchStep(parent){}; + virtual ~QuitAfterGameStop(){}; virtual void executeTask(); - virtual bool canAbort() const - { - return false; - } + virtual bool canAbort() const { return false; } }; diff --git a/launcher/launch/steps/TextPrint.cpp b/launcher/launch/steps/TextPrint.cpp index 0c1f320c..0dec35b7 100644 --- a/launcher/launch/steps/TextPrint.cpp +++ b/launcher/launch/steps/TextPrint.cpp @@ -1,11 +1,11 @@ #include "TextPrint.h" -TextPrint::TextPrint(LaunchTask * parent, const QStringList &lines, MessageLevel::Enum level) : LaunchStep(parent) +TextPrint::TextPrint(LaunchTask* parent, const QStringList& lines, MessageLevel::Enum level) : LaunchStep(parent) { m_lines = lines; m_level = level; } -TextPrint::TextPrint(LaunchTask *parent, const QString &line, MessageLevel::Enum level) : LaunchStep(parent) +TextPrint::TextPrint(LaunchTask* parent, const QString& line, MessageLevel::Enum level) : LaunchStep(parent) { m_lines.append(line); m_level = level; diff --git a/launcher/launch/steps/TextPrint.h b/launcher/launch/steps/TextPrint.h index 36fa7f9a..bd6c2856 100644 --- a/launcher/launch/steps/TextPrint.h +++ b/launcher/launch/steps/TextPrint.h @@ -15,27 +15,26 @@ #pragma once -#include #include #include +#include /* * FIXME: maybe do not export */ -class TextPrint: public LaunchStep -{ +class TextPrint : public LaunchStep { Q_OBJECT -public: - explicit TextPrint(LaunchTask *parent, const QStringList &lines, MessageLevel::Enum level); - explicit TextPrint(LaunchTask *parent, const QString &line, MessageLevel::Enum level); + public: + explicit TextPrint(LaunchTask* parent, const QStringList& lines, MessageLevel::Enum level); + explicit TextPrint(LaunchTask* parent, const QString& line, MessageLevel::Enum level); virtual ~TextPrint(){}; virtual void executeTask(); virtual bool canAbort() const; virtual bool abort(); -private: + private: QStringList m_lines; MessageLevel::Enum m_level; }; diff --git a/launcher/launch/steps/Update.cpp b/launcher/launch/steps/Update.cpp index 8df2bc67..f23c0bb4 100644 --- a/launcher/launch/steps/Update.cpp +++ b/launcher/launch/steps/Update.cpp @@ -18,14 +18,12 @@ void Update::executeTask() { - if(m_aborted) - { + if (m_aborted) { emitFailed(tr("Task aborted.")); return; } m_updateTask.reset(m_parent->instance()->createUpdateTask(m_mode)); - if(m_updateTask) - { + if (m_updateTask) { connect(m_updateTask.get(), &Task::finished, this, &Update::updateFinished); connect(m_updateTask.get(), &Task::progress, this, &Update::setProgress); connect(m_updateTask.get(), &Task::stepProgress, this, &Update::propagateStepProgress); @@ -44,13 +42,10 @@ void Update::proceed() void Update::updateFinished() { - if(m_updateTask->wasSuccessful()) - { + if (m_updateTask->wasSuccessful()) { m_updateTask.reset(); emitSucceeded(); - } - else - { + } else { QString reason = tr("Instance update failed because: %1\n\n").arg(m_updateTask->failReason()); m_updateTask.reset(); emit logLine(reason, MessageLevel::Fatal); @@ -60,21 +55,17 @@ void Update::updateFinished() bool Update::canAbort() const { - if(m_updateTask) - { + if (m_updateTask) { return m_updateTask->canAbort(); } return true; } - bool Update::abort() { m_aborted = true; - if(m_updateTask) - { - if(m_updateTask->canAbort()) - { + if (m_updateTask) { + if (m_updateTask->canAbort()) { return m_updateTask->abort(); } } diff --git a/launcher/launch/steps/Update.h b/launcher/launch/steps/Update.h index ce40611e..9262cdbe 100644 --- a/launcher/launch/steps/Update.h +++ b/launcher/launch/steps/Update.h @@ -15,30 +15,29 @@ #pragma once -#include -#include #include +#include #include +#include #include // FIXME: stupid. should be defined by the instance type? or even completely abstracted away... -class Update: public LaunchStep -{ +class Update : public LaunchStep { Q_OBJECT -public: - explicit Update(LaunchTask *parent, Net::Mode mode):LaunchStep(parent), m_mode(mode) {}; - virtual ~Update() {}; + public: + explicit Update(LaunchTask* parent, Net::Mode mode) : LaunchStep(parent), m_mode(mode){}; + virtual ~Update(){}; void executeTask() override; bool canAbort() const override; void proceed() override; -public slots: + public slots: bool abort() override; -private slots: + private slots: void updateFinished(); -private: + private: Task::Ptr m_updateTask; bool m_aborted = false; Net::Mode m_mode = Net::Mode::Offline; -- cgit