-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstateWidget.h
150 lines (129 loc) · 3.4 KB
/
stateWidget.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
150
class StateWidget;
#ifndef STATEWIDGET_H
#define STATEWIDGET_H
#include "respecta.h"
#include "States.h"
#include "globals.h"
#include "StateTypeWidgets.h"
#include <QDialog>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QDialogButtonBox;
class QComboBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QGridLayout;
class QVBoxLayout;
QT_END_NAMESPACE
/**
* Widget allowing to edit states, containing widgets for all child-classes of BaseState.
*/
class StateWidget : public QWidget
{
Q_OBJECT
public:
StateWidget(QWidget * w,Model * newmod );
/**
* Created for future needs, does nothing.
*/
void refreshData();
/**
* opens a MyTypeWidget connected to the state of ToLoadState, and loads all the data of ToLoadState to relevant fields.
*/
void StateSelected(BaseState * ToLoadState);
/**
* Disables OK button and notes, that no state is currently edited.
*/
void setOKButtonDisabled(){OKButton->setDisabled(true);edited=NULL;}
signals:
/**
* Signals, that newState will be inserted.
*/
//void InsertState(BaseState * newState);
/**
* Signals to a parent widget, that an error has occured.
*/
void reportError(QString msgString);
/**
* Signals, that user requests to change oldState to newState.
*/
void ReplaceState(BaseState * oldState, BaseState * newState);
private slots:
/**
* Forwards error message from child widgets to aprent widget.
*/
void forwardError(QString msgString){emit reportError(msgString);}
/**
* Changes active widget to that of Type == chosen, and blocks/unblocks NameLineEdit if neccessary.
*/
void setStateSubclass(QString newString);
/**
* Blocks or unblocks ok/insert buttons depending on text.size().
*/
void lengthChanged(QString text);
/**
* User accepts change in state (uses ReplaceState signal).
*/
void AcceptState();
/**
* User wants to insert a State (uses InsertState Signal)
*/
//void InsertState();
private:
/**
* Function returning a state from the current widget (updated with name and statetype).
*/
BaseState * getState();
/**
* Checks if name specified for the state is OK.
* @returns True, if anme is correct.
*/
bool StateNameOK();
/**
* Pointer to the model of the project.
*/
Model * mod;
/**
* State that is currently edited, NULL if none.
*/
BaseState * edited;
/**
* Layout containing base informations for all states.
*/
QVBoxLayout *StateLayout;
/**
* Layout containing other layouts and all the MyWidgetType widgets.
*/
QVBoxLayout *mainLayout;
/**
* LineEdit to edit Name of the state.
*/
QLineEdit *stateNameEdit;
/**
* LineEdit to edit parameters of a state.
*/
QLineEdit *paramEdit;
/**
* Button accepting change of edited state.
*/
QPushButton *OKButton;
/**
* Button signaling that this state will be inserted.
*/
//QPushButton *InsertButton;
/**
* Combobox to choose a type of the state.
*/
QComboBox *stateTypeCombo;
/**
* Widgets allowing to edit different types of states.
*/
MyTypeWidget* StateWidgets[STATE_TYPES_NUMBER];
/**
* Index of the widget, which is currently active.
*/
int tmpWidget;
};
#endif // STATEWIDGET_H