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.
This commit is contained in:
Scott Kostyshak 2022-11-22 14:46:00 -05:00
parent 01abab9ad9
commit 3b30dbfca4
2 changed files with 14 additions and 6 deletions

View File

@ -835,10 +835,7 @@ void GuiView::checkCancelBackground()
Alert::prompt(ttl, msg, 1, 1, Alert::prompt(ttl, msg, 1, 1,
_("&Cancel export"), _("Co&ntinue")); _("&Cancel export"), _("Co&ntinue"));
if (ret == 0) { if (ret == 0) {
Systemcall::killscript(); cancelExport();
// stop busy signal immediately so that in the subsequent
// "Export canceled" prompt the status bar icons are accurate.
Q_EMIT scriptKilled();
} }
} }
@ -4448,8 +4445,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
break; break;
} }
case LFUN_EXPORT_CANCEL: { case LFUN_EXPORT_CANCEL: {
Systemcall::killscript(); cancelExport();
Q_EMIT scriptKilled();
break; break;
} }
case LFUN_BUFFER_SWITCH: { 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() void GuiView::toggleFullScreen()
{ {
setWindowState(windowState() ^ Qt::WindowFullScreen); setWindowState(windowState() ^ Qt::WindowFullScreen);

View File

@ -408,6 +408,9 @@ private:
/// ///
bool lfunUiToggle(std::string const & ui_component); bool lfunUiToggle(std::string const & ui_component);
/// ///
/// kill the script and hide export-in-progress status bar icons
void cancelExport();
///
void toggleFullScreen(); void toggleFullScreen();
/// \return whether we did anything /// \return whether we did anything
bool insertLyXFile(docstring const & fname, bool ignorelang = false); bool insertLyXFile(docstring const & fname, bool ignorelang = false);