diff options
Diffstat (limited to 'rbutil/rbutilqt/gui/manualwidget.cpp')
-rw-r--r-- | rbutil/rbutilqt/gui/manualwidget.cpp | 48 |
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) | |||
28 | { | 28 | { |
29 | ui.setupUi(this); | 29 | ui.setupUi(this); |
30 | ui.radioPdf->setChecked(true); | 30 | ui.radioPdf->setChecked(true); |
31 | platform = RbSettings::value(RbSettings::Platform).toString(); | ||
31 | connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual())); | 32 | connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual())); |
32 | } | 33 | } |
33 | 34 | ||
34 | 35 | ||
35 | QString ManualWidget::manualUrl(ManualFormat format) | ||
36 | { | ||
37 | if(RbSettings::value(RbSettings::Platform).toString().isEmpty()) { | ||
38 | return QString(); | ||
39 | } | ||
40 | |||
41 | QString buildservermodel = SystemInfo::value(SystemInfo::CurBuildserverModel).toString(); | ||
42 | QString modelman = SystemInfo::value(SystemInfo::CurManual).toString(); | ||
43 | QString manualbasename; | ||
44 | |||
45 | if(modelman.isEmpty()) { | ||
46 | manualbasename = "rockbox-" + buildservermodel; | ||
47 | } | ||
48 | else { | ||
49 | manualbasename = "rockbox-" + modelman; | ||
50 | } | ||
51 | |||
52 | QString manual = SystemInfo::value(SystemInfo::ManualUrl).toString(); | ||
53 | switch(format) { | ||
54 | case ManualPdf: | ||
55 | manual.replace("%EXTENSION%", "pdf"); | ||
56 | break; | ||
57 | case ManualHtml: | ||
58 | manual.replace("%EXTENSION%", "html"); | ||
59 | manualbasename += "/rockbox-build"; | ||
60 | break; | ||
61 | case ManualZip: | ||
62 | manual.replace("%EXTENSION%", "zip"); | ||
63 | manualbasename += "-html"; | ||
64 | break; | ||
65 | default: | ||
66 | break; | ||
67 | }; | ||
68 | |||
69 | manual.replace("%MANUALBASENAME%", manualbasename); | ||
70 | return manual; | ||
71 | } | ||
72 | |||
73 | |||
74 | void ManualWidget::updateManual() | 36 | void ManualWidget::updateManual() |
75 | { | 37 | { |
76 | if(!RbSettings::value(RbSettings::Platform).toString().isEmpty()) | 38 | if(!RbSettings::value(RbSettings::Platform).toString().isEmpty()) |
77 | { | 39 | { |
78 | ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") | 40 | ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") |
79 | .arg(manualUrl(ManualPdf))); | 41 | .arg(ServerInfo::platformValue(platform, ServerInfo::ManualPdfUrl).toString())); |
80 | ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>") | 42 | ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>") |
81 | .arg(manualUrl(ManualHtml))); | 43 | .arg(ServerInfo::platformValue(platform, ServerInfo::ManualHtmlUrl).toString())); |
82 | } | 44 | } |
83 | else { | 45 | else { |
84 | ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual")); | 46 | ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual")); |
@@ -114,12 +76,12 @@ void ManualWidget::downloadManual(void) | |||
114 | installer->setCache(true); | 76 | installer->setCache(true); |
115 | 77 | ||
116 | if(ui.radioPdf->isChecked()) { | 78 | if(ui.radioPdf->isChecked()) { |
117 | manualurl = manualUrl(ManualPdf); | 79 | manualurl = ServerInfo::platformValue(platform, ServerInfo::ManualPdfUrl).toString(); |
118 | installer->setLogSection("Manual (PDF)"); | 80 | installer->setLogSection("Manual (PDF)"); |
119 | installer->setTarget("/" + manual + ".pdf"); | 81 | installer->setTarget("/" + manual + ".pdf"); |
120 | } | 82 | } |
121 | else { | 83 | else { |
122 | manualurl = manualUrl(ManualZip); | 84 | manualurl = ServerInfo::platformValue(platform, ServerInfo::ManualZipUrl).toString(); |
123 | installer->setLogSection("Manual (HTML)"); | 85 | installer->setLogSection("Manual (HTML)"); |
124 | installer->setTarget("/" + manual + "-" + "-html.zip"); | 86 | installer->setTarget("/" + manual + "-" + "-html.zip"); |
125 | } | 87 | } |