commit 3b30dbfca4936adac9a6eb94fced33d36e617734
Author: Scott Kostyshak <[email protected]>
Date:   Tue Nov 22 14:46:00 2022 -0500

    Centralize cancelation of export
    
    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 |   17 +++++++++++------
 src/frontends/qt/GuiView.h   |    3 +++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 8269ff0..2c409d6 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -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);
diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h
index 5b22ea5..7bac490 100644
--- a/src/frontends/qt/GuiView.h
+++ b/src/frontends/qt/GuiView.h
@@ -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);
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to