Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-10-03 17:22:46 +02:00
commit 67cc549fe6
11 changed files with 91 additions and 63 deletions

View file

@ -4,6 +4,7 @@
</qresource> </qresource>
<qresource prefix="/icons"> <qresource prefix="/icons">
<file>ryzom.ico</file> <file>ryzom.ico</file>
<file>ryzom_installer.png</file>
</qresource> </qresource>
<qresource prefix="/templates"> <qresource prefix="/templates">
<file>template.desktop</file> <file>template.desktop</file>

View file

@ -1,7 +1,10 @@
version=2 version=3
[common] [common]
installation_directory= 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] [product]
name=Ryzom name=Ryzom
@ -31,9 +34,6 @@ client_filename_old_windows=client_ryzom_rd.exe
configuration_filename_windows=ryzom_configuration_qt_r.exe configuration_filename_windows=ryzom_configuration_qt_r.exe
configuration_filename_osx=Ryzom.app/Contents/MacOS/RyzomConfiguration configuration_filename_osx=Ryzom.app/Contents/MacOS/RyzomConfiguration
configuration_filename_linux=ryzom_configuration_qt 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= comments=
[profiles] [profiles]

View file

@ -82,6 +82,18 @@ bool CConfigFile::load(const QString &filename)
m_installationDirectory = settings.value("installation_directory").toString(); m_installationDirectory = settings.value("installation_directory").toString();
m_use64BitsClient = settings.value("use_64bits_client", true).toBool(); m_use64BitsClient = settings.value("use_64bits_client", true).toBool();
m_shouldUninstallOldClient = settings.value("should_uninstall_old_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(); settings.endGroup();
if (!useDefaultValues) if (!useDefaultValues)
@ -129,6 +141,9 @@ bool CConfigFile::load(const QString &filename)
settings.endGroup(); settings.endGroup();
} }
// save file with new values
if (useDefaultValues) save();
return !m_servers.isEmpty(); return !m_servers.isEmpty();
} }
@ -144,6 +159,15 @@ bool CConfigFile::save() const
settings.setValue("installation_directory", m_installationDirectory); settings.setValue("installation_directory", m_installationDirectory);
settings.setValue("use_64bits_client", m_use64BitsClient); settings.setValue("use_64bits_client", m_use64BitsClient);
settings.setValue("should_uninstall_old_client", m_shouldUninstallOldClient); 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.endGroup();
settings.beginGroup("product"); settings.beginGroup("product");
@ -686,10 +710,7 @@ bool CConfigFile::shouldCreateMenuShortcut() const
bool CConfigFile::shouldCopyInstaller() const bool CConfigFile::shouldCopyInstaller() const
{ {
const CProfile &p = getProfile(); QString installerDst = getInstallationDirectory() + "/" + m_installerFilename;
const CServer &s = getServer(p.server);
QString installerDst = getInstallationDirectory() + "/" + s.installerFilename;
// if installer not found in installation directory, extract it from BNP // if installer not found in installation directory, extract it from BNP
if (!QFile::exists(installerDst)) return true; if (!QFile::exists(installerDst)) return true;

View file

@ -116,6 +116,8 @@ public:
bool uninstallingOldClient() const; bool uninstallingOldClient() const;
void setUninstallingOldClient(bool on) const; void setUninstallingOldClient(bool on) const;
QString getInstallerFilename() const { return m_installerFilename; }
QString expandVariables(const QString &str) const; QString expandVariables(const QString &str) const;
QString getClientArch() const; QString getClientArch() const;
@ -155,6 +157,7 @@ private:
QString m_srcDirectory; QString m_srcDirectory;
bool m_use64BitsClient; bool m_use64BitsClient;
bool m_shouldUninstallOldClient; bool m_shouldUninstallOldClient;
QString m_installerFilename;
QString m_language; QString m_language;
QString m_defaultConfigPath; QString m_defaultConfigPath;

View file

@ -245,7 +245,8 @@ void CMainWindow::onUninstall()
components = dialog.getSelectedCompenents(); components = dialog.getSelectedCompenents();
} }
COperationDialog dialog; {
COperationDialog dialog(this);
dialog.setOperation(OperationUninstall); dialog.setOperation(OperationUninstall);
dialog.setUninstallComponents(components); dialog.setUninstallComponents(components);
@ -253,6 +254,7 @@ void CMainWindow::onUninstall()
if (dialog.exec()) if (dialog.exec())
{ {
} }
}
} }
void CMainWindow::onQuit() void CMainWindow::onQuit()

View file

@ -735,15 +735,12 @@ void COperationDialog::copyInstaller()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
// default server
const CServer &server = config->getServer();
m_currentOperation = tr("Copying installer to new location..."); m_currentOperation = tr("Copying installer to new location...");
QString destinationDirectory = config->getInstallationDirectory(); QString destinationDirectory = config->getInstallationDirectory();
// rename old client to installer // rename old client to installer
QString newInstallerFilename = server.installerFilename; QString newInstallerFilename = config->getInstallerFilename();
if (!newInstallerFilename.isEmpty()) if (!newInstallerFilename.isEmpty())
{ {
@ -774,15 +771,10 @@ void COperationDialog::copyInstaller()
// create menu directory if defined // create menu directory if defined
QString path = config->getMenuDirectory(); QString path = config->getMenuDirectory();
if (!path.isEmpty()) if (!path.isEmpty() && !QDir().mkpath(path))
{
QDir dir;
if (!dir.mkpath(path))
{ {
qDebug() << "Unable to create directory" << path; qDebug() << "Unable to create directory" << path;
} }
}
// create installer link in menu // create installer link in menu
QString executable = newInstallerFullPath; QString executable = newInstallerFullPath;
@ -944,14 +936,10 @@ bool COperationDialog::createAddRemoveEntry()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
const CServer &server = config->getServer(); QString newInstallerFilename = config->getInstallerFilename();
QString oldInstallerFilename = server.clientFilenameOld; if (!newInstallerFilename.isEmpty())
QString newInstallerFilename = server.installerFilename;
if (!oldInstallerFilename.isEmpty() && !newInstallerFilename.isEmpty())
{ {
QString oldInstallerFullPath = config->getSrcServerDirectory() + "/" + oldInstallerFilename;
QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename; QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename;
if (QFile::exists(newInstallerFullPath)) if (QFile::exists(newInstallerFullPath))
@ -959,18 +947,13 @@ bool COperationDialog::createAddRemoveEntry()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat); QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat);
QStringList versionTokens = QString(RYZOM_VERSION).split('.');
QString nativeFullPath = QDir::toNativeSeparators(newInstallerFullPath); QString nativeFullPath = QDir::toNativeSeparators(newInstallerFullPath);
settings.setValue("Comments", ""); settings.setValue("Comments", config->getProductComments());
settings.setValue("DisplayIcon", nativeFullPath + ",0"); settings.setValue("DisplayIcon", nativeFullPath + ",0");
settings.setValue("DisplayName", QApplication::applicationName()); settings.setValue("DisplayName", QApplication::applicationName());
settings.setValue("DisplayVersion", RYZOM_VERSION);
settings.setValue("EstimatedSize", getDirectorySize(config->getInstallationDirectory(), true));
settings.setValue("InstallDate", QDateTime::currentDateTime().toString("Ymd")); settings.setValue("InstallDate", QDateTime::currentDateTime().toString("Ymd"));
settings.setValue("InstallLocation", config->getInstallationDirectory()); settings.setValue("InstallLocation", config->getInstallationDirectory());
settings.setValue("MajorVersion", versionTokens[0].toInt());
settings.setValue("MinorVersion", versionTokens[1].toInt());
settings.setValue("NoModify", 0); settings.setValue("NoModify", 0);
settings.setValue("NoRemove", 0); settings.setValue("NoRemove", 0);
settings.setValue("NoRepair", 0); settings.setValue("NoRepair", 0);
@ -985,6 +968,8 @@ bool COperationDialog::createAddRemoveEntry()
} }
} }
updateAddRemoveEntry();
emit done(); emit done();
return true; return true;
@ -994,24 +979,23 @@ bool COperationDialog::updateAddRemoveEntry()
{ {
CConfigFile *config = CConfigFile::getInstance(); CConfigFile *config = CConfigFile::getInstance();
const CServer &server = config->getServer(); QString newInstallerFilename = config->getInstallerFilename();
QString oldInstallerFilename = server.clientFilenameOld; if (!newInstallerFilename.isEmpty())
QString newInstallerFilename = server.installerFilename;
if (!oldInstallerFilename.isEmpty() && !newInstallerFilename.isEmpty())
{ {
QString oldInstallerFullPath = config->getSrcServerDirectory() + "/" + oldInstallerFilename;
QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename; QString newInstallerFullPath = config->getInstallationDirectory() + "/" + newInstallerFilename;
if (QFile::exists(newInstallerFullPath)) if (QFile::exists(newInstallerFullPath))
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat); QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Ryzom", QSettings::NativeFormat);
QStringList versionTokens = QApplication::applicationVersion().split('.');
settings.setValue("DisplayVersion", QApplication::applicationVersion()); QString version = QApplication::applicationVersion();
settings.setValue("EstimatedSize", getDirectorySize(config->getInstallationDirectory(), true));
settings.setValue("DisplayVersion", version);
settings.setValue("EstimatedSize", (quint32)(getDirectorySize(config->getInstallationDirectory(), true) / 1024)); // size if in KiB
QStringList versionTokens = version.split('.');
settings.setValue("MajorVersion", versionTokens[0].toInt()); settings.setValue("MajorVersion", versionTokens[0].toInt());
settings.setValue("MinorVersion", versionTokens[1].toInt()); settings.setValue("MinorVersion", versionTokens[1].toInt());
#endif #endif
@ -1028,8 +1012,6 @@ bool COperationDialog::deleteAddRemoveEntry()
settings.remove(""); settings.remove("");
#endif #endif
emit done();
return true; return true;
} }
@ -1205,7 +1187,7 @@ void COperationDialog::deleteComponentsInstaller()
// reset it once it's done // reset it once it's done
m_removeComponents.installer = false; m_removeComponents.installer = false;
emit onProgressSuccess(1); emit success(1);
emit done(); emit done();
} }
@ -1240,7 +1222,7 @@ void COperationDialog::deleteComponentsDownloadedFiles()
// reset it once it's done // reset it once it's done
m_removeComponents.downloadedFiles = false; m_removeComponents.downloadedFiles = false;
emit onProgressSuccess(1); emit success(1);
emit done(); emit done();
} }

View file

@ -99,16 +99,28 @@ void CProfile::createShortcuts() const
{ {
QString shortcut = getClientDesktopShortcutFullPath(); QString shortcut = getClientDesktopShortcutFullPath();
// make sure directory exists
QDir().mkpath(CConfigFile::getInstance()->getDesktopDirectory());
// create desktop shortcut // create desktop shortcut
createShortcut(shortcut, name, exe, profileArguments, icon, workingDir); if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir))
{
qDebug() << "Unable to create desktop directory";
}
} }
if (menuShortcut) if (menuShortcut)
{ {
QString shortcut = getClientMenuShortcutFullPath(); QString shortcut = getClientMenuShortcutFullPath();
// make sure directory exists
QDir().mkpath(CConfigFile::getInstance()->getMenuDirectory());
// create menu shortcut // create menu shortcut
createShortcut(shortcut, name, exe, profileArguments, icon, workingDir); if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir))
{
qDebug() << "Unable to create shortcut for client in menu";
}
} }
} }

View file

@ -40,17 +40,14 @@ void CServer::loadFromSettings(const QSettings &settings)
clientFilename = settings.value("client_filename_windows").toString(); clientFilename = settings.value("client_filename_windows").toString();
clientFilenameOld = settings.value("client_filename_old_windows").toString(); clientFilenameOld = settings.value("client_filename_old_windows").toString();
configurationFilename = settings.value("configuration_filename_windows").toString(); configurationFilename = settings.value("configuration_filename_windows").toString();
installerFilename = settings.value("installer_filename_windows").toString();
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
clientFilename = settings.value("client_filename_osx").toString(); clientFilename = settings.value("client_filename_osx").toString();
clientFilenameOld = settings.value("client_filename_old_osx").toString(); clientFilenameOld = settings.value("client_filename_old_osx").toString();
configurationFilename = settings.value("configuration_filename_osx").toString(); configurationFilename = settings.value("configuration_filename_osx").toString();
installerFilename = settings.value("installer_filename_osx").toString();
#else #else
clientFilename = settings.value("client_filename_linux").toString(); clientFilename = settings.value("client_filename_linux").toString();
clientFilenameOld = settings.value("client_filename_old_linux").toString(); clientFilenameOld = settings.value("client_filename_old_linux").toString();
configurationFilename = settings.value("configuration_filename_linux").toString(); configurationFilename = settings.value("configuration_filename_linux").toString();
installerFilename = settings.value("installer_filename_linux").toString();
#endif #endif
comments = settings.value("comments").toString(); 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_windows", clientFilename);
settings.setValue("client_filename_old_windows", clientFilenameOld); settings.setValue("client_filename_old_windows", clientFilenameOld);
settings.setValue("configuration_filename_windows", configurationFilename); settings.setValue("configuration_filename_windows", configurationFilename);
settings.setValue("installer_filename_windows", installerFilename);
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
settings.setValue("client_filename_osx", clientFilename); settings.setValue("client_filename_osx", clientFilename);
settings.setValue("client_filename_old_osx", clientFilenameOld); settings.setValue("client_filename_old_osx", clientFilenameOld);
settings.setValue("configuration_filename_osx", configurationFilename); settings.setValue("configuration_filename_osx", configurationFilename);
settings.setValue("installer_filename_osx", installerFilename);
#else #else
settings.setValue("client_filename_linux", clientFilename); settings.setValue("client_filename_linux", clientFilename);
settings.setValue("client_filename_old_linux", clientFilenameOld); settings.setValue("client_filename_old_linux", clientFilenameOld);
settings.setValue("configuration_filename_linux", configurationFilename); settings.setValue("configuration_filename_linux", configurationFilename);
settings.setValue("installer_filename_linux", installerFilename);
#endif #endif
settings.setValue("comments", comments); settings.setValue("comments", comments);
} }

View file

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

View file

@ -265,7 +265,24 @@ void CUninstallDialog::updateSizes()
} }
// downloaded files // downloaded files
qint64 bytes = getDirectorySize(config->getInstallationDirectory(), false); qint64 bytes = 0;
QDir dir(config->getInstallationDirectory());
QStringList filters;
filters << "*.log";
filters << "*.7z";
filters << "*.bnp";
filters << "*.zip";
filters << "*.part";
QFileInfoList downloadedFiles = dir.entryInfoList(filters, QDir::Files);
foreach(const QFileInfo &info, downloadedFiles)
{
bytes += info.size();
}
emit updateSize(m_downloadedFilesIndex, qBytesToHumanReadable(bytes)); emit updateSize(m_downloadedFilesIndex, qBytesToHumanReadable(bytes));

View file

@ -229,9 +229,6 @@ bool resolveShortcut(const QWidget &window, const QString &shortcut, QString &pa
// Handle success // Handle success
path = QDir::fromNativeSeparators(qFromWide(szGotPath)); path = QDir::fromNativeSeparators(qFromWide(szGotPath));
} }
else
{
}
} }
} }
} }