mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Separate select and install parts in themes install window.
Allow using the themes installation dialog as selection dialog separately from installing themes. For this the installation is now triggered separately and can be told to not to do the installation on Ok button. In this case the dialog is selection only, and the Ok button is changed to Select. The installation itself is still done in the class but started by calling the install() method separately. Change-Id: I856db8204788302b2b539e6d8283f73cb354f033
This commit is contained in:
parent
f419128a6b
commit
9b783bc105
2 changed files with 29 additions and 5 deletions
|
|
@ -46,6 +46,8 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
|
|||
this, SLOT(updateDetails(QListWidgetItem*, QListWidgetItem*)));
|
||||
connect(ui.listThemes, SIGNAL(itemSelectionChanged()), this, SLOT(updateSize()));
|
||||
connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool)));
|
||||
|
||||
logger = NULL;
|
||||
}
|
||||
|
||||
ThemesInstallWindow::~ThemesInstallWindow()
|
||||
|
|
@ -285,6 +287,9 @@ void ThemesInstallWindow::resizeEvent(QResizeEvent* e)
|
|||
void ThemesInstallWindow::show()
|
||||
{
|
||||
QDialog::show();
|
||||
if(windowSelectOnly)
|
||||
ui.buttonOk->setText(tr("Select"));
|
||||
|
||||
logger = new ProgressLoggerGui(this);
|
||||
logger->show();
|
||||
logger->addItem(tr("getting themes information ..."), LOGINFO);
|
||||
|
|
@ -304,7 +309,16 @@ void ThemesInstallWindow::abort()
|
|||
}
|
||||
|
||||
|
||||
void ThemesInstallWindow::accept()
|
||||
void ThemesInstallWindow::accept(void)
|
||||
{
|
||||
if(!windowSelectOnly)
|
||||
install();
|
||||
else
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
void ThemesInstallWindow::install()
|
||||
{
|
||||
if(ui.listThemes->selectedItems().size() == 0) {
|
||||
this->close();
|
||||
|
|
@ -329,6 +343,7 @@ void ThemesInstallWindow::accept()
|
|||
}
|
||||
qDebug() << "[Themes] installing:" << themes;
|
||||
|
||||
if(logger == NULL)
|
||||
logger = new ProgressLoggerGui(this);
|
||||
logger->show();
|
||||
QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
||||
|
|
@ -348,13 +363,15 @@ void ThemesInstallWindow::accept()
|
|||
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
||||
installer->setCache(true);
|
||||
|
||||
if(!windowSelectOnly) {
|
||||
connect(logger, SIGNAL(closed()), this, SLOT(close()));
|
||||
connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
||||
}
|
||||
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(installer, SIGNAL(done(bool)), this, SIGNAL(done(bool)));
|
||||
connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
|
||||
installer->install();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,10 +38,16 @@ class ThemesInstallWindow : public QDialog
|
|||
~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);
|
||||
|
||||
signals:
|
||||
void done(bool);
|
||||
|
||||
private:
|
||||
Ui::ThemeInstallFrm ui;
|
||||
HttpGet *getter;
|
||||
|
|
@ -56,6 +62,7 @@ class ThemesInstallWindow : public QDialog
|
|||
QString fileName;
|
||||
|
||||
QString infocachedir;
|
||||
bool windowSelectOnly;
|
||||
|
||||
private slots:
|
||||
void downloadDone(bool);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue