summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/rbutilqt.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-02-14 21:02:52 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-02-14 21:10:54 +0100
commitf7fdf134681a35950edeb1054a1e095f7acec058 (patch)
tree684e59f2f84d11b507065f25d5cfd592680cffda /rbutil/rbutilqt/rbutilqt.cpp
parent3933afcc0942a635ff253a59d6138983e6fd90b8 (diff)
downloadrockbox-f7fdf134681a35950edeb1054a1e095f7acec058.tar.gz
rockbox-f7fdf134681a35950edeb1054a1e095f7acec058.tar.bz2
rockbox-f7fdf134681a35950edeb1054a1e095f7acec058.zip
Move manual tab contents to separate widget.
Create a new widget which holds the contents of the manual tab and its logic. Unify its display / download code. Fixes FS#12587, which was caused by duplicated code. Change-Id: I5721d2a95ebeaf80481c1fd149eda22cf1328501
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp93
1 files changed, 7 insertions, 86 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 466f379666..310f775ff6 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -38,6 +38,7 @@
#include "serverinfo.h"
#include "systeminfo.h"
#include "ziputil.h"
+#include "manualwidget.h"
#include "progressloggerinterface.h"
@@ -113,8 +114,11 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
m_gotInfo = false;
m_auto = false;
- // manual tab
- ui.radioPdf->setChecked(true);
+ // insert ManualWidget() widget in manual tab
+ QGridLayout *mantablayout = new QGridLayout(this);
+ ui.manual->setLayout(mantablayout);
+ manual = new ManualWidget(this);
+ mantablayout->addWidget(manual);
// info tab
ui.treeInfo->setAlternatingRowColors(true);
@@ -145,7 +149,6 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
connect(ui.buttonThemes, SIGNAL(clicked()), this, SLOT(installThemes()));
connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall()));
connect(ui.buttonRemoveBootloader, SIGNAL(clicked()), this, SLOT(uninstallBootloader()));
- connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual()));
connect(ui.buttonSmall, SIGNAL(clicked()), this, SLOT(smallInstall()));
connect(ui.buttonComplete, SIGNAL(clicked()), this, SLOT(completeInstall()));
@@ -343,7 +346,7 @@ void RbUtilQt::updateSettings()
{
qDebug() << "[RbUtil] updating current settings";
updateDevice();
- updateManual();
+ manual->updateManual();
HttpGet::setGlobalProxy(proxy());
HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString());
HttpGet::setGlobalDumbCache(RbSettings::value(RbSettings::CacheOffline).toBool());
@@ -416,39 +419,6 @@ void RbUtilQt::updateDevice()
}
-void RbUtilQt::updateManual()
-{
- if(RbSettings::value(RbSettings::Platform) != "")
- {
- QString manual = SystemInfo::value(SystemInfo::CurManual).toString();
- QString buildservermodel = SystemInfo::value(SystemInfo::CurBuildserverModel).toString();
- QString pdfmanual = SystemInfo::value(SystemInfo::ManualUrl).toString();
- QString htmlmanual = pdfmanual;
-
- pdfmanual.replace("%EXTENSION%", "pdf");
- htmlmanual.replace("%EXTENSION%", "html");
- if(manual.isEmpty()) {
- pdfmanual.replace("%MANUALBASENAME%", "rockbox-" + buildservermodel);
- htmlmanual.replace("%MANUALBASENAME%", "rockbox-" + buildservermodel + "/rockbox-build");
- }
- else {
- pdfmanual.replace("%MANUALBASENAME%", "rockbox-" + manual);
- htmlmanual.replace("%MANUALBASENAME%", "rockbox-" + manual + "/rockbox-build");
- }
-
- ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>")
- .arg(pdfmanual));
- ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>")
- .arg(htmlmanual));
- }
- else {
- ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual"));
- ui.labelHtmlManual->setText(tr("<a href='%1'>Manual Overview</a>")
- .arg("http://www.rockbox.org/manual.shtml"));
-
- }
-}
-
void RbUtilQt::completeInstall()
{
if(chkConfig(this)) return;
@@ -1115,55 +1085,6 @@ void RbUtilQt::uninstallBootloader(void)
}
-void RbUtilQt::downloadManual(void)
-{
- if(chkConfig(this)) return;
- if(QMessageBox::question(this, tr("Confirm download"),
- tr("Do you really want to download the manual? The manual will be saved "
- "to the root folder of your player."),
- QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
- return;
-
- QString manual = SystemInfo::value(SystemInfo::CurManual).toString();
- if(manual.isEmpty())
- manual = "rockbox-"
- + SystemInfo::value(SystemInfo::CurBuildserverModel).toString();
-
- QDate date = QDate::fromString(ServerInfo::value(ServerInfo::DailyDate).toString(),Qt::ISODate);
-
- QString manualurl;
- QString target;
- QString section;
- if(ui.radioPdf->isChecked()) {
- target = "/" + manual + ".pdf";
- section = "Manual (PDF)";
- }
- else {
- target = "/" + manual + "-" + date.toString("yyyyMMdd") + "-html.zip";
- section = "Manual (HTML)";
- }
- manualurl = SystemInfo::value(SystemInfo::ManualUrl).toString() + "/" + target;
- qDebug() << "[RbUtil] Manual URL:" << manualurl;
-
- ProgressLoggerGui* logger = new ProgressLoggerGui(this);
- logger->show();
- installer = new ZipInstaller(this);
- installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
- if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
- installer->setCache(true);
- installer->setLogSection(section);
- installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
- installer->setUrl(manualurl);
- installer->setUnzip(false);
- installer->setTarget(target);
- connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
- connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
- connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
- connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
- installer->install();
-}
-
-
void RbUtilQt::installPortable(void)
{
if(QMessageBox::question(this, tr("Confirm installation"),