Changeset View
Changeset View
Standalone View
Standalone View
src/qml/MediaPlayListView.qml
Show All 15 Lines | |||||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | import QtQuick 2.5 | 18 | import QtQuick 2.5 | ||
19 | import QtQuick.Controls 2.2 | 19 | import QtQuick.Controls 2.2 | ||
20 | import QtQuick.Controls 1.3 as Controls1 | 20 | import QtQuick.Controls 1.3 as Controls1 | ||
21 | import QtQuick.Layouts 1.1 | 21 | import QtQuick.Layouts 1.1 | ||
22 | import QtQuick.Window 2.2 | 22 | import QtQuick.Window 2.2 | ||
23 | import Qt.labs.platform 1.0 as PlatformDialog | 23 | import Qt.labs.platform 1.0 as PlatformDialog | ||
24 | import org.kde.kirigami 2.5 as Kirigami | ||||
24 | import org.kde.elisa 1.0 | 25 | import org.kde.elisa 1.0 | ||
25 | 26 | | |||
26 | FocusScope { | 27 | FocusScope { | ||
27 | property StackView parentStackView | 28 | property StackView parentStackView | ||
28 | 29 | | |||
29 | property int placeholderHeight: elisaTheme.dragDropPlaceholderHeight | 30 | property int placeholderHeight: elisaTheme.dragDropPlaceholderHeight | ||
30 | 31 | | |||
31 | signal startPlayback() | 32 | signal startPlayback() | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 156 | Controls1.ToolButton { | |||
156 | action: clearPlayList | 157 | action: clearPlayList | ||
157 | Keys.onReturnPressed: action.trigger() | 158 | Keys.onReturnPressed: action.trigger() | ||
158 | } | 159 | } | ||
159 | } | 160 | } | ||
160 | 161 | | |||
161 | ColumnLayout { | 162 | ColumnLayout { | ||
162 | id: emptyPlaylistText | 163 | id: emptyPlaylistText | ||
163 | spacing: 0 | 164 | spacing: 0 | ||
164 | visible: elisa.mediaPlayList ? elisa.mediaPlayList.tracksCount === 0 : true | 165 | visible: true | ||
165 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | 166 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | ||
166 | Layout.fillHeight: true | 167 | Layout.fillHeight: true | ||
167 | Layout.fillWidth: true | 168 | Layout.fillWidth: true | ||
168 | 169 | | |||
169 | Item { Layout.fillHeight: true } | 170 | Item { | ||
171 | id: emptyVisible | ||||
172 | visible: elisa.mediaPlayList ? elisa.mediaPlayList.tracksCount === 0 : true | ||||
173 | Layout.preferredHeight: (emptyPlaylistText.height-emptyImage.height-emptyLabel0.height-emptyLabel1.height)/2 | ||||
174 | } | ||||
170 | 175 | | |||
171 | Image { | 176 | Image { | ||
177 | id: emptyImage | ||||
mgallien: Please fix the typo. | |||||
178 | visible: emptyVisible.visible | ||||
172 | Layout.alignment: Qt.AlignHCenter | 179 | Layout.alignment: Qt.AlignHCenter | ||
173 | 180 | | |||
174 | width: elisaTheme.gridDelegateWidth * 5 | 181 | width: elisaTheme.gridDelegateWidth * 5 | ||
175 | height: elisaTheme.gridDelegateWidth * 5 | 182 | height: elisaTheme.gridDelegateWidth * 5 | ||
176 | 183 | | |||
177 | source: elisaTheme.playlistIcon | 184 | source: elisaTheme.playlistIcon | ||
178 | opacity: 0.25 | 185 | opacity: 0.25 | ||
179 | 186 | | |||
180 | sourceSize { | 187 | sourceSize { | ||
181 | width: elisaTheme.viewSelectorDelegateHeight * 5 | 188 | width: elisaTheme.viewSelectorDelegateHeight * 5 | ||
182 | height: elisaTheme.viewSelectorDelegateHeight * 5 | 189 | height: elisaTheme.viewSelectorDelegateHeight * 5 | ||
183 | } | 190 | } | ||
184 | } | 191 | } | ||
185 | 192 | | |||
186 | Label { | 193 | Label { | ||
194 | id: emptyLabel0 | ||||
195 | visible: emptyVisible.visible | ||||
187 | Layout.fillWidth: true | 196 | Layout.fillWidth: true | ||
188 | Layout.alignment: Qt.AlignHCenter | 197 | Layout.alignment: Qt.AlignHCenter | ||
189 | Layout.rightMargin: elisaTheme.layoutHorizontalMargin | 198 | Layout.rightMargin: elisaTheme.layoutHorizontalMargin | ||
190 | Layout.leftMargin: elisaTheme.layoutHorizontalMargin | 199 | Layout.leftMargin: elisaTheme.layoutHorizontalMargin | ||
191 | 200 | | |||
192 | font.pointSize: elisaTheme.defaultFontPointSize * 2 | 201 | font.pointSize: elisaTheme.defaultFontPointSize * 2 | ||
193 | wrapMode: Text.WordWrap | 202 | wrapMode: Text.WordWrap | ||
194 | 203 | | |||
195 | horizontalAlignment: Text.AlignHCenter | 204 | horizontalAlignment: Text.AlignHCenter | ||
196 | text: i18nc("Your playlist is empty", "Your playlist is empty") | 205 | text: i18nc("Your playlist is empty", "Your playlist is empty") | ||
197 | } | 206 | } | ||
198 | 207 | | |||
199 | Label { | 208 | Label { | ||
209 | id: emptyLabel1 | ||||
210 | visible: emptyVisible.visible | ||||
200 | Layout.topMargin: 5 | 211 | Layout.topMargin: 5 | ||
201 | Layout.fillWidth: true | 212 | Layout.fillWidth: true | ||
202 | Layout.alignment: Qt.AlignHCenter | 213 | Layout.alignment: Qt.AlignHCenter | ||
203 | Layout.rightMargin: elisaTheme.layoutHorizontalMargin | 214 | Layout.rightMargin: elisaTheme.layoutHorizontalMargin | ||
204 | Layout.leftMargin: elisaTheme.layoutHorizontalMargin | 215 | Layout.leftMargin: elisaTheme.layoutHorizontalMargin | ||
205 | 216 | | |||
206 | wrapMode: Text.WordWrap | 217 | wrapMode: Text.WordWrap | ||
207 | 218 | | |||
208 | horizontalAlignment: Text.AlignHCenter | 219 | horizontalAlignment: Text.AlignHCenter | ||
209 | text: i18nc("Text shown when play list is empty", "Add some songs to get started. You can browse your music using the views on the left.") | 220 | text: i18nc("Text shown when play list is empty", "Add some songs to get started. You can browse your music using the views on the left.") | ||
210 | } | 221 | } | ||
211 | 222 | | |||
212 | Item { Layout.fillHeight: true } | 223 | Item { | ||
213 | 224 | visible: emptyVisible.visible | |||
225 | Layout.fillHeight: true | ||||
214 | } | 226 | } | ||
215 | 227 | | |||
216 | PlayListBasicView { | 228 | PlayListBasicView { | ||
217 | id: playListView | 229 | id: playListView | ||
218 | 230 | | |||
231 | visible: !emptyVisible.visible | ||||
232 | | ||||
219 | Layout.fillWidth: true | 233 | Layout.fillWidth: true | ||
220 | Layout.fillHeight: true | 234 | Layout.fillHeight: true | ||
221 | 235 | | |||
222 | playListModel: elisa.mediaPlayList | 236 | playListModel: elisa.mediaPlayList | ||
223 | 237 | | |||
224 | focus: true | 238 | focus: true | ||
225 | 239 | | |||
226 | onStartPlayback: topItem.startPlayback() | 240 | onStartPlayback: topItem.startPlayback() | ||
227 | 241 | | |||
228 | onPausePlayback: topItem.pausePlayback() | 242 | onPausePlayback: topItem.pausePlayback() | ||
229 | 243 | | |||
230 | onDisplayError: topItem.displayError(errorText) | 244 | onDisplayError: topItem.displayError(errorText) | ||
231 | 245 | | |||
232 | } | 246 | } | ||
247 | | ||||
248 | Kirigami.InlineMessage { | ||||
249 | | ||||
250 | Connections { | ||||
251 | target: elisa.mediaPlayList | ||||
252 | onDisplayUndoInline: undoClear.visible = true | ||||
253 | } | ||||
254 | | ||||
255 | Connections { | ||||
256 | target: elisa.mediaPlayList | ||||
257 | onHideUndoInline: undoClear.visible = false | ||||
258 | } | ||||
259 | | ||||
260 | id: undoClear | ||||
261 | | ||||
262 | text: i18nc("Playlist cleared", "Playlist cleared") | ||||
263 | type: Kirigami.MessageType.Information | ||||
264 | showCloseButton: true | ||||
265 | Layout.topMargin: 5 | ||||
266 | Layout.fillWidth: true | ||||
267 | Layout.rightMargin: elisaTheme.layoutHorizontalMargin | ||||
268 | Layout.leftMargin: elisaTheme.layoutHorizontalMargin | ||||
269 | | ||||
270 | actions: [ | ||||
271 | Kirigami.Action { | ||||
272 | text: i18nc("Undo", "Undo") | ||||
273 | icon.name: "dialog-cancel" | ||||
274 | onTriggered: elisa.mediaPlayList.undoClearPlayList() | ||||
275 | } | ||||
276 | ] | ||||
277 | } | ||||
278 | } | ||||
233 | } | 279 | } | ||
234 | } | 280 | } | ||
235 | 281 | | |||
236 | 282 | |
Please fix the typo.