Changed: Create default profile

This commit is contained in:
kervala 2016-05-14 18:53:35 +02:00
parent a63cea2a59
commit 994e90e58f
2 changed files with 37 additions and 2 deletions

View file

@ -585,13 +585,15 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
return CreateProfile; return CreateProfile;
} }
QString clientCfg = QString("%1/%2/client.cfg").arg(getProfileDirectory()).arg(profile.id);
// migration profile // 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; return CopyProfileFiles;
} }
if (!QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk")) if (shouldCreateDesktopShortcut())
{ {
// TODO: check they point to getClientFullPath() // TODO: check they point to getClientFullPath()
return CreateShortcuts; return CreateShortcuts;
@ -599,3 +601,33 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
return Done; 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; InstallationStep getNextStep() const;
bool createDefaultProfile();
bool createDefaultShortcuts();
private: private:
int m_defaultServer; int m_defaultServer;
int m_defaultProfile; int m_defaultProfile;