mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
@@ -94,7 +94,7 @@ Rectangle {
|
|||||||
width: iconSize
|
width: iconSize
|
||||||
height: iconSize
|
height: iconSize
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.top: parent.top
|
||||||
|
|
||||||
imageSource: {
|
imageSource: {
|
||||||
if (hasNotificationImage)
|
if (hasNotificationImage)
|
||||||
@@ -138,7 +138,7 @@ Rectangle {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.top: parent.top
|
||||||
spacing: compactMode ? 1 : 2
|
spacing: compactMode ? 1 : 2
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -153,6 +153,7 @@ Rectangle {
|
|||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
|
visible: text.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ Rectangle {
|
|||||||
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
|
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
|
||||||
readonly property real badgeSize: compactMode ? 16 : 18
|
readonly property real badgeSize: compactMode ? 16 : 18
|
||||||
readonly property real actionButtonHeight: compactMode ? 20 : 24
|
readonly property real actionButtonHeight: compactMode ? 20 : 24
|
||||||
readonly property real baseCardHeight: cardPadding * 2 + collapsedContentHeight
|
readonly property real collapsedContentHeight: iconSize
|
||||||
readonly property real collapsedContentHeight: iconSize + cardPadding
|
readonly property real baseCardHeight: cardPadding * 2 + collapsedContentHeight + actionButtonHeight + contentSpacing
|
||||||
|
|
||||||
width: parent ? parent.width : 400
|
width: parent ? parent.width : 400
|
||||||
height: expanded ? (expandedContent.height + cardPadding * 2) : (baseCardHeight + collapsedContent.extraHeight)
|
height: expanded ? (expandedContent.height + cardPadding * 2) : (baseCardHeight + collapsedContent.extraHeight)
|
||||||
@@ -118,7 +118,7 @@ Rectangle {
|
|||||||
width: iconSize
|
width: iconSize
|
||||||
height: iconSize
|
height: iconSize
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.top: parent.top
|
||||||
|
|
||||||
imageSource: {
|
imageSource: {
|
||||||
if (hasNotificationImage)
|
if (hasNotificationImage)
|
||||||
@@ -184,7 +184,7 @@ Rectangle {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.top: parent.top
|
||||||
spacing: compactMode ? 1 : 2
|
spacing: compactMode ? 1 : 2
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -199,6 +199,7 @@ Rectangle {
|
|||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
|
visible: text.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -555,8 +556,8 @@ Rectangle {
|
|||||||
|
|
||||||
Row {
|
Row {
|
||||||
visible: !expanded
|
visible: !expanded
|
||||||
anchors.right: clearButton.left
|
anchors.right: clearButton.visible ? clearButton.left : parent.right
|
||||||
anchors.rightMargin: contentSpacing
|
anchors.rightMargin: clearButton.visible ? contentSpacing : Theme.spacingL
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: contentSpacing
|
anchors.bottomMargin: contentSpacing
|
||||||
spacing: contentSpacing
|
spacing: contentSpacing
|
||||||
@@ -608,8 +609,9 @@ Rectangle {
|
|||||||
id: clearButton
|
id: clearButton
|
||||||
|
|
||||||
property bool isHovered: false
|
property bool isHovered: false
|
||||||
|
readonly property int actionCount: (notificationGroup?.latestNotification?.actions || []).length
|
||||||
|
|
||||||
visible: !expanded
|
visible: !expanded && actionCount < 3
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Theme.spacingL
|
anchors.rightMargin: Theme.spacingL
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ PanelWindow {
|
|||||||
readonly property real popupIconSize: compactMode ? 48 : 63
|
readonly property real popupIconSize: compactMode ? 48 : 63
|
||||||
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
|
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
|
||||||
readonly property real actionButtonHeight: compactMode ? 20 : 24
|
readonly property real actionButtonHeight: compactMode ? 20 : 24
|
||||||
readonly property real collapsedContentHeight: popupIconSize + cardPadding
|
readonly property real collapsedContentHeight: popupIconSize
|
||||||
readonly property real basePopupHeight: cardPadding * 2 + collapsedContentHeight + Theme.spacingS
|
readonly property real basePopupHeight: cardPadding * 2 + collapsedContentHeight + actionButtonHeight + Theme.spacingS
|
||||||
|
|
||||||
signal entered
|
signal entered
|
||||||
signal exitStarted
|
signal exitStarted
|
||||||
@@ -104,7 +104,7 @@ PanelWindow {
|
|||||||
implicitHeight: {
|
implicitHeight: {
|
||||||
if (!descriptionExpanded)
|
if (!descriptionExpanded)
|
||||||
return basePopupHeight;
|
return basePopupHeight;
|
||||||
const bodyTextHeight = bodyTextLoader.item?.contentHeight || 0;
|
const bodyTextHeight = bodyText.contentHeight || 0;
|
||||||
const twoLineHeight = Theme.fontSizeSmall * 1.2 * 2;
|
const twoLineHeight = Theme.fontSizeSmall * 1.2 * 2;
|
||||||
if (bodyTextHeight > twoLineHeight + 2)
|
if (bodyTextHeight > twoLineHeight + 2)
|
||||||
return basePopupHeight + bodyTextHeight - twoLineHeight;
|
return basePopupHeight + bodyTextHeight - twoLineHeight;
|
||||||
@@ -369,7 +369,7 @@ PanelWindow {
|
|||||||
Item {
|
Item {
|
||||||
id: notificationContent
|
id: notificationContent
|
||||||
|
|
||||||
readonly property real expandedTextHeight: bodyTextLoader.item?.contentHeight || 0
|
readonly property real expandedTextHeight: bodyText.contentHeight || 0
|
||||||
readonly property real twoLineHeight: Theme.fontSizeSmall * 1.2 * 2
|
readonly property real twoLineHeight: Theme.fontSizeSmall * 1.2 * 2
|
||||||
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > twoLineHeight + 2) ? (expandedTextHeight - twoLineHeight) : 0
|
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > twoLineHeight + 2) ? (expandedTextHeight - twoLineHeight) : 0
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ PanelWindow {
|
|||||||
width: popupIconSize
|
width: popupIconSize
|
||||||
height: popupIconSize
|
height: popupIconSize
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.top: parent.top
|
||||||
|
|
||||||
imageSource: {
|
imageSource: {
|
||||||
if (!notificationData)
|
if (!notificationData)
|
||||||
@@ -433,90 +433,78 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Column {
|
||||||
id: textContainer
|
id: textContainer
|
||||||
|
|
||||||
anchors.left: iconContainer.right
|
anchors.left: iconContainer.right
|
||||||
anchors.leftMargin: Theme.spacingM
|
anchors.leftMargin: Theme.spacingM
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
spacing: compactMode ? 1 : 2
|
||||||
anchors.bottomMargin: contentSpacing
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
Column {
|
StyledText {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
text: {
|
||||||
spacing: compactMode ? 1 : 2
|
if (!notificationData)
|
||||||
|
return "";
|
||||||
|
const appName = notificationData.appName || "";
|
||||||
|
const timeStr = notificationData.timeStr || "";
|
||||||
|
return timeStr.length > 0 ? appName + " • " + timeStr : appName;
|
||||||
|
}
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
elide: Text.ElideRight
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
maximumLineCount: 1
|
||||||
|
visible: text.length > 0
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
width: parent.width
|
text: notificationData ? (notificationData.summary || "") : ""
|
||||||
text: {
|
color: Theme.surfaceText
|
||||||
if (!notificationData)
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
return "";
|
font.weight: Font.Medium
|
||||||
const appName = notificationData.appName || "";
|
width: parent.width
|
||||||
const timeStr = notificationData.timeStr || "";
|
elide: Text.ElideRight
|
||||||
return timeStr.length > 0 ? appName + " • " + timeStr : appName;
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
maximumLineCount: 1
|
||||||
|
visible: text.length > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: bodyText
|
||||||
|
property bool hasMoreText: truncated
|
||||||
|
|
||||||
|
text: notificationData ? (notificationData.htmlBody || "") : ""
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
width: parent.width
|
||||||
|
elide: descriptionExpanded ? Text.ElideNone : Text.ElideRight
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
maximumLineCount: descriptionExpanded ? -1 : (compactMode ? 1 : 2)
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
visible: text.length > 0
|
||||||
|
linkColor: Theme.primary
|
||||||
|
onLinkActivated: link => Qt.openUrlExternally(link)
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (bodyText.hasMoreText || descriptionExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
|
||||||
|
onClicked: mouse => {
|
||||||
|
if (!parent.hoveredLink && (bodyText.hasMoreText || descriptionExpanded))
|
||||||
|
win.descriptionExpanded = !win.descriptionExpanded;
|
||||||
}
|
}
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
font.weight: Font.Medium
|
|
||||||
elide: Text.ElideRight
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
maximumLineCount: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
propagateComposedEvents: true
|
||||||
text: notificationData ? (notificationData.summary || "") : ""
|
onPressed: mouse => {
|
||||||
color: Theme.surfaceText
|
if (parent.hoveredLink)
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
mouse.accepted = false;
|
||||||
font.weight: Font.Medium
|
}
|
||||||
width: parent.width
|
onReleased: mouse => {
|
||||||
elide: Text.ElideRight
|
if (parent.hoveredLink)
|
||||||
horizontalAlignment: Text.AlignLeft
|
mouse.accepted = false;
|
||||||
maximumLineCount: 1
|
|
||||||
visible: text.length > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: bodyTextLoader
|
|
||||||
width: parent.width
|
|
||||||
active: notificationData && (notificationData.htmlBody || "").length > 0
|
|
||||||
|
|
||||||
sourceComponent: StyledText {
|
|
||||||
id: bodyText
|
|
||||||
property bool hasMoreText: truncated
|
|
||||||
|
|
||||||
text: notificationData ? (notificationData.htmlBody || "") : ""
|
|
||||||
color: Theme.surfaceVariantText
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
width: parent.width
|
|
||||||
elide: descriptionExpanded ? Text.ElideNone : Text.ElideRight
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
maximumLineCount: descriptionExpanded ? -1 : (compactMode ? 1 : 2)
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
linkColor: Theme.primary
|
|
||||||
onLinkActivated: link => Qt.openUrlExternally(link)
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (parent.hasMoreText || descriptionExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
||||||
|
|
||||||
onClicked: mouse => {
|
|
||||||
if (!parent.hoveredLink && (parent.hasMoreText || descriptionExpanded))
|
|
||||||
win.descriptionExpanded = !win.descriptionExpanded;
|
|
||||||
}
|
|
||||||
|
|
||||||
propagateComposedEvents: true
|
|
||||||
onPressed: mouse => {
|
|
||||||
if (parent.hoveredLink)
|
|
||||||
mouse.accepted = false;
|
|
||||||
}
|
|
||||||
onReleased: mouse => {
|
|
||||||
if (parent.hoveredLink)
|
|
||||||
mouse.accepted = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -541,8 +529,8 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
anchors.right: clearButton.left
|
anchors.right: clearButton.visible ? clearButton.left : parent.right
|
||||||
anchors.rightMargin: contentSpacing
|
anchors.rightMargin: clearButton.visible ? contentSpacing : Theme.spacingL
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: contentSpacing
|
anchors.bottomMargin: contentSpacing
|
||||||
spacing: contentSpacing
|
spacing: contentSpacing
|
||||||
@@ -592,7 +580,9 @@ PanelWindow {
|
|||||||
id: clearButton
|
id: clearButton
|
||||||
|
|
||||||
property bool isHovered: false
|
property bool isHovered: false
|
||||||
|
readonly property int actionCount: notificationData ? (notificationData.actions || []).length : 0
|
||||||
|
|
||||||
|
visible: actionCount < 3
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Theme.spacingL
|
anchors.rightMargin: Theme.spacingL
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|||||||
Reference in New Issue
Block a user