On 5/12/19 9:30 PM, Scott Kostyshak wrote: > On Sun, May 12, 2019 at 04:47:58PM -0400, Richard Kimberly Heck wrote: >> On 5/12/19 4:12 PM, Guenter Milde wrote: >>> Dear LyX developers, >>> >>> "It is now possible to cancel background export processes. A menu entry >>> to do so will appear on the Document menu when such a process is underway." >>> >>> -- RELEADE-NOTES >>> >>> >>> May I suggest to make the "background process indicator icon" >>> (the animation in the right corner of the status bar) interactive? >>> IMV it would be good to open a "cancel export process" dialogue when clickin >>> on it. >> I agree, and even thought of that, but I do not myself know how to do >> it. If someone can give me an outline---or maybe just tell me where that >> little spinner thing gets created---then I can do the work. > Not sure but is this the commit that added it? edf0e85f
Yes, thanks, that was helpful. Something like the following ought to work, but it won't link. I'm terrible at linker errors. Help? Riki
diff --git a/src/frontends/qt4/GuiClickableLabel.h b/src/frontends/qt4/GuiClickableLabel.h index c058e41089..3f17ef0c9e 100644 --- a/src/frontends/qt4/GuiClickableLabel.h +++ b/src/frontends/qt4/GuiClickableLabel.h @@ -25,7 +25,7 @@ public: : QLabel(parent) {} - ~QClickableLabel() {} + ~GuiClickableLabel() {} Q_SIGNALS: void clicked(); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 98dba1dfa5..2742c3ea1c 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -19,6 +19,7 @@ #include "FileDialog.h" #include "FontLoader.h" #include "GuiApplication.h" +#include "GuiClickableLabel.h" #include "GuiCommandBuffer.h" #include "GuiCompleter.h" #include "GuiKeySymbol.h" @@ -610,7 +611,7 @@ GuiView::GuiView(int id) setAcceptDrops(true); // add busy indicator to statusbar - QLabel * busylabel = new QLabel(statusBar()); + GuiClickableLabel * busylabel = new GuiClickableLabel(statusBar()); statusBar()->addPermanentWidget(busylabel); search_mode mode = theGuiApp()->imageSearchMode(); QString fn = toqstr(lyx::libFileSearch("images", "busy", "gif", mode).absFileName()); @@ -623,6 +624,7 @@ GuiView::GuiView(int id) busylabel, SLOT(show())); connect(&d.processing_thread_watcher_, SIGNAL(finished()), busylabel, SLOT(hide())); + connect(busylabel, SLOT(clicked()), this, SIGNAL(checkCancelBackground())); QFontMetrics const fm(statusBar()->fontMetrics()); int const iconheight = max(int(d.normalIconSize), fm.height()); @@ -713,6 +715,18 @@ void GuiView::disableShellEscape() } +void GuiView::checkCancelBackground() +{ + docstring const ttl = _("Cancel Export?"); + docstring const msg = _("Do you want to cancel the background export process?"); + int const ret = + Alert::prompt(ttl, msg, 1, 1, + _("&Cancel export"), _("Co&ntinue")); + if (ret == 0) + Systemcall::killscript(); +} + + QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas() { QVector<GuiWorkArea*> areas; diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index fa36f7ff8b..5dd84f3798 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -231,6 +231,8 @@ public Q_SLOTS: void updateWindowTitle(GuiWorkArea * wa); /// void disableShellEscape(); + /// + void checkCancelBackground(); private Q_SLOTS: /// diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index e2e3e1ce5e..488e8ba224 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -198,6 +198,7 @@ MOCHEADER = \ GuiCharacter.h \ GuiCitation.h \ GuiClipboard.h \ + GuiClickableLabel.h \ GuiCommandBuffer.h \ GuiCommandEdit.h \ GuiCompare.h \