diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp index fd46f13a8b..8d91309e66 100644 --- a/rbutil/rbutilqt/base/serverinfo.cpp +++ b/rbutil/rbutilqt/base/serverinfo.cpp @@ -35,6 +35,9 @@ const static struct { { ServerInfo::RelCandidateVersion, ":platform:/rcversion", "" }, { ServerInfo::RelCandidateUrl, ":platform:/rcurl", "" }, { ServerInfo::CurStatus, ":platform:/status", "Unknown" }, + { ServerInfo::ManualPdfUrl, ":platform:/manual_pdf", "" }, + { ServerInfo::ManualHtmlUrl, ":platform:/manual_html", "" }, + { ServerInfo::ManualZipUrl, ":platform:/manual_zip", "" }, { ServerInfo::BleedingRevision, "bleedingrev", "" }, { ServerInfo::BleedingDate, "bleedingdate", "" }, { ServerInfo::CurDevelUrl, ":platform:/develurl", "" }, @@ -126,6 +129,28 @@ void ServerInfo::readBuildInfo(QString file) break; } info.endGroup(); + + // manual URLs + QString manualPdfUrl = manualBaseUrl; + QString manualHtmlUrl = manualBaseUrl; + QString manualZipUrl = manualBaseUrl; + + QString buildservermodel = SystemInfo::platformValue(platforms.at(i), + SystemInfo::CurBuildserverModel).toString(); + QString modelman = SystemInfo::platformValue(platforms.at(i), + SystemInfo::CurManual).toString(); + QString manualBaseName = "rockbox-"; + + if(modelman.isEmpty()) manualBaseName += buildservermodel; + else manualBaseName += modelman; + + manualPdfUrl.replace("%EXTENSION%", "pdf"); + manualPdfUrl.replace("%MANUALBASENAME%", manualBaseName); + manualHtmlUrl.replace("%EXTENSION%", "html"); + manualHtmlUrl.replace("%MANUALBASENAME%", manualBaseName + "/rockbox-build"); + manualZipUrl.replace("%EXTENSION%", "zip"); + manualZipUrl.replace("%MANUALBASENAME%", manualBaseName + "-html"); + // set variants (if any) for(int j = 0; j < variants.size(); ++j) { setPlatformValue(variants.at(j), ServerInfo::CurStatus, status); @@ -138,6 +163,10 @@ void ServerInfo::readBuildInfo(QString file) setPlatformValue(variants.at(j), ServerInfo::RelCandidateUrl, relCandidateUrl); } setPlatformValue(variants.at(j), ServerInfo::CurDevelUrl, develUrl); + + setPlatformValue(variants.at(j), ServerInfo::ManualPdfUrl, manualPdfUrl); + setPlatformValue(variants.at(j), ServerInfo::ManualHtmlUrl, manualHtmlUrl); + setPlatformValue(variants.at(j), ServerInfo::ManualZipUrl, manualZipUrl); } } } diff --git a/rbutil/rbutilqt/base/serverinfo.h b/rbutil/rbutilqt/base/serverinfo.h index ea68fd7fc4..94b2818f73 100644 --- a/rbutil/rbutilqt/base/serverinfo.h +++ b/rbutil/rbutilqt/base/serverinfo.h @@ -34,6 +34,9 @@ class ServerInfo : public QObject CurStatus, CurReleaseUrl, CurDevelUrl, + ManualPdfUrl, + ManualHtmlUrl, + ManualZipUrl, BleedingRevision, BleedingDate, RelCandidateVersion, 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("PDF Manual") - .arg(manualUrl(ManualPdf))); + .arg(ServerInfo::platformValue(platform, ServerInfo::ManualPdfUrl).toString())); ui.labelHtmlManual->setText(tr("HTML Manual (opens in browser)") - .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"); } diff --git a/rbutil/rbutilqt/gui/manualwidget.h b/rbutil/rbutilqt/gui/manualwidget.h index 6de2de55bd..4548391af5 100644 --- a/rbutil/rbutilqt/gui/manualwidget.h +++ b/rbutil/rbutilqt/gui/manualwidget.h @@ -26,20 +26,15 @@ class ManualWidget : public QWidget { Q_OBJECT public: - enum ManualFormat { - ManualPdf, - ManualHtml, - ManualZip, - }; ManualWidget(QWidget *parent = 0); public slots: void downloadManual(void); void updateManual(); - QString manualUrl(ManualFormat format); private: Ui::ManualWidgetFrm ui; + QString platform; }; #endif diff --git a/rbutil/rbutilqt/installwindowfrm.ui b/rbutil/rbutilqt/installwindowfrm.ui index a06908214f..80bdc63c15 100644 --- a/rbutil/rbutilqt/installwindowfrm.ui +++ b/rbutil/rbutilqt/installwindowfrm.ui @@ -10,7 +10,7 @@ 0 0 644 - 500 + 448