2012-06-26 16:41:25 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-27 11:01:56 +00:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QFileDialog>
|
2012-06-26 16:41:25 +00:00
|
|
|
#include "selectiveinstallwidget.h"
|
|
|
|
#include "ui_selectiveinstallwidgetfrm.h"
|
2020-11-28 19:47:28 +00:00
|
|
|
#include "playerbuildinfo.h"
|
2012-06-26 16:41:25 +00:00
|
|
|
#include "rbsettings.h"
|
|
|
|
#include "rockboxinfo.h"
|
|
|
|
#include "progressloggergui.h"
|
|
|
|
#include "bootloaderinstallbase.h"
|
|
|
|
#include "bootloaderinstallhelper.h"
|
|
|
|
#include "themesinstallwindow.h"
|
|
|
|
#include "utils.h"
|
2013-11-03 10:08:18 +00:00
|
|
|
#include "Logger.h"
|
2012-06-26 16:41:25 +00:00
|
|
|
|
|
|
|
SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent)
|
|
|
|
{
|
|
|
|
ui.setupUi(this);
|
|
|
|
ui.rockboxCheckbox->setChecked(RbSettings::value(RbSettings::InstallRockbox).toBool());
|
|
|
|
ui.fontsCheckbox->setChecked(RbSettings::value(RbSettings::InstallFonts).toBool());
|
|
|
|
ui.themesCheckbox->setChecked(RbSettings::value(RbSettings::InstallThemes).toBool());
|
2020-12-04 20:26:19 +00:00
|
|
|
ui.pluginDataCheckbox->setChecked(RbSettings::value(RbSettings::InstallPluginData).toBool());
|
2020-11-21 18:33:29 +00:00
|
|
|
ui.voiceCheckbox->setChecked(RbSettings::value(RbSettings::InstallVoice).toBool());
|
2020-11-22 10:19:41 +00:00
|
|
|
ui.manualCheckbox->setChecked(RbSettings::value(RbSettings::InstallManual).toBool());
|
|
|
|
|
|
|
|
ui.manualCombobox->addItem("PDF", "pdf");
|
|
|
|
ui.manualCombobox->addItem("HTML (zip)", "zip");
|
|
|
|
ui.manualCombobox->addItem("HTML", "html");
|
2012-06-26 16:41:25 +00:00
|
|
|
|
|
|
|
// check if Rockbox is installed by looking after rockbox-info.txt.
|
|
|
|
// If installed uncheck bootloader installation.
|
|
|
|
RockboxInfo info(m_mountpoint);
|
|
|
|
ui.bootloaderCheckbox->setChecked(!info.success());
|
|
|
|
|
2020-11-19 19:36:57 +00:00
|
|
|
m_logger = nullptr;
|
|
|
|
m_zipinstaller = nullptr;
|
|
|
|
m_themesinstaller = nullptr;
|
2012-06-26 16:41:25 +00:00
|
|
|
|
2020-11-21 21:27:38 +00:00
|
|
|
connect(ui.installButton, &QAbstractButton::clicked,
|
|
|
|
this, &SelectiveInstallWidget::startInstall);
|
|
|
|
connect(this, &SelectiveInstallWidget::installSkipped,
|
|
|
|
this, &SelectiveInstallWidget::continueInstall);
|
|
|
|
connect(ui.themesCustomize, &QAbstractButton::clicked,
|
|
|
|
this, &SelectiveInstallWidget::customizeThemes);
|
|
|
|
connect(ui.selectedVersion, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
this, &SelectiveInstallWidget::selectedVersionChanged);
|
2012-06-26 16:41:25 +00:00
|
|
|
// update version information. This also handles setting the previously
|
|
|
|
// selected build type and bootloader disabling.
|
|
|
|
updateVersion();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::selectedVersionChanged(int index)
|
|
|
|
{
|
2020-11-28 19:47:28 +00:00
|
|
|
m_buildtype = static_cast<PlayerBuildInfo::BuildType>(ui.selectedVersion->itemData(index).toInt());
|
2020-11-21 18:33:29 +00:00
|
|
|
bool voice = true;
|
2020-11-21 18:51:09 +00:00
|
|
|
switch(m_buildtype) {
|
2020-11-28 19:47:28 +00:00
|
|
|
case PlayerBuildInfo::TypeRelease:
|
2012-06-26 16:41:25 +00:00
|
|
|
ui.selectedDescription->setText(tr("This is the latest stable "
|
|
|
|
"release available."));
|
2020-11-21 18:33:29 +00:00
|
|
|
voice = true;
|
2020-11-21 18:51:09 +00:00
|
|
|
break;
|
2020-11-28 19:47:28 +00:00
|
|
|
case PlayerBuildInfo::TypeDevel:
|
2012-06-26 16:41:25 +00:00
|
|
|
ui.selectedDescription->setText(tr("The development version is "
|
2020-11-28 19:47:28 +00:00
|
|
|
"updated on every code change. Last update was on %1").arg(
|
|
|
|
PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BuildVersion,
|
|
|
|
PlayerBuildInfo::TypeDevel).toString()));
|
2020-11-21 18:33:29 +00:00
|
|
|
voice = false;
|
2020-11-21 18:51:09 +00:00
|
|
|
break;
|
2020-11-28 19:47:28 +00:00
|
|
|
case PlayerBuildInfo::TypeCandidate:
|
2012-06-26 16:41:25 +00:00
|
|
|
ui.selectedDescription->setText(tr("This will eventually become the "
|
|
|
|
"next Rockbox version. Install it to help testing."));
|
2020-11-21 18:33:29 +00:00
|
|
|
voice = false;
|
2020-11-21 18:51:09 +00:00
|
|
|
break;
|
2020-11-28 19:47:28 +00:00
|
|
|
case PlayerBuildInfo::TypeDaily:
|
2020-11-21 18:51:09 +00:00
|
|
|
ui.selectedDescription->setText(tr("Daily updated development version."));
|
|
|
|
voice = true;
|
|
|
|
break;
|
2020-11-21 18:33:29 +00:00
|
|
|
}
|
|
|
|
ui.voiceCheckbox->setEnabled(voice);
|
|
|
|
ui.voiceCombobox->setEnabled(voice);
|
|
|
|
ui.voiceLabel->setEnabled(voice);
|
2020-12-05 12:14:43 +00:00
|
|
|
|
|
|
|
updateVoiceLangs();
|
2012-06-26 16:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::updateVersion(void)
|
|
|
|
{
|
|
|
|
// get some configuration values globally
|
|
|
|
m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
|
|
|
m_target = RbSettings::value(RbSettings::CurrentPlatform).toString();
|
2020-11-28 19:47:28 +00:00
|
|
|
m_blmethod = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BootloaderMethod, m_target).toString();
|
2012-06-26 16:41:25 +00:00
|
|
|
|
2020-11-19 19:36:57 +00:00
|
|
|
if(m_logger != nullptr) {
|
2012-06-26 16:41:25 +00:00
|
|
|
delete m_logger;
|
2020-11-19 19:36:57 +00:00
|
|
|
m_logger = nullptr;
|
2012-06-26 16:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// re-populate all version items
|
2020-11-28 19:47:28 +00:00
|
|
|
QMap<PlayerBuildInfo::BuildType, QString> types;
|
|
|
|
types[PlayerBuildInfo::TypeRelease] = tr("Stable Release (Version %1)");
|
|
|
|
if (PlayerBuildInfo::instance()->value(PlayerBuildInfo::BuildStatus).toInt() != STATUS_RETIRED) {
|
|
|
|
types[PlayerBuildInfo::TypeCandidate] = tr("Release Candidate (Revison %1)");
|
|
|
|
types[PlayerBuildInfo::TypeDaily] = tr("Daily Build (%1)");
|
|
|
|
types[PlayerBuildInfo::TypeDevel] = tr("Development Version (Revison %1)");
|
2020-05-22 11:55:45 +00:00
|
|
|
}
|
2012-06-26 16:41:25 +00:00
|
|
|
|
|
|
|
ui.selectedVersion->clear();
|
2020-11-28 19:47:28 +00:00
|
|
|
for(auto i = types.begin(); i != types.end(); i++) {
|
|
|
|
QString version = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BuildVersion, i.key()).toString();
|
|
|
|
if(!version.isEmpty())
|
|
|
|
ui.selectedVersion->addItem(i.value().arg(version), i.key());
|
2020-11-22 15:39:56 +00:00
|
|
|
}
|
2012-06-26 16:41:25 +00:00
|
|
|
|
|
|
|
// select previously selected version
|
2020-11-22 18:37:19 +00:00
|
|
|
int index = ui.selectedVersion->findData(
|
2020-11-28 19:47:28 +00:00
|
|
|
static_cast<PlayerBuildInfo::BuildType>(RbSettings::value(RbSettings::Build).toInt()));
|
2020-11-22 18:37:19 +00:00
|
|
|
if(index < 0) {
|
2020-11-28 19:47:28 +00:00
|
|
|
index = ui.selectedVersion->findData(PlayerBuildInfo::TypeRelease);
|
|
|
|
if(index < 0) {
|
|
|
|
index = ui.selectedVersion->findData(PlayerBuildInfo::TypeDevel);
|
2020-11-22 18:37:19 +00:00
|
|
|
}
|
2012-07-01 10:21:20 +00:00
|
|
|
}
|
2020-11-22 18:37:19 +00:00
|
|
|
ui.selectedVersion->setCurrentIndex(index);
|
2012-06-26 16:41:25 +00:00
|
|
|
// check if Rockbox is installed. If it is untick the bootloader option, as
|
|
|
|
// well as if the selected player doesn't need a bootloader.
|
|
|
|
if(m_blmethod == "none") {
|
|
|
|
ui.bootloaderCheckbox->setEnabled(false);
|
2012-09-02 20:30:19 +00:00
|
|
|
ui.bootloaderCheckbox->setChecked(false);
|
2012-06-26 16:41:25 +00:00
|
|
|
ui.bootloaderLabel->setEnabled(false);
|
|
|
|
ui.bootloaderLabel->setText(tr("The selected player doesn't need a bootloader."));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui.bootloaderCheckbox->setEnabled(true);
|
|
|
|
ui.bootloaderLabel->setEnabled(true);
|
|
|
|
ui.bootloaderLabel->setText(tr("The bootloader is required for starting "
|
|
|
|
"Rockbox. Installation of the bootloader is only necessary "
|
|
|
|
"on first time installation."));
|
2012-09-02 20:30:19 +00:00
|
|
|
// check if Rockbox is installed by looking after rockbox-info.txt.
|
|
|
|
// If installed uncheck bootloader installation.
|
|
|
|
RockboxInfo info(m_mountpoint);
|
|
|
|
ui.bootloaderCheckbox->setChecked(!info.success());
|
2012-06-26 16:41:25 +00:00
|
|
|
}
|
2020-12-05 12:14:43 +00:00
|
|
|
|
|
|
|
updateVoiceLangs();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::updateVoiceLangs()
|
|
|
|
{
|
2020-11-21 18:33:29 +00:00
|
|
|
// populate languages for voice file.
|
|
|
|
QVariant current = ui.voiceCombobox->currentData();
|
2020-12-05 12:14:43 +00:00
|
|
|
QMap<QString, QVariant> langs = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::LanguageList).toMap();
|
|
|
|
QStringList voicelangs = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BuildVoiceLangs, m_buildtype).toStringList();
|
2020-11-21 18:33:29 +00:00
|
|
|
ui.voiceCombobox->clear();
|
2020-12-05 12:14:43 +00:00
|
|
|
for(auto it = langs.begin(); it != langs.end(); it++) {
|
|
|
|
if(voicelangs.contains(it.key())) {
|
|
|
|
ui.voiceCombobox->addItem(it.value().toString(), it.key());
|
|
|
|
LOG_INFO() << "available voices: adding" << it.key();
|
2020-11-21 18:33:29 +00:00
|
|
|
}
|
2020-12-05 12:14:43 +00:00
|
|
|
|
2020-11-21 18:33:29 +00:00
|
|
|
}
|
|
|
|
// try to select the previously selected one again (if still present)
|
|
|
|
// TODO: Fall back to system language if not found, or english.
|
|
|
|
int sel = ui.voiceCombobox->findData(current);
|
|
|
|
if(sel >= 0)
|
|
|
|
ui.voiceCombobox->setCurrentIndex(sel);
|
2012-06-26 16:41:25 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::saveSettings(void)
|
|
|
|
{
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "saving current settings";
|
2012-06-26 16:41:25 +00:00
|
|
|
|
|
|
|
RbSettings::setValue(RbSettings::InstallRockbox, ui.rockboxCheckbox->isChecked());
|
|
|
|
RbSettings::setValue(RbSettings::InstallFonts, ui.fontsCheckbox->isChecked());
|
|
|
|
RbSettings::setValue(RbSettings::InstallThemes, ui.themesCheckbox->isChecked());
|
2020-12-04 20:26:19 +00:00
|
|
|
RbSettings::setValue(RbSettings::InstallPluginData, ui.pluginDataCheckbox->isChecked());
|
2020-11-21 18:33:29 +00:00
|
|
|
RbSettings::setValue(RbSettings::InstallVoice, ui.voiceCheckbox->isChecked());
|
2020-11-22 10:19:41 +00:00
|
|
|
RbSettings::setValue(RbSettings::InstallManual, ui.manualCheckbox->isChecked());
|
2020-11-21 18:33:29 +00:00
|
|
|
RbSettings::setValue(RbSettings::VoiceLanguage, ui.voiceCombobox->currentData().toString());
|
2012-06-26 16:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::startInstall(void)
|
|
|
|
{
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "starting installation";
|
2012-06-26 16:41:25 +00:00
|
|
|
saveSettings();
|
2012-08-19 08:49:53 +00:00
|
|
|
|
2012-06-26 16:41:25 +00:00
|
|
|
m_installStage = 0;
|
2020-11-19 19:36:57 +00:00
|
|
|
if(m_logger != nullptr) delete m_logger;
|
2012-06-26 16:41:25 +00:00
|
|
|
m_logger = new ProgressLoggerGui(this);
|
2012-08-19 08:49:53 +00:00
|
|
|
QString warning = Utils::checkEnvironment(false);
|
|
|
|
if(!warning.isEmpty())
|
|
|
|
{
|
|
|
|
warning += "<br/>" + tr("Continue with installation?");
|
|
|
|
if(QMessageBox::warning(this, tr("Really continue?"), warning,
|
|
|
|
QMessageBox::Ok | QMessageBox::Abort, QMessageBox::Abort)
|
|
|
|
== QMessageBox::Abort)
|
|
|
|
{
|
|
|
|
emit installSkipped(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-26 16:41:25 +00:00
|
|
|
m_logger->show();
|
|
|
|
if(!QFileInfo(m_mountpoint).isDir()) {
|
|
|
|
m_logger->addItem(tr("Mountpoint is wrong"), LOGERROR);
|
|
|
|
m_logger->setFinished();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// start installation. No errors until now.
|
|
|
|
continueInstall(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::continueInstall(bool error)
|
|
|
|
{
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "continuing install with stage" << m_installStage;
|
2012-06-26 16:41:25 +00:00
|
|
|
if(error) {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_ERROR() << "Last part returned error.";
|
2012-06-26 16:41:25 +00:00
|
|
|
m_logger->setFinished();
|
2020-11-22 10:19:41 +00:00
|
|
|
m_installStage = 9;
|
2012-06-26 16:41:25 +00:00
|
|
|
}
|
|
|
|
m_installStage++;
|
|
|
|
switch(m_installStage) {
|
2013-11-03 10:08:18 +00:00
|
|
|
case 0: LOG_ERROR() << "Something wrong!"; break;
|
2012-06-26 16:41:25 +00:00
|
|
|
case 1: installBootloader(); break;
|
|
|
|
case 2: installRockbox(); break;
|
|
|
|
case 3: installFonts(); break;
|
|
|
|
case 4: installThemes(); break;
|
2020-12-04 20:26:19 +00:00
|
|
|
case 5: installPluginData(); break;
|
2020-11-21 18:33:29 +00:00
|
|
|
case 6: installVoicefile(); break;
|
2020-11-22 10:19:41 +00:00
|
|
|
case 7: installManual(); break;
|
|
|
|
case 8: installBootloaderPost(); break;
|
2012-06-26 16:41:25 +00:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
2020-11-22 10:19:41 +00:00
|
|
|
if(m_installStage > 8) {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "All install stages done.";
|
2012-06-26 16:41:25 +00:00
|
|
|
m_logger->setFinished();
|
2012-09-02 20:30:19 +00:00
|
|
|
if(m_blmethod != "none") {
|
|
|
|
// check if Rockbox is installed by looking after rockbox-info.txt.
|
|
|
|
// If installed uncheck bootloader installation.
|
|
|
|
RockboxInfo info(m_mountpoint);
|
|
|
|
ui.bootloaderCheckbox->setChecked(!info.success());
|
|
|
|
}
|
2012-06-26 16:41:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::installBootloader(void)
|
|
|
|
{
|
|
|
|
if(ui.bootloaderCheckbox->isChecked()) {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "installing bootloader";
|
2012-06-26 16:41:25 +00:00
|
|
|
|
|
|
|
QString platform = RbSettings::value(RbSettings::Platform).toString();
|
|
|
|
QString backupDestination = "";
|
|
|
|
|
|
|
|
// create installer
|
|
|
|
BootloaderInstallBase *bl =
|
|
|
|
BootloaderInstallHelper::createBootloaderInstaller(this,
|
2020-11-28 19:47:28 +00:00
|
|
|
PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BootloaderMethod).toString());
|
2020-11-19 19:36:57 +00:00
|
|
|
if(bl == nullptr) {
|
2012-06-26 16:41:25 +00:00
|
|
|
m_logger->addItem(tr("No install method known."), LOGERROR);
|
|
|
|
m_logger->setFinished();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// the bootloader install class does NOT use any GUI stuff.
|
|
|
|
// All messages are passed via signals.
|
|
|
|
connect(bl, SIGNAL(done(bool)), m_logger, SLOT(setFinished()));
|
|
|
|
connect(bl, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
|
|
|
connect(bl, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(bl, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int)));
|
2016-01-08 22:56:27 +00:00
|
|
|
// pass Abort button click signal to current installer
|
|
|
|
connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted()));
|
2012-06-26 16:41:25 +00:00
|
|
|
|
|
|
|
// set bootloader filename. Do this now as installed() needs it.
|
2020-11-28 19:47:28 +00:00
|
|
|
QStringList blfile = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BootloaderFile).toStringList();
|
2012-06-26 16:41:25 +00:00
|
|
|
QStringList blfilepath;
|
|
|
|
for(int a = 0; a < blfile.size(); a++) {
|
|
|
|
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
|
|
|
|
+ blfile.at(a));
|
|
|
|
}
|
|
|
|
bl->setBlFile(blfilepath);
|
2020-11-28 19:47:28 +00:00
|
|
|
QUrl url(PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderUrl).toString()
|
|
|
|
+ PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderName).toString());
|
2012-06-26 16:41:25 +00:00
|
|
|
bl->setBlUrl(url);
|
|
|
|
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
|
|
|
|
+ "/.rockbox/rbutil.log");
|
|
|
|
|
|
|
|
if(bl->installed() == BootloaderInstallBase::BootloaderRockbox) {
|
|
|
|
if(QMessageBox::question(this, tr("Bootloader detected"),
|
|
|
|
tr("Bootloader already installed. Do you want to reinstall the bootloader?"),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
|
|
|
// keep m_logger open for auto installs.
|
|
|
|
// don't consider abort as error in auto-mode.
|
|
|
|
m_logger->addItem(tr("Bootloader installation skipped"), LOGINFO);
|
|
|
|
delete bl;
|
|
|
|
emit installSkipped(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(bl->installed() == BootloaderInstallBase::BootloaderOther
|
|
|
|
&& bl->capabilities() & BootloaderInstallBase::Backup)
|
|
|
|
{
|
2020-11-28 19:47:28 +00:00
|
|
|
QString targetFolder = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::DisplayName).toString()
|
2012-06-26 16:41:25 +00:00
|
|
|
+ " Firmware Backup";
|
|
|
|
// remove invalid character(s)
|
|
|
|
targetFolder.remove(QRegExp("[:/]"));
|
|
|
|
if(QMessageBox::question(this, tr("Create Bootloader backup"),
|
|
|
|
tr("You can create a backup of the original bootloader "
|
|
|
|
"file. Press \"Yes\" to select an output folder on your "
|
|
|
|
"computer to save the file to. The file will get placed "
|
|
|
|
"in a new folder \"%1\" created below the selected folder.\n"
|
|
|
|
"Press \"No\" to skip this step.").arg(targetFolder),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
|
|
|
backupDestination = QFileDialog::getExistingDirectory(this,
|
|
|
|
tr("Browse backup folder"), QDir::homePath());
|
|
|
|
if(!backupDestination.isEmpty())
|
|
|
|
backupDestination += "/" + targetFolder;
|
|
|
|
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "backing up to" << backupDestination;
|
2012-06-26 16:41:25 +00:00
|
|
|
// backup needs to be done after the m_logger has been set up.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(bl->capabilities() & BootloaderInstallBase::NeedsOf)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
ret = QMessageBox::information(this, tr("Prerequisites"),
|
|
|
|
bl->ofHint(),QMessageBox::Ok | QMessageBox::Abort);
|
|
|
|
if(ret != QMessageBox::Ok) {
|
|
|
|
// consider aborting an error to close window / abort automatic
|
|
|
|
// installation.
|
|
|
|
m_logger->addItem(tr("Bootloader installation aborted"), LOGINFO);
|
|
|
|
m_logger->setFinished();
|
|
|
|
emit installSkipped(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// open dialog to browse to of file
|
|
|
|
QString offile;
|
|
|
|
QString filter
|
2020-11-28 19:47:28 +00:00
|
|
|
= PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderFilter).toString();
|
2012-06-26 16:41:25 +00:00
|
|
|
if(!filter.isEmpty()) {
|
|
|
|
filter = tr("Bootloader files (%1)").arg(filter) + ";;";
|
|
|
|
}
|
|
|
|
filter += tr("All files (*)");
|
|
|
|
offile = QFileDialog::getOpenFileName(this,
|
|
|
|
tr("Select firmware file"), QDir::homePath(), filter);
|
|
|
|
if(!QFileInfo(offile).isReadable()) {
|
|
|
|
m_logger->addItem(tr("Error opening firmware file"), LOGERROR);
|
|
|
|
m_logger->setFinished();
|
|
|
|
emit installSkipped(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(!bl->setOfFile(offile, blfile)) {
|
|
|
|
m_logger->addItem(tr("Error reading firmware file"), LOGERROR);
|
|
|
|
m_logger->setFinished();
|
|
|
|
emit installSkipped(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// start install.
|
|
|
|
if(!backupDestination.isEmpty()) {
|
|
|
|
if(!bl->backup(backupDestination)) {
|
|
|
|
if(QMessageBox::warning(this, tr("Backup error"),
|
|
|
|
tr("Could not create backup file. Continue?"),
|
|
|
|
QMessageBox::No | QMessageBox::Yes)
|
|
|
|
== QMessageBox::No) {
|
|
|
|
m_logger->setFinished();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bl->install();
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Bootloader install disabled.";
|
2012-06-26 16:41:25 +00:00
|
|
|
emit installSkipped(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::installBootloaderPost()
|
|
|
|
{
|
|
|
|
// don't do anything if no bootloader install has been done.
|
|
|
|
if(ui.bootloaderCheckbox->isChecked()) {
|
|
|
|
QString msg = BootloaderInstallHelper::postinstallHints(
|
|
|
|
RbSettings::value(RbSettings::Platform).toString());
|
|
|
|
if(!msg.isEmpty()) {
|
|
|
|
QMessageBox::information(this, tr("Manual steps required"), msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
emit installSkipped(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::installRockbox(void)
|
|
|
|
{
|
|
|
|
if(ui.rockboxCheckbox->isChecked()) {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "installing Rockbox";
|
2012-06-26 16:41:25 +00:00
|
|
|
QString url;
|
|
|
|
|
2020-11-21 18:33:29 +00:00
|
|
|
RbSettings::setValue(RbSettings::Build, m_buildtype);
|
2012-06-26 16:41:25 +00:00
|
|
|
RbSettings::sync();
|
|
|
|
|
2020-11-28 19:47:28 +00:00
|
|
|
url = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BuildUrl, m_buildtype).toString();
|
2012-06-26 16:41:25 +00:00
|
|
|
//! install build
|
2020-11-19 19:36:57 +00:00
|
|
|
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
2012-06-26 16:41:25 +00:00
|
|
|
m_zipinstaller = new ZipInstaller(this);
|
|
|
|
m_zipinstaller->setUrl(url);
|
|
|
|
m_zipinstaller->setLogSection("Rockbox (Base)");
|
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
|
|
|
m_zipinstaller->setCache(true);
|
2020-11-28 19:47:28 +00:00
|
|
|
m_zipinstaller->setLogVersion(PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BuildVersion, m_buildtype).toString());
|
2012-06-26 16:41:25 +00:00
|
|
|
m_zipinstaller->setMountPoint(m_mountpoint);
|
|
|
|
|
|
|
|
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 {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Rockbox install disabled.";
|
2012-06-26 16:41:25 +00:00
|
|
|
emit installSkipped(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::installFonts(void)
|
|
|
|
{
|
|
|
|
if(ui.fontsCheckbox->isChecked()) {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "installing Fonts";
|
2012-06-26 16:41:25 +00:00
|
|
|
|
2020-11-21 18:33:29 +00:00
|
|
|
RockboxInfo installInfo(m_mountpoint);
|
|
|
|
QString fontsurl;
|
|
|
|
QString logversion;
|
|
|
|
QString relversion = installInfo.release();
|
2020-11-21 18:51:09 +00:00
|
|
|
if(!relversion.isEmpty()) {
|
2020-11-21 18:33:29 +00:00
|
|
|
// release is empty for non-release versions (i.e. daily / current)
|
|
|
|
logversion = installInfo.release();
|
|
|
|
}
|
2020-11-28 19:47:28 +00:00
|
|
|
fontsurl = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BuildFontUrl, m_buildtype).toString();
|
2020-11-21 21:43:18 +00:00
|
|
|
fontsurl.replace("%RELVERSION%", relversion);
|
2020-11-21 18:33:29 +00:00
|
|
|
|
|
|
|
// create new zip installer
|
|
|
|
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
|
|
|
m_zipinstaller = new ZipInstaller(this);
|
|
|
|
m_zipinstaller->setUrl(fontsurl);
|
|
|
|
m_zipinstaller->setLogSection("Fonts");
|
|
|
|
m_zipinstaller->setLogVersion(logversion);
|
|
|
|
m_zipinstaller->setMountPoint(m_mountpoint);
|
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
|
|
|
m_zipinstaller->setCache(true);
|
|
|
|
|
|
|
|
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() << "Fonts install disabled.";
|
|
|
|
emit installSkipped(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::installVoicefile(void)
|
|
|
|
{
|
2020-11-21 21:10:57 +00:00
|
|
|
if(ui.voiceCheckbox->isChecked() && ui.voiceCheckbox->isEnabled()) {
|
2020-11-21 18:33:29 +00:00
|
|
|
LOG_INFO() << "installing Voice file";
|
2020-11-21 21:10:57 +00:00
|
|
|
QString lang = ui.voiceCombobox->currentData().toString();
|
|
|
|
|
|
|
|
RockboxInfo installInfo(m_mountpoint);
|
|
|
|
QString voiceurl;
|
|
|
|
QString logversion;
|
|
|
|
QString relversion = installInfo.release();
|
2020-11-28 19:47:28 +00:00
|
|
|
if(m_buildtype != PlayerBuildInfo::TypeRelease) {
|
2020-11-21 21:10:57 +00:00
|
|
|
// release is empty for non-release versions (i.e. daily / current)
|
|
|
|
logversion = installInfo.release();
|
|
|
|
}
|
2020-11-28 19:47:28 +00:00
|
|
|
voiceurl = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BuildVoiceUrl, m_buildtype).toString();
|
2020-11-21 21:10:57 +00:00
|
|
|
voiceurl.replace("%LANGUAGE%", lang);
|
|
|
|
|
|
|
|
// create new zip installer
|
|
|
|
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
|
|
|
m_zipinstaller = new ZipInstaller(this);
|
|
|
|
m_zipinstaller->setUrl(voiceurl);
|
2020-11-22 15:01:48 +00:00
|
|
|
m_zipinstaller->setLogSection("Prerendered Voice (" + lang + ")");
|
2020-11-21 21:10:57 +00:00
|
|
|
m_zipinstaller->setLogVersion(logversion);
|
|
|
|
m_zipinstaller->setMountPoint(m_mountpoint);
|
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
|
|
|
m_zipinstaller->setCache(true);
|
|
|
|
|
|
|
|
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();
|
2012-06-26 16:41:25 +00:00
|
|
|
}
|
|
|
|
else {
|
2020-11-21 18:33:29 +00:00
|
|
|
LOG_INFO() << "Voice install disabled.";
|
2012-06-26 16:41:25 +00:00
|
|
|
emit installSkipped(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-22 10:19:41 +00:00
|
|
|
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();
|
2020-11-28 19:47:28 +00:00
|
|
|
if(m_buildtype != PlayerBuildInfo::TypeRelease) {
|
2020-11-22 10:19:41 +00:00
|
|
|
// release is empty for non-release versions (i.e. daily / current)
|
|
|
|
logversion = installInfo.release();
|
|
|
|
}
|
|
|
|
|
2020-11-28 19:47:28 +00:00
|
|
|
manualurl = PlayerBuildInfo::instance()->value(
|
|
|
|
PlayerBuildInfo::BuildManualUrl, m_buildtype).toString();
|
2020-11-22 10:19:41 +00:00
|
|
|
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);
|
2020-11-22 15:01:48 +00:00
|
|
|
m_zipinstaller->setLogSection("Manual (" + mantype + ")");
|
2020-11-22 10:19:41 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-26 16:41:25 +00:00
|
|
|
void SelectiveInstallWidget::customizeThemes(void)
|
|
|
|
{
|
2020-11-19 19:36:57 +00:00
|
|
|
if(m_themesinstaller == nullptr)
|
2012-06-26 16:41:25 +00:00
|
|
|
m_themesinstaller = new ThemesInstallWindow(this);
|
|
|
|
|
|
|
|
m_themesinstaller->setSelectOnly(true);
|
|
|
|
m_themesinstaller->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SelectiveInstallWidget::installThemes(void)
|
|
|
|
{
|
|
|
|
if(ui.themesCheckbox->isChecked()) {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "installing themes";
|
2020-11-19 19:36:57 +00:00
|
|
|
if(m_themesinstaller == nullptr)
|
2012-06-26 16:41:25 +00:00
|
|
|
m_themesinstaller = new ThemesInstallWindow(this);
|
|
|
|
|
2012-07-01 12:58:39 +00:00
|
|
|
connect(m_themesinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
2012-06-26 16:41:25 +00:00
|
|
|
m_themesinstaller->setLogger(m_logger);
|
|
|
|
m_themesinstaller->setModal(true);
|
|
|
|
m_themesinstaller->install();
|
|
|
|
}
|
|
|
|
else {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Themes install disabled.";
|
2012-06-26 16:41:25 +00:00
|
|
|
emit installSkipped(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-30 05:17:16 +00:00
|
|
|
static const struct {
|
2020-12-04 20:26:19 +00:00
|
|
|
const char *name; // display name
|
|
|
|
const char *rockfile; // rock file to look for
|
|
|
|
PlayerBuildInfo::BuildInfo zipurl; // download url
|
|
|
|
} PluginDataFiles[] = {
|
2020-11-28 19:47:28 +00:00
|
|
|
{ "Doom", "games/doom.rock", PlayerBuildInfo::DoomUrl },
|
|
|
|
{ "Duke3D", "games/duke3d.rock", PlayerBuildInfo::Duke3DUrl },
|
|
|
|
{ "Quake", "games/quake.rock", PlayerBuildInfo::QuakeUrl },
|
|
|
|
{ "Puzzles fonts", "games/sgt-blackbox.rock", PlayerBuildInfo::PuzzFontsUrl },
|
|
|
|
{ "Wolf3D", "games/wolf3d.rock", PlayerBuildInfo::Wolf3DUrl },
|
|
|
|
{ "XWorld", "games/xworld.rock", PlayerBuildInfo::XWorldUrl },
|
2020-12-04 20:26:19 +00:00
|
|
|
{ "MIDI Patchset", "viewers/midi.rock", PlayerBuildInfo::MidiPatchsetUrl },
|
2019-10-30 05:17:16 +00:00
|
|
|
};
|
2012-06-26 16:41:25 +00:00
|
|
|
|
2020-12-04 20:26:19 +00:00
|
|
|
void SelectiveInstallWidget::installPluginData(void)
|
2012-06-26 16:41:25 +00:00
|
|
|
{
|
2020-12-04 20:26:19 +00:00
|
|
|
if(ui.pluginDataCheckbox->isChecked()) {
|
2019-10-30 05:17:16 +00:00
|
|
|
// build a list of zip urls that we need, then install
|
2020-12-04 20:26:19 +00:00
|
|
|
QStringList dataUrls;
|
|
|
|
QStringList dataName;
|
2019-10-30 05:17:16 +00:00
|
|
|
|
2020-12-04 20:26:19 +00:00
|
|
|
for(size_t i = 0; i < sizeof(PluginDataFiles) / sizeof(PluginDataFiles[0]); i++)
|
2019-10-30 05:17:16 +00:00
|
|
|
{
|
|
|
|
// check if installed Rockbox has this plugin.
|
2020-12-04 20:26:19 +00:00
|
|
|
if(QFileInfo(m_mountpoint + "/.rockbox/rocks/" + PluginDataFiles[i].rockfile).exists()) {
|
|
|
|
dataName.append(PluginDataFiles[i].name);
|
2020-11-28 19:47:28 +00:00
|
|
|
// game URLs do not depend on the actual build type, but we need
|
|
|
|
// to pass it (simplifies the API, and will allow to make them
|
|
|
|
// type specific later if needed)
|
2020-12-04 20:26:19 +00:00
|
|
|
dataUrls.append(PlayerBuildInfo::instance()->value(
|
|
|
|
PluginDataFiles[i].zipurl, m_buildtype).toString());
|
2019-10-30 05:17:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-04 20:26:19 +00:00
|
|
|
if(dataUrls.size() == 0)
|
2019-10-30 05:17:16 +00:00
|
|
|
{
|
|
|
|
m_logger->addItem(tr("Your installation doesn't require any game files, skipping."), LOGINFO);
|
2012-06-26 16:41:25 +00:00
|
|
|
emit installSkipped(false);
|
2019-10-30 05:17:16 +00:00
|
|
|
return;
|
2012-06-26 16:41:25 +00:00
|
|
|
}
|
2019-10-30 05:17:16 +00:00
|
|
|
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "installing gamefiles";
|
2019-10-30 05:17:16 +00:00
|
|
|
|
2012-06-26 16:41:25 +00:00
|
|
|
// create new zip installer
|
2020-11-19 19:36:57 +00:00
|
|
|
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
2012-06-26 16:41:25 +00:00
|
|
|
m_zipinstaller = new ZipInstaller(this);
|
|
|
|
|
2020-12-04 20:26:19 +00:00
|
|
|
m_zipinstaller->setUrl(dataUrls);
|
|
|
|
m_zipinstaller->setLogSection(dataName);
|
2012-06-26 16:41:25 +00:00
|
|
|
m_zipinstaller->setLogVersion();
|
|
|
|
m_zipinstaller->setMountPoint(m_mountpoint);
|
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
|
|
|
m_zipinstaller->setCache(true);
|
|
|
|
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 {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Gamefile install disabled.";
|
2012-06-26 16:41:25 +00:00
|
|
|
emit installSkipped(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-30 08:50:28 +00:00
|
|
|
void SelectiveInstallWidget::changeEvent(QEvent *e)
|
|
|
|
{
|
|
|
|
if(e->type() == QEvent::LanguageChange) {
|
|
|
|
ui.retranslateUi(this);
|
|
|
|
} else {
|
|
|
|
QWidget::changeEvent(e);
|
|
|
|
}
|
|
|
|
}
|