Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/library/dao/cue.cpp

Go to the documentation of this file.
00001 // cue.cpp
00002 // Created 10/26/2009 by RJ Ryan (rryan@mit.edu)
00003 
00004 #include <QMutexLocker>
00005 #include <QtDebug>
00006 
00007 #include "library/dao/cue.h"
00008 
00009 Cue::~Cue() {
00010     qDebug() << "~Cue()" << m_iId;
00011 }
00012 
00013 Cue::Cue(int trackId)
00014         : m_bDirty(false),
00015           m_iId(-1),
00016           m_iTrackId(trackId),
00017           m_type(INVALID),
00018           m_iPosition(-1),
00019           m_iLength(0),
00020           m_iHotCue(-1),
00021           m_label("") {
00022     //qDebug() << "Cue(int)";
00023 }
00024 
00025 
00026 Cue::Cue(int id, int trackId, Cue::CueType type, int position, int length,
00027          int hotCue, QString label)
00028         : m_bDirty(false),
00029           m_iId(id),
00030           m_iTrackId(trackId),
00031           m_type(type),
00032           m_iPosition(position),
00033           m_iLength(length),
00034           m_iHotCue(hotCue),
00035           m_label(label) {
00036     //qDebug() << "Cue(...)";
00037 }
00038 
00039 int Cue::getId() {
00040     QMutexLocker lock(&m_mutex);
00041     int id = m_iId;
00042     return id;
00043 }
00044 
00045 void Cue::setId(int cueId) {
00046     QMutexLocker lock(&m_mutex);
00047     m_iId = cueId;
00048     m_bDirty = true;
00049     lock.unlock();
00050     emit(updated());
00051 }
00052 
00053 int Cue::getTrackId() {
00054     QMutexLocker lock(&m_mutex);
00055     int trackId = m_iTrackId;
00056     return trackId;
00057 }
00058 
00059 void Cue::setTrackId(int trackId) {
00060     QMutexLocker lock(&m_mutex);
00061     m_iTrackId = trackId;
00062     m_bDirty = true;
00063     lock.unlock();
00064     emit(updated());
00065 }
00066 
00067 Cue::CueType Cue::getType() {
00068     QMutexLocker lock(&m_mutex);
00069     Cue::CueType type = m_type;
00070     return type;
00071 }
00072 
00073 void Cue::setType(Cue::CueType type) {
00074     QMutexLocker lock(&m_mutex);
00075     m_type = type;
00076     m_bDirty = true;
00077     lock.unlock();
00078     emit(updated());
00079 }
00080 
00081 int Cue::getPosition() {
00082     QMutexLocker lock(&m_mutex);
00083     int position = m_iPosition;
00084     return position;
00085 }
00086 
00087 void Cue::setPosition(int position) {
00088     QMutexLocker lock(&m_mutex);
00089     Q_ASSERT(position % 2 == 0);
00090     m_iPosition = position;
00091     m_bDirty = true;
00092     lock.unlock();
00093     emit(updated());
00094 }
00095 
00096 int Cue::getLength() {
00097     QMutexLocker lock(&m_mutex);
00098     int length = m_iLength;
00099     return length;
00100 }
00101 
00102 void Cue::setLength(int length) {
00103     QMutexLocker lock(&m_mutex);
00104     Q_ASSERT(length % 2 == 0);
00105     m_iLength = length;
00106     m_bDirty = true;
00107     lock.unlock();
00108     emit(updated());
00109 }
00110 
00111 int Cue::getHotCue() {
00112     QMutexLocker lock(&m_mutex);
00113     int hotCue = m_iHotCue;
00114     return hotCue;
00115 }
00116 
00117 void Cue::setHotCue(int hotCue) {
00118     QMutexLocker lock(&m_mutex);
00119     // TODO(XXX) enforce uniqueness?
00120     m_iHotCue = hotCue;
00121     m_bDirty = true;
00122     lock.unlock();
00123     emit(updated());
00124 }
00125 
00126 const QString Cue::getLabel() {
00127     QMutexLocker lock(&m_mutex);
00128     QString label = m_label;
00129     lock.unlock();
00130     return label;
00131 }
00132 
00133 void Cue::setLabel(const QString label) {
00134     //qDebug() << "setLabel()" << m_label << "-" << label;
00135     QMutexLocker lock(&m_mutex);
00136     m_label = label;
00137     m_bDirty = true;
00138     lock.unlock();
00139     emit(updated());
00140 }
00141 
00142 bool Cue::isDirty() {
00143     QMutexLocker lock(&m_mutex);
00144     bool dirty = m_bDirty;
00145     return dirty;
00146 }
00147 
00148 void Cue::setDirty(bool dirty) {
00149     QMutexLocker lock(&m_mutex);
00150     m_bDirty = dirty;
00151 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines