Canorus  0.0
muselement.h
Go to the documentation of this file.
1 
8 #ifndef MUSELEMENT_H_
9 #define MUSELEMENT_H_
10 
11 #include <QString>
12 #include <QList>
13 #include <QColor>
14 
15 class CAContext;
16 class CAMusElement;
17 class CAPlayable;
18 class CAMark;
19 class CANoteCheckerError;
20 
21 class CAMusElement {
22 public:
24  Undefined = 0,
38  };
39 
41  virtual ~CAMusElement();
42 
43  virtual CAMusElement* clone(CAContext* context=0) = 0;
44  virtual int compare(CAMusElement *elt) = 0;
45 
47 
48  inline CAContext *context() { return _context; }
50 
51  inline virtual int timeStart() const { return _timeStart; }
52  inline void setTimeStart(int time) { _timeStart = time; }
53  inline virtual int timeLength() const { return _timeLength; }
54  inline void setTimeLength(int length) { _timeLength = length; }
55  inline int timeEnd() { return timeStart() + timeLength(); }
56 
57  inline virtual int realTimeStart() { return _timeStart; } // TODO: calculates and returns time in miliseconds
58  inline virtual int realTimeLength() { return _timeLength; } // TODO: calculates and returns time in miliseconds
59  inline int realTimeEnd() { return realTimeStart() + realTimeLength(); } // TODO: calculates and returns time in miliseconds
60 
61  inline const QString name() { return _name; }
62  inline void setName(const QString name) { _name = name; }
63 
64  inline const bool isVisible() { return _visible; }
65  inline void setVisible( const bool v ) { _visible = v; }
66 
67  inline const QColor color() { return _color; }
68  inline void setColor( const QColor c ) { _color = c; }
69 
70  inline const QList<CAMark*> markList() { return _markList; }
71  void addMark( CAMark *mark );
72  void addMarks( QList<CAMark*> marks );
73  inline void removeMark( CAMark* mark ) { _markList.removeAll(mark); }
74 
75  inline const QList<CANoteCheckerError*>& noteCheckerErrorList() { return _noteCheckerErrorList; };
77  inline void removeNoteCheckerError( CANoteCheckerError* nce ) { _noteCheckerErrorList.removeAll(nce); }
78 
79  bool isPlayable();
80 
81  static const QString musElementTypeToString(CAMusElementType);
82  static CAMusElementType musElementTypeFromString(const QString);
83 
84 protected:
85  inline void setMusElementType( CAMusElementType type ) { _musElementType = type; }
86 
88  QList< CAMark* > _markList;
89  QList< CANoteCheckerError* > _noteCheckerErrorList;
93  bool _visible;
94  QColor _color;
95  QString _name;
96 };
97 #endif /* MUSELEMENT_H_ */
void setColor(const QColor c)
Definition: muselement.h:68
CAContext * _context
Definition: muselement.h:90
virtual ~CAMusElement()
Definition: muselement.cpp:52
Definition: muselement.h:36
const bool isVisible()
Definition: muselement.h:64
virtual int timeStart() const
Definition: muselement.h:51
bool _visible
Definition: muselement.h:93
void removeMark(CAMark *mark)
Definition: muselement.h:73
void setTimeLength(int length)
Definition: muselement.h:54
bool isPlayable()
Definition: muselement.cpp:78
static CAMusElementType musElementTypeFromString(const QString)
Definition: muselement.cpp:114
void addNoteCheckerError(CANoteCheckerError *nce)
Definition: muselement.h:76
void removeNoteCheckerError(CANoteCheckerError *nce)
Definition: muselement.h:77
void setName(const QString name)
Definition: muselement.h:62
static const QString musElementTypeToString(CAMusElementType)
Definition: muselement.cpp:88
Marks that depend on other music elements.
Definition: mark.h:15
Definition: muselement.h:35
virtual int compare(CAMusElement *elt)=0
CAMusElementType _musElementType
Definition: muselement.h:87
Definition: muselement.h:31
Definition: muselement.h:30
int _timeStart
Definition: muselement.h:91
void addMark(CAMark *mark)
Definition: muselement.cpp:135
QColor _color
Definition: muselement.h:94
const QList< CAMark * > markList()
Definition: muselement.h:70
int _timeLength
Definition: muselement.h:92
Definition: muselement.h:28
CAMusElementType
Definition: muselement.h:23
CAMusElementType musElementType()
Definition: muselement.h:46
CAMusElement(CAContext *context, int timeStart, int timeLength=0)
Definition: muselement.cpp:39
QString _name
Definition: muselement.h:95
const QList< CANoteCheckerError * > & noteCheckerErrorList()
Definition: muselement.h:75
int timeEnd()
Definition: muselement.h:55
QList< CAMark * > _markList
Definition: muselement.h:88
Definition: muselement.h:34
Definition: muselement.h:27
Definition: muselement.h:33
An abstract class which represents every music element in the score.
Definition: muselement.h:21
virtual int realTimeStart()
Definition: muselement.h:57
void setMusElementType(CAMusElementType type)
Definition: muselement.h:85
QList< CANoteCheckerError * > _noteCheckerErrorList
Definition: muselement.h:89
Definition: muselement.h:25
Class representing the error produced by the note checker.
Definition: notecheckererror.h:13
Playable instances of music elements.
Definition: playable.h:18
void setVisible(const bool v)
Definition: muselement.h:65
Definition: muselement.h:32
int realTimeEnd()
Definition: muselement.h:59
Definition: muselement.h:26
void addMarks(QList< CAMark * > marks)
Definition: muselement.cpp:153
Definition: muselement.h:29
const QString name()
Definition: muselement.h:61
Definition: muselement.h:24
Definition: muselement.h:37
CAContext * context()
Definition: muselement.h:48
virtual CAMusElement * clone(CAContext *context=0)=0
void setTimeStart(int time)
Definition: muselement.h:52
const QColor color()
Definition: muselement.h:67
virtual int realTimeLength()
Definition: muselement.h:58
virtual int timeLength() const
Definition: muselement.h:53
Line of music elements in the sheet.
Definition: context.h:16
void setContext(CAContext *context)
Definition: muselement.h:49