swift
Loading...
Searching...
No Matches
launchersetup.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2017 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_DATA_LAUNCHERSETUP
7#define SWIFT_CORE_DATA_LAUNCHERSETUP
8
10#include "misc/datacache.h"
11#include "misc/propertyindex.h"
12#include "misc/valueobject.h"
13#include "misc/variant.h"
14
16
17namespace swift::core::data
18{
21 {
22 public:
25 {
26 IndexDBusAddress = swift::misc::CPropertyIndexRef::GlobalIndexCLauncherSetup,
27 IndexFramelessWindow,
28 IndexCoreMode,
29 IndexAudioMode
30 };
31
34 {
35 Standalone,
36 Distributed
37 };
38
41 {
42 AudioNothingDisabled = 0,
43 AudioDisableStandaloneAudio = 1 << 0,
44 AudioDisableDistributedCoreAudio = 1 << 1,
45 AudioDisableDistributedGuiAudio = 1 << 2
46 };
47 Q_DECLARE_FLAGS(AudioMode, AudioModeFlag)
48
49
50 CLauncherSetup() = default;
51
53 // virtual ~CLauncherSetup() {}
54
56 const QString &getDBusAddress() const { return m_dBusAddress; }
57
59 void setDBusAddress(const QString &dBusAddress) { m_dBusAddress = dBusAddress.trimmed(); }
60
62 CoreMode getCoreMode() const { return static_cast<CoreMode>(m_coreMode); }
63
65 void setCoreMode(CoreMode mode) { m_coreMode = static_cast<int>(mode); }
66
68 AudioMode getAudioMode() const { return static_cast<AudioMode>(m_audioMode); }
69
71 void setAudioMode(AudioMode mode) { m_audioMode = static_cast<int>(mode); }
72
74 bool useFramelessWindow() const { return m_windowFrameless; }
75
77 void setFramelessWindow(bool frameless) { m_windowFrameless = frameless; }
78
80 QString convertToQString(bool i18n = false) const;
81
83 QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
84
86 void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
87
88 private:
89 QString m_dBusAddress { "tcp:host=127.0.0.1,port=45000" };
90 bool m_windowFrameless = false;
91 int m_coreMode = static_cast<int>(Standalone);
92 int m_audioMode = static_cast<int>(AudioNothingDisabled);
93
95 CLauncherSetup,
96 SWIFT_METAMEMBER(dBusAddress),
97 SWIFT_METAMEMBER(windowFrameless),
98 SWIFT_METAMEMBER(coreMode),
99 SWIFT_METAMEMBER(audioMode));
100 };
101
103 struct TLauncherSetup : public swift::misc::TDataTrait<CLauncherSetup>
104 {
106 static const char *key() { return "swiftlaunchersetup"; }
107
109 static constexpr bool isPinned() { return true; }
110 };
111} // namespace swift::core::data
112
113Q_DECLARE_METATYPE(swift::core::data::CLauncherSetup)
115Q_DECLARE_METATYPE(swift::core::data::CLauncherSetup::AudioMode)
116Q_DECLARE_OPERATORS_FOR_FLAGS(swift::core::data::CLauncherSetup::AudioMode)
117
118#endif // SWIFT_CORE_DATA_LAUNCHERSETUP
CoreMode getCoreMode() const
Core mode.
const QString & getDBusAddress() const
Destructor.
void setAudioMode(AudioMode mode)
Audio mode.
AudioMode getAudioMode() const
Audio mode.
void setCoreMode(CoreMode mode)
Core mode.
void setFramelessWindow(bool frameless)
Frameless window?
void setDBusAddress(const QString &dBusAddress)
DBus address.
CLauncherSetup()=default
Default constructor.
bool useFramelessWindow() const
Frameless window?
Non-owning reference to a CPropertyIndex with a subset of its features.
Mix of the most commonly used mixin classes.
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition metaclass.h:72
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition metaclass.h:52
Core data traits (aka cached values) and classes.
QString trimmed() const const
Trait for global setup data.
static constexpr bool isPinned()
First load is synchronous.
static const char * key()
Key in data cache.
Base class for traits to be used as template argument to swift::misc::CData.
Definition datacache.h:477
#define SWIFT_CORE_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