From a161968c3c0a06627b2f5954e14aa48782776b47 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:45:43 +0200 Subject: [PATCH 01/18] Changed: Profile ID is now a QString --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/configfile.cpp | 4 ++-- code/ryzom/tools/client/ryzom_installer/src/configfile.h | 3 +-- .../ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp | 2 +- code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp | 4 ++-- code/ryzom/tools/client/ryzom_installer/src/profilesmodel.h | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 29c7ba6e4..141fef5e3 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -105,7 +105,7 @@ bool CConfigFile::load(const QString &filename) settings.beginGroup(QString("profile_%1").arg(i)); - profile.id = settings.value("id").toInt(); + profile.id = settings.value("id").toString(); profile.name = settings.value("name").toString(); profile.account = settings.value("account").toString(); profile.server = settings.value("server").toString(); @@ -590,7 +590,7 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const } // no default profile - if (profile.id < 0) + if (profile.id.isEmpty()) { return CreateProfile; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index e225fcc59..8909e39e6 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -46,12 +46,11 @@ struct CProfile { CProfile() { - id = -1; desktopShortcut = false; menuShortcut = false; } - int id; + QString id; QString account; QString name; QString server; diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp index c83447d47..fd9d64a10 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp @@ -97,7 +97,7 @@ void CProfilesDialog::displayProfile(int index) const CProfile &profile = m_model->getProfiles()[index]; // update all widgets with content of profile - profileIdLabel->setText(QString::number(profile.id)); + profileIdLabel->setText(profile.id); accountEdit->setText(profile.account); nameEdit->setText(profile.name); serverComboBox->setCurrentIndex(m_serversModel->getIndexFromServerID(profile.server)); diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp index 64f15c5d5..bdc0fbe23 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp @@ -48,7 +48,7 @@ bool CProfilesModel::save() const return true; } -int CProfilesModel::getIndexFromProfileID(int profileId) const +int CProfilesModel::getIndexFromProfileID(const QString &profileId) const { for(int i = 0; i < m_profiles.size(); ++i) { @@ -58,7 +58,7 @@ int CProfilesModel::getIndexFromProfileID(int profileId) const return -1; } -int CProfilesModel::getProfileIDFromIndex(int index) const +QString CProfilesModel::getProfileIDFromIndex(int index) const { if (index < 0 || index >= m_profiles.size()) return -1; diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.h b/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.h index ea02f618c..4a3a71a77 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.h +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.h @@ -25,8 +25,8 @@ public: bool save() const; - int getIndexFromProfileID(int profileId) const; - int getProfileIDFromIndex(int index) const; + int getIndexFromProfileID(const QString &profileId) const; + QString getProfileIDFromIndex(int index) const; private: CProfiles m_profiles; From 1fed8f51a0e56b8bcd6eb151f460c7975f1becf6 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:46:08 +0200 Subject: [PATCH 02/18] Changed: Better syntax for profile display --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp index bdc0fbe23..dd9c97e40 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesmodel.cpp @@ -24,7 +24,7 @@ QVariant CProfilesModel::data(const QModelIndex &index, int role) const const CProfile &profile = m_profiles.at(index.row()); - return QString("%1 (#%2)").arg(profile.name).arg(profile.id); + return tr("#%1: %2").arg(profile.id).arg(profile.name); } bool CProfilesModel::removeRows(int row, int count, const QModelIndex &parent) From c1485f500af7d90ec05fae2bc4f5d547341105f6 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:46:35 +0200 Subject: [PATCH 03/18] Changed: Use profile default index instead of ID --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp index fd9d64a10..b9c3ef29a 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp @@ -38,7 +38,7 @@ CProfilesDialog::CProfilesDialog():QDialog(), m_currentProfileIndex(-1) profilesListView->setModel(m_model); serverComboBox->setModel(m_serversModel); - int index = m_model->getIndexFromProfileID(CConfigFile::getInstance()->getDefaultProfileIndex()); + int index = CConfigFile::getInstance()->getDefaultProfileIndex(); profilesListView->setCurrentIndex(m_model->index(index, 0)); displayProfile(index); From dbf1229aaef47eecf90550dd7dcc847fe6740f3a Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:48:01 +0200 Subject: [PATCH 04/18] Changed: operationFinish() not useful --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp | 2 +- code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp | 1 - .../tools/client/ryzom_installer/src/filesextractor.cpp | 3 --- code/ryzom/tools/client/ryzom_installer/src/operation.h | 1 - .../tools/client/ryzom_installer/src/operationdialog.cpp | 5 ----- .../ryzom/tools/client/ryzom_installer/src/operationdialog.h | 1 - 6 files changed, 1 insertion(+), 12 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp b/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp index 4b66b437b..9505d3add 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp @@ -73,7 +73,7 @@ bool CFilesCleaner::exec() dir.removeRecursively(); } - if (m_listener) m_listener->operationFinish(); + if (m_listener) m_listener->operationSuccess(files.size()); return true; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp b/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp index 8c8cfabb4..8b2af9be8 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp @@ -181,7 +181,6 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files) if (m_listener) { m_listener->operationSuccess(totalSize); - m_listener->operationFinish(); } return true; diff --git a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp index 222add173..3adea7e80 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp @@ -457,7 +457,6 @@ bool CFilesExtractor::extract7z() if (m_listener) { m_listener->operationSuccess(totalUncompressed); - m_listener->operationFinish(); } return true; @@ -563,7 +562,6 @@ bool CFilesExtractor::extractZip() if (m_listener) { m_listener->operationSuccess(totalSize); - m_listener->operationFinish(); } return true; @@ -594,7 +592,6 @@ bool CFilesExtractor::progress(const std::string &filename, uint32 currentSize, if (m_listener) { m_listener->operationSuccess((qint64)totalSize); - m_listener->operationFinish(); } } diff --git a/code/ryzom/tools/client/ryzom_installer/src/operation.h b/code/ryzom/tools/client/ryzom_installer/src/operation.h index b8cfeea34..121761e57 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operation.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operation.h @@ -29,7 +29,6 @@ public: virtual void operationProgress(qint64 current, const QString &filename) =0; virtual void operationSuccess(qint64 total) =0; virtual void operationFail(const QString &error) =0; - virtual void operationFinish() =0; virtual bool operationShouldStop() =0; }; diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 88656a68a..ef9984e6b 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -382,11 +382,6 @@ void COperationDialog::operationFail(const QString &error) emit fail(error); } -void COperationDialog::operationFinish() -{ - emit done(); -} - bool COperationDialog::operationShouldStop() { QMutexLocker locker(&m_abortingMutex); diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index b4004988b..b16f90edb 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -97,7 +97,6 @@ protected: virtual void operationProgress(qint64 current, const QString &filename); virtual void operationSuccess(qint64 total); virtual void operationFail(const QString &error); - virtual void operationFinish(); virtual bool operationShouldStop(); From 714d899611481a1c723bfe102a5e176ac453b84b Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:48:41 +0200 Subject: [PATCH 05/18] Changed: Name of OperationDialog UI --HG-- branch : develop --- .../ryzom/tools/client/ryzom_installer/ui/operationdialog.ui | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/ui/operationdialog.ui b/code/ryzom/tools/client/ryzom_installer/ui/operationdialog.ui index 104cdd200..86bf38f03 100644 --- a/code/ryzom/tools/client/ryzom_installer/ui/operationdialog.ui +++ b/code/ryzom/tools/client/ryzom_installer/ui/operationdialog.ui @@ -2,6 +2,9 @@ OperationDialog + + Qt::ApplicationModal + 0 @@ -11,7 +14,7 @@ - Dialog + Ryzom Installer From 591f9c88d538766aa029853ae3309b2b84d9e936 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:49:18 +0200 Subject: [PATCH 06/18] Changed: downloadData and downloadClient methods --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 32 +++++++++++++++++-- .../ryzom_installer/src/operationdialog.h | 2 ++ 2 files changed, 31 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 ef9984e6b..0c57bcef1 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -97,7 +97,7 @@ void COperationDialog::processNextStep() break; case CConfigFile::DownloadData: - m_downloader->prepareFile(config->expandVariables(server.dataDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.dataDownloadFilename) + ".part"); + downloadData(); break; case CConfigFile::ExtractDownloadedData: @@ -105,7 +105,7 @@ void COperationDialog::processNextStep() break; case CConfigFile::DownloadClient: - m_downloader->prepareFile(config->expandVariables(server.clientDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.clientDownloadFilename) + ".part"); + downloadClient(); break; case CConfigFile::ExtractDownloadedClient: @@ -248,7 +248,33 @@ void COperationDialog::onProgressFail(const QString &error) void COperationDialog::onDone() { - processNextStep(); + if (!operationShouldStop()) processNextStep(); +} + +void COperationDialog::downloadData() +{ + CConfigFile *config = CConfigFile::getInstance(); + + // default server + const CServer &server = config->getServer(); + + m_currentOperation = QApplication::tr("Download data required for server %1").arg(server.name); + m_currentOperationProgressFormat = QApplication::tr("Downloading %1..."); + + m_downloader->prepareFile(config->expandVariables(server.dataDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.dataDownloadFilename) + ".part"); +} + +void COperationDialog::downloadClient() +{ + CConfigFile *config = CConfigFile::getInstance(); + + // default server + const CServer &server = config->getServer(); + + m_currentOperation = QApplication::tr("Download client required for server %1").arg(server.name); + m_currentOperationProgressFormat = QApplication::tr("Downloading %1..."); + + m_downloader->prepareFile(config->expandVariables(server.clientDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.clientDownloadFilename) + ".part"); } void COperationDialog::copyServerFiles() diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index b16f90edb..39ab5437d 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -82,6 +82,8 @@ protected: void processNextStep(); // operations + void downloadData(); + void downloadClient(); void copyServerFiles(); void copyProfileFiles(); void extractBnpClient(); From 0b2928d3494071824045052fd82fd9953c79a284 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:49:50 +0200 Subject: [PATCH 07/18] Changed: Moved createDefaultProfile --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 78 ++++++++++--------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 0c57bcef1..7281daf88 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -371,6 +371,48 @@ void COperationDialog::cleanFiles() CFilesCleaner cleaner(this); cleaner.setDirectory(config->getInstallationDirectory() + "/" + server.id); cleaner.exec(); + + emit done(); +} + +bool COperationDialog::createDefaultProfile() +{ + CConfigFile *config = CConfigFile::getInstance(); + + CServer server = config->getServer(config->getDefaultServerIndex()); + + m_currentOperation = QApplication::tr("Create default profile"); + m_currentOperationProgressFormat = QApplication::tr("Deleting %1..."); + + CProfile profile; + + profile.id = "0"; + profile.executable = config->getClientFullPath(); + profile.name = QString("Ryzom (%1)").arg(server.name); + profile.server = server.id; + profile.comments = "Default profile created by Ryzom Installer"; + +#ifdef Q_OS_WIN32 +// C:\Users\Public\Desktop + profile.desktopShortcut = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk"); +#endif + + // TODO + // profile.menuShortcut + + config->addProfile(profile); + config->save(); + + emit done(); + + return true; +} + +bool COperationDialog::createDefaultShortcuts() +{ + emit done(); + + return true; } void COperationDialog::operationPrepare() @@ -414,39 +456,3 @@ bool COperationDialog::operationShouldStop() return m_aborting; } - -bool COperationDialog::createDefaultProfile() -{ - CConfigFile *config = CConfigFile::getInstance(); - - CServer server = config->getServer(config->getDefaultServerIndex()); - - CProfile profile; - - profile.id = 0; - profile.executable = config->getClientFullPath(); - profile.name = QString("Ryzom (%1)").arg(server.name); - profile.server = server.id; - profile.comments = "Default profile created by Ryzom Installer"; - -#ifdef Q_OS_WIN32 - profile.desktopShortcut = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk"); -#endif - - // TODO - // profile.menuShortcut - - config->addProfile(profile); - config->save(); - - onDone(); - - return true; -} - -bool COperationDialog::createDefaultShortcuts() -{ - onDone(); - - return true; -} From 32cb08ad729d8b309f6267102359512d47bdc3e3 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:50:15 +0200 Subject: [PATCH 08/18] Changed: Remove Help icon in window title bar --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 7281daf88..f9b2b6f7c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -42,6 +42,8 @@ COperationDialog::COperationDialog():QDialog(), m_aborting(false) { setupUi(this); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + #if defined(Q_OS_WIN32) && defined(QT_WINEXTRAS_LIB) m_button = new QWinTaskbarButton(this); #endif From 740e8ef1e2d1b9992e543bcdde701f8851ebd05a Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:50:53 +0200 Subject: [PATCH 09/18] Changed: Display current operation --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index f9b2b6f7c..f7f953d6c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -286,8 +286,8 @@ void COperationDialog::copyServerFiles() // default server const CServer &server = config->getServer(); - // default profile - const CProfile &configuration = config->getProfile(); + m_currentOperation = QApplication::tr("Copy client files needed for server %1").arg(server.name); + m_currentOperationProgressFormat = QApplication::tr("Copying %1..."); QStringList serverFiles; serverFiles << "cfg"; @@ -297,9 +297,6 @@ void COperationDialog::copyServerFiles() serverFiles << "unpack"; serverFiles << "client_default.cfg"; - m_currentOperation = QApplication::tr("Copying client files needed for server %1...").arg(server.name); - m_currentOperationProgressFormat = QApplication::tr("Copying %1..."); - CFilesCopier copier(this); copier.setSourceDirectory(config->getSrcServerDirectory()); copier.setDesinationDirectory(config->getInstallationDirectory() + "/" + server.id); @@ -323,6 +320,9 @@ void COperationDialog::copyProfileFiles() // default profile const CProfile &profile = config->getProfile(); + m_currentOperation = QApplication::tr("Copy old profile to new location"); + m_currentOperationProgressFormat = QApplication::tr("Copying %1..."); + QStringList profileFiles; profileFiles << "cache"; profileFiles << "save"; @@ -351,8 +351,10 @@ void COperationDialog::extractBnpClient() // default server const CServer &server = config->getServer(); - // default profile - const CProfile &profile = config->getProfile(); + m_currentOperation = QApplication::tr("Extract client to new location"); + m_currentOperationProgressFormat = QApplication::tr("Extracting %1..."); + + QString destinationDirectory = config->getInstallationDirectory() + "/" + server.id; CFilesExtractor extractor(this); extractor.setSourceFile(config->getSrcServerClientBNPFullPath()); @@ -367,8 +369,8 @@ void COperationDialog::cleanFiles() // default server const CServer &server = config->getServer(); - // default profile - const CProfile &profile = config->getProfile(); + m_currentOperation = QApplication::tr("Clean obsolete files"); + m_currentOperationProgressFormat = QApplication::tr("Deleting %1..."); CFilesCleaner cleaner(this); cleaner.setDirectory(config->getInstallationDirectory() + "/" + server.id); From 3e0aa2470387848506a0771898f02351107f608e Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:52:16 +0200 Subject: [PATCH 10/18] Changed: Launch upgd_nl.bat/sh script after extracting BNP client files --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index f7f953d6c..923c01aec 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -358,8 +358,37 @@ void COperationDialog::extractBnpClient() CFilesExtractor extractor(this); extractor.setSourceFile(config->getSrcServerClientBNPFullPath()); - extractor.setDesinationDirectory(config->getInstallationDirectory() + "/" + server.id); + extractor.setDesinationDirectory(destinationDirectory); extractor.exec(); + + QString upgradeScript = destinationDirectory + "/upgd_nl."; + +#ifdef Q_OS_WIN + upgradeScript += "bat"; +#else + upgradeScript += "sh"; +#endif + + if (QFile::exists(upgradeScript)) + { + QProcess process; + + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + env.insert("RYZOM_CLIENT", QDir::toNativeSeparators(destinationDirectory + "/ryzom_client_r.exe")); + env.insert("UNPACKPATH", QDir::toNativeSeparators(destinationDirectory + "/unpack")); + env.insert("ROOTPATH", QDir::toNativeSeparators(destinationDirectory)); + env.insert("STARTUPPATH", ""); + process.setProcessEnvironment(env); + + process.start(upgradeScript); + + while (process.waitForFinished()) + { + qDebug() << "waiting"; + } + } + + emit done(); } void COperationDialog::cleanFiles() From 3efc46a68191fd6337d7086a6b23839acf689bcf Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:52:47 +0200 Subject: [PATCH 11/18] Changed: Emit done when an operation is finished --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 923c01aec..233d64fdd 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -72,6 +72,7 @@ COperationDialog::COperationDialog():QDialog(), m_aborting(false) connect(this, SIGNAL(progress(qint64, QString)), SLOT(onProgressProgress(qint64, QString))); connect(this, SIGNAL(success(qint64)), SLOT(onProgressSuccess(qint64))); connect(this, SIGNAL(fail(QString)), SLOT(onProgressFail(QString))); + connect(this, SIGNAL(done()), SLOT(onDone())); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); } @@ -308,6 +309,8 @@ void COperationDialog::copyServerFiles() else { } + + emit done(); } void COperationDialog::copyProfileFiles() @@ -342,6 +345,8 @@ void COperationDialog::copyProfileFiles() else { } + + emit done(); } void COperationDialog::extractBnpClient() From 4675cdb0d7f1bc8f1f03170811ee3438b9bf8883 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:53:19 +0200 Subject: [PATCH 12/18] Changed: Call accept() or reject() depending on next action --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 233d64fdd..02b1c0ded 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -139,6 +139,10 @@ void COperationDialog::processNextStep() createDefaultShortcuts(); break; + case CConfigFile::Done: + accept(); + break; + default: // cases already managed in main.cpp break; @@ -221,7 +225,7 @@ void COperationDialog::onProgressStop() m_button->progress()->hide(); #endif - close(); + reject(); } void COperationDialog::onProgressProgress(qint64 current, const QString &filename) From af248d0a0f8e5f8eb4325c8eab45f4e0096be7c2 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:54:10 +0200 Subject: [PATCH 13/18] Changed: Don't download changelog --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 02b1c0ded..cc2a53ed2 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -147,8 +147,6 @@ void COperationDialog::processNextStep() // cases already managed in main.cpp break; } - - m_downloader->getHtmlPageContent(config->expandVariables(server.displayUrl)); } void COperationDialog::showEvent(QShowEvent *e) From 9f06af9a87c442b70ab7778a7096d39a37f41c90 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:54:24 +0200 Subject: [PATCH 14/18] Changed: Minor change --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index cc2a53ed2..1c0e5cd82 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -91,7 +91,10 @@ void COperationDialog::processNextStep() // default profile const CProfile &configuration = config->getProfile(); - switch(config->getNextStep()) + // long operations are done in a thread + CConfigFile::InstallationStep step = config->getNextStep(); + + switch(step) { case CConfigFile::DisplayNoServerError: break; From f042f1850fa8c233b748aaafd08a7699af90f868 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:55:46 +0200 Subject: [PATCH 15/18] Changed: Allow to abort when extracting files --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp index 3adea7e80..8314d27e6 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp @@ -614,6 +614,7 @@ bool CFilesExtractor::extractBnp() if (m_listener && m_listener->operationShouldStop()) { // stopped + m_listener->operationStop(); return true; } From 44d3f75cc90321722e90d4928919773f4196ac91 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 14:58:50 +0200 Subject: [PATCH 16/18] Changed: Update progress in CFilesCleaner --HG-- branch : develop --- .../client/ryzom_installer/src/filescleaner.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp b/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp index 9505d3add..e1481fcf9 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp @@ -52,6 +52,8 @@ void CFilesCleaner::setDirectory(const QString &src) bool CFilesCleaner::exec() { + if (m_listener) m_listener->operationPrepare(); + QDir dir(m_directory); // directory doesn't exist @@ -62,9 +64,21 @@ bool CFilesCleaner::exec() // temporary files QStringList files = dir.entryList(QStringList() << "*.string_cache" << "*.packed_sheets" << "*.packed" << "*.pem", QDir::Files); + if (m_listener) + { + m_listener->operationInit(0, files.size()); + m_listener->operationStart(); + } + + int filesCount = 0; + foreach(const QString &file, files) { dir.remove(file); + + if (m_listener) m_listener->operationProgress(filesCount, file); + + ++filesCount; } // fonts directory is not needed anymore From db1146963104424198fd5f7b7a8df520a0008711 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 16:21:47 +0200 Subject: [PATCH 17/18] Changed: Better English --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 6 +++--- 1 file changed, 3 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 1c0e5cd82..1e1f067e6 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -266,7 +266,7 @@ void COperationDialog::downloadData() // default server const CServer &server = config->getServer(); - m_currentOperation = QApplication::tr("Download data required for server %1").arg(server.name); + m_currentOperation = QApplication::tr("Download data required by server %1").arg(server.name); m_currentOperationProgressFormat = QApplication::tr("Downloading %1..."); m_downloader->prepareFile(config->expandVariables(server.dataDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.dataDownloadFilename) + ".part"); @@ -279,7 +279,7 @@ void COperationDialog::downloadClient() // default server const CServer &server = config->getServer(); - m_currentOperation = QApplication::tr("Download client required for server %1").arg(server.name); + m_currentOperation = QApplication::tr("Download client required by server %1").arg(server.name); m_currentOperationProgressFormat = QApplication::tr("Downloading %1..."); m_downloader->prepareFile(config->expandVariables(server.clientDownloadUrl), config->getInstallationDirectory() + "/" + config->expandVariables(server.clientDownloadFilename) + ".part"); @@ -292,7 +292,7 @@ void COperationDialog::copyServerFiles() // default server const CServer &server = config->getServer(); - m_currentOperation = QApplication::tr("Copy client files needed for server %1").arg(server.name); + m_currentOperation = QApplication::tr("Copy client files required by server %1").arg(server.name); m_currentOperationProgressFormat = QApplication::tr("Copying %1..."); QStringList serverFiles; From 579e9eecc3bcca42ab2bdcccdc383cd388151a4f Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 16 May 2016 16:30:46 +0200 Subject: [PATCH 18/18] Changed: Add more checks for data --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 141fef5e3..e7d883314 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -410,11 +410,20 @@ bool CConfigFile::areRyzomDataInstalledIn(const QString &directory) const // directory doesn't exist if (!dir.exists()) return false; - if (!dir.cd("data") && dir.exists()) return false; + if (!dir.cd("data") || !dir.exists()) return false; // at least 200 BNP in data directory if (dir.entryList(QStringList() << "*.bnp", QDir::Files).size() < 200) return false; + // fonts.bnp is required + if (!dir.exists("fonts.bnp")) return false; + + // gamedev.bnp is required + if (!dir.exists("gamedev.bnp")) return false; + + // interfaces.bnp is required + if (!dir.exists("interfaces.bnp")) return false; + // TODO: more checks return true; @@ -550,16 +559,18 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const { // user decided to copy files - // selected directory contains Ryzom files (shouldn't fail) - if (!areRyzomDataInstalledIn(getSrcServerDirectory())) - { - return ShowWizard; - } - // data are not copied if (!areRyzomDataInstalledIn(serverDirectory)) { - return CopyServerFiles; + // selected directory contains Ryzom files (shouldn't fail) + if (areRyzomDataInstalledIn(getSrcServerDirectory())) + { + return CopyServerFiles; + } + else + { + return ShowWizard; + } } // client is not extracted from BNP