Revert "Possibly fixed #117, format and also change a tiny thing in ActiveWindow"
This reverts commit 1e52e7ca40.
This commit is contained in:
parent
1e52e7ca40
commit
6d2f4d51a2
2 changed files with 45 additions and 49 deletions
|
|
@ -41,15 +41,14 @@ Row {
|
||||||
NText {
|
NText {
|
||||||
id: fullTitleMetrics
|
id: fullTitleMetrics
|
||||||
visible: false
|
visible: false
|
||||||
text: getTitle()
|
text: titleText.text
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font: titleText.font
|
||||||
font.weight: Style.fontWeightMedium
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
// Let the Rectangle size itself based on its content (the Row)
|
// Let the Rectangle size itself based on its content (the Row)
|
||||||
visible: root.visible
|
visible: root.visible
|
||||||
width: row.width + Style.marginS * scaling
|
width: row.width + Style.marginM * scaling * 2
|
||||||
height: Math.round(Style.capsuleHeight * scaling)
|
height: Math.round(Style.capsuleHeight * scaling)
|
||||||
radius: Math.round(Style.radiusM * scaling)
|
radius: Math.round(Style.radiusM * scaling)
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
|
|
@ -61,7 +60,6 @@ Row {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: Style.marginS * scaling
|
anchors.leftMargin: Style.marginS * scaling
|
||||||
anchors.rightMargin: Style.marginS * scaling
|
anchors.rightMargin: Style.marginS * scaling
|
||||||
clip: true
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: row
|
id: row
|
||||||
|
|
@ -88,10 +86,9 @@ Row {
|
||||||
NText {
|
NText {
|
||||||
id: titleText
|
id: titleText
|
||||||
|
|
||||||
// For short titles, show full. For long titles, truncate and expand on hover
|
// Collapsed width when not hovered, expand on hover
|
||||||
width: mouseArea.containsMouse ? Math.min(fullTitleMetrics.contentWidth + 8,
|
width: mouseArea.containsMouse ? Math.min(fullTitleMetrics.contentWidth + (Style.marginS * scaling),
|
||||||
400 * scaling) : Math.min(fullTitleMetrics.contentWidth + 12,
|
400 * scaling) : (minWidth * scaling)
|
||||||
200 * scaling)
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
text: getTitle()
|
text: getTitle()
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,8 @@ Row {
|
||||||
NText {
|
NText {
|
||||||
id: fullTitleMetrics
|
id: fullTitleMetrics
|
||||||
visible: false
|
visible: false
|
||||||
text: getTitle()
|
text: titleText.text
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font: titleText.font
|
||||||
font.weight: Style.fontWeightMedium
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
@ -50,37 +49,6 @@ Row {
|
||||||
width: 200 * scaling
|
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 {
|
Item {
|
||||||
id: mainContainer
|
id: mainContainer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -172,18 +140,18 @@ Row {
|
||||||
NText {
|
NText {
|
||||||
id: titleText
|
id: titleText
|
||||||
|
|
||||||
// If hovered, show up to 400 pixels, otherwise show up to 120 pixels
|
// If hovered or just switched window, show up to 400 pixels
|
||||||
width: (mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth + (Style.marginS * scaling),
|
// If not hovered show up to 120 pixels
|
||||||
400 * scaling) : Math.min(
|
width: (mouseArea.containsMouse) ? Math.min(fullTitleMetrics.contentWidth,
|
||||||
fullTitleMetrics.contentWidth + (Style.marginS * scaling), 120 * scaling)
|
400 * scaling) : Math.min(fullTitleMetrics.contentWidth,
|
||||||
|
120 * scaling)
|
||||||
text: getTitle()
|
text: getTitle()
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
font.weight: Style.fontWeightMedium
|
font.weight: Style.fontWeightMedium
|
||||||
elide: mouseArea.containsMouse ? Text.ElideNone : Text.ElideRight
|
elide: Text.ElideRight
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: Color.mTertiary
|
color: Color.mTertiary
|
||||||
clip: true
|
|
||||||
|
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation {
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue