1
0
Fork 0
forked from len0rd/rockbox

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())

View file

@ -356,7 +356,7 @@ void Config::setDevices()
for(int it = 0; it < platformList.size(); it++)
{
QString curbrand = SystemInfo::platformValue(
SystemInfo::CurBrand, platformList.at(it)).toString();
SystemInfo::Brand, platformList.at(it)).toString();
manuf.insert(curbrand, platformList.at(it));
}
@ -385,7 +385,7 @@ void Config::setDevices()
continue;
// construct display name
QString curname = SystemInfo::platformValue(
SystemInfo::CurName, platformList.at(it)).toString() +
SystemInfo::Name, platformList.at(it)).toString() +
" (" +ServerInfo::platformValue(
ServerInfo::CurStatus, platformList.at(it)).toString() +")";
LOG_INFO() << "add supported device:" << brands.at(c) << curname;
@ -472,9 +472,9 @@ void Config::updateEncState()
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
QString encoder = SystemInfo::platformValue(
SystemInfo::CurEncoder, devname).toString();
SystemInfo::Encoder, devname).toString();
ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(
SystemInfo::CurEncoder, devname).toString()));
SystemInfo::Encoder, devname).toString()));
EncoderBase* enc = EncoderBase::getEncoder(this,encoder);
@ -743,7 +743,7 @@ void Config::autodetect()
}
msg += QString("<li>%1</li>").arg(tr("%1 at %2").arg(
SystemInfo::platformValue(
SystemInfo::CurPlatformName, detected.at(i).device).toString(),
SystemInfo::PlatformName, detected.at(i).device).toString(),
QDir::toNativeSeparators(mp)));
}
msg += "</ul>";
@ -769,21 +769,21 @@ void Config::autodetect()
msg += tr("Detected an unsupported player:\n%1\n"
"Sorry, Rockbox doesn't run on your player.")
.arg(SystemInfo::platformValue(
SystemInfo::CurName, detected.at(0).device).toString());
SystemInfo::Name, detected.at(0).device).toString());
break;
case Autodetection::PlayerMtpMode:
msg = tr("%1 in MTP mode found!\n"
"You need to change your player to MSC mode for installation. ")
.arg(SystemInfo::platformValue(
SystemInfo::CurName, detected.at(0).device).toString());
SystemInfo::Name, detected.at(0).device).toString());
break;
case Autodetection::PlayerWrongFilesystem:
if(SystemInfo::platformValue(
SystemInfo::CurBootloaderMethod, detected.at(0).device) == "ipod") {
SystemInfo::BootloaderMethod, detected.at(0).device) == "ipod") {
msg = tr("%1 \"MacPod\" found!\n"
"Rockbox needs a FAT formatted Ipod (so-called \"WinPod\") "
"to run. ").arg(SystemInfo::platformValue(
SystemInfo::CurName, detected.at(0).device).toString());
SystemInfo::Name, detected.at(0).device).toString());
}
else {
msg = tr("The player contains an incompatible filesystem.\n"
@ -963,9 +963,9 @@ void Config::configEnc()
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
QString encoder = SystemInfo::platformValue(
SystemInfo::CurEncoder, devname).toString();
SystemInfo::Encoder, devname).toString();
ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(
SystemInfo::CurEncoder, devname).toString()));
SystemInfo::Encoder, devname).toString()));
EncoderBase* enc = EncoderBase::getEncoder(this,encoder);

View file

@ -65,9 +65,9 @@ void ManualWidget::downloadManual(void)
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
return;
}
QString manual = SystemInfo::platformValue(SystemInfo::CurManual).toString();
QString manual = SystemInfo::platformValue(SystemInfo::Manual).toString();
if(manual.isEmpty()) {
manual = "rockbox-" + SystemInfo::platformValue(SystemInfo::CurBuildserverModel).toString();
manual = "rockbox-" + SystemInfo::platformValue(SystemInfo::BuildserverModel).toString();
}
ProgressLoggerGui* logger = new ProgressLoggerGui(this);

View file

@ -82,7 +82,7 @@ void SelectiveInstallWidget::updateVersion(void)
m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
m_target = RbSettings::value(RbSettings::CurrentPlatform).toString();
m_blmethod = SystemInfo::platformValue(
SystemInfo::CurBootloaderMethod, m_target).toString();
SystemInfo::BootloaderMethod, m_target).toString();
if(m_logger != NULL) {
delete m_logger;
@ -237,7 +237,7 @@ void SelectiveInstallWidget::installBootloader(void)
// create installer
BootloaderInstallBase *bl =
BootloaderInstallHelper::createBootloaderInstaller(this,
SystemInfo::platformValue(SystemInfo::CurBootloaderMethod).toString());
SystemInfo::platformValue(SystemInfo::BootloaderMethod).toString());
if(bl == NULL) {
m_logger->addItem(tr("No install method known."), LOGERROR);
m_logger->setFinished();
@ -254,7 +254,7 @@ void SelectiveInstallWidget::installBootloader(void)
connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted()));
// set bootloader filename. Do this now as installed() needs it.
QStringList blfile = SystemInfo::platformValue(SystemInfo::CurBootloaderFile).toStringList();
QStringList blfile = SystemInfo::platformValue(SystemInfo::BootloaderFile).toStringList();
QStringList blfilepath;
for(int a = 0; a < blfile.size(); a++) {
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
@ -262,7 +262,7 @@ void SelectiveInstallWidget::installBootloader(void)
}
bl->setBlFile(blfilepath);
QUrl url(SystemInfo::value(SystemInfo::BootloaderUrl).toString()
+ SystemInfo::platformValue(SystemInfo::CurBootloaderName).toString());
+ SystemInfo::platformValue(SystemInfo::BootloaderName).toString());
bl->setBlUrl(url);
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.rockbox/rbutil.log");
@ -282,7 +282,7 @@ void SelectiveInstallWidget::installBootloader(void)
else if(bl->installed() == BootloaderInstallBase::BootloaderOther
&& bl->capabilities() & BootloaderInstallBase::Backup)
{
QString targetFolder = SystemInfo::platformValue(SystemInfo::CurPlatformName).toString()
QString targetFolder = SystemInfo::platformValue(SystemInfo::PlatformName).toString()
+ " Firmware Backup";
// remove invalid character(s)
targetFolder.remove(QRegExp("[:/]"));
@ -319,7 +319,7 @@ void SelectiveInstallWidget::installBootloader(void)
// open dialog to browse to of file
QString offile;
QString filter
= SystemInfo::platformValue(SystemInfo::CurBootloaderFilter).toString();
= SystemInfo::platformValue(SystemInfo::BootloaderFilter).toString();
if(!filter.isEmpty()) {
filter = tr("Bootloader files (%1)").arg(filter) + ";;";
}

View file

@ -390,11 +390,11 @@ void RbUtilQt::updateDevice()
/* Enable bootloader installation, if possible */
bool bootloaderInstallable =
SystemInfo::platformValue(SystemInfo::CurBootloaderMethod) != "none";
SystemInfo::platformValue(SystemInfo::BootloaderMethod) != "none";
/* Enable bootloader uninstallation, if possible */
bool bootloaderUninstallable = bootloaderInstallable &&
SystemInfo::platformValue(SystemInfo::CurBootloaderMethod) != "fwpatcher";
SystemInfo::platformValue(SystemInfo::BootloaderMethod) != "fwpatcher";
ui.labelRemoveBootloader->setEnabled(bootloaderUninstallable);
ui.buttonRemoveBootloader->setEnabled(bootloaderUninstallable);
ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
@ -405,9 +405,9 @@ void RbUtilQt::updateDevice()
ui.menuA_ctions->setEnabled(configurationValid);
// displayed device info
QString brand = SystemInfo::platformValue(SystemInfo::CurBrand).toString();
QString brand = SystemInfo::platformValue(SystemInfo::Brand).toString();
QString name
= QString("%1 (%2)").arg(SystemInfo::platformValue(SystemInfo::CurName).toString(),
= QString("%1 (%2)").arg(SystemInfo::platformValue(SystemInfo::Name).toString(),
ServerInfo::platformValue(ServerInfo::CurStatus).toString());
ui.labelDevice->setText(QString("<b>%1 %2</b>").arg(brand, name));
@ -423,7 +423,7 @@ void RbUtilQt::updateDevice()
}
QPixmap pm;
QString m = SystemInfo::platformValue(SystemInfo::CurPlayerPicture).toString();
QString m = SystemInfo::platformValue(SystemInfo::PlayerPicture).toString();
pm.load(":/icons/players/" + m + "-small.png");
pm = pm.scaledToHeight(QFontMetrics(QApplication::font()).height() * 3);
ui.labelPlayerPic->setPixmap(pm);
@ -491,7 +491,7 @@ void RbUtilQt::installVoice()
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return;
QString model = SystemInfo::platformValue(SystemInfo::CurBuildserverModel).toString();
QString model = SystemInfo::platformValue(SystemInfo::BuildserverModel).toString();
// replace placeholder in voice url
voiceurl.replace("%MODEL%", model);
voiceurl.replace("%RELVERSION%", relversion);
@ -560,14 +560,14 @@ void RbUtilQt::uninstallBootloader(void)
// create installer
BootloaderInstallBase *bl
= BootloaderInstallHelper::createBootloaderInstaller(this,
SystemInfo::platformValue(SystemInfo::CurBootloaderMethod).toString());
SystemInfo::platformValue(SystemInfo::BootloaderMethod).toString());
if(bl == NULL) {
logger->addItem(tr("No uninstall method for this target known."), LOGERROR);
logger->setFinished();
return;
}
QStringList blfile = SystemInfo::platformValue(SystemInfo::CurBootloaderFile).toStringList();
QStringList blfile = SystemInfo::platformValue(SystemInfo::BootloaderFile).toStringList();
QStringList blfilepath;
for(int a = 0; a < blfile.size(); a++) {
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()

View file

@ -86,7 +86,7 @@ void ThemesInstallWindow::downloadInfo()
QString infoUrl = SystemInfo::value(SystemInfo::ThemesInfoUrl).toString();
infoUrl.replace("%TARGET%",
SystemInfo::platformValue(SystemInfo::CurConfigureModel).toString());
SystemInfo::platformValue(SystemInfo::ConfigureModel).toString());
infoUrl.replace("%REVISION%", installInfo.revision());
infoUrl.replace("%RELEASE%", installInfo.release());
infoUrl.replace("%RBUTILVER%", VERSION);