GH-1053 add back update progress dialog

This commit is contained in:
Petr Mrázek
2015-07-26 17:55:29 +02:00
parent 6310f6569c
commit d8caab515a
35 changed files with 151 additions and 63 deletions

View File

@ -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)
{

View File

@ -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();

View File

@ -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);
}
}
}

View File

@ -32,6 +32,7 @@ public:
{
return false;
}
virtual void proceed();
private slots:
void updateFinished();