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

This commit is contained in:
kervala 2016-05-14 18:52:09 +02:00
parent cee43e05df
commit c5a35e0828
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 extractSuccess(totalSize);
emit done();
return true; return true;
} }
@ -619,6 +620,7 @@ bool CArchive::extract7z()
{ {
case SZ_OK: case SZ_OK:
emit extractSuccess(totalUncompressed); emit extractSuccess(totalUncompressed);
emit done();
return true; return true;
case SZ_ERROR_INTERRUPTED: case SZ_ERROR_INTERRUPTED:
@ -720,6 +722,7 @@ bool CArchive::extractZip()
} }
emit extractSuccess(totalSize); emit extractSuccess(totalSize);
emit done();
return true; return true;
} }
@ -744,6 +747,7 @@ bool CArchive::progress(const std::string &filename, uint32 currentSize, uint32
if (currentSize == totalSize) if (currentSize == totalSize)
{ {
emit extractSuccess((qint64)totalSize); emit extractSuccess((qint64)totalSize);
emit done();
} }
return true; return true;

View file

@ -61,6 +61,9 @@ signals:
// emitted when an error occurs // emitted when an error occurs
void extractFail(const QString &error); void extractFail(const QString &error);
// emitted when done and should process next step
void done();
protected: protected:
struct FileToCopy 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(extractProgress(qint64, QString)), SLOT(onExtractProgress(qint64, QString)));
connect(m_archive, SIGNAL(extractSuccess(qint64)), SLOT(onExtractSuccess(qint64))); connect(m_archive, SIGNAL(extractSuccess(qint64)), SLOT(onExtractSuccess(qint64)));
connect(m_archive, SIGNAL(extractFail(QString)), SLOT(onExtractFail(QString))); connect(m_archive, SIGNAL(extractFail(QString)), SLOT(onExtractFail(QString)));
connect(m_archive, SIGNAL(done()), SLOT(onDone()));
connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles())); connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles()));
@ -122,6 +123,7 @@ void CMainWindow::processNextStep()
case CConfigFile::ExtractDownloadedClient: case CConfigFile::ExtractDownloadedClient:
displayProgressBar(); displayProgressBar();
// TODO
break; break;
case CConfigFile::CopyServerFiles: case CConfigFile::CopyServerFiles:
@ -145,11 +147,15 @@ void CMainWindow::processNextStep()
break; break;
case CConfigFile::CreateProfile: case CConfigFile::CreateProfile:
displayProgressBar(); hideProgressBar();
config->createDefaultProfile();
onDone();
break; break;
case CConfigFile::CreateShortcuts: case CConfigFile::CreateShortcuts:
displayProgressBar(); hideProgressBar();
config->createDefaultShortcuts();
onDone();
break; break;
default: default:
@ -170,6 +176,15 @@ void CMainWindow::displayProgressBar()
stopButton->setVisible(false); stopButton->setVisible(false);
} }
void CMainWindow::hideProgressBar()
{
downloadFrame->setVisible(false);
configurationFrame->setVisible(false);
resumeButton->setVisible(false);
stopButton->setVisible(false);
}
void CMainWindow::displayConfigurationsChoices() void CMainWindow::displayConfigurationsChoices()
{ {
downloadFrame->setVisible(false); downloadFrame->setVisible(false);
@ -421,6 +436,8 @@ void CMainWindow::onExtractSuccess(qint64 total)
stopButton->setVisible(false); stopButton->setVisible(false);
} }
void CMainWindow::onDone()
{
processNextStep(); processNextStep();
} }

View file

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