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