Changeset View
Changeset View
Standalone View
Standalone View
src/viewmanager.h
Show All 38 Lines | 33 | enum ViewsType { | |||
---|---|---|---|---|---|
39 | AllTracks, | 39 | AllTracks, | ||
40 | AllGenres, | 40 | AllGenres, | ||
41 | AllArtistsFromGenre, | 41 | AllArtistsFromGenre, | ||
42 | OneArtistFromGenre, | 42 | OneArtistFromGenre, | ||
43 | OneAlbumFromArtistAndGenre, | 43 | OneAlbumFromArtistAndGenre, | ||
44 | FrequentlyPlayedTracks, | 44 | FrequentlyPlayedTracks, | ||
45 | RecentlyPlayedTracks, | 45 | RecentlyPlayedTracks, | ||
46 | FilesBrowser, | 46 | FilesBrowser, | ||
47 | Context | 47 | Context, | ||
48 | RadiosBrowser | ||||
48 | }; | 49 | }; | ||
49 | 50 | | |||
50 | Q_ENUM(ViewsType) | 51 | Q_ENUM(ViewsType) | ||
51 | 52 | | |||
52 | enum SortOrder { | 53 | enum SortOrder { | ||
53 | NoSort, | 54 | NoSort, | ||
54 | SortAscending, | 55 | SortAscending, | ||
55 | SortDescending, | 56 | SortDescending, | ||
Show All 19 Lines | 75 | void openGridView(ViewManager::ViewsType viewType, ElisaUtils::FilterType filterType, int expectedDepth, | |||
75 | const QString &mainTitle, const QString &secondaryTitle, const QUrl &imageUrl, | 76 | const QString &mainTitle, const QString &secondaryTitle, const QUrl &imageUrl, | ||
76 | ElisaUtils::PlayListEntryType dataType, const QUrl &viewDefaultIcon, | 77 | ElisaUtils::PlayListEntryType dataType, const QUrl &viewDefaultIcon, | ||
77 | const QString &genreNameFilter, const QString &artistNameFilter, | 78 | const QString &genreNameFilter, const QString &artistNameFilter, | ||
78 | bool viewShowRating, bool viewDelegateDisplaySecondaryText); | 79 | bool viewShowRating, bool viewDelegateDisplaySecondaryText); | ||
79 | 80 | | |||
80 | void openListView(ViewManager::ViewsType viewType, ElisaUtils::FilterType filterType, int expectedDepth, | 81 | void openListView(ViewManager::ViewsType viewType, ElisaUtils::FilterType filterType, int expectedDepth, | ||
81 | const QString &mainTitle, const QString &secondaryTitle, qulonglong databaseId, | 82 | const QString &mainTitle, const QString &secondaryTitle, qulonglong databaseId, | ||
82 | const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType, QVariant sortRole, | 83 | const QUrl &imageUrl, ElisaUtils::PlayListEntryType dataType, QVariant sortRole, | ||
83 | ViewManager::SortOrder sortOrder, bool displaySingleAlbum, ViewManager::AlbumViewStyle showDiscHeaders); | 84 | ViewManager::SortOrder sortOrder, bool displaySingleAlbum, ViewManager::AlbumViewStyle showDiscHeaders, | ||
85 | bool radioCase); | ||||
84 | 86 | | |||
mgallien: Please do not use a bool but a named constant (from an enum).
And yes, there is a bool before… | |||||
Thank you for the reading, I am a little bit confused about the "best" solution here. "bool radioCase" is heavily linked to dataType (ElisaUtils::PlayListEntryType::Radio). Should I expose the enum in qml and do the check in DataListView.qml with something like modelType == ElisaUtils::PlayListEntryType::Radio instead of the property "radioCase"? jguidon: Thank you for the reading,
I am a little bit confused about the "best" solution here. "bool… | |||||
You can simply use a two values enum like IsRadio and IsTrack . That would be easier to read than a true/false . You will have to expose it like ViewManager::AlbumViewStyle is. mgallien: You can simply use a two values enum like IsRadio and IsTrack . That would be easier to read… | |||||
85 | void switchFilesBrowserView(ViewManager::ViewsType viewType, int expectedDepth, | 87 | void switchFilesBrowserView(ViewManager::ViewsType viewType, int expectedDepth, | ||
86 | const QString &mainTitle, const QUrl &imageUrl); | 88 | const QString &mainTitle, const QUrl &imageUrl); | ||
87 | 89 | | |||
88 | void switchContextView(ViewManager::ViewsType viewType, int expectedDepth, | 90 | void switchContextView(ViewManager::ViewsType viewType, int expectedDepth, | ||
89 | const QString &mainTitle, const QUrl &imageUrl); | 91 | const QString &mainTitle, const QUrl &imageUrl); | ||
90 | 92 | | |||
91 | void switchOffAllViews(ViewManager::ViewsType viewType); | 93 | void switchOffAllViews(ViewManager::ViewsType viewType); | ||
92 | 94 | | |||
Show All 24 Lines | 109 | private: | |||
117 | void openAllTracks(const QString &mainTitle, const QUrl &imageUrl); | 119 | void openAllTracks(const QString &mainTitle, const QUrl &imageUrl); | ||
118 | 120 | | |||
119 | void openAllGenres(const QString &mainTitle, const QUrl &imageUrl); | 121 | void openAllGenres(const QString &mainTitle, const QUrl &imageUrl); | ||
120 | 122 | | |||
121 | void openFilesBrowser(const QString &mainTitle, const QUrl &imageUrl); | 123 | void openFilesBrowser(const QString &mainTitle, const QUrl &imageUrl); | ||
122 | 124 | | |||
123 | void openContextView(const QString &mainTitle, const QUrl &imageUrl); | 125 | void openContextView(const QString &mainTitle, const QUrl &imageUrl); | ||
124 | 126 | | |||
127 | void openRadiosBrowser(const QString &mainTitle, const QUrl &imageUrl); | ||||
128 | | ||||
125 | void openOneAlbum(const QString &albumTitle, const QString &albumAuthor, | 129 | void openOneAlbum(const QString &albumTitle, const QString &albumAuthor, | ||
126 | const QUrl &albumCover, qulonglong albumDatabaseId, ViewManager::AlbumViewStyle albumDiscHeader); | 130 | const QUrl &albumCover, qulonglong albumDatabaseId, ViewManager::AlbumViewStyle albumDiscHeader); | ||
127 | 131 | | |||
128 | void openOneArtist(const QString &artistName, const QUrl &artistImageUrl, qulonglong artistDatabaseId); | 132 | void openOneArtist(const QString &artistName, const QUrl &artistImageUrl, qulonglong artistDatabaseId); | ||
129 | 133 | | |||
130 | void openAllArtistsFromGenre(const QString &genreName); | 134 | void openAllArtistsFromGenre(const QString &genreName); | ||
131 | 135 | | |||
132 | void recentlyPlayedTracksIsLoaded(); | 136 | void recentlyPlayedTracksIsLoaded(); | ||
Show All 13 Lines | |||||
146 | void allGenresViewIsLoaded(); | 150 | void allGenresViewIsLoaded(); | ||
147 | 151 | | |||
148 | void allArtistsFromGenreViewIsLoaded(); | 152 | void allArtistsFromGenreViewIsLoaded(); | ||
149 | 153 | | |||
150 | void filesBrowserViewIsLoaded(); | 154 | void filesBrowserViewIsLoaded(); | ||
151 | 155 | | |||
152 | void contextViewIsLoaded(); | 156 | void contextViewIsLoaded(); | ||
153 | 157 | | |||
158 | void radiosBrowserViewIsLoaded(); | ||||
159 | | ||||
154 | QString mCurrentAlbumTitle; | 160 | QString mCurrentAlbumTitle; | ||
155 | QString mCurrentAlbumAuthor; | 161 | QString mCurrentAlbumAuthor; | ||
156 | QString mCurrentArtistName; | 162 | QString mCurrentArtistName; | ||
157 | QString mCurrentGenreName; | 163 | QString mCurrentGenreName; | ||
158 | 164 | | |||
159 | QString mTargetAlbumTitle; | 165 | QString mTargetAlbumTitle; | ||
160 | QString mTargetAlbumAuthor; | 166 | QString mTargetAlbumAuthor; | ||
161 | QString mTargetArtistName; | 167 | QString mTargetArtistName; | ||
Show All 10 Lines |
Please do not use a bool but a named constant (from an enum).
And yes, there is a bool before your modification and that is an error (from me).
See https://ariya.io/2011/08/hall-of-api-shame-boolean-trap for a good explanation.