mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 04:51:48 +00:00
Changed: Read default ryzom_installer.ini from QRC, see #279
This commit is contained in:
parent
d4ac247790
commit
969f54a35e
4 changed files with 142 additions and 65 deletions
|
@ -7,5 +7,6 @@
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/templates">
|
<qresource prefix="/templates">
|
||||||
<file>template.desktop</file>
|
<file>template.desktop</file>
|
||||||
|
<file>ryzom_installer.ini</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
version=1
|
||||||
|
|
||||||
|
[common]
|
||||||
|
installation_directory=
|
||||||
|
|
||||||
|
[product]
|
||||||
|
name=Ryzom
|
||||||
|
publisher="Winch Gate Property Limited"
|
||||||
|
url_about=http://ryzom.com/?lang=$LANG
|
||||||
|
url_help=http://app.ryzom.com/app_forum/index.php?page=topic/view/22047/1&post149889=$LANG#1
|
||||||
|
comments=Science-fantasy MMORPG
|
||||||
|
|
||||||
|
[servers]
|
||||||
|
size=2
|
||||||
|
|
||||||
|
[server_0]
|
||||||
|
id=ryzom_live
|
||||||
|
name=Atys
|
||||||
|
display_url="http://app.ryzom.com/app_releasenotes/index.php?lang=$LANG"
|
||||||
|
data_download_url="http://downloads.sourceforge.net/project/ryzom/ryzom_live_data.7z?r=&ts=$TIMESTAMP"
|
||||||
|
data_download_filename=ryzom_live_data.7z
|
||||||
|
data_compressed_size=1500000000
|
||||||
|
data_uncompressed_size=10000000000
|
||||||
|
client_download_url="http://downloads.sourceforge.net/project/ryzom/ryzom_live_client_$ARCH.zip?r=&ts=$TIMESTAMP"
|
||||||
|
client_download_filename=ryzom_live_client_$ARCH.zip
|
||||||
|
client_filename_windows=ryzom_client_r.exe
|
||||||
|
client_filename_osx=Ryzom.app/Contents/MacOS/Ryzom
|
||||||
|
client_filename_linux=ryzom_client
|
||||||
|
client_filename_old_windows=client_ryzom_rd.exe
|
||||||
|
configuration_filename_windows=ryzom_configuration_qt_r.exe
|
||||||
|
configuration_filename_osx=Ryzom.app/Contents/MacOS/RyzomConfiguration
|
||||||
|
configuration_filename_linux=ryzom_configuration_qt
|
||||||
|
installer_filename_windows=ryzom_installer_qt_r.exe
|
||||||
|
installer_filename_osx=RyzomInstaller.app/Contents/MacOS/RyzomInstaller
|
||||||
|
installer_filename_linux=ryzom_installer_qt
|
||||||
|
comments=
|
||||||
|
|
||||||
|
[server_1]
|
||||||
|
id=ryzom_dev
|
||||||
|
name=Yubo
|
||||||
|
display_url="http://app.ryzom.com/app_releasenotes/index.php?lang=$LANG"
|
||||||
|
data_download_url="http://downloads.sourceforge.net/project/ryzom/ryzom_live_data.7z?r=&ts=$TIMESTAMP"
|
||||||
|
data_download_filename=ryzom_live_data.7z
|
||||||
|
data_compressed_size=1500000000
|
||||||
|
data_uncompressed_size=10000000000
|
||||||
|
client_download_url="http://downloads.sourceforge.net/project/ryzom/ryzom_live_client_$ARCH.zip?r=&ts=$TIMESTAMP"
|
||||||
|
client_download_filename=ryzom_live_client_$ARCH.zip
|
||||||
|
client_filename_windows=ryzom_client_r.exe
|
||||||
|
client_filename_osx=Ryzom.app/Contents/MacOS/Ryzom
|
||||||
|
client_filename_linux=ryzom_client
|
||||||
|
client_filename_old_windows=client_ryzom_rd.exe
|
||||||
|
configuration_filename_windows=ryzom_configuration_qt_r.exe
|
||||||
|
configuration_filename_osx=Ryzom.app/Contents/MacOS/RyzomConfiguration
|
||||||
|
configuration_filename_linux=ryzom_configuration_qt
|
||||||
|
installer_filename_windows=ryzom_installer_qt_r.exe
|
||||||
|
installer_filename_osx=RyzomInstaller.app/Contents/MacOS/RyzomInstaller
|
||||||
|
installer_filename_linux=ryzom_installer_qt
|
||||||
|
comments=Test server
|
||||||
|
|
||||||
|
[profiles]
|
||||||
|
size=0
|
|
@ -142,30 +142,19 @@ void CProfile::updateShortcuts() const
|
||||||
|
|
||||||
CConfigFile *CConfigFile::s_instance = NULL;
|
CConfigFile *CConfigFile::s_instance = NULL;
|
||||||
|
|
||||||
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true)
|
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_version(-1),
|
||||||
|
m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true)
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
||||||
// only keep language ISO 639 code
|
// only keep language ISO 639 code
|
||||||
m_language = QLocale::system().name().left(2);
|
m_language = QLocale::system().name().left(2);
|
||||||
|
|
||||||
// it won't be found if run with uninstall flag, but since we already have a local installer.ini...
|
// default config file in included in resources
|
||||||
QString configFile = getCurrentDirectory() + "/installer.ini";
|
m_defaultConfigPath = ":/templates/ryzom_installer.ini";
|
||||||
|
|
||||||
if (!QFile::exists(configFile))
|
|
||||||
{
|
|
||||||
configFile = QApplication::applicationDirPath() + "/installer.ini";
|
|
||||||
|
|
||||||
if (!QFile::exists(configFile))
|
|
||||||
{
|
|
||||||
configFile.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_defaultConfigPath = configFile;
|
|
||||||
|
|
||||||
// the config file we'll write
|
// the config file we'll write
|
||||||
m_configPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/installer.ini";
|
m_configPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/ryzom_installer.ini";
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigFile::~CConfigFile()
|
CConfigFile::~CConfigFile()
|
||||||
|
@ -175,13 +164,32 @@ CConfigFile::~CConfigFile()
|
||||||
|
|
||||||
bool CConfigFile::load()
|
bool CConfigFile::load()
|
||||||
{
|
{
|
||||||
return load(m_configPath) || load(m_defaultConfigPath);
|
// load default values
|
||||||
|
load(m_defaultConfigPath);
|
||||||
|
|
||||||
|
return load(m_configPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConfigFile::load(const QString &filename)
|
bool CConfigFile::load(const QString &filename)
|
||||||
{
|
{
|
||||||
|
if (!QFile::exists(filename)) return false;
|
||||||
|
|
||||||
QSettings settings(filename, QSettings::IniFormat);
|
QSettings settings(filename, QSettings::IniFormat);
|
||||||
|
|
||||||
|
int defaultVersion = m_version;
|
||||||
|
int currentVersion = settings.value("version", 0).toInt();
|
||||||
|
|
||||||
|
bool useDefaultValues = defaultVersion > currentVersion;
|
||||||
|
|
||||||
|
// set default version from default config
|
||||||
|
if (defaultVersion == -1) m_version = currentVersion;
|
||||||
|
|
||||||
|
if (useDefaultValues)
|
||||||
|
{
|
||||||
|
// TODO: make a backup of custom installer.ini
|
||||||
|
}
|
||||||
|
|
||||||
|
// custom choices, always keep them
|
||||||
settings.beginGroup("common");
|
settings.beginGroup("common");
|
||||||
m_language = settings.value("language", m_language).toString();
|
m_language = settings.value("language", m_language).toString();
|
||||||
m_srcDirectory = settings.value("source_directory").toString();
|
m_srcDirectory = settings.value("source_directory").toString();
|
||||||
|
@ -190,6 +198,8 @@ bool CConfigFile::load(const QString &filename)
|
||||||
m_shouldUninstallOldClient = settings.value("should_uninstall_old_client", true).toBool();
|
m_shouldUninstallOldClient = settings.value("should_uninstall_old_client", true).toBool();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
if (!useDefaultValues)
|
||||||
|
{
|
||||||
settings.beginGroup("product");
|
settings.beginGroup("product");
|
||||||
m_productName = settings.value("name").toString();
|
m_productName = settings.value("name").toString();
|
||||||
m_productPublisher = settings.value("publisher").toString();
|
m_productPublisher = settings.value("publisher").toString();
|
||||||
|
@ -241,7 +251,9 @@ bool CConfigFile::load(const QString &filename)
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// custom choices, always keep them
|
||||||
settings.beginGroup("profiles");
|
settings.beginGroup("profiles");
|
||||||
int profilesCounts = settings.value("size").toInt();
|
int profilesCounts = settings.value("size").toInt();
|
||||||
m_defaultProfileIndex = settings.value("default").toInt();
|
m_defaultProfileIndex = settings.value("default").toInt();
|
||||||
|
@ -274,6 +286,8 @@ bool CConfigFile::save() const
|
||||||
{
|
{
|
||||||
QSettings settings(m_configPath, QSettings::IniFormat);
|
QSettings settings(m_configPath, QSettings::IniFormat);
|
||||||
|
|
||||||
|
settings.setValue("version", m_version);
|
||||||
|
|
||||||
settings.beginGroup("common");
|
settings.beginGroup("common");
|
||||||
settings.setValue("language", m_language);
|
settings.setValue("language", m_language);
|
||||||
settings.setValue("source_directory", m_srcDirectory);
|
settings.setValue("source_directory", m_srcDirectory);
|
||||||
|
|
|
@ -194,6 +194,7 @@ public:
|
||||||
QString getProductComments() const;
|
QString getProductComments() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int m_version;
|
||||||
int m_defaultServerIndex;
|
int m_defaultServerIndex;
|
||||||
int m_defaultProfileIndex;
|
int m_defaultProfileIndex;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue