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 slotEnterPressed();
90 
91 void slotSetWidth();
92 void slotSetInnerAlpha();
93 
94 void slotResetTools();
95 
96 private:
97 void createActions();
98 void createMenus();
99 void createGui();
100 // Set the style of the GUI
101 void setIntelliStyle();
102 
103 // Will check if changes have occurred since last save
104 bool maybeSave();
105 // Opens the Save dialog and saves
106 bool saveFile(const QByteArray &fileFormat);
107 
108 void setDefaultToolValue();
109 
110 // What we'll draw on
111 PaintingArea* paintingArea;
112 
113 const QSize Buttonsize = QSize(35,35);
114 QPixmap preview;
115 QPushButton* CircleButton;
116 QPushButton* FloodFillButton;
117 QPushButton* LineButton;
118 QPushButton* PenButton;
119 QPushButton* PlainButton;
120 QPushButton* PolygonButton;
121 QPushButton* RectangleButton;
122 QLabel* WidthLine;
123 QLabel* innerAlphaLine;
124 QLineEdit* EditLineWidth;
125 QLineEdit* EditLineInnerAlpha;
126 QIntValidator* ValidatorLineWidth;
127 QIntValidator* ValidatorInnerAlpha;
128 
129 QPushButton* FirstColorButton;
130 QPushButton* SecondColorButton;
131 QPushButton* SwitchColorButton;
132 
133 QLabel* ActiveLayerLine;
134 QLabel* ActiveLayerImageLabel;
135 
136 // The menu widgets
137 QMenu*saveAsMenu;
138 QMenu*fileMenu;
139 QMenu*renderMenu;
140 QMenu*optionMenu;
141 QMenu*layerCreationMenu;
142 QMenu*layerMenu;
143 QMenu*colorMenu;
144 QMenu*toolCreationMenu;
145 QMenu*toolSettingsMenu;
146 QMenu*toolMenu;
147 QMenu*helpMenu;
148 
149 // All the actions that can occur
150 // meta image actions (need further modularisation)
151 QAction* actionOpen;
152 QAction* actionExit;
153 
154 //Rendersetting actions
155 QAction*actionUpdateRenderSettingsOn;
156 QAction*actionUpdateRenderSettingsOff;
157 
158 // color Picker actions
159 QAction* actionColorPickerFirstColor;
160 QAction* actionColorPickerSecondColor;
161 QAction* actionColorSwap;
162 
163 // tool actions
164 QAction* actionCreatePenTool;
165 QAction* actionCreatePlainTool;
166 QAction* actionCreateLineTool;
167 QAction* actionCreateRectangleTool;
168 QAction* actionCreateCircleTool;
169 QAction* actionCreatePolygonTool;
170 QAction* actionCreateFloodFillTool;
171 
172 // dialog actions
173 QAction* actionAboutDialog;
174 QAction* actionAboutQtDialog;
175 
176 // layer change actions
177 QAction* actionCreateNewRasterLayer;
178 QAction* actionCreateNewShapedLayer;
179 QAction* actionDeleteLayer;
180 QAction* actionSetActiveLayer;
181 QAction* actionSetActiveAlpha;
182 QAction* actionSetPolygon;
183 QAction* actionMovePositionUp;
184 QAction* actionMovePositionDown;
185 QAction* actionMovePositionLeft;
186 QAction* actionMovePositionRight;
187 QAction* actionMoveLayerUp;
188 QAction* actionMoveLayerDown;
189 
190 // Actions tied to specific file formats
191 QList<QAction*> actionSaveAs;
192 
193 QAction* actionSetWidth;
194 QAction* actionSetInnerAlpha;
195 
196 // main GUI elements
197 QWidget* centralGuiWidget;
198 QGridLayout* mainLayout;
199 };
200 
201 #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:790
IntelliColorPicker
The IntelliColorPicker manages the selected colors for one whole project.
Definition: IntelliColorPicker.h:14
IntelliPhotoGui::UpdateGui
void UpdateGui()
Definition: IntelliPhotoGui.cpp:799
UnitTest
Definition: mainUnitTest.cpp:8