Commit 40734301 authored by Devin Lin's avatar Devin Lin 🎨 Committed by Nate Graham
Browse files

Port to Kirigami.Dialog

parent a2ecfd86
......@@ -11,7 +11,7 @@ import QtQuick.Window 2.2
import QtQml.Models 2.1
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import org.kde.elisa 1.0
import "mobile"
......@@ -391,42 +391,38 @@ FocusScope {
id: contextMenuLoader
active: false
sourceComponent: MobileContextMenuSheet {
sourceComponent: Kirigami.MenuDialog {
id: contextMenu
title: gridEntry.mainText
preferredWidth: Kirigami.Units.gridUnit * 20
ColumnLayout {
Layout.preferredWidth: Kirigami.Units.gridUnit * 20
spacing: 0
MobileContextMenuEntry {
onClicked: {
actions: [
Kirigami.Action {
onTriggered: {
replaceAndPlay();
contextMenu.close();
}
icon: "media-playback-start"
iconName: "media-playback-start"
text: i18nc("Clear play list and add whole container to play list", "Play now, replacing current queue")
}
MobileContextMenuEntry {
},
Kirigami.Action {
visible: fileUrl.toString().substring(0, 7) === 'file://'
onClicked: {
onTriggered: {
ElisaApplication.showInFolder(gridEntry.fileUrl)
contextMenu.close();
}
icon: "document-open-folder"
iconName: "document-open-folder"
text: i18nc("Show the file for this song in the file manager", "Show in folder")
}
MobileContextMenuEntry {
onClicked: {
},
Kirigami.Action {
onTriggered: {
enqueue();
contextMenu.close();
}
icon: "list-add"
iconName: "list-add"
text: i18nc("Add whole container to play list", "Add to queue")
}
}
]
}
}
}
......@@ -11,7 +11,7 @@ import QtQuick.Layouts 1.2
import QtQuick.Controls 2.3
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import org.kde.elisa 1.0
import "mobile"
......@@ -374,36 +374,32 @@ FocusScope {
active: false
// context menu sheet
sourceComponent: MobileContextMenuSheet {
sourceComponent: Kirigami.MenuDialog {
id: contextMenu
title: mediaTrack.title
preferredWidth: Kirigami.Units.gridUnit * 20
ColumnLayout {
Layout.preferredWidth: Kirigami.Units.gridUnit * 20
spacing: 0
MobileContextMenuEntry {
actions: [
Kirigami.Action {
visible: trackUrl.toString().substring(0, 7) === 'file://'
onClicked: {
onTriggered: {
ElisaApplication.showInFolder(mediaTrack.trackUrl);
contextMenu.close();
}
icon: "document-open-folder"
iconName: "document-open-folder"
text: i18nc("Show the file for this song in the file manager", "Show in folder")
}
MobileContextMenuEntry {
onClicked: {
},
Kirigami.Action {
onTriggered: {
callOpenMetaDataView(trackUrl, dataType);
contextMenu.close();
}
icon: "documentinfo"
iconName: "documentinfo"
text: i18nc("Show track metadata", "View details")
}
MobileContextMenuEntry {
},
Kirigami.Action {
visible: ElisaApplication.useFavoriteStyleRatings
onClicked: {
onTriggered: {
var newRating = 0;
if (rating == 10) {
newRating = 0;
......@@ -412,31 +408,18 @@ FocusScope {
}
contextMenu.close();
}
icon: rating == 10 ? "rating-unrated" : "rating"
iconName: rating == 10 ? "rating-unrated" : "rating"
text: rating == 10 ? i18n("Mark this song as no longer being a favorite", "Un-mark as favorite") : i18n("Mark this song as a favorite", "Mark as favorite")
}
MobileContextMenuEntry {
onClicked: {
},
Kirigami.Action {
onTriggered: {
enqueue();
contextMenu.close();
}
icon: "list-add"
iconName: "list-add"
text: i18nc("Enqueue current track", "Add to queue")
}
RatingStar {
id: ratingWidgetMobile
visible: !ElisaApplication.useFavoriteStyleRatings
starRating: rating
Layout.alignment: Qt.AlignHCenter
Layout.leftMargin: Kirigami.Units.largeSpacing
Layout.rightMargin: Kirigami.Units.largeSpacing
}
}
]
}
}
......
......@@ -69,7 +69,7 @@ Kirigami.FormLayout {
model: metadataModel
delegate: RowLayout {
Kirigami.FormData.label: "<b>" + model.name + ":</b>"
Kirigami.FormData.label: model.name + ":"
MediaTrackMetadataDelegate {
index: model.index
......
/*
SPDX-FileCopyrightText: 2021 (c) Devin Lin <espidev@gmail.com>
SPDX-License-Identifier: LGPL-3.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.3
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.elisa 1.0
Kirigami.BasicListItem {
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
iconSize: Kirigami.Units.gridUnit
leftPadding: Kirigami.Units.smallSpacing
rightPadding: 0
}
/*
SPDX-FileCopyrightText: 2020 (c) Devin Lin <espidev@gmail.com>
SPDX-License-Identifier: LGPL-3.0-or-later
*/
import QtQuick 2.7
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.3
import org.kde.kirigami 2.13 as Kirigami
Kirigami.OverlaySheet {
id: contextMenu
property alias title: heading.text
leftPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing
header: Kirigami.Heading {
id: heading
level: 2
wrapMode: Text.Wrap
}
footer: RowLayout {
Button {
Layout.alignment: Qt.AlignRight
text: i18n("Close")
icon.name: "dialog-close"
onClicked: contextMenu.close()
}
}
}
......@@ -9,7 +9,7 @@ import QtQuick.Layouts 1.2
import QtQuick.Controls 2.3
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.13 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import org.kde.elisa 1.0
import ".."
......@@ -152,26 +152,27 @@ BasePlayListDelegate {
active: false
// context menu sheet
sourceComponent: MobileContextMenuSheet {
sourceComponent: Kirigami.MenuDialog {
id: contextMenu
title: playListEntry.title
ColumnLayout {
Layout.preferredWidth: Kirigami.Units.gridUnit * 20
spacing: 0
MobileContextMenuEntry {
preferredWidth: Kirigami.Units.gridUnit * 20
actions: [
Kirigami.Action {
visible: playListEntry.fileName.toString().substring(0, 7) === 'file://'
onClicked: {
iconName: "document-open-folder"
text: i18nc("Show the file for this song in the file manager", "Show in folder")
onTriggered: {
ElisaApplication.showInFolder(playListEntry.fileName)
contextMenu.close();
}
icon: "document-open-folder"
text: i18nc("Show the file for this song in the file manager", "Show in folder")
}
MobileContextMenuEntry {
},
Kirigami.Action {
visible: isValid
onClicked: {
iconName: "documentinfo"
text: i18nc("Show track metadata", "View details")
onTriggered: {
if (metadataLoader.active === false) {
metadataLoader.active = true
}
......@@ -181,20 +182,17 @@ BasePlayListDelegate {
}
contextMenu.close();
}
icon: "documentinfo"
text: i18nc("Show track metadata", "View details")
}
MobileContextMenuEntry {
},
Kirigami.Action {
visible: isValid
onClicked: {
iconName: "error"
text: i18nc("Remove current track from play list", "Remove from queue")
onTriggered: {
playListEntry.removeFromPlaylist(playListEntry.index)
contextMenu.close();
}
icon: "error"
text: i18nc("Remove current track from play list", "Remove from queue")
}
}
]
}
}
}
......
......@@ -51,9 +51,7 @@
<file>qml/mobile/MobileSettingsPage.qml</file>
<file>qml/mobile/MobileMediaTrackMetadataView.qml</file>
<file>qml/mobile/MobilePlayListDelegate.qml</file>
<file>qml/mobile/MobileContextMenuSheet.qml</file>
<file>qml/mobile/MobileVolumeButton.qml</file>
<file>qml/mobile/MobileContextMenuEntry.qml</file>
<file>qml/shared/BasePlayerControl.qml</file>
<file>qml/shared/BasePlayListDelegate.qml</file>
</qresource>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment