swift
applicationsettings.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_CORE_APPLICATION_APPLICATIONSETTINGS_H
7 #define SWIFT_CORE_APPLICATION_APPLICATIONSETTINGS_H
8 
9 #include <QStringList>
10 
12 #include "misc/settingscache.h"
14 
15 namespace swift::core::application
16 {
18  struct TActionHotkeys : misc::TSettingTrait<misc::input::CActionHotkeyList>
19  {
21  static const char *key() { return "application/actionhotkeys"; }
22 
24  static const QString &humanReadable()
25  {
26  static const QString name("Hotkeys");
27  return name;
28  }
29 
31  static bool isValid(const misc::input::CActionHotkeyList &value, QString &)
32  {
33  for (const auto &actionHotkey : value)
34  {
35  if (actionHotkey.getApplicableMachine().getMachineName().isEmpty() ||
36  actionHotkey.getAction().isEmpty() || actionHotkey.getCombination().isEmpty())
37  {
38  return false;
39  }
40  }
41  return true;
42  }
43  };
44 
47  {
49  static const char *key() { return "application/enabledsimulators"; }
50 
52  static const QString &humanReadable()
53  {
54  static const QString name("Enabled simulators");
55  return name;
56  }
57 
59  static const QStringList &defaultValue()
60  {
61  // All default simulators
62  static const QStringList enabledSimulators(misc::simulation::CSimulatorPluginInfo::guessDefaultPlugins());
63  return enabledSimulators;
64  }
65 
67  static bool isValid(const QStringList &pluginIdentifiers, QString &)
68  {
69  for (const QString &pluginIdentifier : pluginIdentifiers)
70  {
71  if (!misc::simulation::CSimulatorPluginInfo::allIdentifiers().contains(pluginIdentifier))
72  {
73  return false;
74  }
75  }
76  return true;
77  }
78  };
79 
82  {
84  static const char *key() { return "application/crashdumpuploadenabled"; }
85 
87  static const QString &humanReadable()
88  {
89  static const QString name("Crash dumps");
90  return name;
91  }
92 
94  static bool defaultValue() { return false; }
95  };
96 } // namespace swift::core::application
97 
98 #endif // SWIFT_CORE_APPLICATION_APPLICATIONSETTINGS_H
Value object encapsulating a list of hotkeys.
static const QStringList & allIdentifiers()
All valid identifiers.
static QStringList guessDefaultPlugins()
Guess default plugins.
static const char * key()
Key string of the value. Reimplemented in derived class.
static const QString & humanReadable()
Optional human readable name.
static bool isValid(const misc::input::CActionHotkeyList &value, QString &)
Validator function. Return true if the argument is valid, false otherwise. Default implementation jus...
Uploading of crash dumps is enabled or disabled.
static const QString & humanReadable()
Optional human readable name.
static const char * key()
Key string of the value. Reimplemented in derived class.
static bool defaultValue()
Return the value to use in case the supplied value does not satisfy the validator....
static const QStringList & defaultValue()
Return the value to use in case the supplied value does not satisfy the validator....
static const char * key()
Key string of the value. Reimplemented in derived class.
static const QString & humanReadable()
Optional human readable name.
static bool isValid(const QStringList &pluginIdentifiers, QString &)
Validator function. Return true if the argument is valid, false otherwise. Default implementation jus...
Base class for traits to be used as template argument to swift::misc::CSetting.