-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.h
149 lines (146 loc) · 6.24 KB
/
app.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#ifndef APP_H
#define APP_H
#include "appstate.h"
#include "customscene.h"
#include "jsonhelper.h"
#include "customrectangle.h"
#include "customcircle.h"
#include "customtext.h"
#include "customtextrectangle.h"
#include "customtextcircle.h"
#include "customtextpoint.h"
namespace app {
/**
* @brief The App class
* @details This class contains essential program features
* it handle the item creation and the update progress of the items and the GUI
* @author Lars Telöken
* @version 1.0
* @date 2019-01-27
*/
class App : public QObject
{
Q_OBJECT
signals:
/**
* @brief signal_selectedItemUpdate - A signal which getting the Items properties and emit them
* @param color - the color of an item
* @param height - the height of an item
* @param text - the text of an item
* @param borderSize - the border size of an item
* @details This method is called in app::onCanvasClicked
* It get the items properties and emit them to the GUI
*/
void signal_selectedItemUpdate(QColor color, qreal height, QString text, qreal borderSize);
public slots:
/**
* @brief onCanvasClicked - slot which is triggered when a click on the canvas is recognized
* @details This method is called in a connect in the MainWindow
* It creates an Item on the clicked position on the canvas
*/
void onCanvasClicked();
/**
* @brief removeSelectedItems - slot which removes selected items
* @details This method is called in a connect in the MainWindow
* It iterates threw a list of selectedItems and delete them
*/
void removeSelectedItems();
/**
* @brief createJson - creates a Json file with all elements on the canvas
* @param filePath - the path where the file is saved
* @details This method is called in MainWindow::on_actionSave_triggered
* It calls the JsonHelper class to create a json file
*/
void createJson(QString filePath);
/**
* @brief readJson - read a Json file with all elements on the canvas
* @param filePath - the path where the file is saved
* @details This method is called in MainWindow::on_actionOpen_triggered
* It calls the JsonHelper class to read a json file
*/
void readJson(QString filePath);
/**
* @brief onSelectedItemSizeChanged - updates the items if the properties are changed in the GUI
* @param size - the new size of an item
* @details This method is called in a connect in the MainWindow
* It update the size of the items if the GUI change their size
*/
void onSelectedItemSizeChanged(qreal size);
/**
* @brief onSelectedItemBorderSizeChanged - updates the itmes if the properties are changed in the GUI
* @param borderSize - the new border size of an items border
* @details This method is called in a connect in the MainWindow
* It update the border size of the otems if the GUI change their size
*/
void onSelectedItemBorderSizeChanged(qreal borderSize);
/**
* @brief onItemSelected - update the properties in the GUI if an item is selected
* @details This method is called in a connect in the MainWindow
* With the help of this method you can select an item on the canvas and the spinboxes etc are changing their values to the selcted item value
*/
void onItemSelected();
private:
/**
* @brief m_scene - the scenen on which all items are added
* @details This member is initialized in the Constructor of the App class
*/
CustomScene *m_scene;
/**
* @brief m_state - contains the app states
* @details This member contains important data about the project
*/
AppState *m_state;
/**
* @brief m_graphicsPixmapItem - contains the background image of the scene
* @details This member contains the image of the scene to get it on multiply functions
*/
QGraphicsPixmapItem *m_graphicsPixmapItem;
public:
/**
* @brief Constructor - the contructor of the class
* @details creates objects of QGraphicsPixmapItem, CustomScene and the AppState
*/
App();
/**
* @brief setGraphicsPixmapItem - setter of the graphicsPixmapItem
* @param graphicsPixmapItem - the item
* @details This method is called in MainWindow::on_actionImport_triggered
*/
void setGraphicsPixmapItem(QGraphicsPixmapItem *graphicsPixmapItem);
/**
* @brief getGraphicsPixmapItem - getter of the graphicsPixmapItem
* @return returned the graphicsPixmapitem
* @details This method is called in MainWindow::resizeEvent
*/
QGraphicsPixmapItem *getGraphicsPixmapItem();
/**
* @brief setScene - setter of the scene
* @param scene - contains geometry forms
* @details This method is called in MainWindow::initializeGuiElements
*/
void setScene(CustomScene *scene);
/**
* @brief getScene - getter of the scene
* @return returned a scene
* @details This method is called in MainWindow::on_actionImport_triggered, MainWindow::initializeGuiElements and in connects in the MainWindow
*/
CustomScene *getScene();
/**
* @brief setAppState - setter of the appState
* @param appState - state of the program
*/
void setAppState(AppState *appState);
/**
* @brief getAppState - getter of the appState
* @return returned appState
* @details This method is called in MainWindow::initializeGuiElements, MainWindow::onGuiEnabledChanged, MainWindow::on_pushButton_toolPropertieColor_clicked,
* MainWindow::on_pushButton_toolPropertieColor_clicked, MainWindow::setTextToolsGuiVisible, MainWindow::on_toolButtonLeftClicked and in connects in the MainWindow
*/
AppState *getAppState();
/**
* @brief Destructor - destructor of the class
*/
~App();
};
}
#endif // APP_H