Changed: Put Ryzom Installer in Add/Remove

This commit is contained in:
kervala 2016-05-25 23:26:40 +02:00
parent 59889aae88
commit 2c49555595
2 changed files with 74 additions and 1 deletions

View file

@ -33,6 +33,10 @@
#include <QtWinExtras/QWinTaskbarButton> #include <QtWinExtras/QWinTaskbarButton>
#endif #endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef DEBUG_NEW #ifdef DEBUG_NEW
#define new DEBUG_NEW #define new DEBUG_NEW
#endif #endif
@ -427,7 +431,7 @@ bool COperationDialog::createDefaultProfile()
CServer server = config->getServer(config->getDefaultServerIndex()); CServer server = config->getServer(config->getDefaultServerIndex());
m_currentOperation = QApplication::tr("Create default profile"); m_currentOperation = QApplication::tr("Create default profile");
m_currentOperationProgressFormat = QApplication::tr("Deleting %1..."); // m_currentOperationProgressFormat = QApplication::tr("Deleting %1...");
CProfile profile; CProfile profile;
@ -448,6 +452,8 @@ bool COperationDialog::createDefaultProfile()
config->addProfile(profile); config->addProfile(profile);
config->save(); config->save();
createAddRemoveEntry();
emit done(); emit done();
return true; return true;
@ -460,6 +466,72 @@ bool COperationDialog::createDefaultShortcuts()
return true; 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() void COperationDialog::operationPrepare()
{ {
emit prepare(); emit prepare();

View file

@ -90,6 +90,7 @@ protected:
void cleanFiles(); void cleanFiles();
bool createDefaultProfile(); bool createDefaultProfile();
bool createDefaultShortcuts(); bool createDefaultShortcuts();
bool createAddRemoveEntry();
// from CFilesCopier // from CFilesCopier
virtual void operationPrepare(); virtual void operationPrepare();