From 9c1a5a315f42c26823a306c8c8aa858c14f9a43c Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:14:43 +0200 Subject: [PATCH 1/9] Changed: Include Installer icon in QRC --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/res/resources.qrc | 1 + 1 file changed, 1 insertion(+) diff --git a/code/ryzom/tools/client/ryzom_installer/res/resources.qrc b/code/ryzom/tools/client/ryzom_installer/res/resources.qrc index 50fb5825f..31622b6c1 100644 --- a/code/ryzom/tools/client/ryzom_installer/res/resources.qrc +++ b/code/ryzom/tools/client/ryzom_installer/res/resources.qrc @@ -4,6 +4,7 @@ ryzom.ico + ryzom_installer.png template.desktop From 7d7ce29894364efcd0394e1fc82f910dca7e4b48 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:17:20 +0200 Subject: [PATCH 2/9] Changed: Installer filename should not depend on server --HG-- branch : develop --- .../ryzom_installer/res/ryzom_installer.ini | 11 +++---- .../client/ryzom_installer/src/configfile.cpp | 29 ++++++++++++++++--- .../client/ryzom_installer/src/configfile.h | 3 ++ .../ryzom_installer/src/operationdialog.cpp | 22 ++++---------- .../client/ryzom_installer/src/server.cpp | 6 ---- .../tools/client/ryzom_installer/src/server.h | 1 - 6 files changed, 37 insertions(+), 35 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.ini b/code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.ini index f82e707c9..7ce0988d5 100644 --- a/code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.ini +++ b/code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.ini @@ -1,7 +1,10 @@ -version=2 +version=3 [common] installation_directory= +installer_filename_windows=ryzom_installer_qt_r.exe +installer_filename_osx=RyzomInstaller.app/Contents/MacOS/RyzomInstaller +installer_filename_linux=ryzom_installer_qt [product] name=Ryzom @@ -31,9 +34,6 @@ client_filename_old_windows=client_ryzom_rd.exe configuration_filename_windows=ryzom_configuration_qt_r.exe configuration_filename_osx=Ryzom.app/Contents/MacOS/RyzomConfiguration configuration_filename_linux=ryzom_configuration_qt -installer_filename_windows=ryzom_installer_qt_r.exe -installer_filename_osx=RyzomInstaller.app/Contents/MacOS/RyzomInstaller -installer_filename_linux=ryzom_installer_qt comments= [server_1] @@ -54,9 +54,6 @@ client_filename_old_windows=client_ryzom_rd.exe configuration_filename_windows=ryzom_configuration_qt_r.exe configuration_filename_osx=Ryzom.app/Contents/MacOS/RyzomConfiguration configuration_filename_linux=ryzom_configuration_qt -installer_filename_windows=ryzom_installer_qt_r.exe -installer_filename_osx=RyzomInstaller.app/Contents/MacOS/RyzomInstaller -installer_filename_linux=ryzom_installer_qt comments=Test server [profiles] diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 8a52a6af7..c3eaf3d64 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -82,6 +82,18 @@ bool CConfigFile::load(const QString &filename) m_installationDirectory = settings.value("installation_directory").toString(); m_use64BitsClient = settings.value("use_64bits_client", true).toBool(); m_shouldUninstallOldClient = settings.value("should_uninstall_old_client", true).toBool(); + + if (!useDefaultValues) + { +#if defined(Q_OS_WIN) + m_installerFilename = settings.value("installer_filename_windows").toString(); +#elif defined(Q_OS_MAC) + m_installerFilename = settings.value("installer_filename_osx").toString(); +#else + m_installerFilename = settings.value("installer_filename_linux").toString(); +#endif + } + settings.endGroup(); if (!useDefaultValues) @@ -129,6 +141,9 @@ bool CConfigFile::load(const QString &filename) settings.endGroup(); } + // save file with new values + if (useDefaultValues) save(); + return !m_servers.isEmpty(); } @@ -144,6 +159,15 @@ bool CConfigFile::save() const settings.setValue("installation_directory", m_installationDirectory); settings.setValue("use_64bits_client", m_use64BitsClient); settings.setValue("should_uninstall_old_client", m_shouldUninstallOldClient); + +#if defined(Q_OS_WIN) + settings.setValue("installer_filename_windows", m_installerFilename); +#elif defined(Q_OS_MAC) + settings.setValue("installer_filename_osx", m_installerFilename); +#else + settings.setValue("installer_filename_linux", m_installerFilename); +#endif + settings.endGroup(); settings.beginGroup("product"); @@ -686,10 +710,7 @@ bool CConfigFile::shouldCreateMenuShortcut() const bool CConfigFile::shouldCopyInstaller() const { - const CProfile &p = getProfile(); - const CServer &s = getServer(p.server); - - QString installerDst = getInstallationDirectory() + "/" + s.installerFilename; + QString installerDst = getInstallationDirectory() + "/" + m_installerFilename; // if installer not found in installation directory, extract it from BNP if (!QFile::exists(installerDst)) return true; diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 6a8600f05..d83103726 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -116,6 +116,8 @@ public: bool uninstallingOldClient() const; void setUninstallingOldClient(bool on) const; + QString getInstallerFilename() const { return m_installerFilename; } + QString expandVariables(const QString &str) const; QString getClientArch() const; @@ -155,6 +157,7 @@ private: QString m_srcDirectory; bool m_use64BitsClient; bool m_shouldUninstallOldClient; + QString m_installerFilename; QString m_language; QString m_defaultConfigPath; diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 529afa8d6..d61d3f8af 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -735,15 +735,12 @@ void COperationDialog::copyInstaller() { CConfigFile *config = CConfigFile::getInstance(); - // default server - const CServer &server = config->getServer(); - m_currentOperation = tr("Copying installer to new location..."); QString destinationDirectory = config->getInstallationDirectory(); // rename old client to installer - QString newInstallerFilename = server.installerFilename; + QString newInstallerFilename = config->getInstallerFilename(); if (!newInstallerFilename.isEmpty()) { @@ -944,14 +941,10 @@ bool COperationDialog::createAddRemoveEntry() { CConfigFile *config = CConfigFile::getInstance(); - const CServer &server = config->getServer(); + QString newInstallerFilename = config->getInstallerFilename(); - QString oldInstallerFilename = server.clientFilenameOld; - QString newInstallerFilename = server.installerFilename; - - if (!oldInstallerFilename.isEmpty() && !newInstallerFilename.isEmpty()) + if (!newInstallerFilename.isEmpty()) { - QString oldInstallerFullPath = config->getSrcServerDirectory() + "/" + oldInstallerFilename; QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename; if (QFile::exists(newInstallerFullPath)) @@ -959,7 +952,6 @@ bool COperationDialog::createAddRemoveEntry() #ifdef Q_OS_WIN QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat); - QStringList versionTokens = QString(RYZOM_VERSION).split('.'); QString nativeFullPath = QDir::toNativeSeparators(newInstallerFullPath); settings.setValue("Comments", ""); @@ -994,14 +986,10 @@ bool COperationDialog::updateAddRemoveEntry() { CConfigFile *config = CConfigFile::getInstance(); - const CServer &server = config->getServer(); + QString newInstallerFilename = config->getInstallerFilename(); - QString oldInstallerFilename = server.clientFilenameOld; - QString newInstallerFilename = server.installerFilename; - - if (!oldInstallerFilename.isEmpty() && !newInstallerFilename.isEmpty()) + if (!newInstallerFilename.isEmpty()) { - QString oldInstallerFullPath = config->getSrcServerDirectory() + "/" + oldInstallerFilename; QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename; if (QFile::exists(newInstallerFullPath)) diff --git a/code/ryzom/tools/client/ryzom_installer/src/server.cpp b/code/ryzom/tools/client/ryzom_installer/src/server.cpp index 6ce9bf6b8..88932fa0c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/server.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/server.cpp @@ -40,17 +40,14 @@ void CServer::loadFromSettings(const QSettings &settings) clientFilename = settings.value("client_filename_windows").toString(); clientFilenameOld = settings.value("client_filename_old_windows").toString(); configurationFilename = settings.value("configuration_filename_windows").toString(); - installerFilename = settings.value("installer_filename_windows").toString(); #elif defined(Q_OS_MAC) clientFilename = settings.value("client_filename_osx").toString(); clientFilenameOld = settings.value("client_filename_old_osx").toString(); configurationFilename = settings.value("configuration_filename_osx").toString(); - installerFilename = settings.value("installer_filename_osx").toString(); #else clientFilename = settings.value("client_filename_linux").toString(); clientFilenameOld = settings.value("client_filename_old_linux").toString(); configurationFilename = settings.value("configuration_filename_linux").toString(); - installerFilename = settings.value("installer_filename_linux").toString(); #endif comments = settings.value("comments").toString(); } @@ -71,17 +68,14 @@ void CServer::saveToSettings(QSettings &settings) const settings.setValue("client_filename_windows", clientFilename); settings.setValue("client_filename_old_windows", clientFilenameOld); settings.setValue("configuration_filename_windows", configurationFilename); - settings.setValue("installer_filename_windows", installerFilename); #elif defined(Q_OS_MAC) settings.setValue("client_filename_osx", clientFilename); settings.setValue("client_filename_old_osx", clientFilenameOld); settings.setValue("configuration_filename_osx", configurationFilename); - settings.setValue("installer_filename_osx", installerFilename); #else settings.setValue("client_filename_linux", clientFilename); settings.setValue("client_filename_old_linux", clientFilenameOld); settings.setValue("configuration_filename_linux", configurationFilename); - settings.setValue("installer_filename_linux", installerFilename); #endif settings.setValue("comments", comments); } diff --git a/code/ryzom/tools/client/ryzom_installer/src/server.h b/code/ryzom/tools/client/ryzom_installer/src/server.h index 61c788c4d..33fbbb49e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/server.h +++ b/code/ryzom/tools/client/ryzom_installer/src/server.h @@ -41,7 +41,6 @@ public: QString clientFilename; QString clientFilenameOld; QString configurationFilename; - QString installerFilename; QString comments; void loadFromSettings(const QSettings &settings); From 72144c31310df2bfbadb178e09381a4454d89e65 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:17:57 +0200 Subject: [PATCH 3/9] Fixed: Wrong size for downloaded components --HG-- branch : develop --- .../ryzom_installer/src/uninstalldialog.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp index bfba57840..1330a16bf 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp @@ -265,7 +265,24 @@ void CUninstallDialog::updateSizes() } // downloaded files - qint64 bytes = getDirectorySize(config->getInstallationDirectory(), false); + qint64 bytes = 0; + + QDir dir(config->getInstallationDirectory()); + + QStringList filters; + + filters << "*.log"; + filters << "*.7z"; + filters << "*.bnp"; + filters << "*.zip"; + filters << "*.part"; + + QFileInfoList downloadedFiles = dir.entryInfoList(filters, QDir::Files); + + foreach(const QFileInfo &info, downloadedFiles) + { + bytes += info.size(); + } emit updateSize(m_downloadedFilesIndex, qBytesToHumanReadable(bytes)); From 983f4f81df2d9a8f4628b2414b14910a44979bd1 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:18:25 +0200 Subject: [PATCH 4/9] Fixed: Create Menu directory before creating shortcuts --HG-- branch : develop --- .../tools/client/ryzom_installer/src/profile.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/profile.cpp b/code/ryzom/tools/client/ryzom_installer/src/profile.cpp index 58bde85df..45800a203 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profile.cpp @@ -99,16 +99,28 @@ void CProfile::createShortcuts() const { QString shortcut = getClientDesktopShortcutFullPath(); + // make sure directory exists + QDir().mkpath(CConfigFile::getInstance()->getDesktopDirectory()); + // create desktop shortcut - createShortcut(shortcut, name, exe, profileArguments, icon, workingDir); + if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir)) + { + qDebug() << "Unable to create desktop directory"; + } } if (menuShortcut) { QString shortcut = getClientMenuShortcutFullPath(); + // make sure directory exists + QDir().mkpath(CConfigFile::getInstance()->getMenuDirectory()); + // create menu shortcut - createShortcut(shortcut, name, exe, profileArguments, icon, workingDir); + if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir)) + { + qDebug() << "Unable to create shortcut for client in menu"; + } } } From 2377b6a45d5b9b1f70143f77a15ddec52fa7763f Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:18:48 +0200 Subject: [PATCH 5/9] Changed: Minor changes --HG-- branch : develop --- .../client/ryzom_installer/src/mainwindow.cpp | 14 ++++++++------ .../client/ryzom_installer/src/operationdialog.cpp | 9 ++------- .../tools/client/ryzom_installer/src/utils.cpp | 3 --- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index 04c665197..822570fec 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -245,13 +245,15 @@ void CMainWindow::onUninstall() components = dialog.getSelectedCompenents(); } - COperationDialog dialog; - - dialog.setOperation(OperationUninstall); - dialog.setUninstallComponents(components); - - if (dialog.exec()) { + COperationDialog dialog(this); + + dialog.setOperation(OperationUninstall); + dialog.setUninstallComponents(components); + + if (dialog.exec()) + { + } } } diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index d61d3f8af..ccb560ca2 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -771,14 +771,9 @@ void COperationDialog::copyInstaller() // create menu directory if defined QString path = config->getMenuDirectory(); - if (!path.isEmpty()) + if (!path.isEmpty() && !QDir().mkpath(path)) { - QDir dir; - - if (!dir.mkpath(path)) - { - qDebug() << "Unable to create directory" << path; - } + qDebug() << "Unable to create directory" << path; } // create installer link in menu diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index a35210588..6c61e0f8f 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -229,9 +229,6 @@ bool resolveShortcut(const QWidget &window, const QString &shortcut, QString &pa // Handle success path = QDir::fromNativeSeparators(qFromWide(szGotPath)); } - else - { - } } } } From 53854c88ae1fb11a2599724b1b84bc9669c65114 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:19:41 +0200 Subject: [PATCH 6/9] Fixed: EstimatedSize is in KiB --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 9 ++++++--- 1 file changed, 6 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 ccb560ca2..7d6e872ce 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -991,10 +991,13 @@ bool COperationDialog::updateAddRemoveEntry() { #ifdef Q_OS_WIN QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat); - QStringList versionTokens = QApplication::applicationVersion().split('.'); - settings.setValue("DisplayVersion", QApplication::applicationVersion()); - settings.setValue("EstimatedSize", getDirectorySize(config->getInstallationDirectory(), true)); + QString version = QApplication::applicationVersion(); + + settings.setValue("DisplayVersion", version); + settings.setValue("EstimatedSize", (quint32)(getDirectorySize(config->getInstallationDirectory(), true) / 1024)); // size if in KiB + + QStringList versionTokens = version.split('.'); settings.setValue("MajorVersion", versionTokens[0].toInt()); settings.setValue("MinorVersion", versionTokens[1].toInt()); #endif From 0cab55f3f9da33b8d451e40a6685ae8a53c4c2e2 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:19:53 +0200 Subject: [PATCH 7/9] Changed: Update product comments --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 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 7d6e872ce..b05cb52d4 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -949,7 +949,7 @@ bool COperationDialog::createAddRemoveEntry() QString nativeFullPath = QDir::toNativeSeparators(newInstallerFullPath); - settings.setValue("Comments", ""); + settings.setValue("Comments", config->getProductComments()); settings.setValue("DisplayIcon", nativeFullPath + ",0"); settings.setValue("DisplayName", QApplication::applicationName()); settings.setValue("DisplayVersion", RYZOM_VERSION); From 3df8c752277a17e01125e776a5c4a11192e3f5e5 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:20:25 +0200 Subject: [PATCH 8/9] Changed: Call updateAddRemoveEntry() instead of setting details twice --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index b05cb52d4..5f075d07a 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -952,12 +952,8 @@ bool COperationDialog::createAddRemoveEntry() settings.setValue("Comments", config->getProductComments()); settings.setValue("DisplayIcon", nativeFullPath + ",0"); settings.setValue("DisplayName", QApplication::applicationName()); - settings.setValue("DisplayVersion", RYZOM_VERSION); - settings.setValue("EstimatedSize", getDirectorySize(config->getInstallationDirectory(), true)); settings.setValue("InstallDate", QDateTime::currentDateTime().toString("Ymd")); settings.setValue("InstallLocation", config->getInstallationDirectory()); - settings.setValue("MajorVersion", versionTokens[0].toInt()); - settings.setValue("MinorVersion", versionTokens[1].toInt()); settings.setValue("NoModify", 0); settings.setValue("NoRemove", 0); settings.setValue("NoRepair", 0); @@ -972,6 +968,8 @@ bool COperationDialog::createAddRemoveEntry() } } + updateAddRemoveEntry(); + emit done(); return true; From fc6415d64b88677bd0867818524d8ecce14ed043 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 3 Oct 2016 17:20:43 +0200 Subject: [PATCH 9/9] Fixed: Wrong signals --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 5f075d07a..7391ec148 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -1012,8 +1012,6 @@ bool COperationDialog::deleteAddRemoveEntry() settings.remove(""); #endif - emit done(); - return true; } @@ -1189,7 +1187,7 @@ void COperationDialog::deleteComponentsInstaller() // reset it once it's done m_removeComponents.installer = false; - emit onProgressSuccess(1); + emit success(1); emit done(); } @@ -1224,7 +1222,7 @@ void COperationDialog::deleteComponentsDownloadedFiles() // reset it once it's done m_removeComponents.downloadedFiles = false; - emit onProgressSuccess(1); + emit success(1); emit done(); }