-
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy path123.patch
More file actions
3045 lines (2784 loc) · 125 KB
/
123.patch
File metadata and controls
3045 lines (2784 loc) · 125 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d79e8fb..75c168a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,14 +15,14 @@ cmake_minimum_required(VERSION 3.24)
project(GERBER_X3 VERSION 0.9.0)
-set(CMAKE_CXX_STANDARD 20)
+set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
# SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
-set_property(GLOBAL PROPERTY CXX_STANDARD 20)
+set_property(GLOBAL PROPERTY CXX_STANDARD 23)
set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
add_definitions(
@@ -35,24 +35,11 @@ add_definitions(
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- add_compile_options(
- # -Winvalid-pch -pthread -Wall -Wextra -Wpedantic -Werror #
- # -Wsign-conversion -fmodules-ts
- )
- # add_compile_options(-rdynamic)# unix
-
- # link_directories(tbb/lib) Link against the dependency of Intel TBB (for
- # parallel C++17 algorithms) target_link_libraries(${PROJECT_NAME} tbb)
-
- # set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "gcc")
- # set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "${compiler_flags_for_module_map}
- # -fmodule-mapper=<MODULE_MAP_FILE>") target_compile_options(example PRIVATE
- # -fmodules-ts) add_compile_options(-H) add_compile_options(-ftime-report)
- # -pthread -ltbbD
+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
- # add_definitions(-D_USE_MATH_DEFINES=1)
+
endif()
# FIND BOOST
@@ -97,6 +84,20 @@ endif()
# add_library(Qt INTERFACE) target_precompile_headers(Qt INTERFACE qt_pch.h)
+include_directories(
+ ggeasy
+ plugins/file
+ plugins/gcode
+ plugins/shape
+ static_libs/clipper
+ static_libs/common
+ static_libs/filetree
+ static_libs/gi
+ static_libs/graphicsview
+ static_libs/tooldatabase
+ third_party/clipper2/CPP/Clipper2Lib/include
+ third_party/ctre/single-header)
+
set(CLIPPER2_UTILS OFF)
set(CLIPPER2_EXAMPLES OFF)
set(CLIPPER2_TESTS OFF)
@@ -116,20 +117,6 @@ find_package(
include(${CMAKE_SOURCE_DIR}/PATHS.cmake)
-include_directories(
- ggeasy
- plugins/file
- plugins/gcode
- plugins/shape
- static_libs/clipper
- static_libs/common
- static_libs/filetree
- static_libs/gi
- static_libs/graphicsview
- static_libs/tooldatabase
- third_party/clipper2/CPP/Clipper2Lib/include
- third_party/ctre/single-header)
-
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
diff --git a/PATHS.cmake b/PATHS.cmake
index 780e79c0..fc22c9db 100644
--- a/PATHS.cmake
+++ b/PATHS.cmake
@@ -34,3 +34,33 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PLUGINS_DIR})
# qt5_add_translation(TRANSLATION_QM ${TRANSLATION_FILES})
# endif(UPDATE_TRANSLATION_SOURCES) add_custom_target(translations DEPENDS
# ${TRANSLATION_QM})
+
+function(add_translation TARGET)
+ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
+ set(TRANSLATIONS ${TARGET}_ru.ts ${TARGET}_en.ts)
+ # qt_add_translations(TARGETS ${TARGET} TS_FILES ${TARGET}_ru.ts TS_FILES
+ # ${TARGET}_en.ts)
+
+ qt_create_translation(QM_FILES ${TRANSLATIONS})
+
+ # qt_add_executable(${PROJECT_NAME} MANUAL_FINALIZATION ${PROJECT_SOURCES})
+ # qt_create_translation(QM_FILES ${PROJECT_SOURCES} ${TS_FILES})
+ # qt_add_lupdate(${PROJECT_NAME} TS_FILES ${TS_FILES} SOURCES
+ # ${PROJECT_SOURCES}) qt_add_lrelease(${PROJECT_NAME} TS_FILES ${TS_FILES}
+ # QM_FILES_OUTPUT_VARIABLE QM_FILES)
+ else()
+ # add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
+ qt_create_translation(QM_FILES ${PROJECT_SOURCES} ${TS_FILES})
+ endif()
+ message(==> ${QM_FILES})
+ add_custom_target(${TARGET}_translations DEPENDS ${QM_FILES})
+ add_dependencies(${TARGET} ${TARGET}_translations)
+ set_source_files_properties(
+ ${QM_FILES} PROPERTIES OUTPUT_LOCATION ${OUTPUT_DIRECTORY}/translations)
+
+endfunction()
+
+# set(QT_TRANSLATION_DIR "${Qt6_DIR}/../../../translations") file(GLOB
+# QT_TRANSLATIONS ${QT_TRANSLATION_DIR}/*.qm)
+# qt_add_resources(ex-texteditor-cmake "qt-translations" PREFIX "/translations"
+# BASE ${QT_TRANSLATION_DIR} FILES ${QT_TRANSLATIONS})
diff --git a/ggeasy/CMakeLists.txt b/ggeasy/CMakeLists.txt
index 3322ee4c..8ada8a04 100644
--- a/ggeasy/CMakeLists.txt
+++ b/ggeasy/CMakeLists.txt
@@ -15,8 +15,6 @@ project(
VERSION 0.9.0.0
LANGUAGES CXX)
-# set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
# if(ANDROID) set(ANDROID_PACKAGE_SOURCE_DIR
# "${CMAKE_CURRENT_SOURCE_DIR}/android") if(ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS ${CMAKE_CURRENT_SOURCE_DIR} / path / to / libcrypto.so
@@ -51,12 +49,9 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
REQUIRED)
endif()
-if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
- qt6_add_resources(RESOURCES ${QRC_FILES})
-else()
- set(Qt5Core_RCC_EXECUTABLE /usr/share/qt5/bin/rcc)
- qt5_add_resources(RESOURCES ${QRC_FILES})
-endif()
+# if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt6_add_resources(RESOURCES
+# ${QRC_FILES}) else() set(Qt5Core_RCC_EXECUTABLE /usr/share/qt5/bin/rcc)
+# qt5_add_resources(RESOURCES ${QRC_FILES}) endif()
set(PROJECT_SOURCES ${APP_ICON_RESOURCE_WINDOWS} ${HEADERS} ${QRC_FILES}
${RESOURCES} ${SOURCES} ${UIS})
@@ -65,21 +60,18 @@ set_source_files_properties(
${TS_FILES} PROPERTIES OUTPUT_LOCATION "${OUTPUT_DIRECTORY}/translations")
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
- qt_add_executable(${PROJECT_NAME} MANUAL_FINALIZATION ${PROJECT_SOURCES})
+ # qt_add_executable(${PROJECT_NAME} MANUAL_FINALIZATION ${PROJECT_SOURCES})
qt_create_translation(QM_FILES ${PROJECT_SOURCES} ${TS_FILES})
- qt_add_lupdate(${PROJECT_NAME} TS_FILES ${TS_FILES} SOURCES
- ${PROJECT_SOURCES})
- # qt_add_lrelease(${PROJECT_NAME} TS_FILES ${TS_FILES}
+ # qt_add_lupdate(${PROJECT_NAME} TS_FILES ${TS_FILES} SOURCES
+ # ${PROJECT_SOURCES}) qt_add_lrelease(${PROJECT_NAME} TS_FILES ${TS_FILES}
# QM_FILES_OUTPUT_VARIABLE QM_FILES)
else()
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
- qt5_create_translation(QM_FILES ${PROJECT_SOURCES} ${TS_FILES})
+ # qt5_create_translation(QM_FILES ${PROJECT_SOURCES} ${TS_FILES})
# qt5_add_translation(${QM_FILES} ${TS_FILES})
endif()
-add_custom_target(translations DEPENDS ${QM_FILES})
-
-# target_precompile_headers(${PROJECT_NAME} PUBLIC a_pch.h)
+# add_translation(${PROJECT_NAME})
target_link_libraries(
${PROJECT_NAME}
diff --git a/ggeasy/debug.cpp b/ggeasy/debug.cpp
index 60f113b7..a6fef1d5 100644
--- a/ggeasy/debug.cpp
+++ b/ggeasy/debug.cpp
@@ -15,6 +15,12 @@
#include <QtWidgets>
#include <qfileinfo.h>
+void delay_ms(int ms) {
+ QEventLoop loop;
+ QTimer::singleShot(ms, [&loop] { loop.exit(); });
+ loop.exec();
+}
+
namespace QtPrivate {
template <>
inline QDebug printSequentialContainer(QDebug debug, const char* which, const QList<QAction*>& c) {
@@ -111,13 +117,13 @@ bool MainWindow::debug() {
QTimer::singleShot(time += delay, this, [this, THERMAL] { toolpathActions[THERMAL]->toggle(); });
}
- if(0) {
+ if(1) {
constexpr auto PROFILE = md5::hash32("Profile");
-
+ delay_ms(1000);
QTimer::singleShot(time += delay, this, [this] { selectAll(); });
QTimer::singleShot(time += delay, this, [this, PROFILE] { toolpathActions[PROFILE]->toggle(); });
- // QTimer::singleShot(i += k, this,[this] { dockWidget_->findChild<QPushButton*>("pbAddBridge")->click(); });
- // QTimer::singleShot(i += k, this,[this] { dockWidget_->findChild<QPushButton*>("pbCreate")->click(); });
+ // QTimer::singleShot(time += delay, this,[this] { dockWidget_->findChild<QPushButton*>("pbAddBridge")->click(); });
+ QTimer::singleShot(time += delay, this, [this] { dockWidget_->findChild<QPushButton*>("pbCreate")->click(); });
QTimer::singleShot(time += delay, this, [this] { App::grView().zoomFit(); });
}
@@ -125,11 +131,11 @@ bool MainWindow::debug() {
constexpr auto THREAD = md5::hash32("Thread");
QTimer::singleShot(time += delay, this, [this, THREAD] { toolpathActions[THREAD]->toggle(); });
- // QTimer::singleShot(i += k, this, [this] { selectAll(); });
- // QTimer::singleShot(i += k, this, [this, PROFILE] { toolpathActions[PROFILE]->toggle(); });
- // // QTimer::singleShot(i += k, this,[this] { dockWidget_->findChild<QPushButton*>("pbAddBridge")->click(); });
- // // QTimer::singleShot(i += k, this,[this] { dockWidget_->findChild<QPushButton*>("pbCreate")->click(); });
- // QTimer::singleShot(i += k, this, [this] { App::grView().zoomFit(); });
+ // QTimer::singleShot(time += delay, this, [this] { selectAll(); });
+ // QTimer::singleShot(time += delay, this, [this, PROFILE] { toolpathActions[PROFILE]->toggle(); });
+ // // QTimer::singleShot(time += delay, this,[this] { dockWidget_->findChild<QPushButton*>("pbAddBridge")->click(); });
+ // // QTimer::singleShot(time += delay, this,[this] { dockWidget_->findChild<QPushButton*>("pbCreate")->click(); });
+ // QTimer::singleShot(time += delay, this, [this] { App::grView().zoomFit(); });
}
if(0) {
@@ -158,14 +164,14 @@ bool MainWindow::debug() {
// if (0) {
// i = 1000;
- // QTimer::singleShot(i += k, this,[this] { selectAll(); });
- // QTimer::singleShot(i += k, this,[this] { toolpathActions[GCode::Pocket]->toggle(); });
- // // QTimer::singleShot(i += k, this,[this] { dockWidget_->findChild<QPushButton*>("pbAddBridge")->click(); });
- // QTimer::singleShot(i += k, this,[this] { dockWidget_->findChild<QPushButton*>("pbCreate")->click(); });
- // QTimer::singleShot(i += k, this,[this] { App::grView().zoomFit(); });
+ // QTimer::singleShot(time += delay, this,[this] { selectAll(); });
+ // QTimer::singleShot(time += delay, this,[this] { toolpathActions[GCode::Pocket]->toggle(); });
+ // // QTimer::singleShot(time += delay, this,[this] { dockWidget_->findChild<QPushButton*>("pbAddBridge")->click(); });
+ // QTimer::singleShot(time += delay, this,[this] { dockWidget_->findChild<QPushButton*>("pbCreate")->click(); });
+ // QTimer::singleShot(time += delay, this,[this] { App::grView().zoomFit(); });
// }
// if (0)
- // QTimer::singleShot(i += k, this,[this] { toolpathActions[GCode::Drill]->toggle(); });
+ // QTimer::singleShot(time += delay, this,[this] { toolpathActions[GCode::Drill]->toggle(); });
break;
}
return {};
diff --git a/ggeasy/mainwindow.cpp b/ggeasy/mainwindow.cpp
index b93ef99c..dbd91dfc 100644
--- a/ggeasy/mainwindow.cpp
+++ b/ggeasy/mainwindow.cpp
@@ -1,7 +1,6 @@
// This is a personal academic project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: https://pvs-studio.com
-
/********************************************************************************
* Author : Damir Bakiev *
* Version : na *
@@ -37,7 +36,6 @@
#include <QPrinter>
// #include <QtWidgets>
-
// static auto PointConverter = QMetaType::registerConverter(&Point::toString); NOTE
inline constexpr auto G_CODE_PROPERTIES = md5::hash32("GCodeProperties");
@@ -916,6 +914,10 @@ const QDockWidget* MainWindow::dockWidget() const { return dockWidget_; }
QDockWidget* MainWindow::dockWidget() { return dockWidget_; }
+void MainWindow::logMessage2(QtMsgType type, const QMessageLogContext& context, const QString& message) {
+ emit logMessage(type, {context.category, context.file, context.function, QString::number(context.line)}, message);
+}
+
void MainWindow::messageHandler(QtMsgType type, const QStringList& context, const QString& message) {
ui.loggingTextBrowser->setTextColor(QColor{128, 128, 128});
enum {
@@ -924,17 +926,17 @@ void MainWindow::messageHandler(QtMsgType type, const QStringList& context, cons
Function,
Line,
};
- ui.loggingTextBrowser->append(QString{"%1: %2 '%3'"}.arg(context[File], context[Line], context[Function].split('(').front()));
-
- switch(type) {
- // clang-format off
- case QtDebugMsg: ui.loggingTextBrowser->setTextColor(QColor{128, 128, 128}); break;
- case QtWarningMsg: ui.loggingTextBrowser->setTextColor(QColor{255, 128, 000}); break;
- case QtCriticalMsg: ui.loggingTextBrowser->setTextColor(QColor{255, 000, 000}); break;
- case QtFatalMsg: ui.loggingTextBrowser->setTextColor(QColor{255, 000, 000}); break;
- case QtInfoMsg: ui.loggingTextBrowser->setTextColor(QColor{128, 128, 255}); break;
- // clang-format on
- }
+ auto file = context[File].split("/").back();
+ static constexpr QColor color[]{
+ QColor{128, 128, 128}, // gray QtDebugMsg
+ QColor{255, 128, 000}, // orange QtWarningMsg
+ QColor{255, 000, 000}, // red QtCriticalMsg
+ QColor{255, 000, 000}, // red QtFatalMsg
+ QColor{128, 128, 255}, // blue QtInfoMsg
+ };
+ ui.loggingTextBrowser->setTextColor(*color);
+ ui.loggingTextBrowser->append("%1: %2 '%3'"_s.arg(file, context[Line], context[Function].split('(').front()));
+ ui.loggingTextBrowser->setTextColor(color[type]);
ui.loggingTextBrowser->append(message);
ui.loggingTextBrowser->append("");
ui.loggingTextBrowser->moveCursor(QTextCursor::MoveOperation::End);
diff --git a/ggeasy/mainwindow.h b/ggeasy/mainwindow.h
index f2a5f21d..a237eb58 100644
--- a/ggeasy/mainwindow.h
+++ b/ggeasy/mainwindow.h
@@ -318,6 +318,7 @@ public:
dockWidget_->show();
}
+ void logMessage2(QtMsgType type, const QMessageLogContext& context, const QString& message);
signals:
void parseFile(const QString& filename, int type);
void logMessage(QtMsgType type, const QStringList& context, const QString& message);
diff --git a/ggeasy/plugindialog.cpp b/ggeasy/plugindialog.cpp
index 54d3d079..29836ddb 100644
--- a/ggeasy/plugindialog.cpp
+++ b/ggeasy/plugindialog.cpp
@@ -84,19 +84,19 @@ DialogAboutPlugins::~DialogAboutPlugins() { }
void DialogAboutPlugins::setupUi(QDialog* Dialog) {
if(Dialog->objectName().isEmpty())
- Dialog->setObjectName(QString::fromUtf8("Dialog"));
+ Dialog->setObjectName(u""_s);
Dialog->resize(400, 300);
verticalLayout = new QVBoxLayout{Dialog};
verticalLayout->setSpacing(6);
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ verticalLayout->setObjectName(u""_s);
verticalLayout->setContentsMargins(6, 6, 6, 6);
treeWidget = new QTreeWidget{Dialog};
- treeWidget->setObjectName(QString::fromUtf8("treeWidget"));
+ treeWidget->setObjectName(u""_s);
verticalLayout->addWidget(treeWidget);
buttonBox = new QDialogButtonBox{Dialog};
- buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
+ buttonBox->setObjectName(u""_s);
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::NoButton);
// pbInfo = buttonBox->addButton("Info", QDialogButtonBox::HelpRole);
diff --git a/ggeasy/stacktrace_and_output.h b/ggeasy/stacktrace_and_output.h
index 5d0889ee..3e25892c 100644
--- a/ggeasy/stacktrace_and_output.h
+++ b/ggeasy/stacktrace_and_output.h
@@ -1,8 +1,11 @@
#pragma once
+#include "mainwindow.h"
+
+#include <QDebug>
+#include <app.h>
#include <csignal>
#include <string>
-#include <QDebug>
#if __cpp_lib_stacktrace
#include <QMessageLogContext>
@@ -118,6 +121,9 @@ inline void myMessageHandler(QtMsgType type, const QMessageLogContext& context,
while(file && *file)
if(*file++ == '\\')
context_.file = file;
+
+ if(App::mainWindowPtr())
+ App::mainWindow().logMessage2(type, context, message);
messageHandler(type, context, message);
}
diff --git a/plugins/file/abstract_file.h b/plugins/file/abstract_file.h
index b5a0d9c7..62d43200 100644
--- a/plugins/file/abstract_file.h
+++ b/plugins/file/abstract_file.h
@@ -337,7 +337,7 @@ public:
connect(dsbx, &QDoubleSpinBox::valueChanged, this, &TransformDialog::setTransform);
auto buttonBox = new QDialogButtonBox{this};
- buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
+ buttonBox->setObjectName(u""_s);
buttonBox->setGeometry(QRect(30, 240, 341, 32));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
diff --git a/plugins/file/dxf/dxf_node.cpp b/plugins/file/dxf/dxf_node.cpp
index 79ebbc48..1e6967d3 100644
--- a/plugins/file/dxf/dxf_node.cpp
+++ b/plugins/file/dxf/dxf_node.cpp
@@ -34,19 +34,19 @@ class Dialog : public QDialog {
QTableView* tableView;
void setupUi(QDialog* dialog) {
if(dialog->objectName().isEmpty())
- dialog->setObjectName(QString::fromUtf8("Dialog"));
+ dialog->setObjectName(u""_s);
verticalLayout = new QVBoxLayout{dialog};
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ verticalLayout->setObjectName(u""_s);
verticalLayout->setContentsMargins(6, 6, 6, 6);
pushButtonColorize = new QPushButton{dialog};
- pushButtonColorize->setObjectName(QString::fromUtf8("pushButtonColorize"));
+ pushButtonColorize->setObjectName(u""_s);
pushButtonColorize->setText(DxfObj::tr("Colorize"));
pushButtonColorize->setIcon(QIcon::fromTheme("color-management"));
verticalLayout->addWidget(pushButtonColorize);
tableView = new QTableView{dialog};
- tableView->setObjectName(QString::fromUtf8("tableView"));
+ tableView->setObjectName(u""_s);
verticalLayout->addWidget(tableView);
QMetaObject::connectSlotsByName(dialog);
diff --git a/plugins/file/dxf/dxf_settingstab.cpp b/plugins/file/dxf/dxf_settingstab.cpp
index ba721f91..ee7e8b91 100644
--- a/plugins/file/dxf/dxf_settingstab.cpp
+++ b/plugins/file/dxf/dxf_settingstab.cpp
@@ -19,49 +19,49 @@ namespace Dxf {
SettingsTab::SettingsTab(QWidget* parent)
: AbstractFileSettings{parent} {
- setObjectName(QString::fromUtf8("tabDxf"));
+ setObjectName(u""_s);
auto verticalLayout = new QVBoxLayout{this};
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout_9"));
+ verticalLayout->setObjectName(u""_s);
verticalLayout->setContentsMargins(6, 6, 6, 6);
auto groupBox = new QGroupBox{this};
- groupBox->setObjectName(QString::fromUtf8("groupBox_3"));
+ groupBox->setObjectName(u""_s);
auto formLayout = new QFormLayout{groupBox};
- formLayout->setObjectName(QString::fromUtf8("formLayout_4"));
+ formLayout->setObjectName(u""_s);
formLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
formLayout->setContentsMargins(6, 6, 6, 6);
// DefaultFont
auto labelDefaultFont = new QLabel{groupBox};
- labelDefaultFont->setObjectName(QString::fromUtf8("labelDefaultFont"));
+ labelDefaultFont->setObjectName(u""_s);
formLayout->setWidget(0, QFormLayout::LabelRole, labelDefaultFont);
fcbxDxfDefaultFont = new QFontComboBox{groupBox};
- fcbxDxfDefaultFont->setObjectName(QString::fromUtf8("fcbxDxfDefaultFont"));
+ fcbxDxfDefaultFont->setObjectName(u""_s);
formLayout->setWidget(0, QFormLayout::FieldRole, fcbxDxfDefaultFont);
// Bold Font
auto labelBoldFont = new QLabel{groupBox};
- labelBoldFont->setObjectName(QString::fromUtf8("labelBoldFont"));
+ labelBoldFont->setObjectName(u""_s);
formLayout->setWidget(1, QFormLayout::LabelRole, labelBoldFont);
chbxBoldFont = new QCheckBox{" ", groupBox};
- chbxBoldFont->setObjectName(QString::fromUtf8("chbxDxfBoldFont"));
+ chbxBoldFont->setObjectName(u""_s);
formLayout->setWidget(1, QFormLayout::FieldRole, chbxBoldFont);
// Italic Font
auto labelItalicFont = new QLabel{groupBox};
- labelItalicFont->setObjectName(QString::fromUtf8("labelItalicFont"));
+ labelItalicFont->setObjectName(u""_s);
formLayout->setWidget(2, QFormLayout::LabelRole, labelItalicFont);
chbxItalicFont = new QCheckBox{" ", groupBox};
- chbxItalicFont->setObjectName(QString::fromUtf8("chbxDxfItalicFont"));
+ chbxItalicFont->setObjectName(u""_s);
formLayout->setWidget(2, QFormLayout::FieldRole, chbxItalicFont);
// Override Fonts
auto labelOverrideFonts = new QLabel{groupBox};
- labelOverrideFonts->setObjectName(QString::fromUtf8("labelOverrideFonts"));
+ labelOverrideFonts->setObjectName(u""_s);
formLayout->setWidget(3, QFormLayout::LabelRole, labelOverrideFonts);
chbxOverrideFonts = new QCheckBox{" ", groupBox};
- chbxOverrideFonts->setObjectName(QString::fromUtf8("chbxDxfOverrideFonts"));
+ chbxOverrideFonts->setObjectName(u""_s);
formLayout->setWidget(3, QFormLayout::FieldRole, chbxOverrideFonts);
verticalLayout->addWidget(groupBox);
diff --git a/plugins/file/dxf/dxf_sourcedialog.cpp b/plugins/file/dxf/dxf_sourcedialog.cpp
index 40ea9733..e1b4aa8d 100644
--- a/plugins/file/dxf/dxf_sourcedialog.cpp
+++ b/plugins/file/dxf/dxf_sourcedialog.cpp
@@ -20,17 +20,17 @@ namespace Dxf {
SourceDialog::SourceDialog(int fileId, QWidget* parent)
: QDialog{parent} {
- setObjectName(QString::fromUtf8("this"));
+ setObjectName(u""_s);
resize(600, 600);
// Dialog->resize(400, 300);
auto verticalLayout = new QVBoxLayout{this};
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ verticalLayout->setObjectName(u""_s);
// tableView
auto tableView = new QTableView{this};
QFont f(font());
f.setFamily("Consolas");
tableView->setFont(f);
- tableView->setObjectName(QString::fromUtf8("tableView"));
+ tableView->setObjectName(u""_s);
tableView->setModel(new Model{App::project().file(fileId)->lines()});
// horizontal Header
@@ -73,14 +73,14 @@ SourceDialog::SourceDialog(int fileId, QWidget* parent)
{
auto spinBox = new QSpinBox{this};
- spinBox->setObjectName(QString::fromUtf8("spinBox"));
+ spinBox->setObjectName(u""_s);
spinBox->setRange(0, tableView->model()->rowCount());
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), tableView, &QTableView::selectRow);
verticalLayout->addWidget(spinBox);
}
// leFind
auto leFind = new QLineEdit{this};
- leFind->setObjectName(QString::fromUtf8("lineEdit"));
+ leFind->setObjectName(u""_s);
connect(leFind, &QLineEdit::textChanged, [tableView](const QString& text) {
for(int row = 0; row < tableView->model()->rowCount(); ++row)
if(tableView->model()->data(tableView->model()->index(row, 2)).toString().contains(text, Qt::CaseInsensitive)) {
@@ -91,7 +91,7 @@ SourceDialog::SourceDialog(int fileId, QWidget* parent)
verticalLayout->addWidget(leFind);
// pbNext
auto pbNext = new QPushButton{this};
- pbNext->setObjectName(QString::fromUtf8("pbNext"));
+ pbNext->setObjectName(u""_s);
pbNext->setText(DxfObj::tr("Next"));
connect(pbNext, &QPushButton::clicked, [tableView, leFind] {
for(int row = tableView->currentIndex().row() + 1; row < tableView->model()->rowCount(); ++row)
@@ -103,7 +103,7 @@ SourceDialog::SourceDialog(int fileId, QWidget* parent)
verticalLayout->addWidget(pbNext);
// pbPrev
auto pbPrev = new QPushButton{this};
- pbPrev->setObjectName(QString::fromUtf8("pbPrev"));
+ pbPrev->setObjectName(u""_s);
pbPrev->setText(DxfObj::tr("Prev"));
connect(pbPrev, &QPushButton::clicked, [tableView, leFind] {
for(int row = tableView->currentIndex().row() - 1; row >= 0; --row)
diff --git a/plugins/file/excellon/ex_node.cpp b/plugins/file/excellon/ex_node.cpp
index 091e0dd3..553d7cb8 100644
--- a/plugins/file/excellon/ex_node.cpp
+++ b/plugins/file/excellon/ex_node.cpp
@@ -103,15 +103,15 @@ void Node::menu(QMenu& menu, FileTree::View* tv) {
menu.addAction(QIcon::fromTheme("hint"), QObject::tr("&Hide other"), tv, &FileTree::View::hideOther);
menu.addAction(QIcon(), QObject::tr("&Show source"), [this] {
QDialog* dialog = new QDialog;
- dialog->setObjectName(QString::fromUtf8("dialog"));
+ dialog->setObjectName(u""_s);
dialog->resize(600, 600);
// Dialog->resize(400, 300);
QVBoxLayout* verticalLayout = new QVBoxLayout{dialog};
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ verticalLayout->setObjectName(u""_s);
QTextBrowser* textBrowser = new QTextBrowser{dialog};
textBrowser->setFont(QFont("JetBrains Mono"));
new SyntaxHighlighter{textBrowser->document()};
- textBrowser->setObjectName(QString::fromUtf8("textBrowser"));
+ textBrowser->setObjectName(u""_s);
verticalLayout->addWidget(textBrowser);
for(const QString& str: file->lines())
textBrowser->append(str);
diff --git a/plugins/file/excellon/ex_settingstab.cpp b/plugins/file/excellon/ex_settingstab.cpp
index 3d9ecb00..b38aef5f 100644
--- a/plugins/file/excellon/ex_settingstab.cpp
+++ b/plugins/file/excellon/ex_settingstab.cpp
@@ -17,7 +17,7 @@
namespace Excellon {
ExSettingsTab::ExSettingsTab(QWidget* parent)
: AbstractFileSettings{parent} {
- setObjectName(QString::fromUtf8("tabExcellon"));
+ setObjectName(u""_s);
auto vlayTab = new QVBoxLayout{this};
vlayTab->setContentsMargins(6, 6, 6, 6);
@@ -30,10 +30,10 @@ ExSettingsTab::ExSettingsTab(QWidget* parent)
{
grbxUnits->setTitle(QApplication::translate("ExcellonDialog", "Units", nullptr));
rbInches = new QRadioButton{grbxUnits};
- rbInches->setObjectName(QString::fromUtf8("rbInches"));
+ rbInches->setObjectName(u""_s);
rbMillimeters = new QRadioButton{grbxUnits};
- rbMillimeters->setObjectName(QString::fromUtf8("rbMillimeters"));
+ rbMillimeters->setObjectName(u""_s);
auto vlay = new QVBoxLayout{grbxUnits};
vlay->setContentsMargins(6, 6, 6, 6);
@@ -45,10 +45,10 @@ ExSettingsTab::ExSettingsTab(QWidget* parent)
grbxZeroes->setTitle(QApplication::translate("ExcellonDialog", "Zeroes", nullptr));
rbLeading = new QRadioButton{grbxZeroes};
- rbLeading->setObjectName(QString::fromUtf8("rbLeading"));
+ rbLeading->setObjectName(u""_s);
rbTrailing = new QRadioButton{grbxZeroes};
- rbTrailing->setObjectName(QString::fromUtf8("rbTrailing"));
+ rbTrailing->setObjectName(u""_s);
auto vlay = new QVBoxLayout{grbxZeroes};
vlay->setContentsMargins(6, 6, 6, 6);
@@ -60,7 +60,7 @@ ExSettingsTab::ExSettingsTab(QWidget* parent)
grbxFormat->setTitle(QApplication::translate("ExcellonDialog", "Format", nullptr));
sbxInteger = new QSpinBox{grbxFormat};
- sbxInteger->setObjectName(QString::fromUtf8("sbxInteger"));
+ sbxInteger->setObjectName(u""_s);
sbxInteger->setWrapping(false);
sbxInteger->setAlignment(Qt::AlignCenter);
sbxInteger->setProperty("showGroupSeparator", QVariant(false));
@@ -68,7 +68,7 @@ ExSettingsTab::ExSettingsTab(QWidget* parent)
sbxInteger->setMaximum(8);
sbxDecimal = new QSpinBox{grbxFormat};
- sbxDecimal->setObjectName(QString::fromUtf8("sbxDecimal"));
+ sbxDecimal->setObjectName(u""_s);
sbxDecimal->setAlignment(Qt::AlignCenter);
sbxDecimal->setMinimum(1);
sbxDecimal->setMaximum(8);
@@ -88,14 +88,14 @@ ExSettingsTab::ExSettingsTab(QWidget* parent)
grbxOffset->setTitle(QApplication::translate("ExcellonDialog", "Offset", nullptr));
dsbxX = new DoubleSpinBox{grbxOffset};
- dsbxX->setObjectName(QString::fromUtf8("dsbxX"));
+ dsbxX->setObjectName(u""_s);
dsbxX->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
dsbxX->setDecimals(4);
dsbxX->setMinimum(-1000.0);
dsbxX->setMaximum(1000.0);
dsbxY = new DoubleSpinBox{grbxOffset};
- dsbxY->setObjectName(QString::fromUtf8("dsbxY"));
+ dsbxY->setObjectName(u""_s);
dsbxY->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
dsbxY->setDecimals(4);
dsbxY->setMinimum(-1000.0);
@@ -121,13 +121,13 @@ ExSettingsTab::ExSettingsTab(QWidget* parent)
grbxParse->setTitle(QApplication::translate("ExcellonDialog", "Parse Reg.Expr.", nullptr));
leParseZero = new QLineEdit{this};
- leParseZero->setObjectName(QString::fromUtf8("leParseZero"));
+ leParseZero->setObjectName(u""_s);
leParseUnit = new QLineEdit{this};
- leParseUnit->setObjectName(QString::fromUtf8("leParseUnit"));
+ leParseUnit->setObjectName(u""_s);
leParseDecimalAndInteger = new QLineEdit{this};
- leParseDecimalAndInteger->setObjectName(QString::fromUtf8("leParseDecimalAndInteger"));
+ leParseDecimalAndInteger->setObjectName(u""_s);
auto leTestParseZero = new QLineEdit{this};
auto leTestParseUnit = new QLineEdit{this};
diff --git a/plugins/file/gerber/gbr_node.cpp b/plugins/file/gerber/gbr_node.cpp
index b7ea7ffd..b9be7708 100644
--- a/plugins/file/gerber/gbr_node.cpp
+++ b/plugins/file/gerber/gbr_node.cpp
@@ -151,16 +151,16 @@ void Node::menu(QMenu& menu, FileTree::View* tv) {
menu.setToolTipsVisible(true);
menu.addAction(QIcon(), GbrObj::tr("&Show source"), [this] {
QDialog* dialog = new QDialog;
- dialog->setObjectName(QString::fromUtf8("dialog"));
+ dialog->setObjectName(u""_s);
dialog->resize(800, 600);
QTextBrowser* textBrowser = new QTextBrowser{dialog};
- textBrowser->setObjectName(QString::fromUtf8("textBrowser"));
+ textBrowser->setObjectName(u""_s);
textBrowser->setFontFamily("JetBrains Mono");
textBrowser->setLineWrapMode(QTextEdit::NoWrap);
new SyntaxHighlighter{textBrowser->document()};
QVBoxLayout* verticalLayout = new QVBoxLayout{dialog};
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ verticalLayout->setObjectName(u""_s);
verticalLayout->setContentsMargins(6, 6, 6, 6);
verticalLayout->addWidget(textBrowser);
QString s;
diff --git a/plugins/file/gerber/gbr_plugin.cpp b/plugins/file/gerber/gbr_plugin.cpp
index 1da33969..a978816f 100644
--- a/plugins/file/gerber/gbr_plugin.cpp
+++ b/plugins/file/gerber/gbr_plugin.cpp
@@ -103,30 +103,30 @@ AbstractFileSettings* Plugin::createSettingsTab(QWidget* parent) {
public:
Tab(QWidget* parent = nullptr)
: AbstractFileSettings{parent} {
- setObjectName(QString::fromUtf8("tabGerber"));
+ setObjectName(u""_s);
auto verticalLayout = new QVBoxLayout{this};
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ verticalLayout->setObjectName(u""_s);
verticalLayout->setContentsMargins(6, 6, 6, 6);
{
auto groupBox1 = new QGroupBox{this};
- groupBox1->setObjectName(QString::fromUtf8("groupBox1"));
+ groupBox1->setObjectName(u""_s);
groupBox1->setTitle(QApplication::translate("SettingsDialog", "Gerber", nullptr));
verticalLayout->addWidget(groupBox1);
chbxCleanPolygons = new QCheckBox{groupBox1};
- chbxCleanPolygons->setObjectName(QString::fromUtf8("chbxCleanPolygons"));
+ chbxCleanPolygons->setObjectName(u""_s);
chbxSimplifyRegions = new QCheckBox{groupBox1};
- chbxSimplifyRegions->setObjectName(QString::fromUtf8("chbxSimplifyRegions"));
+ chbxSimplifyRegions->setObjectName(u""_s);
chbxSkipDuplicates = new QCheckBox{groupBox1};
- chbxSkipDuplicates->setObjectName(QString::fromUtf8("chbxSkipDuplicates"));
+ chbxSkipDuplicates->setObjectName(u""_s);
dsbxCleanPolygonsDist = new DoubleSpinBox{groupBox1};
dsbxCleanPolygonsDist->setDecimals(4);
- dsbxCleanPolygonsDist->setObjectName(QString::fromUtf8("dsbxCleanPolygonsDist"));
+ dsbxCleanPolygonsDist->setObjectName(u""_s);
dsbxCleanPolygonsDist->setRange(0.0001, 1.0);
dsbxCleanPolygonsDist->setSingleStep(0.001);
@@ -140,15 +140,15 @@ AbstractFileSettings* Plugin::createSettingsTab(QWidget* parent) {
{
auto groupBox2 = new QGroupBox{this};
- groupBox2->setObjectName(QString::fromUtf8("groupBox2"));
+ groupBox2->setObjectName(u""_s);
groupBox2->setTitle(QApplication::translate("SettingsDialog", "Wire Creation Method", nullptr));
verticalLayout->addWidget(groupBox2);
rbClipperOffset = new QRadioButton{groupBox2};
- rbClipperOffset->setObjectName(QString::fromUtf8("rbClipperOffset"));
+ rbClipperOffset->setObjectName(u""_s);
rbMinkowskiSum = new QRadioButton{groupBox2};
- rbMinkowskiSum->setObjectName(QString::fromUtf8("rbMinkowskiSum"));
+ rbMinkowskiSum->setObjectName(u""_s);
auto vBoxLayout = new QVBoxLayout{groupBox2};
vBoxLayout->setContentsMargins(6, 9, 6, 6);
vBoxLayout->addWidget(rbClipperOffset);
diff --git a/plugins/file/gerber/gbrcomp_dialog.cpp b/plugins/file/gerber/gbrcomp_dialog.cpp
index decdaf3c..a172a140 100644
--- a/plugins/file/gerber/gbrcomp_dialog.cpp
+++ b/plugins/file/gerber/gbrcomp_dialog.cpp
@@ -44,29 +44,29 @@ void Dialog::setFile(int fileId) { componentsView->setFile(fileId); }
void Dialog::setupUi(QDialog* dialog) {
if(dialog->objectName().isEmpty())
- dialog->setObjectName(QString::fromUtf8("Dialog"));
+ dialog->setObjectName(u""_s);
dialog->resize(800, 600);
splitter = new QSplitter{dialog};
- splitter->setObjectName(QString::fromUtf8("splitter"));
+ splitter->setObjectName(u""_s);
splitter->setOrientation(Qt::Horizontal);
componentsView = new sView{splitter};
- componentsView->setObjectName(QString::fromUtf8("componentsView"));
+ componentsView->setObjectName(u""_s);
grView = new QGraphicsView{splitter};
- grView->setObjectName(QString::fromUtf8("grView"));
+ grView->setObjectName(u""_s);
splitter->addWidget(componentsView);
splitter->addWidget(grView);
auto buttonBox = new QDialogButtonBox{dialog};
- buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
+ buttonBox->setObjectName(u""_s);
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
auto verticalLayout = new QVBoxLayout{dialog};
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ verticalLayout->setObjectName(u""_s);
verticalLayout->setContentsMargins(6, 6, 6, 6);
verticalLayout->addWidget(splitter);
verticalLayout->addWidget(buttonBox);
diff --git a/plugins/gcode/gc_baseform.cpp b/plugins/gcode/gc_baseform.cpp
index 44bc06b5..078f20d4 100644
--- a/plugins/gcode/gc_baseform.cpp
+++ b/plugins/gcode/gc_baseform.cpp
@@ -215,7 +215,7 @@ BaseForm::BaseForm(Plugin* plugin, Creator* tpc, QWidget* parent)
grid->addWidget(errTable = new TableView{errWidget});
grid->addWidget(errBtnBox = new QDialogButtonBox{errWidget});
- errBtnBox->setObjectName(QString::fromUtf8("errBtnBox"));
+ errBtnBox->setObjectName(u""_s);
errBtnBox->setOrientation(Qt::Horizontal);
errBtnBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
@@ -241,27 +241,30 @@ BaseForm::BaseForm(Plugin* plugin, Creator* tpc, QWidget* parent)
BaseForm::~BaseForm() {
if(errWidget->isVisible()) errBreak();
- if(runer.isRunning()) runer.terminate();
- // /*thread*/ runer.quit();
- // /*thread*/ runer.wait();
+ ProgressCancel::cancel();
+ if(runer.isRunning())
+ // runer.terminate();
+ // runer.quit();
+ runer.wait();
delete creator_;
qDebug(__FUNCTION__);
}
void BaseForm::setCreator(Creator* newCreator) {
qDebug() << __FUNCTION__ << creator_ << newCreator;
- if(/*thread*/ runer.isRunning()) {
- runer.terminate();
- // /*thread*/ runer.quit();
- // /*thread*/ runer.wait();
+ ProgressCancel::cancel();
+ if(runer.isRunning()) {
+ // runer.terminate();
+ // runer.quit();
+ runer.wait();
}
if(creator_ != newCreator && newCreator) {
qDebug(__FUNCTION__);
delete creator_;
creator_ = newCreator;
- creator_->moveToThread(&/*thread*/ runer);
+ creator_->moveToThread(&runer);
// clang-format off
- // connect(&/*thread*/runer, &QThread::finished, creator_, &QObject::deleteLater );
+ // connect(&runer, &QThread::finished, creator_, &QObject::deleteLater );
connect(creator_, &Creator::canceled, this, &BaseForm::stopProgress );
connect(creator_, &Creator::errorOccurred, this, &BaseForm::errorHandler );
connect(creator_, &Creator::fileReady, this, &BaseForm::fileHandler );
@@ -269,7 +272,7 @@ void BaseForm::setCreator(Creator* newCreator) {
connect(this, &BaseForm::createToolpath, &runer, &Runer::createGc, Qt::QueuedConnection);
connect(this, &BaseForm::createToolpath, this, &BaseForm::startProgress );
// clang-format on
- // /*thread*/ runer.start(QThread::LowPriority /*HighestPriority*/);
+ // runer.start(QThread::LowPriority /*HighestPriority*/);
} else if(creator_ && !newCreator) {
creator_ = nullptr;
}
@@ -421,9 +424,13 @@ void BaseForm::cancel() {
if(creator_ == nullptr)
return;
creator_->continueCalc(false);
- if(runer.isRunning())
- runer.terminate();
- // /*thread*/ runer.start(QThread::LowPriority /*HighestPriority*/);
+ ProgressCancel::cancel();
+ if(runer.isRunning()) {
+ // runer.quit();
+ runer.wait();
+ // runer.terminate();
+ }
+ // runer.start(QThread::LowPriority /*HighestPriority*/);
stopProgress();
}
diff --git a/plugins/gcode/gc_baseform.h b/plugins/gcode/gc_baseform.h
index 2e523519..2ad6bdb8 100644
--- a/plugins/gcode/gc_baseform.h
+++ b/plugins/gcode/gc_baseform.h
@@ -10,6 +10,7 @@
********************************************************************************/
#pragma once
+#include "cancelation.h"
#include "depthform.h"
#include "gcode.h"
@@ -111,8 +112,8 @@ private:
start();
}
- // QThread interface
protected:
+ // QThread interface
void run() override { form->creator_->createGc(gcp); }
} runer{this};
diff --git a/plugins/gcode/gc_creator.cpp b/plugins/gcode/gc_creator.cpp
index c4a7542b..fe59b1fe 100644
--- a/plugins/gcode/gc_creator.cpp
+++ b/plugins/gcode/gc_creator.cpp
@@ -50,16 +50,15 @@ public:
QIcon icon() const override { return QIcon::fromTheme("crosshairs"); }
uint32_t type() const override { return GC_DBG_FILE; }
void createGi() override {
- Gi::Item* item;
- item = new Gi::GcPath{pocketPaths_, this};
- item->setPen(QPen(color, gcp_.getToolDiameter(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
- item->setPenColorPtr(&color);
- itemGroup()->push_back(item);
- for(int i{}; i < pocketPaths_.size() - 1; ++i)
- g0path_.emplace_back(Path{pocketPaths_[i].back(), pocketPaths_[i + 1].front()});
- item = new Gi::GcPath{g0path_};
- item->setPenColorPtr(&App::settings().guiColor(GuiColors::G0));
+ Gi::Item* item = new Gi::GcPath{pocketPaths_, this};
+ // item->setPen(QPen(color, gcp_.getToolDiameter(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+ // item->setPenColorPtr(&color);
itemGroup()->push_back(item);
+ // for(int i{}; i < pocketPaths_.size() - 1; ++i)
+ // g0path_.emplace_back(Path{pocketPaths_[i].back(), pocketPaths_[i + 1].front()});
+ // item = new Gi::GcPath{g0path_};
+ // item->setPenColorPtr(&App::settings().guiColor(GuiColors::G0));
+ // itemGroup()->push_back(item);
itemGroup()->setVisible(true);
}
void genGcodeAndTile() override { } // saveLaserProfile({});
@@ -171,7 +170,7 @@ void Creator::addRawPaths(Paths&& rawPaths) {
}
}
- mergeSegments(rawPaths, mergDist);
+ mergePaths(rawPaths, mergDist);
for(Path& path: rawPaths) {
Point& pf = path.front();
@@ -215,7 +214,7 @@ void Creator::createGc(Params* gcp) {
try {
checkMillingFl = true;
checkMilling(gcp_.side());
- } catch(const cancelException& e) {
+ } catch(const Cancel& e) {
ProgressCancel::reset();
qWarning() << "checkMilling canceled:" << e.what();
} catch(...) {
@@ -229,7 +228,7 @@ void Creator::createGc(Params* gcp) {
create();
}
qWarning() << "Creator::createGc() finish";
- } catch(const cancelException& e) {
+ } catch(const Cancel& e) {
qWarning() << "Creator::createGc() canceled:" << e.what();
} catch(const std::exception& e) {
qWarning() << "Creator::createGc() exeption:" << e.what();
@@ -355,86 +354,10 @@ void Creator::stacking(Paths& paths) {
path.emplace_back(path.front());
}
- sortB(returnPss);
-}
-
-void Creator::mergeSegments(Paths& paths, double maxDist) {
- qDebug(__FUNCTION__);
-#if 1
- mergePaths(paths, maxDist);
-#else
- size_t size;
- do {
- size = paths.size();
- for(size_t i{}; i < paths.size(); ++i) {
- if(i >= paths.size())
- break;
- for(size_t j{}; j < paths.size(); ++j) {
- if(i == j)
- continue;
- if(i >= paths.size())
- break;
- Point pib = paths[i].back();
- Point pjf = paths[j].front();
- if(pib == pjf) {
- paths[i] += paths[j] | skipFront;
- paths -= j--;
- continue;
- }
- Point pif = paths[i].front();
- Point pjb = paths[j].back();
- if(pif == pjb) {
- paths[j].insert(paths[j].end(), paths[i].begin() + 1, paths[i].end());
- paths -= i--;
- break;
- }
- if(pib == pjb) {
- ReversePath(paths[j]);
- paths[i] += paths[j] | skipFront;
- paths -= j--;
- continue;
- }
- }
- }
- } while(size != paths.size());
- if(qFuzzyIsNull(maxDist))
- return;
- do {
- size = paths.size();
- for(size_t i{}; i < paths.size(); ++i) {