mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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::BackupPath, "backuppath", "" },
|
||||||
{ RbSettings::InstallRockbox, "install_rockbox", "true" },
|
{ RbSettings::InstallRockbox, "install_rockbox", "true" },
|
||||||
{ RbSettings::InstallFonts, "install_fonts", "true" },
|
{ RbSettings::InstallFonts, "install_fonts", "true" },
|
||||||
{ RbSettings::InstallThemes, "install_themes", "false" },
|
|
||||||
{ RbSettings::InstallPluginData, "install_plugin_data", "true" },
|
{ RbSettings::InstallPluginData, "install_plugin_data", "true" },
|
||||||
{ RbSettings::InstallVoice, "install_voice", "false" },
|
{ RbSettings::InstallVoice, "install_voice", "false" },
|
||||||
{ RbSettings::InstallManual, "install_manual", "false" },
|
{ RbSettings::InstallManual, "install_manual", "false" },
|
||||||
|
|
|
@ -44,7 +44,6 @@ class RbSettings : public QObject
|
||||||
BackupPath,
|
BackupPath,
|
||||||
InstallRockbox,
|
InstallRockbox,
|
||||||
InstallFonts,
|
InstallFonts,
|
||||||
InstallThemes,
|
|
||||||
InstallPluginData,
|
InstallPluginData,
|
||||||
InstallVoice,
|
InstallVoice,
|
||||||
InstallManual,
|
InstallManual,
|
||||||
|
|
|
@ -36,7 +36,6 @@ SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
ui.rockboxCheckbox->setChecked(RbSettings::value(RbSettings::InstallRockbox).toBool());
|
ui.rockboxCheckbox->setChecked(RbSettings::value(RbSettings::InstallRockbox).toBool());
|
||||||
ui.fontsCheckbox->setChecked(RbSettings::value(RbSettings::InstallFonts).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.pluginDataCheckbox->setChecked(RbSettings::value(RbSettings::InstallPluginData).toBool());
|
||||||
ui.voiceCheckbox->setChecked(RbSettings::value(RbSettings::InstallVoice).toBool());
|
ui.voiceCheckbox->setChecked(RbSettings::value(RbSettings::InstallVoice).toBool());
|
||||||
ui.manualCheckbox->setChecked(RbSettings::value(RbSettings::InstallManual).toBool());
|
ui.manualCheckbox->setChecked(RbSettings::value(RbSettings::InstallManual).toBool());
|
||||||
|
@ -52,14 +51,16 @@ SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent
|
||||||
|
|
||||||
m_logger = nullptr;
|
m_logger = nullptr;
|
||||||
m_zipinstaller = 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,
|
connect(ui.installButton, &QAbstractButton::clicked,
|
||||||
this, &SelectiveInstallWidget::startInstall);
|
this, &SelectiveInstallWidget::startInstall);
|
||||||
connect(this, &SelectiveInstallWidget::installSkipped,
|
connect(this, &SelectiveInstallWidget::installSkipped,
|
||||||
this, &SelectiveInstallWidget::continueInstall);
|
this, &SelectiveInstallWidget::continueInstall);
|
||||||
connect(ui.themesCustomize, &QAbstractButton::clicked,
|
connect(ui.themesCustomize, &QAbstractButton::clicked,
|
||||||
this, &SelectiveInstallWidget::customizeThemes);
|
[this]() { m_themesinstaller->show(); } );
|
||||||
connect(ui.selectedVersion, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui.selectedVersion, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &SelectiveInstallWidget::selectedVersionChanged);
|
this, &SelectiveInstallWidget::selectedVersionChanged);
|
||||||
// update version information. This also handles setting the previously
|
// 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::InstallRockbox, ui.rockboxCheckbox->isChecked());
|
||||||
RbSettings::setValue(RbSettings::InstallFonts, ui.fontsCheckbox->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::InstallPluginData, ui.pluginDataCheckbox->isChecked());
|
||||||
RbSettings::setValue(RbSettings::InstallVoice, ui.voiceCheckbox->isChecked());
|
RbSettings::setValue(RbSettings::InstallVoice, ui.voiceCheckbox->isChecked());
|
||||||
RbSettings::setValue(RbSettings::InstallManual, ui.manualCheckbox->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)
|
void SelectiveInstallWidget::installThemes(void)
|
||||||
{
|
{
|
||||||
if(ui.themesCheckbox->isChecked()) {
|
if(ui.themesCheckbox->isChecked()) {
|
||||||
LOG_INFO() << "installing themes";
|
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->setLogger(m_logger);
|
||||||
m_themesinstaller->setModal(true);
|
m_themesinstaller->setModal(true);
|
||||||
m_themesinstaller->install();
|
m_themesinstaller->install();
|
||||||
|
connect(m_themesinstaller, &ThemesInstallWindow::finished,
|
||||||
|
this, &SelectiveInstallWidget::continueInstall);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_INFO() << "Themes install disabled.";
|
LOG_INFO() << "Themes install disabled.";
|
||||||
|
|
|
@ -39,7 +39,6 @@ class SelectiveInstallWidget : public QWidget
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void continueInstall(bool);
|
void continueInstall(bool);
|
||||||
void customizeThemes(void);
|
|
||||||
void selectedVersionChanged(int);
|
void selectedVersionChanged(int);
|
||||||
void updateVoiceLangs();
|
void updateVoiceLangs();
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
|
||||||
ui.themeDescription->setLayoutDirection(Qt::LeftToRight);
|
ui.themeDescription->setLayoutDirection(Qt::LeftToRight);
|
||||||
|
|
||||||
connect(ui.buttonCancel, &QAbstractButton::clicked, this, &QWidget::close);
|
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,
|
connect(ui.listThemes, &QListWidget::currentItemChanged,
|
||||||
this, &ThemesInstallWindow::updateDetails);
|
this, &ThemesInstallWindow::updateDetails);
|
||||||
connect(ui.listThemes, &QListWidget::itemSelectionChanged, this, &ThemesInstallWindow::updateSize);
|
connect(ui.listThemes, &QListWidget::itemSelectionChanged, this, &ThemesInstallWindow::updateSize);
|
||||||
|
@ -287,8 +287,7 @@ void ThemesInstallWindow::resizeEvent(QResizeEvent* e)
|
||||||
void ThemesInstallWindow::show()
|
void ThemesInstallWindow::show()
|
||||||
{
|
{
|
||||||
QDialog::show();
|
QDialog::show();
|
||||||
if(windowSelectOnly)
|
ui.buttonOk->setText(tr("Select"));
|
||||||
ui.buttonOk->setText(tr("Select"));
|
|
||||||
|
|
||||||
if(!logger)
|
if(!logger)
|
||||||
logger = new ProgressLoggerGui(this);
|
logger = new ProgressLoggerGui(this);
|
||||||
|
@ -309,16 +308,14 @@ void ThemesInstallWindow::abort()
|
||||||
{
|
{
|
||||||
igetter.abort();
|
igetter.abort();
|
||||||
logger->setFinished();
|
logger->setFinished();
|
||||||
this->close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ThemesInstallWindow::accept(void)
|
void ThemesInstallWindow::buttonOk(void)
|
||||||
{
|
{
|
||||||
if(!windowSelectOnly)
|
emit selected(ui.listThemes->selectedItems().size());
|
||||||
install();
|
close();
|
||||||
else
|
|
||||||
close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,7 +323,6 @@ void ThemesInstallWindow::install()
|
||||||
{
|
{
|
||||||
if(ui.listThemes->selectedItems().size() == 0) {
|
if(ui.listThemes->selectedItems().size() == 0) {
|
||||||
logger->addItem(tr("No themes selected, skipping"), LOGINFO);
|
logger->addItem(tr("No themes selected, skipping"), LOGINFO);
|
||||||
emit done(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList themes;
|
QStringList themes;
|
||||||
|
@ -368,13 +364,9 @@ void ThemesInstallWindow::install()
|
||||||
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
||||||
installer->setCache(true);
|
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::logItem, logger, &ProgressLoggerGui::addItem);
|
||||||
connect(installer, &ZipInstaller::logProgress, logger, &ProgressLoggerGui::setProgress);
|
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);
|
connect(logger, &ProgressLoggerGui::aborted, installer, &ZipInstaller::abort);
|
||||||
installer->install();
|
installer->install();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,17 +36,16 @@ class ThemesInstallWindow : public QDialog
|
||||||
public:
|
public:
|
||||||
ThemesInstallWindow(QWidget* parent = 0);
|
ThemesInstallWindow(QWidget* parent = 0);
|
||||||
~ThemesInstallWindow();
|
~ThemesInstallWindow();
|
||||||
void downloadInfo(void);
|
|
||||||
void show(void);
|
void show(void);
|
||||||
void setLogger(ProgressLoggerGui* l) { logger = l; }
|
void setLogger(ProgressLoggerGui* l) { logger = l; }
|
||||||
void setSelectOnly(bool state) { windowSelectOnly = state; }
|
|
||||||
void install(void);
|
void install(void);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept(void);
|
void buttonOk(void);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done(bool);
|
void selected(int);
|
||||||
|
void finished(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ThemeInstallFrm ui;
|
Ui::ThemeInstallFrm ui;
|
||||||
|
@ -62,9 +61,9 @@ class ThemesInstallWindow : public QDialog
|
||||||
QString fileName;
|
QString fileName;
|
||||||
|
|
||||||
QString infocachedir;
|
QString infocachedir;
|
||||||
bool windowSelectOnly;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void downloadInfo(void);
|
||||||
void downloadDone(QNetworkReply::NetworkError error);
|
void downloadDone(QNetworkReply::NetworkError error);
|
||||||
void updateImage(QNetworkReply::NetworkError error);
|
void updateImage(QNetworkReply::NetworkError error);
|
||||||
void abort(void);
|
void abort(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue