2016-02-25 20:19:27 +00:00
|
|
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
// Copyright (C) 2010 Winch Gate Property Limited
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#ifndef CONFIGFILE_H
|
|
|
|
#define CONFIGFILE_H
|
|
|
|
|
|
|
|
struct CServer
|
|
|
|
{
|
|
|
|
CServer()
|
|
|
|
{
|
|
|
|
dataCompressedSize = 0;
|
|
|
|
dataUncompressedSize = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString id;
|
|
|
|
QString name;
|
|
|
|
QString displayUrl;
|
|
|
|
QString dataDownloadUrl;
|
|
|
|
QString dataDownloadFilename;
|
|
|
|
qint64 dataCompressedSize;
|
|
|
|
qint64 dataUncompressedSize;
|
|
|
|
QString clientDownloadUrl;
|
|
|
|
QString clientDownloadFilename;
|
|
|
|
QString clientFilename;
|
|
|
|
QString comments;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const CServer NoServer;
|
|
|
|
|
2016-02-27 17:43:14 +00:00
|
|
|
struct CProfile
|
2016-02-25 20:19:27 +00:00
|
|
|
{
|
2016-02-27 17:43:14 +00:00
|
|
|
CProfile()
|
2016-02-25 20:19:27 +00:00
|
|
|
{
|
|
|
|
id = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int id;
|
|
|
|
QString account;
|
|
|
|
QString name;
|
|
|
|
QString server;
|
|
|
|
QString executable;
|
|
|
|
QString parameters;
|
|
|
|
QString comments;
|
|
|
|
};
|
|
|
|
|
2016-02-27 17:43:14 +00:00
|
|
|
extern const CProfile NoProfile;
|
2016-02-25 20:19:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Config file management and other stuff related to location of files/directories.
|
|
|
|
*
|
|
|
|
* \author Cedric 'Kervala' OCHS
|
|
|
|
* \date 2016
|
|
|
|
*/
|
|
|
|
class CConfigFile : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum InstallationStep
|
|
|
|
{
|
|
|
|
DisplayNoServerError,
|
|
|
|
ShowWizard,
|
|
|
|
DownloadData,
|
|
|
|
ExtractDownloadedData,
|
|
|
|
DownloadClient,
|
|
|
|
ExtractDownloadedClient,
|
|
|
|
CopyServerFiles,
|
2016-02-27 17:43:14 +00:00
|
|
|
CopyProfileFiles,
|
2016-02-25 20:19:27 +00:00
|
|
|
ExtractBnpClient,
|
2016-02-27 17:43:14 +00:00
|
|
|
CreateProfile,
|
2016-02-25 20:19:27 +00:00
|
|
|
CreateShortcuts,
|
|
|
|
Done
|
|
|
|
};
|
|
|
|
|
|
|
|
CConfigFile(QObject *parent = NULL);
|
|
|
|
virtual ~CConfigFile();
|
|
|
|
|
|
|
|
bool load();
|
|
|
|
bool load(const QString &filename);
|
|
|
|
bool save() const;
|
|
|
|
|
|
|
|
static CConfigFile* getInstance();
|
|
|
|
|
|
|
|
int getServersCount() const;
|
|
|
|
const CServer& getServer(int i = -1) const;
|
|
|
|
const CServer& getServer(const QString &id) const;
|
|
|
|
|
2016-02-27 17:43:14 +00:00
|
|
|
int getProfilesCount() const;
|
|
|
|
CProfile getProfile(int i = -1) const;
|
|
|
|
void setProfile(int i, const CProfile &profile);
|
|
|
|
int addProfile(const CProfile &profile);
|
|
|
|
void removeProfile(int i);
|
2016-02-25 20:19:27 +00:00
|
|
|
|
|
|
|
int getDefaultServer() const;
|
2016-02-27 17:43:14 +00:00
|
|
|
int getDefaultProfile() const;
|
2016-02-25 20:19:27 +00:00
|
|
|
|
|
|
|
bool isRyzomInstallerConfigured() const;
|
|
|
|
|
|
|
|
QString getInstallationDirectory() const;
|
|
|
|
void setInstallationDirectory(const QString &directory);
|
|
|
|
|
|
|
|
QString getSrcServerDirectory() const;
|
|
|
|
void setSrcServerDirectory(const QString &directory);
|
|
|
|
|
2016-02-27 17:43:14 +00:00
|
|
|
QString getProfileDirectory() const;
|
|
|
|
QString getSrcProfileDirectory() const;
|
2016-02-25 20:19:27 +00:00
|
|
|
|
|
|
|
static bool has64bitsOS();
|
|
|
|
|
|
|
|
// default directories
|
|
|
|
static QString getCurrentDirectory();
|
|
|
|
static QString getParentDirectory();
|
|
|
|
static QString getApplicationDirectory();
|
|
|
|
static QString getOldInstallationDirectory();
|
|
|
|
static QString getNewInstallationDirectory();
|
|
|
|
|
|
|
|
bool isRyzomInstalledIn(const QString &directory) const;
|
|
|
|
bool areRyzomDataInstalledIn(const QString &directory) const;
|
|
|
|
bool isRyzomClientInstalledIn(const QString &directory) const;
|
|
|
|
|
|
|
|
// installation choices
|
|
|
|
bool use64BitsClient() const;
|
|
|
|
void setUse64BitsClient(bool on);
|
|
|
|
|
|
|
|
QString expandVariables(const QString &str);
|
|
|
|
|
|
|
|
QString getClientArch() const;
|
|
|
|
|
|
|
|
QString getClientFullPath() const;
|
|
|
|
|
|
|
|
QString getSrcServerClientBNPFullPath() const;
|
|
|
|
|
|
|
|
InstallationStep getNextStep() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_defaultServer;
|
2016-02-27 17:43:14 +00:00
|
|
|
int m_defaultProfile;
|
2016-02-25 20:19:27 +00:00
|
|
|
|
|
|
|
QVector<CServer> m_servers;
|
2016-02-27 17:43:14 +00:00
|
|
|
QVector<CProfile> m_profiles;
|
2016-02-25 20:19:27 +00:00
|
|
|
|
|
|
|
QString m_installationDirectory;
|
|
|
|
QString m_srcDirectory;
|
|
|
|
bool m_use64BitsClient;
|
|
|
|
QString m_language;
|
|
|
|
|
|
|
|
QString m_defaultConfigPath;
|
|
|
|
QString m_configPath;
|
|
|
|
|
|
|
|
static CConfigFile *s_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|