From 0489869a786c644d305557860dbff10d9fff9166 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 25 May 2016 23:26:40 +0200 Subject: [PATCH] Changed: Put Ryzom Installer in Add/Remove --- .../ryzom_installer/src/operationdialog.cpp | 74 ++++++++++++++++++- .../ryzom_installer/src/operationdialog.h | 1 + 2 files changed, 74 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 50cbd9d78..765c66127 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -33,6 +33,10 @@ #include #endif +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifdef DEBUG_NEW #define new DEBUG_NEW #endif @@ -427,7 +431,7 @@ bool COperationDialog::createDefaultProfile() CServer server = config->getServer(config->getDefaultServerIndex()); m_currentOperation = QApplication::tr("Create default profile"); - m_currentOperationProgressFormat = QApplication::tr("Deleting %1..."); +// m_currentOperationProgressFormat = QApplication::tr("Deleting %1..."); CProfile profile; @@ -448,6 +452,8 @@ bool COperationDialog::createDefaultProfile() config->addProfile(profile); config->save(); + createAddRemoveEntry(); + emit done(); return true; @@ -460,6 +466,72 @@ bool COperationDialog::createDefaultShortcuts() return true; } +bool COperationDialog::createAddRemoveEntry() +{ + QString ff = QApplication::applicationFilePath(); + + CConfigFile *config = CConfigFile::getInstance(); + + CFilesCopier copier(this); + + const CServer &server = config->getServer(); + + QString oldInstallerFilename = server.clientFilenameOld; + QString newInstallerFilename = server.installerFilename; + + if (!oldInstallerFilename.isEmpty() && !newInstallerFilename.isEmpty()) + { + QString oldInstallerFullPath = config->getSrcServerDirectory() + "/" + oldInstallerFilename; + QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename; + + if (QFile::exists(oldInstallerFullPath) && !QFile::exists(newInstallerFullPath)) + { + QStringList filter; + filter << oldInstallerFilename; + filter << "msvcp100.dll"; + filter << "msvcr100.dll"; + + copier.setIncludeFilter(filter); + copier.setDesinationDirectory(config->getInstallationDirectory()); + copier.exec(); + + QFile::rename(oldInstallerFullPath, newInstallerFullPath); + } + + if (QFile::exists(newInstallerFullPath)) + { + QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat); + + QStringList versionTokens = QString(RYZOM_VERSION).split('.'); + + settings.setValue("Comments", ""); + settings.setValue("DisplayIcon", QDir::toNativeSeparators(newInstallerFullPath) + ",0"); + settings.setValue("DisplayName", "Ryzom"); + settings.setValue("DisplayVersion", RYZOM_VERSION); + settings.setValue("EstimatedSize", 1500000); // TODO: compute real size + 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); + settings.setValue("Publisher", AUTHOR); + settings.setValue("QuietUninstallString", QDir::toNativeSeparators(newInstallerFullPath) + " -u -s"); + settings.setValue("UninstallString", QDir::toNativeSeparators(newInstallerFullPath) + " -u"); + settings.setValue("URLUpdateInfo", "http://ryzom.fr/info"); + settings.setValue("URLInfoAbout", "http://ryzom.fr/info2"); + // settings.setValue("sEstimatedSize2", 0); + settings.setValue("HelpLink", "http://ryzom.fr/support"); + // ModifyPath + } + } + +// emit done(); + + return true; +} + void COperationDialog::operationPrepare() { emit prepare(); diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index 39ab5437d..c8a7c1276 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -90,6 +90,7 @@ protected: void cleanFiles(); bool createDefaultProfile(); bool createDefaultShortcuts(); + bool createAddRemoveEntry(); // from CFilesCopier virtual void operationPrepare();