summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/gui/manualwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/gui/manualwidget.cpp')
-rw-r--r--rbutil/rbutilqt/gui/manualwidget.cpp107
1 files changed, 0 insertions, 107 deletions
diff --git a/rbutil/rbutilqt/gui/manualwidget.cpp b/rbutil/rbutilqt/gui/manualwidget.cpp
deleted file mode 100644
index c10288df10..0000000000
--- a/rbutil/rbutilqt/gui/manualwidget.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2012 by Dominik Riebeling
10 *
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
13 *
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
16 *
17 ****************************************************************************/
18
19#include <QWidget>
20#include <QMessageBox>
21#include <QDebug>
22#include "manualwidget.h"
23#include "rbutilqt.h"
24#include "rbsettings.h"
25#include "serverinfo.h"
26#include "systeminfo.h"
27#include "Logger.h"
28
29ManualWidget::ManualWidget(QWidget *parent) : QWidget(parent)
30{
31 ui.setupUi(this);
32 ui.radioPdf->setChecked(true);
33 m_platform = RbSettings::value(RbSettings::Platform).toString();
34 connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual()));
35}
36
37
38void ManualWidget::updateManual()
39{
40 LOG_INFO() << "updating manual URLs";
41 m_platform = RbSettings::value(RbSettings::Platform).toString();
42 if(!m_platform.isEmpty())
43 {
44 ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>")
45 .arg(ServerInfo::instance()->platformValue(ServerInfo::ManualPdfUrl, m_platform).toString()));
46 ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>")
47 .arg(ServerInfo::instance()->platformValue(ServerInfo::ManualHtmlUrl, m_platform).toString()));
48 }
49 else {
50 ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual"));
51 ui.labelHtmlManual->setText(tr("<a href='%1'>Manual Overview</a>")
52 .arg("http://www.rockbox.org/manual.shtml"));
53 }
54}
55
56
57void ManualWidget::downloadManual(void)
58{
59 if(RbUtilQt::chkConfig(this)) {
60 return;
61 }
62 if(QMessageBox::question(this, tr("Confirm download"),
63 tr("Do you really want to download the manual? The manual will be saved "
64 "to the root folder of your player."),
65 QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
66 return;
67 }
68 QString manual = ServerInfo::instance()->platformValue(ServerInfo::ManualPdfUrl).toString();
69
70 ProgressLoggerGui* logger = new ProgressLoggerGui(this);
71 logger->show();
72 ZipInstaller *installer = new ZipInstaller(this);
73 installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
74 if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
75 installer->setCache(true);
76
77 if(ui.radioPdf->isChecked()) {
78 installer->setUrl(ServerInfo::instance()->platformValue(
79 ServerInfo::ManualPdfUrl, m_platform).toString());
80 installer->setLogSection("Manual (PDF)");
81 }
82 else {
83 installer->setUrl(ServerInfo::instance()->platformValue(
84 ServerInfo::ManualZipUrl, m_platform).toString());
85 installer->setLogSection("Manual (HTML)");
86 }
87 installer->setLogVersion();
88 installer->setUnzip(false);
89
90 connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
91 connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
92 connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
93 connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
94 installer->install();
95}
96
97
98void ManualWidget::changeEvent(QEvent *e)
99{
100 if(e->type() == QEvent::LanguageChange) {
101 ui.retranslateUi(this);
102 updateManual();
103 } else {
104 QWidget::changeEvent(e);
105 }
106}
107