Revert previous commit, was incorrect
[amarok.git] / src / tagdialog.h
blobd058219846fdf7eea7420976fcd6d4fd2fe86447
1 // (c) 2004 Mark Kretschmann <markey@web.de>
2 // (c) 2004 Pierpaolo Di Panfilo <pippo_dp@libero.it>
3 // (c) 2005 Alexandre Pereira de Oliveira <aleprj@gmail.com>
4 // See COPYING file for licensing information.
6 #ifndef AMAROK_TAGDIALOG_H
7 #define AMAROK_TAGDIALOG_H
9 #include "config-amarok.h"
11 #include "ktrm.h"
12 #include "metabundle.h" //stack alloc
13 #include "playlist/PlaylistItem.h"
14 #include "tagdialogbase.h" //baseclass
16 #include "meta/Meta.h"
18 #include <khtml_part.h>
19 #include <KUrl> //stack alloc
21 #include <QDateTime>
22 #include <QLabel>
23 #include <QMap>
24 #include <QtGui/QWidget>
27 namespace TagLib {
28 namespace ID3v2 {
29 class Tag;
33 class TagDialog : public TagDialogBase
35 Q_OBJECT
37 public:
39 enum Changes { NOCHANGE=0, SCORECHANGED=1, TAGSCHANGED=2, LYRICSCHANGED=4, RATINGCHANGED=8, LABELSCHANGED=16 };
40 enum Tabs { SUMMARYTAB, TAGSTAB, LYRICSTAB, STATSTAB, LABELSTAB };
42 explicit TagDialog( const KUrl& url, QWidget* parent = 0 );
43 explicit TagDialog( const KUrl::List list, QWidget* parent = 0 );
44 TagDialog( const MetaBundle& mb, Playlist::Item* item, QWidget* parent = 0 );
45 explicit TagDialog( const Meta::TrackList &tracks, QWidget *parent = 0 );
46 explicit TagDialog( Meta::TrackPtr track, QWidget *parent = 0 );
47 ~TagDialog();
49 void setTab( int id );
51 friend class TagSelect;
53 signals:
54 void lyricsChanged( const QString& );
56 public slots:
57 void openUrlRequest(const KUrl &url );
59 private slots:
60 void accept();
61 void cancelPressed();
62 void openPressed();
63 void previousTrack();
64 void nextTrack();
65 void perTrack();
66 void checkModified();
68 void loadCover( const QString &artist, const QString &album );
70 void musicbrainzQuery();
71 void guessFromFilename();
72 void setFileNameSchemes();
73 void queryDone( KTRMResultList results, QString error );
74 void fillSelected( KTRMResult selected );
75 void resetMusicbrainz();
77 private:
78 void init();
79 void readTags();
80 void readMultipleTracks();
81 void setMultipleTracksMode();
82 void setSingleTrackMode();
83 void enableItems();
84 bool hasChanged();
85 int changes();
86 void storeTags();
87 void storeTags( const KUrl& url );
88 void storeTags( const KUrl& url, int changes, const MetaBundle &mb );
89 void storeLabels( const KUrl &url, const QStringList &labels );
90 void loadTags( const KUrl& url );
91 void loadLyrics( const KUrl& url );
92 void loadLabels( const KUrl &url );
93 MetaBundle bundleForURL( const KUrl &url );
94 float scoreForURL( const KUrl &url );
95 int ratingForURL( const KUrl &url );
96 QString lyricsForURL( const KUrl &url );
97 QStringList labelsForURL( const KUrl &url );
98 QStringList getCommonLabels();
99 void saveTags();
100 bool writeTag( MetaBundle &mb, bool updateCB=true );
101 const QString unknownSafe( QString );
102 const QStringList statisticsData();
103 void applyToAllTracks();
105 const QStringList filenameSchemes();
107 QStringList labelListFromText( const QString &text );
108 void generateDeltaForLabelList( const QStringList &list );
109 QString generateHTML( const QStringList &labels );
111 MetaBundle m_bundle;
112 KUrl::List::iterator m_currentURL;
113 QString m_lyrics;
114 bool m_perTrack;
115 Playlist::Item* m_playlistItem;
116 QMap<QString, MetaBundle> storedTags;
117 QMap<QString, float> storedScores;
118 QMap<QString, int> storedRatings;
119 QMap<QString, QString> storedLyrics;
120 QMap<QString, QStringList> newLabels;
121 QMap<QString, QStringList> originalLabels;
122 KUrl::List m_urlList;
123 QString m_buttonMbText;
124 QString m_path;
125 QString m_currentCover;
126 QStringList m_labels;
127 QStringList m_addedLabels;
128 QStringList m_removedLabels;
129 KUrl m_mbTrack;
130 QString m_commaSeparatedLabels;
131 KHTMLPart *m_labelCloud;
132 //HTMLView *m_labelCloud;
134 //2.0 stuff
135 Meta::TrackList m_tracks;
136 Meta::TrackPtr m_currentTrack;
140 #endif /*AMAROK_TAGDIALOG_H*/