new themes + notif dnd
This commit is contained in:
@@ -19,15 +19,18 @@ Rectangle {
|
||||
property int barMargin: Cfg.Config.margin
|
||||
readonly property var t: Cfg.Config.theme
|
||||
|
||||
property int unreadCount: 0
|
||||
property bool historyOpen: historyPopup.popupOpen
|
||||
property int unreadCount: 0
|
||||
property bool doNotDisturb: false
|
||||
property bool historyOpen: historyPopup.popupOpen
|
||||
|
||||
width: 35
|
||||
height: 40
|
||||
radius: panelRadius
|
||||
|
||||
color: hoverHandler.hovered ? t.notifBgHover : t.notifBg
|
||||
border.color: (hoverHandler.hovered || historyOpen) ? t.notifBorderActive : t.notifBorder
|
||||
border.color: root.doNotDisturb
|
||||
? t.notifDnd
|
||||
: ((hoverHandler.hovered || historyOpen) ? t.notifBorderActive : t.notifBorder)
|
||||
border.width: borderWidth
|
||||
|
||||
Behavior on color { ColorAnimation { duration: 150 } }
|
||||
@@ -54,8 +57,10 @@ Rectangle {
|
||||
Text {
|
||||
id: bellIcon
|
||||
anchors.centerIn: parent
|
||||
text: ""
|
||||
color: root.unreadCount > 0 ? t.notifIconActive : t.notifIcon
|
||||
text: root.doNotDisturb ? "" : ""
|
||||
color: root.doNotDisturb
|
||||
? t.notifDnd
|
||||
: (root.unreadCount > 0 ? t.notifIconActive : t.notifIcon)
|
||||
font.pixelSize: Cfg.Config.notifIconSize
|
||||
Behavior on color { ColorAnimation { duration: 150 } }
|
||||
}
|
||||
@@ -149,10 +154,11 @@ Rectangle {
|
||||
timeStr: timeStr,
|
||||
timeout: finalTimeout
|
||||
}
|
||||
if (toastLayer.atBottom) activeToasts.append(toastEntry)
|
||||
else activeToasts.insert(0, toastEntry)
|
||||
|
||||
if (!root.historyOpen) root.unreadCount++
|
||||
if (!root.doNotDisturb) {
|
||||
if (toastLayer.atBottom) activeToasts.append(toastEntry)
|
||||
else activeToasts.insert(0, toastEntry)
|
||||
if (!root.historyOpen) root.unreadCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +303,45 @@ Rectangle {
|
||||
Layout.fillWidth: true; Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
// ── Do Not Disturb toggle ─────────────────────────────
|
||||
Rectangle {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
width: dndRow.implicitWidth + 16
|
||||
height: 24
|
||||
radius: 12
|
||||
color: root.doNotDisturb
|
||||
? Qt.rgba(t.notifDnd.r, t.notifDnd.g, t.notifDnd.b, 0.18)
|
||||
: (dndHover.hovered ? t.notifHistoryHover : "transparent")
|
||||
border.color: root.doNotDisturb ? t.notifDnd : "transparent"
|
||||
border.width: Cfg.Config.popupBorderWidth
|
||||
Behavior on color { ColorAnimation { duration: 150 } }
|
||||
Behavior on border.color { ColorAnimation { duration: 150 } }
|
||||
|
||||
Row {
|
||||
id: dndRow
|
||||
anchors.centerIn: parent
|
||||
spacing: 4
|
||||
Text {
|
||||
text: ""
|
||||
color: root.doNotDisturb ? t.notifDnd : t.notifToastDim
|
||||
font.pixelSize: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Behavior on color { ColorAnimation { duration: 150 } }
|
||||
}
|
||||
Text {
|
||||
text: root.doNotDisturb ? "On" : "Off"
|
||||
color: root.doNotDisturb ? t.notifDnd : t.notifToastDim
|
||||
font.pixelSize: 11
|
||||
font.bold: root.doNotDisturb
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Behavior on color { ColorAnimation { duration: 150 } }
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler { id: dndHover; cursorShape: Qt.PointingHandCursor }
|
||||
TapHandler { onTapped: root.doNotDisturb = !root.doNotDisturb }
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: notifHistory.count > 0
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
@@ -308,7 +353,7 @@ Rectangle {
|
||||
|
||||
Text { id: clearText; anchors.centerIn: parent; text: "Clear all"; color: t.notifToastDim; font.pixelSize: 11 }
|
||||
HoverHandler { id: clearHover; cursorShape: Qt.PointingHandCursor }
|
||||
TapHandler { onTapped: { notifHistory.clear(); root.unreadCount = 0 } }
|
||||
TapHandler { onTapped: clearAllAnim.start() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,10 +363,31 @@ Rectangle {
|
||||
anchors.topMargin: 12; height: 1; color: t.notifSeparator
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: clearAllAnim
|
||||
ParallelAnimation {
|
||||
NumberAnimation {
|
||||
target: histCol; property: "opacity"
|
||||
to: 0; duration: 220; easing.type: Easing.OutCubic
|
||||
}
|
||||
NumberAnimation {
|
||||
target: clearShift; property: "y"
|
||||
to: -16; duration: 220; easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
ScriptAction {
|
||||
script: { notifHistory.clear(); root.unreadCount = 0 }
|
||||
}
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: histCol; property: "opacity"; to: 1; duration: 0 }
|
||||
NumberAnimation { target: clearShift; property: "y"; to: 0; duration: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: histFlick
|
||||
anchors { left: parent.left; right: parent.right; top: histDivider.bottom; bottom: parent.bottom }
|
||||
anchors.leftMargin: 8; anchors.rightMargin: 8
|
||||
anchors.leftMargin: 2; anchors.rightMargin: 8
|
||||
anchors.topMargin: 6; anchors.bottomMargin: 8; clip: true
|
||||
contentHeight: histCol.implicitHeight
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
@@ -329,7 +395,9 @@ Rectangle {
|
||||
|
||||
Column {
|
||||
id: histCol
|
||||
width: histFlick.width; spacing: 2; topPadding: 4; bottomPadding: 4; leftPadding: 8; rightPadding: 8
|
||||
opacity: 1
|
||||
transform: Translate { id: clearShift; y: 0 }
|
||||
width: histFlick.width; spacing: 2; topPadding: 4; bottomPadding: 4; leftPadding: 2; rightPadding: 8
|
||||
|
||||
Item {
|
||||
width: histCol.width - 16; height: 90; visible: notifHistory.count === 0
|
||||
@@ -343,7 +411,7 @@ Rectangle {
|
||||
Repeater {
|
||||
model: notifHistory
|
||||
Notif.HistoryCard {
|
||||
width: histCol.width - 16; x: 8; itemIndex: index
|
||||
width: histCol.width - 10; x: 2; itemIndex: index
|
||||
appName: model.appName; summary: model.summary; body: model.body; urgency: model.urgency; timeStr: model.timeStr
|
||||
t: root.t; urgencyColor: root.urgencyColor; urgencyIcon: root.urgencyIcon
|
||||
onDismissed: (idx) => notifHistory.remove(idx)
|
||||
@@ -355,3 +423,4 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -340,11 +340,12 @@ Rectangle {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.preferredWidth: 44
|
||||
}
|
||||
// ── Mute toggle button ────────────────────────────────────────
|
||||
Rectangle {
|
||||
width: 22; height: 22; radius: 6
|
||||
color: muteHover.hovered ? (vs.muted ? "#33ffffff" : "#22ffffff") : (vs.muted ? root.t.volMuteBg : "transparent")
|
||||
border.color: vs.muted ? vs.accentColor : vs.dimColor
|
||||
border.width: 1
|
||||
border.width: Cfg.Config.popupBorderWidth
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: vs.muted ? "" : ""
|
||||
@@ -370,6 +371,7 @@ Rectangle {
|
||||
color: vs.muted ? vs.dimColor : vs.accentColor
|
||||
}
|
||||
}
|
||||
// ── Volume slider handle ──────────────────────────────────────
|
||||
Rectangle {
|
||||
readonly property real ratio: vs.volume / Math.max(1, vs.maxVolume)
|
||||
x: Math.min(sliderItem.width - width, Math.max(0, sliderItem.width * ratio - width / 2))
|
||||
@@ -377,7 +379,7 @@ Rectangle {
|
||||
width: Cfg.Config.volumeHandleSize; height: Cfg.Config.volumeHandleSize; radius: width / 2
|
||||
color: vs.muted ? vs.dimColor : vs.accentColor
|
||||
border.color: root.t.volHandleBorder
|
||||
border.width: 1
|
||||
border.width: Cfg.Config.popupBorderWidth
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent; cursorShape: Qt.PointingHandCursor
|
||||
@@ -401,11 +403,12 @@ Rectangle {
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
// ── Device picker chevron ─────────────────────────────────────
|
||||
Rectangle {
|
||||
width: 20; height: 20; radius: 5
|
||||
color: chevHover.hovered ? "#22ffffff" : "transparent"
|
||||
border.color: vs.pickerOpen ? vs.accentColor : root.t.volPopupBorder
|
||||
border.width: 1
|
||||
border.width: Cfg.Config.popupBorderWidth
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: vs.pickerOpen ? "" : ""
|
||||
@@ -445,8 +448,9 @@ Rectangle {
|
||||
readonly property bool isActive: vs.currentNode !== null && modelData.id === vs.currentNode.id
|
||||
Layout.fillWidth: true; height: 28; radius: 7
|
||||
color: isActive ? Qt.alpha(vs.accentColor, 0.18) : (rowHover.hovered ? root.t.volPickerHover : "transparent")
|
||||
// ── Device row border ─────────────────────────────
|
||||
border.color: isActive ? Qt.alpha(vs.accentColor, 0.45) : "transparent"
|
||||
border.width: 1
|
||||
border.width: Cfg.Config.popupBorderWidth
|
||||
RowLayout {
|
||||
anchors { fill: parent; leftMargin: 8; rightMargin: 8 }
|
||||
spacing: 8
|
||||
@@ -454,7 +458,7 @@ Rectangle {
|
||||
width: 6; height: 6; radius: 3
|
||||
color: isActive ? vs.accentColor : "transparent"
|
||||
border.color: isActive ? "transparent" : vs.dimColor
|
||||
border.width: 1
|
||||
border.width: Cfg.Config.popupBorderWidth
|
||||
}
|
||||
Text {
|
||||
text: modelData.description || modelData.nickName || modelData.name
|
||||
@@ -495,10 +499,12 @@ Rectangle {
|
||||
font.pixelSize: 11
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
// ── Decrement button ──────────────────────────────────────────────
|
||||
Rectangle {
|
||||
width: 22; height: 22; radius: 5
|
||||
color: decHover.hovered ? "#22ffffff" : "transparent"
|
||||
border.color: lr.borderColor; border.width: 1
|
||||
border.color: lr.borderColor
|
||||
border.width: Cfg.Config.popupBorderWidth
|
||||
Text {
|
||||
anchors.centerIn: parent; text: "−"
|
||||
color: lr.value <= lr.minValue ? lr.dimColor : lr.textColor
|
||||
@@ -514,10 +520,12 @@ Rectangle {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.preferredWidth: 44
|
||||
}
|
||||
// ── Increment button ──────────────────────────────────────────────
|
||||
Rectangle {
|
||||
width: 22; height: 22; radius: 5
|
||||
color: incHover.hovered ? "#22ffffff" : "transparent"
|
||||
border.color: lr.borderColor; border.width: 1
|
||||
border.color: lr.borderColor
|
||||
border.width: Cfg.Config.popupBorderWidth
|
||||
Text {
|
||||
anchors.centerIn: parent; text: "+"
|
||||
color: lr.value >= lr.maxValue ? lr.dimColor : lr.textColor
|
||||
|
||||
Reference in New Issue
Block a user