diff --git a/src/qml/EditableMetaDataDelegate.qml b/src/qml/EditableMetaDataDelegate.qml index 9082ec27..f21cebe3 100644 --- a/src/qml/EditableMetaDataDelegate.qml +++ b/src/qml/EditableMetaDataDelegate.qml @@ -1,77 +1,79 @@ /* * Copyright 2016 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.10 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.2 import org.kde.elisa 1.0 RowLayout { id: delegateRow spacing: 0 TextMetrics { id: metaDataLabelMetric text: 'Metadata Name' } Label { id: metaDataLabels text: { if (model.name !== undefined) { return i18nc("Label for a piece of metadata, e.g. 'Album Artist:'", "%1:", model.name) } return "" } font.weight: Font.Bold horizontalAlignment: Text.AlignRight Layout.alignment: Qt.AlignCenter Layout.preferredWidth: 0.8 * elisaTheme.coverImageSize Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin / 2 : 0 Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin / 2 : 0 } Loader { id: textDisplayLoader active: model.type === EditableTrackMetadataModel.TextEntry || model.type === EditableTrackMetadataModel.UrlEntry || model.type === EditableTrackMetadataModel.IntegerEntry visible: model.type === EditableTrackMetadataModel.TextEntry || model.type === EditableTrackMetadataModel.UrlEntry || model.type === EditableTrackMetadataModel.IntegerEntry Layout.fillWidth: true Layout.alignment: Qt.AlignTop sourceComponent: TextField { text: model.display horizontalAlignment: Text.AlignLeft + selectByMouse: true + anchors.fill: parent onTextEdited: { if (model.display !== text) { model.display = text } } } } } diff --git a/src/qml/NavigationActionBar.qml b/src/qml/NavigationActionBar.qml index 1b3be24c..fc218de0 100644 --- a/src/qml/NavigationActionBar.qml +++ b/src/qml/NavigationActionBar.qml @@ -1,239 +1,241 @@ /* * Copyright 2016 Matthieu Gallien * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQml 2.2 import QtQuick 2.7 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.3 import org.kde.kirigami 2.8 as Kirigami ColumnLayout { id: navigationBar spacing: 0 property string mainTitle property string secondaryTitle property url image property bool allowArtistNavigation: false property bool showEnqueueButton: true property bool showCreateRadioButton property string labelText property bool showRating: true property alias filterText: filterTextInput.text property alias filterRating: ratingFilter.starRating property bool enableGoBack: true property bool expandedFilterView property bool enableSorting: true property bool sortOrder signal enqueue(); signal replaceAndPlay(); signal createRadio(); signal goBack(); signal showArtist(); signal sort(var order); HeaderFooterToolbar { type: filterRow.visible? "other" : "header" contentItems: [ FlatButtonWithToolTip { id: goPreviousButton objectName: 'goPreviousButton' visible: enableGoBack text: i18nc("navigate back in the views stack", "Back") icon.name: (Qt.application.layoutDirection == Qt.RightToLeft) ? "go-next" : "go-previous" onClicked: goBack() }, Item { id: spacer Layout.preferredWidth: elisaTheme.layoutHorizontalMargin visible: goPreviousButton.visible }, Image { id: mainIcon source: image Layout.preferredHeight: authorAndAlbumLayout.height Layout.preferredWidth: height sourceSize.height: height sourceSize.width: width fillMode: Image.PreserveAspectFit asynchronous: true Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft }, Item { Layout.preferredWidth: elisaTheme.layoutHorizontalMargin visible: mainIcon.visible }, ColumnLayout { Layout.fillWidth: true Layout.fillHeight: true id: authorAndAlbumLayout LabelWithToolTip { id: albumLabel Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.fillWidth: true text: mainTitle level: authorLabel.visible ? 4 : 1 font.weight: authorLabel.visible ? Font.Bold : Font.Normal elide: Text.ElideRight } LabelWithToolTip { id: authorLabel Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.fillWidth: true text: secondaryTitle elide: Text.ElideRight visible: secondaryTitle !== "" } }, FlatButtonWithToolTip { objectName: 'createRadioButton' visible: showCreateRadioButton text: i18nc("Create a new radio", "Create a radio") icon.name: "media-track-add-amarok" onClicked: createRadio() }, FlatButtonWithToolTip { objectName: 'enqueueButton' visible: !showCreateRadioButton text: i18nc("Add current list to playlist", "Enqueue") icon.name: "list-add" onClicked: enqueue() }, FlatButtonWithToolTip { objectName: 'replaceAndPlayButton' visible: !showCreateRadioButton text: i18n("Play now, replacing contents of Playlist") icon.name: "media-playback-start" onClicked: replaceAndPlay() }, FlatButtonWithToolTip { objectName: 'showArtistButton' visible: allowArtistNavigation && !showCreateRadioButton text: i18nc("Button to navigate to the artist of the album", "Display Artist") icon.name: "view-media-artist" onClicked: showArtist() }, FlatButtonWithToolTip { objectName: 'sortAscendingButton' visible: enableSorting && !showCreateRadioButton text: i18nc("Toggle between ascending and descending order", "Toggle sort order") icon.name: sortOrder ? "view-sort-ascending" : "view-sort-descending" onClicked: sortOrder ? sort(Qt.DescendingOrder) : sort(Qt.AscendingOrder) }, FlatButtonWithToolTip { objectName: 'showFilterButton' visible: !showCreateRadioButton text: !navigationBar.expandedFilterView ? i18nc("Show filters in the navigation bar", "Show Search Options") : i18nc("Hide filters in the navigation bar", "Hide Search Options") icon.name: 'search' checkable: true checked: expandedFilterView onClicked: persistentSettings.expandedFilterView = !persistentSettings.expandedFilterView } ] } HeaderFooterToolbar { type: "header" id: filterRow visible: opacity > 0.0 opacity: 0 contentItems: [ Kirigami.SearchField { id: filterTextInput objectName: 'filterTextInput' Layout.fillWidth: true focusSequence: "" + selectByMouse: true + Accessible.role: Accessible.EditableText placeholderText: i18n("Search for album name, artist, etc.") Keys.onEscapePressed: persistentSettings.expandedFilterView = false; }, Item { width: elisaTheme.layoutHorizontalMargin }, LabelWithToolTip { text: i18n("Filter by rating: ") visible: showRating }, RatingStar { id: ratingFilter objectName: 'ratingFilter' visible: showRating hoverWidgetOpacity: 1 readOnly: false } ] } states: [ State { name: 'collapsed' when: !expandedFilterView PropertyChanges { target: filterRow opacity: 0.0 } StateChangeScript { // Focus main content view since that's probably what the user // wants to interact with next script: contentDirectoryView.forceActiveFocus(); } }, State { name: 'expanded' when: expandedFilterView PropertyChanges { target: filterRow opacity: 1.0 } StateChangeScript { script: filterTextInput.forceActiveFocus() } } ] transitions: Transition { from: "expanded,collapsed" PropertyAnimation { properties: "opacity" easing.type: Easing.Linear duration: 250 } } }