Debian Codegraph @

src/track.h

raw symbols SCIP
1 /*
2 Copyright (C) 2005-2014 Mario Stephan <[email protected]>
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program 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.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef TRACK_H
19 #define TRACK_H
20
21
22 #include <QUrl>
23 #include <QImage>
24 #include <QStringList>
25
26 #define TAGLIB_STATIC
27
28 class PlaylistItem;
29
30
31 namespace TagLib { class AudioProperties; class Tag; }
32
33
34 class Track
35 {
36
37 public:
38
39 enum Option {
40 NoOptions = 0x0,
41 isOnFirstPlayer = 0x1,
42 isOnSecondPlayer = 0x2,
43 isAutoDjSelection = 0x4
44 };
45 Q_DECLARE_FLAGS(Options, Option)
46
47 Track();
48 Track( const QUrl &u);
49 Track( const QStringList& list );
50 Track( const PlaylistItem *item );
51 ~Track();
52
53 static QStringList tagNameList;
54
55 QImage coverImage();
56 QImage defaultImage();
57
58 bool operator==(Track* track);
59 bool containIn(QList<Track*> list );
60
61 QUrl url();
62 QString title();
63 QString artist();
64 QString album();
65 QString year();
66 QString comment();
67 QString genre();
68 int length();
69 int counter();
70 int rate();
71 QString tracknumber();
72 QString prettyLength();
73 QStringList tagList();
74 QString dirPath();
75 Track::Options flags();
76
77 bool isValid();
78
79 void setUrl(QUrl);
80 void setTitle(QString);
81 void setArtist(QString);
82 void setAlbum(QString);
83 void setYear(QString);
84 void setComment(QString);
85 void setGenre(QString);
86 void setTracknumber(QString);
87 void setLength(QString);
88 void setLengthFromPretty(QString);
89 void setCounter(QString);
90 void setRate(int);
91 void setFlags(Track::Options flags);
92
93
94 QString prettyTitle() const;
95 QString prettyArtist(int) const;
96 QString prettyTitle(int) const;
97
98 static QString prettyLength( int );
99 static QString prettyTime( int, bool showHours = true );
100 static QString zeroPad( uint i ) { return ( i < 10 ) ? QString( "0%1" ).arg( i ) : QString::number( i ); }
101 static QString prettyTitle( QString );
102
103 protected:
104
105 QString rsqueeze( const QString&, int ) const;
106 void readTags();
107
108 private:
109
110 struct TrackPrivate *p;
111
112 };
113 Q_DECLARE_OPERATORS_FOR_FLAGS(Track::Options)
114 #endif