fix config file writing + positioning issues
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 22s
JS/TS / lint (pull_request) Successful in 27s
Python / fmt (pull_request) Successful in 33s
Python / lint (pull_request) Successful in 32s
Python / test (pull_request) Successful in 1m3s
Python / typecheck (pull_request) Failing after 1m4s
Rust / fmt (pull_request) Successful in 41s
Rust / build (pull_request) Successful in 1m39s
C++ / build (pull_request) Successful in 2m33s
Rust / clippy (pull_request) Successful in 1m18s
Python / buildcheck (pull_request) Successful in 2m23s
C++ / clang-tidy (pull_request) Successful in 3m56s
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 22s
JS/TS / lint (pull_request) Successful in 27s
Python / fmt (pull_request) Successful in 33s
Python / lint (pull_request) Successful in 32s
Python / test (pull_request) Successful in 1m3s
Python / typecheck (pull_request) Failing after 1m4s
Rust / fmt (pull_request) Successful in 41s
Rust / build (pull_request) Successful in 1m39s
C++ / build (pull_request) Successful in 2m33s
Rust / clippy (pull_request) Successful in 1m18s
Python / buildcheck (pull_request) Successful in 2m23s
C++ / clang-tidy (pull_request) Successful in 3m56s
This commit is contained in:
@@ -14,7 +14,7 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property int clampedExtent: Math.max(Config.bar.border, extent)
|
readonly property int clampedExtent: Math.max(Config.bar.border, extent)
|
||||||
readonly property int contentThickness: Math.max(Config.bar.height, 30) + padding * 2
|
readonly property int contentThickness: Math.max(Config.bar.height, Tokens.bar.innerSize) + padding * 2
|
||||||
readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentThickness
|
readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentThickness
|
||||||
property real extent: fullscreen ? 0 : Config.bar.border
|
property real extent: fullscreen ? 0 : Config.bar.border
|
||||||
required property bool fullscreen
|
required property bool fullscreen
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ CustomRect {
|
|||||||
required property bool horizontal
|
required property bool horizontal
|
||||||
required property GridLayout loader
|
required property GridLayout loader
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
readonly property real shortSize: Config.bar.height
|
readonly property real shortSize: Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
readonly property real size: timeText.contentWidth + (horizontal ? Tokens.padding.normal : Tokens.padding.larger) * 2
|
readonly property real size: timeText.contentWidth + (horizontal ? Tokens.padding.normal : Tokens.padding.larger) * 2
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ CustomRect {
|
|||||||
property bool tempEnabled: Hyprsunset.enabled
|
property bool tempEnabled: Hyprsunset.enabled
|
||||||
|
|
||||||
color: root.tempEnabled ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
color: root.tempEnabled ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: horizontal ? Config.bar.height : width
|
implicitHeight: horizontal ? Math.max(Config.bar.height, Tokens.bar.innerSize) : width
|
||||||
implicitWidth: horizontal ? height : Config.bar.height
|
implicitWidth: horizontal ? height : Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
@@ -27,7 +27,7 @@ CustomRect {
|
|||||||
animate: true
|
animate: true
|
||||||
color: root.tempEnabled ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: root.tempEnabled ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
fill: root.tempEnabled ? 1 : 0
|
fill: root.tempEnabled ? 1 : 0
|
||||||
font.pointSize: root.horizontal ? Tokens.font.size.larger : Tokens.font.size.large
|
font.pointSize: Tokens.font.size.larger
|
||||||
text: root.tempEnabled ? "lightbulb" : "light_off"
|
text: root.tempEnabled ? "lightbulb" : "light_off"
|
||||||
|
|
||||||
Behavior on fill {
|
Behavior on fill {
|
||||||
|
|||||||
+16
-5
@@ -14,11 +14,19 @@ CustomRect {
|
|||||||
readonly property int textWidth: Math.min(metrics.width, 200)
|
readonly property int textWidth: Math.min(metrics.width, 200)
|
||||||
|
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: horizontal ? Config.bar.height : layout.implicitHeight + Tokens.padding.normal * 2
|
implicitHeight: horizontal ? Math.max(Config.bar.height, Tokens.bar.innerSize) : layout.implicitHeight + Tokens.padding.normal * 2
|
||||||
implicitWidth: horizontal ? layout.implicitWidth + Tokens.padding.normal * 2 : Config.bar.height
|
implicitWidth: horizontal ? layout.implicitWidth + Tokens.padding.normal * 2 : Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
enabled: !root.horizontal
|
||||||
|
|
||||||
|
Anim {
|
||||||
|
}
|
||||||
|
}
|
||||||
Behavior on implicitWidth {
|
Behavior on implicitWidth {
|
||||||
|
enabled: root.horizontal
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +41,11 @@ CustomRect {
|
|||||||
GridLayout {
|
GridLayout {
|
||||||
id: layout
|
id: layout
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.bottomMargin: root.horizontal ? 0 : Tokens.padding.normal
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: root.horizontal ? Tokens.padding.normal : 0
|
||||||
|
anchors.rightMargin: root.horizontal ? Tokens.padding.normal : 0
|
||||||
|
anchors.topMargin: root.horizontal ? 0 : Tokens.padding.normal
|
||||||
columns: root.horizontal ? -1 : 1
|
columns: root.horizontal ? -1 : 1
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
Behavior on implicitWidth {
|
||||||
@@ -53,15 +65,14 @@ CustomRect {
|
|||||||
id: mediatext
|
id: mediatext
|
||||||
|
|
||||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||||
Layout.preferredHeight: root.horizontal ? root.height : root.textWidth
|
|
||||||
animate: true
|
animate: true
|
||||||
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
color: Players.active?.isPlaying ? Colors.palette.m3primary : Colors.palette.m3onSurface
|
||||||
font.pointSize: Tokens.font.size.normal
|
font.pointSize: Tokens.font.size.normal
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
implicitWidth: root.textWidth
|
||||||
marqueeEnabled: false
|
marqueeEnabled: false
|
||||||
pauseMs: 4000
|
pauseMs: 4000
|
||||||
text: root.currentMedia
|
text: root.currentMedia
|
||||||
width: root.textWidth
|
|
||||||
|
|
||||||
transform: [
|
transform: [
|
||||||
Translate {
|
Translate {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ CustomRect {
|
|||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
color: visibilities.sidebar ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
color: visibilities.sidebar ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: horizontal ? Config.bar.height : width
|
implicitHeight: horizontal ? Math.max(Config.bar.height, Tokens.bar.innerSize) : width
|
||||||
implicitWidth: horizontal ? height : Config.bar.height
|
implicitWidth: horizontal ? height : Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
@@ -23,7 +23,7 @@ CustomRect {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: root.visibilities.sidebar ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
color: root.visibilities.sidebar ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
||||||
fill: root.visibilities.sidebar ? 1 : 0
|
fill: root.visibilities.sidebar ? 1 : 0
|
||||||
font.pointSize: root.horizontal ? Tokens.font.size.larger : Tokens.font.size.large
|
font.pointSize: Tokens.font.size.larger
|
||||||
text: NotifServer.list.length ? "\uf4fe" : "\ue7f4"
|
text: NotifServer.list.length ? "\uf4fe" : "\ue7f4"
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ GridLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CustomClippingRect {
|
CustomClippingRect {
|
||||||
Layout.preferredHeight: root.horizontal ? icon.implicitHeight : 4
|
Layout.preferredHeight: root.horizontal ? icon.implicitHeight - Tokens.padding.small : 4
|
||||||
Layout.preferredWidth: root.horizontal ? 4 : icon.implicitWidth
|
Layout.preferredWidth: root.horizontal ? 4 : icon.implicitWidth
|
||||||
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
color: Colors.layer(Colors.palette.m3surfaceContainerHigh, 2)
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
@@ -63,7 +63,7 @@ GridLayout {
|
|||||||
anchors.top: root.horizontal ? undefined : parent.top
|
anchors.top: root.horizontal ? undefined : parent.top
|
||||||
color: root.mainColor
|
color: root.mainColor
|
||||||
implicitHeight: root.horizontal ? Math.ceil(root.percentage * parent.height) : 0
|
implicitHeight: root.horizontal ? Math.ceil(root.percentage * parent.height) : 0
|
||||||
implicitWidth: root.horizontal ? 0 : Math.ceil(root.percentage * parent.height)
|
implicitWidth: root.horizontal ? 0 : Math.ceil(root.percentage * parent.width)
|
||||||
|
|
||||||
// Behavior on implicitHeight {
|
// Behavior on implicitHeight {
|
||||||
// Anim {
|
// Anim {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ CustomRect {
|
|||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
color: visibilities.resources ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
color: visibilities.resources ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: horizontal ? Math.max(Config.bar.height, 24) : gridLayout.implicitHeight + Tokens.padding.normal * 2
|
implicitHeight: horizontal ? Math.max(Config.bar.height, Tokens.bar.innerSize) : gridLayout.implicitHeight + Tokens.padding.normal * 2
|
||||||
implicitWidth: horizontal ? gridLayout.implicitWidth + Tokens.padding.larger * 2 : Config.bar.height
|
implicitWidth: horizontal ? gridLayout.implicitWidth + Tokens.padding.larger * 2 : Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
StateLayer {
|
StateLayer {
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ PageBase {
|
|||||||
active: Config.bar.position === "top" ? menuItems[0] : Config.bar.position === "left" ? menuItems[1] : menuItems[2]
|
active: Config.bar.position === "top" ? menuItems[0] : Config.bar.position === "left" ? menuItems[1] : menuItems[2]
|
||||||
last: true
|
last: true
|
||||||
settingAnchor: "bar-position"
|
settingAnchor: "bar-position"
|
||||||
subtext: qsTr("Automatic or manual effect values")
|
subtext: qsTr("Change which edge the bar appears on")
|
||||||
text: qsTr("Effects mode")
|
text: qsTr("Position")
|
||||||
|
|
||||||
menuItems: [
|
menuItems: [
|
||||||
MenuItem {
|
MenuItem {
|
||||||
@@ -58,10 +58,7 @@ PageBase {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
onSelected: item => {
|
onSelected: item => Config.bar.position = item.value
|
||||||
Config.bar.position = item.value;
|
|
||||||
Config.save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ CustomClippingRect {
|
|||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
readonly property real shortSize: Config.bar.height
|
readonly property real shortSize: Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
readonly property real size: horizontal ? grid.implicitWidth + Tokens.padding.small * 2 : grid.implicitHeight + Tokens.padding.small * 2
|
readonly property real size: horizontal ? grid.implicitWidth + Tokens.padding.small * 2 : grid.implicitHeight + Tokens.padding.small * 2
|
||||||
readonly property int spacing: Tokens.spacing.normal / 2
|
readonly property int spacing: Tokens.spacing.normal / 2
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ CustomClippingRect {
|
|||||||
required property GridLayout loader
|
required property GridLayout loader
|
||||||
readonly property int padding: Tokens.padding.small
|
readonly property int padding: Tokens.padding.small
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
readonly property real shortSize: Config.bar.height
|
readonly property real shortSize: Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
readonly property real size: horizontal ? sysGrid.implicitWidth + Tokens.padding.small : sysGrid.implicitHeight + Tokens.padding.small
|
readonly property real size: horizontal ? sysGrid.implicitWidth + Tokens.padding.small : sysGrid.implicitHeight + Tokens.padding.small
|
||||||
|
|
||||||
bottomLeftRadius: horizontal ? Tokens.rounding.full : Tokens.rounding.smallest / 2
|
bottomLeftRadius: horizontal ? Tokens.rounding.full : Tokens.rounding.smallest / 2
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ MaterialIcon {
|
|||||||
animate: true
|
animate: true
|
||||||
color: Audio.muted ? Colors.palette.m3error : Colors.palette.m3onSurface
|
color: Audio.muted ? Colors.palette.m3error : Colors.palette.m3onSurface
|
||||||
fill: 1
|
fill: 1
|
||||||
font.pointSize: horizontal ? Tokens.font.size.larger : Tokens.font.size.large
|
font.pointSize: Tokens.font.size.larger
|
||||||
text: Audio.muted ? "volume_off" : "volume_up"
|
text: Audio.muted ? "volume_off" : "volume_up"
|
||||||
|
|
||||||
Behavior on Layout.maximumWidth {
|
Behavior on Layout.maximumWidth {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ MaterialIcon {
|
|||||||
animate: true
|
animate: true
|
||||||
color: (Audio.sourceMuted ?? false) ? Colors.palette.m3error : Colors.palette.m3onSurface
|
color: (Audio.sourceMuted ?? false) ? Colors.palette.m3error : Colors.palette.m3onSurface
|
||||||
fill: 1
|
fill: 1
|
||||||
font.pointSize: horizontal ? Tokens.font.size.larger : Tokens.font.size.large
|
font.pointSize: Tokens.font.size.larger
|
||||||
text: Audio.sourceMuted ? "mic_off" : "mic"
|
text: Audio.sourceMuted ? "mic_off" : "mic"
|
||||||
|
|
||||||
Behavior on Layout.maximumWidth {
|
Behavior on Layout.maximumWidth {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ Item {
|
|||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
animate: true
|
animate: true
|
||||||
fill: 1
|
fill: 1
|
||||||
font.pointSize: root.horizontal ? Tokens.font.size.larger : Tokens.font.size.large
|
font.pointSize: Tokens.font.size.larger
|
||||||
text: {
|
text: {
|
||||||
if (PowerProfiles.profile === PowerProfile.PowerSaver)
|
if (PowerProfiles.profile === PowerProfile.PowerSaver)
|
||||||
return "energy_savings_leaf";
|
return "energy_savings_leaf";
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ CustomRect {
|
|||||||
property color textColor: Colors.palette.m3onSurface
|
property color textColor: Colors.palette.m3onSurface
|
||||||
|
|
||||||
color: Colors.tPalette.m3surfaceContainer
|
color: Colors.tPalette.m3surfaceContainer
|
||||||
implicitHeight: horizontal ? Config.bar.height : content.implicitHeight + Tokens.spacing.small * 2
|
implicitHeight: horizontal ? Math.max(Config.bar.height, Tokens.bar.innerSize) : content.implicitHeight + Tokens.spacing.small
|
||||||
implicitWidth: horizontal ? content.implicitWidth + Tokens.spacing.small * 2 : Config.bar.height
|
implicitWidth: horizontal ? content.implicitWidth + Tokens.spacing.small * 2 : Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
radius: Tokens.rounding.full
|
radius: Tokens.rounding.full
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
@@ -24,6 +24,7 @@ CustomRect {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
columnSpacing: Tokens.spacing.small
|
columnSpacing: Tokens.spacing.small
|
||||||
columns: root.horizontal ? -1 : 1
|
columns: root.horizontal ? -1 : 1
|
||||||
|
rowSpacing: -Tokens.spacing.extraSmall / 2
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||||
@@ -34,7 +35,7 @@ CustomRect {
|
|||||||
CustomText {
|
CustomText {
|
||||||
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter
|
||||||
color: root.textColor
|
color: root.textColor
|
||||||
font.pointSize: root.horizontal ? Tokens.font.size.normal : Tokens.font.size.larger
|
font.pointSize: Tokens.font.size.normal
|
||||||
text: root.countUpdates
|
text: root.countUpdates
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Item {
|
|||||||
required property bool horizontal
|
required property bool horizontal
|
||||||
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(root.screen)
|
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(root.screen)
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
readonly property real shortSize: Math.max(Config.bar.height, 24)
|
readonly property real shortSize: Math.max(Config.bar.height, Tokens.bar.innerSize)
|
||||||
readonly property real size: (workspaceButtonWidth * workspacesShown) + activeWorkspaceMargin * 2
|
readonly property real size: (workspaceButtonWidth * workspacesShown) + activeWorkspaceMargin * 2
|
||||||
property int workspaceButtonWidth: (horizontal ? bgRect.implicitHeight : bgRect.implicitWidth) - root.activeWorkspaceMargin * 2
|
property int workspaceButtonWidth: (horizontal ? bgRect.implicitHeight : bgRect.implicitWidth) - root.activeWorkspaceMargin * 2
|
||||||
property int workspaceIndexInGroup: (effectiveActiveWorkspaceId - 1) % root.workspacesShown
|
property int workspaceIndexInGroup: (effectiveActiveWorkspaceId - 1) % root.workspacesShown
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "configlist.hpp"
|
#include "configlist.hpp"
|
||||||
#include "configobject.hpp"
|
#include "configobject.hpp"
|
||||||
#include <qcontainerfwd.h>
|
#include <qcontainerfwd.h>
|
||||||
|
#include <qhashfunctions.h>
|
||||||
#include <qqmlregistration.h>
|
#include <qqmlregistration.h>
|
||||||
|
|
||||||
namespace ZShell::config {
|
namespace ZShell::config {
|
||||||
@@ -62,7 +63,7 @@ class Bar : public ConfigObject {
|
|||||||
CFG_PROPERTY(int, revealDelay, 100)
|
CFG_PROPERTY(int, revealDelay, 100)
|
||||||
CFG_PROPERTY(int, rounding, 14)
|
CFG_PROPERTY(int, rounding, 14)
|
||||||
CFG_PROPERTY(int, smoothing, 32)
|
CFG_PROPERTY(int, smoothing, 32)
|
||||||
CFG_PROPERTY(QString, position, "top")
|
CFG_PROPERTY(QString, position, QStringLiteral("top"))
|
||||||
CONFIG_SUBOBJECT(Tray, tray)
|
CONFIG_SUBOBJECT(Tray, tray)
|
||||||
CONFIG_LIST(
|
CONFIG_LIST(
|
||||||
EntryList,
|
EntryList,
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ Config::Config(QObject* parent)
|
|||||||
m_reloadTimer.setInterval(50);
|
m_reloadTimer.setInterval(50);
|
||||||
connect(&m_reloadTimer, &QTimer::timeout, this, &Config::reloadAsync);
|
connect(&m_reloadTimer, &QTimer::timeout, this, &Config::reloadAsync);
|
||||||
|
|
||||||
|
connectAutoSave(this);
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
&m_watcher,
|
&m_watcher,
|
||||||
&QFileSystemWatcher::directoryChanged,
|
&QFileSystemWatcher::directoryChanged,
|
||||||
@@ -232,6 +234,15 @@ void Config::saveNow() {
|
|||||||
flushAsync();
|
flushAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Config::connectAutoSave(ConfigNode* node) {
|
||||||
|
connect(node, &ConfigNode::propertiesChanged, this, [this] {
|
||||||
|
scheduleSave();
|
||||||
|
});
|
||||||
|
|
||||||
|
for (auto* child : node->childNodes())
|
||||||
|
connectAutoSave(child);
|
||||||
|
}
|
||||||
|
|
||||||
bool Config::writeAtomically(const QByteArray& data) {
|
bool Config::writeAtomically(const QByteArray& data) {
|
||||||
QSaveFile f(filePath());
|
QSaveFile f(filePath());
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ class Config : public ConfigObject {
|
|||||||
void updateWatch();
|
void updateWatch();
|
||||||
void loadSync();
|
void loadSync();
|
||||||
void loadAsync();
|
void loadAsync();
|
||||||
|
void connectAutoSave(ConfigNode* node);
|
||||||
|
|
||||||
QTimer m_saveTimer;
|
QTimer m_saveTimer;
|
||||||
QTimer m_reloadTimer;
|
QTimer m_reloadTimer;
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
#include "configobject.hpp"
|
#include "configobject.hpp"
|
||||||
|
|
||||||
#include <QVariantList>
|
#include <QVariantList>
|
||||||
|
#include <qobject.h>
|
||||||
#include <qqmlengine.h>
|
#include <qqmlengine.h>
|
||||||
|
#include <qqmlintegration.h>
|
||||||
#include <qqmlregistration.h>
|
#include <qqmlregistration.h>
|
||||||
|
|
||||||
namespace ZShell::config {
|
namespace ZShell::config {
|
||||||
@@ -195,6 +197,16 @@ class AnimTokens : public ConfigObject {
|
|||||||
, m_durations(new AnimDurations(this)) {}
|
, m_durations(new AnimDurations(this)) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BarTokens : public ConfigObject {
|
||||||
|
Q_OBJECT
|
||||||
|
QML_ANONYMOUS
|
||||||
|
|
||||||
|
CFG_PROPERTY(int, innerSize, 28)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit BarTokens(QObject* parent = nullptr) : ConfigObject(parent) {}
|
||||||
|
};
|
||||||
|
|
||||||
class Tokens : public ConfigObject {
|
class Tokens : public ConfigObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
@@ -205,6 +217,7 @@ class Tokens : public ConfigObject {
|
|||||||
CONFIG_SUBOBJECT(AppearanceSpacing, spacing)
|
CONFIG_SUBOBJECT(AppearanceSpacing, spacing)
|
||||||
CONFIG_SUBOBJECT(FontTokens, font)
|
CONFIG_SUBOBJECT(FontTokens, font)
|
||||||
CONFIG_SUBOBJECT(AnimTokens, anim)
|
CONFIG_SUBOBJECT(AnimTokens, anim)
|
||||||
|
CONFIG_SUBOBJECT(BarTokens, bar)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Tokens(QObject* parent = nullptr)
|
explicit Tokens(QObject* parent = nullptr)
|
||||||
@@ -213,7 +226,8 @@ class Tokens : public ConfigObject {
|
|||||||
, m_padding(new AppearancePadding(this))
|
, m_padding(new AppearancePadding(this))
|
||||||
, m_spacing(new AppearanceSpacing(this))
|
, m_spacing(new AppearanceSpacing(this))
|
||||||
, m_font(new FontTokens(this))
|
, m_font(new FontTokens(this))
|
||||||
, m_anim(new AnimTokens(this)) {}
|
, m_anim(new AnimTokens(this))
|
||||||
|
, m_bar(new BarTokens(this)) {}
|
||||||
|
|
||||||
static Tokens* create(QQmlEngine*, QJSEngine*) { return new Tokens(); }
|
static Tokens* create(QQmlEngine*, QJSEngine*) { return new Tokens(); }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user