From 40ce2b41331888d6284fff6e709789e939cc6a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A1stor=20Mu=C3=B1oz?= Date: Fri, 8 Jan 2016 23:56:27 +0100 Subject: rbutil: add abort signal for bootloader install/uninstall 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 --- rbutil/rbutilqt/base/bootloaderinstallbase.cpp | 7 +++++++ rbutil/rbutilqt/base/bootloaderinstallbase.h | 2 ++ rbutil/rbutilqt/gui/selectiveinstallwidget.cpp | 2 ++ rbutil/rbutilqt/rbutilqt.cpp | 2 ++ 4 files changed, 13 insertions(+) (limited to 'rbutil') diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp index 9a1c74c690..15ced2e435 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp @@ -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. diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.h b/rbutil/rbutilqt/base/bootloaderinstallbase.h index 0e970c4af6..23aac4f92f 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallbase.h +++ b/rbutil/rbutilqt/base/bootloaderinstallbase.h @@ -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. @@ -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. diff --git a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp index 35837ba41d..843fa63cad 100644 --- a/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp +++ b/rbutil/rbutilqt/gui/selectiveinstallwidget.cpp @@ -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(); diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 1444f4509d..8f4ee582d5 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -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(); -- cgit v1.2.3