tooltip for playlist model
[jkt-jerboa.git] / include / TrackData.h
blob0ac41d4a5b454d04a6aa32f2e9ef59a58f6a448a
1 /* LICENSE NOTICE
2 This file is part of Jerboa.
4 Jerboa is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option), version 3 of the license.
9 Jerboa 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
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with Jerboa. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef _JERBOA_TRACKDATA_H
18 #define _JERBOA_TRACKDATA_H
20 #include <QString>
21 #include <QUrl>
22 #include <QVariant>
24 namespace Jerboa
26 class TrackDataPrivate;
27 /// Represents a track and all the information about it.
28 class TrackData
30 public:
31 /// Construct a TrackData object from the specified data.
32 TrackData(
33 const QUrl& url,
34 const QString& album,
35 const QString& albumArtist,
36 const QString& albumArtistRomanised,
37 const QString& artist,
38 const QString& artistRomanised,
39 const QString& title,
40 const QString& trackNumber,
41 const QString& albumRG,
42 const QString& trackRG,
43 const QString& musicBrainzID);
45 /** Construct a TrackData object from mime data.
46 * This should be in the text/x-jerboa-trackdata format.
47 * \see mimeData
49 TrackData(const QString& mimeData);
51 /// Copy constructor.
52 TrackData(const TrackData &);
54 /** Creates an invalid TrackData object.
55 * An object created with this constructor will have failed Q_ASSERTs on all of the members
56 * except \ref isValid, \ref operator==, \ref operator=, and \ref toMpris, unless it is
57 * reinitialised with operator=.
59 TrackData();
60 ~TrackData();
62 /** Compares two TrackData objects for equality.
63 * Two TrackData objects are equal if they are both invalid, or if they both have
64 * identical mime data.
66 bool operator==(const TrackData& other) const;
68 TrackData& operator=(const TrackData& other);
70 /// If the TrackData object is valid.
71 bool isValid() const;
72 const QUrl& url() const;
73 const QString& album() const;
74 const QString& albumArtist() const;
75 const QString& albumArtistRomanised() const;
76 const QString& artist() const;
77 const QString& artistRomanised() const;
78 const QString& title() const;
79 quint8 trackNumber() const;
81 qreal albumRG() const;
82 qreal trackRG() const;
83 const QString& musicBrainzID() const;
84 /** Mime data for this track.
85 * This is in the format text/x-jerboa-trackdata
87 const QString& mimeData() const;
88 /** MPRIS-formatted metadata.
89 * This returns all the data for this track in an a{sv} format, suitable for use with
90 * MPRIS's Player::GetMetadata call.
92 * If the TrackData object is invalid, it returns an empty map.
94 QVariantMap toMpris() const;
95 private:
96 TrackDataPrivate* d;
100 #endif