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 
14 // PaintingArea used to paint the image
15 class PaintingArea;
16 
17 class IntelliTool;
18 
19 class IntelliColorPicker;
20 
24 class IntelliPhotoGui : public QMainWindow {
25 // Declares our class as a QObject which is the base class
26 // for all Qt objects
27 // QObjects handle events
28 Q_OBJECT
29 public:
34 
35 void UpdateGui();
36 
37 protected:
38 // Function used to close an event
39 void closeEvent(QCloseEvent*event) override;
40 
41 private slots:
42 // meta slots here (need further )
43 void slotOpen();
44 void slotSave();
45 
46 // layer slots here
47 void slotCreateNewLayer();
48 void slotDeleteLayer();
49 void slotClearActiveLayer();
50 void slotSetActiveLayer();
51 void slotSetActiveAlpha();
52 void slotPositionMoveUp();
53 void slotPositionMoveDown();
54 void slotPositionMoveLeft();
55 void slotPositionMoveRight();
56 void slotMoveLayerUp();
57 void slotMoveLayerDown();
58 
59 // color Picker slots here
60 void slotSetFirstColor();
61 void slotSetSecondColor();
62 void slotSwapColor();
63 
64 // tool slots here
65 void slotCreatePenTool();
66 void slotCreatePlainTool();
67 void slotCreateLineTool();
68 void slotCreateRectangleTool();
69 void slotCreateCircleTool();
70 void slotCreatePolygonTool();
71 void slotCreateFloodFillTool();
72 
73 // slots for dialogs
74 void slotAboutDialog();
75 
76 void slotEnterPressed();
77 
78 void slotResetTools();
79 
80 private:
81 // Will tie user actions to functions
82 void createActions();
83 void createMenus();
84 // setup GUI elements
85 void createGui();
86 // set style of the GUI
87 void setIntelliStyle();
88 
89 // Will check if changes have occurred since last save
90 bool maybeSave();
91 // Opens the Save dialog and saves
92 bool saveFile(const QByteArray &fileFormat);
93 
94 void setDefaultToolValue();
95 
96 // What we'll draw on
97 PaintingArea* paintingArea;
98 
99 const QSize Buttonsize = QSize(70,70);
100 QPixmap p;
101 QPushButton* CircleButton;
102 QPushButton* FloodFillButton;
103 QPushButton* LineButton;
104 QPushButton* PenButton;
105 QPushButton* PlainButton;
106 QPushButton* PolygonButton;
107 QPushButton* RectangleButton;
108 QLabel* WidthLine;
109 QLabel* innerAlphaLine;
110 QLineEdit* EditLineWidth;
111 QLineEdit* EditLineInnerAlpha;
112 QIntValidator* ValidatorLineWidth;
113 QIntValidator* ValidatorInnerAlpha;
114 
115 QPushButton* FirstColorButton;
116 QPushButton* SecondColorButton;
117 QPushButton* SwitchColorButton;
118 
119 QLabel* ActiveLayerLine;
120 QPushButton* ActiveLayerImageButton;
121 
122 // The menu widgets
123 QMenu*saveAsMenu;
124 QMenu*fileMenu;
125 QMenu*optionMenu;
126 QMenu*layerMenu;
127 QMenu*colorMenu;
128 QMenu*toolMenu;
129 QMenu*helpMenu;
130 
131 // All the actions that can occur
132 // meta image actions (need further modularisation)
133 QAction*actionOpen;
134 QAction*actionExit;
135 
136 // color Picker actions
137 QAction*actionColorPickerFirstColor;
138 QAction*actionColorPickerSecondColor;
139 QAction*actionColorSwap;
140 
141 // tool actions
142 QAction*actionCreatePenTool;
143 QAction*actionCreatePlainTool;
144 QAction*actionCreateLineTool;
145 QAction*actionCreateRectangleTool;
146 QAction*actionCreateCircleTool;
147 QAction*actionCreatePolygonTool;
148 QAction*actionCreateFloodFillTool;
149 
150 // dialog actions
151 QAction*actionAboutDialog;
152 QAction*actionAboutQtDialog;
153 
154 // layer change actions
155 QAction*actionCreateNewLayer;
156 QAction*actionDeleteLayer;
157 QAction* actionSetActiveLayer;
158 QAction* actionSetActiveAlpha;
159 QAction* actionMovePositionUp;
160 QAction* actionMovePositionDown;
161 QAction* actionMovePositionLeft;
162 QAction* actionMovePositionRight;
163 QAction* actionMoveLayerUp;
164 QAction* actionMoveLayerDown;
165 
166 // Actions tied to specific file formats
167 QList<QAction*> actionSaveAs;
168 
169 // main GUI elements
170 QWidget* centralGuiWidget;
171 QGridLayout* mainLayout;
172 };
173 
174 #endif
IntelliPhotoGui
The IntelliPhotoGui class handles the graphical user interface for the intelliPhoto program.
Definition: IntelliPhotoGui.h:24
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:37
IntelliTool
An abstract class that manages the basic events, like mouse clicks or scrolls events.
Definition: IntelliTool.h:14
IntelliPhotoGui::closeEvent
void closeEvent(QCloseEvent *event) override
Definition: IntelliPhotoGui.cpp:23
IntelliColorPicker
The IntelliColorPicker manages the selected colors for one whole project.
Definition: IntelliColorPicker.h:11
IntelliPhotoGui::UpdateGui
void UpdateGui()
Definition: IntelliPhotoGui.cpp:694