mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-02 18:42:04 +00:00
Qt-Scaling: first cleanup pass
This commit is contained in:
@@ -17,7 +17,6 @@ Variants {
|
||||
id: root
|
||||
|
||||
required property ShellScreen modelData
|
||||
property real scaling: ScalingService.getScreenScale(modelData)
|
||||
|
||||
// Access the notification model from the service
|
||||
property ListModel notificationModel: NotificationService.activeList
|
||||
@@ -42,15 +41,6 @@ Variants {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ScalingService
|
||||
function onScaleChanged(screenName, scale) {
|
||||
if (root.modelData && screenName === root.modelData.name) {
|
||||
root.scaling = scale
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceComponent: PanelWindow {
|
||||
screen: modelData
|
||||
|
||||
@@ -79,10 +69,10 @@ Variants {
|
||||
margins.top: {
|
||||
if (!(anchors.top))
|
||||
return 0
|
||||
var base = Style.marginM * scaling
|
||||
var base = Style.marginM
|
||||
if (Settings.data.bar.position === "top") {
|
||||
var floatExtraV = Settings.data.bar.floating ? Settings.data.bar.marginVertical * Style.marginXL * scaling : 0
|
||||
return (Style.barHeight * scaling) + base + floatExtraV
|
||||
var floatExtraV = Settings.data.bar.floating ? Settings.data.bar.marginVertical * Style.marginXL : 0
|
||||
return (Style.barHeight) + base + floatExtraV
|
||||
}
|
||||
return base
|
||||
}
|
||||
@@ -90,10 +80,10 @@ Variants {
|
||||
margins.bottom: {
|
||||
if (!(anchors.bottom))
|
||||
return 0
|
||||
var base = Style.marginM * scaling
|
||||
var base = Style.marginM
|
||||
if (Settings.data.bar.position === "bottom") {
|
||||
var floatExtraV = Settings.data.bar.floating ? Settings.data.bar.marginVertical * Style.marginXL * scaling : 0
|
||||
return (Style.barHeight * scaling) + base + floatExtraV
|
||||
var floatExtraV = Settings.data.bar.floating ? Settings.data.bar.marginVertical * Style.marginXL : 0
|
||||
return (Style.barHeight) + base + floatExtraV
|
||||
}
|
||||
return base
|
||||
}
|
||||
@@ -101,10 +91,10 @@ Variants {
|
||||
margins.left: {
|
||||
if (!(anchors.left))
|
||||
return 0
|
||||
var base = Style.marginM * scaling
|
||||
var base = Style.marginM
|
||||
if (Settings.data.bar.position === "left") {
|
||||
var floatExtraH = Settings.data.bar.floating ? Settings.data.bar.marginHorizontal * Style.marginXL * scaling : 0
|
||||
return (Style.barHeight * scaling) + base + floatExtraH
|
||||
var floatExtraH = Settings.data.bar.floating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
|
||||
return (Style.barHeight) + base + floatExtraH
|
||||
}
|
||||
return base
|
||||
}
|
||||
@@ -112,15 +102,15 @@ Variants {
|
||||
margins.right: {
|
||||
if (!(anchors.right))
|
||||
return 0
|
||||
var base = Style.marginM * scaling
|
||||
var base = Style.marginM
|
||||
if (Settings.data.bar.position === "right") {
|
||||
var floatExtraH = Settings.data.bar.floating ? Settings.data.bar.marginHorizontal * Style.marginXL * scaling : 0
|
||||
return (Style.barHeight * scaling) + base + floatExtraH
|
||||
var floatExtraH = Settings.data.bar.floating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
|
||||
return (Style.barHeight) + base + floatExtraH
|
||||
}
|
||||
return base
|
||||
}
|
||||
|
||||
implicitWidth: 360 * scaling
|
||||
implicitWidth: 360
|
||||
implicitHeight: notificationStack.implicitHeight
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
|
||||
@@ -165,8 +155,8 @@ Variants {
|
||||
anchors.left: parent.isLeft ? parent.left : undefined
|
||||
anchors.right: parent.isRight ? parent.right : undefined
|
||||
anchors.horizontalCenter: parent.isCentered ? parent.horizontalCenter : undefined
|
||||
spacing: Style.marginS * scaling
|
||||
width: 360 * scaling
|
||||
spacing: Style.marginS
|
||||
width: 360
|
||||
visible: true
|
||||
|
||||
// Multiple notifications display
|
||||
@@ -178,15 +168,14 @@ Variants {
|
||||
// Store the notification ID and data for reference
|
||||
property string notificationId: model.id
|
||||
property var notificationData: model
|
||||
property real cardScaling: root.scaling
|
||||
|
||||
Layout.preferredWidth: 360 * cardScaling
|
||||
Layout.preferredHeight: notificationLayout.implicitHeight + (Style.marginL * 2 * cardScaling)
|
||||
Layout.preferredWidth: 360
|
||||
Layout.preferredHeight: notificationLayout.implicitHeight + (Style.marginL * 2)
|
||||
Layout.maximumHeight: Layout.preferredHeight
|
||||
|
||||
radius: Style.radiusL * cardScaling
|
||||
radius: Style.radiusL
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS * cardScaling)
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
color: Color.mSurface
|
||||
|
||||
// Optimized progress bar container
|
||||
@@ -195,7 +184,7 @@ Variants {
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: 2 * cardScaling
|
||||
height: 2
|
||||
color: Color.transparent
|
||||
|
||||
// Pre-calculate available width for the progress bar
|
||||
@@ -311,28 +300,28 @@ Variants {
|
||||
ColumnLayout {
|
||||
id: notificationLayout
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginM * cardScaling
|
||||
anchors.rightMargin: (Style.marginM + 32) * cardScaling // Leave space for close button
|
||||
spacing: Style.marginM * cardScaling
|
||||
anchors.margins: Style.marginM
|
||||
anchors.rightMargin: (Style.marginM + 32) // Leave space for close button
|
||||
spacing: Style.marginM
|
||||
|
||||
// Main content section
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginM * cardScaling
|
||||
spacing: Style.marginM
|
||||
|
||||
ColumnLayout {
|
||||
// For real-time notification always show the original image
|
||||
// as the cached version is most likely still processing.
|
||||
NImageCircled {
|
||||
Layout.preferredWidth: 40 * cardScaling
|
||||
Layout.preferredHeight: 40 * cardScaling
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 40
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.topMargin: 30 * cardScaling
|
||||
Layout.topMargin: 30
|
||||
imagePath: model.originalImage || ""
|
||||
borderColor: Color.transparent
|
||||
borderWidth: 0
|
||||
fallbackIcon: "bell"
|
||||
fallbackIconSize: 24 * cardScaling
|
||||
fallbackIconSize: 24
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
@@ -342,17 +331,17 @@ Variants {
|
||||
// Text content
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginS * cardScaling
|
||||
spacing: Style.marginS
|
||||
|
||||
// Header section with app name and timestamp
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginS * cardScaling
|
||||
spacing: Style.marginS
|
||||
|
||||
Rectangle {
|
||||
Layout.preferredWidth: 6 * cardScaling
|
||||
Layout.preferredHeight: 6 * cardScaling
|
||||
radius: Style.radiusXS * cardScaling
|
||||
Layout.preferredWidth: 6
|
||||
Layout.preferredHeight: 6
|
||||
radius: Style.radiusXS
|
||||
color: {
|
||||
if (model.urgency === NotificationUrgency.Critical || model.urgency === 2)
|
||||
return Color.mError
|
||||
@@ -367,7 +356,7 @@ Variants {
|
||||
NText {
|
||||
text: `${model.appName || I18n.tr("system.unknown-app")} · ${Time.formatRelativeTime(model.timestamp)}`
|
||||
color: Color.mSecondary
|
||||
pointSize: Style.fontSizeXS * cardScaling
|
||||
pointSize: Style.fontSizeXS
|
||||
}
|
||||
|
||||
Item {
|
||||
@@ -377,7 +366,7 @@ Variants {
|
||||
|
||||
NText {
|
||||
text: model.summary || I18n.tr("general.no-summary")
|
||||
pointSize: Style.fontSizeL * cardScaling
|
||||
pointSize: Style.fontSizeL
|
||||
font.weight: Style.fontWeightMedium
|
||||
color: Color.mOnSurface
|
||||
textFormat: Text.PlainText
|
||||
@@ -390,7 +379,7 @@ Variants {
|
||||
|
||||
NText {
|
||||
text: model.body || ""
|
||||
pointSize: Style.fontSizeM * cardScaling
|
||||
pointSize: Style.fontSizeM
|
||||
color: Color.mOnSurface
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
@@ -403,8 +392,8 @@ Variants {
|
||||
// Notification actions
|
||||
Flow {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginS * cardScaling
|
||||
Layout.topMargin: Style.marginM * cardScaling
|
||||
spacing: Style.marginS
|
||||
Layout.topMargin: Style.marginM
|
||||
|
||||
flow: Flow.LeftToRight
|
||||
layoutDirection: Qt.LeftToRight
|
||||
@@ -436,12 +425,12 @@ Variants {
|
||||
}
|
||||
return actionText
|
||||
}
|
||||
fontSize: Style.fontSizeS * cardScaling
|
||||
fontSize: Style.fontSizeS
|
||||
backgroundColor: Color.mPrimary
|
||||
textColor: hovered ? Color.mOnTertiary : Color.mOnPrimary
|
||||
hoverColor: Color.mTertiary
|
||||
outlined: false
|
||||
implicitHeight: 24 * cardScaling
|
||||
implicitHeight: 24
|
||||
onClicked: {
|
||||
NotificationService.invokeAction(parent.parentNotificationId, actionData.identifier)
|
||||
}
|
||||
@@ -458,9 +447,9 @@ Variants {
|
||||
tooltipText: I18n.tr("tooltips.close")
|
||||
baseSize: Style.baseWidgetSize * 0.6
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.marginM * cardScaling
|
||||
anchors.topMargin: Style.marginM
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.marginM * cardScaling
|
||||
anchors.rightMargin: Style.marginM
|
||||
|
||||
onClicked: {
|
||||
animateOut()
|
||||
|
||||
@@ -26,23 +26,23 @@ NPanel {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginL * scaling
|
||||
spacing: Style.marginM * scaling
|
||||
anchors.margins: Style.marginL
|
||||
spacing: Style.marginM
|
||||
|
||||
// Header section
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginM * scaling
|
||||
spacing: Style.marginM
|
||||
|
||||
NIcon {
|
||||
icon: "bell"
|
||||
pointSize: Style.fontSizeXXL * scaling
|
||||
pointSize: Style.fontSizeXXL
|
||||
color: Color.mPrimary
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("notifications.panel.title")
|
||||
pointSize: Style.fontSizeL * scaling
|
||||
pointSize: Style.fontSizeL
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mOnSurface
|
||||
Layout.fillWidth: true
|
||||
@@ -84,7 +84,7 @@ NPanel {
|
||||
Layout.fillHeight: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
visible: NotificationService.historyList.count === 0
|
||||
spacing: Style.marginL * scaling
|
||||
spacing: Style.marginL
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
@@ -92,21 +92,21 @@ NPanel {
|
||||
|
||||
NIcon {
|
||||
icon: "bell-off"
|
||||
pointSize: 64 * scaling
|
||||
pointSize: 64
|
||||
color: Color.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("notifications.panel.no-notifications")
|
||||
pointSize: Style.fontSizeL * scaling
|
||||
pointSize: Style.fontSizeL
|
||||
color: Color.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("notifications.panel.description")
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
pointSize: Style.fontSizeS
|
||||
color: Color.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
@@ -128,7 +128,7 @@ NPanel {
|
||||
verticalPolicy: ScrollBar.AsNeeded
|
||||
|
||||
model: NotificationService.historyList
|
||||
spacing: Style.marginM * scaling
|
||||
spacing: Style.marginM
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
visible: NotificationService.historyList.count > 0
|
||||
@@ -141,11 +141,11 @@ NPanel {
|
||||
property bool isExpanded: notificationList.expandedId === notificationId
|
||||
|
||||
width: notificationList.width
|
||||
height: notificationLayout.implicitHeight + (Style.marginM * scaling * 2)
|
||||
radius: Style.radiusM * scaling
|
||||
height: notificationLayout.implicitHeight + (Style.marginM * 2)
|
||||
radius: Style.radiusM
|
||||
color: Color.mSurfaceVariant
|
||||
border.color: Qt.alpha(Color.mOutline, Style.opacityMedium)
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
@@ -165,7 +165,7 @@ NPanel {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
// Don't capture clicks on the delete button
|
||||
anchors.rightMargin: 48 * scaling
|
||||
anchors.rightMargin: 48
|
||||
enabled: (summaryText.truncated || bodyText.truncated)
|
||||
onClicked: {
|
||||
if (notificationList.expandedId === notificationId) {
|
||||
@@ -180,20 +180,20 @@ NPanel {
|
||||
RowLayout {
|
||||
id: notificationLayout
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginM * scaling
|
||||
spacing: Style.marginM * scaling
|
||||
anchors.margins: Style.marginM
|
||||
spacing: Style.marginM
|
||||
|
||||
ColumnLayout {
|
||||
NImageCircled {
|
||||
Layout.preferredWidth: 40 * scaling
|
||||
Layout.preferredHeight: 40 * scaling
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 40
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.topMargin: 20 * scaling
|
||||
Layout.topMargin: 20
|
||||
imagePath: model.cachedImage || model.originalImage || ""
|
||||
borderColor: Color.transparent
|
||||
borderWidth: 0
|
||||
fallbackIcon: "bell"
|
||||
fallbackIconSize: 24 * scaling
|
||||
fallbackIconSize: 24
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
@@ -204,20 +204,20 @@ NPanel {
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
spacing: Style.marginXS * scaling
|
||||
Layout.rightMargin: -(Style.marginM + Style.baseWidgetSize * 0.6) * scaling
|
||||
spacing: Style.marginXS
|
||||
Layout.rightMargin: -(Style.marginM + Style.baseWidgetSize * 0.6)
|
||||
|
||||
// Header row with app name and timestamp
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginS * scaling
|
||||
spacing: Style.marginS
|
||||
|
||||
// Urgency indicator
|
||||
Rectangle {
|
||||
Layout.preferredWidth: 6 * scaling
|
||||
Layout.preferredHeight: 6 * scaling
|
||||
Layout.preferredWidth: 6
|
||||
Layout.preferredHeight: 6
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
radius: 3 * scaling
|
||||
radius: 3
|
||||
visible: model.urgency !== 1
|
||||
color: {
|
||||
if (model.urgency === 2)
|
||||
@@ -231,13 +231,13 @@ NPanel {
|
||||
|
||||
NText {
|
||||
text: model.appName || "Unknown App"
|
||||
pointSize: Style.fontSizeXS * scaling
|
||||
pointSize: Style.fontSizeXS
|
||||
color: Color.mSecondary
|
||||
}
|
||||
|
||||
NText {
|
||||
text: Time.formatRelativeTime(model.timestamp)
|
||||
pointSize: Style.fontSizeXS * scaling
|
||||
pointSize: Style.fontSizeXS
|
||||
color: Color.mSecondary
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ NPanel {
|
||||
NText {
|
||||
id: summaryText
|
||||
text: model.summary || I18n.tr("general.no-summary")
|
||||
pointSize: Style.fontSizeM * scaling
|
||||
pointSize: Style.fontSizeM
|
||||
font.weight: Font.Medium
|
||||
color: Color.mOnSurface
|
||||
textFormat: Text.PlainText
|
||||
@@ -264,7 +264,7 @@ NPanel {
|
||||
NText {
|
||||
id: bodyText
|
||||
text: model.body || ""
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
pointSize: Style.fontSizeS
|
||||
color: Color.mOnSurfaceVariant
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.Wrap
|
||||
@@ -277,14 +277,14 @@ NPanel {
|
||||
// Spacer for expand indicator
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: (!isExpanded && (summaryText.truncated || bodyText.truncated)) ? (Style.marginS * scaling) : 0
|
||||
Layout.preferredHeight: (!isExpanded && (summaryText.truncated || bodyText.truncated)) ? (Style.marginS) : 0
|
||||
}
|
||||
|
||||
// Expand indicator
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: !isExpanded && (summaryText.truncated || bodyText.truncated)
|
||||
spacing: Style.marginXS * scaling
|
||||
spacing: Style.marginXS
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
@@ -292,14 +292,14 @@ NPanel {
|
||||
|
||||
NText {
|
||||
text: I18n.tr("notifications.panel.click-to-expand") || "Click to expand"
|
||||
pointSize: Style.fontSizeXS * scaling
|
||||
pointSize: Style.fontSizeXS
|
||||
color: Color.mPrimary
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
NIcon {
|
||||
icon: "chevron-down"
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
pointSize: Style.fontSizeS
|
||||
color: Color.mPrimary
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user