| 1 | /*************************************************************************** |
| 2 | * This file is part of Robocut. * |
| 3 | * Copyright (C) 2010 Tim Hutt <[email protected]> * |
| 4 | * Copyright (C) 2010 Markus Schulz <[email protected]> * |
| 5 | * * |
| 6 | * This program is free software; you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 3 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, write to the * |
| 18 | * Free Software Foundation, Inc., * |
| 19 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | #include "CuttingDialog.h"cxx . . $ `<file>/CuttingDialog.h`/ |
| 23 | #include "ui_CuttingDialog.h"cxx . . $ `<file>/ui_CuttingDialog.h`/ |
| 24 | |
| 25 | #include <QMessageBox> |
| 26 | #include <QPushButton> |
| 27 | #include <QCloseEvent> |
| 28 | |
| 29 | #include <QDebug> |
| 30 | |
| 31 | CuttingDialogcxx . . $ CuttingDialog#::CuttingDialogcxx . . $ CuttingDialog#CuttingDialog(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) : |
| 32 | QDialogcxx . . $ QDialog#QDialog(872e7b0c281abd8d).(parent), |
| 33 | uicxx . . $ CuttingDialog#ui.(new Uicxx . . $ Ui/::CuttingDialogcxx . . $ Ui/CuttingDialog#) |
| 34 | { |
| 35 | uicxx . . $ CuttingDialog#ui.->setupUicxx . . $ Ui_CuttingDialog#setupUi(d194de0c0f68c28b).(this); |
| 36 | threadcxx . . $ CuttingDialog#thread. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 37 | } |
| 38 | |
| 39 | CuttingDialogcxx . . $ CuttingDialog#::~cxx . . $ CuttingDialog#`~CuttingDialog`(49f6e7a06ebc5aa8).CuttingDialogcxx . . $ CuttingDialog#() |
| 40 | { |
| 41 | delete uicxx . . $ CuttingDialog#ui.; |
| 42 | if (threadcxx . . $ CuttingDialog#thread.) |
| 43 | { |
| 44 | threadcxx . . $ CuttingDialog#thread.->exitcxx . . $ QThread#exit(d4f767463ce0a6b3).(); |
| 45 | threadcxx . . $ CuttingDialog#thread.->waitcxx . . $ QThread#wait(31596a199e1d8a50).(1000); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | void CuttingDialogcxx . . $ CuttingDialog#::changeEventcxx . . $ CuttingDialog#changeEvent(c2473e2e70986fd7).(QEventcxx . . $ QEvent# *e) |
| 50 | { |
| 51 | QDialogcxx . . $ QDialog#::changeEventcxx . . $ QWidget#changeEvent(c2473e2e70986fd7).(e); |
| 52 | switch (e->typecxx . . $ QEvent#type(916a8de57f4d422b).()) { |
| 53 | case QEventcxx . . $ QEvent#::LanguageChangecxx . . $ QEvent#LanguageChange.: |
| 54 | uicxx . . $ CuttingDialog#ui.->retranslateUicxx . . $ Ui_CuttingDialog#retranslateUi(d194de0c0f68c28b).(this); |
| 55 | break; |
| 56 | default: |
| 57 | break; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | |
| 62 | void CuttingDialogcxx . . $ CuttingDialog#::startCutcxx . . $ CuttingDialog#startCut(f40ad2760b5d2a0).(const CutParamscxx . . $ CutParams#& params) |
| 63 | { |
| 64 | if (threadcxx . . $ CuttingDialog#thread.) |
| 65 | { |
| 66 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Internal error: startCut() called twice."; |
| 67 | return; |
| 68 | } |
| 69 | threadcxx . . $ CuttingDialog#thread. = new CuttingThreadcxx . . $ CuttingThread#(this); |
| 70 | |
| 71 | connectcxx . . $ QObject#connect(f4332061c7e4ca89).(threadcxx . . $ CuttingDialog#thread., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(success()), SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onSuccess())); |
| 72 | connectcxx . . $ QObject#connect(f4332061c7e4ca89).(threadcxx . . $ CuttingDialog#thread., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(error(QString)), SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onError(QString))); |
| 73 | |
| 74 | threadcxx . . $ CuttingDialog#thread.->setParamscxx . . $ CuttingThread#setParams(f40ad2760b5d2a0).(params); |
| 75 | |
| 76 | threadcxx . . $ CuttingDialog#thread.->startcxx . . $ QThread#start(bd4fe741c868f69f).(); |
| 77 | } |
| 78 | |
| 79 | void CuttingDialogcxx . . $ CuttingDialog#::onSuccesscxx . . $ CuttingDialog#onSuccess(49f6e7a06ebc5aa8).() |
| 80 | { |
| 81 | uicxx . . $ CuttingDialog#ui.->statuscxx . . $ Ui_CuttingDialog#status.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).("Finished"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 82 | uicxx . . $ CuttingDialog#ui.->buttonBoxcxx . . $ Ui_CuttingDialog#buttonBox.->buttoncxx . . $ QDialogButtonBox#button(3b1c1f83a3cc2105).(QDialogButtonBoxcxx . . $ QDialogButtonBox#::Cancelcxx . . $ QDialogButtonBox#Cancel.)->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).("Close"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 83 | threadcxx . . $ CuttingDialog#thread.->exitcxx . . $ QThread#exit(d4f767463ce0a6b3).(); |
| 84 | threadcxx . . $ CuttingDialog#thread.->waitcxx . . $ QThread#wait(31596a199e1d8a50).(1000); |
| 85 | delete threadcxx . . $ CuttingDialog#thread.; |
| 86 | threadcxx . . $ CuttingDialog#thread. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 87 | } |
| 88 | |
| 89 | void CuttingDialogcxx . . $ CuttingDialog#::onErrorcxx . . $ CuttingDialog#onError(7df51288a9ebd664).(QStringcxx . . $ QString# message) |
| 90 | { |
| 91 | uicxx . . $ CuttingDialog#ui.->statuscxx . . $ Ui_CuttingDialog#status.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).("Error: " +cxx . . $ operator+(c75c3ae4eb9af1a8). message); |
| 92 | uicxx . . $ CuttingDialog#ui.->buttonBoxcxx . . $ Ui_CuttingDialog#buttonBox.->buttoncxx . . $ QDialogButtonBox#button(3b1c1f83a3cc2105).(QDialogButtonBoxcxx . . $ QDialogButtonBox#::Cancelcxx . . $ QDialogButtonBox#Cancel.)->setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).("Close"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 93 | threadcxx . . $ CuttingDialog#thread.->exitcxx . . $ QThread#exit(d4f767463ce0a6b3).(); |
| 94 | threadcxx . . $ CuttingDialog#thread.->waitcxx . . $ QThread#wait(31596a199e1d8a50).(1000); |
| 95 | delete threadcxx . . $ CuttingDialog#thread.; |
| 96 | threadcxx . . $ CuttingDialog#thread. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 97 | } |
| 98 | |
| 99 | void CuttingDialogcxx . . $ CuttingDialog#::closeEventcxx . . $ CuttingDialog#closeEvent(642e80679aeb34f8).(QCloseEventcxx . . $ QCloseEvent#* e) |
| 100 | { |
| 101 | if (threadcxx . . $ CuttingDialog#thread.) |
| 102 | { |
| 103 | if (QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(21b6fd1dd558cc82).(this, "Kill cutting process?"cxx . . $ QString#QString(85c52e162fed56f9)., "Are you sure you wish to stop the cutting process? "cxx . . $ QString#QString(85c52e162fed56f9). |
| 104 | "This may result in bad stuff. It might be better just to turn the plotter off and on again.", |
| 105 | QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes., QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.) == QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.) |
| 106 | { |
| 107 | e->ignorecxx . . $ QEvent#ignore(49f6e7a06ebc5aa8).(); |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | threadcxx . . $ CuttingDialog#thread.->terminatecxx . . $ QThread#terminate(49f6e7a06ebc5aa8).(); |
| 112 | threadcxx . . $ CuttingDialog#thread.->waitcxx . . $ QThread#wait(31596a199e1d8a50).(5000); |
| 113 | delete threadcxx . . $ CuttingDialog#thread.; |
| 114 | threadcxx . . $ CuttingDialog#thread. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 115 | } |
| 116 | return QDialogcxx . . $ QDialog#::closeEventcxx . . $ QDialog#closeEvent(642e80679aeb34f8).(e); |
| 117 | } |