1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "operation.h"
25 * Config file management and other stuff related to location of files/directories.
27 * \author Cedric 'Kervala' OCHS
30 class CConfigFile
: public QObject
35 CConfigFile(QObject
*parent
= NULL
);
36 virtual ~CConfigFile();
39 bool load(const QString
&filename
);
43 static CConfigFile
* getInstance();
45 CServers
getServers() const { return m_servers
; }
46 void setServers(const CServers
&servers
) { m_servers
= servers
; }
48 int getServersCount() const;
49 const CServer
& getServer(int i
= -1) const;
50 const CServer
& getServer(const QString
&id
) const;
52 CProfiles
getProfiles() const { return m_profiles
; }
53 void setProfiles(const CProfiles
&profiles
) { m_profiles
= profiles
; }
55 CProfiles
getBackupProfiles() const { return m_backupProfiles
; }
56 CProfile
getBackupProfile(const QString
&id
) const;
57 void backupProfiles();
59 QString
getLanguage() const { return m_language
; }
61 bool getInstallerCopied() const { return m_installerCopied
; }
62 void setInstallerCopied(bool copied
) { m_installerCopied
= copied
; }
64 int getProfilesCount() const;
65 CProfile
getProfile(int i
= -1) const;
66 CProfile
getProfile(const QString
&id
) const;
67 void setProfile(int i
, const CProfile
&profile
);
68 int addProfile(const CProfile
&profile
);
69 void removeProfile(int i
);
70 void removeProfile(const QString
&id
);
72 int getDefaultServerIndex() const;
73 void setDefaultServerIndex(int index
);
75 int getDefaultProfileIndex() const;
76 void setDefaultProfileIndex(int index
);
78 bool isRyzomInstallerConfigured() const;
80 QString
getInstallationDirectory() const;
81 void setInstallationDirectory(const QString
&directory
);
83 QString
getSrcServerDirectory() const;
84 void setSrcServerDirectory(const QString
&directory
);
86 QString
getProfileDirectory() const;
87 QString
getSrcProfileDirectory() const;
89 QString
getDesktopDirectory() const;
90 QString
getMenuDirectory() const;
92 static bool has64bitsOS();
94 // default directories
95 static QString
getCurrentDirectory();
96 static QString
getParentDirectory();
97 static QString
getNewInstallationDirectory();
98 static QString
getNewInstallationLanguage();
100 // status of installation
101 bool isRyzomInstalledIn(const QString
&directory
) const;
102 bool areRyzomDataInstalledIn(const QString
&directory
) const;
103 bool isRyzomClientInstalledIn(const QString
&directory
) const;
105 bool foundTemporaryFiles(const QString
&directory
) const;
106 bool shouldCreateDesktopShortcut() const;
107 bool shouldCreateMenuShortcut() const;
108 int compareInstallersVersion() const;
110 // installation choices
111 bool use64BitsClient() const;
112 void setUse64BitsClient(bool on
);
114 bool shouldUninstallOldClient() const;
115 void setShouldUninstallOldClient(bool on
);
117 bool ignoreFreeDiskSpaceChecks() const;
118 void setIgnoreFreeDiskSpaceChecks(bool on
);
120 bool uninstallingOldClient() const;
121 void setUninstallingOldClient(bool on
) const;
123 QString
getInstallerFilename() const { return m_installerFilename
; }
125 QString
expandVariables(const QString
&str
) const;
127 QString
getClientArch() const;
129 QString
getInstallerCurrentFilePath() const;
130 QString
getInstallerCurrentDirPath() const;
131 QString
getInstallerInstalledFilePath() const;
132 QString
getInstallerInstalledDirPath() const;
134 QString
getInstallerMenuShortcutFullPath() const;
135 QString
getInstallerDesktopShortcutFullPath() const;
137 QStringList
getInstallerRequiredFiles() const;
139 QString
getSrcServerClientBNPFullPath() const;
141 OperationStep
getInstallNextStep() const;
144 QString
getProductName() const;
145 QString
getProductPublisher() const;
146 QString
getProductAboutUrl() const;
147 QString
getProductUpdateUrl() const;
148 QString
getProductHelpUrl() const;
149 QString
getProductComments() const;
153 int m_defaultServerIndex
;
154 int m_defaultProfileIndex
;
155 bool m_installerCopied
;
158 CProfiles m_profiles
;
159 CProfiles m_backupProfiles
;
161 QString m_installationDirectory
;
162 QString m_srcDirectory
;
163 bool m_use64BitsClient
;
164 bool m_shouldUninstallOldClient
;
165 bool m_ignoreFreeDiskSpaceChecks
;
166 QString m_installerFilename
;
169 QString m_defaultConfigPath
;
170 QString m_configPath
;
173 QString m_productName
;
174 QString m_productPublisher
;
175 QString m_productAboutUrl
;
176 QString m_productUpdateUrl
;
177 QString m_productHelpUrl
;
178 QString m_productComments
;
180 static CConfigFile
*s_instance
;