From 191edf39b2a0195705b45817d030eeb370b0286f Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2016 19:51:28 +0200 Subject: [PATCH] Changed: Profiles update --- .../ryzom_installer/src/operationdialog.cpp | 95 ++++++++++++++++++- .../ryzom_installer/src/operationdialog.h | 1 + 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 2a7c80ae1..a3fdd1e4a 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -196,9 +196,98 @@ void COperationDialog::processUpdateProfilesNextStep() // TODO: create shortcuts } -void COperationDialog::processInstallNextStep() -{ - // TODO: implement + QStringList serversToUpdate; + QStringList profilesToDelete; + + CConfigFile *config = CConfigFile::getInstance(); + + // append all old profiles + foreach(const CProfile &profile, config->getBackupProfiles()) + { + if (QFile::exists(profile.getDirectory())) profilesToDelete << profile.id; + } + + const CServer &defaultServer = config->getServer(); + + foreach(const CProfile &profile, config->getProfiles()) + { + const CServer &server = config->getServer(profile.server); + + QString serverDirectory = server.getDirectory(); + + // check if Ryzom is installed in new server directory + if (server.id != defaultServer.id && !config->isRyzomInstalledIn(serverDirectory) && serversToUpdate.indexOf(server.id) == -1) + { + serversToUpdate << server.id; + } + + // remove profiles that still exist + profilesToDelete.removeAll(profile.id); + } + + if (!profilesToDelete.isEmpty()) + { + m_components.profiles << profilesToDelete; + + // delete profiles in another thread + QtConcurrent::run(this, &COperationDialog::deleteComponentsProfiles); + + return; + } + + // servers files to download/update + foreach(const QString &serverId, serversToUpdate) + { + const CServer &server = config->getServer(serverId); + + // data + if (!config->areRyzomDataInstalledIn(server.getDirectory())) + { + QString dataFile = config->getInstallationDirectory() + "/" + server.dataDownloadFilename; + + // archive already downloaded + if (QFile::exists(dataFile)) + { + // make server current + m_currentServerId = server.id; + + // uncompress it + QtConcurrent::run(this, &COperationDialog::extractDownloadedData); + return; + } + + // data download URLs are different, can't copy data from default server + if (server.dataDownloadUrl != defaultServer.dataDownloadUrl) + { + // download it + // TODO + + return; + } + + // same data used + + // copy them + // TODO + return; + } + + // client + if (!config->isRyzomClientInstalledIn(server.getDirectory())) + { + // client download URLs are different, can't copy client from default server + if (server.clientDownloadUrl == defaultServer.clientDownloadUrl) + { + if (QFile::exists("")) + downloadData(); + return; + } + } + else + { + QString clientFile = config->getInstallationDirectory() + "/" + server.clientDownloadFilename; + } + } } void COperationDialog::processUninstallNextStep() diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index 916eb319f..fdee8b404 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -87,6 +87,7 @@ protected: void processUpdateProfilesNextStep(); void processInstallNextStep(); void processUninstallNextStep(); + void processUpdateProfilesNextStep(); // operations void downloadData();