-
Notifications
You must be signed in to change notification settings - Fork 1
/
shapeicon.cpp
175 lines (128 loc) · 4.09 KB
/
shapeicon.cpp
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
#include "shapeicon.h"
ShapeIcon::ShapeIcon() {
_iconPixmap = new QPixmap();
}
QIcon ShapeIcon::getIcon() {
QIcon icon;
switch ( _shape ) {
case CIRCLE:
if ( _hollow ) {
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/hollow-circle-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/hollow-circle-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/hollow-circle" ) );
}
} else {
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/circle-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/circle-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/circle" ) );
}
}
break;
case OBROUND:
if ( _hollow ) {
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/hollow-obround-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/hollow-obround-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/hollow-obround" ) );
}
} else {
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/obround-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/obround-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/obround" ) );
}
}
break;
case RECTANGLE:
if ( _hollow ) {
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/hollow-rectangle-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/hollow-rectangle-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/hollow-rectangle" ) );
}
} else {
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/rectangle-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/rectangle-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/rectangle" ) );
}
}
break;
case POLYGON:
if ( _hollow ) {
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/hollow-polygon-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/hollow-polygon-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/hollow-polygon" ) );
}
} else {
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/polygon-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/polygon-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/polygon" ) );
}
}
break;
case MACRO:
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/macro-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/macro-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/macro" ) );
}
break;
case UNSET:
if ( _deleted ) {
icon.addPixmap( QPixmap( ":/res/unknown-deleted" ) );
} else if ( _changed ) {
icon.addPixmap( QPixmap( ":/res/unknown-changed" ) );
} else {
icon.addPixmap( QPixmap( ":/res/unknown" ) );
}
break;
}
return icon;
}
void ShapeIcon::setShape( shape_type_t shape ) {
_shape = shape;
}
void ShapeIcon::setHollow( bool hollow ) {
_hollow = hollow;
}
void ShapeIcon::setDeleted( bool deleted ) {
_deleted = deleted;
}
void ShapeIcon::setChanged( bool changed ) {
_changed = changed;
}
shape_type_t ShapeIcon::getShape() {
return _shape;
}
bool ShapeIcon::isHollow() {
return _hollow;
}
bool ShapeIcon::isDeleted() {
return _deleted;
}
bool ShapeIcon::isChanged() {
return _changed;
}