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 QCoreApplication
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-i2mprog.h"
2631#include " i2mprogdialog.h" // for I2MProgDialog
@@ -41,11 +46,19 @@ int Addons::doI2MProg(QWidget* parent, QSettings* settings, QString& tx)
4146 dlg->loadSettings (I2MProgOptions ());
4247 }
4348
44- if (dlg->exec () == QDialog::Accepted) {
45- I2MProgOptions opt = dlg->options ();
46- result = Utils::i2mprog (tx, opt.axes , opt.toInch , opt.prec );
49+ if (dlg->exec () != QDialog::Accepted) {
50+ return 0 ;
4751 }
4852
53+ LongJobHelper helper{parent};
54+ helper.begin (tx.length (), QCoreApplication::translate (" Addons::Actions" , " Converting inch to metric" ), 20 );
55+
56+ I2MProgOptions opt = dlg->options ();
57+ result = Utils::i2mprog (tx, opt.axes , opt.toInch , opt.prec , [&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