From 53405c13afb55d52e4405139c27dea83a18fa6e9 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Sun, 31 Aug 2025 08:41:51 -0400 Subject: [PATCH] NText: Reverted my change to support Richtext by default + All tooltips are no longer using capital letter at the start of every word --- Modules/Bar/Widgets/ArchUpdater.qml | 4 +- Modules/Bar/Widgets/Battery.qml | 4 +- Modules/Bar/Widgets/Bluetooth.qml | 2 +- Modules/Bar/Widgets/Brightness.qml | 4 +- Modules/Bar/Widgets/KeyboardLayout.qml | 2 +- Modules/Bar/Widgets/MediaMini.qml | 85 +++++++++---------- Modules/Bar/Widgets/NightLight.qml | 2 +- .../Bar/Widgets/ScreenRecorderIndicator.qml | 2 +- Modules/Bar/Widgets/SidePanelToggle.qml | 2 +- Modules/Bar/Widgets/Volume.qml | 2 +- Modules/Bar/Widgets/WiFi.qml | 2 +- Modules/Calendar/Calendar.qml | 4 +- .../Notification/NotificationHistoryPanel.qml | 4 +- Modules/SettingsPanel/Tabs/DisplayTab.qml | 2 +- Modules/SidePanel/Cards/MediaCard.qml | 2 +- Modules/SidePanel/Cards/ProfileCard.qml | 6 +- Modules/SidePanel/Cards/UtilitiesCard.qml | 2 +- Modules/WiFiPanel/WiFiPanel.qml | 2 +- Widgets/NText.qml | 1 - 19 files changed, 66 insertions(+), 68 deletions(-) diff --git a/Modules/Bar/Widgets/ArchUpdater.qml b/Modules/Bar/Widgets/ArchUpdater.qml index b86eb50..e405ecf 100644 --- a/Modules/Bar/Widgets/ArchUpdater.qml +++ b/Modules/Bar/Widgets/ArchUpdater.qml @@ -48,10 +48,10 @@ NIconButton { let tooltip = header if (pacmanTooltip !== "") { - tooltip += "
" + pacmanTooltip + tooltip += "\n" + pacmanTooltip } if (aurTooltip !== "") { - tooltip += "
" + aurTooltip + tooltip += "\n" + aurTooltip } return tooltip } diff --git a/Modules/Bar/Widgets/Battery.qml b/Modules/Bar/Widgets/Battery.qml index e76a0a3..f149b9b 100644 --- a/Modules/Bar/Widgets/Battery.qml +++ b/Modules/Bar/Widgets/Battery.qml @@ -103,7 +103,7 @@ Item { let lines = [] if (testMode) { lines.push("Time left: " + Time.formatVagueHumanReadableDuration(12345)) - return lines.join("
") + 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("
") + return lines.join("\n") } } } diff --git a/Modules/Bar/Widgets/Bluetooth.qml b/Modules/Bar/Widgets/Bluetooth.qml index 0b8b4f9..7cb4186 100644 --- a/Modules/Bar/Widgets/Bluetooth.qml +++ b/Modules/Bar/Widgets/Bluetooth.qml @@ -21,6 +21,6 @@ NIconButton { colorBorderHover: Color.transparent icon: "bluetooth" - tooltipText: "Bluetooth Devices" + tooltipText: "Bluetooth devices" onClicked: PanelService.getPanel("bluetoothPanel")?.toggle(screen, this) } diff --git a/Modules/Bar/Widgets/Brightness.qml b/Modules/Bar/Widgets/Brightness.qml index 63a8c20..bc09dca 100644 --- a/Modules/Bar/Widgets/Brightness.qml +++ b/Modules/Bar/Widgets/Brightness.qml @@ -70,8 +70,8 @@ Item { var monitor = getMonitor() if (!monitor) return "" - return "Brightness: " + Math.round(monitor.brightness * 100) + "%
Method: " + monitor.method - + "
Left click for advanced settings.
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) { diff --git a/Modules/Bar/Widgets/KeyboardLayout.qml b/Modules/Bar/Widgets/KeyboardLayout.qml index 0ee56e5..d655055 100644 --- a/Modules/Bar/Widgets/KeyboardLayout.qml +++ b/Modules/Bar/Widgets/KeyboardLayout.qml @@ -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: { diff --git a/Modules/Bar/Widgets/MediaMini.qml b/Modules/Bar/Widgets/MediaMini.qml index dbfe5cf..5607fe2 100644 --- a/Modules/Bar/Widgets/MediaMini.qml +++ b/Modules/Bar/Widgets/MediaMini.qml @@ -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
" + str += "Right click for next\n" } if (MediaService.canGoPrevious) { - str += "Middle click for previous
" + str += "Middle click for previous\n" } return str } target: anchor positionAbove: Settings.data.bar.position === "bottom" } -} +} \ No newline at end of file diff --git a/Modules/Bar/Widgets/NightLight.qml b/Modules/Bar/Widgets/NightLight.qml index 43e330e..f6eda83 100644 --- a/Modules/Bar/Widgets/NightLight.qml +++ b/Modules/Bar/Widgets/NightLight.qml @@ -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"}
Left click to toggle.
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: { diff --git a/Modules/Bar/Widgets/ScreenRecorderIndicator.qml b/Modules/Bar/Widgets/ScreenRecorderIndicator.qml index 38ed2c7..ce68391 100644 --- a/Modules/Bar/Widgets/ScreenRecorderIndicator.qml +++ b/Modules/Bar/Widgets/ScreenRecorderIndicator.qml @@ -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 diff --git a/Modules/Bar/Widgets/SidePanelToggle.qml b/Modules/Bar/Widgets/SidePanelToggle.qml index 0a6e6b3..7020209 100644 --- a/Modules/Bar/Widgets/SidePanelToggle.qml +++ b/Modules/Bar/Widgets/SidePanelToggle.qml @@ -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 diff --git a/Modules/Bar/Widgets/Volume.qml b/Modules/Bar/Widgets/Volume.qml index 24a8492..8819cc9 100644 --- a/Modules/Bar/Widgets/Volume.qml +++ b/Modules/Bar/Widgets/Volume.qml @@ -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) + "%
Left click for advanced settings.
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 diff --git a/Modules/Bar/Widgets/WiFi.qml b/Modules/Bar/Widgets/WiFi.qml index f4ec9dd..2362a82 100644 --- a/Modules/Bar/Widgets/WiFi.qml +++ b/Modules/Bar/Widgets/WiFi.qml @@ -50,6 +50,6 @@ NIconButton { return "signal_wifi_bad" } } - tooltipText: "Network / WiFi" + tooltipText: "Network / Wi-Fi" onClicked: PanelService.getPanel("wifiPanel")?.toggle(screen, this) } diff --git a/Modules/Calendar/Calendar.qml b/Modules/Calendar/Calendar.qml index ea5b260..891a866 100644 --- a/Modules/Calendar/Calendar.qml +++ b/Modules/Calendar/Calendar.qml @@ -29,7 +29,7 @@ NPanel { NIconButton { icon: "chevron_left" - tooltipText: "Previous Month" + tooltipText: "Previous month" onClicked: { let newDate = new Date(grid.year, grid.month - 1, 1) grid.year = newDate.getFullYear() @@ -48,7 +48,7 @@ NPanel { NIconButton { icon: "chevron_right" - tooltipText: "Next Month" + tooltipText: "Next month" onClicked: { let newDate = new Date(grid.year, grid.month + 1, 1) grid.year = newDate.getFullYear() diff --git a/Modules/Notification/NotificationHistoryPanel.qml b/Modules/Notification/NotificationHistoryPanel.qml index 8001d39..3b10aec 100644 --- a/Modules/Notification/NotificationHistoryPanel.qml +++ b/Modules/Notification/NotificationHistoryPanel.qml @@ -45,7 +45,7 @@ NPanel { NIconButton { icon: "delete" - tooltipText: "Clear History" + tooltipText: "Clear history" sizeRatio: 0.8 onClicked: NotificationService.clearHistory() } @@ -158,7 +158,7 @@ NPanel { // Trash icon button NIconButton { icon: "delete" - tooltipText: "Delete Notification" + tooltipText: "Delete notification" sizeRatio: 0.7 onClicked: { diff --git a/Modules/SettingsPanel/Tabs/DisplayTab.qml b/Modules/SettingsPanel/Tabs/DisplayTab.qml index 67905aa..b2bda25 100644 --- a/Modules/SettingsPanel/Tabs/DisplayTab.qml +++ b/Modules/SettingsPanel/Tabs/DisplayTab.qml @@ -212,7 +212,7 @@ ColumnLayout { NIconButton { icon: "refresh" - tooltipText: "Reset Scaling" + tooltipText: "Reset scaling" onClicked: ScalingService.setMonitorScale(modelData.name, 1.0) } } diff --git a/Modules/SidePanel/Cards/MediaCard.qml b/Modules/SidePanel/Cards/MediaCard.qml index eaac9a5..65f7211 100644 --- a/Modules/SidePanel/Cards/MediaCard.qml +++ b/Modules/SidePanel/Cards/MediaCard.qml @@ -324,7 +324,7 @@ NBox { // Next button NIconButton { icon: "skip_next" - tooltipText: "Next Media" + tooltipText: "Next media" visible: MediaService.canGoNext onClicked: MediaService.canGoNext ? MediaService.next() : {} } diff --git a/Modules/SidePanel/Cards/ProfileCard.qml b/Modules/SidePanel/Cards/ProfileCard.qml index 7374159..d58abe8 100644 --- a/Modules/SidePanel/Cards/ProfileCard.qml +++ b/Modules/SidePanel/Cards/ProfileCard.qml @@ -58,7 +58,7 @@ NBox { } NIconButton { icon: "settings" - tooltipText: "Open Settings" + tooltipText: "Open settings" onClicked: { settingsPanel.requestedTab = SettingsPanel.Tab.General settingsPanel.open(screen) @@ -68,7 +68,7 @@ NBox { NIconButton { id: powerButton icon: "power_settings_new" - tooltipText: "Power Menu" + tooltipText: "Power menu" onClicked: { powerPanel.open(screen) sidePanel.close() @@ -78,7 +78,7 @@ NBox { NIconButton { id: closeButton icon: "close" - tooltipText: "Close Side Panel" + tooltipText: "Close side panel" onClicked: { sidePanel.close() } diff --git a/Modules/SidePanel/Cards/UtilitiesCard.qml b/Modules/SidePanel/Cards/UtilitiesCard.qml index 26f3b4e..5770df2 100644 --- a/Modules/SidePanel/Cards/UtilitiesCard.qml +++ b/Modules/SidePanel/Cards/UtilitiesCard.qml @@ -48,7 +48,7 @@ NBox { // Wallpaper NIconButton { icon: "image" - tooltipText: "Open Wallpaper Selector" + tooltipText: "Open wallpaper selector" onClicked: { var settingsPanel = PanelService.getPanel("settingsPanel") settingsPanel.requestedTab = SettingsPanel.Tab.WallpaperSelector diff --git a/Modules/WiFiPanel/WiFiPanel.qml b/Modules/WiFiPanel/WiFiPanel.qml index 3780b6f..4349cc4 100644 --- a/Modules/WiFiPanel/WiFiPanel.qml +++ b/Modules/WiFiPanel/WiFiPanel.qml @@ -51,7 +51,7 @@ NPanel { NIconButton { icon: "refresh" - tooltipText: "Refresh Networks" + tooltipText: "Refresh networks" sizeRatio: 0.8 enabled: Settings.data.network.wifiEnabled && !NetworkService.isLoading onClicked: { diff --git a/Widgets/NText.qml b/Widgets/NText.qml index 1d54c89..00f5561 100644 --- a/Widgets/NText.qml +++ b/Widgets/NText.qml @@ -13,5 +13,4 @@ Text { font.kerning: true color: Color.mOnSurface renderType: Text.QtRendering - textFormat: Text.RichText }