Changeset View
Changeset View
Standalone View
Standalone View
src/qml/PlayListBasicView.qml
Show All 25 Lines | 24 | ListView { | |||
---|---|---|---|---|---|
26 | 26 | | |||
27 | property alias playListModel: playListModelDelegate.model | 27 | property alias playListModel: playListModelDelegate.model | ||
28 | 28 | | |||
29 | signal startPlayback() | 29 | signal startPlayback() | ||
30 | signal pausePlayback() | 30 | signal pausePlayback() | ||
31 | signal displayError(var errorText) | 31 | signal displayError(var errorText) | ||
32 | 32 | | |||
33 | focus: true | 33 | focus: true | ||
34 | activeFocusOnTab: true | | |||
35 | keyNavigationEnabled: true | 34 | keyNavigationEnabled: true | ||
35 | activeFocusOnTab: true | ||||
36 | | ||||
37 | currentIndex: -1 | ||||
36 | 38 | | |||
37 | section.property: 'albumSection' | 39 | section.property: 'albumSection' | ||
38 | section.criteria: ViewSection.FullString | 40 | section.criteria: ViewSection.FullString | ||
39 | section.labelPositioning: ViewSection.InlineLabels | 41 | section.labelPositioning: ViewSection.InlineLabels | ||
40 | section.delegate: PlayListAlbumHeader { | 42 | section.delegate: PlayListAlbumHeader { | ||
41 | headerData: JSON.parse(section) | 43 | headerData: JSON.parse(section) | ||
42 | width: scrollBar.visible ? (!LayoutMirroring.enabled ? playListView.width - scrollBar.width : playListView.width) : playListView.width | 44 | width: scrollBar.visible ? (!LayoutMirroring.enabled ? playListView.width - scrollBar.width : playListView.width) : playListView.width | ||
43 | height: elisaTheme.playListHeaderHeight | 45 | height: elisaTheme.playListHeaderHeight | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 104 | PlayListEntry { | |||
126 | isSingleDiscAlbum: (model.isSingleDiscAlbum ? model.isSingleDiscAlbum : true) | 128 | isSingleDiscAlbum: (model.isSingleDiscAlbum ? model.isSingleDiscAlbum : true) | ||
127 | isValid: model.isValid | 129 | isValid: model.isValid | ||
128 | isPlaying: model.isPlaying | 130 | isPlaying: model.isPlaying | ||
129 | 131 | | |||
130 | onStartPlayback: playListView.startPlayback() | 132 | onStartPlayback: playListView.startPlayback() | ||
131 | onPausePlayback: playListView.pausePlayback() | 133 | onPausePlayback: playListView.pausePlayback() | ||
132 | onRemoveFromPlaylist: playListView.playListModel.removeRows(trackIndex, 1) | 134 | onRemoveFromPlaylist: playListView.playListModel.removeRows(trackIndex, 1) | ||
133 | onSwitchToTrack: playListView.playListModel.switchTo(trackIndex) | 135 | onSwitchToTrack: playListView.playListModel.switchTo(trackIndex) | ||
136 | | ||||
137 | onActiveFocusChanged: { | ||||
138 | if (activeFocus && playListView.currentIndex !== index) { | ||||
139 | playListView.currentIndex = index | ||||
140 | } | ||||
141 | } | ||||
134 | } | 142 | } | ||
135 | 143 | | |||
136 | draggedItemParent: playListView | 144 | draggedItemParent: playListView | ||
137 | 145 | | |||
138 | onClicked: { | 146 | onClicked: { | ||
139 | playListView.currentIndex = index | 147 | playListView.currentIndex = index | ||
140 | entry.forceActiveFocus() | 148 | entry.forceActiveFocus() | ||
141 | } | 149 | } | ||
142 | 150 | | |||
143 | onDoubleClicked: { | 151 | onDoubleClicked: { | ||
144 | if (model.isValid) { | 152 | if (model.isValid) { | ||
145 | playListView.playListModel.switchTo(model.index) | 153 | playListView.playListModel.switchTo(model.index) | ||
146 | playListView.startPlayback() | 154 | playListView.startPlayback() | ||
147 | } | 155 | } | ||
148 | } | 156 | } | ||
149 | 157 | | |||
150 | onMoveItemRequested: { | 158 | onMoveItemRequested: { | ||
151 | playListModel.move(from, to, 1); | 159 | playListModel.move(from, to, 1); | ||
152 | } | 160 | } | ||
153 | } | 161 | } | ||
154 | } | 162 | } | ||
163 | | ||||
164 | onCountChanged: if (count === 0) { | ||||
165 | currentIndex = -1; | ||||
166 | } | ||||
155 | } | 167 | } |