commit 869247b6179cd820840153b41028e66a123a210f
Author: Juergen Spitzmueller <[email protected]>
Date:   Mon Nov 21 18:56:28 2022 +0100

    Add button to stop processing
    
    (rather than having it stop by clicking on the spinner)
---
 lib/Makefile.am              |    1 +
 lib/images/process-stop.svgz |  Bin 0 -> 1255 bytes
 src/frontends/qt/GuiView.cpp |   23 ++++++++++++++++-------
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/lib/Makefile.am b/lib/Makefile.am
index bff08ad..81cf05e 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -661,6 +661,7 @@ dist_images_DATA1X = \
        images/outline-out+rtl.svgz \
        images/outline-up.svgz \
        images/paste.svgz \
+       images/process-stop.svgz \
        images/redo.svgz \
        images/reload.svgz \
        images/search-case-sensitive.svgz \
diff --git a/lib/images/process-stop.svgz b/lib/images/process-stop.svgz
new file mode 100644
index 0000000..013e4a4
Binary files /dev/null and b/lib/images/process-stop.svgz differ
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index d51dcc6..2ec5037 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -633,6 +633,10 @@ GuiView::GuiView(int id)
        // For Drag&Drop.
        setAcceptDrops(true);
 
+       QFontMetrics const fm(statusBar()->fontMetrics());
+       int const iconheight = max(int(d.normalIconSize), fm.height());
+       QSize const iconsize(iconheight, iconheight);
+
        // add busy indicator to statusbar
        search_mode mode = theGuiApp()->imageSearchMode();
        QString fn = toqstr(lyx::libFileSearch("images", "busy", "svgz", 
mode).absFileName());
@@ -641,12 +645,23 @@ GuiView::GuiView(int id)
        // make busy indicator square with 5px margins
        busySVG->setMaximumSize(busySVG->height() - 5, busySVG->height() - 5);
        busySVG->hide();
+       // Add cancel button
+       QPixmap ps = QIcon(getPixmap("images/", "process-stop", 
"svgz")).pixmap(iconsize);
+       GuiClickableLabel * processStop = new GuiClickableLabel(statusBar());
+       processStop->setPixmap(ps);
+       processStop->setToolTip(qt_("Click here to stop export/output 
process"));
+       processStop->hide();
+       statusBar()->addPermanentWidget(processStop);
 
        connect(&d.processing_thread_watcher_, SIGNAL(started()),
                busySVG, SLOT(show()));
        connect(&d.processing_thread_watcher_, SIGNAL(finished()),
                busySVG, SLOT(hide()));
-       connect(busySVG, SIGNAL(pressed()), this, 
SLOT(checkCancelBackground()));
+       connect(&d.processing_thread_watcher_, SIGNAL(started()),
+               processStop, SLOT(show()));
+       connect(&d.processing_thread_watcher_, SIGNAL(finished()),
+               processStop, SLOT(hide()));
+       connect(processStop, SIGNAL(pressed()), this, 
SLOT(checkCancelBackground()));
 
        stat_counts_ = new GuiClickableLabel(statusBar());
        stat_counts_->setAlignment(Qt::AlignCenter);
@@ -656,9 +671,6 @@ GuiView::GuiView(int id)
 
        connect(stat_counts_, SIGNAL(clicked()), this, SLOT(statsPressed()));
 
-
-       QFontMetrics const fm(statusBar()->fontMetrics());
-
        zoom_slider_ = new QSlider(Qt::Horizontal, statusBar());
        // Small size slider for macOS to prevent the status bar from enlarging
        zoom_slider_->setAttribute(Qt::WA_MacSmallSize);
@@ -730,9 +742,6 @@ GuiView::GuiView(int id)
        // enable pinch to zoom
        grabGesture(Qt::PinchGesture);
 
-       int const iconheight = max(int(d.normalIconSize), fm.height());
-       QSize const iconsize(iconheight, iconheight);
-
        QPixmap shellescape = QIcon(getPixmap("images/", "emblem-shellescape", 
"svgz,png")).pixmap(iconsize);
        shell_escape_ = new QLabel(statusBar());
        shell_escape_->setPixmap(shellescape);
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to