Revert previous commit, was incorrect
[amarok.git] / src / cuefile.h
blob6bb2648c3d71a84e483c07aa8bf185b534039946
1 // (c) 2005 Martin Ehmke <ehmke@gmx.de>
2 // License: GNU General Public License V2
4 #ifndef CUEFILE_H
5 #define CUEFILE_H
7 #include "engineobserver.h"
9 #include <QMap>
10 #include <QObject>
11 #include <QString>
14 class CueFileItem {
15 public:
16 CueFileItem (const QString& title, const QString& artist, const QString& album, const int trackNumber, const long index)
17 : m_title( title )
18 , m_artist( artist )
19 , m_album( album )
20 , m_trackNumber( trackNumber )
21 , m_index( index )
22 , m_length( -1 )
26 CueFileItem () {}
28 void setLength(const long length) { m_length = length; }
30 const QString getTitle () const { return m_title; }
31 const QString getArtist () const { return m_artist; }
32 const QString getAlbum () const { return m_album; }
33 const int getTrackNumber () const { return m_trackNumber; }
34 const long getIndex () const { return m_index; }
35 const long getLength () const { return m_length; }
37 private:
38 QString m_title;
39 QString m_artist;
40 QString m_album;
41 int m_trackNumber;
42 long m_index;
43 long m_length;
46 // <<Singleton>>
47 class CueFile : public QObject, public QMap<long, CueFileItem>, public EngineObserver
49 Q_OBJECT
51 public:
52 static CueFile *instance();
54 void setCueFileName( QString name ) { m_cueFileName = name; }
55 bool load(int mediaLength);
57 // EngineObserver
58 virtual void engineTrackPositionChanged( long /*position*/ , bool /*userSeek*/ );
60 signals:
61 /** Transmits new metadata bundle */
62 void metaData( const MetaBundle& );
63 /** Transmits new length information associated with current cue */
64 void newCuePoint( long currentPos, long startPos, long endPos );
66 protected:
67 CueFile() : EngineObserver(), m_lastSeekPos(-1) { }
68 CueFile(EngineSubject *s) : EngineObserver(s), m_lastSeekPos(-1) { }
69 ~CueFile();
71 private:
72 QString m_cueFileName;
73 int m_lastSeekPos; // in seconds
77 #endif