swift
Loading...
Searching...
No Matches
dbstashcomponent.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_DBSTASHCOMPONENT_H
7#define SWIFT_GUI_COMPONENTS_DBSTASHCOMPONENT_H
8
9#include <functional>
10
11#include <QFrame>
12#include <QList>
13#include <QMessageBox>
14#include <QObject>
15#include <QScopedPointer>
16#include <QStringList>
17
21#include "gui/swiftguiexport.h"
28#include "misc/statusmessage.h"
30
31class QWidget;
32
33namespace swift::misc
34{
35 class CLogCategoryList;
36 namespace aviation
37 {
39 class CLivery;
40 } // namespace aviation
41} // namespace swift::misc
42namespace Ui
43{
44 class CDbStashComponent;
45}
46namespace swift::gui
47{
48 namespace views
49 {
51 }
52 namespace components
53 {
58 public QFrame,
61 {
63
64 public:
66 static constexpr int MaxModelPublished = 1000;
67
69 explicit CDbStashComponent(QWidget *parent = nullptr);
70
73
76 bool allowReplace) const;
77
79 int unstashModels(const QSet<int> &keys);
80
82 int unstashModels(const QStringList &modelStrings);
83
86
89
91 bool hasStashedModels() const;
92
94 int getStashedModelsCount() const;
95
98
101
104
106 void applyToSelected(const swift::misc::aviation::CLivery &livery, bool acceptWarnings = true);
107
109 void applyToSelected(const swift::misc::aviation::CAircraftIcaoCode &icao, bool acceptWarnings = true);
110
112 void applyToSelected(const swift::misc::aviation::CAirlineIcaoCode &icao, bool acceptWarnings = true);
113
115 void applyToSelected(const swift::misc::simulation::CDistributor &distributor, bool acceptWarnings = true);
116
119
123
126
129
130 public slots:
133 bool replace = false, bool consolidateWithDbData = true,
134 bool clearHighlighting = true);
135
138 bool replace = false, bool consolidateWithDbData = true,
139 bool clearHighlighting = true);
140
143
144 signals:
147
150 bool directWrite);
151
152 private:
155 this, &CDbStashComponent::onUserChanged
156 };
157
159 void onUnstashPressed();
160
162 void onValidatePressed();
163
165 void onRemoveInvalidPressed();
166
168 void onPublishPressed();
169
171 void onPublishedModelsResponse(const swift::misc::simulation::CAircraftModelList &publishedModels,
173 const swift::misc::CStatusMessageList &msgs, bool sendingSuccesful,
174 bool directWrite);
175
177 void copyOverValuesToSelectedModels();
178
180 void modifyModelDialog();
181
183 void onRowCountChanged(int number, bool filter);
184
186 void onUserChanged();
187
189 bool showOverlayMessages(const swift::misc::CStatusMessageList &msgs, bool onlyErrors = false,
190 bool appendOldMessages = false,
191 std::chrono::milliseconds timeout = std::chrono::milliseconds(0));
192
194 bool showOverlayMessagesWithConfirmation(const swift::misc::CStatusMessageList &msgs,
195 bool appendOldMessages, const QString &confirmation,
196 std::function<void()> okLambda,
197 QMessageBox::StandardButton defaultButton, bool onlyErrors = false,
198 std::chrono::milliseconds timeout = std::chrono::milliseconds(0));
199
201 bool showOverlayMessage(const swift::misc::CStatusMessage &msg,
202 std::chrono::milliseconds timeout = std::chrono::milliseconds(0));
203
205 void clearOverlayMessages();
206
210
212 bool validateAndDisplay(swift::misc::simulation::CAircraftModelList &validModels,
214 bool displayInfo = false);
215
217 void enableButtonRow();
218
220 const swift::misc::CLogCategoryList &validationCategories() const;
221
223 swift::misc::simulation::CAircraftModelList getSelectedOrAllModels() const;
224
227 consolidateWithDbData(const swift::misc::simulation::CAircraftModel &model, bool forced) const;
228
231 consolidateWithOwnModels(const swift::misc::simulation::CAircraftModel &model) const;
232
234 swift::misc::network::CAuthenticatedUser getSwiftDbUser() const;
235 };
236 } // namespace components
237} // namespace swift::gui
238
239#endif // SWIFT_GUI_COMPONENTS_DBSTASHCOMPONENT_H
CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea=nullptr)
Constructor.
static constexpr int MaxModelPublished
Number of models which can be published at once.
void stashedModelsChanged()
Stashed models have been changed.
void showChangedAttributes()
Show changed attributes of selected models.
int unstashModels(const QSet< int > &keys)
Unstash given models with keys.
int getStashedModelsCount() const
Number of models.
swift::misc::simulation::CAircraftModel getStashedModel(const QString &modelString) const
Model for model string.
swift::gui::views::CAircraftModelView * view() const
The embedded view.
void applyToSelected(const swift::misc::aviation::CLivery &livery, bool acceptWarnings=true)
Apply livery to selected objects.
bool hasStashedModels() const
Has stashed models.
swift::misc::CStatusMessage stashModel(const swift::misc::simulation::CAircraftModel &model, bool replace=false, bool consolidateWithDbData=true, bool clearHighlighting=true)
Stash given model (includes validation and consolidation with DB data).
swift::misc::CStatusMessage validateStashModel(const swift::misc::simulation::CAircraftModel &model, bool allowReplace) const
Test the given model if it can be stashed.
swift::misc::simulation::CAircraftModel consolidateModel(const swift::misc::simulation::CAircraftModel &model) const
Consolidate with other available data.
const swift::misc::simulation::CAircraftModelList & getStashedModels() const
The stashed models.
void modelsSuccessfullyPublished(const swift::misc::simulation::CAircraftModelList &publishedModels, bool directWrite)
Models succesfully published.
swift::misc::CStatusMessageList stashModels(const swift::misc::simulation::CAircraftModelList &models, bool replace=false, bool consolidateWithDbData=true, bool clearHighlighting=true)
Stash given models (includes validation and consolidation with DB data).
void clearValidationHighlighting()
Clear highlighting set by validations.
void replaceModelsUnvalidated(const swift::misc::simulation::CAircraftModelList &models)
Replace models, no validation.
CDbStashComponent(QWidget *parent=nullptr)
Constructor.
QStringList getStashedModelStrings() const
Stashed model strings.
Class template for read-only access to a specific value in the CDataCache.
Definition datacache.h:458
A sequence of log categories.
Specialized value object compliant map for variants, based on indexes.
Streamable status message, e.g.
Status messages, e.g. from Core -> GUI.
Value object for ICAO classification.
Value object for ICAO classification.
Value object encapsulating information about an airpot.
Definition livery.h:29
Value object encapsulating information of an authentiated user.
Aircraft model (used by another pilot, my models on disk).
Value object encapsulating a list of aircraft models.
Value object encapsulating information of software distributor.
Definition distributor.h:33
High level reusable GUI components.
Models to be used with views, mainly QTableView.
Views, mainly QTableView.
GUI related classes.
Free functions in swift::misc.
QFrame(QWidget *parent, Qt::WindowFlags f)
Q_OBJECTQ_OBJECT
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
#define SWIFT_GUI_EXPORT
Export a class or function from the library.