From ba2bbd60bd3d8a9fa204b17686c33dfb0337b07c Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 22 Nov 2020 11:19:41 +0100 Subject: rbutil: Move Manual installation to main tab. The manual tab didn't show the manual, so it's clearer to have that as part of the main tab. Also fixes the wrong manual getting downloaded for releases. Change-Id: I5d4a287102af037f94f0de8464e025d9ff5f76ed --- rbutil/rbutilqt/gui/manualwidget.cpp | 107 --------------- rbutil/rbutilqt/gui/manualwidget.h | 42 ------ rbutil/rbutilqt/gui/manualwidgetfrm.ui | 116 ---------------- rbutil/rbutilqt/gui/selectiveinstallwidget.cpp | 64 ++++++++- rbutil/rbutilqt/gui/selectiveinstallwidget.h | 7 +- rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui | 167 +++++++++++++---------- 6 files changed, 160 insertions(+), 343 deletions(-) delete mode 100644 rbutil/rbutilqt/gui/manualwidget.cpp delete mode 100644 rbutil/rbutilqt/gui/manualwidget.h delete mode 100644 rbutil/rbutilqt/gui/manualwidgetfrm.ui (limited to 'rbutil/rbutilqt/gui') 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 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2012 by Dominik Riebeling - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include -#include -#include -#include "manualwidget.h" -#include "rbutilqt.h" -#include "rbsettings.h" -#include "serverinfo.h" -#include "systeminfo.h" -#include "Logger.h" - -ManualWidget::ManualWidget(QWidget *parent) : QWidget(parent) -{ - ui.setupUi(this); - ui.radioPdf->setChecked(true); - m_platform = RbSettings::value(RbSettings::Platform).toString(); - connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual())); -} - - -void ManualWidget::updateManual() -{ - LOG_INFO() << "updating manual URLs"; - m_platform = RbSettings::value(RbSettings::Platform).toString(); - if(!m_platform.isEmpty()) - { - ui.labelPdfManual->setText(tr("PDF Manual") - .arg(ServerInfo::instance()->platformValue(ServerInfo::ManualPdfUrl, m_platform).toString())); - ui.labelHtmlManual->setText(tr("HTML Manual (opens in browser)") - .arg(ServerInfo::instance()->platformValue(ServerInfo::ManualHtmlUrl, m_platform).toString())); - } - else { - ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual")); - ui.labelHtmlManual->setText(tr("Manual Overview") - .arg("http://www.rockbox.org/manual.shtml")); - } -} - - -void ManualWidget::downloadManual(void) -{ - if(RbUtilQt::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 = ServerInfo::instance()->platformValue(ServerInfo::ManualPdfUrl).toString(); - - ProgressLoggerGui* logger = new ProgressLoggerGui(this); - logger->show(); - ZipInstaller *installer = new ZipInstaller(this); - installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); - if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) - installer->setCache(true); - - if(ui.radioPdf->isChecked()) { - installer->setUrl(ServerInfo::instance()->platformValue( - ServerInfo::ManualPdfUrl, m_platform).toString()); - installer->setLogSection("Manual (PDF)"); - } - else { - installer->setUrl(ServerInfo::instance()->platformValue( - ServerInfo::ManualZipUrl, m_platform).toString()); - installer->setLogSection("Manual (HTML)"); - } - installer->setLogVersion(); - installer->setUnzip(false); - - 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 ManualWidget::changeEvent(QEvent *e) -{ - if(e->type() == QEvent::LanguageChange) { - ui.retranslateUi(this); - updateManual(); - } else { - QWidget::changeEvent(e); - } -} - diff --git a/rbutil/rbutilqt/gui/manualwidget.h b/rbutil/rbutilqt/gui/manualwidget.h deleted file mode 100644 index d6095d3e14..0000000000 --- a/rbutil/rbutilqt/gui/manualwidget.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2012 by Dominik Riebeling - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#ifndef MANUALWIDGET_H -#define MANUALWIDGET_H - -#include -#include "ui_manualwidgetfrm.h" - -class ManualWidget : public QWidget -{ - Q_OBJECT - public: - ManualWidget(QWidget *parent = nullptr); - - public slots: - void downloadManual(void); - void updateManual(); - - private: - void changeEvent(QEvent*); - Ui::ManualWidgetFrm ui; - QString m_platform; -}; - -#endif - diff --git a/rbutil/rbutilqt/gui/manualwidgetfrm.ui b/rbutil/rbutilqt/gui/manualwidgetfrm.ui deleted file mode 100644 index add26736c9..0000000000 --- a/rbutil/rbutilqt/gui/manualwidgetfrm.ui +++ /dev/null @@ -1,116 +0,0 @@ - - - ManualWidgetFrm - - - - 0 - 0 - 543 - 255 - - - - Manual - - - - - - Read the manual - - - - - - PDF manual - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - - - - - - - HTML manual - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - - - - - - - - - - Download the manual - - - - - - - - &PDF version - - - - - - - &HTML version (zip file) - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Down&load - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp index 88b085e9b3..50017e65d4 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp +++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp @@ -40,6 +40,11 @@ SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent ui.themesCheckbox->setChecked(RbSettings::value(RbSettings::InstallThemes).toBool()); ui.gamefileCheckbox->setChecked(RbSettings::value(RbSettings::InstallGamefiles).toBool()); ui.voiceCheckbox->setChecked(RbSettings::value(RbSettings::InstallVoice).toBool()); + ui.manualCheckbox->setChecked(RbSettings::value(RbSettings::InstallManual).toBool()); + + ui.manualCombobox->addItem("PDF", "pdf"); + ui.manualCombobox->addItem("HTML (zip)", "zip"); + ui.manualCombobox->addItem("HTML", "html"); // check if Rockbox is installed by looking after rockbox-info.txt. // If installed uncheck bootloader installation. @@ -201,6 +206,7 @@ void SelectiveInstallWidget::saveSettings(void) RbSettings::setValue(RbSettings::InstallThemes, ui.themesCheckbox->isChecked()); RbSettings::setValue(RbSettings::InstallGamefiles, ui.gamefileCheckbox->isChecked()); RbSettings::setValue(RbSettings::InstallVoice, ui.voiceCheckbox->isChecked()); + RbSettings::setValue(RbSettings::InstallManual, ui.manualCheckbox->isChecked()); RbSettings::setValue(RbSettings::VoiceLanguage, ui.voiceCombobox->currentData().toString()); } @@ -244,7 +250,7 @@ void SelectiveInstallWidget::continueInstall(bool error) if(error) { LOG_ERROR() << "Last part returned error."; m_logger->setFinished(); - m_installStage = 7; + m_installStage = 9; } m_installStage++; switch(m_installStage) { @@ -255,11 +261,12 @@ void SelectiveInstallWidget::continueInstall(bool error) case 4: installThemes(); break; case 5: installGamefiles(); break; case 6: installVoicefile(); break; - case 7: installBootloaderPost(); break; + case 7: installManual(); break; + case 8: installBootloaderPost(); break; default: break; } - if(m_installStage > 6) { + if(m_installStage > 8) { LOG_INFO() << "All install stages done."; m_logger->setFinished(); if(m_blmethod != "none") { @@ -548,6 +555,57 @@ void SelectiveInstallWidget::installVoicefile(void) } } +void SelectiveInstallWidget::installManual(void) +{ + if(ui.manualCheckbox->isChecked() && ui.manualCheckbox->isEnabled()) { + LOG_INFO() << "installing Manual"; + QString mantype = ui.manualCombobox->currentData().toString(); + + RockboxInfo installInfo(m_mountpoint); + QString manualurl; + QString logversion; + QString relversion = installInfo.release(); + if(m_buildtype != SystemInfo::BuildRelease) { + // release is empty for non-release versions (i.e. daily / current) + logversion = installInfo.release(); + } + + manualurl = SystemInfo::value(SystemInfo::ManualUrl, m_buildtype).toString(); + manualurl.replace("%RELVERSION%", m_versions[m_buildtype]); + QString model = SystemInfo::platformValue(SystemInfo::Manual, m_target).toString(); + if(model.isEmpty()) + model = m_target; + manualurl.replace("%MODEL%", model); + + if(mantype == "pdf") + manualurl.replace("%FORMAT%", ".pdf"); + else + manualurl.replace("%FORMAT%", "-html.zip"); + + // create new zip installer + if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater(); + m_zipinstaller = new ZipInstaller(this); + m_zipinstaller->setUrl(manualurl); + m_zipinstaller->setLogSection("Manual Voice (" + mantype + ")"); + m_zipinstaller->setLogVersion(logversion); + m_zipinstaller->setMountPoint(m_mountpoint); + if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) + m_zipinstaller->setCache(true); + // if type is html extract it. + m_zipinstaller->setUnzip(mantype == "html"); + + connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool))); + connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int))); + connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int))); + connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort())); + m_zipinstaller->install(); + } + else { + LOG_INFO() << "Manual install disabled."; + emit installSkipped(false); + } +} + void SelectiveInstallWidget::customizeThemes(void) { if(m_themesinstaller == nullptr) diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.h b/rbutil/rbutilqt/gui/selectiveinstallwidget.h index 38cce78a46..7a969a9e89 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidget.h +++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.h @@ -39,15 +39,18 @@ class SelectiveInstallWidget : public QWidget private slots: void continueInstall(bool); + void customizeThemes(void); + void selectedVersionChanged(int); + + private: void installBootloader(void); void installRockbox(void); void installFonts(void); void installVoicefile(void); + void installManual(void); void installThemes(void); void installGamefiles(void); void installBootloaderPost(void); - void customizeThemes(void); - void selectedVersionChanged(int); signals: void installSkipped(bool); diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui b/rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui index a5bb023f2e..06f2af92b8 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui +++ b/rbutil/rbutilqt/gui/selectiveinstallwidgetfrm.ui @@ -7,7 +7,7 @@ 0 0 663 - 399 + 409 @@ -54,6 +54,20 @@ Rockbox components to install + + + + &Bootloader + + + + :/icons/preferences-system.svg:/icons/preferences-system.svg + + + true + + + @@ -68,8 +82,8 @@ - - + + 0 @@ -77,7 +91,7 @@ - The bootloader is required for starting Rockbox. Only necessary for first time install. + Themes allow adjusting the user interface of Rockbox. Use "Customize" to select themes. true @@ -95,33 +109,6 @@ - - - - Customize - - - - :/icons/preferences-system.svg:/icons/preferences-system.svg - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 1 - 1 - - - - @@ -136,19 +123,8 @@ - - - - Game Files - - - - :/icons/input-gaming.svg:/icons/input-gaming.svg - - - - - + + 0 @@ -156,15 +132,15 @@ - Themes allow adjusting the user interface of Rockbox. Use "Customize" to select themes. + The bootloader is required for starting Rockbox. Only necessary for first time install. true - - + + 0 @@ -172,31 +148,26 @@ - Additional fonts for the User Interface. + Some game plugins require additional files. true - - - - - 0 - 0 - - + + - Some game plugins require additional files. + Customize - - true + + + :/icons/preferences-system.svg:/icons/preferences-system.svg - - + + 0 @@ -204,24 +175,55 @@ - The main Rockbox firmware. + Additional fonts for the User Interface. true - - + + - &Bootloader + Install prerendered voice file. + + + + + + + Game Files - :/icons/preferences-system.svg:/icons/preferences-system.svg + :/icons/input-gaming.svg:/icons/input-gaming.svg - - true + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 1 + 1 + + + + + + + + &Manual + + + + :/icons/edit-find.svg:/icons/edit-find.svg @@ -236,15 +238,34 @@ - - + + + + + + + + 0 + 0 + + - Install prerendered voice file. + The main Rockbox firmware. + + + true - - + + + + Save a copy of the manual on the player. + + + + + -- cgit v1.2.3