swift
dbautostashingcomponent.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2016 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_DBAUTOSTASHINGCOMPONENT_H
7 #define SWIFT_GUI_COMPONENTS_DBAUTOSTASHINGCOMPONENT_H
8 
9 #include <QDialog>
10 #include <QObject>
11 #include <QScopedPointer>
12 
13 #include "core/progress.h"
15 #include "gui/swiftguiexport.h"
18 #include "misc/statusmessage.h"
19 
20 namespace swift::misc
21 {
22  class CLogCategoryList;
23  namespace simulation
24  {
25  class CAircraftModel;
26  }
27 } // namespace swift::misc
28 namespace Ui
29 {
30  class CDbAutoStashingComponent;
31 }
32 namespace swift::gui
33 {
34  namespace views
35  {
36  class CAircraftModelView;
37  }
38  namespace components
39  {
44  public QDialog,
47  {
48  Q_OBJECT
50 
51  public:
53  enum State
54  {
55  Idle,
56  Running,
57  Completed
58  };
59 
61  static const QStringList &getLogCategories();
62 
64  explicit CDbAutoStashingComponent(QWidget *parent = nullptr);
65 
67  virtual ~CDbAutoStashingComponent() override;
68 
70  bool isCompleted() const { return m_state == Completed; }
71 
73  virtual void updateProgressIndicator(int percent) override;
74 
75  public slots:
77  virtual void accept() override;
78 
80  virtual int exec() override;
81 
83  void showLastResults();
84 
85  private:
86  QScopedPointer<Ui::CDbAutoStashingComponent> ui;
87 
89  void resetDescription();
90 
92  void initGui();
93 
95  int getSelectedOrAllCount() const;
96 
98  swift::gui::views::CAircraftModelView *currentModelView() const;
99 
101  void addStatusMessage(const swift::misc::CStatusMessage &msg);
102 
104  void addStatusMessage(const swift::misc::CStatusMessage &msg,
106 
108  void tryToStashModels();
109 
113  bool tryToStashModel(swift::misc::simulation::CAircraftModel &model,
114  const swift::misc::aviation::CLivery &tempLivery);
115 
117  void setModelDescription(swift::misc::simulation::CAircraftModel &model, const QString &description) const;
118 
120  static swift::misc::aviation::CLivery getTempLivery();
121 
122  int m_noStashed = 0;
123  int m_noData = 0;
124  int m_noValidationFailed = 0;
125  State m_state = Idle;
127  };
128  } // namespace components
129 } // namespace swift::gui
130 
131 #endif // SWIFT_GUI_COMPONENTS_DBAUTOSTASHINGCOMPONENT_H
Implementing class features a progress bar or something similar.
Definition: progress.h:16
bool isCompleted() const
At least run once and completed.
Allows subcomponents to gain access to model component.
Streamable status message, e.g.
Value object encapsulating information about an airpot.
Definition: livery.h:29
Aircraft model (used by another pilot, my models on disk)
Definition: aircraftmodel.h:71
Value object encapsulating a list of aircraft models.
GUI related classes.
Free functions in swift::misc.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.