1
0
Fork 0
forked from len0rd/rockbox

rbutil: Rework player configuration.

- Split internal configuration into player specific and common parts.
  Always require passing the player for player specific data instead of
  implicitly assuming the currently selected one; only use the currently
  selected one if the player name is explicitly passed as empty.
- Similarly adjust handling of server info data; prepare for splitting
  into build type specific values so the naming becomes cleaner.

Change-Id: I894e694f83bd9fe2d22ad46b3f8f7df3e2c68033
This commit is contained in:
Dominik Riebeling 2020-11-14 16:23:56 +01:00
parent 440083af87
commit 2509def164
14 changed files with 107 additions and 114 deletions

View file

@ -108,7 +108,7 @@ void Autodetection::detectUsb()
LOG_WARNING() << "[USB] detected problem with player" << d.device; LOG_WARNING() << "[USB] detected problem with player" << d.device;
} }
QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0')); QString idstring = QString("%1").arg(attached.at(i), 8, 16, QChar('0'));
if(!SystemInfo::platformValue(idstring, SystemInfo::CurName).toString().isEmpty()) { if(!SystemInfo::platformValue(SystemInfo::CurName, idstring).toString().isEmpty()) {
struct Detected d; struct Detected d;
d.status = PlayerIncompatible; d.status = PlayerIncompatible;
d.device = idstring; d.device = idstring;

View file

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

View file

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

View file

@ -51,9 +51,9 @@ void ServerInfo::readBuildInfo(QString file)
QSettings info(file, QSettings::IniFormat); QSettings info(file, QSettings::IniFormat);
QString developmentRevision = info.value("bleeding/rev").toString(); QString developmentRevision = info.value("bleeding/rev").toString();
setValue(ServerInfo::BleedingRevision, developmentRevision); setPlatformValue(ServerInfo::BleedingRevision, "", developmentRevision);
QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ"); QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ");
setValue(ServerInfo::BleedingDate, date.toString(Qt::ISODate)); setPlatformValue(ServerInfo::BleedingDate, "", date.toString(Qt::ISODate));
info.beginGroup("release"); info.beginGroup("release");
QStringList releasekeys = info.allKeys(); QStringList releasekeys = info.allKeys();
@ -135,10 +135,10 @@ void ServerInfo::readBuildInfo(QString file)
QString manualHtmlUrl = manualBaseUrl; QString manualHtmlUrl = manualBaseUrl;
QString manualZipUrl = manualBaseUrl; QString manualZipUrl = manualBaseUrl;
QString buildservermodel = SystemInfo::platformValue(platforms.at(i), QString buildservermodel = SystemInfo::platformValue(
SystemInfo::CurBuildserverModel).toString(); SystemInfo::CurBuildserverModel, platforms.at(i)).toString();
QString modelman = SystemInfo::platformValue(platforms.at(i), QString modelman = SystemInfo::platformValue(
SystemInfo::CurManual).toString(); SystemInfo::CurManual, platforms.at(i)).toString();
QString manualBaseName = "rockbox-"; QString manualBaseName = "rockbox-";
if(modelman.isEmpty()) manualBaseName += buildservermodel; if(modelman.isEmpty()) manualBaseName += buildservermodel;
@ -153,45 +153,26 @@ void ServerInfo::readBuildInfo(QString file)
// set variants (if any) // set variants (if any)
for(int j = 0; j < variants.size(); ++j) { for(int j = 0; j < variants.size(); ++j) {
setPlatformValue(variants.at(j), ServerInfo::CurStatus, status); setPlatformValue(ServerInfo::CurStatus, variants.at(j), status);
if(!releaseUrl.isEmpty()) { if(!releaseUrl.isEmpty()) {
setPlatformValue(variants.at(j), ServerInfo::CurReleaseVersion, releaseVersion); setPlatformValue(ServerInfo::CurReleaseVersion, variants.at(j), releaseVersion);
setPlatformValue(variants.at(j), ServerInfo::CurReleaseUrl, releaseUrl); setPlatformValue(ServerInfo::CurReleaseUrl, variants.at(j), releaseUrl);
} }
if(!relCandidateUrl.isEmpty()) { if(!relCandidateUrl.isEmpty()) {
setPlatformValue(variants.at(j), ServerInfo::RelCandidateVersion, relCandidateVersion); setPlatformValue(ServerInfo::RelCandidateVersion, variants.at(j), relCandidateVersion);
setPlatformValue(variants.at(j), ServerInfo::RelCandidateUrl, relCandidateUrl); setPlatformValue(ServerInfo::RelCandidateUrl, variants.at(j), relCandidateUrl);
} }
setPlatformValue(variants.at(j), ServerInfo::CurDevelUrl, develUrl); setPlatformValue(ServerInfo::CurDevelUrl, variants.at(j), develUrl);
setPlatformValue(variants.at(j), ServerInfo::ManualPdfUrl, manualPdfUrl); setPlatformValue(ServerInfo::ManualPdfUrl, variants.at(j), manualPdfUrl);
setPlatformValue(variants.at(j), ServerInfo::ManualHtmlUrl, manualHtmlUrl); setPlatformValue(ServerInfo::ManualHtmlUrl, variants.at(j), manualHtmlUrl);
setPlatformValue(variants.at(j), ServerInfo::ManualZipUrl, manualZipUrl); setPlatformValue(ServerInfo::ManualZipUrl, variants.at(j), manualZipUrl);
} }
} }
} }
QVariant ServerInfo::value(enum ServerInfos info) void ServerInfo::setPlatformValue(enum ServerInfos info, QString platform, QVariant value)
{
// 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());
LOG_INFO() << "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 // locate setting item
int i = 0; int i = 0;
@ -204,13 +185,16 @@ void ServerInfo::setPlatformValue(QString platform, enum ServerInfos info, QVari
LOG_INFO() << "SET:" << s << serverInfos.value(s).toString(); LOG_INFO() << "SET:" << s << serverInfos.value(s).toString();
} }
QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info) QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform)
{ {
// locate setting item // locate setting item
int i = 0; int i = 0;
while(ServerInfoList[i].info != info) while(ServerInfoList[i].info != info)
i++; i++;
if(platform.isEmpty())
platform = RbSettings::value(RbSettings::CurrentPlatform).toString();
QString s = ServerInfoList[i].name; QString s = ServerInfoList[i].name;
s.replace(":platform:", platform); s.replace(":platform:", platform);
QString d = ServerInfoList[i].def; QString d = ServerInfoList[i].def;

View file

@ -45,16 +45,14 @@ class ServerInfo : public QObject
//! read in buildinfo file //! read in buildinfo file
static void readBuildInfo(QString file); static void readBuildInfo(QString file);
//! get a value from server info
static QVariant value(enum ServerInfos setting);
//! get a value from server info for a named platform. //! get a value from server info for a named platform.
static QVariant platformValue(QString platform, enum ServerInfos setting); static QVariant platformValue(enum ServerInfos setting, QString platform = "");
private: private:
//! set a server info value //! set a server info value
static void setValue(enum ServerInfos setting, QVariant value); static void setValue(enum ServerInfos setting, QVariant value);
//! set a value for a server info for a named platform. //! set a value for a server info for a named platform.
static void setPlatformValue(QString platform, enum ServerInfos setting, QVariant value); static void setPlatformValue(enum ServerInfos setting, QString platform, QVariant value);
//! you shouldnt call this, its a fully static class //! you shouldnt call this, its a fully static class
ServerInfo() {} ServerInfo() {}

View file

@ -49,6 +49,13 @@ const static struct {
{ SystemInfo::ThemesUrl, "themes_url", "" }, { SystemInfo::ThemesUrl, "themes_url", "" },
{ SystemInfo::ThemesInfoUrl, "themes_info_url", "" }, { SystemInfo::ThemesInfoUrl, "themes_info_url", "" },
{ SystemInfo::RbutilUrl, "rbutil_url", "" }, { SystemInfo::RbutilUrl, "rbutil_url", "" },
};
const static struct {
SystemInfo::PlatformInfo info;
const char* name;
const char* def;
} PlatformInfosList[] = {
{ SystemInfo::CurPlatformName, ":platform:/name", "" }, { SystemInfo::CurPlatformName, ":platform:/name", "" },
{ SystemInfo::CurManual, ":platform:/manualname","rockbox-:platform:" }, { SystemInfo::CurManual, ":platform:/manualname","rockbox-:platform:" },
{ SystemInfo::CurBootloaderMethod, ":platform:/bootloadermethod", "none" }, { SystemInfo::CurBootloaderMethod, ":platform:/bootloadermethod", "none" },
@ -85,27 +92,27 @@ QVariant SystemInfo::value(enum SystemInfos info)
int i = 0; int i = 0;
while(SystemInfosList[i].info != info) while(SystemInfosList[i].info != info)
i++; i++;
QString platform = RbSettings::value(RbSettings::CurrentPlatform).toString();
QString s = SystemInfosList[i].name; QString s = SystemInfosList[i].name;
s.replace(":platform:", platform);
QString d = SystemInfosList[i].def; QString d = SystemInfosList[i].def;
d.replace(":platform:", platform);
LOG_INFO() << "GET:" << s << systemInfos->value(s, d).toString(); LOG_INFO() << "GET:" << s << systemInfos->value(s, d).toString();
return systemInfos->value(s, d); return systemInfos->value(s, d);
} }
QVariant SystemInfo::platformValue(QString platform, enum SystemInfos info) QVariant SystemInfo::platformValue(enum PlatformInfo info, QString platform)
{ {
ensureSystemInfoExists(); ensureSystemInfoExists();
// locate setting item // locate setting item
int i = 0; int i = 0;
while(SystemInfosList[i].info != info) while(PlatformInfosList[i].info != info)
i++; i++;
QString s = SystemInfosList[i].name; if (platform.isEmpty())
platform = RbSettings::value(RbSettings::CurrentPlatform).toString();
QString s = PlatformInfosList[i].name;
s.replace(":platform:", platform); s.replace(":platform:", platform);
QString d = SystemInfosList[i].def; QString d = PlatformInfosList[i].def;
d.replace(":platform:", platform); d.replace(":platform:", platform);
LOG_INFO() << "GET P:" << s << systemInfos->value(s, d).toString(); LOG_INFO() << "GET P:" << s << systemInfos->value(s, d).toString();
return systemInfos->value(s, d); return systemInfos->value(s, d);

View file

@ -57,6 +57,9 @@ class SystemInfo : public QObject
ThemesUrl, ThemesUrl,
ThemesInfoUrl, ThemesInfoUrl,
RbutilUrl, RbutilUrl,
};
enum PlatformInfo {
CurPlatformName, CurPlatformName,
CurManual, CurManual,
CurBootloaderMethod, CurBootloaderMethod,
@ -90,7 +93,7 @@ class SystemInfo : public QObject
//! get a value from system settings //! get a value from system settings
static QVariant value(enum SystemInfos info); static QVariant value(enum SystemInfos info);
//! get a value from system settings for a named platform. //! get a value from system settings for a named platform.
static QVariant platformValue(QString platform, enum SystemInfos info); static QVariant platformValue(enum PlatformInfo info, QString platform = "");
private: private:
//! you shouldnt call this, its a fully static calls //! you shouldnt call this, its a fully static calls

View file

@ -56,7 +56,8 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt
// Encoder // Encoder
emit logItem(tr("Starting Encoder Engine"),LOGINFO); emit logItem(tr("Starting Encoder Engine"),LOGINFO);
m_enc = EncoderBase::getEncoder(this,SystemInfo::value(SystemInfo::CurEncoder).toString()); m_enc = EncoderBase::getEncoder(
this, SystemInfo::platformValue(SystemInfo::CurEncoder).toString());
if(!m_enc->start()) if(!m_enc->start())
{ {
emit logItem(tr("Init of Encoder engine failed"),LOGERROR); 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()); RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString());
QString installed = rbinfo.target(); QString installed = rbinfo.target();
if(!installed.isEmpty() && installed != if(!installed.isEmpty() && installed !=
SystemInfo::value(SystemInfo::CurConfigureModel).toString()) SystemInfo::platformValue(SystemInfo::CurConfigureModel).toString())
{ {
text += tr("<li>Target mismatch detected.<br/>" text += tr("<li>Target mismatch detected.<br/>"
"Installed target: %1<br/>Selected target: %2.</li>") "Installed target: %1<br/>Selected target: %2.</li>")
.arg(SystemInfo::platformValue(installed, SystemInfo::CurPlatformName).toString(), .arg(SystemInfo::platformValue(SystemInfo::CurPlatformName, installed).toString(),
SystemInfo::value(SystemInfo::CurPlatformName).toString()); SystemInfo::platformValue(SystemInfo::CurPlatformName).toString());
} }
if(!text.isEmpty()) if(!text.isEmpty())

View file

@ -355,8 +355,8 @@ void Config::setDevices()
QMultiMap <QString, QString> manuf; QMultiMap <QString, QString> manuf;
for(int it = 0; it < platformList.size(); it++) for(int it = 0; it < platformList.size(); it++)
{ {
QString curbrand = SystemInfo::platformValue(platformList.at(it), QString curbrand = SystemInfo::platformValue(
SystemInfo::CurBrand).toString(); SystemInfo::CurBrand, platformList.at(it)).toString();
manuf.insert(curbrand, platformList.at(it)); manuf.insert(curbrand, platformList.at(it));
} }
@ -384,10 +384,10 @@ void Config::setDevices()
if(!manuf.values(brands.at(c)).contains(platformList.at(it))) if(!manuf.values(brands.at(c)).contains(platformList.at(it)))
continue; continue;
// construct display name // construct display name
QString curname = SystemInfo::platformValue(platformList.at(it), QString curname = SystemInfo::platformValue(
SystemInfo::CurName).toString() + SystemInfo::CurName, platformList.at(it)).toString() +
" (" +ServerInfo::platformValue(platformList.at(it), " (" +ServerInfo::platformValue(
ServerInfo::CurStatus).toString() +")"; ServerInfo::CurStatus, platformList.at(it)).toString() +")";
LOG_INFO() << "add supported device:" << brands.at(c) << curname; LOG_INFO() << "add supported device:" << brands.at(c) << curname;
w2 = new QTreeWidgetItem(w, QStringList(curname)); w2 = new QTreeWidgetItem(w, QStringList(curname));
w2->setData(0, Qt::UserRole, platformList.at(it)); w2->setData(0, Qt::UserRole, platformList.at(it));
@ -471,10 +471,10 @@ void Config::updateEncState()
return; return;
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
QString encoder = SystemInfo::platformValue(devname, QString encoder = SystemInfo::platformValue(
SystemInfo::CurEncoder).toString(); SystemInfo::CurEncoder, devname).toString();
ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(devname, ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(
SystemInfo::CurEncoder).toString())); SystemInfo::CurEncoder, devname).toString()));
EncoderBase* enc = EncoderBase::getEncoder(this,encoder); EncoderBase* enc = EncoderBase::getEncoder(this,encoder);
@ -742,8 +742,8 @@ void Config::autodetect()
mp = tr("(unknown)"); mp = tr("(unknown)");
} }
msg += QString("<li>%1</li>").arg(tr("%1 at %2").arg( msg += QString("<li>%1</li>").arg(tr("%1 at %2").arg(
SystemInfo::platformValue(detected.at(i).device, SystemInfo::platformValue(
SystemInfo::CurPlatformName).toString(), SystemInfo::CurPlatformName, detected.at(i).device).toString(),
QDir::toNativeSeparators(mp))); QDir::toNativeSeparators(mp)));
} }
msg += "</ul>"; msg += "</ul>";
@ -768,22 +768,22 @@ void Config::autodetect()
case Autodetection::PlayerIncompatible: case Autodetection::PlayerIncompatible:
msg += tr("Detected an unsupported player:\n%1\n" msg += tr("Detected an unsupported player:\n%1\n"
"Sorry, Rockbox doesn't run on your player.") "Sorry, Rockbox doesn't run on your player.")
.arg(SystemInfo::platformValue(detected.at(0).device, .arg(SystemInfo::platformValue(
SystemInfo::CurName).toString()); SystemInfo::CurName, detected.at(0).device).toString());
break; break;
case Autodetection::PlayerMtpMode: case Autodetection::PlayerMtpMode:
msg = tr("%1 in MTP mode found!\n" msg = tr("%1 in MTP mode found!\n"
"You need to change your player to MSC mode for installation. ") "You need to change your player to MSC mode for installation. ")
.arg(SystemInfo::platformValue(detected.at(0).device, .arg(SystemInfo::platformValue(
SystemInfo::CurName).toString()); SystemInfo::CurName, detected.at(0).device).toString());
break; break;
case Autodetection::PlayerWrongFilesystem: case Autodetection::PlayerWrongFilesystem:
if(SystemInfo::platformValue(detected.at(0).device, if(SystemInfo::platformValue(
SystemInfo::CurBootloaderMethod) == "ipod") { SystemInfo::CurBootloaderMethod, detected.at(0).device) == "ipod") {
msg = tr("%1 \"MacPod\" found!\n" msg = tr("%1 \"MacPod\" found!\n"
"Rockbox needs a FAT formatted Ipod (so-called \"WinPod\") " "Rockbox needs a FAT formatted Ipod (so-called \"WinPod\") "
"to run. ").arg(SystemInfo::platformValue( "to run. ").arg(SystemInfo::platformValue(
detected.at(0).device, SystemInfo::CurName).toString()); SystemInfo::CurName, detected.at(0).device).toString());
} }
else { else {
msg = tr("The player contains an incompatible filesystem.\n" msg = tr("The player contains an incompatible filesystem.\n"
@ -962,10 +962,10 @@ void Config::configEnc()
return; return;
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
QString encoder = SystemInfo::platformValue(devname, QString encoder = SystemInfo::platformValue(
SystemInfo::CurEncoder).toString(); SystemInfo::CurEncoder, devname).toString();
ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(devname, ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(
SystemInfo::CurEncoder).toString())); SystemInfo::CurEncoder, devname).toString()));
EncoderBase* enc = EncoderBase::getEncoder(this,encoder); EncoderBase* enc = EncoderBase::getEncoder(this,encoder);

View file

@ -42,9 +42,9 @@ void ManualWidget::updateManual()
if(!m_platform.isEmpty()) if(!m_platform.isEmpty())
{ {
ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>")
.arg(ServerInfo::platformValue(m_platform, ServerInfo::ManualPdfUrl).toString())); .arg(ServerInfo::platformValue(ServerInfo::ManualPdfUrl, m_platform).toString()));
ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>") ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>")
.arg(ServerInfo::platformValue(m_platform, ServerInfo::ManualHtmlUrl).toString())); .arg(ServerInfo::platformValue(ServerInfo::ManualHtmlUrl, m_platform).toString()));
} }
else { else {
ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual")); ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual"));
@ -65,9 +65,9 @@ void ManualWidget::downloadManual(void)
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
return; return;
} }
QString manual = SystemInfo::value(SystemInfo::CurManual).toString(); QString manual = SystemInfo::platformValue(SystemInfo::CurManual).toString();
if(manual.isEmpty()) { if(manual.isEmpty()) {
manual = "rockbox-" + SystemInfo::value(SystemInfo::CurBuildserverModel).toString(); manual = "rockbox-" + SystemInfo::platformValue(SystemInfo::CurBuildserverModel).toString();
} }
ProgressLoggerGui* logger = new ProgressLoggerGui(this); ProgressLoggerGui* logger = new ProgressLoggerGui(this);
@ -78,14 +78,14 @@ void ManualWidget::downloadManual(void)
installer->setCache(true); installer->setCache(true);
if(ui.radioPdf->isChecked()) { if(ui.radioPdf->isChecked()) {
installer->setUrl(ServerInfo::platformValue(m_platform, installer->setUrl(ServerInfo::platformValue(
ServerInfo::ManualPdfUrl).toString()); ServerInfo::ManualPdfUrl, m_platform).toString());
installer->setLogSection("Manual (PDF)"); installer->setLogSection("Manual (PDF)");
installer->setTarget("/" + manual + ".pdf"); installer->setTarget("/" + manual + ".pdf");
} }
else { else {
installer->setUrl(ServerInfo::platformValue(m_platform, installer->setUrl(ServerInfo::platformValue(
ServerInfo::ManualZipUrl).toString()); ServerInfo::ManualZipUrl, m_platform).toString());
installer->setLogSection("Manual (HTML)"); installer->setLogSection("Manual (HTML)");
installer->setTarget("/" + manual + "-" + "-html.zip"); installer->setTarget("/" + manual + "-" + "-html.zip");
} }

View file

@ -69,7 +69,7 @@ void SelectiveInstallWidget::selectedVersionChanged(int index)
if(current == "development") if(current == "development")
ui.selectedDescription->setText(tr("The development version is " ui.selectedDescription->setText(tr("The development version is "
"updated on every code change. Last update was on %1").arg( "updated on every code change. Last update was on %1").arg(
ServerInfo::value(ServerInfo::BleedingDate).toString())); ServerInfo::platformValue(ServerInfo::BleedingDate).toString()));
if(current == "rc") if(current == "rc")
ui.selectedDescription->setText(tr("This will eventually become the " ui.selectedDescription->setText(tr("This will eventually become the "
"next Rockbox version. Install it to help testing.")); "next Rockbox version. Install it to help testing."));
@ -81,8 +81,8 @@ void SelectiveInstallWidget::updateVersion(void)
// get some configuration values globally // get some configuration values globally
m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
m_target = RbSettings::value(RbSettings::CurrentPlatform).toString(); m_target = RbSettings::value(RbSettings::CurrentPlatform).toString();
m_blmethod = SystemInfo::platformValue(m_target, m_blmethod = SystemInfo::platformValue(
SystemInfo::CurBootloaderMethod).toString(); SystemInfo::CurBootloaderMethod, m_target).toString();
if(m_logger != NULL) { if(m_logger != NULL) {
delete m_logger; delete m_logger;
@ -91,11 +91,11 @@ void SelectiveInstallWidget::updateVersion(void)
// re-populate all version items // re-populate all version items
m_versions.clear(); m_versions.clear();
m_versions.insert("release", ServerInfo::value(ServerInfo::CurReleaseVersion).toString()); m_versions.insert("release", ServerInfo::platformValue(ServerInfo::CurReleaseVersion).toString());
// Don't populate RC or development selections if target has been retired. // Don't populate RC or development selections if target has been retired.
if (ServerInfo::value(ServerInfo::CurStatus) != tr("Stable (Retired)")) { if (ServerInfo::platformValue(ServerInfo::CurStatus) != tr("Stable (Retired)")) {
m_versions.insert("development", ServerInfo::value(ServerInfo::BleedingRevision).toString()); m_versions.insert("development", ServerInfo::platformValue(ServerInfo::BleedingRevision).toString());
m_versions.insert("rc", ServerInfo::value(ServerInfo::RelCandidateVersion).toString()); m_versions.insert("rc", ServerInfo::platformValue(ServerInfo::RelCandidateVersion).toString());
} }
ui.selectedVersion->clear(); ui.selectedVersion->clear();
@ -237,7 +237,7 @@ void SelectiveInstallWidget::installBootloader(void)
// create installer // create installer
BootloaderInstallBase *bl = BootloaderInstallBase *bl =
BootloaderInstallHelper::createBootloaderInstaller(this, BootloaderInstallHelper::createBootloaderInstaller(this,
SystemInfo::value(SystemInfo::CurBootloaderMethod).toString()); SystemInfo::platformValue(SystemInfo::CurBootloaderMethod).toString());
if(bl == NULL) { if(bl == NULL) {
m_logger->addItem(tr("No install method known."), LOGERROR); m_logger->addItem(tr("No install method known."), LOGERROR);
m_logger->setFinished(); m_logger->setFinished();
@ -254,7 +254,7 @@ void SelectiveInstallWidget::installBootloader(void)
connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted())); connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted()));
// set bootloader filename. Do this now as installed() needs it. // set bootloader filename. Do this now as installed() needs it.
QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList(); QStringList blfile = SystemInfo::platformValue(SystemInfo::CurBootloaderFile).toStringList();
QStringList blfilepath; QStringList blfilepath;
for(int a = 0; a < blfile.size(); a++) { for(int a = 0; a < blfile.size(); a++) {
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString() blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
@ -262,7 +262,7 @@ void SelectiveInstallWidget::installBootloader(void)
} }
bl->setBlFile(blfilepath); bl->setBlFile(blfilepath);
QUrl url(SystemInfo::value(SystemInfo::BootloaderUrl).toString() QUrl url(SystemInfo::value(SystemInfo::BootloaderUrl).toString()
+ SystemInfo::value(SystemInfo::CurBootloaderName).toString()); + SystemInfo::platformValue(SystemInfo::CurBootloaderName).toString());
bl->setBlUrl(url); bl->setBlUrl(url);
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString() bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.rockbox/rbutil.log"); + "/.rockbox/rbutil.log");
@ -282,7 +282,7 @@ void SelectiveInstallWidget::installBootloader(void)
else if(bl->installed() == BootloaderInstallBase::BootloaderOther else if(bl->installed() == BootloaderInstallBase::BootloaderOther
&& bl->capabilities() & BootloaderInstallBase::Backup) && bl->capabilities() & BootloaderInstallBase::Backup)
{ {
QString targetFolder = SystemInfo::value(SystemInfo::CurPlatformName).toString() QString targetFolder = SystemInfo::platformValue(SystemInfo::CurPlatformName).toString()
+ " Firmware Backup"; + " Firmware Backup";
// remove invalid character(s) // remove invalid character(s)
targetFolder.remove(QRegExp("[:/]")); targetFolder.remove(QRegExp("[:/]"));
@ -319,7 +319,7 @@ void SelectiveInstallWidget::installBootloader(void)
// open dialog to browse to of file // open dialog to browse to of file
QString offile; QString offile;
QString filter QString filter
= SystemInfo::value(SystemInfo::CurBootloaderFilter).toString(); = SystemInfo::platformValue(SystemInfo::CurBootloaderFilter).toString();
if(!filter.isEmpty()) { if(!filter.isEmpty()) {
filter = tr("Bootloader files (%1)").arg(filter) + ";;"; filter = tr("Bootloader files (%1)").arg(filter) + ";;";
} }
@ -385,12 +385,12 @@ void SelectiveInstallWidget::installRockbox(void)
RbSettings::setValue(RbSettings::Build, selected); RbSettings::setValue(RbSettings::Build, selected);
RbSettings::sync(); RbSettings::sync();
if(selected == "release") url = ServerInfo::platformValue(m_target, if(selected == "release") url = ServerInfo::platformValue(
ServerInfo::CurReleaseUrl).toString(); ServerInfo::CurReleaseUrl, m_target).toString();
else if(selected == "development") url = ServerInfo::platformValue(m_target, else if(selected == "development") url = ServerInfo::platformValue(
ServerInfo::CurDevelUrl).toString(); ServerInfo::CurDevelUrl, m_target).toString();
else if(selected == "rc") url = ServerInfo::platformValue(m_target, else if(selected == "rc") url = ServerInfo::platformValue(
ServerInfo::RelCandidateUrl).toString(); ServerInfo::RelCandidateUrl, m_target).toString();
//! install build //! install build
if(m_zipinstaller != NULL) m_zipinstaller->deleteLater(); if(m_zipinstaller != NULL) m_zipinstaller->deleteLater();

View file

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

View file

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