swift
textmessagesettings.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_SETTINGS_TEXTMESSAGESETTINGS_H
7 #define SWIFT_GUI_SETTINGS_TEXTMESSAGESETTINGS_H
8 
9 #include <QString>
10 
11 #include "gui/swiftguiexport.h"
12 #include "misc/settingscache.h"
13 
14 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::gui::settings, CTextMessageSettings)
15 
16 namespace swift::misc
17 {
18  namespace simulation
19  {
20  class CSimulatedAircraft;
21  }
22  namespace network
23  {
24  class CTextMessage;
25  }
26 } // namespace swift::misc
27 namespace swift::gui::settings
28 {
31  {
32  public:
35  {
36  IndexPopupPrivateMessages = swift::misc::CPropertyIndexRef::GlobalIndexCTextMessageSettings,
37  IndexPopupSupervisorMessages,
38  IndexPopupFrequencyMessages,
39  IndexPopupAllMessages,
40  IndexPopupSelcalMessages,
41  IndexFocus,
42  IndexLatestFirst,
43  IndexStyle
44  };
45 
48 
50  bool popupPrivateMessages() const;
51 
53  bool getPopupPrivateMessages() const { return m_popupPrivateMessages; }
54 
56  void setPopupPrivateMessages(bool popup) { m_popupPrivateMessages = popup; }
57 
59  bool popupSupervisorMessages() const;
60 
62  bool getPopupSupervisorMessages() const { return m_popupSupervisorMessages; }
63 
65  void setSupervisorMessages(bool popup) { m_popupSupervisorMessages = popup; }
66 
68  bool popupFrequencyMessages() const;
69 
71  bool getPopupFrequencyMessages() const { return m_popupFrequencyMessages; }
72 
74  void setPopupFrequencyMessages(bool popup) { m_popupFrequencyMessages = popup; }
75 
77  bool getPopupAllMessages() const { return m_popupAllMessages; }
78 
80  void setPopupAllMessages(bool popup) { m_popupAllMessages = popup; }
81 
83  bool getPopupSelcalMessages() const { return m_popupSelcalMessages; }
84 
86  bool popupSelcalMessages() const;
87 
89  void setPopupSelcalMessages(bool popup) { m_popupSelcalMessages = popup; }
90 
92  void disableAllPopups();
93 
95  bool popup(const swift::misc::network::CTextMessage &textMessage) const;
96 
98  bool popup(const swift::misc::network::CTextMessage &textMessage,
99  const swift::misc::simulation::CSimulatedAircraft &ownAircraft) const;
100 
102  bool isLatestFirst() const { return m_latestFirst; }
103 
105  void setLatestFirst(bool latestFirst) { m_latestFirst = latestFirst; }
106 
108  const QString &getStyleSheet() const { return m_styleSheet; }
109 
111  void setStyleSheet(const QString &styleSheet) { m_styleSheet = styleSheet; }
112 
114  bool focusOverlayWindow() const { return m_focus; }
115 
117  void setFocusOverlayWindows(bool focus) { m_focus = focus; }
118 
120  void resetStyleSheet() { m_styleSheet.clear(); }
121 
123  QString convertToQString(bool i18n = false) const;
124 
126  QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
127 
129  void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
130 
131  private:
132  bool m_popupPrivateMessages = true;
133  bool m_popupSupervisorMessages = true;
134  bool m_popupFrequencyMessages = false;
135  bool m_popupAllMessages = false;
136  bool m_popupSelcalMessages = true;
137  bool m_focus = true;
138  bool m_latestFirst = false;
139  QString m_styleSheet;
140 
143  SWIFT_METAMEMBER(popupPrivateMessages),
144  SWIFT_METAMEMBER(popupSupervisorMessages),
145  SWIFT_METAMEMBER(popupFrequencyMessages),
146  SWIFT_METAMEMBER(popupAllMessages),
147  SWIFT_METAMEMBER(popupSelcalMessages),
148  SWIFT_METAMEMBER(focus),
149  SWIFT_METAMEMBER(latestFirst),
150  SWIFT_METAMEMBER(styleSheet));
151  };
152 
154  struct TextMessageSettings : public swift::misc::TSettingTrait<CTextMessageSettings>
155  {
157  static const char *key() { return "textmessages"; }
158 
160  static const QString &humanReadable()
161  {
162  static const QString name("Text message");
163  return name;
164  }
165  };
166 } // namespace swift::gui::settings
167 
170 
171 #endif // SWIFT_GUI_SETTINGS_TEXTMESSAGESETTINGS_H
void setPopupSelcalMessages(bool popup)
SELCAL messages?
bool getPopupSupervisorMessages() const
Supervisor messages?
void setStyleSheet(const QString &styleSheet)
CSS style sheet.
bool getPopupFrequencyMessages() const
Frequency messages tuned in?
bool focusOverlayWindow() const
Focus in the overlay window.
void setLatestFirst(bool latestFirst)
Latest messages 1st?
bool getPopupAllMessages() const
Popup all messages?
void setSupervisorMessages(bool popup)
Supervisor messages?
bool isLatestFirst() const
Latest messages 1st?
void setFocusOverlayWindows(bool focus)
Set focus in overlay window.
const QString & getStyleSheet() const
CSS style sheet.
void setPopupAllMessages(bool popup)
All messages?
bool getPopupSelcalMessages() const
Popup SELCAL messages?
bool getPopupPrivateMessages() const
Private messages.
void setPopupFrequencyMessages(bool popup)
Frequency messages?
void setPopupPrivateMessages(bool popup)
Private messages?
Generic ordered container with value semantics.
Definition: collection.h:107
Non-owning reference to a CPropertyIndex with a subset of its features.
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
Value object encapsulating information of a text message.
Definition: textmessage.h:31
Comprehensive information of an aircraft.
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition: metaclass.h:73
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition: metaclass.h:53
Free functions in swift::misc.
static const char * key()
Key string of the value. Reimplemented in derived class.
static const QString & humanReadable()
Optional human readable name.
Base class for traits to be used as template argument to swift::misc::CSetting.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition: valueobject.h:65