swift
dbliveryselectorcomponent.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_CDBLIVERYSELECTORCOMPONENT_H
7 #define SWIFT_GUI_COMPONENTS_CDBLIVERYSELECTORCOMPONENT_H
8 
9 #include <QFrame>
10 #include <QMetaObject>
11 #include <QObject>
12 #include <QScopedPointer>
13 #include <QString>
14 
15 #include "gui/dropbase.h"
16 #include "gui/swiftguiexport.h"
17 #include "misc/aviation/livery.h"
19 
20 class QCompleter;
21 class QDragEnterEvent;
22 class QDragLeaveEvent;
23 class QDragMoveEvent;
24 class QDropEvent;
25 class QWidget;
26 
27 namespace Ui
28 {
29  class CDbLiverySelectorComponent;
30 }
31 
32 namespace swift::gui::components
33 {
38  {
39  Q_OBJECT
40 
41  public:
43  explicit CDbLiverySelectorComponent(QWidget *parent = nullptr);
44 
46  virtual ~CDbLiverySelectorComponent();
47 
49  void setLivery(const swift::misc::aviation::CLivery &livery);
50 
52  void setLivery(const QString &code);
53 
55  swift::misc::aviation::CLivery getLivery() const;
56 
58  QString getRawCombinedCode() const;
59 
61  void withLiveryDescription(bool description);
62 
64  void setReadOnly(bool readOnly);
65 
67  bool isSet() const;
68 
70  void clear();
71 
72  signals:
75 
76  protected:
78  virtual void dragEnterEvent(QDragEnterEvent *event) override;
79 
81  virtual void dragMoveEvent(QDragMoveEvent *event) override;
82 
84  virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
85 
87  virtual void dropEvent(QDropEvent *event) override;
88 
89  private:
91  void onDataChanged();
92 
94  void onCompleterActivated(const QString &liveryCode);
95 
97  void onLiveriesRead(swift::misc::network::CEntityFlags::Entity entity,
98  swift::misc::network::CEntityFlags::ReadState readState, int count, const QUrl &url);
99 
101  QString stripExtraInfo(const QString &liveryCode) const;
102 
103  QScopedPointer<Ui::CDbLiverySelectorComponent> ui;
104  QScopedPointer<QCompleter> m_completerLiveries;
105  swift::misc::aviation::CLivery m_currentLivery;
106  };
107 } // namespace swift::gui::components
108 
109 #endif // SWIFT_GUI_COMPONENTS_CDBLIVERYSELECTORCOMPONENT_H
Utilities for dropping swift value objects.
Definition: dropbase.h:19
void changedLivery(const swift::misc::aviation::CLivery &livery)
Distributor was changed.
Value object encapsulating information about an airpot.
Definition: livery.h:29
High level reusable GUI components.
Definition: aboutdialog.cpp:13
#define SWIFT_GUI_EXPORT
Export a class or function from the library.