11/*
22 * Copyright (C) 2006-2018 by Artur Kozioł, artkoz78@gmail.com
3- * Copyright (C) 2023 Nick Egorrov, nicegorov@yandex.ru
3+ * Copyright (C) 2023-2025 Nick Egorrov, nicegorov@yandex.ru
44 *
55 * This file is part of GCodeWorkShop.
66 *
1818 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1919 */
2020
21- #include < QDialog> // for QDialog
22- #include < QString> // for QString
23- #include < QWidget> // for QWidget
21+ #include < functional> // for function
22+
23+ #include < QCoreApplication> // for translate
24+ #include < QDialog> // for QDialog
25+ #include < QString> // for QString
26+ #include < QWidget> // for QWidget
27+
28+ #include < ui/longjobhelper.h> // for LongJobHelper, LongJobHelper::CANCEL
2429
2530#include " addons-dot.h"
2631#include " dotdialog.h" // for DotDialog
@@ -41,11 +46,19 @@ int Addons::doDot(QWidget* parent, QSettings* settings, QString& tx)
4146 dlg->loadSettings (DotOptions ());
4247 }
4348
44- if (dlg->exec () == QDialog::Accepted) {
45- DotOptions opt = dlg->options ();
46- result = Utils::insertDot (tx, opt.axes , opt.convert , opt.divider );
49+ if (dlg->exec () != QDialog::Accepted) {
50+ return 0 ;
4751 }
4852
53+ LongJobHelper helper{parent};
54+ helper.begin (tx.length (), QCoreApplication::translate (" Addons::Actions" , " Inserting dots" ), 20 );
55+
56+ DotOptions opt = dlg->options ();
57+ result = Utils::insertDot (tx, opt.axes , opt.convert , opt.divider , [&helper](int pos) -> bool {
58+ return helper.check (pos) == LongJobHelper::CANCEL;
59+ });
60+
61+ helper.end ();
4962 dlg->deleteLater ();
5063 return result;
5164}
0 commit comments