Changeset View
Changeset View
Standalone View
Standalone View
src/mediaplaylist.h
Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Line(s) | 75 | public: | |||
---|---|---|---|---|---|
157 | Q_INVOKABLE bool savePlaylist(const QUrl &fileName); | 157 | Q_INVOKABLE bool savePlaylist(const QUrl &fileName); | ||
158 | 158 | | |||
159 | QVariantMap persistentState() const; | 159 | QVariantMap persistentState() const; | ||
160 | 160 | | |||
161 | MusicListenersManager* musicListenersManager() const; | 161 | MusicListenersManager* musicListenersManager() const; | ||
162 | 162 | | |||
163 | int tracksCount() const; | 163 | int tracksCount() const; | ||
164 | 164 | | |||
165 | bool displayUndoInline() const; | ||||
166 | | ||||
mgallien: Better use isUndoDisplayedInline | |||||
165 | QPersistentModelIndex currentTrack() const; | 167 | QPersistentModelIndex currentTrack() const; | ||
166 | 168 | | |||
167 | int currentTrackRow() const; | 169 | int currentTrackRow() const; | ||
168 | 170 | | |||
169 | bool randomPlay() const; | 171 | bool randomPlay() const; | ||
170 | 172 | | |||
171 | bool repeatPlay() const; | 173 | bool repeatPlay() const; | ||
172 | 174 | | |||
173 | Q_SIGNALS: | 175 | Q_SIGNALS: | ||
176 | void displayUndoInline(); | ||||
177 | | ||||
178 | void hideUndoInline(); | ||||
174 | 179 | | |||
175 | void newTrackByNameInList(const QString &title, const QString &artist, const QString &album, int trackNumber, int discNumber); | 180 | void newTrackByNameInList(const QString &title, const QString &artist, const QString &album, int trackNumber, int discNumber); | ||
176 | 181 | | |||
177 | void newEntryInList(qulonglong newDatabaseId, | 182 | void newEntryInList(qulonglong newDatabaseId, | ||
178 | const QString &entryTitle, | 183 | const QString &entryTitle, | ||
179 | ElisaUtils::PlayListEntryType databaseIdType); | 184 | ElisaUtils::PlayListEntryType databaseIdType); | ||
180 | 185 | | |||
181 | void persistentStateChanged(); | 186 | void persistentStateChanged(); | ||
182 | 187 | | |||
183 | void musicListenersManagerChanged(); | 188 | void musicListenersManagerChanged(); | ||
184 | 189 | | |||
185 | void tracksCountChanged(); | 190 | void tracksCountChanged(); | ||
186 | 191 | | |||
187 | void currentTrackChanged(QPersistentModelIndex currentTrack); | 192 | void currentTrackChanged(QPersistentModelIndex currentTrack); | ||
188 | 193 | | |||
194 | void clearPlayListPlayer(); | ||||
195 | | ||||
196 | void undoClearPlayListPlayer(); | ||||
197 | | ||||
189 | void currentTrackRowChanged(); | 198 | void currentTrackRowChanged(); | ||
190 | 199 | | |||
191 | void randomPlayChanged(); | 200 | void randomPlayChanged(); | ||
192 | 201 | | |||
193 | void repeatPlayChanged(); | 202 | void repeatPlayChanged(); | ||
194 | 203 | | |||
195 | void playListFinished(); | 204 | void playListFinished(); | ||
196 | 205 | | |||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 257 | void enqueue(const ElisaUtils::EntryDataList &newEntries, | |||
251 | ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); | 260 | ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay); | ||
252 | 261 | | |||
253 | void replaceAndPlay(const ElisaUtils::EntryData &newEntry, ElisaUtils::PlayListEntryType databaseIdType); | 262 | void replaceAndPlay(const ElisaUtils::EntryData &newEntry, ElisaUtils::PlayListEntryType databaseIdType); | ||
254 | 263 | | |||
255 | void enqueueRestoredEntry(const MediaPlayListEntry &newEntry); | 264 | void enqueueRestoredEntry(const MediaPlayListEntry &newEntry); | ||
256 | 265 | | |||
257 | void trackInError(const QUrl &sourceInError, QMediaPlayer::Error playerError); | 266 | void trackInError(const QUrl &sourceInError, QMediaPlayer::Error playerError); | ||
258 | 267 | | |||
268 | Q_SCRIPTABLE void undoClearPlayList(); | ||||
269 | | ||||
As far as I know, Q_SCRIPTABLE is not necessary to call it from qml. Can you remove it ? mgallien: As far as I know, Q_SCRIPTABLE is not necessary to call it from qml. Can you remove it ? | |||||
259 | private Q_SLOTS: | 270 | private Q_SLOTS: | ||
260 | 271 | | |||
261 | void loadPlayListLoaded(); | 272 | void loadPlayListLoaded(); | ||
262 | 273 | | |||
263 | void loadPlayListLoadFailed(); | 274 | void loadPlayListLoadFailed(); | ||
264 | 275 | | |||
265 | private: | 276 | private: | ||
277 | void displayOrHideUndoInline(bool value); | ||||
278 | | ||||
279 | void clearPlayList(bool prepareUndo); | ||||
266 | 280 | | |||
267 | void resetCurrentTrack(); | 281 | void resetCurrentTrack(); | ||
268 | 282 | | |||
269 | void notifyCurrentTrackChanged(); | 283 | void notifyCurrentTrackChanged(); | ||
270 | 284 | | |||
271 | void restorePlayListPosition(); | 285 | void restorePlayListPosition(); | ||
272 | 286 | | |||
273 | void restoreRandomPlay(); | 287 | void restoreRandomPlay(); | ||
274 | 288 | | |||
275 | void restoreRepeatPlay(); | 289 | void restoreRepeatPlay(); | ||
276 | 290 | | |||
277 | void enqueueArtist(const QString &artistName); | 291 | void enqueueArtist(const QString &artistName); | ||
278 | 292 | | |||
279 | void enqueueFilesList(const ElisaUtils::EntryDataList &newEntries); | 293 | void enqueueFilesList(const ElisaUtils::EntryDataList &newEntries); | ||
280 | 294 | | |||
281 | void enqueueTracksListById(const ElisaUtils::EntryDataList &newEntries); | 295 | void enqueueTracksListById(const ElisaUtils::EntryDataList &newEntries); | ||
282 | 296 | | |||
283 | void enqueueOneEntry(const ElisaUtils::EntryData &entryData, ElisaUtils::PlayListEntryType type); | 297 | void enqueueOneEntry(const ElisaUtils::EntryData &entryData, ElisaUtils::PlayListEntryType type); | ||
284 | 298 | | |||
285 | void enqueueMultipleEntries(const ElisaUtils::EntryDataList &entriesData, ElisaUtils::PlayListEntryType type); | 299 | void enqueueMultipleEntries(const ElisaUtils::EntryDataList &entriesData, ElisaUtils::PlayListEntryType type); | ||
286 | 300 | | |||
301 | void enqueueCommon(); | ||||
302 | | ||||
303 | void copyD(); | ||||
304 | | ||||
287 | std::unique_ptr<MediaPlayListPrivate> d; | 305 | std::unique_ptr<MediaPlayListPrivate> d; | ||
288 | 306 | | |||
307 | std::unique_ptr<MediaPlayListPrivate> dOld; | ||||
289 | }; | 308 | }; | ||
290 | 309 | | |||
291 | class MediaPlayListEntry | 310 | class MediaPlayListEntry | ||
292 | { | 311 | { | ||
293 | public: | 312 | public: | ||
294 | 313 | | |||
295 | MediaPlayListEntry() = default; | 314 | MediaPlayListEntry() = default; | ||
296 | 315 | | |||
297 | explicit MediaPlayListEntry(qulonglong id) : mId(id), mIsValid(true) { | 316 | explicit MediaPlayListEntry(qulonglong id) : mId(id), mIsValid(true) { | ||
298 | } | 317 | } | ||
299 | 318 | | |||
300 | MediaPlayListEntry(QString title, QString artist, QString album, int trackNumber, int discNumber) | 319 | MediaPlayListEntry(QString title, QString artist, QString album, int trackNumber, int discNumber, ElisaUtils::PlayListEntryType entryType = ElisaUtils::Unknown) | ||
301 | : mTitle(std::move(title)), mAlbum(std::move(album)), mArtist(std::move(artist)), | 320 | : mTitle(std::move(title)), mAlbum(std::move(album)), mArtist(std::move(artist)), | ||
302 | mTrackNumber(trackNumber), mDiscNumber(discNumber) { | 321 | mTrackNumber(trackNumber), mDiscNumber(discNumber), mEntryType(entryType) { | ||
303 | } | 322 | } | ||
304 | 323 | | |||
305 | explicit MediaPlayListEntry(const MusicAudioTrack &track) | 324 | explicit MediaPlayListEntry(const MusicAudioTrack &track) | ||
306 | : mTitle(track.title()), mAlbum(track.albumName()), mTrackNumber(track.trackNumber()), | 325 | : mTitle(track.title()), mAlbum(track.albumName()), mTrackNumber(track.trackNumber()), | ||
307 | mDiscNumber(track.discNumber()), mId(track.databaseId()), mIsValid(true) { | 326 | mDiscNumber(track.discNumber()), mId(track.databaseId()), mIsValid(true) { | ||
308 | } | 327 | } | ||
309 | 328 | | |||
310 | explicit MediaPlayListEntry(const MediaPlayList::TrackDataType &track) | 329 | explicit MediaPlayListEntry(const MediaPlayList::TrackDataType &track) | ||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
Better use isUndoDisplayedInline