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  return std::all_of(value.cbegin(), value.cend(), [](const auto &actionHotkey) {
34  return !actionHotkey.getApplicableMachine().getMachineName().isEmpty() &&
35  !actionHotkey.getAction().isEmpty() && !actionHotkey.getCombination().isEmpty();
36  });
37  }
38  };
39 
42  {
44  static const char *key() { return "application/enabledsimulators"; }
45 
47  static const QString &humanReadable()
48  {
49  static const QString name("Enabled simulators");
50  return name;
51  }
52 
54  static const QStringList &defaultValue()
55  {
56  // All default simulators
58  return enabledSimulators;
59  }
60 
62  static bool isValid(const QStringList &pluginIdentifiers, QString &)
63  {
64  return std::all_of(pluginIdentifiers.cbegin(), pluginIdentifiers.cend(), [](const auto &pluginIdentifier) {
65  return misc::simulation::CSimulatorPluginInfo::allIdentifiers().contains(pluginIdentifier);
66  });
67  }
68  };
69 
72  {
74  static const char *key() { return "application/crashdumpuploadenabled"; }
75 
77  static const QString &humanReadable()
78  {
79  static const QString name("Crash dumps");
80  return name;
81  }
82 
84  static bool defaultValue() { return false; }
85  };
86 } // namespace swift::core::application
87 
88 #endif // SWIFT_CORE_APPLICATION_APPLICATIONSETTINGS_H
const_iterator cbegin() const
Returns const iterator at the beginning of the sequence.
Definition: sequence.h:169
const_iterator cend() const
Returns const iterator one past the end of the sequence.
Definition: sequence.h:178
Value object encapsulating a list of hotkeys.
static QStringList guessDefaultPlugins()
Guess default plugins.
QList< T >::const_iterator cbegin() const const
QList< T >::const_iterator cend() const const
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.