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
QTranslator qtTranslator;
if (qtTranslator.load(locale, "qt", "_", ":/translations"))
if (qtTranslator.load(locale, "qtbase", "_", ":/translations"))
{
QApplication::installTranslator(&qtTranslator);
}

@ -6,5 +6,9 @@
<file>ryzom_configuration_fr.qm</file>
<file>ryzom_configuration_hu.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>
</RCC>

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

@ -122,14 +122,14 @@ int main(int argc, char *argv[])
// load application translations
QTranslator localTranslator;
if (localTranslator.load(locale, "ryzom_installer", "_", "translations"))
if (localTranslator.load(locale, "ryzom_installer", "_", ":/translations"))
{
QApplication::installTranslator(&localTranslator);
}
// load Qt default translations
QTranslator qtTranslator;
if (qtTranslator.load(locale, "qt", "_", "translations"))
if (qtTranslator.load(locale, "qtbase", "_", ":/translations"))
{
QApplication::installTranslator(&qtTranslator);
}
@ -149,8 +149,23 @@ int main(int argc, char *argv[])
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
// 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
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_currentOperationProgressFormat = tr("Extracting %1...");
QString destinationDirectory = server.getDirectory();
CFilesExtractor extractor(this);
extractor.setSourceFile(config->getInstallationDirectory() + "/" + config->expandVariables(server.clientDownloadFilename));
extractor.setDestinationDirectory(server.getDirectory());
extractor.setDestinationDirectory(destinationDirectory);
if (extractor.exec())
{
@ -564,6 +566,8 @@ void COperationDialog::extractDownloadedClient()
{
}
launchUpgradeScript(destinationDirectory, server.clientFilename);
emit done();
}
@ -652,7 +656,14 @@ void COperationDialog::extractBnpClient()
extractor.setDestinationDirectory(destinationDirectory);
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
upgradeScript += "bat";
@ -665,9 +676,9 @@ void COperationDialog::extractBnpClient()
QProcess process;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("RYZOM_CLIENT", QDir::toNativeSeparators(destinationDirectory + "/" + server.clientFilename));
env.insert("UNPACKPATH", QDir::toNativeSeparators(destinationDirectory + "/unpack"));
env.insert("ROOTPATH", QDir::toNativeSeparators(destinationDirectory));
env.insert("RYZOM_CLIENT", QDir::toNativeSeparators(directory + "/" + executable));
env.insert("UNPACKPATH", QDir::toNativeSeparators(directory + "/unpack"));
env.insert("ROOTPATH", QDir::toNativeSeparators(directory));
env.insert("STARTUPPATH", "");
process.setProcessEnvironment(env);
@ -694,7 +705,6 @@ void COperationDialog::extractBnpClient()
}
}
emit done();
}
void COperationDialog::copyInstaller()
@ -888,6 +898,8 @@ bool COperationDialog::createDefaultProfile()
config->addProfile(profile);
config->save();
profile.createClientConfig();
emit done();
return true;
@ -1071,6 +1083,7 @@ void COperationDialog::addComponentsProfiles()
const CProfile &profile = config->getProfile(profileId);
profile.createShortcuts();
profile.createClientConfig();
}
}

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

@ -118,3 +118,55 @@ void CProfile::updateShortcuts() const
deleteShortcuts();
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 deleteShortcuts() const;
void updateShortcuts() const;
bool createClientConfig() const;
};
extern const CProfile NoProfile;

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

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

@ -4,5 +4,9 @@
<file>ryzom_installer_es.qm</file>
<file>ryzom_installer_fr.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>
</RCC>

Loading…
Cancel
Save