Changed: Create default profile

This commit is contained in:
kervala 2016-05-14 18:53:35 +02:00
parent 8cc612f477
commit 9fcc916e83
2 changed files with 37 additions and 2 deletions

View file

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

View file

@ -162,6 +162,9 @@ public:
InstallationStep getNextStep() const;
bool createDefaultProfile();
bool createDefaultShortcuts();
private:
int m_defaultServer;
int m_defaultProfile;