Changeset View
Changeset View
Standalone View
Standalone View
src/qml/MediaTrackMetadataView.qml
Show All 33 Lines | 27 | Window { | |||
---|---|---|---|---|---|
34 | 34 | | |||
35 | LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft | 35 | LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft | ||
36 | LayoutMirroring.childrenInherit: true | 36 | LayoutMirroring.childrenInherit: true | ||
37 | 37 | | |||
38 | title: i18nc("Window title for track metadata", "View Details") | 38 | title: i18nc("Window title for track metadata", "View Details") | ||
39 | 39 | | |||
40 | TrackMetadataModel { | 40 | TrackMetadataModel { | ||
41 | id: realModel | 41 | id: realModel | ||
42 | | ||||
43 | manager: elisa.musicManager | ||||
42 | } | 44 | } | ||
43 | 45 | | |||
44 | modality: Qt.NonModal | 46 | modality: Qt.NonModal | ||
45 | flags: Qt.Dialog | Qt.WindowCloseButtonHint | 47 | flags: Qt.Dialog | Qt.WindowCloseButtonHint | ||
46 | 48 | | |||
47 | color: myPalette.window | 49 | color: myPalette.window | ||
48 | 50 | | |||
49 | minimumHeight: elisaTheme.coverImageSize * 1.8 | 51 | minimumHeight: elisaTheme.coverImageSize * 1.8 | ||
Show All 30 Lines | 68 | Image { | |||
80 | Layout.maximumWidth: elisaTheme.coverImageSize | 82 | Layout.maximumWidth: elisaTheme.coverImageSize | ||
81 | } | 83 | } | ||
82 | 84 | | |||
83 | ListView { | 85 | ListView { | ||
84 | id: trackData | 86 | id: trackData | ||
85 | 87 | | |||
86 | Layout.fillWidth: true | 88 | Layout.fillWidth: true | ||
87 | Layout.fillHeight: true | 89 | Layout.fillHeight: true | ||
90 | Layout.leftMargin: 2 * elisaTheme.layoutHorizontalMargin | ||||
88 | 91 | | |||
89 | focus: true | 92 | focus: true | ||
90 | 93 | | |||
91 | ScrollBar.vertical: ScrollBar { | 94 | ScrollBar.vertical: ScrollBar { | ||
92 | id: scrollBar | 95 | id: scrollBar | ||
93 | } | 96 | } | ||
94 | boundsBehavior: Flickable.StopAtBounds | 97 | boundsBehavior: Flickable.StopAtBounds | ||
95 | clip: true | 98 | clip: true | ||
96 | 99 | | |||
97 | | ||||
98 | ScrollHelper { | 100 | ScrollHelper { | ||
99 | id: scrollHelper | 101 | id: scrollHelper | ||
100 | flickable: trackData | 102 | flickable: trackData | ||
101 | anchors.fill: trackData | 103 | anchors.fill: trackData | ||
102 | } | 104 | } | ||
103 | model: realModel | 105 | model: realModel | ||
104 | 106 | | |||
105 | delegate: metadataDelegate | 107 | delegate: MetaDataDelegate { | ||
108 | width: scrollBar.visible ? (!LayoutMirroring.enabled ? trackData.width - scrollBar.width : trackData.width) : trackData.width | ||||
109 | } | ||||
106 | } | 110 | } | ||
107 | } | 111 | } | ||
108 | 112 | | |||
109 | RowLayout { | 113 | RowLayout { | ||
110 | Layout.alignment: Qt.AlignLeft | Qt.AlignBottom | 114 | Layout.alignment: Qt.AlignLeft | Qt.AlignBottom | ||
111 | Layout.topMargin: elisaTheme.layoutVerticalMargin | 115 | Layout.topMargin: elisaTheme.layoutVerticalMargin | ||
112 | Layout.bottomMargin: elisaTheme.layoutVerticalMargin | 116 | Layout.bottomMargin: elisaTheme.layoutVerticalMargin | ||
113 | 117 | | |||
Show All 27 Lines | 141 | DialogButtonBox { | |||
141 | Layout.minimumHeight: implicitHeight | 145 | Layout.minimumHeight: implicitHeight | ||
142 | 146 | | |||
143 | standardButtons: DialogButtonBox.Close | 147 | standardButtons: DialogButtonBox.Close | ||
144 | alignment: Qt.AlignRight | 148 | alignment: Qt.AlignRight | ||
145 | onRejected: trackMetadata.rejected() | 149 | onRejected: trackMetadata.rejected() | ||
146 | } | 150 | } | ||
147 | } | 151 | } | ||
148 | 152 | | |||
149 | Component { | | |||
150 | id: metadataDelegate | | |||
151 | | ||||
152 | RowLayout { | | |||
153 | id: delegateRow | | |||
154 | spacing: 0 | | |||
155 | | ||||
156 | width: scrollBar.visible ? trackData.width - scrollBar.width : trackData.width | | |||
157 | | ||||
158 | Label { | | |||
159 | id: metaDataLabels | | |||
160 | text: model.name | | |||
161 | color: myPalette.text | | |||
162 | horizontalAlignment: Text.AlignRight | | |||
163 | | ||||
164 | Layout.preferredWidth: 0.8 * elisaTheme.coverImageSize | | |||
165 | Layout.rightMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0 | | |||
166 | Layout.leftMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0 | | |||
167 | } | | |||
168 | | ||||
169 | Loader { | | |||
170 | active: model.type === TrackMetadataModel.TextEntry || model.type === TrackMetadataModel.IntegerEntry | | |||
171 | | ||||
172 | Layout.fillWidth: true | | |||
173 | | ||||
174 | sourceComponent: LabelWithToolTip { | | |||
175 | text: model.display | | |||
176 | | ||||
177 | horizontalAlignment: Text.AlignLeft | | |||
178 | elide: Text.ElideRight | | |||
179 | | ||||
180 | anchors.fill: parent | | |||
181 | } | | |||
182 | } | | |||
183 | | ||||
184 | Loader { | | |||
185 | active: model.type === TrackMetadataModel.DateEntry | | |||
186 | | ||||
187 | Layout.fillWidth: true | | |||
188 | | ||||
189 | sourceComponent: LabelWithToolTip { | | |||
190 | text: rawDate.toLocaleDateString() | | |||
191 | | ||||
192 | horizontalAlignment: Text.AlignLeft | | |||
193 | elide: Text.ElideRight | | |||
194 | | ||||
195 | anchors.fill: parent | | |||
196 | | ||||
197 | property date rawDate: new Date(model.display) | | |||
198 | } | | |||
199 | } | | |||
200 | | ||||
201 | Loader { | | |||
202 | active: model.type === TrackMetadataModel.RatingEntry | | |||
203 | | ||||
204 | Layout.fillWidth: true | | |||
205 | | ||||
206 | sourceComponent: RatingStar { | | |||
207 | starRating: model.display | | |||
208 | starSize: elisaTheme.ratingStarSize | | |||
209 | | ||||
210 | readOnly: true | | |||
211 | | ||||
212 | anchors { | | |||
213 | left: parent.left | | |||
214 | top: parent.top | | |||
215 | bottom: parent.bottom | | |||
216 | } | | |||
217 | } | | |||
218 | } | | |||
219 | } | | |||
220 | } | | |||
221 | | ||||
222 | Connections { | 153 | Connections { | ||
223 | target: elisa | 154 | target: elisa | ||
224 | 155 | | |||
225 | onMusicManagerChanged: { | 156 | onMusicManagerChanged: { | ||
226 | if (databaseId !== 0) { | 157 | if (databaseId !== 0) { | ||
227 | realModel.initializeByTrackId(elisa.musicManager, databaseId) | 158 | realModel.initializeByTrackId(databaseId) | ||
228 | } else { | 159 | } else { | ||
229 | realModel.initializeByTrackFileName(elisa.musicManager, fileName) | 160 | realModel.initializeByTrackFileName(fileName) | ||
230 | } | 161 | } | ||
231 | } | 162 | } | ||
232 | } | 163 | } | ||
233 | 164 | | |||
234 | Component.onCompleted: { | 165 | Component.onCompleted: { | ||
235 | if (elisa.musicManager) { | 166 | if (elisa.musicManager) { | ||
236 | if (databaseId !== 0) { | 167 | if (databaseId !== 0) { | ||
237 | realModel.initializeByTrackId(elisa.musicManager, databaseId) | 168 | realModel.initializeByTrackId(databaseId) | ||
238 | } else { | 169 | } else { | ||
239 | realModel.initializeByTrackFileName(elisa.musicManager, fileName) | 170 | realModel.initializeByTrackFileName(fileName) | ||
240 | } | 171 | } | ||
241 | } | 172 | } | ||
242 | } | 173 | } | ||
243 | } | 174 | } |