summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp7
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstalls5l.cpp6
-rw-r--r--rbutil/rbutilqt/base/playerbuildinfo.cpp265
-rw-r--r--rbutil/rbutilqt/base/playerbuildinfo.h106
-rw-r--r--rbutil/rbutilqt/base/rbsettings.cpp5
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp157
-rw-r--r--rbutil/rbutilqt/base/serverinfo.h71
-rw-r--r--rbutil/rbutilqt/base/systeminfo.cpp85
-rw-r--r--rbutil/rbutilqt/base/systeminfo.h44
-rw-r--r--rbutil/rbutilqt/base/talkgenerator.cpp9
-rw-r--r--rbutil/rbutilqt/base/utils.cpp8
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp5
12 files changed, 395 insertions, 373 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 00918bf769..58e844b4c3 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -20,6 +20,7 @@
#include "autodetection.h"
#include "rbsettings.h"
#include "systeminfo.h"
+#include "playerbuildinfo.h"
#include "../ipodpatcher/ipodpatcher.h"
#include "../sansapatcher/sansapatcher.h"
@@ -69,7 +70,8 @@ bool Autodetection::detect(void)
}
for(int i = 0; i < m_detected.size(); ++i) {
LOG_INFO() << "Detected player:" << m_detected.at(i).device
- << "at" << m_detected.at(i).mountpoint << states[m_detected.at(i).status];
+ << "at" << m_detected.at(i).mountpoint
+ << states[m_detected.at(i).status];
}
return m_detected.size() > 0;
@@ -108,7 +110,8 @@ void Autodetection::detectUsb()
LOG_WARNING() << "[USB] detected problem with player" << d.device;
}
QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0'));
- if(!SystemInfo::platformValue(SystemInfo::Name, idstring).toString().isEmpty()) {
+ if(!PlayerBuildInfo::instance()->value(
+ PlayerBuildInfo::DisplayName, idstring).toString().isEmpty()) {
struct Detected d;
d.status = PlayerIncompatible;
d.device = idstring;
diff --git a/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp b/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp
index e8852d6df5..3621a27e26 100644
--- a/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstalls5l.cpp
@@ -23,7 +23,7 @@
#include "utils.h"
#include "system.h"
#include "rbsettings.h"
-#include "systeminfo.h"
+#include "playerbuildinfo.h"
#include "../mks5lboot/mks5lboot.h"
@@ -408,8 +408,8 @@ BootloaderInstallBase::BootloaderType BootloaderInstallS5l::installed(void)
QString logfile = RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.rockbox/rbutil.log";
QSettings s(logfile, QSettings::IniFormat, this);
- QString section = SystemInfo::platformValue(
- SystemInfo::BootloaderName).toString().section('/', -1);
+ QString section = PlayerBuildInfo::instance()->value(
+ PlayerBuildInfo::BootloaderName).toString().section('/', -1);
rbblInstalled = s.contains("Bootloader/" + section);
if (rbblInstalled) {
diff --git a/rbutil/rbutilqt/base/playerbuildinfo.cpp b/rbutil/rbutilqt/base/playerbuildinfo.cpp
new file mode 100644
index 0000000000..fb8b121e8f
--- /dev/null
+++ b/rbutil/rbutilqt/base/playerbuildinfo.cpp
@@ -0,0 +1,265 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2020 by Dominik Riebeling
+ *
+ * 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 "playerbuildinfo.h"
+#include "rbsettings.h"
+#include "Logger.h"
+
+PlayerBuildInfo* PlayerBuildInfo::infoInstance = nullptr;
+
+PlayerBuildInfo* PlayerBuildInfo::instance()
+{
+ if (infoInstance == nullptr) {
+ infoInstance = new PlayerBuildInfo();
+ }
+ return infoInstance;
+}
+
+// server infos
+const static struct {
+ PlayerBuildInfo::BuildInfo item;
+ const char* name;
+} ServerInfoList[] = {
+ { PlayerBuildInfo::BuildVoiceLangs, "voices/:version:" },
+ { PlayerBuildInfo::BuildVersion, ":build:/:target:" },
+ { PlayerBuildInfo::BuildUrl, ":build:/build_url" },
+ { PlayerBuildInfo::BuildVoiceUrl, ":build:/voice_url" },
+ { PlayerBuildInfo::BuildManualUrl, ":build:/manual_url" },
+ { PlayerBuildInfo::BuildSourceUrl, ":build:/source_url" },
+ { PlayerBuildInfo::BuildFontUrl, ":build:/font_url" },
+
+ // other URLs -- those are not directly related to the build, but handled here.
+ { PlayerBuildInfo::DoomUrl, "other/doom_url" },
+ { PlayerBuildInfo::Duke3DUrl, "other/duke3d_url" },
+ { PlayerBuildInfo::PuzzFontsUrl, "other/puzzfonts_url" },
+ { PlayerBuildInfo::QuakeUrl, "other/quake_url" },
+ { PlayerBuildInfo::Wolf3DUrl, "other/wolf3d_url" },
+ { PlayerBuildInfo::XWorldUrl, "other/xworld_url" },
+ { PlayerBuildInfo::MidiPatchsetUrl, "other/patcheset_url" },
+};
+
+const static struct {
+ PlayerBuildInfo::DeviceInfo item;
+ const char* name;
+} PlayerInfoList[] = {
+ { PlayerBuildInfo::BuildStatus, "status/:target:" },
+ { PlayerBuildInfo::DisplayName, ":target:/name" },
+ { PlayerBuildInfo::BootloaderMethod, ":target:/bootloadermethod" },
+ { PlayerBuildInfo::BootloaderName, ":target:/bootloadername" },
+ { PlayerBuildInfo::BootloaderFile, ":target:/bootloaderfile" },
+ { PlayerBuildInfo::BootloaderFilter, ":target:/bootloaderfilter" },
+ { PlayerBuildInfo::Encoder, ":target:/encoder" },
+ { PlayerBuildInfo::Brand, ":target:/brand" },
+ { PlayerBuildInfo::PlayerPicture, ":target:/playerpic" },
+};
+
+const static struct {
+ PlayerBuildInfo::SystemUrl item;
+ const char* name;
+} PlayerSystemUrls[] = {
+ { PlayerBuildInfo::BootloaderUrl, "bootloader/download_url" },
+ { PlayerBuildInfo::BuildInfoUrl, "build_info_url" },
+ { PlayerBuildInfo::GenlangUrl, "genlang_url" },
+ { PlayerBuildInfo::ThemesUrl, "themes_url" },
+ { PlayerBuildInfo::ThemesInfoUrl, "themes_info_url" },
+ { PlayerBuildInfo::RbutilUrl, "rbutil_url" },
+};
+
+PlayerBuildInfo::PlayerBuildInfo() :
+ serverInfo(nullptr),
+ playerInfo(":/ini/rbutil.ini", QSettings::IniFormat)
+{
+
+}
+
+void PlayerBuildInfo::setBuildInfo(QString file)
+{
+ if (serverInfo)
+ delete serverInfo;
+ LOG_INFO() << "updated:" << file;
+ serverInfo = new QSettings(file, QSettings::IniFormat);
+}
+
+QVariant PlayerBuildInfo::value(BuildInfo item, BuildType type)
+{
+ // locate setting item in server info file
+ int i = 0;
+ while(ServerInfoList[i].item != item)
+ i++;
+
+ // split of variant for target.
+ // we can have an optional variant part in the target string.
+ // For build info we don't use that.
+ QString target = RbSettings::value(RbSettings::CurrentPlatform).toString().split('.').at(0);
+
+ QString s = ServerInfoList[i].name;
+ s.replace(":target:", target);
+ QString v;
+ switch(type) {
+ case TypeRelease:
+ v = "release";
+ break;
+ case TypeCandidate:
+ v = "release-candidate";
+ break;
+ case TypeDaily:
+ v = "daily";
+ break;
+ case TypeDevel:
+ v = "development";
+ break;
+ }
+
+ QVariant result = QString();
+ if (!serverInfo)
+ return result;
+ QStringList version = serverInfo->value(v + "/" + target, "").toStringList();
+ s.replace(":build:", v);
+ s.replace(":version:", version.at(0));
+
+ // get value from server build-info
+ // we need to get a version string, otherwise the data is invalid.
+ // For invalid data return an empty string.
+ if(version.at(0).isEmpty()) {
+ LOG_INFO() << s << "(version invalid)";
+ return result;
+ }
+ if(!s.isEmpty())
+ result = serverInfo->value(s);
+
+ // depending on the actual value we need more replacements.
+ switch(item) {
+ case BuildVersion:
+ result = result.toStringList().at(0);
+ break;
+
+ case BuildUrl:
+ if(version.size() > 1) {
+ // version info has an URL appended. Takes precendence.
+ result = version.at(1);
+ }
+ break;
+
+ case BuildVoiceLangs:
+ if (type == TypeDaily)
+ s = "voices/daily";
+ result = serverInfo->value(s);
+ break;
+
+ case BuildManualUrl:
+ {
+ // special case: if playerInfo has a non-empty manualname entry for the
+ // target, use that as target for the manual name.
+ QString manualtarget = playerInfo.value(target + "/manualname", "").toString();
+ if(!manualtarget.isEmpty())
+ target = manualtarget;
+ break;
+ }
+
+ default:
+ break;
+ }
+ // if the value is a string we can replace some patterns.
+ // if we cannot convert it (f.e. for a QStringList) we leave as-is, since
+ // the conversion would return an empty type.
+ if (result.canConvert(QMetaType::QString))
+ result = result.toString()
+ .replace("%TARGET%", target)
+ .replace("%VERSION%", version.at(0));
+
+ LOG_INFO() << "B:" << s << result;
+ return result;
+}
+
+QVariant PlayerBuildInfo::value(DeviceInfo item, QString target)
+{
+ // locate setting item in server info file
+ int i = 0;
+ while(PlayerInfoList[i].item != item)
+ i++;
+
+ // split of variant for target.
+ // we can have an optional variant part in the target string.
+ // For device info we use this.
+ if (target.isEmpty())
+ target = RbSettings::value(RbSettings::CurrentPlatform).toString();
+
+ QVariant result = QString();
+
+ QString s = PlayerInfoList[i].name;
+ s.replace(":target:", target);
+
+ switch(item) {
+ case BuildStatus:
+ {
+ // build status is the only value that doesn't depend on the version
+ // but the selected target instead.
+ bool ok = false;
+ if (serverInfo)
+ result = serverInfo->value(s).toInt(&ok);
+ if (!ok)
+ result = -1;
+ break;
+ }
+
+ default:
+ result = playerInfo.value(s);
+ break;
+ }
+
+ LOG_INFO() << "T:" << s << result;
+ return result;
+}
+
+QVariant PlayerBuildInfo::value(SystemUrl item)
+{
+ // locate setting item in server info file
+ int i = 0;
+ while(PlayerSystemUrls[i].item != item)
+ i++;
+
+ QVariant result = playerInfo.value(PlayerSystemUrls[i].name);
+ LOG_INFO() << "U:" << PlayerSystemUrls[i].name << result;
+ return result;
+}
+
+
+QString PlayerBuildInfo::statusAsString(QString platform)
+{
+ QString result;
+ switch(value(BuildStatus, platform).toInt())
+ {
+ case STATUS_RETIRED:
+ result = tr("Stable (Retired)");
+ break;
+ case STATUS_UNUSABLE:
+ result = tr("Unusable");
+ break;
+ case STATUS_UNSTABLE:
+ result = tr("Unstable");
+ break;
+ case STATUS_STABLE:
+ result = tr("Stable");
+ break;
+ default:
+ result = tr("Unknown");
+ break;
+ }
+
+ return result;
+}
diff --git a/rbutil/rbutilqt/base/playerbuildinfo.h b/rbutil/rbutilqt/base/playerbuildinfo.h
new file mode 100644
index 0000000000..81d7d97312
--- /dev/null
+++ b/rbutil/rbutilqt/base/playerbuildinfo.h
@@ -0,0 +1,106 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2020 by Dominik Riebeling
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef PLAYERBUILDINFO_H
+#define PLAYERBUILDINFO_H
+
+#include <QSettings>
+
+#define STATUS_RETIRED 0
+#define STATUS_UNUSABLE 1
+#define STATUS_UNSTABLE 2
+#define STATUS_STABLE 3
+
+// Provide information about both player and builds.
+// For build info data retrieved from the build server has to be passed.
+class PlayerBuildInfo : public QObject
+{
+public:
+
+ enum BuildType {
+ TypeRelease,
+ TypeCandidate,
+ TypeDaily,
+ TypeDevel,
+ };
+ enum BuildInfo {
+ BuildUrl,
+ BuildVersion,
+ BuildManualUrl,
+ BuildVoiceUrl,
+ BuildVoiceLangs,
+ BuildSourceUrl,
+ BuildFontUrl,
+
+ DoomUrl,
+ Duke3DUrl,
+ PuzzFontsUrl,
+ QuakeUrl,
+ Wolf3DUrl,
+ XWorldUrl,
+ MidiPatchsetUrl,
+ };
+ enum DeviceInfo {
+ BuildStatus,
+
+ DisplayName,
+ BootloaderMethod,
+ BootloaderName,
+ BootloaderFile,
+ BootloaderFilter,
+ Encoder,
+ Brand,
+ PlayerPicture,
+ };
+
+ enum SystemUrl {
+ BootloaderUrl,
+ BuildInfoUrl,
+ GenlangUrl,
+ ThemesUrl,
+ ThemesInfoUrl,
+ RbutilUrl,
+ };
+
+ static PlayerBuildInfo* instance();
+
+ //! Update with build information from server
+ void setBuildInfo(QString file);
+
+ // Get information about a device. This data does not depend on the build type.
+ QVariant value(DeviceInfo item, QString target = "");
+
+ // Get build information for currently selected player.
+ QVariant value(BuildInfo item, BuildType type);
+
+ // Get fixed download URL information
+ QVariant value(SystemUrl item);
+
+ QString statusAsString(QString target = "");
+
+protected:
+ explicit PlayerBuildInfo();
+
+private:
+ static PlayerBuildInfo* infoInstance;
+ QSettings* serverInfo;
+ QSettings playerInfo;
+
+};
+
+#endif
diff --git a/rbutil/rbutilqt/base/rbsettings.cpp b/rbutil/rbutilqt/base/rbsettings.cpp
index adb222f80e..47217a15fe 100644
--- a/rbutil/rbutilqt/base/rbsettings.cpp
+++ b/rbutil/rbutilqt/base/rbsettings.cpp
@@ -17,7 +17,7 @@
****************************************************************************/
#include "rbsettings.h"
-#include "systeminfo.h"
+#include "playerbuildinfo.h"
#include <QSettings>
#include "Logger.h"
@@ -196,7 +196,8 @@ QString RbSettings::constructSettingPath(QString path, QString substitute)
}
else {
path.replace(":tts:", userSettings->value("tts").toString());
- path.replace(":encoder:", SystemInfo::platformValue(SystemInfo::Encoder, platform).toString());
+ path.replace(":encoder:", PlayerBuildInfo::instance()->value(
+ PlayerBuildInfo::Encoder, platform).toString());
}
path.replace(":platform:", platform);
}
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp
deleted file mode 100644
index 5fee75f689..0000000000
--- a/rbutil/rbutilqt/base/serverinfo.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- *
- * Copyright (C) 2010 by Dominik Wenger
- *
- * 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"
-#include "Logger.h"
-
-ServerInfo* ServerInfo::infoInstance = nullptr;
-
-ServerInfo* ServerInfo::instance()
-{
- if (infoInstance == nullptr) {
- infoInstance = new ServerInfo();
- }
- return infoInstance;
-}
-
-// server infos
-const static struct {
- ServerInfo::ServerInfos info;
- const char* name;
- const char* def;
-} ServerInfoList[] = {
- { ServerInfo::CurReleaseVersion, "release/:platform:", "" },
- { ServerInfo::CurReleaseUrl, "release/:platform:", "" },
- { ServerInfo::RelCandidateVersion, "release-candidate/:platform:", "" },
- { ServerInfo::RelCandidateUrl, "release-candidate/:platform:", "" },
- { ServerInfo::DailyVersion, "daily/:platform:", "" },
- { ServerInfo::DailyUrl, "daily/:platform:", "" },
- { ServerInfo::CurStatus, "status/:platform:", "-1" },
- { ServerInfo::BleedingRevision, "bleeding/rev", "" },
- { ServerInfo::BleedingDate, "bleeding/timestamp", "" },
- { ServerInfo::CurDevelUrl, "", "" },
-};
-
-void ServerInfo::readBuildInfo(QString file)
-{
- if (serverSettings)
- delete serverSettings;
- serverSettings = new QSettings(file, QSettings::IniFormat);
-}
-
-
-QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform)
-{
- // locate setting item in server info file
- int i = 0;
- while(ServerInfoList[i].info != info)
- i++;
-
- // replace setting name
- if(platform.isEmpty())
- platform = RbSettings::value(RbSettings::CurrentPlatform).toString();
-
- // split of variant for platform.
- // we can have an optional variant part in the platform string.
- // For build info we don't use that.
- platform = platform.split('.').at(0);
-
- QString s = ServerInfoList[i].name;
- s.replace(":platform:", platform);
-
- // get value
- QVariant value = QString();
- if(!s.isEmpty() && serverSettings)
- value = serverSettings->value(s, ServerInfoList[i].def);
-
- // depending on the actual value we need more replacements.
- switch(info) {
- case CurReleaseVersion:
- case RelCandidateVersion:
- case DailyVersion:
- value = value.toStringList().at(0);
- break;
- case CurReleaseUrl:
- case RelCandidateUrl:
- case DailyUrl:
- {
- QString version = value.toStringList().at(0);
- if(value.toStringList().size() > 1)
- value = value.toStringList().at(1);
- else if(!version.isEmpty() && info == CurReleaseUrl)
- value = SystemInfo::value(SystemInfo::BuildUrl,
- SystemInfo::BuildRelease).toString()
- .replace("%MODEL%", platform)
- .replace("%RELVERSION%", version);
- else if(!version.isEmpty() && info == RelCandidateUrl)
- value = SystemInfo::value(SystemInfo::BuildUrl,
- SystemInfo::BuildCandidate).toString()
- .replace("%MODEL%", platform)
- .replace("%RELVERSION%", version);
- else if(!version.isEmpty() && info == DailyUrl)
- value = SystemInfo::value(SystemInfo::BuildUrl,
- SystemInfo::BuildDaily).toString()
- .replace("%MODEL%", platform)
- .replace("%RELVERSION%", version);
- }
- break;
- case CurDevelUrl:
- value = SystemInfo::value(SystemInfo::BuildUrl,
- SystemInfo::BuildCurrent).toString()
- .replace("%MODEL%", platform);
- break;
- case BleedingDate:
- // TODO: get rid of this, it's location specific.
- value = QDateTime::fromString(value.toString(),
- "yyyyMMddThhmmssZ").toString(Qt::ISODate);
- break;
-
- default:
- break;
- }
-
- LOG_INFO() << "Server:" << value;
- return value;
-}
-
-QString ServerInfo::statusAsString(QString platform)
-{
- QString value;
- switch(platformValue(CurStatus, platform).toInt())
- {
- case STATUS_RETIRED:
- value = tr("Stable (Retired)");
- break;
- case STATUS_UNUSABLE:
- value = tr("Unusable");
- break;
- case STATUS_UNSTABLE:
- value = tr("Unstable");
- break;
- case STATUS_STABLE:
- value = tr("Stable");
- break;
- default:
- value = tr("Unknown");
- break;
- }
-
- return value;
-}
diff --git a/rbutil/rbutilqt/base/serverinfo.h b/rbutil/rbutilqt/base/serverinfo.h
deleted file mode 100644
index 0746ec2c4f..0000000000
--- a/rbutil/rbutilqt/base/serverinfo.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- *
- * Copyright (C) 2010 by Dominik Wenger
- *
- * 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.
- *
- ****************************************************************************/
-
-// Parse and provide information from build server via build-info file.
-// This is a singleton.
-
-#ifndef SERVERINFO_H
-#define SERVERINFO_H
-
-#include <QtCore>
-#define STATUS_RETIRED 0
-#define STATUS_UNUSABLE 1
-#define STATUS_UNSTABLE 2
-#define STATUS_STABLE 3
-
-class ServerInfo : public QObject
-{
- Q_OBJECT
- public:
-
- //! All Server infos
- enum ServerInfos {
- CurReleaseVersion,
- CurStatus,
- CurReleaseUrl,
- CurDevelUrl,
- BleedingRevision,
- BleedingDate,
- RelCandidateVersion,
- RelCandidateUrl,
- DailyVersion,
- DailyUrl
- };
-
- static ServerInfo* instance();
-
- //! read in buildinfo file
- void readBuildInfo(QString file);
- //! get a value from server info for a named platform.
- QVariant platformValue(enum ServerInfos setting, QString platform = "");
- //! Get status number as string
- QString statusAsString(QString platform = "");
-
- protected:
- ServerInfo() : serverSettings(nullptr) {}
-
- private:
- static ServerInfo* infoInstance;
- QSettings* serverSettings;
-
-};
-
-#endif
-
diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp
index 8868ba937b..aa847540b9 100644
--- a/rbutil/rbutilqt/base/systeminfo.cpp
+++ b/rbutil/rbutilqt/base/systeminfo.cpp
@@ -23,44 +23,6 @@
#include "Logger.h"
// device settings
-const static struct {
- SystemInfo::SystemInfos info;
- const char* name;
-} SystemInfosList[] = {
- { SystemInfo::ManualUrl, ":build:/manual_url" },
- { SystemInfo::BuildUrl, ":build:/build_url" },
- { SystemInfo::FontUrl, ":build:/font_url" },
- { SystemInfo::VoiceUrl, ":build:/voice_url" },
- { SystemInfo::BootloaderUrl, "bootloader/download_url" },
- { SystemInfo::BootloaderInfoUrl, "bootloader/info_url" },
- { SystemInfo::DoomUrl, "doom_url" },
- { SystemInfo::Duke3DUrl, "duke3d_url" },
- { SystemInfo::PuzzFontsUrl, "puzzfonts_url" },
- { SystemInfo::QuakeUrl, "quake_url" },
- { SystemInfo::Wolf3DUrl, "wolf3d_url" },
- { SystemInfo::XWorldUrl, "xworld_url" },
- { SystemInfo::BuildInfoUrl, "build_info_url" },
- { SystemInfo::GenlangUrl, "genlang_url" },
- { SystemInfo::ThemesUrl, "themes_url" },
- { SystemInfo::ThemesInfoUrl, "themes_info_url" },
- { SystemInfo::RbutilUrl, "rbutil_url" },
-};
-
-const static struct {
- SystemInfo::PlatformInfo info;
- const char* name;
- const char* def;
-} PlatformInfosList[] = {
- { SystemInfo::Manual, ":platform:/manualname", ":platform:" },
- { SystemInfo::BootloaderMethod, ":platform:/bootloadermethod", "none" },
- { SystemInfo::BootloaderName, ":platform:/bootloadername", "" },
- { SystemInfo::BootloaderFile, ":platform:/bootloaderfile", "" },
- { SystemInfo::BootloaderFilter, ":platform:/bootloaderfilter", "" },
- { SystemInfo::Encoder, ":platform:/encoder", "" },
- { SystemInfo::Brand, ":platform:/brand", "" },
- { SystemInfo::Name, ":platform:/name", "" },
- { SystemInfo::PlayerPicture, ":platform:/playerpic", "" },
-};
//! pointer to setting object to nullptr
QSettings* SystemInfo::systemInfos = nullptr;
@@ -76,53 +38,6 @@ void SystemInfo::ensureSystemInfoExists()
}
-QVariant SystemInfo::value(enum SystemInfos info, BuildType type)
-{
- ensureSystemInfoExists();
-
- // locate setting item
- int i = 0;
- while(SystemInfosList[i].info != info)
- i++;
- QString s = SystemInfosList[i].name;
- switch(type) {
- case BuildDaily:
- s.replace(":build:", "daily");
- break;
- case BuildCurrent:
- s.replace(":build:", "development");
- break;
- case BuildCandidate:
- s.replace(":build:", "release-candidate");
- break;
- case BuildRelease:
- s.replace(":build:", "release");
- break;
- }
- LOG_INFO() << "GET:" << s << systemInfos->value(s).toString();
- return systemInfos->value(s);
-}
-
-QVariant SystemInfo::platformValue(enum PlatformInfo info, QString platform)
-{
- ensureSystemInfoExists();
-
- // locate setting item
- int i = 0;
- while(PlatformInfosList[i].info != info)
- i++;
-
- if (platform.isEmpty())
- platform = RbSettings::value(RbSettings::CurrentPlatform).toString();
-
- QString s = PlatformInfosList[i].name;
- s.replace(":platform:", platform);
- QString d = PlatformInfosList[i].def;
- d.replace(":platform:", platform);
- LOG_INFO() << "GET P:" << s << systemInfos->value(s, d).toString();
- return systemInfos->value(s, d);
-}
-
QStringList SystemInfo::platforms(enum SystemInfo::PlatformType type, QString variant)
{
ensureSystemInfoExists();
diff --git a/rbutil/rbutilqt/base/systeminfo.h b/rbutil/rbutilqt/base/systeminfo.h
index 67863c2268..7b5b68131b 100644
--- a/rbutil/rbutilqt/base/systeminfo.h
+++ b/rbutil/rbutilqt/base/systeminfo.h
@@ -34,47 +34,6 @@ class SystemInfo : public QObject
MapIncompatible,
};
- enum BuildType {
- BuildCurrent,
- BuildDaily,
- BuildRelease,
- BuildCandidate
- };
-
- //! All system settings
- enum SystemInfos {
- BuildUrl,
- FontUrl,
- VoiceUrl,
- ManualUrl,
- BootloaderUrl,
- BootloaderInfoUrl,
- DoomUrl,
- Duke3DUrl,
- QuakeUrl,
- PuzzFontsUrl,
- Wolf3DUrl,
- XWorldUrl,
- ReleaseUrl,
- BuildInfoUrl,
- GenlangUrl,
- ThemesUrl,
- ThemesInfoUrl,
- RbutilUrl,
- };
-
- enum PlatformInfo {
- Manual,
- BootloaderMethod,
- BootloaderName,
- BootloaderFile,
- BootloaderFilter,
- Encoder,
- Brand,
- Name,
- PlayerPicture,
- };
-
enum PlatformType {
PlatformAll,
PlatformAllDisabled,
@@ -93,9 +52,6 @@ class SystemInfo : public QObject
//! returns a map of usb-ids and their targets
static QMap<int, QStringList> usbIdMap(enum MapType type);
//! get a value from system settings
- static QVariant value(enum SystemInfos info, BuildType type = BuildCurrent);
- //! get a value from system settings for a named platform.
- static QVariant platformValue(enum PlatformInfo info, QString platform = "");
private:
//! you shouldnt call this, its a fully static calls
diff --git a/rbutil/rbutilqt/base/talkgenerator.cpp b/rbutil/rbutilqt/base/talkgenerator.cpp
index 951bf0e804..9139ceb274 100644
--- a/rbutil/rbutilqt/base/talkgenerator.cpp
+++ b/rbutil/rbutilqt/base/talkgenerator.cpp
@@ -18,7 +18,7 @@
#include "talkgenerator.h"
#include "rbsettings.h"
-#include "systeminfo.h"
+#include "playerbuildinfo.h"
#include "wavtrim.h"
#include "Logger.h"
@@ -56,8 +56,8 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt
// Encoder
emit logItem(tr("Starting Encoder Engine"),LOGINFO);
- m_enc = EncoderBase::getEncoder(
- this, SystemInfo::platformValue(SystemInfo::Encoder).toString());
+ m_enc = EncoderBase::getEncoder(this, PlayerBuildInfo::instance()->value(
+ PlayerBuildInfo::Encoder).toString());
if(!m_enc->start())
{
emit logItem(tr("Init of Encoder engine failed"),LOGERROR);
@@ -156,7 +156,8 @@ TalkGenerator::Status TalkGenerator::voiceList(QList<TalkEntry>* list,int wavtri
QString error;
LOG_INFO() << "voicing: " << list->at(i).toSpeak
<< "to" << list->at(i).wavfilename;
- TTSStatus status = m_tts->voice(list->at(i).toSpeak,list->at(i).wavfilename, &error);
+ TTSStatus status = m_tts->voice(list->at(i).toSpeak,
+ list->at(i).wavfilename, &error);
if(status == Warning)
{
warnings = true;
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 2f01f42e2c..3ab8aa6906 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -20,7 +20,7 @@
#include "rockboxinfo.h"
#include "system.h"
#include "rbsettings.h"
-#include "systeminfo.h"
+#include "playerbuildinfo.h"
#include "Logger.h"
#if !defined(_UNICODE)
@@ -385,8 +385,10 @@ QString Utils::checkEnvironment(bool permission)
{
text += tr("<li>Target mismatch detected.<br/>"
"Installed target: %1<br/>Selected target: %2.</li>")
- .arg(SystemInfo::platformValue(SystemInfo::Name, installed).toString(),
- SystemInfo::platformValue(SystemInfo::Name).toString());
+ .arg(PlayerBuildInfo::instance()->value(
+ PlayerBuildInfo::DisplayName, installed).toString(),
+ PlayerBuildInfo::instance()->value(
+ PlayerBuildInfo::DisplayName).toString());
}
if(!text.isEmpty())
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp
index c4edac64b9..98ab96b8ab 100644
--- a/rbutil/rbutilqt/base/voicefile.cpp
+++ b/rbutil/rbutilqt/base/voicefile.cpp
@@ -21,7 +21,7 @@
#include "utils.h"
#include "rockboxinfo.h"
#include "rbsettings.h"
-#include "systeminfo.h"
+#include "playerbuildinfo.h"
#include "ziputil.h"
#include "Logger.h"
@@ -148,7 +148,8 @@ bool VoiceFileCreator::createVoiceFile()
// genlang output as previously from the webserver.
// prepare download url
- QString genlang = SystemInfo::value(SystemInfo::GenlangUrl).toString();
+ QString genlang = PlayerBuildInfo::instance()->value(
+ PlayerBuildInfo::GenlangUrl).toString();
genlang.replace("%LANG%", m_lang);
genlang.replace("%TARGET%", target);
genlang.replace("%REVISION%", version);