From 9a55bb5783759626e1a8f70b8fa8e6423129b8d1 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2016 18:53:35 +0200 Subject: [PATCH] Changed: Create default profile --HG-- branch : feature-ryzom-installer --- .../client/ryzom_installer/src/configfile.cpp | 36 +++++++++++++++++-- .../client/ryzom_installer/src/configfile.h | 3 ++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index ffc77a9d4..d62a58372 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -585,13 +585,15 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const return CreateProfile; } + QString clientCfg = QString("%1/%2/client.cfg").arg(getProfileDirectory()).arg(profile.id); + // migration profile - if (!getSrcServerDirectory().isEmpty() && QFile::exists(getSrcProfileDirectory() + "/client.cfg") && !QFile::exists(QString("%1/%2/client.cfg").arg(getProfileDirectory()).arg(profile.name))) + if (!getSrcServerDirectory().isEmpty() && QFile::exists(getSrcProfileDirectory() + "/client.cfg") && !QFile::exists(clientCfg)) { return CopyProfileFiles; } - if (!QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk")) + if (shouldCreateDesktopShortcut()) { // TODO: check they point to getClientFullPath() return CreateShortcuts; @@ -599,3 +601,33 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const return Done; } + +bool CConfigFile::createDefaultProfile() +{ + CServer server = getServer(getDefaultServer()); + + CProfile profile; + + profile.id = 0; + profile.executable = getClientFullPath(); + profile.name = QString("Ryzom (%1)").arg(server.name); + profile.server = server.id; + profile.comments = "Default profile created by Ryzom Installer"; + +#ifdef Q_OS_WIN32 + profile.desktopShortcut = QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk"); +#endif + + // TODO + // profile.menuShortcut + + addProfile(profile); + save(); + + return true; +} + +bool CConfigFile::createDefaultShortcuts() +{ + return true; +} diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index ae01ee2af..3426681bc 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -162,6 +162,9 @@ public: InstallationStep getNextStep() const; + bool createDefaultProfile(); + bool createDefaultShortcuts(); + private: int m_defaultServer; int m_defaultProfile;