NText: Reverted my change to support Richtext by default + All tooltips are no longer using capital letter at the start of every word

This commit is contained in:
LemmyCook 2025-08-31 08:41:51 -04:00
parent 4ad851fdd2
commit 53405c13af
19 changed files with 66 additions and 68 deletions

View file

@ -48,10 +48,10 @@ NIconButton {
let tooltip = header
if (pacmanTooltip !== "") {
tooltip += "<br/>" + pacmanTooltip
tooltip += "\n" + pacmanTooltip
}
if (aurTooltip !== "") {
tooltip += "<br/>" + aurTooltip
tooltip += "\n" + aurTooltip
}
return tooltip
}

View file

@ -103,7 +103,7 @@ Item {
let lines = []
if (testMode) {
lines.push("Time left: " + Time.formatVagueHumanReadableDuration(12345))
return lines.join("<br/>")
return lines.join("\n")
}
if (!isReady || !battery.isLaptopBattery) {
return "No battery detected"
@ -130,7 +130,7 @@ Item {
if (battery.healthPercentage !== undefined && battery.healthPercentage > 0) {
lines.push("Health: " + Math.round(battery.healthPercentage) + "%")
}
return lines.join("<br/>")
return lines.join("\n")
}
}
}

View file

@ -21,6 +21,6 @@ NIconButton {
colorBorderHover: Color.transparent
icon: "bluetooth"
tooltipText: "Bluetooth Devices"
tooltipText: "Bluetooth devices"
onClicked: PanelService.getPanel("bluetoothPanel")?.toggle(screen, this)
}

View file

@ -70,8 +70,8 @@ Item {
var monitor = getMonitor()
if (!monitor)
return ""
return "Brightness: " + Math.round(monitor.brightness * 100) + "%<br/>Method: " + monitor.method
+ "<br/>Left click for advanced settings.<br/>Scroll up/down to change brightness."
return "Brightness: " + Math.round(monitor.brightness * 100) + "%\nMethod: " + monitor.method
+ "\nLeft click for advanced settings.\nScroll up/down to change brightness."
}
onWheel: function (angle) {

View file

@ -25,7 +25,7 @@ Row {
collapsedIconColor: Color.mOnSurface
autoHide: false // Important to be false so we can hover as long as we want
text: currentLayout
tooltipText: "Keyboard Layout: " + currentLayout
tooltipText: "Keyboard layout: " + currentLayout
onClicked: {

View file

@ -26,9 +26,8 @@ Row {
NText {
id: fullTitleMetrics
visible: false
text: getTitle()
font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium
text: titleText.text
font: titleText.font
}
Rectangle {
@ -50,37 +49,6 @@ Row {
width: 200 * scaling
}
// Mouse area for hover detection - direct child of Rectangle
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: mouse => {
if (mouse.button === Qt.LeftButton) {
MediaService.playPause()
} else if (mouse.button == Qt.RightButton) {
MediaService.next()
// Need to hide the tooltip instantly
tooltip.visible = false
} else if (mouse.button == Qt.MiddleButton) {
MediaService.previous()
// Need to hide the tooltip instantly
tooltip.visible = false
}
}
onEntered: {
if (tooltip.text !== "") {
tooltip.show()
}
}
onExited: {
tooltip.hide()
}
}
Item {
id: mainContainer
anchors.fill: parent
@ -172,18 +140,18 @@ Row {
NText {
id: titleText
// If hovered, show up to 400 pixels, otherwise show up to 120 pixels
width: (mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth + (Style.marginS * scaling),
400 * scaling) : Math.min(
fullTitleMetrics.contentWidth + (Style.marginS * scaling), 120 * scaling)
// If hovered or just switched window, show up to 400 pixels
// If not hovered show up to 120 pixels
width: (mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth,
400 * scaling) : Math.min(fullTitleMetrics.contentWidth,
120 * scaling)
text: getTitle()
font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium
elide: mouseArea.containsMouse ? Text.ElideNone : Text.ElideRight
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
color: Color.mTertiary
clip: true
Behavior on width {
NumberAnimation {
@ -193,6 +161,37 @@ Row {
}
}
}
// Mouse area for hover detection
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: mouse => {
if (mouse.button === Qt.LeftButton) {
MediaService.playPause()
} else if (mouse.button == Qt.RightButton) {
MediaService.next()
// Need to hide the tooltip instantly
tooltip.visible = false
} else if (mouse.button == Qt.MiddleButton) {
MediaService.previous()
// Need to hide the tooltip instantly
tooltip.visible = false
}
}
onEntered: {
if (tooltip.text !== "") {
tooltip.show()
}
}
onExited: {
tooltip.hide()
}
}
}
}
@ -201,14 +200,14 @@ Row {
text: {
var str = ""
if (MediaService.canGoNext) {
str += "Right click for next<br/>"
str += "Right click for next\n"
}
if (MediaService.canGoPrevious) {
str += "Middle click for previous<br/>"
str += "Middle click for previous\n"
}
return str
}
target: anchor
positionAbove: Settings.data.bar.position === "bottom"
}
}
}

View file

@ -21,7 +21,7 @@ NIconButton {
colorBorderHover: Color.transparent
icon: Settings.data.nightLight.enabled ? "bedtime" : "bedtime_off"
tooltipText: `Night Light: ${Settings.data.nightLight.enabled ? "enabled" : "disabled"}<br/>Left click to toggle.<br/>Right click to access settings.`
tooltipText: `Night light: ${Settings.data.nightLight.enabled ? "enabled" : "disabled"}\nLeft click to toggle.\nRight click to access settings.`
onClicked: Settings.data.nightLight.enabled = !Settings.data.nightLight.enabled
onRightClicked: {

View file

@ -12,7 +12,7 @@ NIconButton {
visible: ScreenRecorderService.isRecording
icon: "videocam"
tooltipText: "Screen Recording Active\nClick To Stop Recording"
tooltipText: "Screen recording is active\nClick to stop recording"
sizeRatio: 0.8
colorBg: Color.mPrimary
colorFg: Color.mOnPrimary

View file

@ -10,7 +10,7 @@ NIconButton {
property real scaling: ScalingService.scale(screen)
icon: "widgets"
tooltipText: "Open Side Panel"
tooltipText: "Open side panel"
sizeRatio: 0.8
colorBg: Color.mSurfaceVariant

View file

@ -59,7 +59,7 @@ Item {
autoHide: false // Important to be false so we can hover as long as we want
text: Math.floor(AudioService.volume * 100) + "%"
tooltipText: "Volume: " + Math.round(
AudioService.volume * 100) + "%<br/>Left click for advanced settings.<br/>Scroll up/down to change volume."
AudioService.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume."
onWheel: function (delta) {
wheelAccumulator += delta

View file

@ -50,6 +50,6 @@ NIconButton {
return "signal_wifi_bad"
}
}
tooltipText: "Network / WiFi"
tooltipText: "Network / Wi-Fi"
onClicked: PanelService.getPanel("wifiPanel")?.toggle(screen, this)
}