FOSSredder 0.5.0
Loading...
Searching...
No Matches
Navigation.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <QObject>
9
10namespace ui {
11
15class Navigation : public QObject {
16 Q_OBJECT
17 Q_PROPERTY(
19 Q_PROPERTY(int sectionValue READ sectionValue NOTIFY sectionChanged)
20 Q_PROPERTY(int activeSection READ activeSection NOTIFY sectionChanged)
21 Q_PROPERTY(int actorSection READ actorSection CONSTANT)
22 Q_PROPERTY(int propertySection READ propertySection CONSTANT)
23 Q_PROPERTY(int contractSection READ contractSection CONSTANT)
24 Q_PROPERTY(int bookingSection READ bookingSection CONSTANT)
25 Q_PROPERTY(int importSection READ importSection CONSTANT)
26 Q_PROPERTY(int exportSection READ exportSection CONSTANT)
27 Q_PROPERTY(int settingsSection READ settingsSection CONSTANT)
28 Q_PROPERTY(int analysisSection READ analysisSection CONSTANT)
29 Q_PROPERTY(int annualSection READ annualSection CONSTANT)
30
31public:
46 Q_ENUM(Section)
47
52
62
67 explicit Navigation(QObject* parent = nullptr);
68
74 return settingsCategory_;
75 }
76
81 int settingsCategoryValue() const noexcept {
82 return static_cast<int>(settingsCategory_);
83 }
84
90
95 Q_INVOKABLE void setSettingsCategoryValue(int value);
96
101 Section section() const noexcept {
102 return section_;
103 }
104
109 int sectionValue() const noexcept {
110 return static_cast<int>(section_);
111 }
112
117 int activeSection() const noexcept {
118 return sectionValue();
119 }
120
122 int actorSection() const noexcept {
123 return static_cast<int>(Section::Actors);
124 }
125
127 int propertySection() const noexcept {
128 return static_cast<int>(Section::Properties);
129 }
130
132 int contractSection() const noexcept {
133 return static_cast<int>(Section::Contracts);
134 }
135
137 int bookingSection() const noexcept {
138 return static_cast<int>(Section::Booking);
139 }
140
142 int importSection() const noexcept {
143 return static_cast<int>(Section::Import);
144 }
145
147 int exportSection() const noexcept {
148 return static_cast<int>(Section::Export);
149 }
150
152 int settingsSection() const noexcept {
153 return static_cast<int>(Section::Settings);
154 }
155
157 int analysisSection() const noexcept {
158 return static_cast<int>(Section::Analysis);
159 }
160
162 int annualSection() const noexcept {
163 return static_cast<int>(Section::Annual);
164 }
165
170 void setSection(Section s);
171
176 Q_INVOKABLE void setSectionValue(int value);
177
182 Q_INVOKABLE void navigateToSection(int section);
183
184signals:
189
194
195private:
196 Section section_ = Section::Import;
198 bool sectionChangeQueued_ = false;
199 bool settingsCategoryChangeQueued_ = false;
200};
201
202} // namespace ui
int actorSection() const noexcept
Returns the actor section enum value for QML.
Definition Navigation.h:122
int importSection() const noexcept
Returns the import section enum value for QML.
Definition Navigation.h:142
int analysisSection() const noexcept
Returns the analysis section enum value for QML.
Definition Navigation.h:157
Q_INVOKABLE void setSectionValue(int value)
Sets the active shell section from QML.
Section section
Definition Navigation.h:18
int bookingSection() const noexcept
Returns the booking section enum value for QML.
Definition Navigation.h:137
int sectionValue() const noexcept
Returns the active shell section as QML-friendly integer.
Definition Navigation.h:109
int propertySection() const noexcept
Returns the property section enum value for QML.
Definition Navigation.h:127
Section
Top-level shell sections shown by the desktop UI.
Definition Navigation.h:35
int activeSection() const noexcept
Returns the active shell section value used by QML.
Definition Navigation.h:117
void sectionChanged()
Emitted when the active shell section changes.
int annualSection() const noexcept
Returns the annual section enum value for QML.
Definition Navigation.h:162
SettingsCategory
Settings page categories shown inside the settings section.
Definition Navigation.h:56
void setSettingsCategory(SettingsCategory c)
Sets the active settings category.
Section section() const noexcept
Returns the active shell section.
Definition Navigation.h:101
int contractSection() const noexcept
Returns the contract section enum value for QML.
Definition Navigation.h:132
int settingsCategoryValue() const noexcept
Returns the active settings category as QML-friendly integer.
Definition Navigation.h:81
void setSection(Section s)
Sets the active shell section.
Q_INVOKABLE void navigateToSection(int section)
Navigates to a top-level shell section from QML.
SettingsCategory settingsCategory
Definition Navigation.h:49
Q_INVOKABLE void setSettingsCategoryValue(int value)
Sets the active settings category from QML.
Navigation(QObject *parent=nullptr)
Creates the navigation state.
void settingsCategoryChanged()
Emitted when the active settings category changes.
int settingsCategoryValue
Definition Navigation.h:51
int exportSection() const noexcept
Returns the export section enum value for QML.
Definition Navigation.h:147
SettingsCategory settingsCategory() const noexcept
Returns the active settings category.
Definition Navigation.h:73
int settingsSection() const noexcept
Returns the settings section enum value for QML.
Definition Navigation.h:152