-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontroller.h
235 lines (227 loc) · 5.08 KB
/
controller.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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include "guiimage.h"
#include "tool.h"
#include <QGraphicsPixmapItem>
#include <QObject>
#include <QVector>
class ThumbsWidget;
/**
* @brief The Controller class is one of the most important classes of the User Interface,
* and is responsible to manage the images.
*/
class Controller : public QObject {
Q_OBJECT
DisplayFormat * bw2dFormat;
DisplayFormat * rgb2dFormat;
DisplayFormat * bw3dFormat;
/**
*
* @brief m_images holds all opened images.
*
*/
QVector< GuiImage* > m_images;
/**
*
* @brief m_pixmapItems holds all pixmapLabelItems.
* This class holds two pixmaps, one for the image,
* and one for the label.
*
*/
QVector< QGraphicsPixmapItem * > m_pixmapItems;
QVector< QGraphicsPixmapItem * > m_labelItems;
/**
*
* @brief m_currentImagePos holds the current image position.
*
*/
int m_currentImagePos;
/**
* @brief m_thumbsWidget is a pointer to the thumbnails dock.
*/
ThumbsWidget *m_thumbsWidget;
/**
* @brief scale
*/
double scale;
public:
enum { MaxRecentFiles = 10 };
/**
*
* @brief Controller's constructor
* @param views is the number of the views of the imageViewer.
* @param parent is the parent object.
*
*/
explicit Controller( int views, QObject *parent = 0 );
/**
*
* @brief currentImage
* @return A pointer to the current guiimage.
*
*/
GuiImage* currentImage( );
/**
*
* @brief currentImage
* @return A pointer to the current guiimage.
*
*/
GuiImage* imageAt( int pos );
/**
*
* @brief currentImagePos
* @return The current image position
*
*/
int currentImagePos( ) const;
/**
*
* @brief addImage Adds an image to vector.
* @param fname is the file name of the Image to be opened.
*
*/
bool addImage( QString fname );
/**
*
* @brief addLabel Adds a label to the current image.
* @param label is the file name of the label to be opened.
*
*/
bool addLabel( QString label );
/**
*
* @brief removeCurrentLabel removes the current label from current image.
* @return true if removed successfully.
*
*/
bool removeCurrentLabel( );
/**
*
* @brief removeCurrentImage removes the current image from vector.
*
*/
void removeCurrentImage( );
/**
*
* @brief isEmpty
* @return true the vector is empty
*
*/
bool isEmpty( );
/**
*
* @brief clear Clears the image vector, and resets thumbnails.
*
*/
void clear( );
/**
*
* @brief size
* @return The image vector size.
*
*/
int size( );
/**
* @brief setThumbsWidget setThumbsWidget sets the pointer to the thumbnails dock.
* @param thumbsWidget
*/
void setThumbsWidget( ThumbsWidget *thumbsWidget );
/**
* @brief currentFormat
*/
DisplayFormat * currentFormat( );
/**
* @brief getPixmapItem returns the PixmapItem of the view.
* @param view is the number of the view;
* @return
*/
QGraphicsPixmapItem* getPixmapItem( size_t view );
/**
* @brief getLabelItem returns the LabelItem of the view.
* @param view is the number of the view;
* @return
*/
QGraphicsPixmapItem* getLabelItem( size_t view );
signals:
/**
* @brief This signal is emmited every time the current image changes.
*/
void currentImageChanged( );
/**
* @brief This signal is emmited every time the current image is updated.
*/
void imageUpdated( );
/**
* @brief This signal is emmited avery time the m_images vector is updated.
*/
void containerUpdated( );
/**
* @brief recentFilesUpdated
*/
void recentFilesUpdated( );
public slots:
/**
*
* @brief update updates the image pixmaps.
*
*/
void update( );
/**
*
* @brief setCurrentImagePos
* @param position is the position of the image in the images vector.
*
*/
void setCurrentImagePos( int position );
/**
*
* @brief loadNextImage is a slot called from controlsdock
* that loads the next image ( like an circular list ).
*
*/
void loadNextImage( );
/**
* @brief setCurrentSlice is called by the imageViewer when the slider or
* the spinbox have theis values updated.
* @param view
* @param slice
*/
void setCurrentSlice( size_t view, size_t slice );
/**
* @brief setZoom updates the zoom factor.
* @param value
*/
void setZoom( int value );
/**
* @brief setInterpolation switches between smoot and fast interpolation.
* @param isSmooth
*/
void setInterpolation(bool isSmooth);
/**
* @brief rotateAll90 rotates all views in 90 degrees.
*/
void rotateAll90();
/**
* @brief rotate90 rotates a view in 90 degrees.
* @param view View number
*/
void rotate90(size_t view);
/**
* @brief flipH mirrors the current view on X axis.
* @param view View number
*/
void flipH(size_t view);
/**
* @brief flipV mirrors the current view on Y axis.
* @param view View number
*/
void flipV(size_t view);
private:
/**
* @brief setRecentFile
* @param file
*/
void setRecentFile( QString fname );
};
#endif /** CONTROLLER_H */