Changed: Renamed configurations to profiles

--HG--
branch : feature-ryzom-installer
This commit is contained in:
kervala 2016-02-27 18:43:14 +01:00
parent f3352a9ccc
commit 86bfb53ff2
8 changed files with 94 additions and 94 deletions

View file

@ -338,7 +338,7 @@ bool CArchive::copyServerFiles()
return copyFiles(files);
}
bool CArchive::copyConfigurationFiles()
bool CArchive::copyProfileFiles()
{
emit extractPrepare();
@ -372,7 +372,7 @@ bool CArchive::copyServerFiles(const QString &src, const QString &dst)
return true;
}
bool CArchive::copyConfigurationFiles(const QString &src, const QString &dst)
bool CArchive::copyProfileFiles(const QString &src, const QString &dst)
{
if (src.isEmpty() || dst.isEmpty()) return false;
@ -382,7 +382,7 @@ bool CArchive::copyConfigurationFiles(const QString &src, const QString &dst)
// create destination directory
QDir().mkpath(dst);
QFuture<bool> future = QtConcurrent::run(this, &CArchive::copyConfigurationFiles);
QFuture<bool> future = QtConcurrent::run(this, &CArchive::copyProfileFiles);
return true;
}

View file

@ -33,7 +33,7 @@ public:
bool extract(const QString &filename, const QString &dest);
bool copyServerFiles(const QString &src, const QString &dst);
bool copyConfigurationFiles(const QString &src, const QString &dst);
bool copyProfileFiles(const QString &src, const QString &dst);
void stop();
bool mustStop();
@ -80,7 +80,7 @@ protected:
bool progress(const std::string &filename, uint32 currentFile, uint32 totalFiles);
bool copyServerFiles();
bool copyConfigurationFiles();
bool copyProfileFiles();
bool copyFiles(const FilesToCopy &files);
static void getFilesList(const QString &srcDir, const QString &dstDir, const QStringList &filter, FilesToCopy &files);

View file

@ -25,11 +25,11 @@
#endif
const CServer NoServer;
const CConfiguration NoConfiguration;
const CProfile NoProfile;
CConfigFile *CConfigFile::s_instance = NULL;
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_defaultServer(0), m_defaultConfiguration(0), m_use64BitsClient(false)
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_defaultServer(0), m_defaultProfile(0), m_use64BitsClient(false)
{
s_instance = this;
@ -92,26 +92,26 @@ bool CConfigFile::load(const QString &filename)
settings.endGroup();
}
settings.beginGroup("configurations");
int configurationsCounts = settings.value("size").toInt();
m_defaultConfiguration = settings.value("default").toInt();
settings.beginGroup("profiles");
int profilesCounts = settings.value("size").toInt();
m_defaultProfile = settings.value("default").toInt();
settings.endGroup();
m_configurations.resize(configurationsCounts);
m_profiles.resize(profilesCounts);
for(int i = 0; i < configurationsCounts; ++i)
for(int i = 0; i < profilesCounts; ++i)
{
CConfiguration &configuration = m_configurations[i];
CProfile &profile = m_profiles[i];
settings.beginGroup(QString("configuration_%1").arg(i));
settings.beginGroup(QString("profile_%1").arg(i));
configuration.id = settings.value("id").toInt();
configuration.name = settings.value("name").toString();
configuration.account = settings.value("account").toString();
configuration.server = settings.value("server").toString();
configuration.executable = settings.value("executable").toString();
configuration.parameters = settings.value("parameters").toString();
configuration.comments = settings.value("comments").toString();
profile.id = settings.value("id").toInt();
profile.name = settings.value("name").toString();
profile.account = settings.value("account").toString();
profile.server = settings.value("server").toString();
profile.executable = settings.value("executable").toString();
profile.parameters = settings.value("parameters").toString();
profile.comments = settings.value("comments").toString();
settings.endGroup();
}
@ -162,24 +162,24 @@ bool CConfigFile::save() const
settings.endGroup();
}
settings.beginGroup("configurations");
settings.setValue("size", m_configurations.size());
settings.setValue("default", m_defaultConfiguration);
settings.beginGroup("profiles");
settings.setValue("size", m_profiles.size());
settings.setValue("default", m_defaultProfile);
settings.endGroup();
for(int i = 0; i < m_configurations.size(); ++i)
for(int i = 0; i < m_profiles.size(); ++i)
{
const CConfiguration &configuration = m_configurations[i];
const CProfile &profile = m_profiles[i];
settings.beginGroup(QString("configuration_%1").arg(i));
settings.beginGroup(QString("profile_%1").arg(i));
settings.setValue("id", configuration.id);
settings.setValue("name", configuration.name);
settings.setValue("account", configuration.account);
settings.setValue("server", configuration.server);
settings.setValue("executable", configuration.executable);
settings.setValue("parameters", configuration.parameters);
settings.setValue("comments", configuration.comments);
settings.setValue("id", profile.id);
settings.setValue("name", profile.name);
settings.setValue("account", profile.account);
settings.setValue("server", profile.server);
settings.setValue("executable", profile.executable);
settings.setValue("parameters", profile.parameters);
settings.setValue("comments", profile.comments);
settings.endGroup();
}
@ -217,37 +217,37 @@ const CServer& CConfigFile::getServer(const QString &id) const
return getServer();
}
int CConfigFile::getConfigurationsCount() const
int CConfigFile::getProfilesCount() const
{
return m_configurations.size();
return m_profiles.size();
}
CConfiguration CConfigFile::getConfiguration(int i) const
CProfile CConfigFile::getProfile(int i) const
{
if (i < 0) i = m_defaultConfiguration;
if (i < 0) i = m_defaultProfile;
if (i >= m_configurations.size()) return NoConfiguration;
if (i >= m_profiles.size()) return NoProfile;
return m_configurations.at(i);
return m_profiles.at(i);
}
void CConfigFile::setConfiguration(int i, const CConfiguration &configuration)
void CConfigFile::setProfile(int i, const CProfile &profile)
{
m_configurations[i] = configuration;
m_profiles[i] = profile;
}
int CConfigFile::addConfiguration(const CConfiguration &configuration)
int CConfigFile::addProfile(const CProfile &profile)
{
m_configurations.append(configuration);
m_profiles.append(profile);
return m_configurations.size()-1;
return m_profiles.size()-1;
}
void CConfigFile::removeConfiguration(int i)
void CConfigFile::removeProfile(int i)
{
m_configurations.removeAt(i);
m_profiles.removeAt(i);
// TODO: decalle all configurations and move files
// TODO: decalle all profiles and move files
}
bool CConfigFile::has64bitsOS()
@ -255,9 +255,9 @@ bool CConfigFile::has64bitsOS()
return QSysInfo::currentCpuArchitecture() == "x86_64";
}
int CConfigFile::getDefaultConfiguration() const
int CConfigFile::getDefaultProfile() const
{
return m_defaultConfiguration;
return m_defaultProfile;
}
int CConfigFile::getDefaultServer() const
@ -267,7 +267,7 @@ int CConfigFile::getDefaultServer() const
bool CConfigFile::isRyzomInstallerConfigured() const
{
return m_configurations.size() > 0;
return m_profiles.size() > 0;
}
QString CConfigFile::getInstallationDirectory() const
@ -290,12 +290,12 @@ void CConfigFile::setSrcServerDirectory(const QString &directory)
m_srcDirectory = directory;
}
QString CConfigFile::getConfigurationDirectory() const
QString CConfigFile::getProfileDirectory() const
{
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
}
QString CConfigFile::getSrcConfigurationDirectory() const
QString CConfigFile::getSrcProfileDirectory() const
{
if (QFile::exists(getSrcServerDirectory() + "/client.cfg")) return getSrcServerDirectory();
@ -425,7 +425,7 @@ bool CConfigFile::isRyzomClientInstalledIn(const QString &directory) const
QString CConfigFile::getClientFullPath() const
{
QString path = getConfiguration().executable;
QString path = getProfile().executable;
if (!path.isEmpty()) return path;
@ -439,13 +439,13 @@ QString CConfigFile::getSrcServerClientBNPFullPath() const
CConfigFile::InstallationStep CConfigFile::getNextStep() const
{
// get last used configuration
const CConfiguration &configuration = getConfiguration();
// get last used profile
const CProfile &profile = getProfile();
// get server used by it or default server
CServer server = getServer(configuration.server);
CServer server = getServer(profile.server);
// no or wrong configuration
// no or wrong profile
if (server.id.isEmpty())
{
// get last used server
@ -542,16 +542,16 @@ CConfigFile::InstallationStep CConfigFile::getNextStep() const
}
}
// no default configuration
if (configuration.id < 0)
// no default profile
if (profile.id < 0)
{
return CreateConfiguration;
return CreateProfile;
}
// migration configuration
if (!getSrcServerDirectory().isEmpty() && QFile::exists(getSrcConfigurationDirectory() + "/client.cfg") && !QFile::exists(QString("%1/%2/client.cfg").arg(getConfigurationDirectory()).arg(configuration.name)))
// migration profile
if (!getSrcServerDirectory().isEmpty() && QFile::exists(getSrcProfileDirectory() + "/client.cfg") && !QFile::exists(QString("%1/%2/client.cfg").arg(getProfileDirectory()).arg(profile.name)))
{
return CopyConfigurationFiles;
return CopyProfileFiles;
}
if (!QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk"))

View file

@ -40,9 +40,9 @@ struct CServer
extern const CServer NoServer;
struct CConfiguration
struct CProfile
{
CConfiguration()
CProfile()
{
id = -1;
}
@ -56,7 +56,7 @@ struct CConfiguration
QString comments;
};
extern const CConfiguration NoConfiguration;
extern const CProfile NoProfile;
/**
* Config file management and other stuff related to location of files/directories.
@ -78,9 +78,9 @@ public:
DownloadClient,
ExtractDownloadedClient,
CopyServerFiles,
CopyConfigurationFiles,
CopyProfileFiles,
ExtractBnpClient,
CreateConfiguration,
CreateProfile,
CreateShortcuts,
Done
};
@ -98,14 +98,14 @@ public:
const CServer& getServer(int i = -1) const;
const CServer& getServer(const QString &id) const;
int getConfigurationsCount() const;
CConfiguration getConfiguration(int i = -1) const;
void setConfiguration(int i, const CConfiguration &configuration);
int addConfiguration(const CConfiguration &configuration);
void removeConfiguration(int i);
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);
int getDefaultServer() const;
int getDefaultConfiguration() const;
int getDefaultProfile() const;
bool isRyzomInstallerConfigured() const;
@ -115,8 +115,8 @@ public:
QString getSrcServerDirectory() const;
void setSrcServerDirectory(const QString &directory);
QString getConfigurationDirectory() const;
QString getSrcConfigurationDirectory() const;
QString getProfileDirectory() const;
QString getSrcProfileDirectory() const;
static bool has64bitsOS();
@ -147,10 +147,10 @@ public:
private:
int m_defaultServer;
int m_defaultConfiguration;
int m_defaultProfile;
QVector<CServer> m_servers;
QVector<CConfiguration> m_configurations;
QVector<CProfile> m_profiles;
QString m_installationDirectory;
QString m_srcDirectory;

View file

@ -92,8 +92,8 @@ void CMainWindow::processNextStep()
// default server
const CServer &server = config->getServer();
// default configuration
const CConfiguration &configuration = config->getConfiguration();
// default profile
const CProfile &configuration = config->getProfile();
switch(CConfigFile::getInstance()->getNextStep())
{
@ -126,9 +126,9 @@ void CMainWindow::processNextStep()
m_archive->copyServerFiles(config->getSrcServerDirectory(), config->getInstallationDirectory() + "/" + server.id);
break;
case CConfigFile::CopyConfigurationFiles:
case CConfigFile::CopyProfileFiles:
displayProgressBar();
m_archive->copyConfigurationFiles(config->getSrcConfigurationDirectory(), config->getConfigurationDirectory() + "/0");
m_archive->copyProfileFiles(config->getSrcProfileDirectory(), config->getProfileDirectory() + "/0");
break;
case CConfigFile::ExtractBnpClient:
@ -136,7 +136,7 @@ void CMainWindow::processNextStep()
m_archive->extract(config->getSrcServerClientBNPFullPath(), config->getInstallationDirectory() + "/" + server.id);
break;
case CConfigFile::CreateConfiguration:
case CConfigFile::CreateProfile:
displayProgressBar();
break;

View file

@ -15,22 +15,22 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "configurationsdialog.h"
#include "profilesdialog.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
CConfigurationsDialog::CConfigurationsDialog():QDialog()
CProfilesDialog::CProfilesDialog():QDialog()
{
setupUi(this);
}
CConfigurationsDialog::~CConfigurationsDialog()
CProfilesDialog::~CProfilesDialog()
{
}
void CConfigurationsDialog::accept()
void CProfilesDialog::accept()
{
// TODO: add save code

View file

@ -14,18 +14,18 @@
// 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 CONFIGURATIONSDIALOG_H
#define CONFIGURATIONSDIALOG_H
#ifndef PROFILESDIALOG_H
#define PROFILESDIALOG_H
#include "ui_configurations.h"
#include "ui_profiles.h"
class CConfigurationsDialog : public QDialog, public Ui::ConfigurationsDialog
class CProfilesDialog : public QDialog, public Ui::ConfigurationsDialog
{
Q_OBJECT
public:
CConfigurationsDialog();
virtual ~CConfigurationsDialog();
CProfilesDialog();
virtual ~CProfilesDialog();
private slots:
void accept();