diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2022-04-17 22:28:13 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2022-04-17 23:21:19 +0200 |
commit | 37a60d54619e957cbc3f7d9a49bd152f674df8e6 (patch) | |
tree | fca1fc420fa6fcf041ad52836ce775d57d49bfdc /utils/rbutilqt/themesinstallwindow.cpp | |
parent | 62108a96137dff6fefb61d2af8dc59e8716ccb96 (diff) | |
download | rockbox-37a60d54619e957cbc3f7d9a49bd152f674df8e6.tar.gz rockbox-37a60d54619e957cbc3f7d9a49bd152f674df8e6.zip |
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
Diffstat (limited to 'utils/rbutilqt/themesinstallwindow.cpp')
-rw-r--r-- | utils/rbutilqt/themesinstallwindow.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/utils/rbutilqt/themesinstallwindow.cpp b/utils/rbutilqt/themesinstallwindow.cpp index 7edfc91cd1..3dd564c5e5 100644 --- a/utils/rbutilqt/themesinstallwindow.cpp +++ b/utils/rbutilqt/themesinstallwindow.cpp | |||
@@ -44,7 +44,7 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent) | |||
44 | ui.themeDescription->setLayoutDirection(Qt::LeftToRight); | 44 | ui.themeDescription->setLayoutDirection(Qt::LeftToRight); |
45 | 45 | ||
46 | connect(ui.buttonCancel, &QAbstractButton::clicked, this, &QWidget::close); | 46 | connect(ui.buttonCancel, &QAbstractButton::clicked, this, &QWidget::close); |
47 | connect(ui.buttonOk, &QAbstractButton::clicked, this, &ThemesInstallWindow::accept); | 47 | connect(ui.buttonOk, &QAbstractButton::clicked, this, &ThemesInstallWindow::buttonOk); |
48 | connect(ui.listThemes, &QListWidget::currentItemChanged, | 48 | connect(ui.listThemes, &QListWidget::currentItemChanged, |
49 | this, &ThemesInstallWindow::updateDetails); | 49 | this, &ThemesInstallWindow::updateDetails); |
50 | connect(ui.listThemes, &QListWidget::itemSelectionChanged, this, &ThemesInstallWindow::updateSize); | 50 | connect(ui.listThemes, &QListWidget::itemSelectionChanged, this, &ThemesInstallWindow::updateSize); |
@@ -287,8 +287,7 @@ void ThemesInstallWindow::resizeEvent(QResizeEvent* e) | |||
287 | void ThemesInstallWindow::show() | 287 | void ThemesInstallWindow::show() |
288 | { | 288 | { |
289 | QDialog::show(); | 289 | QDialog::show(); |
290 | if(windowSelectOnly) | 290 | ui.buttonOk->setText(tr("Select")); |
291 | ui.buttonOk->setText(tr("Select")); | ||
292 | 291 | ||
293 | if(!logger) | 292 | if(!logger) |
294 | logger = new ProgressLoggerGui(this); | 293 | logger = new ProgressLoggerGui(this); |
@@ -309,16 +308,14 @@ void ThemesInstallWindow::abort() | |||
309 | { | 308 | { |
310 | igetter.abort(); | 309 | igetter.abort(); |
311 | logger->setFinished(); | 310 | logger->setFinished(); |
312 | this->close(); | 311 | close(); |
313 | } | 312 | } |
314 | 313 | ||
315 | 314 | ||
316 | void ThemesInstallWindow::accept(void) | 315 | void ThemesInstallWindow::buttonOk(void) |
317 | { | 316 | { |
318 | if(!windowSelectOnly) | 317 | emit selected(ui.listThemes->selectedItems().size()); |
319 | install(); | 318 | close(); |
320 | else | ||
321 | close(); | ||
322 | } | 319 | } |
323 | 320 | ||
324 | 321 | ||
@@ -326,7 +323,6 @@ void ThemesInstallWindow::install() | |||
326 | { | 323 | { |
327 | if(ui.listThemes->selectedItems().size() == 0) { | 324 | if(ui.listThemes->selectedItems().size() == 0) { |
328 | logger->addItem(tr("No themes selected, skipping"), LOGINFO); | 325 | logger->addItem(tr("No themes selected, skipping"), LOGINFO); |
329 | emit done(false); | ||
330 | return; | 326 | return; |
331 | } | 327 | } |
332 | QStringList themes; | 328 | QStringList themes; |
@@ -368,13 +364,9 @@ void ThemesInstallWindow::install() | |||
368 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) | 364 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
369 | installer->setCache(true); | 365 | installer->setCache(true); |
370 | 366 | ||
371 | if(!windowSelectOnly) { | ||
372 | connect(logger, &ProgressLoggerGui::closed, this, &QWidget::close); | ||
373 | connect(installer, &ZipInstaller::done, logger, &ProgressLoggerGui::setFinished); | ||
374 | } | ||
375 | connect(installer, &ZipInstaller::logItem, logger, &ProgressLoggerGui::addItem); | 367 | connect(installer, &ZipInstaller::logItem, logger, &ProgressLoggerGui::addItem); |
376 | connect(installer, &ZipInstaller::logProgress, logger, &ProgressLoggerGui::setProgress); | 368 | connect(installer, &ZipInstaller::logProgress, logger, &ProgressLoggerGui::setProgress); |
377 | connect(installer, &ZipInstaller::done, this, &ThemesInstallWindow::done); | 369 | connect(installer, &ZipInstaller::done, this, &ThemesInstallWindow::finished); |
378 | connect(logger, &ProgressLoggerGui::aborted, installer, &ZipInstaller::abort); | 370 | connect(logger, &ProgressLoggerGui::aborted, installer, &ZipInstaller::abort); |
379 | installer->install(); | 371 | installer->install(); |
380 | } | 372 | } |