| 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 | #pragma once |
| 23 | |
| 24 | #include <QThread> |
| 25 | |
| 26 | #include <QPolygonF> |
| 27 | |
| 28 | // A thread to send the cutting stuff to the plotter. |
| 29 | // To use: |
| 30 | // |
| 31 | // 1. Create. |
| 32 | // 2. Connect success() and error() to your class. Only one is called. |
| 33 | // 3. Call setParams(...) with the parameters you want. |
| 34 | // 4. Call start(). |
| 35 | // 5. Wait for success() or error(). |
| 36 | |
| 37 | struct CutParamscxx . . $ CutParams# |
| 38 | { |
| 39 | QListcxx . . $ QList#<QPolygonFcxx . . $ QPolygonF#> cutscxx . . $ CutParams#cuts.; |
| 40 | double mediawidthcxx . . $ CutParams#mediawidth. = 0.0; |
| 41 | double mediaheightcxx . . $ CutParams#mediaheight. = 0.0; |
| 42 | int mediacxx . . $ CutParams#media. = 300; |
| 43 | int speedcxx . . $ CutParams#speed. = 10; |
| 44 | int pressurecxx . . $ CutParams#pressure. = 10; |
| 45 | bool trackenhancingcxx . . $ CutParams#trackenhancing. = false; |
| 46 | bool regmarkcxx . . $ CutParams#regmark. = false; |
| 47 | bool regsearchcxx . . $ CutParams#regsearch. = false; |
| 48 | double regwidthcxx . . $ CutParams#regwidth. = 0.0; |
| 49 | double regheightcxx . . $ CutParams#regheight. = 0.0; |
| 50 | }; |
| 51 | |
| 52 | class CuttingThreadcxx . . $ CuttingThread# : public QThreadcxx . . $ QThread# |
| 53 | { |
| 54 | Q_OBJECTcxx . . $ CuttingThread#trUtf8(75d9f1c324b4579d). |
| 55 | public: |
| 56 | explicit CuttingThreadcxx . . $ CuttingThread#CuttingThread(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent = 0); |
| 57 | |
| 58 | // Set the parameters to use for the cut. |
| 59 | void setParamscxx . . $ CuttingThread#setParams(f40ad2760b5d2a0).(const CutParamscxx . . $ CutParams#& params); |
| 60 | |
| 61 | signalscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:89:14`!: |
| 62 | // Emitted if the cutting was (as far as we can tell) successful. |
| 63 | void successcxx . . $ CuttingThread#success(49f6e7a06ebc5aa8).(); |
| 64 | // Emitted if the cutting failed. |
| 65 | void errorcxx . . $ CuttingThread#error(7df51288a9ebd664).(QStringcxx . . $ QString# message); |
| 66 | public slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 67 | |
| 68 | protected: |
| 69 | // This reads the params, then tries to send the data to the cutter. |
| 70 | // When it is done, it runs exec() to send the success() or error() signal. |
| 71 | void runcxx . . $ CuttingThread#run(49f6e7a06ebc5aa8).(); |
| 72 | |
| 73 | private: |
| 74 | CutParamscxx . . $ CutParams# paramscxx . . $ CuttingThread#params.; |
| 75 | |
| 76 | }; |