Changed: Installer filename should not depend on server

This commit is contained in:
kervala 2016-10-03 17:17:20 +02:00
parent 1547e22d6f
commit 15f5bf6505
6 changed files with 37 additions and 35 deletions

View file

@ -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]

View file

@ -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;

View file

@ -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;

View file

@ -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))

View file

@ -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);
}

View file

@ -41,7 +41,6 @@ public:
QString clientFilename;
QString clientFilenameOld;
QString configurationFilename;
QString installerFilename;
QString comments;
void loadFromSettings(const QSettings &settings);