Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
kervala 8 years ago
commit e3576787ed

@ -67,7 +67,7 @@ int main(sint32 argc, char **argv)
// load Qt default translations // load Qt default translations
QTranslator qtTranslator; QTranslator qtTranslator;
if (qtTranslator.load(locale, "qt", "_", ":/translations")) if (qtTranslator.load(locale, "qtbase", "_", ":/translations"))
{ {
QApplication::installTranslator(&qtTranslator); QApplication::installTranslator(&qtTranslator);
} }

@ -6,5 +6,9 @@
<file>ryzom_configuration_fr.qm</file> <file>ryzom_configuration_fr.qm</file>
<file>ryzom_configuration_hu.qm</file> <file>ryzom_configuration_hu.qm</file>
<file>ryzom_configuration_ru.qm</file> <file>ryzom_configuration_ru.qm</file>
<file>qtbase_de.qm</file>
<file>qtbase_es.qm</file>
<file>qtbase_fr.qm</file>
<file>qtbase_ru.qm</file>
</qresource> </qresource>
</RCC> </RCC>

@ -54,6 +54,8 @@ public:
CProfiles getBackupProfiles() const { return m_backupProfiles; } CProfiles getBackupProfiles() const { return m_backupProfiles; }
void backupProfiles(); void backupProfiles();
QString getLanguage() const { return m_language; }
int getProfilesCount() const; int getProfilesCount() const;
CProfile getProfile(int i = -1) const; CProfile getProfile(int i = -1) const;
CProfile getProfile(const QString &id) const; CProfile getProfile(const QString &id) const;

@ -122,14 +122,14 @@ int main(int argc, char *argv[])
// load application translations // load application translations
QTranslator localTranslator; QTranslator localTranslator;
if (localTranslator.load(locale, "ryzom_installer", "_", "translations")) if (localTranslator.load(locale, "ryzom_installer", "_", ":/translations"))
{ {
QApplication::installTranslator(&localTranslator); QApplication::installTranslator(&localTranslator);
} }
// load Qt default translations // load Qt default translations
QTranslator qtTranslator; QTranslator qtTranslator;
if (qtTranslator.load(locale, "qt", "_", "translations")) if (qtTranslator.load(locale, "qtbase", "_", ":/translations"))
{ {
QApplication::installTranslator(&qtTranslator); QApplication::installTranslator(&qtTranslator);
} }
@ -149,8 +149,23 @@ int main(int argc, char *argv[])
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
// check if launched from TEMP directory // check if launched from TEMP directory
if (step == Done && QApplication::applicationDirPath() != tempPath) if (step == Done && !QApplication::applicationDirPath().startsWith(tempPath))
{ {
// try to delete all temporary installers
QDir tempDir(tempPath);
QStringList filter;
filter << "ryzom_installer_*";
QStringList dirs = tempDir.entryList(filter, QDir::Dirs);
foreach(const QString &dir, dirs)
{
QDir(dir).removeRecursively();
}
tempPath += QString("/ryzom_installer_%1").arg(QDateTime::currentMSecsSinceEpoch());
// copy installer and required files to TEMP directory // copy installer and required files to TEMP directory
if (copyInstallerFiles(config.getInstallerRequiredFiles(), tempPath)) if (copyInstallerFiles(config.getInstallerRequiredFiles(), tempPath))
{ {

@ -553,9 +553,11 @@ void COperationDialog::extractDownloadedClient()
m_currentOperation = tr("Extract client files required by server %1").arg(server.name); m_currentOperation = tr("Extract client files required by server %1").arg(server.name);
m_currentOperationProgressFormat = tr("Extracting %1..."); m_currentOperationProgressFormat = tr("Extracting %1...");
QString destinationDirectory = server.getDirectory();
CFilesExtractor extractor(this); CFilesExtractor extractor(this);
extractor.setSourceFile(config->getInstallationDirectory() + "/" + config->expandVariables(server.clientDownloadFilename)); extractor.setSourceFile(config->getInstallationDirectory() + "/" + config->expandVariables(server.clientDownloadFilename));
extractor.setDestinationDirectory(server.getDirectory()); extractor.setDestinationDirectory(destinationDirectory);
if (extractor.exec()) if (extractor.exec())
{ {
@ -564,6 +566,8 @@ void COperationDialog::extractDownloadedClient()
{ {
} }
launchUpgradeScript(destinationDirectory, server.clientFilename);
emit done(); emit done();
} }
@ -652,7 +656,14 @@ void COperationDialog::extractBnpClient()
extractor.setDestinationDirectory(destinationDirectory); extractor.setDestinationDirectory(destinationDirectory);
extractor.exec(); extractor.exec();
QString upgradeScript = destinationDirectory + "/upgd_nl."; launchUpgradeScript(destinationDirectory, server.clientFilename);
emit done();
}
void COperationDialog::launchUpgradeScript(const QString &directory, const QString &executable)
{
QString upgradeScript = directory + "/upgd_nl.";
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
upgradeScript += "bat"; upgradeScript += "bat";
@ -665,9 +676,9 @@ void COperationDialog::extractBnpClient()
QProcess process; QProcess process;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("RYZOM_CLIENT", QDir::toNativeSeparators(destinationDirectory + "/" + server.clientFilename)); env.insert("RYZOM_CLIENT", QDir::toNativeSeparators(directory + "/" + executable));
env.insert("UNPACKPATH", QDir::toNativeSeparators(destinationDirectory + "/unpack")); env.insert("UNPACKPATH", QDir::toNativeSeparators(directory + "/unpack"));
env.insert("ROOTPATH", QDir::toNativeSeparators(destinationDirectory)); env.insert("ROOTPATH", QDir::toNativeSeparators(directory));
env.insert("STARTUPPATH", ""); env.insert("STARTUPPATH", "");
process.setProcessEnvironment(env); process.setProcessEnvironment(env);
@ -694,7 +705,6 @@ void COperationDialog::extractBnpClient()
} }
} }
emit done();
} }
void COperationDialog::copyInstaller() void COperationDialog::copyInstaller()
@ -888,6 +898,8 @@ bool COperationDialog::createDefaultProfile()
config->addProfile(profile); config->addProfile(profile);
config->save(); config->save();
profile.createClientConfig();
emit done(); emit done();
return true; return true;
@ -1071,6 +1083,7 @@ void COperationDialog::addComponentsProfiles()
const CProfile &profile = config->getProfile(profileId); const CProfile &profile = config->getProfile(profileId);
profile.createShortcuts(); profile.createShortcuts();
profile.createClientConfig();
} }
} }

@ -132,6 +132,7 @@ protected:
virtual bool operationShouldStop(); virtual bool operationShouldStop();
void renamePartFile(); void renamePartFile();
void launchUpgradeScript(const QString &directory, const QString &executable);
// hacks to prevent an infinite loop // hacks to prevent an infinite loop
void acceptDelayed(); void acceptDelayed();

@ -118,3 +118,55 @@ void CProfile::updateShortcuts() const
deleteShortcuts(); deleteShortcuts();
createShortcuts(); createShortcuts();
} }
bool CProfile::createClientConfig() const
{
// where to search and put client.cfg
QString directory = getDirectory();
QString filename = directory + "/client.cfg";
const CServer &s = CConfigFile::getInstance()->getServer(server);
// create the 2 initial lines of client.cfg
QString rootConfigFilenameLine = QString("RootConfigFilename = \"%1\";").arg(s.getDefaultClientConfigFullPath());
QString languageCodeline = QString("LanguageCode = \"%1\";\n").arg(CConfigFile::getInstance()->getLanguage());
QString content;
QFile file(filename);
if (file.open(QFile::ReadOnly))
{
// read while content as UTF-8 text
content = QString::fromUtf8(file.readAll());
// search the end of the first line
int pos = content.indexOf('\n');
if (pos > 0)
{
// don't remove the \r under Windows
if (content[pos - 1] == '\r') pos--;
// update RootConfigFilename to be sure it points on right client_default.cfg
content = content.mid(pos);
content.prepend(rootConfigFilenameLine);
}
file.close();
}
else
{
// create initial client.cfg
content += rootConfigFilenameLine + "\n";
content += languageCodeline + "\n";
}
// write the new content of client.cfg
if (!file.open(QFile::WriteOnly)) return false;
file.write(content.toUtf8());
file.close();
return true;
}

@ -46,6 +46,8 @@ public:
void createShortcuts() const; void createShortcuts() const;
void deleteShortcuts() const; void deleteShortcuts() const;
void updateShortcuts() const; void updateShortcuts() const;
bool createClientConfig() const;
}; };
extern const CProfile NoProfile; extern const CProfile NoProfile;

@ -42,3 +42,8 @@ QString CServer::getConfigurationFullPath() const
return getDirectory() + "/" + configurationFilename; return getDirectory() + "/" + configurationFilename;
} }
QString CServer::getDefaultClientConfigFullPath() const
{
return getDirectory() + "/client_default.cfg";
}

@ -47,6 +47,7 @@ public:
QString getDirectory() const; QString getDirectory() const;
QString getClientFullPath() const; QString getClientFullPath() const;
QString getConfigurationFullPath() const; QString getConfigurationFullPath() const;
QString getDefaultClientConfigFullPath() const;
}; };
extern const CServer NoServer; extern const CServer NoServer;

@ -4,5 +4,9 @@
<file>ryzom_installer_es.qm</file> <file>ryzom_installer_es.qm</file>
<file>ryzom_installer_fr.qm</file> <file>ryzom_installer_fr.qm</file>
<file>ryzom_installer_ru.qm</file> <file>ryzom_installer_ru.qm</file>
<file>qtbase_de.qm</file>
<file>qtbase_es.qm</file>
<file>qtbase_fr.qm</file>
<file>qtbase_ru.qm</file>
</qresource> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save