swift
modelsettings.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_MISC_SIMULATION_SETTINGS_MODELSETTINGS_H
7 #define SWIFT_MISC_SIMULATION_SETTINGS_MODELSETTINGS_H
8 
10 #include "misc/settingscache.h"
12 #include "misc/swiftmiscexport.h"
13 
14 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::simulation::Settings, CModelSettings)
15 
16 namespace swift::misc::simulation::settings
17 {
19  class SWIFT_MISC_EXPORT CModelSettings : public CValueObject<CModelSettings>
20  {
21  public:
24  {
25  IndexAllowExclude = CPropertyIndexRef::GlobalIndexCSimulatorSettings
26  };
27 
30 
32  bool getAllowExcludedModels() const { return m_allowExcludeModels; }
33 
35  void setAllowExcludedModels(bool allow) { m_allowExcludeModels = allow; }
36 
38  QString convertToQString(bool i18n = false) const;
39 
41  QVariant propertyByIndex(CPropertyIndexRef index) const;
42 
44  void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
45 
46  private:
47  bool m_allowExcludeModels = false;
48 
51  SWIFT_METAMEMBER(allowExcludeModels));
52  };
53 
55  struct TModel : public TSettingTrait<CModelSettings>
56  {
58  static const char *key() { return "Models"; }
59 
61  static const QString &humanReadable()
62  {
63  static const QString name("Model settings");
64  return name;
65  }
66  };
67 
69  struct TDistributorListPreferences : public TSettingTrait<simulation::CDistributorListPreferences>
70  {
72  static const QString &humanReadable()
73  {
74  static const QString name("Distributor preferences");
75  return name;
76  }
77 
79  static const char *key() { return "mapping/distributorpreferences"; }
80  };
81 } // namespace swift::misc::simulation::settings
82 
85 
86 #endif // SWIFT_MISC_SIMULATION_SETTINGS_MODELSETTINGS_H
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
ColumnIndex
Base class enums.
Definition: mixinindex.h:44
void setAllowExcludedModels(bool allow)
Allow excluded models?
Definition: modelsettings.h:35
bool getAllowExcludedModels() const
Allow excluded models?
Definition: modelsettings.h:32
#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
Base class for traits to be used as template argument to swift::misc::CSetting.
Mapping preferences for model distributor list.
Definition: modelsettings.h:70
static const char * key()
Key string of the value. Reimplemented in derived class.
Definition: modelsettings.h:79
static const QString & humanReadable()
Optional human readable name.
Definition: modelsettings.h:72
Trait for simulator settings.
Definition: modelsettings.h:56
static const char * key()
Key in data cache.
Definition: modelsettings.h:58
static const QString & humanReadable()
Optional human readable name.
Definition: modelsettings.h:61
#define SWIFT_MISC_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