Changed: New done() signal to go to next step

This commit is contained in:
kervala 2016-05-14 18:52:09 +02:00
parent 6370c08da5
commit d2bbbaf134
4 changed files with 30 additions and 2 deletions

View file

@ -460,6 +460,7 @@ bool CArchive::copyFiles(const FilesToCopy &files)
}
emit extractSuccess(totalSize);
emit done();
return true;
}
@ -619,6 +620,7 @@ bool CArchive::extract7z()
{
case SZ_OK:
emit extractSuccess(totalUncompressed);
emit done();
return true;
case SZ_ERROR_INTERRUPTED:
@ -720,6 +722,7 @@ bool CArchive::extractZip()
}
emit extractSuccess(totalSize);
emit done();
return true;
}
@ -744,6 +747,7 @@ bool CArchive::progress(const std::string &filename, uint32 currentSize, uint32
if (currentSize == totalSize)
{
emit extractSuccess((qint64)totalSize);
emit done();
}
return true;

View file

@ -61,6 +61,9 @@ signals:
// emitted when an error occurs
void extractFail(const QString &error);
// emitted when done and should process next step
void done();
protected:
struct FileToCopy

View file

@ -68,6 +68,7 @@ CMainWindow::CMainWindow():QMainWindow(), m_archive(NULL), m_statusLabel(NULL)
connect(m_archive, SIGNAL(extractProgress(qint64, QString)), SLOT(onExtractProgress(qint64, QString)));
connect(m_archive, SIGNAL(extractSuccess(qint64)), SLOT(onExtractSuccess(qint64)));
connect(m_archive, SIGNAL(extractFail(QString)), SLOT(onExtractFail(QString)));
connect(m_archive, SIGNAL(done()), SLOT(onDone()));
connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles()));
@ -122,6 +123,7 @@ void CMainWindow::processNextStep()
case CConfigFile::ExtractDownloadedClient:
displayProgressBar();
// TODO
break;
case CConfigFile::CopyServerFiles:
@ -145,11 +147,15 @@ void CMainWindow::processNextStep()
break;
case CConfigFile::CreateProfile:
displayProgressBar();
hideProgressBar();
config->createDefaultProfile();
onDone();
break;
case CConfigFile::CreateShortcuts:
displayProgressBar();
hideProgressBar();
config->createDefaultShortcuts();
onDone();
break;
default:
@ -170,6 +176,15 @@ void CMainWindow::displayProgressBar()
stopButton->setVisible(false);
}
void CMainWindow::hideProgressBar()
{
downloadFrame->setVisible(false);
configurationFrame->setVisible(false);
resumeButton->setVisible(false);
stopButton->setVisible(false);
}
void CMainWindow::displayConfigurationsChoices()
{
downloadFrame->setVisible(false);
@ -421,6 +436,8 @@ void CMainWindow::onExtractSuccess(qint64 total)
stopButton->setVisible(false);
}
void CMainWindow::onDone()
{
processNextStep();
}

View file

@ -66,6 +66,8 @@ public slots:
void onExtractSuccess(qint64 total);
void onExtractFail(const QString &error);
void onDone();
protected:
void showEvent(QShowEvent *e);
void closeEvent(QCloseEvent *e);
@ -73,6 +75,8 @@ protected:
void processNextStep();
void displayProgressBar();
void hideProgressBar();
void displayConfigurationsChoices();
QWinTaskbarButton *m_button;