![]() |
Mixxx
|
00001 // cuedao.h 00002 // Created 10/26/2009 by RJ Ryan (rryan@mit.edu) 00003 00004 #ifndef CUEDAO_H 00005 #define CUEDAO_H 00006 00007 #include <QMap> 00008 #include <QSqlDatabase> 00009 00010 #include "trackinfoobject.h" 00011 #include "library/dao/dao.h" 00012 00013 #define CUE_TABLE "cues" 00014 00015 class Cue; 00016 00017 class CueDAO : public DAO { 00018 public: 00019 CueDAO(QSqlDatabase& database); 00020 virtual ~CueDAO(); 00021 void setDatabase(QSqlDatabase& database) { m_database = database; }; 00022 00023 void initialize(); 00024 int cueCount(); 00025 int numCuesForTrack(int trackId); 00026 Cue* getCue(int cueId); 00027 QList<Cue*> getCuesForTrack(int trackId) const; 00028 bool deleteCuesForTrack(int trackId); 00029 bool saveCue(Cue* cue); 00030 bool deleteCue(Cue* cue); 00031 // TODO(XXX) once we refer to all tracks by their id and TIO has a getId() 00032 // method the first parameter here won't be necessary. 00033 void saveTrackCues(int trackId, TrackInfoObject*); 00034 private: 00035 Cue* cueFromRow(QSqlQuery& query) const; 00036 00037 QSqlDatabase& m_database; 00038 mutable QMap<int, Cue*> m_cues; 00039 }; 00040 00041 #endif /* CUEDAO_H */