]> git.lyx.org Git - features.git/commitdiff
Centralize cancelation of export
authorScott Kostyshak <skostysh@lyx.org>
Tue, 22 Nov 2022 19:46:00 +0000 (14:46 -0500)
committerScott Kostyshak <skostysh@lyx.org>
Tue, 22 Nov 2022 19:55:26 +0000 (14:55 -0500)
An export can be canceled by clicking on the status bar icon or by
executing export-cancel (e.g., via Document > Cancel Background
Process).

The centralized code kills the script and updates the status bar
icons.

No change in functionality intended.

Related commits: 70a71a82 and 01abab9a.

src/frontends/qt/GuiView.cpp
src/frontends/qt/GuiView.h

index 8269ff09cceec5164a8882c2045b17d6992678c4..2c409d626e64baeff529a4420ce8842b63bad76e 100644 (file)
@@ -835,10 +835,7 @@ void GuiView::checkCancelBackground()
                Alert::prompt(ttl, msg, 1, 1,
                        _("&Cancel export"), _("Co&ntinue"));
        if (ret == 0) {
-               Systemcall::killscript();
-               // stop busy signal immediately so that in the subsequent
-               // "Export canceled" prompt the status bar icons are accurate.
-               Q_EMIT scriptKilled();
+               cancelExport();
        }
 }
 
@@ -4448,8 +4445,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        break;
                }
                case LFUN_EXPORT_CANCEL: {
-                       Systemcall::killscript();
-                       Q_EMIT scriptKilled();
+                       cancelExport();
                        break;
                }
                case LFUN_BUFFER_SWITCH: {
@@ -5099,6 +5095,15 @@ bool GuiView::lfunUiToggle(string const & ui_component)
 }
 
 
+void GuiView::cancelExport()
+{
+       Systemcall::killscript();
+       // stop busy signal immediately so that in the subsequent
+       // "Export canceled" prompt the status bar icons are accurate.
+       Q_EMIT scriptKilled();
+}
+
+
 void GuiView::toggleFullScreen()
 {
        setWindowState(windowState() ^ Qt::WindowFullScreen);
index 5b22ea574b8a618dd77d1c56056a519c835ee6d2..7bac49091fe0d9d6c9be20c807aae92b3acb88a7 100644 (file)
@@ -408,6 +408,9 @@ private:
        ///
        bool lfunUiToggle(std::string const & ui_component);
        ///
+       /// kill the script and hide export-in-progress status bar icons
+       void cancelExport();
+       ///
        void toggleFullScreen();
        /// \return whether we did anything
        bool insertLyXFile(docstring const & fname, bool ignorelang = false);