TDE 0.1.0
 
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1
12#pragma once
13
14#include <qsettings.h>
15#include <qstring.h>
16
17#include "tde/common.hpp"
18#include "tde/config.hpp"
19
20namespace tde {
21
26class TDE_PUBLIC DesktopSettings : public QSettings
27{
28 Q_OBJECT
29
30public:
36 DesktopSettings(QObject* parent = nullptr)
37 : QSettings{ QSettings::IniFormat,
38 QSettings::UserScope,
39 config::APP_ORGANIZATION,
40 config::APP_NAME,
41 parent }
42 {
43 }
44
45 ~DesktopSettings() override = default;
46
47 Q_DISABLE_COPY(DesktopSettings)
48
49
54 [[nodiscard]] TDE_INLINE auto desktop_width() const
55 {
56 return value("desktop/width", 800).value<int>(); // NOLINT
57 }
58
64 [[nodiscard]] TDE_INLINE auto desktop_height() const
65 {
66 return value("desktop/height", 480).value<int>(); // NOLINT
67 }
68
74 [[nodiscard]] TDE_INLINE auto desktop_title() const
75 {
76 return value("desktop/title", "TDE").value<QString>();
77 }
78
84 [[nodiscard]] TDE_INLINE auto desktop_grid_x() const
85 {
86 return value("desktop/grid_x", 4).value<int>();
87 }
88
94 [[nodiscard]] TDE_INLINE auto desktop_grid_y() const
95 {
96 return value("desktop/grid_y", 3).value<int>();
97 }
98
104 [[nodiscard]] TDE_INLINE auto desktop_qss_path() const
105 {
106 return value("desktop/qss_path").value<QString>();
107 }
108
114 [[nodiscard]] TDE_INLINE auto desktop_app_path() const
115 {
116 return value("desktop/app_path").value<QString>();
117 }
118
124 [[nodiscard]] TDE_INLINE auto tray_time_format() const
125 {
126 return value("tray/time_format", "yyyy/MM/dd | hh:mm:ss").value<QString>();
127 }
128};
129
130}
Desktop settings.
Definition settings.hpp:27
TDE_INLINE auto tray_time_format() const
Get the tray time format.
Definition settings.hpp:124
TDE_INLINE auto desktop_qss_path() const
Get the desktop qss path.
Definition settings.hpp:104
TDE_INLINE auto desktop_width() const
Get the desktop width.
Definition settings.hpp:54
TDE_INLINE auto desktop_title() const
Get the desktop title.
Definition settings.hpp:74
DesktopSettings(QObject *parent=nullptr)
Construct a new Desktop Settings object.
Definition settings.hpp:36
TDE_INLINE auto desktop_height() const
Get the desktop height.
Definition settings.hpp:64
TDE_INLINE auto desktop_grid_y() const
Get the desktop grid y size.
Definition settings.hpp:94
TDE_INLINE auto desktop_app_path() const
Get the desktop apps.json path.
Definition settings.hpp:114
TDE_INLINE auto desktop_grid_x() const
Get the desktop grid x size.
Definition settings.hpp:84
Some utility macros.
Static configurations.