From b952b51d05e5427ee006cb2abafc91f3877bd67d Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:39:39 +0200 Subject: [PATCH] Changed: Moved Operation steps enum --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 4 +- .../client/ryzom_installer/src/configfile.h | 31 +++-------- .../tools/client/ryzom_installer/src/main.cpp | 14 ++--- .../client/ryzom_installer/src/mainwindow.cpp | 4 +- .../client/ryzom_installer/src/operation.h | 30 +++++++++++ .../ryzom_installer/src/operationdialog.cpp | 51 +++++++++---------- .../ryzom_installer/src/operationdialog.h | 13 +---- 7 files changed, 74 insertions(+), 73 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 8815396f7..7367cddba 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -620,7 +620,7 @@ QString CConfigFile::getSrcServerClientBNPFullPath() const return QString("%1/unpack/exedll_%2.bnp").arg(getSrcServerDirectory()).arg(getClientArch()); } -CConfigFile::InstallationStep CConfigFile::getNextStep() const +OperationStep CConfigFile::getInstallNextStep() const { // get last used profile const CProfile &profile = getProfile(); @@ -712,7 +712,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const // selected directory contains Ryzom files (shouldn't fail) if (areRyzomDataInstalledIn(getSrcServerDirectory())) { - return CopyServerFiles; + return CopyDataFiles; } else { diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 67c1a5547..1122ca78e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -17,8 +17,11 @@ #ifndef CONFIGFILE_H #define CONFIGFILE_H -struct CServer +#include "operation.h" + +class CServer { +public: CServer() { dataCompressedSize = 0; @@ -45,8 +48,9 @@ extern const CServer NoServer; typedef QVector CServers; -struct CProfile +class CProfile { +public: CProfile() { desktopShortcut = false; @@ -78,27 +82,6 @@ class CConfigFile : public QObject Q_OBJECT public: - enum InstallationStep - { - DisplayNoServerError, - ShowInstallWizard, - ShowMigrateWizard, - DownloadData, - ExtractDownloadedData, - DownloadClient, - ExtractDownloadedClient, - CopyServerFiles, - CopyProfileFiles, - CleanFiles, - ExtractBnpClient, - CopyInstaller, - UninstallOldClient, - CreateProfile, - CreateShortcuts, - CreateAddRemoveEntry, - Done - }; - CConfigFile(QObject *parent = NULL); virtual ~CConfigFile(); @@ -180,7 +163,7 @@ public: QString getSrcServerClientBNPFullPath() const; - InstallationStep getNextStep() const; + OperationStep getInstallNextStep() const; // product details QString getProductName() const; diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index e66115485..be15c75c3 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -80,9 +80,9 @@ int main(int argc, char *argv[]) // instanciate ConfigFile CConfigFile config; - CConfigFile::InstallationStep step = config.load() ? config.getNextStep():CConfigFile::DisplayNoServerError; + OperationStep step = config.load() ? config.getInstallNextStep():DisplayNoServerError; - if (step == CConfigFile::DisplayNoServerError) + if (step == DisplayNoServerError) { QMessageBox::critical(NULL, QApplication::tr("Error"), QApplication::tr("Unable to find installer.ini")); return 1; @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) COperationDialog dialog; - dialog.setOperation(COperationDialog::OperationUninstall); + dialog.setOperation(OperationUninstall); dialog.setUninstallComponents(components); // TODO: set all components to uninstall @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) return dialog.exec() ? 0 : 1; } - if (step == CConfigFile::ShowMigrateWizard) + if (step == ShowMigrateWizard) { CMigrateDialog dialog; @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) step = config.getNextStep(); } - else if (step == CConfigFile::ShowInstallWizard) + else if (step == ShowInstallWizard) { CInstallDialog dialog; @@ -157,10 +157,10 @@ int main(int argc, char *argv[]) step = config.getNextStep(); } - if (step != CConfigFile::Done) + if (step != Done) { COperationDialog dialog; - dialog.setOperation(config.getSrcServerDirectory().isEmpty() ? COperationDialog::OperationInstall: COperationDialog::OperationMigrate); + dialog.setOperation(config.getSrcServerDirectory().isEmpty() ? OperationInstall:OperationMigrate); if (!dialog.exec()) return 1; diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index a69426ffa..cbdea44b0 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -153,7 +153,7 @@ void CMainWindow::onProfiles() { COperationDialog dialog(this); - dialog.setOperation(COperationDialog::OperationUpdateProfiles); + dialog.setOperation(OperationUpdateProfiles); if (!dialog.exec()) { @@ -212,7 +212,7 @@ void CMainWindow::onUninstall() COperationDialog dialog; - dialog.setOperation(COperationDialog::OperationUninstall); + dialog.setOperation(OperationUninstall); dialog.setUninstallComponents(components); if (dialog.exec()) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operation.h b/code/ryzom/tools/client/ryzom_installer/src/operation.h index 344e9e8ba..cdcd64a93 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operation.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operation.h @@ -46,4 +46,34 @@ struct SUninstallComponents bool installer; }; +enum OperationStep +{ + DisplayNoServerError, + ShowInstallWizard, + ShowMigrateWizard, + DownloadData, + ExtractDownloadedData, + DownloadClient, + ExtractDownloadedClient, + CopyDataFiles, + CopyProfileFiles, + CleanFiles, + ExtractBnpClient, + CopyInstaller, + UninstallOldClient, + CreateProfile, + CreateShortcuts, + CreateAddRemoveEntry, + Done +}; + +enum OperationType +{ + OperationNone, + OperationMigrate, + OperationUpdateProfiles, + OperationInstall, + OperationUninstall +}; + #endif diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index ec5381a57..0f2c2d731 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -76,7 +76,7 @@ COperationDialog::~COperationDialog() { } -void COperationDialog::setOperation(Operation operation) +void COperationDialog::setOperation(OperationType operation) { m_operation = operation; } @@ -126,73 +126,65 @@ void COperationDialog::processMigrateNextStep() switch(step) { - case CConfigFile::DisplayNoServerError: - break; - - case CConfigFile::ShowMigrateWizard: - break; - - case CConfigFile::ShowInstallWizard: - break; - - case CConfigFile::DownloadData: + case DownloadData: downloadData(); break; - case CConfigFile::ExtractDownloadedData: - // TODO + case ExtractDownloadedData: + QtConcurrent::run(this, &COperationDialog::extractDownloadedData); break; - case CConfigFile::DownloadClient: + case DownloadClient: downloadClient(); break; - case CConfigFile::ExtractDownloadedClient: - // TODO + case ExtractDownloadedClient: + QtConcurrent::run(this, &COperationDialog::extractDownloadedClient); break; - case CConfigFile::CopyServerFiles: - QtConcurrent::run(this, &COperationDialog::copyServerFiles); + case CopyDataFiles: + QtConcurrent::run(this, &COperationDialog::copyDataFiles); break; - case CConfigFile::CopyProfileFiles: + case CopyProfileFiles: QtConcurrent::run(this, &COperationDialog::copyProfileFiles); break; - case CConfigFile::CleanFiles: + case CleanFiles: QtConcurrent::run(this, &COperationDialog::cleanFiles); break; - case CConfigFile::ExtractBnpClient: + case ExtractBnpClient: QtConcurrent::run(this, &COperationDialog::extractBnpClient); break; - case CConfigFile::CopyInstaller: + case CopyInstaller: QtConcurrent::run(this, &COperationDialog::copyInstaller); break; - case CConfigFile::UninstallOldClient: + case UninstallOldClient: uninstallOldClient(); break; - case CConfigFile::CreateProfile: + case CreateProfile: createDefaultProfile(); break; - case CConfigFile::CreateShortcuts: + case CreateShortcuts: createDefaultShortcuts(); break; - case CConfigFile::CreateAddRemoveEntry: + case CreateAddRemoveEntry: createAddRemoveEntry(); break; - case CConfigFile::Done: + case Done: accept(); break; default: // cases already managed in main.cpp + qDebug() << "Shouldn't happen, step" << step; break; } } @@ -352,6 +344,11 @@ void COperationDialog::downloadData() m_downloader->prepareFile(config->expandVariables(server.dataDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.dataDownloadFilename) + ".part"); } +void COperationDialog::extractDownloadedData() +{ + // TODO: implement +} + void COperationDialog::downloadClient() { CConfigFile *config = CConfigFile::getInstance(); diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index 8aef3ec02..916eb319f 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -38,16 +38,7 @@ public: COperationDialog(QWidget *parent = NULL); virtual ~COperationDialog(); - enum Operation - { - OperationNone, - OperationMigrate, - OperationUpdateProfiles, - OperationInstall, - OperationUninstall - }; - - void setOperation(Operation operation); + void setOperation(OperationType operation); void setUninstallComponents(const SUninstallComponents &components); public slots: @@ -134,7 +125,7 @@ protected: QMutex m_abortingMutex; bool m_aborting; - Operation m_operation; + OperationType m_operation; SUninstallComponents m_components; };