Merge with develop

This commit is contained in:
kervala 2016-09-20 17:51:27 +02:00
parent 2455fc02d7
commit 61a3bc0c9a
19 changed files with 56153 additions and 10 deletions

View file

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

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