Changeset View
Changeset View
Standalone View
Standalone View
src/lyrics/LyricsManager.h
- This file was added.
1 | /**************************************************************************************** | ||||
---|---|---|---|---|---|
2 | * Copyright (c) 2007 Leo Franchi <lfranchi@kde.org> * | ||||
3 | * * | ||||
4 | * This program is free software; you can redistribute it and/or modify it under * | ||||
5 | * the terms of the GNU General Public License as published by the Free Software * | ||||
6 | * Foundation; either version 2 of the License, or (at your option) any later * | ||||
7 | * version. * | ||||
8 | * * | ||||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY * | ||||
10 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * | ||||
11 | * PARTICULAR PURPOSE. See the GNU General Public License for more details. * | ||||
12 | * * | ||||
13 | * You should have received a copy of the GNU General Public License along with * | ||||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. * | ||||
15 | ****************************************************************************************/ | ||||
16 | | ||||
17 | #ifndef LYRICS_MANAGER_H | ||||
18 | #define LYRICS_MANAGER_H | ||||
19 | | ||||
20 | #include "amarok_export.h" | ||||
21 | #include "core/meta/Meta.h" | ||||
22 | #include "network/NetworkAccessManagerProxy.h" | ||||
23 | | ||||
24 | #include <QMap> | ||||
25 | #include <QStringList> | ||||
26 | #include <QUrl> | ||||
27 | #include <QVariant> | ||||
28 | | ||||
29 | | ||||
30 | class AMAROK_EXPORT LyricsManager : public QObject | ||||
31 | { | ||||
32 | Q_OBJECT | ||||
33 | | ||||
34 | public: | ||||
35 | static LyricsManager* instance() | ||||
36 | { | ||||
37 | if( !s_self ) | ||||
38 | s_self = new LyricsManager(); | ||||
39 | | ||||
40 | return s_self; | ||||
41 | } | ||||
42 | | ||||
43 | /** | ||||
44 | * Tests if the given lyrics are empty. | ||||
45 | * | ||||
46 | * @param lyrics The lyrics which will be tested. | ||||
47 | * | ||||
48 | * @return true if the given lyrics are empty, otherwise false. | ||||
49 | */ | ||||
50 | bool isEmpty( const QString &lyrics ) const; | ||||
51 | | ||||
52 | void newTrack( Meta::TrackPtr track ); | ||||
53 | void lyricsResult( const QByteArray& lyrics, Meta::TrackPtr track ); | ||||
54 | void lyricsLoaded( const QUrl &url, const QByteArray &data, NetworkAccessManagerProxy::Error err ); | ||||
55 | void loadLyrics( Meta::TrackPtr track, bool overwrite = false ); | ||||
56 | | ||||
57 | signals: | ||||
58 | void newLyrics( Meta::TrackPtr ); | ||||
59 | void newSuggestions( QVariantList ); | ||||
60 | void error( QString ); | ||||
61 | | ||||
62 | private: | ||||
63 | LyricsManager(); | ||||
64 | | ||||
65 | void sanitizeTitle( QString &title ); | ||||
66 | void sanitizeArtist( QString &artist ); | ||||
67 | | ||||
68 | static LyricsManager* s_self; | ||||
69 | | ||||
70 | QMap<QUrl, Meta::TrackPtr> m_trackMap; | ||||
71 | }; | ||||
72 | | ||||
73 | #endif |