From d819704717af9b03a05d3f236dfe5400803b43e7 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 27 Feb 2016 18:43:14 +0100 Subject: [PATCH] Changed: Renamed configurations to profiles --- .../client/ryzom_installer/src/archive.cpp | 6 +- .../client/ryzom_installer/src/archive.h | 4 +- .../client/ryzom_installer/src/configfile.cpp | 118 +++++++++--------- .../client/ryzom_installer/src/configfile.h | 30 ++--- .../client/ryzom_installer/src/mainwindow.cpp | 10 +- ...gurationsdialog.cpp => profilesdialog.cpp} | 8 +- ...onfigurationsdialog.h => profilesdialog.h} | 12 +- .../ui/{configurations.ui => profiles.ui} | 0 8 files changed, 94 insertions(+), 94 deletions(-) rename code/ryzom/tools/client/ryzom_installer/src/{configurationsdialog.cpp => profilesdialog.cpp} (84%) rename code/ryzom/tools/client/ryzom_installer/src/{configurationsdialog.h => profilesdialog.h} (78%) rename code/ryzom/tools/client/ryzom_installer/ui/{configurations.ui => profiles.ui} (100%) diff --git a/code/ryzom/tools/client/ryzom_installer/src/archive.cpp b/code/ryzom/tools/client/ryzom_installer/src/archive.cpp index 23f61330c..bc40c3061 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/archive.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/archive.cpp @@ -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 future = QtConcurrent::run(this, &CArchive::copyConfigurationFiles); + QFuture future = QtConcurrent::run(this, &CArchive::copyProfileFiles); return true; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/archive.h b/code/ryzom/tools/client/ryzom_installer/src/archive.h index ac9c0c036..0f8284b9e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/archive.h +++ b/code/ryzom/tools/client/ryzom_installer/src/archive.h @@ -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); diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index f0b8c7577..0f73bd96e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -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")) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 1b5e0a111..acff20b3d 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -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 m_servers; - QVector m_configurations; + QVector m_profiles; QString m_installationDirectory; QString m_srcDirectory; diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index 81f2d925c..1fccb6fcb 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -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; diff --git a/code/ryzom/tools/client/ryzom_installer/src/configurationsdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp similarity index 84% rename from code/ryzom/tools/client/ryzom_installer/src/configurationsdialog.cpp rename to code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp index ec7fe079f..279a703b5 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configurationsdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp @@ -15,22 +15,22 @@ // along with this program. If not, see . #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 diff --git a/code/ryzom/tools/client/ryzom_installer/src/configurationsdialog.h b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.h similarity index 78% rename from code/ryzom/tools/client/ryzom_installer/src/configurationsdialog.h rename to code/ryzom/tools/client/ryzom_installer/src/profilesdialog.h index c236b62c7..1ba25c5e0 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configurationsdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.h @@ -14,18 +14,18 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#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(); diff --git a/code/ryzom/tools/client/ryzom_installer/ui/configurations.ui b/code/ryzom/tools/client/ryzom_installer/ui/profiles.ui similarity index 100% rename from code/ryzom/tools/client/ryzom_installer/ui/configurations.ui rename to code/ryzom/tools/client/ryzom_installer/ui/profiles.ui