Skip to content

Commit

Permalink
rbutil: add abort signal for bootloader install/uninstall
Browse files Browse the repository at this point in the history
During the bootloader install/uninstall process, a signal
is emitted when "Abort" button is pressed, the installers
can attach this signal and cancel the process.

Change-Id: I7f297b8031d7a2d93da0022081aaef03ef041baf
  • Loading branch information
Cástor Muñoz authored and bluebrother committed Aug 15, 2016
1 parent e4af973 commit 40ce2b4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rbutil/rbutilqt/base/bootloaderinstallbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ void BootloaderInstallBase::installBlfile(void)
}


void BootloaderInstallBase::progressAborted(void)
{
LOG_INFO() << "progressAborted(void)";
emit installAborted();
}


//! @brief backup OF file.
//! @param to folder to write backup file to. Folder will get created.
//! @return true on success, false on error.
Expand Down
2 changes: 2 additions & 0 deletions rbutil/rbutilqt/base/bootloaderinstallbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class BootloaderInstallBase : public QObject
void downloadReqFinished(int id, bool error);
void downloadBlFinish(bool error);
void installBlfile(void);
void progressAborted(void);

// NOTE: we need to keep this slot even on targets that don't need it
// -- using the preprocessor here confused moc.
Expand Down Expand Up @@ -101,6 +102,7 @@ class BootloaderInstallBase : public QObject

signals:
void downloadDone(void); //! internal signal sent when download finished.
void installAborted(void); //! internal signal sent on abort button click.
void done(bool);
void logItem(QString, int); //! set logger item
void logProgress(int, int); //! set progress bar.
Expand Down
2 changes: 2 additions & 0 deletions rbutil/rbutilqt/gui/selectiveinstallwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ void SelectiveInstallWidget::installBootloader(void)
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)));
// pass Abort button click signal to current installer
connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted()));

// set bootloader filename. Do this now as installed() needs it.
QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
Expand Down
2 changes: 2 additions & 0 deletions rbutil/rbutilqt/rbutilqt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ void RbUtilQt::uninstallBootloader(void)
connect(bl, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
connect(bl, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
connect(bl, SIGNAL(done(bool)), logger, SLOT(setFinished()));
// pass Abort button click signal to current installer
connect(logger, SIGNAL(aborted()), bl, SLOT(progressAborted()));

bl->uninstall();

Expand Down

0 comments on commit 40ce2b4

Please sign in to comment.