Changeset View
Changeset View
Standalone View
Standalone View
src/android/androidmusiclistener.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2018 Matthieu Gallien <matthieu_gallien@yahoo.fr> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Library General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 3 of the License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This library is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | * Library General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Library General Public License | ||||
15 | * along with this library; see the file COPYING.LIB. If not, write to | ||||
16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
17 | * Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #ifndef ANDROIDMUSICLISTENER_H | ||||
21 | #define ANDROIDMUSICLISTENER_H | ||||
22 | | ||||
23 | #include "notificationitem.h" | ||||
24 | | ||||
25 | #include <QObject> | ||||
26 | #include <QList> | ||||
27 | #include <QHash> | ||||
28 | #include <QUrl> | ||||
29 | #include <QString> | ||||
30 | | ||||
31 | #include <memory> | ||||
32 | | ||||
33 | class DatabaseInterface; | ||||
34 | class MusicAudioTrack; | ||||
35 | class AndroidMusicListenerPrivate; | ||||
36 | | ||||
37 | class AndroidMusicListener : public QObject | ||||
38 | { | ||||
39 | | ||||
40 | Q_OBJECT | ||||
41 | | ||||
42 | Q_PROPERTY(DatabaseInterface* databaseInterface | ||||
43 | READ databaseInterface | ||||
44 | WRITE setDatabaseInterface | ||||
45 | NOTIFY databaseInterfaceChanged) | ||||
46 | | ||||
47 | public: | ||||
48 | | ||||
49 | explicit AndroidMusicListener(QObject *parent = nullptr); | ||||
50 | | ||||
51 | ~AndroidMusicListener() override; | ||||
52 | | ||||
53 | DatabaseInterface* databaseInterface() const; | ||||
54 | | ||||
55 | static void registerNativeMethods(); | ||||
56 | | ||||
57 | static AndroidMusicListener* currentInstance(); | ||||
58 | | ||||
59 | void androidMusicTracksScanStarted(); | ||||
60 | | ||||
61 | void newMusicTrack(const QString &trackDescription); | ||||
62 | | ||||
63 | void androidMusicTracksScanFinished(); | ||||
64 | | ||||
65 | void androidMusicAlbumsScanStarted(); | ||||
66 | | ||||
67 | void newMusicAlbum(const QString &albumDescription); | ||||
68 | | ||||
69 | void androidMusicAlbumsScanFinished(); | ||||
70 | | ||||
71 | Q_SIGNALS: | ||||
72 | | ||||
73 | void databaseInterfaceChanged(); | ||||
74 | | ||||
75 | void indexingStarted(); | ||||
76 | | ||||
77 | void indexingFinished(); | ||||
78 | | ||||
79 | void clearDatabase(const QString &listenerName); | ||||
80 | | ||||
81 | void newNotification(NotificationItem notification); | ||||
82 | | ||||
83 | void closeNotification(QString notificationId); | ||||
84 | | ||||
85 | void tracksList(const QList<MusicAudioTrack> &tracks, const QHash<QString, QUrl> &covers, const QString &musicSource); | ||||
86 | | ||||
87 | void removedTracksList(const QList<QUrl> &removedTracks); | ||||
88 | | ||||
89 | void modifyTracksList(const QList<MusicAudioTrack> &modifiedTracks, const QHash<QString, QUrl> &covers, const QString &musicSource); | ||||
90 | | ||||
91 | void askRestoredTracks(const QString &musicSource); | ||||
92 | | ||||
93 | public Q_SLOTS: | ||||
94 | | ||||
95 | void setDatabaseInterface(DatabaseInterface* databaseInterface); | ||||
96 | | ||||
97 | void applicationAboutToQuit(); | ||||
98 | | ||||
99 | void quitListener(); | ||||
100 | | ||||
101 | void restoredTracks(const QString &musicSource, QHash<QUrl, QDateTime> allFiles); | ||||
102 | | ||||
103 | void init(); | ||||
104 | | ||||
105 | private: | ||||
106 | | ||||
107 | static AndroidMusicListener* mCurrentInstance; | ||||
108 | | ||||
109 | std::unique_ptr<AndroidMusicListenerPrivate> d; | ||||
110 | | ||||
111 | }; | ||||
112 | | ||||
113 | #endif // ANDROIDMUSICLISTENER_H |