diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-07-26 17:55:29 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-07-26 17:55:29 +0200 |
commit | d8caab515aa641ec901592d40b5d30c6dfd282f5 (patch) | |
tree | 612b322374083309027204b656d4dc0a78780de8 /logic/launch | |
parent | 6310f6569c2630f27ad72dc0a5fef9f9fec5a88c (diff) | |
download | MultiMC-d8caab515aa641ec901592d40b5d30c6dfd282f5.tar MultiMC-d8caab515aa641ec901592d40b5d30c6dfd282f5.tar.gz MultiMC-d8caab515aa641ec901592d40b5d30c6dfd282f5.tar.lz MultiMC-d8caab515aa641ec901592d40b5d30c6dfd282f5.tar.xz MultiMC-d8caab515aa641ec901592d40b5d30c6dfd282f5.zip |
GH-1053 add back update progress dialog
Diffstat (limited to 'logic/launch')
-rw-r--r-- | logic/launch/LaunchStep.cpp | 1 | ||||
-rw-r--r-- | logic/launch/LaunchStep.h | 1 | ||||
-rw-r--r-- | logic/launch/LaunchTask.cpp | 6 | ||||
-rw-r--r-- | logic/launch/LaunchTask.h | 5 | ||||
-rw-r--r-- | logic/launch/steps/LaunchMinecraft.cpp (renamed from logic/launch/steps/LaunchCommand.cpp) | 18 | ||||
-rw-r--r-- | logic/launch/steps/LaunchMinecraft.h (renamed from logic/launch/steps/LaunchCommand.h) | 4 | ||||
-rw-r--r-- | logic/launch/steps/Update.cpp | 11 | ||||
-rw-r--r-- | logic/launch/steps/Update.h | 1 |
8 files changed, 34 insertions, 13 deletions
diff --git a/logic/launch/LaunchStep.cpp b/logic/launch/LaunchStep.cpp index 9799d767..3078043b 100644 --- a/logic/launch/LaunchStep.cpp +++ b/logic/launch/LaunchStep.cpp @@ -23,4 +23,5 @@ void LaunchStep::bind(LaunchTask *parent) connect(this, &LaunchStep::logLine, parent, &LaunchTask::onLogLine); connect(this, &LaunchStep::logLines, parent, &LaunchTask::onLogLines); connect(this, &LaunchStep::finished, parent, &LaunchTask::onStepFinished); + connect(this, &LaunchStep::progressReportingRequest, parent, &LaunchTask::onProgressReportingRequested); } diff --git a/logic/launch/LaunchStep.h b/logic/launch/LaunchStep.h index 9b9631cb..ea472c0d 100644 --- a/logic/launch/LaunchStep.h +++ b/logic/launch/LaunchStep.h @@ -38,6 +38,7 @@ signals: void logLines(QStringList lines, MessageLevel::Enum level); void logLine(QString line, MessageLevel::Enum level); void readyForLaunch(); + void progressReportingRequest(); public slots: virtual void proceed() {}; diff --git a/logic/launch/LaunchTask.cpp b/logic/launch/LaunchTask.cpp index 66502020..1defeba3 100644 --- a/logic/launch/LaunchTask.cpp +++ b/logic/launch/LaunchTask.cpp @@ -103,6 +103,12 @@ void LaunchTask::onStepFinished() } } +void LaunchTask::onProgressReportingRequested() +{ + state = LaunchTask::Waiting; + emit requestProgress(m_steps[currentStep].get()); +} + void LaunchTask::setCensorFilter(QMap<QString, QString> filter) { m_censorFilter = filter; diff --git a/logic/launch/LaunchTask.h b/logic/launch/LaunchTask.h index 24139ea8..bd0485c8 100644 --- a/logic/launch/LaunchTask.h +++ b/logic/launch/LaunchTask.h @@ -92,6 +92,10 @@ signals: */ void readyForLaunch(); + void requestProgress(Task *task); + + void requestLogging(); + /** * @brief emitted when we want to log something * @param text the text to log @@ -104,6 +108,7 @@ public slots: void onLogLine(QString line, MessageLevel::Enum defaultLevel = MessageLevel::MultiMC); void onReadyForLaunch(); void onStepFinished(); + void onProgressReportingRequested(); protected: /* data */ InstancePtr m_instance; diff --git a/logic/launch/steps/LaunchCommand.cpp b/logic/launch/steps/LaunchMinecraft.cpp index 2cbb3785..f01a584d 100644 --- a/logic/launch/steps/LaunchCommand.cpp +++ b/logic/launch/steps/LaunchMinecraft.cpp @@ -13,18 +13,18 @@ * limitations under the License. */ -#include "LaunchCommand.h" +#include "LaunchMinecraft.h" #include <launch/LaunchTask.h> #include <minecraft/OneSixInstance.h> #include <QStandardPaths> -LaunchCommand::LaunchCommand(LaunchTask *parent) : LaunchStep(parent) +LaunchMinecraft::LaunchMinecraft(LaunchTask *parent) : LaunchStep(parent) { - connect(&m_process, &LoggedProcess::log, this, &LaunchCommand::logLines); - connect(&m_process, &LoggedProcess::stateChanged, this, &LaunchCommand::on_state); + connect(&m_process, &LoggedProcess::log, this, &LaunchMinecraft::logLines); + connect(&m_process, &LoggedProcess::stateChanged, this, &LaunchMinecraft::on_state); } -void LaunchCommand::executeTask() +void LaunchMinecraft::executeTask() { auto instance = m_parent->instance(); std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance); @@ -58,7 +58,7 @@ void LaunchCommand::executeTask() } } -void LaunchCommand::on_state(LoggedProcess::State state) +void LaunchMinecraft::on_state(LoggedProcess::State state) { switch(state) { @@ -103,12 +103,12 @@ void LaunchCommand::on_state(LoggedProcess::State state) } } -void LaunchCommand::setWorkingDirectory(const QString &wd) +void LaunchMinecraft::setWorkingDirectory(const QString &wd) { m_process.setWorkingDirectory(wd); } -void LaunchCommand::proceed() +void LaunchMinecraft::proceed() { if(mayProceed) { @@ -118,7 +118,7 @@ void LaunchCommand::proceed() } } -bool LaunchCommand::abort() +bool LaunchMinecraft::abort() { if(mayProceed) { diff --git a/logic/launch/steps/LaunchCommand.h b/logic/launch/steps/LaunchMinecraft.h index 4a631054..808ec33b 100644 --- a/logic/launch/steps/LaunchCommand.h +++ b/logic/launch/steps/LaunchMinecraft.h @@ -18,11 +18,11 @@ #include <launch/LaunchStep.h> #include <launch/LoggedProcess.h> -class LaunchCommand: public LaunchStep +class LaunchMinecraft: public LaunchStep { Q_OBJECT public: - explicit LaunchCommand(LaunchTask *parent); + explicit LaunchMinecraft(LaunchTask *parent); virtual void executeTask(); virtual bool abort(); virtual void proceed(); diff --git a/logic/launch/steps/Update.cpp b/logic/launch/steps/Update.cpp index 069b4f41..4901f001 100644 --- a/logic/launch/steps/Update.cpp +++ b/logic/launch/steps/Update.cpp @@ -22,12 +22,19 @@ void Update::executeTask() if(m_updateTask) { connect(m_updateTask.get(), SIGNAL(finished()), this, SLOT(updateFinished())); - m_updateTask->start(); + connect(m_updateTask.get(), &Task::progress, this, &Task::setProgress); + connect(m_updateTask.get(), &Task::status, this, &Task::setStatus); + emit progressReportingRequest(); return; } emitSucceeded(); } +void Update::proceed() +{ + m_updateTask->start(); +} + void Update::updateFinished() { if(m_updateTask->successful()) @@ -40,4 +47,4 @@ void Update::updateFinished() emit logLine(reason, MessageLevel::Fatal); emitFailed(reason); } -}
\ No newline at end of file +} diff --git a/logic/launch/steps/Update.h b/logic/launch/steps/Update.h index 3ad07264..14928253 100644 --- a/logic/launch/steps/Update.h +++ b/logic/launch/steps/Update.h @@ -32,6 +32,7 @@ public: { return false; } + virtual void proceed(); private slots: void updateFinished(); |