Revert 8c81514
This commit is contained in:
parent
8c815146e6
commit
2a1e7832d6
6 changed files with 48 additions and 53 deletions
|
|
@ -92,7 +92,7 @@ Variants {
|
||||||
|
|
||||||
// Top section (left widgets)
|
// Top section (left widgets)
|
||||||
Column {
|
Column {
|
||||||
spacing: Style.marginXXS * root.scaling
|
spacing: Style.marginS * root.scaling
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: Style.marginM * root.scaling
|
anchors.topMargin: Style.marginM * root.scaling
|
||||||
|
|
@ -118,7 +118,7 @@ Variants {
|
||||||
|
|
||||||
// Center section (center widgets)
|
// Center section (center widgets)
|
||||||
Column {
|
Column {
|
||||||
spacing: Style.marginXXS * root.scaling
|
spacing: Style.marginS * root.scaling
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
@ -143,7 +143,7 @@ Variants {
|
||||||
|
|
||||||
// Bottom section (right widgets)
|
// Bottom section (right widgets)
|
||||||
Column {
|
Column {
|
||||||
spacing: Style.marginXS * root.scaling
|
spacing: Style.marginS * root.scaling
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: Style.marginM * root.scaling
|
anchors.bottomMargin: Style.marginM * root.scaling
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ Item {
|
||||||
readonly property real minWidth: Math.max(1, screen.width * 0.06)
|
readonly property real minWidth: Math.max(1, screen.width * 0.06)
|
||||||
readonly property real maxWidth: minWidth * 2
|
readonly property real maxWidth: minWidth * 2
|
||||||
|
|
||||||
implicitHeight: Math.round(Style.capsuleHeight * scaling)
|
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling)
|
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||||
|
|
||||||
function getTitle() {
|
function getTitle() {
|
||||||
|
|
@ -66,6 +66,21 @@ Item {
|
||||||
|
|
||||||
visible: getTitle() !== ""
|
visible: getTitle() !== ""
|
||||||
|
|
||||||
|
function calculatedVerticalHeight() {
|
||||||
|
// Base height for the background rectangle
|
||||||
|
let total = Math.round(Style.capsuleHeight * scaling)
|
||||||
|
|
||||||
|
// Add padding for the container margins
|
||||||
|
total += Style.marginM * scaling * 2 // Top and bottom margins
|
||||||
|
|
||||||
|
// Add space for icon if shown
|
||||||
|
if (showIcon) {
|
||||||
|
total += Style.fontSizeL * scaling * 1.2 + Style.marginS * scaling
|
||||||
|
}
|
||||||
|
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
function calculatedHorizontalWidth() {
|
function calculatedHorizontalWidth() {
|
||||||
let total = Style.marginM * 2 * scaling // internal padding
|
let total = Style.marginM * 2 * scaling // internal padding
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,17 +39,6 @@ Rectangle {
|
||||||
|
|
||||||
implicitWidth: useCompactMode ? Math.round(Style.capsuleHeight * scaling) : Math.round(layout.implicitWidth + Style.marginM * 2 * scaling)
|
implicitWidth: useCompactMode ? Math.round(Style.capsuleHeight * scaling) : Math.round(layout.implicitWidth + Style.marginM * 2 * scaling)
|
||||||
implicitHeight: useCompactMode ? Math.round(Style.capsuleHeight * 2.5 * scaling) : Math.round(Style.capsuleHeight * scaling)
|
implicitHeight: useCompactMode ? Math.round(Style.capsuleHeight * 2.5 * scaling) : Math.round(Style.capsuleHeight * scaling)
|
||||||
|
|
||||||
// React to bar position changes
|
|
||||||
Connections {
|
|
||||||
target: BarService
|
|
||||||
function onBarPositionChanged(newPosition) {
|
|
||||||
root.barPosition = newPosition
|
|
||||||
// Force re-evaluation of implicitWidth and implicitHeight
|
|
||||||
root.implicitWidth = Qt.binding(() => useCompactMode ? Math.round(Style.capsuleHeight * scaling) : Math.round(layout.implicitWidth + Style.marginM * 2 * scaling))
|
|
||||||
root.implicitHeight = Qt.binding(() => useCompactMode ? Math.round(Style.capsuleHeight * 2.5 * scaling) : Math.round(Style.capsuleHeight * scaling))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
radius: Math.round(Style.radiusS * scaling)
|
radius: Math.round(Style.radiusS * scaling)
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
|
|
||||||
|
|
@ -75,8 +64,7 @@ Rectangle {
|
||||||
if (useCompactMode) {
|
if (useCompactMode) {
|
||||||
// Compact mode: time section (first 2 lines)
|
// Compact mode: time section (first 2 lines)
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0: // Hours
|
||||||
// Hours
|
|
||||||
if (use12h) {
|
if (use12h) {
|
||||||
const hours = now.getHours()
|
const hours = now.getHours()
|
||||||
const displayHours = hours === 0 ? 12 : (hours > 12 ? hours - 12 : hours)
|
const displayHours = hours === 0 ? 12 : (hours > 12 ? hours - 12 : hours)
|
||||||
|
|
@ -84,8 +72,7 @@ Rectangle {
|
||||||
} else {
|
} else {
|
||||||
return now.getHours().toString().padStart(2, '0')
|
return now.getHours().toString().padStart(2, '0')
|
||||||
}
|
}
|
||||||
case 1:
|
case 1: // Minutes
|
||||||
// Minutes
|
|
||||||
return now.getMinutes().toString().padStart(2, '0')
|
return now.getMinutes().toString().padStart(2, '0')
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
|
|
@ -165,11 +152,9 @@ Rectangle {
|
||||||
if (useCompactMode) {
|
if (useCompactMode) {
|
||||||
// Compact mode: date section (last 2 lines)
|
// Compact mode: date section (last 2 lines)
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0: // Day
|
||||||
// Day
|
|
||||||
return now.getDate().toString().padStart(2, '0')
|
return now.getDate().toString().padStart(2, '0')
|
||||||
case 1:
|
case 1: // Month
|
||||||
// Month
|
|
||||||
return (now.getMonth() + 1).toString().padStart(2, '0')
|
return (now.getMonth() + 1).toString().padStart(2, '0')
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,10 @@ Item {
|
||||||
return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "")
|
return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function calculatedVerticalHeight() {
|
||||||
|
return Math.round(Style.baseWidgetSize * 0.8 * scaling)
|
||||||
|
}
|
||||||
|
|
||||||
function calculatedHorizontalWidth() {
|
function calculatedHorizontalWidth() {
|
||||||
let total = Style.marginM * 2 * scaling // internal padding
|
let total = Style.marginM * 2 * scaling // internal padding
|
||||||
if (showAlbumArt) {
|
if (showAlbumArt) {
|
||||||
|
|
@ -70,7 +74,7 @@ Item {
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitHeight: Math.round(Style.capsuleHeight * scaling)
|
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (rowLayout.implicitWidth + Style.marginM * 2 * scaling)
|
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (rowLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||||
|
|
||||||
visible: MediaService.currentPlayer !== null && MediaService.canPlay
|
visible: MediaService.currentPlayer !== null && MediaService.canPlay
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ Item {
|
||||||
readonly property bool showNetworkStats: (widgetSettings.showNetworkStats !== undefined) ? widgetSettings.showNetworkStats : widgetMetadata.showNetworkStats
|
readonly property bool showNetworkStats: (widgetSettings.showNetworkStats !== undefined) ? widgetSettings.showNetworkStats : widgetMetadata.showNetworkStats
|
||||||
readonly property bool showDiskUsage: (widgetSettings.showDiskUsage !== undefined) ? widgetSettings.showDiskUsage : widgetMetadata.showDiskUsage
|
readonly property bool showDiskUsage: (widgetSettings.showDiskUsage !== undefined) ? widgetSettings.showDiskUsage : widgetMetadata.showDiskUsage
|
||||||
|
|
||||||
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.capsuleHeight * scaling)
|
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling)
|
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling)
|
||||||
|
|
||||||
function calculatedVerticalHeight() {
|
function calculatedVerticalHeight() {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ import qs.Commons
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Bar position property - initialize safely
|
// Bar position property
|
||||||
property string position: "top"
|
property string position: Settings.data.bar.position
|
||||||
|
|
||||||
// Signal emitted when bar position changes
|
// Signal emitted when bar position changes
|
||||||
signal barPositionChanged(string newPosition)
|
signal barPositionChanged(string newPosition)
|
||||||
|
|
@ -17,7 +17,7 @@ Singleton {
|
||||||
Connections {
|
Connections {
|
||||||
target: Settings
|
target: Settings
|
||||||
function onDataChanged() {
|
function onDataChanged() {
|
||||||
if (Settings.data && Settings.data.bar && Settings.data.bar.position !== root.position) {
|
if (Settings.data.bar.position !== root.position) {
|
||||||
root.position = Settings.data.bar.position
|
root.position = Settings.data.bar.position
|
||||||
root.barPositionChanged(root.position)
|
root.barPositionChanged(root.position)
|
||||||
}
|
}
|
||||||
|
|
@ -31,15 +31,6 @@ Singleton {
|
||||||
|
|
||||||
// Function to change bar position
|
// Function to change bar position
|
||||||
function setPosition(newPosition) {
|
function setPosition(newPosition) {
|
||||||
if (Settings.data && Settings.data.bar) {
|
|
||||||
Settings.data.bar.position = newPosition
|
Settings.data.bar.position = newPosition
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize position after component is completed
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (Settings.data && Settings.data.bar) {
|
|
||||||
position = Settings.data.bar.position
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue