rbutil: Rework player configuration.

Rename config entries and remove now unnecessary default value handling.

Change-Id: I5c60ef9769fc01f45f45290dafffb80c1962e674
This commit is contained in:
Dominik Riebeling 2020-11-14 16:33:48 +01:00
parent 2509def164
commit be1be797b2
14 changed files with 84 additions and 88 deletions

View file

@ -108,7 +108,7 @@ 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::CurName, idstring).toString().isEmpty()) {
if(!SystemInfo::platformValue(SystemInfo::Name, idstring).toString().isEmpty()) {
struct Detected d;
d.status = PlayerIncompatible;
d.device = idstring;

View file

@ -409,7 +409,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallS5l::installed(void)
+ "/.rockbox/rbutil.log";
QSettings s(logfile, QSettings::IniFormat, this);
QString section = SystemInfo::platformValue(
SystemInfo::CurBootloaderName).toString().section('/', -1);
SystemInfo::BootloaderName).toString().section('/', -1);
rbblInstalled = s.contains("Bootloader/" + section);
if (rbblInstalled) {

View file

@ -194,7 +194,7 @@ QString RbSettings::constructSettingPath(QString path, QString substitute)
}
else {
path.replace(":tts:", userSettings->value("tts").toString());
path.replace(":encoder:", SystemInfo::platformValue(SystemInfo::CurEncoder, platform).toString());
path.replace(":encoder:", SystemInfo::platformValue(SystemInfo::Encoder, platform).toString());
}
path.replace(":platform:", platform);
}

View file

@ -136,9 +136,9 @@ void ServerInfo::readBuildInfo(QString file)
QString manualZipUrl = manualBaseUrl;
QString buildservermodel = SystemInfo::platformValue(
SystemInfo::CurBuildserverModel, platforms.at(i)).toString();
SystemInfo::BuildserverModel, platforms.at(i)).toString();
QString modelman = SystemInfo::platformValue(
SystemInfo::CurManual, platforms.at(i)).toString();
SystemInfo::Manual, platforms.at(i)).toString();
QString manualBaseName = "rockbox-";
if(modelman.isEmpty()) manualBaseName += buildservermodel;

View file

@ -49,8 +49,6 @@ class ServerInfo : public QObject
static QVariant platformValue(enum ServerInfos setting, QString platform = "");
private:
//! 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(enum ServerInfos setting, QString platform, QVariant value);
//! you shouldnt call this, its a fully static class

View file

@ -26,29 +26,28 @@
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::ReleaseFontUrl, "release_font_url", "" },
{ SystemInfo::DailyFontUrl, "daily_font_url", "" },
{ SystemInfo::DailyVoiceUrl, "daily_voice_url", "" },
{ SystemInfo::ReleaseVoiceUrl, "release_voice_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::ReleaseUrl, "release_url", "" },
{ SystemInfo::DailyUrl, "daily_url", "" },
{ SystemInfo::BuildInfoUrl, "build_info_url", "" },
{ SystemInfo::GenlangUrl, "genlang_url", "" },
{ SystemInfo::ThemesUrl, "themes_url", "" },
{ SystemInfo::ThemesInfoUrl, "themes_info_url", "" },
{ SystemInfo::RbutilUrl, "rbutil_url", "" },
{ SystemInfo::ManualUrl, "manual_url" },
{ SystemInfo::BleedingUrl, "bleeding_url" },
{ SystemInfo::BootloaderUrl, "bootloader_url" },
{ SystemInfo::BootloaderInfoUrl, "bootloader_info_url" },
{ SystemInfo::ReleaseFontUrl, "release_font_url" },
{ SystemInfo::DailyFontUrl, "daily_font_url" },
{ SystemInfo::DailyVoiceUrl, "daily_voice_url" },
{ SystemInfo::ReleaseVoiceUrl, "release_voice_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::ReleaseUrl, "release_url" },
{ SystemInfo::DailyUrl, "daily_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 {
@ -56,18 +55,18 @@ const static struct {
const char* name;
const char* def;
} PlatformInfosList[] = {
{ SystemInfo::CurPlatformName, ":platform:/name", "" },
{ SystemInfo::CurManual, ":platform:/manualname","rockbox-:platform:" },
{ SystemInfo::CurBootloaderMethod, ":platform:/bootloadermethod", "none" },
{ SystemInfo::CurBootloaderName, ":platform:/bootloadername", "" },
{ SystemInfo::CurBootloaderFile, ":platform:/bootloaderfile", "" },
{ SystemInfo::CurBootloaderFilter, ":platform:/bootloaderfilter", "" },
{ SystemInfo::CurEncoder, ":platform:/encoder", "" },
{ SystemInfo::CurBrand, ":platform:/brand", "" },
{ SystemInfo::CurName, ":platform:/name", "" },
{ SystemInfo::CurBuildserverModel, ":platform:/buildserver_modelname", "" },
{ SystemInfo::CurConfigureModel, ":platform:/configure_modelname", "" },
{ SystemInfo::CurPlayerPicture, ":platform:/playerpic", "" },
{ SystemInfo::PlatformName, ":platform:/name", "" },
{ SystemInfo::Manual, ":platform:/manualname","rockbox-: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::BuildserverModel, ":platform:/buildserver_modelname", "" },
{ SystemInfo::ConfigureModel, ":platform:/configure_modelname", "" },
{ SystemInfo::PlayerPicture, ":platform:/playerpic", "" },
};
//! pointer to setting object to NULL
@ -93,9 +92,8 @@ QVariant SystemInfo::value(enum SystemInfos info)
while(SystemInfosList[i].info != info)
i++;
QString s = SystemInfosList[i].name;
QString d = SystemInfosList[i].def;
LOG_INFO() << "GET:" << s << systemInfos->value(s, d).toString();
return systemInfos->value(s, d);
LOG_INFO() << "GET:" << s << systemInfos->value(s).toString();
return systemInfos->value(s);
}
QVariant SystemInfo::platformValue(enum PlatformInfo info, QString platform)

View file

@ -60,18 +60,18 @@ class SystemInfo : public QObject
};
enum PlatformInfo {
CurPlatformName,
CurManual,
CurBootloaderMethod,
CurBootloaderName,
CurBootloaderFile,
CurBootloaderFilter,
CurEncoder,
CurBrand,
CurName,
CurBuildserverModel,
CurConfigureModel,
CurPlayerPicture,
PlatformName,
Manual,
BootloaderMethod,
BootloaderName,
BootloaderFile,
BootloaderFilter,
Encoder,
Brand,
Name,
BuildserverModel,
ConfigureModel,
PlayerPicture,
};
enum PlatformType {

View file

@ -57,7 +57,7 @@ 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::CurEncoder).toString());
this, SystemInfo::platformValue(SystemInfo::Encoder).toString());
if(!m_enc->start())
{
emit logItem(tr("Init of Encoder engine failed"),LOGERROR);

View file

@ -381,12 +381,12 @@ QString Utils::checkEnvironment(bool permission)
RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString());
QString installed = rbinfo.target();
if(!installed.isEmpty() && installed !=
SystemInfo::platformValue(SystemInfo::CurConfigureModel).toString())
SystemInfo::platformValue(SystemInfo::ConfigureModel).toString())
{
text += tr("<li>Target mismatch detected.<br/>"
"Installed target: %1<br/>Selected target: %2.</li>")
.arg(SystemInfo::platformValue(SystemInfo::CurPlatformName, installed).toString(),
SystemInfo::platformValue(SystemInfo::CurPlatformName).toString());
.arg(SystemInfo::platformValue(SystemInfo::PlatformName, installed).toString(),
SystemInfo::platformValue(SystemInfo::PlatformName).toString());
}
if(!text.isEmpty())