IntelliPhoto  0.5
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 "IntelliInputDialog.h"
18 
19 //for unit testing
20 class UnitTest;
21 
22 // PaintingArea used to paint the image
23 class PaintingArea;
24 
25 class IntelliTool;
26 
27 class IntelliColorPicker;
28 
32 class IntelliPhotoGui : public QMainWindow {
33 friend UnitTest;
34 // Declares our class as a QObject which is the base class
35 // for all Qt objects
36 // QObjects handle events
37 Q_OBJECT
38 public:
43 
44 void UpdateGui();
45 
46 void setToolWidth(int value);
47 
48 protected:
52 void closeEvent(QCloseEvent*event) override;
53 
54 private slots:
55 void slotOpen();
56 void slotSave();
57 
58 // layer slots here
59 void slotCreateNewRasterLayer();
60 void slotCreateNewShapedLayer();
61 void slotDeleteLayer();
62 void slotSetActiveLayer();
63 void slotSetActiveAlpha();
64 void slotSetPolygon();
65 void slotPositionMoveUp();
66 void slotPositionMoveDown();
67 void slotPositionMoveLeft();
68 void slotPositionMoveRight();
69 void slotMoveLayerUp();
70 void slotMoveLayerDown();
71 
72 void slotUpdateRenderSettingsOn();
73 void slotUpdateRenderSettingsOff();
74 
75 void slotSetFirstColor();
76 void slotSetSecondColor();
77 void slotSwapColor();
78 
79 void slotCreatePenTool();
80 void slotCreatePlainTool();
81 void slotCreateLineTool();
82 void slotCreateRectangleTool();
83 void slotCreateCircleTool();
84 void slotCreatePolygonTool();
85 void slotCreateFloodFillTool();
86 
87 void slotAboutDialog();
88 
89 void slotChangeDim();
90 
91 void slotEnterPressed();
92 
93 void slotSetWidth();
94 void slotSetInnerAlpha();
95 
96 void slotResetTools();
97 
98 private:
99 void createActions();
100 void createMenus();
101 void createGui();
102 // Set the style of the GUI
103 void setIntelliStyle();
104 
105 // Will check if changes have occurred since last save
106 bool maybeSave();
107 // Opens the Save dialog and saves
108 bool saveFile(const QByteArray &fileFormat);
109 
110 void setDefaultToolValue();
111 
112 // What we'll draw on
113 PaintingArea* paintingArea;
114 
115 const QSize Buttonsize = QSize(35,35);
116 QPixmap preview;
117 QPushButton* CircleButton;
118 QPushButton* FloodFillButton;
119 QPushButton* LineButton;
120 QPushButton* PenButton;
121 QPushButton* PlainButton;
122 QPushButton* PolygonButton;
123 QPushButton* RectangleButton;
124 QLabel* WidthLine;
125 QLabel* innerAlphaLine;
126 QLineEdit* EditLineWidth;
127 QLineEdit* EditLineInnerAlpha;
128 QIntValidator* ValidatorLineWidth;
129 QIntValidator* ValidatorInnerAlpha;
130 
131 QPushButton* FirstColorButton;
132 QPushButton* SecondColorButton;
133 QPushButton* SwitchColorButton;
134 
135 QLabel* ActiveLayerLine;
136 QLabel* ActiveLayerImageLabel;
137 
138 QPushButton* dimActive;
139 QPushButton* dimCanvas;
140 
141 // The menu widgets
142 QMenu*saveAsMenu;
143 QMenu*fileMenu;
144 QMenu*renderMenu;
145 QMenu*optionMenu;
146 QMenu*layerCreationMenu;
147 QMenu*layerMenu;
148 QMenu*colorMenu;
149 QMenu*toolCreationMenu;
150 QMenu*toolSettingsMenu;
151 QMenu*toolMenu;
152 QMenu*helpMenu;
153 
154 // All the actions that can occur
155 // meta image actions (need further modularisation)
156 QAction* actionOpen;
157 QAction* actionExit;
158 
159 //Rendersetting actions
160 QAction*actionUpdateRenderSettingsOn;
161 QAction*actionUpdateRenderSettingsOff;
162 
163 // color Picker actions
164 QAction* actionColorPickerFirstColor;
165 QAction* actionColorPickerSecondColor;
166 QAction* actionColorSwap;
167 
168 // tool actions
169 QAction* actionCreatePenTool;
170 QAction* actionCreatePlainTool;
171 QAction* actionCreateLineTool;
172 QAction* actionCreateRectangleTool;
173 QAction* actionCreateCircleTool;
174 QAction* actionCreatePolygonTool;
175 QAction* actionCreateFloodFillTool;
176 
177 // dimension actions
178 QAction*actionChangeDim;
179 
180 // dialog actions
181 QAction* actionAboutDialog;
182 QAction* actionAboutQtDialog;
183 
184 // layer change actions
185 QAction* actionCreateNewRasterLayer;
186 QAction* actionCreateNewShapedLayer;
187 QAction* actionDeleteLayer;
188 QAction* actionSetActiveLayer;
189 QAction* actionSetActiveAlpha;
190 QAction* actionSetPolygon;
191 QAction* actionMovePositionUp;
192 QAction* actionMovePositionDown;
193 QAction* actionMovePositionLeft;
194 QAction* actionMovePositionRight;
195 QAction* actionMoveLayerUp;
196 QAction* actionMoveLayerDown;
197 
198 // Actions tied to specific file formats
199 QList<QAction*> actionSaveAs;
200 
201 QAction* actionSetWidth;
202 QAction* actionSetInnerAlpha;
203 
204 // main GUI elements
205 QWidget* centralGuiWidget;
206 QGridLayout* mainLayout;
207 };
208 
209 #endif
IntelliInputDialog.h
IntelliPhotoGui
The IntelliPhotoGui base class handles the graphical user interface and events for the intelliPhoto p...
Definition: IntelliPhotoGui.h:32
IntelliPhotoGui::IntelliPhotoGui
IntelliPhotoGui()
The IntelliPhotoGui method is the constructor and is used to create a new instance of the main progra...
Definition: IntelliPhotoGui.cpp:7
PaintingArea
The PaintingArea class manages the methods and stores information about the current painting area,...
Definition: PaintingArea.h:53
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:23
IntelliPhotoGui::setToolWidth
void setToolWidth(int value)
Definition: IntelliPhotoGui.cpp:827
IntelliColorPicker
The IntelliColorPicker manages the selected colors for one whole project.
Definition: IntelliColorPicker.h:14
IntelliPhotoGui::UpdateGui
void UpdateGui()
Definition: IntelliPhotoGui.cpp:836
UnitTest
Definition: mainUnitTest.cpp:8