-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
caneeditorwidget.h
130 lines (105 loc) · 2.85 KB
/
caneeditorwidget.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
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
#ifndef CANEEDITORWIDGET_H
#define CANEEDITORWIDGET_H
#include <QWidget>
#include <QMutex>
#include <QWaitCondition>
#include <QShortcut>
#include <string>
#include "geometry.h"
#include "shape.h"
#include "mesh.h"
#include "constants.h"
class QImage;
class QPushButton;
class QStackedWidget;
class QLabel;
class QTabWidget;
class QSpinBox;
class QHBoxLayout;
class QScrollArea;
class Cane;
class CaneEditorViewWidget;
class CaneCustomizeViewWidget;
class NiceViewWidget;
class CaneTemplateLibraryWidget;
class CaneGeometryThread;
class TwistWidget;
#define MIN_CANE_COUNT_PARAMETER_VALUE 0
#define MAX_CANE_COUNT_PARAMETER_VALUE 99
class CaneEditorWidget : public QWidget
{
Q_OBJECT
friend class CaneGeometryThread;
public:
CaneEditorWidget(QWidget* parent=0);
void resetCane();
Cane* cane();
void setCane(Cane* c);
void seedTemplates();
void writeCaneToPLYFile(QString& filename);
void writeCaneToOBJFile(QString& filename);
QImage caneImage();
void reset3DCamera();
public slots:
void updateEverything();
protected:
bool eventFilter(QObject* obj, QEvent* event);
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
signals:
void showMessage(const QString& message, unsigned int timeout);
private slots:
void circleCasingButtonClicked();
void squareCasingButtonClicked();
void addCasingButtonClicked();
void deleteCasingButtonClicked();
void addCircleButtonClicked();
void addSquareButtonClicked();
void copySelectedButtonClicked();
void deleteSelectedButtonClicked();
void twistEnded();
void countSpinChanged(int);
void controlsTabChanged(int);
void geometryThreadFinishedMesh(bool completed, unsigned int quality);
private:
QMutex tempCaneMutex;
Cane* tempCane;
bool tempCaneDirty;
QWaitCondition wakeWait;
QMutex wakeMutex;
CaneGeometryThread* geometryThread;
QMutex geometryDirtyMutex;
bool geometryDirty;
QMutex tempGeometryMutex;
Geometry tempGeometry;
Geometry geometry;
Cane* cane_;
CaneEditorViewWidget* viewWidget;
CaneCustomizeViewWidget* customizeViewWidget;
NiceViewWidget* niceViewWidget;
TwistWidget* twistWidget;
QLabel* countLabel;
QSpinBox* countSpin;
QHBoxLayout* templateLibraryLayout;
QPushButton* addCasingButton;
QPushButton* deleteCasingButton;
QPushButton* customizeCaneButton;
QPushButton* circleCasingPushButton;
QPushButton* squareCasingPushButton;
QPushButton* addCircleButton;
QPushButton* addSquareButton;
QPushButton* copySelectedButton;
QPushButton* deleteSelectedButton;
QStackedWidget* viewEditorStack;
QTabWidget* controlsTab;
QScrollArea* pullTemplateLibraryScrollArea;
bool isDragging;
QPoint dragStartPosition;
QPoint lastDragPosition;
int maxDragDistance;
void setupLayout();
void setupThreading();
void setupConnections();
};
#endif