summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/gui/manualwidget.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-18 23:16:17 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-18 23:18:32 +0200
commit4f4e1d1f0ea3dd23dc2571716a5959ca4fe3273a (patch)
treefab150784747872e0afa20faa499b47e55c9fdf1 /rbutil/rbutilqt/gui/manualwidget.cpp
parentbeb61a93c58a2f97bc3f297ffdf3026b846fccca (diff)
downloadrockbox-4f4e1d1f0ea3dd23dc2571716a5959ca4fe3273a.tar.gz
rockbox-4f4e1d1f0ea3dd23dc2571716a5959ca4fe3273a.tar.bz2
rockbox-4f4e1d1f0ea3dd23dc2571716a5959ca4fe3273a.zip
Move constructing manual URL to ServerInfo class.
Change-Id: I4d2605b2389b4378e8311fc82057974e0eb238e6
Diffstat (limited to 'rbutil/rbutilqt/gui/manualwidget.cpp')
-rw-r--r--rbutil/rbutilqt/gui/manualwidget.cpp48
1 files changed, 5 insertions, 43 deletions
diff --git a/rbutil/rbutilqt/gui/manualwidget.cpp b/rbutil/rbutilqt/gui/manualwidget.cpp
index 7be9145162..4dac771627 100644
--- a/rbutil/rbutilqt/gui/manualwidget.cpp
+++ b/rbutil/rbutilqt/gui/manualwidget.cpp
@@ -28,57 +28,19 @@ ManualWidget::ManualWidget(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
ui.radioPdf->setChecked(true);
+ platform = RbSettings::value(RbSettings::Platform).toString();
connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual()));
}
-QString ManualWidget::manualUrl(ManualFormat format)
-{
- if(RbSettings::value(RbSettings::Platform).toString().isEmpty()) {
- return QString();
- }
-
- QString buildservermodel = SystemInfo::value(SystemInfo::CurBuildserverModel).toString();
- QString modelman = SystemInfo::value(SystemInfo::CurManual).toString();
- QString manualbasename;
-
- if(modelman.isEmpty()) {
- manualbasename = "rockbox-" + buildservermodel;
- }
- else {
- manualbasename = "rockbox-" + modelman;
- }
-
- QString manual = SystemInfo::value(SystemInfo::ManualUrl).toString();
- switch(format) {
- case ManualPdf:
- manual.replace("%EXTENSION%", "pdf");
- break;
- case ManualHtml:
- manual.replace("%EXTENSION%", "html");
- manualbasename += "/rockbox-build";
- break;
- case ManualZip:
- manual.replace("%EXTENSION%", "zip");
- manualbasename += "-html";
- break;
- default:
- break;
- };
-
- manual.replace("%MANUALBASENAME%", manualbasename);
- return manual;
-}
-
-
void ManualWidget::updateManual()
{
if(!RbSettings::value(RbSettings::Platform).toString().isEmpty())
{
ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>")
- .arg(manualUrl(ManualPdf)));
+ .arg(ServerInfo::platformValue(platform, ServerInfo::ManualPdfUrl).toString()));
ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>")
- .arg(manualUrl(ManualHtml)));
+ .arg(ServerInfo::platformValue(platform, ServerInfo::ManualHtmlUrl).toString()));
}
else {
ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual"));
@@ -114,12 +76,12 @@ void ManualWidget::downloadManual(void)
installer->setCache(true);
if(ui.radioPdf->isChecked()) {
- manualurl = manualUrl(ManualPdf);
+ manualurl = ServerInfo::platformValue(platform, ServerInfo::ManualPdfUrl).toString();
installer->setLogSection("Manual (PDF)");
installer->setTarget("/" + manual + ".pdf");
}
else {
- manualurl = manualUrl(ManualZip);
+ manualurl = ServerInfo::platformValue(platform, ServerInfo::ManualZipUrl).toString();
installer->setLogSection("Manual (HTML)");
installer->setTarget("/" + manual + "-" + "-html.zip");
}