From 8bc07e20ca0ef8ff6c67ada0aceb5a111d0ff89b Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 24 Sep 2024 15:23:33 -0500 Subject: [PATCH] Making title and subtitle obey missing information colors --- src/qml/presenter/LibraryItem.qml | 70 ++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/qml/presenter/LibraryItem.qml b/src/qml/presenter/LibraryItem.qml index 1169054..0ad7ffa 100644 --- a/src/qml/presenter/LibraryItem.qml +++ b/src/qml/presenter/LibraryItem.qml @@ -250,13 +250,42 @@ ColumnLayout { implicitWidth: libraryList.width height: selectedLibrary == libraryType ? 50 : 0 - text: title - Controls.Label { - anchors.top: parent.verticalCenter - anchors.topMargin: Kirigami.Units.gridUnit / 2 + id: itemTitle + anchors.top: parent.top + anchors.topMargin: Kirigami.Units.smallSpacing anchors.left: parent.left anchors.leftMargin: Kirigami.Units.gridUnit * 1.7 + width: parent.width - Kirigami.Units.gridUnit * 3.5 + + text: title + elide: Text.ElideRight + + color: { + if (selectedLibrary == "song") + Kirigami.Theme.textColor; + else if (fileValidation) { + Kirigami.Theme.textColor; + } + else + "red" + } + + Binding on color { + when: dragHandler.containsMouse || + (selectionModel.hasSelection && + selectionModel.isSelected(proxyModel.idx(index))) + value: Kirigami.Theme.highlightedTextColor + } + } + + Controls.Label { + id: itemSubtitle + anchors.top: itemTitle.bottom + anchors.topMargin: Kirigami.Units.smallSpacing + anchors.left: parent.left + anchors.leftMargin: Kirigami.Units.gridUnit * 1.7 + width: parent.width - Kirigami.Units.gridUnit * 3.5 font.pointSize: 9 text: { if (libraryType == "song") @@ -267,28 +296,29 @@ ColumnLayout { "file is missing"; } elide: Text.ElideRight + + color: { + if (selectedLibrary == "song") + Kirigami.Theme.textColor; + else if (fileValidation) { + Kirigami.Theme.textColor; + } + else + "red" + } + + Binding on color { + when: dragHandler.containsMouse || + (selectionModel.hasSelection && + selectionModel.isSelected(proxyModel.idx(index))) + value: Kirigami.Theme.highlightedTextColor + } } icon.source: itemIcon icon.width: Kirigami.Units.gridUnit icon.height: Kirigami.Units.gridUnit /* supportsMouseEvents: false */ - /* textColor: { */ - /* if (selectedLibrary == "song") */ - /* Kirigami.Theme.textColor; */ - /* else if (fileValidation) { */ - /* Kirigami.Theme.textColor; */ - /* } */ - /* else */ - /* "red" */ - /* } */ - - /* Binding on textColor { */ - /* when: dragHandler.containsMouse || */ - /* (selectionModel.hasSelection && */ - /* selectionModel.isSelected(proxyModel.idx(index))) */ - /* value: Kirigami.Theme.highlightedTextColor */ - /* } */ Behavior on height { NumberAnimation {