swift
navigatorsettings.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_NAVIGATOR_H
7 #define SWIFT_GUI_SETTINGS_NAVIGATOR_H
8 
9 #include <QMap>
10 #include <QMetaType>
11 #include <QString>
12 
13 #include "gui/swiftguiexport.h"
14 #include "misc/propertyindex.h"
15 #include "misc/settingscache.h"
16 #include "misc/variant.h"
17 
18 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::gui::settings, CNavigatorSettings)
19 
20 namespace swift::gui::settings
21 {
24  {
25  public:
28  {
29  IndexMargins = swift::misc::CPropertyIndexRef::GlobalIndexCNavigatorSettings,
30  IndexFrameless,
31  IndexColumns
32  };
33 
36 
39 
41  void reset();
42 
44  void setMargins(const QMargins &margins);
45 
47  QMargins getMargins() const;
48 
50  bool isFramless() const { return m_frameless; }
51 
53  void setFrameless(bool frameless) { m_frameless = frameless; }
54 
56  int getColumns() const { return m_columns; }
57 
59  void setColumns(int columns) { this->m_columns = columns; }
60 
62  QByteArray getGeometry() const;
63 
65  void setGeometry(const QByteArray &ba);
66 
68  QString convertToQString(bool i18n = false) const;
69 
71  QString convertToQString(const QString &separator, bool i18n = false) const;
72 
74  QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
75 
77  void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
78 
79  private:
80  QString m_margins { "0:0:0:0" };
81  QString m_geometry;
82  bool m_frameless = false;
83  int m_columns = 1;
84 
86  CNavigatorSettings,
87  SWIFT_METAMEMBER(margins),
88  SWIFT_METAMEMBER(frameless),
89  SWIFT_METAMEMBER(columns),
90  SWIFT_METAMEMBER(geometry));
91  };
92 
94  struct TNavigator : public swift::misc::TSettingTrait<CNavigatorSettings>
95  {
97  static const char *key() { return "guinavigator"; }
98 
100  static const QString &humanReadable()
101  {
102  static const QString name("Navigator");
103  return name;
104  }
105  };
106 } // namespace swift::gui::settings
107 
110 
111 #endif // SWIFT_GUI_SETTINGS_NAVIGATOR_H
void setColumns(int columns)
Set columns.
void setFrameless(bool frameless)
Frameless.
int getColumns() const
Number pf columns.
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
#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
Trait for settings for navigator.
static const QString & humanReadable()
Optional human readable name.
static const char * key()
Key string of the value. Reimplemented in derived class.
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