Changeset View
Changeset View
Standalone View
Standalone View
src/qml/DataListView.qml
Show All 29 Lines | 23 | FocusScope { | |||
---|---|---|---|---|---|
30 | property alias secondaryTitle: listView.secondaryTitle | 30 | property alias secondaryTitle: listView.secondaryTitle | ||
31 | property int databaseId | 31 | property int databaseId | ||
32 | property alias showSection: listView.showSection | 32 | property alias showSection: listView.showSection | ||
33 | property alias image: listView.image | 33 | property alias image: listView.image | ||
34 | property var modelType | 34 | property var modelType | ||
35 | property alias sortRole: proxyModel.sortRole | 35 | property alias sortRole: proxyModel.sortRole | ||
36 | property var sortAscending | 36 | property var sortAscending | ||
37 | property bool displaySingleAlbum: false | 37 | property bool displaySingleAlbum: false | ||
38 | property bool radioCase: false | ||||
astippich: make this false by default an set it from context view | |||||
astippich: i think "isRadio", or actually "isStream" is better fitting here | |||||
I agree about isStream being a better fit. We need to have something generic and reusable. mgallien: I agree about isStream being a better fit. We need to have something generic and reusable. | |||||
39 | | ||||
40 | function openMetaDataView(databaseId){ | ||||
41 | metadataLoader.setSource("MediaTrackMetadataView.qml", {"databaseId": databaseId, "radio": viewHeader.radioCase}); | ||||
42 | metadataLoader.active = true | ||||
43 | } | ||||
38 | 44 | | |||
39 | DataModel { | 45 | DataModel { | ||
40 | id: realModel | 46 | id: realModel | ||
41 | } | 47 | } | ||
42 | 48 | | |||
43 | AllTracksProxyModel { | 49 | AllTracksProxyModel { | ||
44 | id: proxyModel | 50 | id: proxyModel | ||
45 | 51 | | |||
46 | sourceModel: realModel | 52 | sourceModel: realModel | ||
47 | 53 | | |||
48 | onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) | 54 | onEntriesToEnqueue: elisa.mediaPlayList.enqueue(newEntries, databaseIdType, enqueueMode, triggerPlay) | ||
49 | } | 55 | } | ||
50 | 56 | | |||
57 | Loader { | ||||
58 | id: metadataLoader | ||||
59 | active: false | ||||
60 | onLoaded: item.show() | ||||
61 | } | ||||
62 | | ||||
51 | Component { | 63 | Component { | ||
astippich: is this alias used? | |||||
52 | id: singleAlbumDelegate | 64 | id: singleAlbumDelegate | ||
53 | 65 | | |||
54 | ListBrowserDelegate { | 66 | ListBrowserDelegate { | ||
55 | id: entry | 67 | id: entry | ||
56 | 68 | | |||
57 | width: listView.delegateWidth | 69 | width: listView.delegateWidth | ||
58 | height: ((true && !true) ? elisaTheme.delegateHeight*2 : elisaTheme.delegateHeight) | 70 | height: ((true && !true) ? elisaTheme.delegateHeight*2 : elisaTheme.delegateHeight) | ||
59 | 71 | | |||
Show All 25 Lines | |||||
85 | 97 | | |||
86 | onClicked: listView.currentIndex = index | 98 | onClicked: listView.currentIndex = index | ||
87 | 99 | | |||
88 | onActiveFocusChanged: { | 100 | onActiveFocusChanged: { | ||
89 | if (activeFocus && listView.currentIndex !== index) { | 101 | if (activeFocus && listView.currentIndex !== index) { | ||
90 | listView.currentIndex = index | 102 | listView.currentIndex = index | ||
91 | } | 103 | } | ||
92 | } | 104 | } | ||
105 | | ||||
106 | onCallOpenMetaDataView: { | ||||
107 | openMetaDataView(databaseId) | ||||
108 | } | ||||
93 | } | 109 | } | ||
94 | } | 110 | } | ||
95 | 111 | | |||
96 | Component { | 112 | Component { | ||
97 | id: multipleDiscDelegate | 113 | id: multipleDiscDelegate | ||
98 | 114 | | |||
99 | ListBrowserDelegate { | 115 | ListBrowserDelegate { | ||
100 | id: entry | 116 | id: entry | ||
Show All 10 Lines | |||||
111 | albumArtist: model.albumArtist ? model.albumArtist : '' | 127 | albumArtist: model.albumArtist ? model.albumArtist : '' | ||
112 | duration: model.duration | 128 | duration: model.duration | ||
113 | imageUrl: model.imageUrl ? model.imageUrl : '' | 129 | imageUrl: model.imageUrl ? model.imageUrl : '' | ||
114 | trackNumber: model.trackNumber ? model.trackNumber : -1 | 130 | trackNumber: model.trackNumber ? model.trackNumber : -1 | ||
115 | discNumber: model.discNumber ? model.discNumber : -1 | 131 | discNumber: model.discNumber ? model.discNumber : -1 | ||
116 | rating: model.rating | 132 | rating: model.rating | ||
117 | isSingleDiscAlbum: model.isSingleDiscAlbum | 133 | isSingleDiscAlbum: model.isSingleDiscAlbum | ||
118 | isSelected: listView.currentIndex === index | 134 | isSelected: listView.currentIndex === index | ||
119 | isAlternateColor: (index % 2) === 1 | 135 | isAlternateColor: (index % 2) === 1 | ||
please revisit all of these changes if they are really necessary astippich: please revisit all of these changes if they are really necessary
there are some errors… | |||||
Sorry for that, I had many warnings opening the view. jguidon: Sorry for that, I had many warnings opening the view.
I tried to correct these warnings by… | |||||
120 | 136 | | |||
121 | onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, | 137 | onEnqueue: elisa.mediaPlayList.enqueue(databaseId, name, modelType, | ||
122 | ElisaUtils.AppendPlayList, | 138 | ElisaUtils.AppendPlayList, | ||
123 | ElisaUtils.DoNotTriggerPlay) | 139 | ElisaUtils.DoNotTriggerPlay) | ||
124 | 140 | | |||
125 | onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, | 141 | onReplaceAndPlay: elisa.mediaPlayList.enqueue(databaseId, name, modelType, | ||
126 | ElisaUtils.ReplacePlayList, | 142 | ElisaUtils.ReplacePlayList, | ||
127 | ElisaUtils.TriggerPlay) | 143 | ElisaUtils.TriggerPlay) | ||
128 | 144 | | |||
129 | onClicked: { | 145 | onClicked: { | ||
130 | listView.currentIndex = index | 146 | listView.currentIndex = index | ||
131 | entry.forceActiveFocus() | 147 | entry.forceActiveFocus() | ||
132 | } | 148 | } | ||
149 | | ||||
150 | onCallOpenMetaDataView: { | ||||
151 | openMetaDataView(databaseId) | ||||
152 | } | ||||
133 | } | 153 | } | ||
134 | } | 154 | } | ||
135 | 155 | | |||
136 | ListBrowserView { | 156 | ListBrowserView { | ||
137 | id: listView | 157 | id: listView | ||
138 | 158 | | |||
139 | focus: true | 159 | focus: true | ||
140 | 160 | | |||
141 | anchors.fill: parent | 161 | anchors.fill: parent | ||
142 | 162 | | |||
143 | contentModel: proxyModel | 163 | contentModel: proxyModel | ||
144 | 164 | | |||
145 | delegate: (displaySingleAlbum ? singleAlbumDelegate : multipleDiscDelegate) | 165 | delegate: (displaySingleAlbum ? singleAlbumDelegate : multipleDiscDelegate) | ||
146 | 166 | | |||
147 | enableSorting: !displaySingleAlbum | 167 | enableSorting: !displaySingleAlbum | ||
148 | 168 | | |||
149 | allowArtistNavigation: isSubPage | 169 | allowArtistNavigation: isSubPage | ||
150 | 170 | | |||
171 | showCreateRadioButton: viewHeader.radioCase | ||||
172 | | ||||
In this case, you could name it createButton and the property would be viewHeader.createButtonActive . What do you think ? mgallien: In this case, you could name it createButton and the property would be viewHeader. | |||||
151 | onShowArtist: { | 173 | onShowArtist: { | ||
152 | viewManager.openChildView(secondaryTitle, '', elisaTheme.artistIcon, 0, ElisaUtils.Artist, ViewManager.NoDiscHeaders) | 174 | viewManager.openChildView(secondaryTitle, '', elisaTheme.artistIcon, 0, ElisaUtils.Artist, ViewManager.NoDiscHeaders) | ||
153 | } | 175 | } | ||
154 | 176 | | |||
155 | onGoBack: viewManager.goBack() | 177 | onGoBack: viewManager.goBack() | ||
156 | 178 | | |||
157 | Loader { | 179 | Loader { | ||
158 | anchors.centerIn: parent | 180 | anchors.centerIn: parent | ||
Show All 12 Lines | |||||
171 | Connections { | 193 | Connections { | ||
172 | target: elisa | 194 | target: elisa | ||
173 | 195 | | |||
174 | onMusicManagerChanged: realModel.initialize(elisa.musicManager, | 196 | onMusicManagerChanged: realModel.initialize(elisa.musicManager, | ||
175 | elisa.musicManager.viewDatabase, | 197 | elisa.musicManager.viewDatabase, | ||
176 | modelType) | 198 | modelType) | ||
177 | } | 199 | } | ||
178 | 200 | | |||
201 | Connections { | ||||
202 | target: listView.navigationBar | ||||
203 | | ||||
204 | onCreateRadio: { | ||||
205 | openMetaDataView(-1) | ||||
206 | } | ||||
207 | } | ||||
208 | | ||||
179 | Component.onCompleted: { | 209 | Component.onCompleted: { | ||
180 | if (elisa.musicManager) { | 210 | if (elisa.musicManager) { | ||
181 | realModel.initialize(elisa.musicManager, elisa.musicManager.viewDatabase, modelType, filterType, mainTitle, secondaryTitle, databaseId) | 211 | realModel.initialize(elisa.musicManager, elisa.musicManager.viewDatabase, modelType, filterType, mainTitle, secondaryTitle, databaseId) | ||
182 | } | 212 | } | ||
183 | 213 | | |||
184 | if (sortAscending === ViewManager.SortAscending) { | 214 | if (sortAscending === ViewManager.SortAscending) { | ||
185 | proxyModel.sortModel(Qt.AscendingOrder) | 215 | proxyModel.sortModel(Qt.AscendingOrder) | ||
186 | } else if (sortAscending === ViewManager.SortDescending) { | 216 | } else if (sortAscending === ViewManager.SortDescending) { | ||
187 | proxyModel.sortModel(Qt.DescendingOrder) | 217 | proxyModel.sortModel(Qt.DescendingOrder) | ||
188 | } | 218 | } | ||
189 | } | 219 | } | ||
190 | } | 220 | } |
make this false by default an set it from context view