From 37fe37c8ed70ebafd98cceba4ceff1059c61a169 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 19 Oct 2016 17:06:25 +0200 Subject: [PATCH 1/3] Fixed: When incrementing version of ini file, check servers by ID not by index --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 20 +++++++++--- .../client/ryzom_installer/src/server.cpp | 32 +++++++++++++++++++ .../tools/client/ryzom_installer/src/server.h | 8 +++-- 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 08b485773..6dadeb5cd 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -114,16 +114,26 @@ bool CConfigFile::load(const QString &filename) settings.endGroup(); // only resize if added servers in local ryzom_installer.ini - int oldServersCount = m_servers.size(); + CServers defaultServers = m_servers; - if (serversCount > oldServersCount) m_servers.resize(serversCount); + m_servers.resize(serversCount); - for (int i = oldServersCount; i < serversCount; ++i) + for (int i = 0; i < serversCount; ++i) { + settings.beginGroup(QString("server_%1").arg(i)); + CServer &server = m_servers[i]; - settings.beginGroup(QString("server_%1").arg(i)); - server.loadFromSettings(settings); + if (useDefaultValues) + { + // search server with same ID and use these values + server.loadFromServers(defaultServers); + } + else + { + server.loadFromSettings(settings); + } + settings.endGroup(); } diff --git a/code/ryzom/tools/client/ryzom_installer/src/server.cpp b/code/ryzom/tools/client/ryzom_installer/src/server.cpp index 88932fa0c..9514c8df9 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/server.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/server.cpp @@ -52,6 +52,38 @@ void CServer::loadFromSettings(const QSettings &settings) comments = settings.value("comments").toString(); } +void CServer::loadFromServers(const CServers &servers) +{ + foreach(const CServer &server, servers) + { + if (server.id == id) + { + // found the same server + loadFromServer(server); + break; + } + } +} + +void CServer::loadFromServer(const CServer &server) +{ + // copy all members + id = server.id; + name = server.name; + displayUrl = server.displayUrl; + filesListUrl = server.filesListUrl; + dataDownloadUrl = server.dataDownloadUrl; + dataDownloadFilename = server.dataDownloadFilename; + dataCompressedSize = server.dataCompressedSize; + dataUncompressedSize = server.dataUncompressedSize; + clientDownloadUrl = server.clientDownloadUrl; + clientDownloadFilename = server.clientDownloadFilename; + clientFilename = server.clientFilename; + clientFilenameOld = server.clientFilenameOld; + configurationFilename = server.configurationFilename; + comments = server.comments; +} + void CServer::saveToSettings(QSettings &settings) const { settings.setValue("id", id); diff --git a/code/ryzom/tools/client/ryzom_installer/src/server.h b/code/ryzom/tools/client/ryzom_installer/src/server.h index 33fbbb49e..afde10b55 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/server.h +++ b/code/ryzom/tools/client/ryzom_installer/src/server.h @@ -19,6 +19,10 @@ #include "operation.h" +class CServer; + +typedef QVector CServers; + class CServer { public: @@ -44,6 +48,8 @@ public: QString comments; void loadFromSettings(const QSettings &settings); + void loadFromServers(const CServers &servers); + void loadFromServer(const CServer &server); void saveToSettings(QSettings &settings) const; // helpers @@ -55,6 +61,4 @@ public: extern const CServer NoServer; -typedef QVector CServers; - #endif From 55398733374d7d6ea217c2e9a8d405df47e556aa Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 19 Oct 2016 17:07:31 +0200 Subject: [PATCH 2/3] Fixed: Use 3 numbers version (without revision) for MACOSX_BUNDLE_SHORT_VERSION_STRING --HG-- branch : develop --- code/CMakeModules/ConfigureChecks.cmake | 3 ++- code/ryzom/client/src/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/CMakeModules/ConfigureChecks.cmake b/code/CMakeModules/ConfigureChecks.cmake index 3929d65c9..1eade142c 100644 --- a/code/CMakeModules/ConfigureChecks.cmake +++ b/code/CMakeModules/ConfigureChecks.cmake @@ -40,7 +40,8 @@ MACRO(NL_CONFIGURE_CHECKS) SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}.${REVISION}") SET(NL_VERSION_RC "${NL_VERSION_MAJOR},${NL_VERSION_MINOR},${NL_VERSION_PATCH},${REVISION}") - SET(RYZOM_VERSION "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}.${REVISION}") + SET(RYZOM_VERSION_SHORT "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}") + SET(RYZOM_VERSION "${RYZOM_VERSION_SHORT}.${REVISION}") SET(RYZOM_VERSION_RC "${RYZOM_VERSION_MAJOR},${RYZOM_VERSION_MINOR},${RYZOM_VERSION_PATCH},${REVISION}") NOW(BUILD_DATE) diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 1c703efaf..6793314f6 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -61,7 +61,7 @@ IF(WITH_RYZOM_CLIENT) SET(MACOSX_BUNDLE_GUI_IDENTIFIER "") SET(MACOSX_BUNDLE_LONG_VERSION_STRING ${RYZOM_VERSION}) SET(MACOSX_BUNDLE_BUNDLE_NAME "Ryzom Core Client") - SET(MACOSX_BUNDLE_SHORT_VERSION_STRING ${RYZOM_VERSION}) + SET(MACOSX_BUNDLE_SHORT_VERSION_STRING ${RYZOM_VERSION_SHORT}) SET(MACOSX_BUNDLE_BUNDLE_VERSION "1.0") SET(MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT}) SET(RYZOM_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app) From 2858fce96842fb4e47ced9e20cdb26860f23e2d1 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 19 Oct 2016 17:23:42 +0200 Subject: [PATCH 3/3] Fixed: Trying to resume after a 206 HTTP status code --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/downloader.cpp | 6 +++++- code/ryzom/tools/client/ryzom_installer/src/operation.h | 1 + .../tools/client/ryzom_installer/src/operationdialog.cpp | 5 +++++ .../tools/client/ryzom_installer/src/operationdialog.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp index eb87a6175..bbc660f8a 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp @@ -388,9 +388,13 @@ void CDownloader::onDownloadFinished() emit downloadDone(); } + else if (status == 206) + { + if (m_listener) m_listener->operationContinue(); + } else { - m_listener->operationFail(tr("HTTP error: %1").arg(status)); + if (m_listener) m_listener->operationFail(tr("HTTP error: %1").arg(status)); } } } diff --git a/code/ryzom/tools/client/ryzom_installer/src/operation.h b/code/ryzom/tools/client/ryzom_installer/src/operation.h index 6d039252a..71627363e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operation.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operation.h @@ -31,6 +31,7 @@ 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 operationContinue() = 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 9c7ebabf8..75a0f49aa 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -1264,6 +1264,11 @@ void COperationDialog::operationFail(const QString &error) emit fail(error); } +void COperationDialog::operationContinue() +{ + 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 50f6d761b..a68912fdd 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -129,6 +129,7 @@ protected: virtual void operationProgress(qint64 current, const QString &filename); virtual void operationSuccess(qint64 total); virtual void operationFail(const QString &error); + virtual void operationContinue(); virtual bool operationShouldStop();