Changeset View
Changeset View
Standalone View
Standalone View
src/viewmanager.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 45 | case AllGenres: | |||
---|---|---|---|---|---|
46 | openAllGenres(mainTitle, mainImage); | 46 | openAllGenres(mainTitle, mainImage); | ||
47 | break; | 47 | break; | ||
48 | case FilesBrowser: | 48 | case FilesBrowser: | ||
49 | openFilesBrowser(mainTitle, mainImage); | 49 | openFilesBrowser(mainTitle, mainImage); | ||
50 | break; | 50 | break; | ||
51 | case Context: | 51 | case Context: | ||
52 | openContextView(mainTitle, mainImage); | 52 | openContextView(mainTitle, mainImage); | ||
53 | break; | 53 | break; | ||
54 | case RadiosBrowser: | ||||
55 | openRadiosBrowser(mainTitle, mainImage); | ||||
56 | break; | ||||
54 | case OneAlbum: | 57 | case OneAlbum: | ||
55 | case OneArtist: | 58 | case OneArtist: | ||
56 | case OneAlbumFromArtist: | 59 | case OneAlbumFromArtist: | ||
57 | case OneArtistFromGenre: | 60 | case OneArtistFromGenre: | ||
58 | case OneAlbumFromArtistAndGenre: | 61 | case OneAlbumFromArtistAndGenre: | ||
59 | case AllArtistsFromGenre: | 62 | case AllArtistsFromGenre: | ||
60 | break; | 63 | break; | ||
61 | } | 64 | } | ||
Show All 13 Lines | 76 | case ElisaUtils::Artist: | |||
75 | break; | 78 | break; | ||
76 | case ElisaUtils::Genre: | 79 | case ElisaUtils::Genre: | ||
77 | openAllArtistsFromGenre(innerMainTitle); | 80 | openAllArtistsFromGenre(innerMainTitle); | ||
78 | break; | 81 | break; | ||
79 | case ElisaUtils::Track: | 82 | case ElisaUtils::Track: | ||
80 | case ElisaUtils::FileName: | 83 | case ElisaUtils::FileName: | ||
81 | case ElisaUtils::Lyricist: | 84 | case ElisaUtils::Lyricist: | ||
82 | case ElisaUtils::Composer: | 85 | case ElisaUtils::Composer: | ||
86 | case ElisaUtils::Radio: | ||||
83 | case ElisaUtils::Unknown: | 87 | case ElisaUtils::Unknown: | ||
84 | break; | 88 | break; | ||
85 | } | 89 | } | ||
86 | } | 90 | } | ||
87 | 91 | | |||
88 | void ViewManager::viewIsLoaded(ViewManager::ViewsType viewType) | 92 | void ViewManager::viewIsLoaded(ViewManager::ViewsType viewType) | ||
89 | { | 93 | { | ||
90 | switch (viewType) | 94 | switch (viewType) | ||
Show All 35 Lines | 129 | case ViewsType::OneAlbumFromArtistAndGenre: | |||
126 | oneAlbumViewIsLoaded(); | 130 | oneAlbumViewIsLoaded(); | ||
127 | break; | 131 | break; | ||
128 | case ViewsType::FilesBrowser: | 132 | case ViewsType::FilesBrowser: | ||
129 | filesBrowserViewIsLoaded(); | 133 | filesBrowserViewIsLoaded(); | ||
130 | break; | 134 | break; | ||
131 | case ViewsType::Context: | 135 | case ViewsType::Context: | ||
132 | contextViewIsLoaded(); | 136 | contextViewIsLoaded(); | ||
133 | break; | 137 | break; | ||
138 | case ViewsType::RadiosBrowser: | ||||
139 | radiosBrowserViewIsLoaded(); | ||||
140 | break; | ||||
134 | } | 141 | } | ||
135 | } | 142 | } | ||
136 | 143 | | |||
137 | void ViewManager::openRecentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl) | 144 | void ViewManager::openRecentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl) | ||
138 | { | 145 | { | ||
139 | mTargetView = ViewsType::RecentlyPlayedTracks; | 146 | mTargetView = ViewsType::RecentlyPlayedTracks; | ||
140 | 147 | | |||
141 | if (mCurrentView != mTargetView) { | 148 | if (mCurrentView != mTargetView) { | ||
142 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterByRecentlyPlayed, 1, mainTitle, {}, | 149 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterByRecentlyPlayed, 1, mainTitle, {}, | ||
143 | 0, imageUrl, ElisaUtils::Track, DatabaseInterface::LastPlayDate, | 150 | 0, imageUrl, ElisaUtils::Track, DatabaseInterface::LastPlayDate, | ||
144 | SortOrder::SortDescending, MultipleAlbum, NoDiscHeaders); | 151 | SortOrder::SortDescending, MultipleAlbum, NoDiscHeaders, IsTrack); | ||
145 | } | 152 | } | ||
146 | } | 153 | } | ||
147 | 154 | | |||
148 | void ViewManager::openFrequentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl) | 155 | void ViewManager::openFrequentlyPlayedTracks(const QString &mainTitle, const QUrl &imageUrl) | ||
149 | { | 156 | { | ||
150 | mTargetView = ViewsType::FrequentlyPlayedTracks; | 157 | mTargetView = ViewsType::FrequentlyPlayedTracks; | ||
151 | 158 | | |||
152 | if (mCurrentView != mTargetView) { | 159 | if (mCurrentView != mTargetView) { | ||
153 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterByFrequentlyPlayed, 1, mainTitle, {}, | 160 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterByFrequentlyPlayed, 1, mainTitle, {}, | ||
154 | 0, imageUrl, ElisaUtils::Track, DatabaseInterface::PlayFrequency, | 161 | 0, imageUrl, ElisaUtils::Track, DatabaseInterface::PlayFrequency, | ||
155 | SortOrder::SortDescending, MultipleAlbum, NoDiscHeaders); | 162 | SortOrder::SortDescending, MultipleAlbum, NoDiscHeaders, IsTrack); | ||
156 | } | 163 | } | ||
157 | } | 164 | } | ||
158 | 165 | | |||
159 | void ViewManager::openAllAlbums(const QString &mainTitle, const QUrl &imageUrl) | 166 | void ViewManager::openAllAlbums(const QString &mainTitle, const QUrl &imageUrl) | ||
160 | { | 167 | { | ||
161 | mTargetView = ViewsType::AllAlbums; | 168 | mTargetView = ViewsType::AllAlbums; | ||
162 | 169 | | |||
163 | if (mCurrentView != mTargetView) { | 170 | if (mCurrentView != mTargetView) { | ||
Show All 11 Lines | 179 | { | |||
175 | mTargetDatabaseId = albumDatabaseId; | 182 | mTargetDatabaseId = albumDatabaseId; | ||
176 | mTargetImageUrl = albumCover; | 183 | mTargetImageUrl = albumCover; | ||
177 | mAlbumDiscHeader = albumDiscHeader; | 184 | mAlbumDiscHeader = albumDiscHeader; | ||
178 | 185 | | |||
179 | if (mCurrentView == ViewsType::AllAlbums) { | 186 | if (mCurrentView == ViewsType::AllAlbums) { | ||
180 | mTargetView = ViewsType::OneAlbum; | 187 | mTargetView = ViewsType::OneAlbum; | ||
181 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 2, mTargetAlbumTitle, mTargetAlbumAuthor, | 188 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 2, mTargetAlbumTitle, mTargetAlbumAuthor, | ||
182 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, {}, | 189 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, {}, | ||
183 | SortOrder::NoSort, SingleAlbum, mAlbumDiscHeader); | 190 | SortOrder::NoSort, SingleAlbum, mAlbumDiscHeader, IsTrack); | ||
184 | } else if (mCurrentView == ViewsType::OneArtist && mCurrentArtistName == mTargetAlbumAuthor) { | 191 | } else if (mCurrentView == ViewsType::OneArtist && mCurrentArtistName == mTargetAlbumAuthor) { | ||
185 | mTargetView = ViewsType::OneAlbumFromArtist; | 192 | mTargetView = ViewsType::OneAlbumFromArtist; | ||
186 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 3, mTargetAlbumTitle, mTargetAlbumAuthor, | 193 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 3, mTargetAlbumTitle, mTargetAlbumAuthor, | ||
187 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, {}, | 194 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, {}, | ||
188 | SortOrder::NoSort, SingleAlbum, mAlbumDiscHeader); | 195 | SortOrder::NoSort, SingleAlbum, mAlbumDiscHeader, IsTrack); | ||
189 | } else if (mCurrentView == ViewsType::OneArtist && mCurrentArtistName != mTargetAlbumAuthor) { | 196 | } else if (mCurrentView == ViewsType::OneArtist && mCurrentArtistName != mTargetAlbumAuthor) { | ||
190 | mTargetView = ViewsType::OneAlbumFromArtist; | 197 | mTargetView = ViewsType::OneAlbumFromArtist; | ||
191 | Q_EMIT popOneView(); | 198 | Q_EMIT popOneView(); | ||
192 | } else if (mCurrentView == ViewsType::OneArtistFromGenre) { | 199 | } else if (mCurrentView == ViewsType::OneArtistFromGenre) { | ||
193 | mTargetView = ViewsType::OneAlbumFromArtistAndGenre; | 200 | mTargetView = ViewsType::OneAlbumFromArtistAndGenre; | ||
194 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 4, mTargetAlbumTitle, mTargetAlbumAuthor, | 201 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 4, mTargetAlbumTitle, mTargetAlbumAuthor, | ||
195 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, {}, | 202 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, {}, | ||
196 | SortOrder::NoSort, SingleAlbum, mAlbumDiscHeader); | 203 | SortOrder::NoSort, SingleAlbum, mAlbumDiscHeader, IsTrack); | ||
197 | } else { | 204 | } else { | ||
198 | mTargetView = ViewsType::OneAlbum; | 205 | mTargetView = ViewsType::OneAlbum; | ||
199 | Q_EMIT openGridView(ViewsType::AllAlbums, ElisaUtils::NoFilter, 1, {}, {}, {}, ElisaUtils::Album, | 206 | Q_EMIT openGridView(ViewsType::AllAlbums, ElisaUtils::NoFilter, 1, {}, {}, {}, ElisaUtils::Album, | ||
200 | QUrl(QStringLiteral("image://icon/media-optical-audio")), {}, {}, true, true); | 207 | QUrl(QStringLiteral("image://icon/media-optical-audio")), {}, {}, true, true); | ||
201 | } | 208 | } | ||
202 | } | 209 | } | ||
203 | 210 | | |||
204 | void ViewManager::openAllArtists(const QString &mainTitle, const QUrl &imageUrl) | 211 | void ViewManager::openAllArtists(const QString &mainTitle, const QUrl &imageUrl) | ||
Show All 39 Lines | |||||
244 | } | 251 | } | ||
245 | 252 | | |||
246 | void ViewManager::openAllTracks(const QString &mainTitle, const QUrl &imageUrl) | 253 | void ViewManager::openAllTracks(const QString &mainTitle, const QUrl &imageUrl) | ||
247 | { | 254 | { | ||
248 | mTargetView = ViewsType::AllTracks; | 255 | mTargetView = ViewsType::AllTracks; | ||
249 | if (mCurrentView != mTargetView) { | 256 | if (mCurrentView != mTargetView) { | ||
250 | Q_EMIT openListView(mTargetView, ElisaUtils::NoFilter, 1, mainTitle, {}, | 257 | Q_EMIT openListView(mTargetView, ElisaUtils::NoFilter, 1, mainTitle, {}, | ||
251 | 0, imageUrl, ElisaUtils::Track, Qt::DisplayRole, | 258 | 0, imageUrl, ElisaUtils::Track, Qt::DisplayRole, | ||
252 | SortOrder::SortAscending, MultipleAlbum, NoDiscHeaders); | 259 | SortOrder::SortAscending, MultipleAlbum, NoDiscHeaders, IsTrack); | ||
253 | } | 260 | } | ||
254 | } | 261 | } | ||
255 | 262 | | |||
256 | void ViewManager::openAllGenres(const QString &mainTitle, const QUrl &imageUrl) | 263 | void ViewManager::openAllGenres(const QString &mainTitle, const QUrl &imageUrl) | ||
257 | { | 264 | { | ||
258 | mTargetView = ViewsType::AllGenres; | 265 | mTargetView = ViewsType::AllGenres; | ||
259 | 266 | | |||
260 | if (mCurrentView != mTargetView) { | 267 | if (mCurrentView != mTargetView) { | ||
Show All 25 Lines | |||||
286 | } | 293 | } | ||
287 | 294 | | |||
288 | void ViewManager::openContextView(const QString &mainTitle, const QUrl &imageUrl) | 295 | void ViewManager::openContextView(const QString &mainTitle, const QUrl &imageUrl) | ||
289 | { | 296 | { | ||
290 | mTargetView = ViewsType::Context; | 297 | mTargetView = ViewsType::Context; | ||
291 | if (mCurrentView != mTargetView) { | 298 | if (mCurrentView != mTargetView) { | ||
292 | Q_EMIT switchContextView(mTargetView, 1, mainTitle, imageUrl); | 299 | Q_EMIT switchContextView(mTargetView, 1, mainTitle, imageUrl); | ||
293 | } | 300 | } | ||
301 | } | ||||
294 | 302 | | |||
303 | void ViewManager::openRadiosBrowser(const QString &mainTitle, const QUrl &imageUrl) | ||||
304 | { | ||||
305 | mTargetView = ViewsType::RadiosBrowser; | ||||
306 | if (mCurrentView != mTargetView) { | ||||
307 | Q_EMIT openListView(mTargetView, ElisaUtils::NoFilter, 1, mainTitle, {}, | ||||
308 | 0, imageUrl, ElisaUtils::Radio, Qt::DisplayRole, | ||||
309 | SortOrder::SortAscending, MultipleAlbum, NoDiscHeaders, IsRadio); | ||||
310 | } | ||||
295 | } | 311 | } | ||
296 | 312 | | |||
297 | void ViewManager::recentlyPlayedTracksIsLoaded() | 313 | void ViewManager::recentlyPlayedTracksIsLoaded() | ||
298 | { | 314 | { | ||
299 | mCurrentView = ViewsType::RecentlyPlayedTracks; | 315 | mCurrentView = ViewsType::RecentlyPlayedTracks; | ||
300 | } | 316 | } | ||
301 | 317 | | |||
302 | void ViewManager::frequentlyPlayedTracksIsLoaded() | 318 | void ViewManager::frequentlyPlayedTracksIsLoaded() | ||
303 | { | 319 | { | ||
304 | mCurrentView = ViewsType::FrequentlyPlayedTracks; | 320 | mCurrentView = ViewsType::FrequentlyPlayedTracks; | ||
305 | } | 321 | } | ||
306 | 322 | | |||
307 | void ViewManager::allAlbumsViewIsLoaded() | 323 | void ViewManager::allAlbumsViewIsLoaded() | ||
308 | { | 324 | { | ||
309 | mCurrentView = ViewsType::AllAlbums; | 325 | mCurrentView = ViewsType::AllAlbums; | ||
310 | if (mTargetView == ViewsType::OneAlbum) { | 326 | if (mTargetView == ViewsType::OneAlbum) { | ||
311 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 2, mTargetAlbumTitle, mTargetAlbumAuthor, | 327 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 2, mTargetAlbumTitle, mTargetAlbumAuthor, | ||
312 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, Qt::DisplayRole, | 328 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, Qt::DisplayRole, | ||
313 | SortOrder::SortAscending, MultipleAlbum, NoDiscHeaders); | 329 | SortOrder::SortAscending, MultipleAlbum, NoDiscHeaders, IsTrack); | ||
314 | } | 330 | } | ||
315 | } | 331 | } | ||
316 | 332 | | |||
317 | void ViewManager::oneAlbumViewIsLoaded() | 333 | void ViewManager::oneAlbumViewIsLoaded() | ||
318 | { | 334 | { | ||
319 | mCurrentAlbumTitle = mTargetAlbumTitle; | 335 | mCurrentAlbumTitle = mTargetAlbumTitle; | ||
320 | mCurrentAlbumAuthor = mTargetAlbumAuthor; | 336 | mCurrentAlbumAuthor = mTargetAlbumAuthor; | ||
321 | 337 | | |||
Show All 26 Lines | 360 | { | |||
348 | } else if (mTargetView == ViewsType::OneArtistFromGenre) { | 364 | } else if (mTargetView == ViewsType::OneArtistFromGenre) { | ||
349 | mCurrentGenreName = mTargetGenreName; | 365 | mCurrentGenreName = mTargetGenreName; | ||
350 | mCurrentView = ViewsType::OneArtistFromGenre; | 366 | mCurrentView = ViewsType::OneArtistFromGenre; | ||
351 | } else if (mTargetView == ViewsType::OneAlbumFromArtist) { | 367 | } else if (mTargetView == ViewsType::OneAlbumFromArtist) { | ||
352 | mCurrentView = ViewsType::OneArtist; | 368 | mCurrentView = ViewsType::OneArtist; | ||
353 | 369 | | |||
354 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 3, mTargetAlbumTitle, mTargetAlbumAuthor, | 370 | Q_EMIT openListView(mTargetView, ElisaUtils::FilterById, 3, mTargetAlbumTitle, mTargetAlbumAuthor, | ||
355 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, Qt::DisplayRole, | 371 | mTargetDatabaseId, mTargetImageUrl, ElisaUtils::Track, Qt::DisplayRole, | ||
356 | SortOrder::SortAscending, MultipleAlbum, NoDiscHeaders); | 372 | SortOrder::SortAscending, MultipleAlbum, NoDiscHeaders, IsTrack); | ||
357 | } | 373 | } | ||
358 | } | 374 | } | ||
359 | 375 | | |||
360 | void ViewManager::allTracksViewIsLoaded() | 376 | void ViewManager::allTracksViewIsLoaded() | ||
361 | { | 377 | { | ||
362 | mCurrentView = ViewsType::AllTracks; | 378 | mCurrentView = ViewsType::AllTracks; | ||
363 | } | 379 | } | ||
364 | 380 | | |||
Show All 13 Lines | 393 | { | |||
378 | mCurrentView = ViewsType::FilesBrowser; | 394 | mCurrentView = ViewsType::FilesBrowser; | ||
379 | } | 395 | } | ||
380 | 396 | | |||
381 | void ViewManager::contextViewIsLoaded() | 397 | void ViewManager::contextViewIsLoaded() | ||
382 | { | 398 | { | ||
383 | mCurrentView = ViewsType::Context; | 399 | mCurrentView = ViewsType::Context; | ||
384 | } | 400 | } | ||
385 | 401 | | |||
402 | void ViewManager::radiosBrowserViewIsLoaded() | ||||
403 | { | ||||
404 | mCurrentView = ViewsType::RadiosBrowser; | ||||
405 | } | ||||
406 | | ||||
386 | void ViewManager::goBack() | 407 | void ViewManager::goBack() | ||
387 | { | 408 | { | ||
388 | Q_EMIT popOneView(); | 409 | Q_EMIT popOneView(); | ||
389 | 410 | | |||
390 | if (mCurrentView == ViewsType::OneAlbum) { | 411 | if (mCurrentView == ViewsType::OneAlbum) { | ||
391 | mCurrentView = ViewsType::AllAlbums; | 412 | mCurrentView = ViewsType::AllAlbums; | ||
392 | } else if (mCurrentView == ViewsType::OneArtist) { | 413 | } else if (mCurrentView == ViewsType::OneArtist) { | ||
393 | mCurrentView = ViewsType::AllArtists; | 414 | mCurrentView = ViewsType::AllArtists; | ||
Show All 14 Lines |