Commit 158a30e8 authored by Prince Gupta's avatar Prince Gupta 💬 Committed by Jean-Baptiste Kempf
Browse files

qml: try to show more items in expand tracks list

fixes #25597
parent 0bb61310
......@@ -31,10 +31,20 @@ Widgets.NavigableFocusScope {
id: root
property variant model: MLAlbumModel{}
implicitHeight: artAndControl.height + VLCStyle.margin_large + VLCStyle.margin_xxsmall
implicitWidth: layout.implicitWidth
signal retract()
implicitWidth: layout.implicitWidth
implicitHeight: {
var verticalMargins = layout.anchors.topMargin + layout.anchors.bottomMargin
if (tracks.contentHeight < artAndControl.height)
return artAndControl.height + verticalMargins
return Math.min(tracks.contentHeight
, tracks.listView.headerItem.height + tracks.rowHeight * 6) // show a maximum of 6 rows
+ verticalMargins
}
Rectangle {
anchors.fill: parent
color: VLCStyle.colors.bgAlt
......@@ -134,123 +144,118 @@ Widgets.NavigableFocusScope {
}
navigationParent: root
navigationRightItem: expand_track_id
navigationRightItem: tracks
}
}
}
/* The list of the tracks available */
MusicTrackListDisplay {
id: tracks
ColumnLayout {
id: expand_infos_id
spacing: 0
Layout.fillWidth: true
Layout.fillHeight: true
readonly property int _nbCols: VLCStyle.gridColumnsForWidth(tracks.availableRowWidth)
RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: expand_infos_title_id.implicitHeight
property Component titleDelegate: RowLayout {
property var rowModel: parent.rowModel
/* The title of the albums */
Widgets.SubtitleLabel {
id: expand_infos_title_id
anchors.fill: parent
text: model.title || i18n.qtr("Unknown title")
Widgets.ListLabel {
text: !!rowModel && !!rowModel.track_number ? rowModel.track_number : ""
color: foregroundColor
font.weight: Font.Normal
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
Layout.fillHeight: true
Layout.leftMargin: VLCStyle.margin_xxsmall
Layout.preferredWidth: VLCStyle.margin_large
}
Widgets.IconLabel {
text: VLCIcons.close
Widgets.ListLabel {
text: !!rowModel && !!rowModel.title ? rowModel.title : ""
color: foregroundColor
MouseArea {
anchors.fill: parent
onClicked: root.retract()
}
Layout.fillHeight: true
Layout.fillWidth: true
}
}
Widgets.CaptionLabel {
id: expand_infos_subtitle_id
property Component titleHeaderDelegate: Row {
text: i18n.qtr("%1 - %2 - %3")
.arg(model.main_artist || i18n.qtr("Unknown artist"))
.arg(model.release_year || "")
.arg(Helpers.msToString(model.duration) || "")
Widgets.CaptionLabel {
text: "#"
width: VLCStyle.margin_large
}
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
Widgets.CaptionLabel {
text: i18n.qtr("Title")
}
}
/* The list of the tracks available */
MusicTrackListDisplay {
id: expand_track_id
readonly property int _nbCols: VLCStyle.gridColumnsForWidth(expand_track_id.availableRowWidth)
header: Column {
width: tracks.width
height: implicitHeight
bottomPadding: VLCStyle.margin_large
property Component titleDelegate: RowLayout {
property var rowModel: parent.rowModel
RowLayout {
width: parent.width
anchors.fill: parent
/* The title of the albums */
Widgets.SubtitleLabel {
id: expand_infos_title_id
Widgets.ListLabel {
text: !!rowModel && !!rowModel.track_number ? rowModel.track_number : ""
color: foregroundColor
font.weight: Font.Normal
text: model.title || i18n.qtr("Unknown title")
Layout.fillHeight: true
Layout.preferredWidth: VLCStyle.margin_large
Layout.fillWidth: true
}
Widgets.ListLabel {
text: !!rowModel && !!rowModel.title ? rowModel.title : ""
color: foregroundColor
Widgets.IconLabel {
text: VLCIcons.close
Layout.fillHeight: true
Layout.fillWidth: true
Layout.rightMargin: VLCStyle.margin_small
MouseArea {
anchors.fill: parent
onClicked: root.retract()
}
}
}
property Component titleHeaderDelegate: Row {
Widgets.CaptionLabel {
text: "#"
width: VLCStyle.margin_large
}
Widgets.CaptionLabel {
id: expand_infos_subtitle_id
Widgets.CaptionLabel {
text: i18n.qtr("Title")
}
width: parent.width
text: i18n.qtr("%1 - %2 - %3")
.arg(model.main_artist || i18n.qtr("Unknown artist"))
.arg(model.release_year || "")
.arg(Helpers.msToString(model.duration) || "")
}
}
section.property: ""
headerPositioning: ListView.InlineHeader
section.property: ""
Layout.fillWidth: true
Layout.fillHeight: true
Layout.topMargin: VLCStyle.margin_large
Layout.fillWidth: true
Layout.fillHeight: true
rowHeight: VLCStyle.tableRow_height
headerColor: VLCStyle.colors.bgAlt
rowHeight: VLCStyle.tableRow_height
headerColor: VLCStyle.colors.bgAlt
parentId : root.model.id
onParentIdChanged: {
currentIndex = 0
}
parentId: root.model.id
onParentIdChanged: {
currentIndex = 0
}
sortModel: [
{ isPrimary: true, criteria: "title", width: VLCStyle.colWidth(Math.max(expand_track_id._nbCols - 1, 1)), visible: true, text: i18n.qtr("Title"), showSection: "", colDelegate: titleDelegate, headerDelegate: titleHeaderDelegate },
{ criteria: "duration", width: VLCStyle.colWidth(1), visible: true, showSection: "", colDelegate: tableColumns.timeColDelegate, headerDelegate: tableColumns.timeHeaderDelegate },
]
sortModel: [
{ isPrimary: true, criteria: "title", width: VLCStyle.colWidth(Math.max(tracks._nbCols - 1, 1)), visible: true, text: i18n.qtr("Title"), showSection: "", colDelegate: titleDelegate, headerDelegate: titleHeaderDelegate },
{ criteria: "duration", width: VLCStyle.colWidth(1), visible: true, showSection: "", colDelegate: tableColumns.timeColDelegate, headerDelegate: tableColumns.timeHeaderDelegate },
]
navigationParent: root
navigationLeftItem: actionButtons
navigationParent: root
navigationLeftItem: actionButtons
Widgets.TableColumns {
id: tableColumns
}
Widgets.TableColumns {
id: tableColumns
}
}
}
......
Markdown is supported
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