diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2010-01-20 22:18:36 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2010-01-20 22:18:36 +0000 |
commit | 8363619e666b37cf8e33f71ea1bfe44676b401e3 (patch) | |
tree | 2090e3f3c2bfbd5908c18b453c6d228de3d5c42e /rbutil/rbutilqt/base | |
parent | b5d16e79e191af7c4cb34be685770166e8dfcfa6 (diff) |
rbutil: store the info from the server centrally in RbSetttings. Dont download build-info multiple times. Rename install.cpp
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24301 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r-- | rbutil/rbutilqt/base/rbsettings.cpp | 60 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/rbsettings.h | 17 |
2 files changed, 75 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/base/rbsettings.cpp b/rbutil/rbutilqt/base/rbsettings.cpp index bd6f94f2f4..527312b108 100644 --- a/rbutil/rbutilqt/base/rbsettings.cpp +++ b/rbutil/rbutilqt/base/rbsettings.cpp @@ -94,9 +94,24 @@ const static struct { { RbSettings::EncoderVolume, ":encoder:/volume", "1.0" }, }; +// server settings +const static struct { + RbSettings::ServerSettings setting; + const char* name; + const char* def; +} ServerSettingsList[] = { + { RbSettings::CurReleaseVersion, ":platform:/releaseversion", "" }, + { RbSettings::CurStatus, ":platform:/status", "" }, + { RbSettings::DailyRevision, "dailyrev", "" }, + { RbSettings::DailyDate, "dailydate", "" }, + { RbSettings::BleedingRevision, "bleedingrev", "" }, + { RbSettings::BleedingDate, "bleedingdate", "" }, +}; + //! pointer to setting object to NULL QSettings* RbSettings::systemSettings = NULL; QSettings* RbSettings::userSettings = NULL; +QSettings* RbSettings::serverSettings = NULL; void RbSettings::ensureRbSettingsExists() { @@ -106,7 +121,13 @@ void RbSettings::ensureRbSettingsExists() // only use built-in rbutil.ini systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0); } - + + if(serverSettings == NULL) + { + serverSettings = new QSettings(QSettings::IniFormat, + QSettings::UserScope, "rockbox.org", "RockboxUtility",NULL); + } + if(userSettings == NULL) { // portable installation: @@ -200,6 +221,20 @@ QVariant RbSettings::subValue(QString sub, enum UserSettings setting) return userSettings->value(s, UserSettingsList[i].def); } +QVariant RbSettings::value(enum ServerSettings setting) +{ + ensureRbSettingsExists(); + + // locate setting item + int i = 0; + while(ServerSettingsList[i].setting != setting) + i++; + + QString s = constructSettingPath(ServerSettingsList[i].name); + qDebug() << "[Settings] GET SERV:" << s << serverSettings->value(s, ServerSettingsList[i].def).toString(); + return serverSettings->value(s, ServerSettingsList[i].def); +} + void RbSettings::setValue(enum UserSettings setting , QVariant value) { QString empty; @@ -216,8 +251,29 @@ void RbSettings::setSubValue(QString sub, enum UserSettings setting, QVariant va i++; QString s = constructSettingPath(UserSettingsList[i].name, sub); - qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString(); userSettings->setValue(s, value); + qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString(); +} + +void RbSettings::setValue(enum ServerSettings setting, QVariant value) +{ + QString empty; + return setPlatformValue(empty, setting, value); +} + +void RbSettings::setPlatformValue(QString platform, enum ServerSettings setting, QVariant value) +{ + ensureRbSettingsExists(); + + // locate setting item + int i = 0; + while(ServerSettingsList[i].setting != setting) + i++; + + QString s = ServerSettingsList[i].name; + s.replace(":platform:", platform); + serverSettings->setValue(s, value); + qDebug() << "[Settings] SET SERV:" << s << serverSettings->value(s).toString(); } diff --git a/rbutil/rbutilqt/base/rbsettings.h b/rbutil/rbutilqt/base/rbsettings.h index b3f0430208..5e128e602d 100644 --- a/rbutil/rbutilqt/base/rbsettings.h +++ b/rbutil/rbutilqt/base/rbsettings.h @@ -97,6 +97,16 @@ class RbSettings : public QObject CurConfigureModel, }; + //! All Server settings + enum ServerSettings { + CurReleaseVersion, + CurStatus, + DailyRevision, + DailyDate, + BleedingRevision, + BleedingDate, + }; + //! call this to flush the user Settings static void sync(); //! returns the filename of the usersettings file @@ -115,12 +125,18 @@ class RbSettings : public QObject static QVariant value(enum SystemSettings setting); //! get a value from user settings static QVariant value(enum UserSettings setting); + //! get a value from server settings + static QVariant value(enum ServerSettings setting); //! set a user setting value static void setValue(enum UserSettings setting , QVariant value); + //! set a server setting value + static void setValue(enum ServerSettings setting , QVariant value); //! get a user setting from a subvalue (ie for encoders and tts engines) static QVariant subValue(QString sub, enum UserSettings setting); //! set a user setting from a subvalue (ie for encoders and tts engines) static void setSubValue(QString sub, enum UserSettings setting, QVariant value); + //! set a value for a server settings for a named platform. + static void setPlatformValue(QString platform, enum ServerSettings setting, QVariant value); //! get a value from system settings for a named platform. static QVariant platformValue(QString platform, enum SystemSettings setting); @@ -135,6 +151,7 @@ class RbSettings : public QObject //! pointers to our setting objects static QSettings *systemSettings; static QSettings *userSettings; + static QSettings *serverSettings; }; #endif |