MauiMan

backgroundmanager.h
1#pragma once
2
3#include <QObject>
4#include <QString>
5
6#include "mauiman_export.h"
7
8#if !defined Q_OS_ANDROID
10#endif
11
12
13namespace MauiMan
14{
15class SettingsStore;
16
17/**
18 * @brief The BackgroundManager class
19 * Helpfull for third parties to connect to property changes from the Background module setting changes.
20 */
21class MAUIMAN_EXPORT BackgroundManager : public QObject
22{
23 Q_OBJECT
24
25 /**
26 * The image file path to be used as the wallpaper background
27 */
28 Q_PROPERTY(QString wallpaperSource READ wallpaperSource WRITE setWallpaperSource NOTIFY wallpaperSourceChanged)
29
30 /**
31 * Whether the wallpaper background should have a dimmed effect. This could be used to reduce eye strain, or for a night mode effect
32 */
33 Q_PROPERTY(bool dimWallpaper READ dimWallpaper WRITE setDimWallpaper NOTIFY dimWallpaperChanged)
34
35 /**
36 * Whether the wallpaper image should fit the screen area, preserving its aspect ratio, instead of filling it
37 */
38 Q_PROPERTY(bool fitWallpaper READ fitWallpaper WRITE setFitWallpaper NOTIFY fitWallpaperChanged)
39
40 /**
41 * A color to be used in the background. If not wallpaper image is shown then, this is the color visible
42 */
43 Q_PROPERTY(QString solidColor READ solidColor WRITE setSolidColor NOTIFY solidColorChanged)
44
45 /**
46 * Whether to display the wallpaper image
47 */
48 Q_PROPERTY(bool showWallpaper READ showWallpaper WRITE setShowWallpaper NOTIFY showWallpaperChanged)
49
50 /**
51 * The preferred file path to the directory containing the wallpaper images
52 */
53 Q_PROPERTY(QString wallpaperSourceDir READ wallpaperSourceDir WRITE setWallpaperSourceDir NOTIFY wallpaperSourceDirChanged)
54
55public:
56/**
57 * @brief The DefaultValues class
58 */
60 {
61 static inline const QString wallpaperSource = QStringLiteral("qrc:/wallpapers/maui_shell_dev_bg.png");
62 static inline const bool dimWallpaper = false;
63 static inline const bool fitWallpaper = false; //false is to fill, true to fit
64 static inline const QString solidColor = QStringLiteral("#333");
65 static inline const bool showWallpaper = true;
66 static inline const QString wallpaperSourceDir = QStringLiteral("file:///usr/share/wallpapers/Cask");
67 };
68
69 explicit BackgroundManager(QObject * parent = nullptr);
70
71 QString wallpaperSource() const;
72
73 bool dimWallpaper() const;
74
75 bool fitWallpaper() const;
76
77 QString solidColor() const;
78
79 bool showWallpaper() const;
80
81 void setWallpaperSource(QString wallpaperSource);
82
83 void setDimWallpaper(bool dimWallpaper);
84
85 void setFitWallpaper(bool fitWallpaper);
86
87 void setSolidColor(QString solidColor);
88
89 void setShowWallpaper(bool showWallpaper);
90
91 QString wallpaperSourceDir() const;
92 void setWallpaperSourceDir(QString wallpaperSourceDir);
93
94private Q_SLOTS:
95 void onWallpaperChanged(const QString &wallpaperSource);
96 void onSolidColorChanged(const QString &solidColor);
97 void onFitWallpaperChanged(const bool &fitWallpaper);
98 void onDimWallpaperChanged(const bool &dimWallpaper);
99 void onShowWallpaperChanged(const bool &showWallpaper);
100
101Q_SIGNALS:
102 void wallpaperSourceChanged(QString wallpaperSource);
103 void dimWallpaperChanged(bool dimWallpaper);
104 void fitWallpaperChanged(bool fitWallpaper);
105 void solidColorChanged(QString solidColor);
106 void showWallpaperChanged(bool showWallpaper);
107 void wallpaperSourceDirChanged(QString wallpaperSourceDir);
108
109private:
110#if !defined Q_OS_ANDROID
111 QDBusInterface *m_interface = nullptr;
112#endif
113 MauiMan::SettingsStore *m_settings;
114
115 QString m_wallpaperSource = MauiMan::BackgroundManager::DefaultValues::wallpaperSource;
116 bool m_dimWallpaper = MauiMan::BackgroundManager::DefaultValues::dimWallpaper;
117 bool m_fitWallpaper = MauiMan::BackgroundManager::DefaultValues::fitWallpaper; //false is to fill, true to fit
118 QString m_solidColor = MauiMan::BackgroundManager::DefaultValues::solidColor;
119 bool m_showWallpaper = MauiMan::BackgroundManager::DefaultValues::showWallpaper;
120
121 QString m_wallpaperSourceDir = MauiMan::BackgroundManager::DefaultValues::wallpaperSourceDir;
122
123 void sync(const QString &key, const QVariant &value);
124 void setConnections();
125 void loadSettings();
126};
127}
128
The BackgroundManager class Helpfull for third parties to connect to property changes from the Backgr...
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...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:13:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.