-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathComponentEditorSettingsPage.h
165 lines (136 loc) · 4.57 KB
/
ComponentEditorSettingsPage.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//-----------------------------------------------------------------------------
// File: ComponentEditorSettingsPage.h
//-----------------------------------------------------------------------------
// Project: Kactus 2
// Author: Mikko Teuho
// Date: 11.11.2014
//
// Description:
// Component editor property settings page.
//-----------------------------------------------------------------------------
#ifndef COMPONENTEDITORSETTINGSPAGE_H
#define COMPONENTEDITORSETTINGSPAGE_H
#include "SettingsPage.h"
#include "ComponentEditorSettingsPage.h"
#include <QCheckBox>
#include <QTableWidget>
#include <QStackedWidget>
class ComponentEditorSettingsPage : public SettingsPage
{
Q_OBJECT
public:
ComponentEditorSettingsPage(QSettings &settings);
virtual ~ComponentEditorSettingsPage() = default;
//! Disable copying.
ComponentEditorSettingsPage(ComponentEditorSettingsPage const& rhs) = delete;
ComponentEditorSettingsPage& operator=(ComponentEditorSettingsPage const& rhs) = delete;
/*!
* Applies the changes that were done to the page.
*/
virtual void apply() override final;
public slots:
/*!
* Select all hardware check boxes from the selected row.
*
* @param [in] rowIndex The selected row.
*/
void onHwHorizonSelectAll(int rowIndex);
/*!
* Select all hardware check boxes from the selected column.
*
* @param [in] columnIndex The selected column.
*/
void onHwVerticalSelectAll(int columnIndex);
/*!
* Select all software check boxes from the selected row.
*
* @param [in] rowIndex The selected row.
*/
void onSwHorizonSelectAll(int rowIndex);
/*!
* Select all software check boxes from the selected column.
*
* @param [in] columnIndex If software would have hierarchy, this selects it.
*/
void onSwVerticalSelectAll();
/*!
* Change the workspace index.
*
* @param [in] workspaceIndex The index value of the new workspace.
*/
void onWorkspaceChanged(int workspaceIndex);
private:
/*!
* Apply the hardware settings.
*
* @param [in] workspaceIndex The current workspace index.
*/
void applyHwSettings(int workspaceIndex) const;
/*!
* Apply the software settings.
*
* @param [in] workspaceIndex The current workspace index.
*/
void applySwSettings(int workspaceIndex) const;
/*!
* Setup the layout.
*/
void setupLayout();
/*!
* Setup the table for the layout.
*/
QStackedWidget* createWorkspacePages(QString currentWorkspaceName, QStringList workspaceNames);
/*!
* Get the names of the hierarchies.
*/
QStringList getHierarchyNames() const;
/*!
* Set the check box names to correct format.
*
* @param [in/out] checkBoxNames List of names to be changed.
*/
void changeNameSeparators(QStringList& checkBoxNames);
/*!
* Set the hardware table.
*
* @param [in] table The table.
* @param [in] horizontalHeaders Horizontal headers for the table.
* @param [in] verticalHeaders Vertical headers for the table.
* @param [in] workspaceIndex Current workspace index.
*/
void setHwTable(QTableWidget* table, QStringList horizontalHeaders, QStringList verticalHeaders,
int workspaceIndex);
/*!
* Set the software table.
*
* @param [in] table The table.
* @param [in] horizontalHeaders Horizontal headers for the table.
* @param [in] verticalHeaders Vertical headers for the table.
* @param [in] workspaceIndex Current workspace index.
*/
void setSwTable(QTableWidget* table, QStringList horizontalHeaders, QStringList verticalHeaders,
int workspaceIndex);
/*!
* Center the check box to a table cell.
*
* @param [in] checkBox Check box to be centered.
*/
QWidget* centeredCheckBox(QCheckBox* checkBox);
/*!
* Loads the current settings.
*/
void loadSettings();
/*!
* Set the check boxes to their respective lists.
*
* @param [in] checkBoxes The current usable check box list.
*/
QList <QCheckBox*> setCheckBoxes();
//! All the hardware check boxes used by all the workspaces. Structured as workspace.hierarchy.checkboxes.
QList <QList <QList <QCheckBox*> > > workspaceHwCheckBoxes_;
//! All the software check boxes used by all the workspaces. Structured as workspace.checkboxes.
QList <QList <QCheckBox*> > workspaceSwCheckBoxes_;
//! The current workspace index.
int currentWorkspaceIndex_ = 0;
};
#endif // COMPONENTEDITORSETTINGSPAGE_H