summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp9
-rw-r--r--rbutil/rbutilqt/base/rbsettings.cpp222
-rw-r--r--rbutil/rbutilqt/base/rbsettings.h73
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp149
-rw-r--r--rbutil/rbutilqt/base/serverinfo.h67
-rw-r--r--rbutil/rbutilqt/base/systeminfo.cpp196
-rw-r--r--rbutil/rbutilqt/base/systeminfo.h91
-rw-r--r--rbutil/rbutilqt/base/talkgenerator.cpp3
-rw-r--r--rbutil/rbutilqt/base/ttssapi.cpp3
-rw-r--r--rbutil/rbutilqt/base/utils.cpp5
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp3
-rw-r--r--rbutil/rbutilqt/configure.cpp34
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp5
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp3
-rw-r--r--rbutil/rbutilqt/installwindow.cpp40
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp111
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro4
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.cpp11
18 files changed, 620 insertions, 409 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index c7ddcab662..09cfac5767 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -20,6 +20,7 @@
#include <QtCore>
#include "autodetection.h"
#include "rbsettings.h"
+#include "systeminfo.h"
#include "../ipodpatcher/ipodpatcher.h"
#include "../sansapatcher/sansapatcher.h"
@@ -384,9 +385,9 @@ bool Autodetection::detectUsb()
// usbids holds the mapping in the form
// ((VID<<16)|(PID)), targetname
// the ini file needs to hold the IDs as hex values.
- QMap<int, QString> usbids = RbSettings::usbIdMap(RbSettings::MapDevice);
- QMap<int, QString> usberror = RbSettings::usbIdMap(RbSettings::MapError);
- QMap<int, QString> usbincompat = RbSettings::usbIdMap(RbSettings::MapIncompatible);
+ QMap<int, QString> usbids = SystemInfo::usbIdMap(SystemInfo::MapDevice);
+ QMap<int, QString> usberror = SystemInfo::usbIdMap(SystemInfo::MapError);
+ QMap<int, QString> usbincompat = SystemInfo::usbIdMap(SystemInfo::MapIncompatible);
// usb pid detection
QList<uint32_t> attached;
@@ -405,7 +406,7 @@ bool Autodetection::detectUsb()
return true;
}
QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0'));
- if(!RbSettings::platformValue(idstring, RbSettings::CurName).toString().isEmpty()) {
+ if(!SystemInfo::platformValue(idstring, SystemInfo::CurName).toString().isEmpty()) {
m_incompat = idstring;
qDebug() << "[USB] detected incompatible player" << m_incompat;
return true;
diff --git a/rbutil/rbutilqt/base/rbsettings.cpp b/rbutil/rbutilqt/base/rbsettings.cpp
index ca870fc932..98d5b331b7 100644
--- a/rbutil/rbutilqt/base/rbsettings.cpp
+++ b/rbutil/rbutilqt/base/rbsettings.cpp
@@ -18,46 +18,13 @@
****************************************************************************/
#include "rbsettings.h"
-
+#include "systeminfo.h"
#include <QSettings>
#if defined(Q_OS_LINUX)
#include <unistd.h>
#endif
-
-// device settings
-const static struct {
- RbSettings::SystemSettings setting;
- const char* name;
- const char* def;
-} SystemSettingsList[] = {
- { RbSettings::ManualUrl, "manual_url", "" },
- { RbSettings::BleedingUrl, "bleeding_url", "" },
- { RbSettings::BootloaderUrl, "bootloader_url", "" },
- { RbSettings::BootloaderInfoUrl, "bootloader_info_url", "" },
- { RbSettings::FontUrl, "font_url", "" },
- { RbSettings::VoiceUrl, "voice_url", "" },
- { RbSettings::DoomUrl, "doom_url", "" },
- { RbSettings::ReleaseUrl, "release_url", "" },
- { RbSettings::DailyUrl, "daily_url", "" },
- { RbSettings::ServerConfUrl, "server_conf_url", "" },
- { RbSettings::GenlangUrl, "genlang_url", "" },
- { RbSettings::ThemesUrl, "themes_url", "" },
- { RbSettings::RbutilUrl, "rbutil_url", "" },
- { RbSettings::BleedingInfo, "bleeding_info", "" },
- { RbSettings::CurPlatformName, ":platform:/name", "" },
- { RbSettings::CurManual, ":platform:/manualname","rockbox-:platform:" },
- { RbSettings::CurBootloaderMethod, ":platform:/bootloadermethod", "none" },
- { RbSettings::CurBootloaderName, ":platform:/bootloadername", "" },
- { RbSettings::CurBootloaderFile, ":platform:/bootloaderfile", "" },
- { RbSettings::CurEncoder, ":platform:/encoder", "" },
- { RbSettings::CurBrand, ":platform:/brand", "" },
- { RbSettings::CurName, ":platform:/name", "" },
- { RbSettings::CurBuildserverModel, ":platform:/buildserver_modelname", "" },
- { RbSettings::CurConfigureModel, ":platform:/configure_modelname", "" },
-};
-
// user settings
const static struct {
RbSettings::UserSettings setting;
@@ -94,35 +61,11 @@ 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;
-//! global volatile settings
-QMap<QString, QVariant> RbSettings::serverSettings;
void RbSettings::ensureRbSettingsExists()
{
- //check and create settings object
- if(systemSettings == NULL)
- {
- // only use built-in rbutil.ini
- systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0);
- }
-
if(userSettings == NULL)
{
// portable installation:
@@ -180,22 +123,6 @@ QString RbSettings::userSettingFilename()
return userSettings->fileName();
}
-QVariant RbSettings::value(enum SystemSettings setting)
-{
- ensureRbSettingsExists();
-
- // locate setting item
- int i = 0;
- while(SystemSettingsList[i].setting != setting)
- i++;
-
- QString s = constructSettingPath(SystemSettingsList[i].name);
- QString d = SystemSettingsList[i].def;
- d.replace(":platform:", userSettings->value("platform").toString());
- qDebug() << "[Settings] GET S:" << s << systemSettings->value(s, d).toString();
- return systemSettings->value(s, d);
-}
-
QVariant RbSettings::value(enum UserSettings setting)
{
QString empty;
@@ -216,24 +143,6 @@ 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();
- if(serverSettings.contains(s))
- return serverSettings.value(s);
- else
- return ServerSettingsList[i].def;
-}
-
void RbSettings::setValue(enum UserSettings setting , QVariant value)
{
QString empty;
@@ -254,133 +163,6 @@ void RbSettings::setSubValue(QString sub, enum UserSettings setting, QVariant va
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.insert(s, value);
- qDebug() << "[Settings] SET SERV:" << s << serverSettings.value(s).toString();
-}
-
-
-QVariant RbSettings::platformValue(QString platform, enum SystemSettings setting)
-{
- ensureRbSettingsExists();
-
- // locate setting item
- int i = 0;
- while(SystemSettingsList[i].setting != setting)
- i++;
-
- QString s = SystemSettingsList[i].name;
- s.replace(":platform:", platform);
- QString d = SystemSettingsList[i].def;
- d.replace(":platform:", platform);
- qDebug() << "[Settings] GET P:" << s << systemSettings->value(s, d).toString();
- return systemSettings->value(s, d);
-}
-
-
-QStringList RbSettings::platforms()
-{
- ensureRbSettingsExists();
-
- QStringList result;
- systemSettings->beginGroup("platforms");
- QStringList a = systemSettings->childKeys();
- systemSettings->endGroup();
- for(int i = 0; i < a.size(); i++)
- {
- //only add not disabled targets
- QString target = systemSettings->value("platforms/"+a.at(i), "null").toString();
- if(systemSettings->value(target+"/status").toString() != "disabled")
- result.append(target);
- }
- return result;
-}
-
-QStringList RbSettings::languages()
-{
- ensureRbSettingsExists();
-
- QStringList result;
- systemSettings->beginGroup("languages");
- QStringList a = systemSettings->childKeys();
- for(int i = 0; i < a.size(); i++)
- {
- result.append(systemSettings->value(a.at(i), "null").toString());
- }
- systemSettings->endGroup();
- return result;
-}
-
-
-QString RbSettings::name(QString platform)
-{
- ensureRbSettingsExists();
- return systemSettings->value(platform + "/name").toString();
-}
-
-QString RbSettings::brand(QString platform)
-{
- ensureRbSettingsExists();
- return systemSettings->value(platform + "/brand").toString();
-}
-
-QMap<int, QString> RbSettings::usbIdMap(enum MapType type)
-{
- ensureRbSettingsExists();
-
- QMap<int, QString> map;
- // get a list of ID -> target name
- QStringList platforms;
- systemSettings->beginGroup("platforms");
- platforms = systemSettings->childKeys();
- systemSettings->endGroup();
-
- QString t;
- switch(type) {
- case MapDevice:
- t = "usbid";
- break;
- case MapError:
- t = "usberror";
- break;
- case MapIncompatible:
- t = "usbincompat";
- break;
- }
-
- for(int i = 0; i < platforms.size(); i++)
- {
- systemSettings->beginGroup("platforms");
- QString target = systemSettings->value(platforms.at(i)).toString();
- systemSettings->endGroup();
- systemSettings->beginGroup(target);
- QStringList ids = systemSettings->value(t).toStringList();
- int j = ids.size();
- while(j--)
- map.insert(ids.at(j).toInt(0, 16), target);
-
- systemSettings->endGroup();
- }
- return map;
-}
-
-
QString RbSettings::constructSettingPath(QString path, QString substitute)
{
QString platform = userSettings->value("platform").toString();
@@ -390,7 +172,7 @@ QString RbSettings::constructSettingPath(QString path, QString substitute)
}
else {
path.replace(":tts:", userSettings->value("tts").toString());
- path.replace(":encoder:", systemSettings->value(platform + "/encoder").toString());
+ path.replace(":encoder:", SystemInfo::platformValue(platform,SystemInfo::CurEncoder).toString());
}
path.replace(":platform:", platform);
diff --git a/rbutil/rbutilqt/base/rbsettings.h b/rbutil/rbutilqt/base/rbsettings.h
index ba0c393939..d66a01d3e2 100644
--- a/rbutil/rbutilqt/base/rbsettings.h
+++ b/rbutil/rbutilqt/base/rbsettings.h
@@ -24,18 +24,10 @@
#include <QtCore>
-class QSettings;
-
class RbSettings : public QObject
{
Q_OBJECT
public:
- //! Type of requested usb-id map
- enum MapType {
- MapDevice,
- MapError,
- MapIncompatible,
- };
//! All user settings
enum UserSettings {
@@ -68,77 +60,19 @@ class RbSettings : public QObject
EncoderQuality,
EncoderVolume,
};
-
- //! All system settings
- enum SystemSettings {
- ManualUrl,
- BleedingUrl,
- BootloaderUrl,
- BootloaderInfoUrl,
- FontUrl,
- VoiceUrl,
- DoomUrl,
- ReleaseUrl,
- DailyUrl,
- ServerConfUrl,
- GenlangUrl,
- ThemesUrl,
- RbutilUrl,
- BleedingInfo,
- CurPlatformName,
- CurManual,
- CurBootloaderMethod,
- CurBootloaderName,
- CurBootloaderFile,
- CurEncoder,
- CurBrand,
- CurName,
- CurBuildserverModel,
- 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
static QString userSettingFilename();
- //! return a list of all platforms (rbutil internal names)
- static QStringList platforms(void);
- //! returns a list of all languages
- static QStringList languages(void);
- //! maps a platform to its name
- static QString name(QString plattform);
- //! maps a platform to its brand
- static QString brand(QString plattform);
- //! returns a map of usb-ids and their targets
- static QMap<int, QString> usbIdMap(enum MapType);
- //! get a value from system settings
- 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);
private:
//! you shouldnt call this, its a fully static calls
@@ -148,11 +82,8 @@ class RbSettings : public QObject
//! create a settings path, substitute platform, tts and encoder
static QString constructSettingPath(QString path, QString substitute = QString());
- //! pointers to our setting objects
- static QSettings *systemSettings;
+ //! pointers to our setting object
static QSettings *userSettings;
- //! global volatile settings
- static QMap<QString, QVariant> serverSettings;
};
#endif
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp
new file mode 100644
index 0000000000..e54fd03f8a
--- /dev/null
+++ b/rbutil/rbutilqt/base/serverinfo.cpp
@@ -0,0 +1,149 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2010 by Dominik Wenger
+ * $Id$
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "serverinfo.h"
+#include "rbsettings.h"
+#include "systeminfo.h"
+
+#if defined(Q_OS_LINUX)
+#include <unistd.h>
+#endif
+
+// server infos
+const static struct {
+ ServerInfo::ServerInfos info;
+ const char* name;
+ const char* def;
+} ServerInfoList[] = {
+ { ServerInfo::CurReleaseVersion, ":platform:/releaseversion", "" },
+ { ServerInfo::CurStatus, ":platform:/status", "Unknown" },
+ { ServerInfo::DailyRevision, "dailyrev", "" },
+ { ServerInfo::DailyDate, "dailydate", "" },
+ { ServerInfo::BleedingRevision, "bleedingrev", "" },
+ { ServerInfo::BleedingDate, "bleedingdate", "" },
+};
+
+QMap<QString, QVariant> ServerInfo::serverInfos;
+
+void ServerInfo::readBuildInfo(QString file)
+{
+ QSettings info(file, QSettings::IniFormat);
+
+ setValue(ServerInfo::DailyRevision,info.value("dailies/rev"));
+ QDate date = QDate::fromString(info.value("dailies/date").toString(), "yyyyMMdd");
+ setValue(ServerInfo::DailyDate,date.toString(Qt::ISODate));
+
+ info.beginGroup("release");
+ QStringList keys = info.allKeys();
+ for(int i=0; i < keys.size(); i++)
+ {
+ setAllConfigPlatformValue(keys[i],ServerInfo::CurReleaseVersion,info.value(keys[i]));
+ }
+ info.endGroup();
+
+ info.beginGroup("status");
+ keys = info.allKeys();
+ for(int i=0; i < keys.size(); i++)
+ {
+ switch(info.value(keys[i]).toInt())
+ {
+ case 1:
+ ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unusable"));
+ break;
+ case 2:
+ ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unstable"));
+ break;
+ case 3:
+ ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Stable"));
+ break;
+ default:
+ ServerInfo::setAllConfigPlatformValue(keys[i],ServerInfo::CurStatus,tr("Unknown"));
+ break;
+ }
+ }
+ info.endGroup();
+}
+
+void ServerInfo::readBleedingInfo(QString file)
+{
+ QSettings info(file, QSettings::IniFormat);
+
+ setValue(ServerInfo::BleedingRevision,info.value("bleeding/rev"));
+ QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ");
+ setValue(ServerInfo::BleedingDate,date.toString(Qt::ISODate));
+}
+
+QVariant ServerInfo::value(enum ServerInfos info)
+{
+ // locate info item
+ int i = 0;
+ while(ServerInfoList[i].info != info)
+ i++;
+
+ QString s = ServerInfoList[i].name;
+ s.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
+ qDebug() << "[ServerIndo] GET:" << s << serverInfos.value(s, ServerInfoList[i].def).toString();
+ return serverInfos.value(s, ServerInfoList[i].def);
+}
+
+void ServerInfo::setValue(enum ServerInfos setting, QVariant value)
+{
+ QString empty;
+ return setPlatformValue(empty, setting, value);
+}
+
+void ServerInfo::setPlatformValue(QString platform, enum ServerInfos info, QVariant value)
+{
+ // locate setting item
+ int i = 0;
+ while(ServerInfoList[i].info != info)
+ i++;
+
+ QString s = ServerInfoList[i].name;
+ s.replace(":platform:", platform);
+ serverInfos.insert(s, value);
+ qDebug() << "[ServerInfo] SET:" << s << serverInfos.value(s).toString();
+}
+
+void ServerInfo::setAllConfigPlatformValue(QString configplatform, ServerInfos info, QVariant value)
+{
+ // insert intp all platforms where configurename matches
+ QStringList platforms = SystemInfo::platforms();
+ for(int i =0; i < platforms.size(); i++)
+ {
+ if(SystemInfo::platformValue(platforms.at(i),SystemInfo::CurConfigureModel) == configplatform)
+ setPlatformValue(platforms.at(i),info,value);
+ }
+}
+
+QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
+{
+ // locate setting item
+ int i = 0;
+ while(ServerInfoList[i].info != info)
+ i++;
+
+ QString s = ServerInfoList[i].name;
+ s.replace(":platform:", platform);
+ QString d = ServerInfoList[i].def;
+ d.replace(":platform:", platform);
+ qDebug() << "[ServerInfo] GET" << s << serverInfos.value(s, d).toString();
+ return serverInfos.value(s, d);
+}
+
diff --git a/rbutil/rbutilqt/base/serverinfo.h b/rbutil/rbutilqt/base/serverinfo.h
new file mode 100644
index 0000000000..742ea277ff
--- /dev/null
+++ b/rbutil/rbutilqt/base/serverinfo.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2010 by Dominik Wenger
+ * $Id$
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef SERVERINFO_H
+#define SERVERINFO_H
+
+#include <QtCore>
+
+class ServerInfo : public QObject
+{
+ Q_OBJECT
+ public:
+
+ //! All Server infos
+ enum ServerInfos {
+ CurReleaseVersion,
+ CurStatus,
+ DailyRevision,
+ DailyDate,
+ BleedingRevision,
+ BleedingDate,
+ };
+
+ //! read in buildinfo file
+ static void readBuildInfo(QString file);
+ //! read in bleeding info file
+ static void readBleedingInfo(QString file);
+ //! get a value from server info
+ static QVariant value(enum ServerInfos setting);
+ //! get a value from server info for a named platform.
+ static QVariant platformValue(QString platform, enum ServerInfos setting);
+
+ private:
+ //! set a server info to all platforms where configurename matches
+ static void setAllConfigPlatformValue(QString configplatform,ServerInfos info, QVariant value);
+ //! set a server info value
+ static void setValue(enum ServerInfos setting , QVariant value);
+ //! set a value for a server info for a named platform.
+ static void setPlatformValue(QString platform, enum ServerInfos setting, QVariant value);
+ //! you shouldnt call this, its a fully static class
+ ServerInfo() {}
+
+ //! map of server infos
+ static QMap<QString, QVariant> serverInfos;
+
+};
+
+#endif
+
diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp
new file mode 100644
index 0000000000..c6b6d83450
--- /dev/null
+++ b/rbutil/rbutilqt/base/systeminfo.cpp
@@ -0,0 +1,196 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2010 by Dominik Wenger
+ * $Id$
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "systeminfo.h"
+#include "rbsettings.h"
+
+#include <QSettings>
+
+#if defined(Q_OS_LINUX)
+#include <unistd.h>
+#endif
+
+
+// device settings
+const static struct {
+ SystemInfo::SystemInfos info;
+ const char* name;
+ const char* def;
+} SystemInfosList[] = {
+ { SystemInfo::ManualUrl, "manual_url", "" },
+ { SystemInfo::BleedingUrl, "bleeding_url", "" },
+ { SystemInfo::BootloaderUrl, "bootloader_url", "" },
+ { SystemInfo::BootloaderInfoUrl, "bootloader_info_url", "" },
+ { SystemInfo::FontUrl, "font_url", "" },
+ { SystemInfo::VoiceUrl, "voice_url", "" },
+ { SystemInfo::DoomUrl, "doom_url", "" },
+ { SystemInfo::ReleaseUrl, "release_url", "" },
+ { SystemInfo::DailyUrl, "daily_url", "" },
+ { SystemInfo::ServerConfUrl, "server_conf_url", "" },
+ { SystemInfo::GenlangUrl, "genlang_url", "" },
+ { SystemInfo::ThemesUrl, "themes_url", "" },
+ { SystemInfo::RbutilUrl, "rbutil_url", "" },
+ { SystemInfo::BleedingInfo, "bleeding_info", "" },
+ { SystemInfo::CurPlatformName, ":platform:/name", "" },
+ { SystemInfo::CurManual, ":platform:/manualname","rockbox-:platform:" },
+ { SystemInfo::CurBootloaderMethod, ":platform:/bootloadermethod", "none" },
+ { SystemInfo::CurBootloaderName, ":platform:/bootloadername", "" },
+ { SystemInfo::CurBootloaderFile, ":platform:/bootloaderfile", "" },
+ { SystemInfo::CurEncoder, ":platform:/encoder", "" },
+ { SystemInfo::CurBrand, ":platform:/brand", "" },
+ { SystemInfo::CurName, ":platform:/name", "" },
+ { SystemInfo::CurBuildserverModel, ":platform:/buildserver_modelname", "" },
+ { SystemInfo::CurConfigureModel, ":platform:/configure_modelname", "" },
+};
+
+//! pointer to setting object to NULL
+QSettings* SystemInfo::systemInfos = NULL;
+
+void SystemInfo::ensureSystemInfoExists()
+{
+ //check and create settings object
+ if(systemInfos == NULL)
+ {
+ // only use built-in rbutil.ini
+ systemInfos = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0);
+ }
+}
+
+
+QVariant SystemInfo::value(enum SystemInfos info)
+{
+ ensureSystemInfoExists();
+
+ // locate setting item
+ int i = 0;
+ while(SystemInfosList[i].info != info)
+ i++;
+
+ QString s = SystemInfosList[i].name;
+ s.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
+ QString d = SystemInfosList[i].def;
+ d.replace(":platform:", RbSettings::value(RbSettings::CurrentPlatform).toString());
+ qDebug() << "[SystemInfos] GET:" << s << systemInfos->value(s, d).toString();
+ return systemInfos->value(s, d);
+}
+
+QVariant SystemInfo::platformValue(QString platform, enum SystemInfos info)
+{
+ ensureSystemInfoExists();
+
+ // locate setting item
+ int i = 0;
+ while(SystemInfosList[i].info != info)
+ i++;
+
+ QString s = SystemInfosList[i].name;
+ s.replace(":platform:", platform);
+ QString d = SystemInfosList[i].def;
+ d.replace(":platform:", platform);
+ qDebug() << "[SystemInfo] GET P:" << s << systemInfos->value(s, d).toString();
+ return systemInfos->value(s, d);
+}
+
+QStringList SystemInfo::platforms()
+{
+ ensureSystemInfoExists();
+
+ QStringList result;
+ systemInfos->beginGroup("platforms");
+ QStringList a = systemInfos->childKeys();
+ systemInfos->endGroup();
+ for(int i = 0; i < a.size(); i++)
+ {
+ //only add not disabled targets
+ QString target = systemInfos->value("platforms/"+a.at(i), "null").toString();
+ if(systemInfos->value(target+"/status").toString() != "disabled")
+ result.append(target);
+ }
+ return result;
+}
+
+QStringList SystemInfo::languages()
+{
+ ensureSystemInfoExists();
+
+ QStringList result;
+ systemInfos->beginGroup("languages");
+ QStringList a = systemInfos->childKeys();
+ for(int i = 0; i < a.size(); i++)
+ {
+ result.append(systemInfos->value(a.at(i), "null").toString());
+ }
+ systemInfos->endGroup();
+ return result;
+}
+
+
+QString SystemInfo::name(QString platform)
+{
+ ensureSystemInfoExists();
+ return systemInfos->value(platform + "/name").toString();
+}
+
+QString SystemInfo::brand(QString platform)
+{
+ ensureSystemInfoExists();
+ return systemInfos->value(platform + "/brand").toString();
+}
+
+QMap<int, QString> SystemInfo::usbIdMap(enum MapType type)
+{
+ ensureSystemInfoExists();
+
+ QMap<int, QString> map;
+ // get a list of ID -> target name
+ QStringList platforms;
+ systemInfos->beginGroup("platforms");
+ platforms = systemInfos->childKeys();
+ systemInfos->endGroup();
+
+ QString t;
+ switch(type) {
+ case MapDevice:
+ t = "usbid";
+ break;
+ case MapError:
+ t = "usberror";
+ break;
+ case MapIncompatible:
+ t = "usbincompat";
+ break;
+ }
+
+ for(int i = 0; i < platforms.size(); i++)
+ {
+ systemInfos->beginGroup("platforms");
+ QString target = systemInfos->value(platforms.at(i)).toString();
+ systemInfos->endGroup();
+ systemInfos->beginGroup(target);
+ QStringList ids = systemInfos->value(t).toStringList();
+ int j = ids.size();
+ while(j--)
+ map.insert(ids.at(j).toInt(0, 16), target);
+
+ systemInfos->endGroup();
+ }
+ return map;
+}
+
+
diff --git a/rbutil/rbutilqt/base/systeminfo.h b/rbutil/rbutilqt/base/systeminfo.h
new file mode 100644
index 0000000000..1794b00a76
--- /dev/null
+++ b/rbutil/rbutilqt/base/systeminfo.h
@@ -0,0 +1,91 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2010 by Dominik Wenger
+ * $Id$
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef SYSTEMINFO_H
+#define SYSTEMINFO_H
+
+#include <QtCore>
+
+class SystemInfo : public QObject
+{
+ Q_OBJECT
+ public:
+ //! Type of requested usb-id map
+ enum MapType {
+ MapDevice,
+ MapError,
+ MapIncompatible,
+ };
+
+ //! All system settings
+ enum SystemInfos {
+ ManualUrl,
+ BleedingUrl,
+ BootloaderUrl,
+ BootloaderInfoUrl,
+ FontUrl,
+ VoiceUrl,
+ DoomUrl,
+ ReleaseUrl,
+ DailyUrl,
+ ServerConfUrl,
+ GenlangUrl,
+ ThemesUrl,
+ RbutilUrl,
+ BleedingInfo,
+ CurPlatformName,
+ CurManual,
+ CurBootloaderMethod,
+ CurBootloaderName,
+ CurBootloaderFile,
+ CurEncoder,
+ CurBrand,
+ CurName,
+ CurBuildserverModel,
+ CurConfigureModel,
+ };
+
+ //! return a list of all platforms (rbutil internal names)
+ static QStringList platforms(void);
+ //! returns a list of all languages
+ static QStringList languages(void);
+ //! maps a platform to its name
+ static QString name(QString plattform);
+ //! maps a platform to its brand
+ static QString brand(QString plattform);
+ //! returns a map of usb-ids and their targets
+ static QMap<int, QString> usbIdMap(enum MapType);
+ //! get a value from system settings
+ static QVariant value(enum SystemInfos info);
+ //! get a value from system settings for a named platform.
+ static QVariant platformValue(QString platform, enum SystemInfos info);
+
+ private:
+ //! you shouldnt call this, its a fully static calls
+ SystemInfo() {}
+ //! create the setting objects if neccessary
+ static void ensureSystemInfoExists();
+ //! pointers to our setting objects
+ static QSettings *systemInfos;
+};
+
+#endif
+
diff --git a/rbutil/rbutilqt/base/talkgenerator.cpp b/rbutil/rbutilqt/base/talkgenerator.cpp
index 93a52a922e..5c0f8e985b 100644
--- a/rbutil/rbutilqt/base/talkgenerator.cpp
+++ b/rbutil/rbutilqt/base/talkgenerator.cpp
@@ -19,6 +19,7 @@
#include "talkgenerator.h"
#include "rbsettings.h"
+#include "systeminfo.h"
#include "wavtrim.h"
TalkGenerator::TalkGenerator(QObject* parent): QObject(parent)
@@ -48,7 +49,7 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt
// Encoder
emit logItem(tr("Starting Encoder Engine"),LOGINFO);
- m_enc = EncBase::getEncoder(this,RbSettings::value(RbSettings::CurEncoder).toString());
+ m_enc = EncBase::getEncoder(this,SystemInfo::value(SystemInfo::CurEncoder).toString());
if(!m_enc->start())
{
emit logItem(tr("Init of Encoder engine failed"),LOGERROR);
diff --git a/rbutil/rbutilqt/base/ttssapi.cpp b/rbutil/rbutilqt/base/ttssapi.cpp
index e356d613de..b8c22f2fa7 100644
--- a/rbutil/rbutilqt/base/ttssapi.cpp
+++ b/rbutil/rbutilqt/base/ttssapi.cpp
@@ -20,6 +20,7 @@
#include "ttssapi.h"
#include "utils.h"
#include "rbsettings.h"
+#include "systeminfo.h"
TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
{
@@ -31,7 +32,7 @@ TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
void TTSSapi::generateSettings()
{
// language
- QStringList languages = RbSettings::languages();
+ QStringList languages = SystemInfo::languages();
languages.sort();
EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,
tr("Language:"),RbSettings::subValue("sapi",RbSettings::TtsLanguage),languages);
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 4bdc748553..4125c17205 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -20,6 +20,7 @@
#include "utils.h"
#include "system.h"
#include "rbsettings.h"
+#include "systeminfo.h"
#ifdef UNICODE
#define _UNICODE
@@ -187,11 +188,11 @@ QString check(bool permission)
// Check TargetId
RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString());
QString installed = rbinfo.target();
- if(!installed.isEmpty() && installed != RbSettings::value(RbSettings::CurConfigureModel).toString())
+ if(!installed.isEmpty() && installed != SystemInfo::value(SystemInfo::CurConfigureModel).toString())
{
text += QObject::tr("<li>Target mismatch detected.\n"
"Installed target: %1, selected target: %2.</li>")
- .arg(installed, RbSettings::value(RbSettings::CurPlatformName).toString());
+ .arg(installed, SystemInfo::value(SystemInfo::CurPlatformName).toString());
// FIXME: replace installed by human-friendly name
}
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp
index 4c7a775c72..2ccdd05c09 100644
--- a/rbutil/rbutilqt/base/voicefile.cpp
+++ b/rbutil/rbutilqt/base/voicefile.cpp
@@ -20,6 +20,7 @@
#include "voicefile.h"
#include "utils.h"
#include "rbsettings.h"
+#include "systeminfo.h"
VoiceFileCreator::VoiceFileCreator(QObject* parent) :QObject(parent)
{
@@ -61,7 +62,7 @@ bool VoiceFileCreator::createVoiceFile()
version = version.left(version.indexOf("-")).remove("r");
//prepare download url
- QUrl genlangUrl = RbSettings::value(RbSettings::GenlangUrl).toString()
+ QUrl genlangUrl = SystemInfo::value(SystemInfo::GenlangUrl).toString()
+"?lang=" + m_lang + "&t=" + target + "&rev=" + version + "&f=" + features;
qDebug() << "downloading " << genlangUrl;
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 3dff2b1397..dafa9997a4 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -29,6 +29,8 @@
#include "system.h"
#include "encttscfggui.h"
#include "rbsettings.h"
+#include "serverinfo.h"
+#include "systeminfo.h"
#include "utils.h"
#include <stdio.h>
#if defined(Q_OS_WIN32)
@@ -286,14 +288,15 @@ void Config::setDevices()
// setup devices table
qDebug() << "[Config] setting up devices list";
- QStringList platformList = RbSettings::platforms();
+ QStringList platformList = SystemInfo::platforms();
QMap <QString, QString> manuf;
QMap <QString, QString> devcs;
for(int it = 0; it < platformList.size(); it++)
{
- QString curname = RbSettings::name(platformList.at(it));
- QString curbrand = RbSettings::brand(platformList.at(it));
+ QString curname = SystemInfo::name(platformList.at(it)) +
+ " (" +ServerInfo::platformValue(platformList.at(it),ServerInfo::CurStatus).toString() + ")";
+ QString curbrand = SystemInfo::brand(platformList.at(it));
manuf.insertMulti(curbrand, platformList.at(it));
devcs.insert(platformList.at(it), curname);
}
@@ -321,8 +324,9 @@ void Config::setDevices()
// go through platforms again for sake of order
for(int it = 0; it < platformList.size(); it++) {
- QString curname = RbSettings::name(platformList.at(it));
- QString curbrand = RbSettings::brand(platformList.at(it));
+ QString curname = SystemInfo::name(platformList.at(it)) +
+ " (" +ServerInfo::platformValue(platformList.at(it),ServerInfo::CurStatus).toString() +")";
+ QString curbrand = SystemInfo::brand(platformList.at(it));
if(curbrand != brands.at(c)) continue;
qDebug() << "[Config] add supported device:" << brands.at(c) << curname;
@@ -382,10 +386,10 @@ void Config::updateEncState()
return;
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
- QString encoder = RbSettings::platformValue(devname,
- RbSettings::CurEncoder).toString();
- ui.encoderName->setText(EncBase::getEncoderName(RbSettings::platformValue(devname,
- RbSettings::CurEncoder).toString()));
+ QString encoder = SystemInfo::platformValue(devname,
+ SystemInfo::CurEncoder).toString();
+ ui.encoderName->setText(EncBase::getEncoderName(SystemInfo::platformValue(devname,
+ SystemInfo::CurEncoder).toString()));
EncBase* enc = EncBase::getEncoder(this,encoder);
@@ -601,8 +605,8 @@ void Config::autodetect()
QString text;
text = tr("Detected an unsupported player:\n%1\n"
"Sorry, Rockbox doesn't run on your player.")
- .arg(RbSettings::platformValue(detector.incompatdev(),
- RbSettings::CurName).toString());
+ .arg(SystemInfo::platformValue(detector.incompatdev(),
+ SystemInfo::CurName).toString());
QMessageBox::critical(this, tr("Fatal: player incompatible"),
text, QMessageBox::Ok);
@@ -723,10 +727,10 @@ void Config::configEnc()
return;
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
- QString encoder = RbSettings::platformValue(devname,
- RbSettings::CurEncoder).toString();
- ui.encoderName->setText(EncBase::getEncoderName(RbSettings::platformValue(devname,
- RbSettings::CurEncoder).toString()));
+ QString encoder = SystemInfo::platformValue(devname,
+ SystemInfo::CurEncoder).toString();
+ ui.encoderName->setText(EncBase::getEncoderName(SystemInfo::platformValue(devname,
+ SystemInfo::CurEncoder).toString()));
EncBase* enc = EncBase::getEncoder(this,encoder);
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp
index 5beedd2f90..7fde1678a0 100644
--- a/rbutil/rbutilqt/createvoicewindow.cpp
+++ b/rbutil/rbutilqt/createvoicewindow.cpp
@@ -23,6 +23,7 @@
#include "browsedirtree.h"
#include "configure.h"
#include "rbsettings.h"
+#include "systeminfo.h"
CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
{
@@ -72,7 +73,7 @@ void CreateVoiceWindow::accept()
void CreateVoiceWindow::updateSettings(void)
{
// fill in language combobox
- QStringList languages = RbSettings::languages();
+ QStringList languages = SystemInfo::languages();
languages.sort();
ui.comboLanguage->addItems(languages);
// set saved lang
@@ -99,7 +100,7 @@ void CreateVoiceWindow::updateSettings(void)
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
.arg("Invalid TTS configuration!"));
- QString encoder = RbSettings::value(RbSettings::CurEncoder).toString();
+ QString encoder = SystemInfo::value(SystemInfo::CurEncoder).toString();
// only proceed if encoder setting is set
EncBase* enc = EncBase::getEncoder(this,encoder);
if(enc != NULL) {
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index 25a6273b1a..fb604e71e2 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -23,6 +23,7 @@
#include "browsedirtree.h"
#include "configure.h"
#include "rbsettings.h"
+#include "systeminfo.h"
InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
{
@@ -130,7 +131,7 @@ void InstallTalkWindow::updateSettings(void)
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
.arg("Invalid TTS configuration!"));
- QString encoder = RbSettings::value(RbSettings::CurEncoder).toString();
+ QString encoder = SystemInfo::value(SystemInfo::CurEncoder).toString();
EncBase* enc = EncBase::getEncoder(this,encoder);
if(enc != NULL) {
if(enc->configOk())
diff --git a/rbutil/rbutilqt/installwindow.cpp b/rbutil/rbutilqt/installwindow.cpp
index eb0dbf228d..8aefeb0bac 100644
--- a/rbutil/rbutilqt/installwindow.cpp
+++ b/rbutil/rbutilqt/installwindow.cpp
@@ -22,6 +22,8 @@
#include "rbzip.h"
#include "system.h"
#include "rbsettings.h"
+#include "serverinfo.h"
+#include "systeminfo.h"
#include "utils.h"
InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent)
@@ -54,24 +56,24 @@ InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent)
backupCheckboxChanged(Qt::Unchecked);
- if(RbSettings::value(RbSettings::DailyRevision).toString().isEmpty()) {
+ if(ServerInfo::value(ServerInfo::DailyRevision).toString().isEmpty()) {
ui.radioArchived->setEnabled(false);
qDebug() << "[Install] no information about archived version available!";
}
- if(RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) {
+ if(ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) {
ui.radioStable->setEnabled(false);
}
// try to use the old selection first. If no selection has been made
// in the past, use a preselection based on released status.
if(RbSettings::value(RbSettings::Build).toString() == "stable"
- && !RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty())
+ && !ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty())
ui.radioStable->setChecked(true);
else if(RbSettings::value(RbSettings::Build).toString() == "archived")
ui.radioArchived->setChecked(true);
else if(RbSettings::value(RbSettings::Build).toString() == "current")
ui.radioCurrent->setChecked(true);
- else if(!RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) {
+ else if(!ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) {
ui.radioStable->setChecked(true);
ui.radioStable->setEnabled(true);
QFont font;
@@ -138,30 +140,30 @@ void InstallWindow::accept()
}
QString myversion;
- QString buildname = RbSettings::value(RbSettings::CurBuildserverModel).toString();
+ QString buildname = SystemInfo::value(SystemInfo::CurBuildserverModel).toString();
if(ui.radioStable->isChecked()) {
- file = RbSettings::value(RbSettings::ReleaseUrl).toString();
+ file = SystemInfo::value(SystemInfo::ReleaseUrl).toString();
RbSettings::setValue(RbSettings::Build, "stable");
- myversion = RbSettings::value(RbSettings::CurReleaseVersion).toString();
+ myversion = ServerInfo::value(ServerInfo::CurReleaseVersion).toString();
}
else if(ui.radioArchived->isChecked()) {
- file = RbSettings::value(RbSettings::DailyUrl).toString();
+ file = SystemInfo::value(SystemInfo::DailyUrl).toString();
RbSettings::setValue(RbSettings::Build, "archived");
- myversion = "r" + RbSettings::value(RbSettings::DailyRevision).toString() + "-" + RbSettings::value(RbSettings::DailyDate).toString();
+ myversion = "r" + ServerInfo::value(ServerInfo::DailyRevision).toString() + "-" + ServerInfo::value(ServerInfo::DailyDate).toString();
}
else if(ui.radioCurrent->isChecked()) {
- file = RbSettings::value(RbSettings::BleedingUrl).toString();
+ file = SystemInfo::value(SystemInfo::BleedingUrl).toString();
RbSettings::setValue(RbSettings::Build, "current");
- myversion = "r" + RbSettings::value(RbSettings::BleedingRevision).toString();
+ myversion = "r" + ServerInfo::value(ServerInfo::BleedingRevision).toString();
}
else {
qDebug() << "[Install] no build selected -- this shouldn't happen";
return;
}
file.replace("%MODEL%", buildname);
- file.replace("%RELVERSION%", RbSettings::value(RbSettings::CurReleaseVersion).toString());
- file.replace("%REVISION%", RbSettings::value(RbSettings::DailyRevision).toString());
- file.replace("%DATE%", RbSettings::value(RbSettings::DailyDate).toString());
+ file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
+ file.replace("%REVISION%", ServerInfo::value(ServerInfo::DailyRevision).toString());
+ file.replace("%DATE%", ServerInfo::value(ServerInfo::DailyDate).toString());
RbSettings::sync();
@@ -268,8 +270,8 @@ void InstallWindow::setDetailsCurrent(bool show)
ui.labelDetails->setText(tr("This is the absolute up to the minute "
"Rockbox built. A current build will get updated every time "
"a change is made. Latest version is r%1 (%2).")
- .arg(RbSettings::value(RbSettings::BleedingRevision).toString(),RbSettings::value(RbSettings::BleedingDate).toString()));
- if(RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty())
+ .arg(ServerInfo::value(ServerInfo::BleedingRevision).toString(),ServerInfo::value(ServerInfo::BleedingDate).toString()));
+ if(ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty())
ui.labelNote->setText(tr("<b>This is the recommended version.</b>"));
else
ui.labelNote->setText("");
@@ -283,11 +285,11 @@ void InstallWindow::setDetailsStable(bool show)
ui.labelDetails->setText(
tr("This is the last released version of Rockbox."));
- if(!RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty())
+ if(!ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty())
ui.labelNote->setText(tr("<b>Note:</b> "
"The lastest released version is %1. "
"<b>This is the recommended version.</b>")
- .arg(RbSettings::value(RbSettings::CurReleaseVersion).toString()));
+ .arg(ServerInfo::value(ServerInfo::CurReleaseVersion).toString()));
else ui.labelNote->setText("");
}
}
@@ -301,7 +303,7 @@ void InstallWindow::setDetailsArchived(bool show)
"features than the last stable release but may be much less stable. "
"Features may change regularly."));
ui.labelNote->setText(tr("<b>Note:</b> archived version is r%1 (%2).")
- .arg(RbSettings::value(RbSettings::DailyRevision).toString(),RbSettings::value(RbSettings::DailyDate).toString()));
+ .arg(ServerInfo::value(ServerInfo::DailyRevision).toString(),ServerInfo::value(ServerInfo::DailyDate).toString()));
}
}
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 8997c386bf..9e535ffdcc 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -36,6 +36,8 @@
#include "system.h"
#include "systrace.h"
#include "rbsettings.h"
+#include "serverinfo.h"
+#include "systeminfo.h"
#include "progressloggerinterface.h"
@@ -179,7 +181,7 @@ void RbUtilQt::downloadInfo()
ui.statusbar->showMessage(tr("Downloading build information, please wait ..."));
qDebug() << "[RbUtil] downloading build info";
daily->setFile(&buildInfo);
- daily->getFile(QUrl(RbSettings::value(RbSettings::ServerConfUrl).toString()));
+ daily->getFile(QUrl(SystemInfo::value(SystemInfo::ServerConfUrl).toString()));
}
@@ -194,30 +196,10 @@ void RbUtilQt::downloadDone(bool error)
}
qDebug() << "[RbUtil] network status:" << daily->error();
- // read info into settings object
+ // read info into ServerInfo object
buildInfo.open();
- QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
+ ServerInfo::readBuildInfo(buildInfo.fileName());
buildInfo.close();
- RbSettings::setValue(RbSettings::DailyRevision,info.value("dailies/rev"));
- QDate date = QDate::fromString(info.value("dailies/date").toString(), "yyyyMMdd");
- RbSettings::setValue(RbSettings::DailyDate,date.toString());
-
- info.beginGroup("release");
- QStringList keys = info.allKeys();
- for(int i=0; i < keys.size(); i++)
- {
- RbSettings::setPlatformValue(keys[i],RbSettings::CurReleaseVersion,info.value(keys[i]));
- }
- info.endGroup();
-
- info.beginGroup("status");
- keys = info.allKeys();
- for(int i=0; i < keys.size(); i++)
- {
- RbSettings::setPlatformValue(keys[i],RbSettings::CurStatus,info.value(keys[i]));
- }
- info.endGroup();
-
//start bleeding info download
bleeding = new HttpGet(this);
@@ -227,7 +209,7 @@ void RbUtilQt::downloadDone(bool error)
if(RbSettings::value(RbSettings::CacheOffline).toBool())
bleeding->setCache(true);
bleeding->setFile(&bleedingInfo);
- bleeding->getFile(QUrl(RbSettings::value(RbSettings::BleedingInfo).toString()));
+ bleeding->getFile(QUrl(SystemInfo::value(SystemInfo::BleedingInfo).toString()));
ui.statusbar->showMessage(tr("Downloading build information, please wait ..."));
}
@@ -240,12 +222,9 @@ void RbUtilQt::downloadBleedingDone(bool error)
}
else {
bleedingInfo.open();
- QSettings info(bleedingInfo.fileName(), QSettings::IniFormat, this);
+ ServerInfo::readBleedingInfo(bleedingInfo.fileName());
bleedingInfo.close();
- RbSettings::setValue(RbSettings::BleedingRevision,info.value("bleeding/rev"));
- QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ");
- RbSettings::setValue(RbSettings::BleedingDate,date.toString());
-
+
ui.statusbar->showMessage(tr("Download build information finished."), 5000);
updateSettings();
m_gotInfo = true;
@@ -361,14 +340,14 @@ void RbUtilQt::updateDevice()
/* Enable bootloader installation, if possible */
bool bootloaderInstallable =
- RbSettings::value(RbSettings::CurBootloaderMethod) != "none";
+ SystemInfo::value(SystemInfo::CurBootloaderMethod) != "none";
ui.buttonBootloader->setEnabled(bootloaderInstallable);
ui.labelBootloader->setEnabled(bootloaderInstallable);
ui.actionInstall_Bootloader->setEnabled(bootloaderInstallable);
/* Enable bootloader uninstallation, if possible */
bool bootloaderUninstallable = bootloaderInstallable &&
- RbSettings::value(RbSettings::CurBootloaderMethod) != "fwpatcher";
+ SystemInfo::value(SystemInfo::CurBootloaderMethod) != "fwpatcher";
ui.labelRemoveBootloader->setEnabled(bootloaderUninstallable);
ui.buttonRemoveBootloader->setEnabled(bootloaderUninstallable);
ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
@@ -380,15 +359,16 @@ void RbUtilQt::updateDevice()
// displayed device info
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
- QString brand = RbSettings::value(RbSettings::CurBrand).toString();
- QString name = RbSettings::value(RbSettings::CurName).toString();
+ QString brand = SystemInfo::value(SystemInfo::CurBrand).toString();
+ QString name = SystemInfo::value(SystemInfo::CurName).toString() +
+ " (" + ServerInfo::value(ServerInfo::CurStatus).toString() + ")";
if(name.isEmpty()) name = "&lt;none&gt;";
if(mountpoint.isEmpty()) mountpoint = "&lt;invalid&gt;";
ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>")
.arg(brand, name, QDir::toNativeSeparators(mountpoint)));
// hide quickstart buttons if no release available
- bool installable = !RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty();
+ bool installable = !ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty();
ui.buttonSmall->setEnabled(installable);
ui.buttonComplete->setEnabled(installable);
ui.actionSmall_Installation->setEnabled(installable);
@@ -400,15 +380,15 @@ void RbUtilQt::updateManual()
{
if(RbSettings::value(RbSettings::Platform) != "")
{
- QString manual= RbSettings::value(RbSettings::CurManual).toString();
+ QString manual= SystemInfo::value(SystemInfo::CurManual).toString();
if(manual == "")
manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString();
QString pdfmanual;
- pdfmanual = RbSettings::value(RbSettings::ManualUrl).toString()
+ pdfmanual = SystemInfo::value(SystemInfo::ManualUrl).toString()
+ "/" + manual + ".pdf";
QString htmlmanual;
- htmlmanual = RbSettings::value(RbSettings::ManualUrl).toString()
+ htmlmanual = SystemInfo::value(SystemInfo::ManualUrl).toString()
+ "/" + manual + "/rockbox-build.html";
ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>")
.arg(pdfmanual));
@@ -431,7 +411,7 @@ void RbUtilQt::completeInstall()
"This will install Rockbox %1. To install the most recent "
"development build available press \"Cancel\" and "
"use the \"Installation\" tab.")
- .arg(RbSettings::value(RbSettings::CurReleaseVersion).toString()),
+ .arg(ServerInfo::value(ServerInfo::CurReleaseVersion).toString()),
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok)
return;
// create logger
@@ -489,7 +469,7 @@ void RbUtilQt::smallInstall()
"This will install Rockbox %1. To install the most recent "
"development build available press \"Cancel\" and "
"use the \"Installation\" tab.")
- .arg(RbSettings::value(RbSettings::CurReleaseVersion).toString()),
+ .arg(ServerInfo::value(ServerInfo::CurReleaseVersion).toString()),
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok)
return;
@@ -510,7 +490,7 @@ bool RbUtilQt::smallInstallInner()
return true;
}
// Bootloader
- if(RbSettings::value(RbSettings::CurBootloaderMethod) != "none")
+ if(SystemInfo::value(SystemInfo::CurBootloaderMethod) != "none")
{
m_error = false;
m_installed = false;
@@ -561,9 +541,9 @@ void RbUtilQt::installBtn()
bool RbUtilQt::installAuto()
{
- QString file = RbSettings::value(RbSettings::ReleaseUrl).toString();
- file.replace("%MODEL%", RbSettings::value(RbSettings::CurBuildserverModel).toString());
- file.replace("%RELVERSION%", RbSettings::value(RbSettings::CurReleaseVersion).toString());
+ QString file = SystemInfo::value(SystemInfo::ReleaseUrl).toString();
+ file.replace("%MODEL%", SystemInfo::value(SystemInfo::CurBuildserverModel).toString());
+ file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
// check installed Version and Target
QString warning = check(false);
@@ -620,7 +600,7 @@ bool RbUtilQt::installAuto()
ZipInstaller* installer = new ZipInstaller(this);
installer->setUrl(file);
installer->setLogSection("Rockbox (Base)");
- installer->setLogVersion(RbSettings::value(RbSettings::CurReleaseVersion).toString());
+ installer->setLogVersion(ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
@@ -668,7 +648,7 @@ void RbUtilQt::installBootloader()
// create installer
BootloaderInstallBase *bl;
- QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString();
+ QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString();
if(type == "mi4") {
bl = new BootloaderInstallMi4(this);
}
@@ -700,15 +680,15 @@ void RbUtilQt::installBootloader()
}
// set bootloader filename. Do this now as installed() needs it.
- QStringList blfile = RbSettings::value(RbSettings::CurBootloaderFile).toStringList();
+ QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
QStringList blfilepath;
for(int a = 0; a < blfile.size(); a++) {
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
+ blfile.at(a));
}
bl->setBlFile(blfilepath);
- QUrl url(RbSettings::value(RbSettings::BootloaderUrl).toString()
- + RbSettings::value(RbSettings::CurBootloaderName).toString());
+ QUrl url(SystemInfo::value(SystemInfo::BootloaderUrl).toString()
+ + SystemInfo::value(SystemInfo::CurBootloaderName).toString());
bl->setBlUrl(url);
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.rockbox/rbutil.log");
@@ -734,7 +714,7 @@ void RbUtilQt::installBootloader()
else if(bl->installed() == BootloaderInstallBase::BootloaderOther
&& bl->capabilities() & BootloaderInstallBase::Backup)
{
- QString targetFolder = RbSettings::value(RbSettings::CurPlatformName).toString()
+ QString targetFolder = SystemInfo::value(SystemInfo::CurPlatformName).toString()
+ " Firmware Backup";
// remove invalid character(s)
targetFolder.remove(QRegExp("[:/]"));
@@ -852,9 +832,9 @@ void RbUtilQt::installFonts()
// create zip installer
installer = new ZipInstaller(this);
- installer->setUrl(RbSettings::value(RbSettings::FontUrl).toString());
+ installer->setUrl(SystemInfo::value(SystemInfo::FontUrl).toString());
installer->setLogSection("Fonts");
- installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString());
+ installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
@@ -890,15 +870,15 @@ void RbUtilQt::installVoice()
// create zip installer
installer = new ZipInstaller(this);
- QString voiceurl = RbSettings::value(RbSettings::VoiceUrl).toString();
+ QString voiceurl = SystemInfo::value(SystemInfo::VoiceUrl).toString();
- voiceurl += RbSettings::value(RbSettings::CurBuildserverModel).toString() + "-" +
- RbSettings::value(RbSettings::DailyDate).toString() + "-english.zip";
+ voiceurl += SystemInfo::value(SystemInfo::CurBuildserverModel).toString() + "-" +
+ ServerInfo::value(ServerInfo::DailyDate).toString() + "-english.zip";
qDebug() << "[RbUtil] voicefile URL:" << voiceurl;
installer->setUrl(voiceurl);
installer->setLogSection("Voice");
- installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString());
+ installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
@@ -946,9 +926,9 @@ void RbUtilQt::installDoom()
// create zip installer
installer = new ZipInstaller(this);
- installer->setUrl(RbSettings::value(RbSettings::DoomUrl).toString());
+ installer->setUrl(SystemInfo::value(SystemInfo::DoomUrl).toString());
installer->setLogSection("Game Addons");
- installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString());
+ installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
@@ -973,8 +953,6 @@ void RbUtilQt::createTalkFiles(void)
{
if(chkConfig(true)) return;
InstallTalkWindow *installWindow = new InstallTalkWindow(this);
-
- connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
installWindow->show();
@@ -985,7 +963,6 @@ void RbUtilQt::createVoiceFile(void)
if(chkConfig(true)) return;
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
- connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
installWindow->show();
}
@@ -1013,7 +990,7 @@ void RbUtilQt::uninstallBootloader(void)
// create installer
BootloaderInstallBase *bl;
- QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString();
+ QString type = SystemInfo::value(SystemInfo::CurBootloaderMethod).toString();
if(type == "mi4") {
bl = new BootloaderInstallMi4(this);
}
@@ -1035,7 +1012,7 @@ void RbUtilQt::uninstallBootloader(void)
return;
}
- QStringList blfile = RbSettings::value(RbSettings::CurBootloaderFile).toStringList();
+ QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
QStringList blfilepath;
for(int a = 0; a < blfile.size(); a++) {
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
@@ -1063,11 +1040,11 @@ void RbUtilQt::downloadManual(void)
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return;
- QString manual = RbSettings::value(RbSettings::CurManual).toString();
+ QString manual = SystemInfo::value(SystemInfo::CurManual).toString();
if(manual.isEmpty())
manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString();
- QString date = RbSettings::value(RbSettings::DailyDate).toString();
+ QString date = ServerInfo::value(ServerInfo::DailyDate).toString();
QString manualurl;
QString target;
@@ -1080,7 +1057,7 @@ void RbUtilQt::downloadManual(void)
target = "/" + manual + "-" + date + "-html.zip";
section = "Manual (HTML)";
}
- manualurl = RbSettings::value(RbSettings::ManualUrl).toString() + "/" + target;
+ manualurl = SystemInfo::value(SystemInfo::ManualUrl).toString() + "/" + target;
qDebug() << "[RbUtil] Manual URL:" << manualurl;
ProgressLoggerGui* logger = new ProgressLoggerGui(this);
@@ -1243,7 +1220,7 @@ bool RbUtilQt::chkConfig(bool warn)
void RbUtilQt::checkUpdate(void)
{
- QString url = RbSettings::value(RbSettings::RbutilUrl).toString();
+ QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString();
#if defined(Q_OS_WIN32)
url += "win32/";
#elif defined(Q_OS_LINUX)
@@ -1308,7 +1285,7 @@ void RbUtilQt::downloadUpdateDone(bool error)
// if we found something newer, display info
if(newVersion != "")
{
- QString url = RbSettings::value(RbSettings::RbutilUrl).toString();
+ QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString();
#if defined(Q_OS_WIN32)
url += "win32/";
#elif defined(Q_OS_LINUX)
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index 0a562f0e7c..a1983719b4 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -97,6 +97,8 @@ SOURCES += rbutilqt.cpp \
base/voicefile.cpp \
createvoicewindow.cpp \
base/rbsettings.cpp \
+ base/serverinfo.cpp \
+ base/systeminfo.cpp \
base/rbunzip.cpp \
base/rbzip.cpp \
base/system.cpp \
@@ -158,6 +160,8 @@ HEADERS += rbutilqt.h \
base/voicefile.h \
createvoicewindow.h \
base/rbsettings.h \
+ base/serverinfo.h \
+ base/systeminfo.h \
base/rbunzip.h \
base/rbzip.h \
sysinfo.h \
diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp
index 4717457fdb..4c75d431fb 100644
--- a/rbutil/rbutilqt/themesinstallwindow.cpp
+++ b/rbutil/rbutilqt/themesinstallwindow.cpp
@@ -25,6 +25,7 @@
#include "progressloggergui.h"
#include "utils.h"
#include "rbsettings.h"
+#include "systeminfo.h"
ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
{
@@ -63,9 +64,9 @@ void ThemesInstallWindow::downloadInfo()
themesInfo.close();
QUrl url;
- url = QUrl(RbSettings::value(RbSettings::ThemesUrl).toString()
+ url = QUrl(SystemInfo::value(SystemInfo::ThemesUrl).toString()
+ "/rbutilqt.php?target="
- + RbSettings::value(RbSettings::CurConfigureModel).toString());
+ + SystemInfo::value(SystemInfo::CurConfigureModel).toString());
qDebug() << "[Themes] Info URL:" << url << "Query:" << url.queryItems();
if(RbSettings::value(RbSettings::CacheOffline).toBool())
getter->setCache(true);
@@ -195,9 +196,9 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p
iniDetails.beginGroup(cur->data(Qt::UserRole).toString());
QUrl img, txt;
- txt = QUrl(QString(RbSettings::value(RbSettings::ThemesUrl).toString() + "/"
+ txt = QUrl(QString(SystemInfo::value(SystemInfo::ThemesUrl).toString() + "/"
+ iniDetails.value("descriptionfile").toString()));
- img = QUrl(QString(RbSettings::value(RbSettings::ThemesUrl).toString() + "/"
+ img = QUrl(QString(SystemInfo::value(SystemInfo::ThemesUrl).toString() + "/"
+ iniDetails.value("image").toString()));
QString text;
@@ -311,7 +312,7 @@ void ThemesInstallWindow::accept()
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) {
iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString());
- zip = RbSettings::value(RbSettings::ThemesUrl).toString()
+ zip = SystemInfo::value(SystemInfo::ThemesUrl).toString()
+ "/" + iniDetails.value("archive").toString();
themes.append(zip);
names.append("Theme: " +