swift
Loading...
Searching...
No Matches
mappingcomponent.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_GUI_COMPONENTS_MAPPINGCOMPONENT_H
7#define SWIFT_GUI_COMPONENTS_MAPPINGCOMPONENT_H
8
9#include <QFrame>
10#include <QObject>
11#include <QScopedPointer>
12#include <QString>
13#include <QTimer>
14#include <Qt>
15
19#include "gui/swiftguiexport.h"
20#include "misc/identifiable.h"
21#include "misc/identifier.h"
23#include "misc/propertyindex.h"
26#include "misc/tokenbucket.h"
27#include "misc/variant.h"
28
29class QModelIndex;
30
31namespace Ui
32{
33 class CMappingComponent;
34}
35namespace swift::misc
36{
37 namespace aviation
38 {
39 class CCallsign;
40 }
41 namespace simulation
42 {
44 }
45} // namespace swift::misc
46namespace swift::gui
47{
48 namespace views
49 {
51 }
52 namespace components
53 {
59 {
61
62 public:
66 {
67 TabRenderedAircraft = 0,
68 TabAircraftModels,
69 TabInterpolatorSetup,
70 TabStatistics,
71 TabMatchingLog,
72 TabPartsLog
73 };
74
76 static const QStringList &getLogCategories();
77
79 explicit CMappingComponent(QWidget *parent = nullptr);
80
83
85 int countCurrentMappings() const;
86
88 int countAircraftModels() const;
89
91 void setTab(TabWidget tab);
92
96
97 signals:
100
101 private:
103 void onModelSetChanged(const swift::misc::simulation::CSimulatorInfo &dummy);
104
106 void onRowCountChanged(int count, bool withFilter);
107
110 void onChangedSimulatedAircraftInView(const swift::misc::CVariant &simulatedAircraft,
111 const swift::misc::CPropertyIndex &index);
112
114 void onAircraftSelectedInView(const QModelIndex &index);
115
117 void onModelSelectedInView(const QModelIndex &index);
118
120 void onSaveAircraft();
121
123 void onResetAircraft();
124
126 void onModelPreviewChanged(Qt::CheckState state);
127
129 void onModelsUpdateRequested();
130
132 void onTempDisableModelsForMatchingRequested(const swift::misc::simulation::CAircraftModelList &models);
133
135 void onRemoteAircraftModelChanged(const swift::misc::simulation::CSimulatedAircraft &aircraft,
136 const swift::misc::CIdentifier &originator);
137
139 void onConnectionStatusChanged(const swift::misc::network::CConnectionStatus &from,
141
143 void onTabWidgetChanged(int index);
144
146 swift::misc::simulation::CSimulatorInfo getConnectedOrSelectedSimulator() const;
147
149 bool isSimulatorAvailable() const;
150
152 void showAircraftModelDetails(bool show);
153
155 void onAddingRemoteAircraftFailed(const swift::misc::simulation::CSimulatedAircraft &aircraft,
156 bool disabled, bool failover, const swift::misc::CStatusMessage &message);
157
159 void timerUpdate();
160
162 void tokenBucketUpdate();
163
165 void tokenBucketUpdateAircraft(const swift::misc::simulation::CSimulatedAircraft &aircraft);
166
168 void settingsChanged();
169
171 void onNetworkConnectionStatusChanged(const swift::misc::network::CConnectionStatus &from,
173
175 void updateRenderedAircraftView(bool forceUpdate = false);
176
178 swift::misc::aviation::CCallsign validateRenderedCallsign();
179
181 void onModelSetSimulatorChanged(const swift::misc::simulation::CSimulatorInfo &simulator);
182
184 void onSimulatorPluginChanged(const swift::misc::simulation::CSimulatorPluginInfo &pluginInfo);
185
187 void onSimulatorStatusChanged(int status);
188
190 void doMatchingsAgain();
191
192 static constexpr std::chrono::milliseconds OverlayMessageMs { 5000 };
194 QTimer m_updateTimer;
195 bool m_missedRenderedAircraftUpdate = true;
196 swift::misc::CTokenBucket m_bucket { 3, 5000, 1 };
198 this, &CMappingComponent::settingsChanged
199 };
200 views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr;
201 };
202 } // namespace components
203} // namespace swift::gui
204
205#endif // SWIFT_GUI_COMPONENTS_MAPPINGCOMPONENT_H
CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea=nullptr)
Constructor.
COverlayMessagesFrame(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Constructor.
CMappingComponent(QWidget *parent=nullptr)
Constructor.
int countAircraftModels() const
Numer of models.
int countCurrentMappings() const
Number of current mappings.
void requestValidationDialog()
Request the validation dialog.
swift::misc::simulation::CAircraftModelList findModelsStartingWith(const QString &modelName, Qt::CaseSensitivity cs)
Find models starting with.
CheckBox for single column.
Base class with a member CIdentifier to be inherited by a class which has an identity in the environm...
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition identifier.h:29
Class template for accessing a specific value in the CSettingsCache.
Streamable status message, e.g.
Token bucket algorithm.
Definition tokenbucket.h:21
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition variant.h:69
Value object encapsulating information of a callsign.
Definition callsign.h:30
Value object encapsulating information about a connection status.
Value object encapsulating a list of aircraft models.
Comprehensive information of an aircraft.
Simple hardcoded info about the corresponding simulator.
High level reusable GUI components.
Models to be used with views, mainly QTableView.
Views, mainly QTableView.
GUI related classes.
Free functions in swift::misc.
Q_OBJECTQ_OBJECT
CaseSensitivity
CheckState
void show()
#define SWIFT_GUI_EXPORT
Export a class or function from the library.