MauiMan

accessibilitymanager.h
1#pragma once
2
3#include <QObject>
4#include "mauiman_export.h"
5
7namespace MauiMan
8{
9
10class SettingsStore;
11
12/**
13 * @brief The AccessibilityManager class contains properties for changing visual and hearing clues.
14 */
15class MAUIMAN_EXPORT AccessibilityManager : public QObject
16{
17 Q_OBJECT
18 /**
19 * Whether to open items with a single click.
20 * By default this is set to `true` for mobile, and `false` for desktop.
21 */
22 Q_PROPERTY(bool singleClick READ singleClick WRITE setSingleClick NOTIFY singleClickChanged)
23
24 /**
25 * The policy for showing the scroll bars. The possible values are:
26 * - 0 Always visible
27 * - 1 Visible when needed
28 * - 2 Auto Hide
29 * - 3 Always hidden
30 */
31 Q_PROPERTY(uint scrollBarPolicy READ scrollBarPolicy WRITE setScrollBarPolicy NOTIFY scrollBarPolicyChanged)
32
33 /**
34 * Whether the user prefers the application to emit notification or alarm sounds.
35 */
36 Q_PROPERTY(bool playSounds READ playSounds WRITE setPlaySounds NOTIFY playSoundsChanged)
37
38public:
39
40 struct DefaultValues
41 {
42 static bool isMobile()
43 {
44#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(UBUNTU_TOUCH)
45 return true;
46#else
47 return QByteArrayList{"1", "true"}.contains(qgetenv("QT_QUICK_CONTROLS_MOBILE"));
48#endif
49 }
50 static inline const bool singleClick = DefaultValues::isMobile();
51 static inline const bool playSounds = true;
52 static inline const uint scrollBarPolicy = DefaultValues::isMobile() ? 3 : 0;
53 };
54
55 explicit AccessibilityManager(QObject *parent = nullptr);
56
57 bool singleClick() const;
58 void setSingleClick(bool singleClick);
59
60 uint scrollBarPolicy() const;
61 void setScrollBarPolicy(uint newScrollBarPolicy);
62
63 bool playSounds() const;
64 void setPlaySounds(bool newPlaySounds);
65
66private Q_SLOTS:
67 void onSingleClickChanged(bool singleClick);
68 void onScrollBarPolicyChanged(uint scrollBarPolicy);
69 void onPlaySoundsChanged(bool playSounds);
70
71private:
72#if !defined Q_OS_ANDROID
73 QDBusInterface *m_interface = nullptr;
74#endif
75 MauiMan::SettingsStore *m_settings;
76
77 bool m_singleClick = AccessibilityManager::DefaultValues::singleClick;
78 uint m_scrollBarPolicy = AccessibilityManager::DefaultValues::scrollBarPolicy;
79 bool m_playSounds = AccessibilityManager::DefaultValues::playSounds;
80
81 void sync(const QString &key, const QVariant &value);
82 void setConnections();
83 void loadSettings();
84
85Q_SIGNALS:
86 void singleClickChanged(bool);
87 void scrollBarPolicyChanged(uint);
88 void playSoundsChanged(bool);
89};
90
91}
The AccessibilityManager class contains properties for changing visual and hearing clues.
The SettingsStore class Allows to store and read settings for MauiMan from the local conf file.
The MauiMan name-space contains all of the available modules for configuring the Maui Applications an...
bool contains(const AT &value) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:51:22 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.