IntelliPhoto  0.6
IntelliPhotoGui.h
Go to the documentation of this file.
1 #ifndef IntelliPhotoGui_H
2 #define IntelliPhotoGui_H
3 
4 #include <QAction>
5 #include <QFileDialog>
6 #include <QMessageBox>
7 #include <QImageWriter>
8 #include <QMenu>
9 #include <QMenuBar>
10 #include <QList>
11 #include <QMainWindow>
12 #include <QGridLayout>
13 #include <QPushButton>
14 #include <QTextEdit>
15 #include <QLabel>
16 #include <QLineEdit>
17 #include <QScrollArea>
18 #include "IntelliInputDialog.h"
20 
21 //for unit testing
22 class UnitTest;
23 
24 // PaintingArea used to paint the image
25 class PaintingArea;
26 
27 class IntelliTool;
28 
29 class IntelliColorPicker;
30 
34 class IntelliPhotoGui : public QMainWindow {
35 friend UnitTest;
36 // Declares our class as a QObject which is the base class
37 // for all Qt objects
38 // QObjects handle events
39 Q_OBJECT
40 public:
45 
46 void UpdateGui();
47 
48 void setToolWidth(int value);
49 
50 protected:
54 void closeEvent(QCloseEvent*event) override;
55 
56 private slots:
57 void slotOpen();
58 void slotSave();
59 
60 // layer slots here
61 void slotCreateNewRasterLayer();
62 void slotCreateNewShapedLayer();
63 void slotDeleteLayer();
64 void slotSetActiveLayer();
65 void slotSetActiveAlpha();
66 void slotSetPolygon();
67 void slotPositionMoveUp();
68 void slotPositionMoveDown();
69 void slotPositionMoveLeft();
70 void slotPositionMoveRight();
71 void slotMoveLayerUp();
72 void slotMoveLayerDown();
73 
74 void slotUpdateRenderSettingsOn();
75 void slotUpdateRenderSettingsOff();
76 
77 void slotSetFirstColor();
78 void slotSetSecondColor();
79 void slotSwapColor();
80 
81 void slotCreatePenTool();
82 void slotCreatePlainTool();
83 void slotCreateLineTool();
84 void slotCreateRectangleTool();
85 void slotCreateCircleTool();
86 void slotCreatePolygonTool();
87 void slotCreateFloodFillTool();
88 
89 void slotAboutDialog();
90 
91 void slotChangeDim();
92 
93 void slotEnterPressed();
94 
95 void slotSetWidth();
96 void slotSetInnerAlpha();
97 
98 void slotResetTools();
99 
100 void slotGoBack();
101 void slotGoForward();
102 
103 private:
104 
105 //setup functions for gui
106 void createActions();
107 void createMenus();
108 void createGui();
109 void setIntelliStyle();
110 
111 // Will check if changes have occurred since last save
112 bool maybeSave();
113 // Opens the Save dialog and saves
114 bool saveFile(const QByteArray &fileFormat);
115 
116 //basic to set tool values to begin
117 void setDefaultValues();
118 
119 // What we'll draw on
120 PaintingArea* paintingArea;
121 
122 //used to display a preview of the active layer
123 QPixmap preview;
124 
125 //size of all buttons
126 const QSize Buttonsize = QSize(35,35);
127 
128 //buttons used for gui
129 QPushButton* CircleButton;
130 QPushButton* FloodFillButton;
131 QPushButton* LineButton;
132 QPushButton* PenButton;
133 QPushButton* PlainButton;
134 QPushButton* PolygonButton;
135 QPushButton* RectangleButton;
136 QPushButton* FirstColorButton;
137 QPushButton* SecondColorButton;
138 QPushButton* SwitchColorButton;
139 QPushButton* dimActive;
140 QPushButton* dimCanvas;
141 
142 //labels used for gui
143 QLabel* WidthLine;
144 QLabel* innerAlphaLine;
145 QLabel* ActiveLayerLine;
146 QLabel* ActiveLayerImageLabel;
147 
148 //scroll area to display canvas
149 QScrollArea* ScrollArea;
150 
151 //line edits used for gui
152 QLineEdit* EditLineWidth;
153 QLineEdit* EditLineInnerAlpha;
154 
155 //int validator used for gui
156 QIntValidator* ValidatorLineWidth;
157 QIntValidator* ValidatorInnerAlpha;
158 
159 
160 // The menu widgets
161 QMenu* saveAsMenu;
162 QMenu* fileMenu;
163 QMenu* renderMenu;
164 QMenu* optionMenu;
165 QMenu* layerCreationMenu;
166 QMenu* layerMenu;
167 QMenu* colorMenu;
168 QMenu* toolCreationMenu;
169 QMenu* toolSettingsMenu;
170 QMenu* toolMenu;
171 QMenu* helpMenu;
172 
173 // All the actions that can occur
174 // meta image actions (need further modularisation)
175 QAction* actionOpen;
176 QAction* actionExit;
177 
178 //Rendersetting actions
179 QAction*actionUpdateRenderSettingsOn;
180 QAction*actionUpdateRenderSettingsOff;
181 
182 // color Picker actions
183 QAction* actionColorPickerFirstColor;
184 QAction* actionColorPickerSecondColor;
185 QAction* actionColorSwap;
186 
187 // tool actions
188 QAction* actionCreatePenTool;
189 QAction* actionCreatePlainTool;
190 QAction* actionCreateLineTool;
191 QAction* actionCreateRectangleTool;
192 QAction* actionCreateCircleTool;
193 QAction* actionCreatePolygonTool;
194 QAction* actionCreateFloodFillTool;
195 
196 // dimension actions
197 QAction* actionChangeDim;
198 QAction* actionSetWidth;
199 QAction* actionSetInnerAlpha;
200 
201 // dialog actions
202 QAction* actionAboutDialog;
203 QAction* actionAboutQtDialog;
204 
205 // layer change actions
206 QAction* actionCreateNewRasterLayer;
207 QAction* actionCreateNewShapedLayer;
208 QAction* actionDeleteLayer;
209 QAction* actionSetActiveLayer;
210 QAction* actionSetActiveAlpha;
211 QAction* actionSetPolygon;
212 QAction* actionMovePositionUp;
213 QAction* actionMovePositionDown;
214 QAction* actionMovePositionLeft;
215 QAction* actionMovePositionRight;
216 QAction* actionMoveLayerUp;
217 QAction* actionMoveLayerDown;
218 
219 // actions tied to specific file formats
220 QList<QAction*> actionSaveAs;
221 
222 
223 // history actions
224 QAction* actionGoBack;
225 QAction* actionGoForward;
226 
227 // main GUI elements
228 QWidget* centralGuiWidget;
229 QGridLayout* mainLayout;
230 };
231 
232 #endif
IntelliInputDialog.h
IntelliPhotoGui
The IntelliPhotoGui base class handles the graphical user interface and events for the intelliPhoto p...
Definition: IntelliPhotoGui.h:34
IntelliPhotoGui::IntelliPhotoGui
IntelliPhotoGui()
The IntelliPhotoGui method is the constructor and is used to create a new instance of the main progra...
Definition: IntelliPhotoGui.cpp:12
PaintingArea
The PaintingArea class manages the methods and stores information about the current painting area,...
Definition: PaintingArea.h:57
IntelliTool
An abstract class that manages the basic events, like mouse clicks or scrolls events.
Definition: IntelliTool.h:17
IntelliPhotoGui::closeEvent
void closeEvent(QCloseEvent *event) override
The closeEvent function handles closing events.
Definition: IntelliPhotoGui.cpp:27
IntelliPhotoGui::setToolWidth
void setToolWidth(int value)
Definition: IntelliPhotoGui.cpp:886
IntelliColorPicker
The IntelliColorPicker manages the selected colors for one whole project.
Definition: IntelliColorPicker.h:14
IntelliPhotoGui::UpdateGui
void UpdateGui()
Definition: IntelliPhotoGui.cpp:895
UnitTest
Definition: mainUnitTest.cpp:8
IntelliDatamanager.h