rbutil: Enable themes install depending on theme selection.
Don't store the "Install Themes" option. Automatically enable themes installation if the themes selection has at least one entry selected instead. Change-Id: Ib46e8b53b0204555b79dea51545dd7c380f003ff
This commit is contained in:
parent
62108a9613
commit
37a60d5461
6 changed files with 17 additions and 41 deletions
|
@ -45,7 +45,6 @@ const static struct {
|
|||
{ RbSettings::BackupPath, "backuppath", "" },
|
||||
{ RbSettings::InstallRockbox, "install_rockbox", "true" },
|
||||
{ RbSettings::InstallFonts, "install_fonts", "true" },
|
||||
{ RbSettings::InstallThemes, "install_themes", "false" },
|
||||
{ RbSettings::InstallPluginData, "install_plugin_data", "true" },
|
||||
{ RbSettings::InstallVoice, "install_voice", "false" },
|
||||
{ RbSettings::InstallManual, "install_manual", "false" },
|
||||
|
|
|
@ -44,7 +44,6 @@ class RbSettings : public QObject
|
|||
BackupPath,
|
||||
InstallRockbox,
|
||||
InstallFonts,
|
||||
InstallThemes,
|
||||
InstallPluginData,
|
||||
InstallVoice,
|
||||
InstallManual,
|
||||
|
|
|
@ -36,7 +36,6 @@ 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());
|
||||
ui.pluginDataCheckbox->setChecked(RbSettings::value(RbSettings::InstallPluginData).toBool());
|
||||
ui.voiceCheckbox->setChecked(RbSettings::value(RbSettings::InstallVoice).toBool());
|
||||
ui.manualCheckbox->setChecked(RbSettings::value(RbSettings::InstallManual).toBool());
|
||||
|
@ -52,14 +51,16 @@ SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent
|
|||
|
||||
m_logger = nullptr;
|
||||
m_zipinstaller = nullptr;
|
||||
m_themesinstaller = nullptr;
|
||||
m_themesinstaller = new ThemesInstallWindow(this);
|
||||
connect(m_themesinstaller, &ThemesInstallWindow::selected,
|
||||
[this](int count) {ui.themesCheckbox->setChecked(count > 0);});
|
||||
|
||||
connect(ui.installButton, &QAbstractButton::clicked,
|
||||
this, &SelectiveInstallWidget::startInstall);
|
||||
connect(this, &SelectiveInstallWidget::installSkipped,
|
||||
this, &SelectiveInstallWidget::continueInstall);
|
||||
connect(ui.themesCustomize, &QAbstractButton::clicked,
|
||||
this, &SelectiveInstallWidget::customizeThemes);
|
||||
[this]() { m_themesinstaller->show(); } );
|
||||
connect(ui.selectedVersion, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &SelectiveInstallWidget::selectedVersionChanged);
|
||||
// update version information. This also handles setting the previously
|
||||
|
@ -202,7 +203,6 @@ void SelectiveInstallWidget::saveSettings(void)
|
|||
|
||||
RbSettings::setValue(RbSettings::InstallRockbox, ui.rockboxCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallFonts, ui.fontsCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallThemes, ui.themesCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallPluginData, ui.pluginDataCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallVoice, ui.voiceCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallManual, ui.manualCheckbox->isChecked());
|
||||
|
@ -584,28 +584,16 @@ void SelectiveInstallWidget::installManual(void)
|
|||
}
|
||||
}
|
||||
|
||||
void SelectiveInstallWidget::customizeThemes(void)
|
||||
{
|
||||
if(m_themesinstaller == nullptr)
|
||||
m_themesinstaller = new ThemesInstallWindow(this);
|
||||
|
||||
m_themesinstaller->setSelectOnly(true);
|
||||
m_themesinstaller->show();
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::installThemes(void)
|
||||
{
|
||||
if(ui.themesCheckbox->isChecked()) {
|
||||
LOG_INFO() << "installing themes";
|
||||
if(m_themesinstaller == nullptr)
|
||||
m_themesinstaller = new ThemesInstallWindow(this);
|
||||
|
||||
connect(m_themesinstaller, &ThemesInstallWindow::done,
|
||||
this, &SelectiveInstallWidget::continueInstall);
|
||||
m_themesinstaller->setLogger(m_logger);
|
||||
m_themesinstaller->setModal(true);
|
||||
m_themesinstaller->install();
|
||||
connect(m_themesinstaller, &ThemesInstallWindow::finished,
|
||||
this, &SelectiveInstallWidget::continueInstall);
|
||||
}
|
||||
else {
|
||||
LOG_INFO() << "Themes install disabled.";
|
||||
|
|
|
@ -39,7 +39,6 @@ class SelectiveInstallWidget : public QWidget
|
|||
|
||||
private slots:
|
||||
void continueInstall(bool);
|
||||
void customizeThemes(void);
|
||||
void selectedVersionChanged(int);
|
||||
void updateVoiceLangs();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
|
|||
ui.themeDescription->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
connect(ui.buttonCancel, &QAbstractButton::clicked, this, &QWidget::close);
|
||||
connect(ui.buttonOk, &QAbstractButton::clicked, this, &ThemesInstallWindow::accept);
|
||||
connect(ui.buttonOk, &QAbstractButton::clicked, this, &ThemesInstallWindow::buttonOk);
|
||||
connect(ui.listThemes, &QListWidget::currentItemChanged,
|
||||
this, &ThemesInstallWindow::updateDetails);
|
||||
connect(ui.listThemes, &QListWidget::itemSelectionChanged, this, &ThemesInstallWindow::updateSize);
|
||||
|
@ -287,8 +287,7 @@ void ThemesInstallWindow::resizeEvent(QResizeEvent* e)
|
|||
void ThemesInstallWindow::show()
|
||||
{
|
||||
QDialog::show();
|
||||
if(windowSelectOnly)
|
||||
ui.buttonOk->setText(tr("Select"));
|
||||
ui.buttonOk->setText(tr("Select"));
|
||||
|
||||
if(!logger)
|
||||
logger = new ProgressLoggerGui(this);
|
||||
|
@ -309,16 +308,14 @@ void ThemesInstallWindow::abort()
|
|||
{
|
||||
igetter.abort();
|
||||
logger->setFinished();
|
||||
this->close();
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
void ThemesInstallWindow::accept(void)
|
||||
void ThemesInstallWindow::buttonOk(void)
|
||||
{
|
||||
if(!windowSelectOnly)
|
||||
install();
|
||||
else
|
||||
close();
|
||||
emit selected(ui.listThemes->selectedItems().size());
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
@ -326,7 +323,6 @@ void ThemesInstallWindow::install()
|
|||
{
|
||||
if(ui.listThemes->selectedItems().size() == 0) {
|
||||
logger->addItem(tr("No themes selected, skipping"), LOGINFO);
|
||||
emit done(false);
|
||||
return;
|
||||
}
|
||||
QStringList themes;
|
||||
|
@ -368,13 +364,9 @@ void ThemesInstallWindow::install()
|
|||
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
||||
installer->setCache(true);
|
||||
|
||||
if(!windowSelectOnly) {
|
||||
connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close);
|
||||
connect(installer, &ZipInstaller::done, logger, &ProgressLoggerGui::setFinished);
|
||||
}
|
||||
connect(installer, &ZipInstaller::logItem, logger, &ProgressLoggerGui::addItem);
|
||||
connect(installer, &ZipInstaller::logProgress, logger, &ProgressLoggerGui::setProgress);
|
||||
connect(installer, &ZipInstaller::done, this, &ThemesInstallWindow::done);
|
||||
connect(installer, &ZipInstaller::done, this, &ThemesInstallWindow::finished);
|
||||
connect(logger, &ProgressLoggerGui::aborted, installer, &ZipInstaller::abort);
|
||||
installer->install();
|
||||
}
|
||||
|
|
|
@ -36,17 +36,16 @@ class ThemesInstallWindow : public QDialog
|
|||
public:
|
||||
ThemesInstallWindow(QWidget* parent = 0);
|
||||
~ThemesInstallWindow();
|
||||
void downloadInfo(void);
|
||||
void show(void);
|
||||
void setLogger(ProgressLoggerGui* l) { logger = l; }
|
||||
void setSelectOnly(bool state) { windowSelectOnly = state; }
|
||||
void install(void);
|
||||
|
||||
public slots:
|
||||
void accept(void);
|
||||
void buttonOk(void);
|
||||
|
||||
signals:
|
||||
void done(bool);
|
||||
void selected(int);
|
||||
void finished(bool);
|
||||
|
||||
private:
|
||||
Ui::ThemeInstallFrm ui;
|
||||
|
@ -62,9 +61,9 @@ class ThemesInstallWindow : public QDialog
|
|||
QString fileName;
|
||||
|
||||
QString infocachedir;
|
||||
bool windowSelectOnly;
|
||||
|
||||
private slots:
|
||||
void downloadInfo(void);
|
||||
void downloadDone(QNetworkReply::NetworkError error);
|
||||
void updateImage(QNetworkReply::NetworkError error);
|
||||
void abort(void);
|
||||
|
|
Loading…
Reference in a new issue