-
Notifications
You must be signed in to change notification settings - Fork 28
/
CuttingDialog.h
62 lines (50 loc) · 2.46 KB
/
CuttingDialog.h
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
/***************************************************************************
* This file is part of Robocut. *
* Copyright (C) 2010 Tim Hutt <tdhutt@gmail.com> *
* Copyright (C) 2010 Markus Schulz <schulz@alpharesearch.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#pragma once
#include <QDialog>
#include "CuttingThread.h"
namespace Ui {
class CuttingDialog;
}
// This is the dialog that shows while the cut is progressing. The thread that does the cutting
// is also owned by the dialog, in a slightly bad design.
class CuttingDialog : public QDialog
{
Q_OBJECT
public:
explicit CuttingDialog(QWidget *parent = 0);
~CuttingDialog();
// Start the cutting thread. Call this only once, before the dialog is shown.
// It creates the thread, passes it the cutting details, and runs it.
void startCut(const CutParams& params);
protected:
void changeEvent(QEvent *e);
void closeEvent(QCloseEvent* e);
private:
Ui::CuttingDialog *ui;
// The cutting thread. It is pretty basic - just one long run() routine and then it calls onSuccess() or
// onError().
CuttingThread* thread;
private slots:
// These are called from the thread when it has finished. Only one is called.
void onSuccess();
void onError(QString message);
};