Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
chord.hh
Go to the documentation of this file.
1 // Copyright (C) 2009-2012, Romain Goffe <romain.goffe@gmail.com>
2 // Copyright (C) 2009-2012, Alexandre Dupas <alexandre.dupas@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301, USA.
18 //******************************************************************************
19 #ifndef __CHORD_HH__
20 #define __CHORD_HH__
21 
22 #include <QObject>
23 #include <QString>
24 #include <QPixmap>
25 #include <QSize>
26 #include <QBrush>
27 #include <QRegExp>
28 
29 
30 class QPainter;
31 
56 class CChord : public QObject
57 {
58  Q_OBJECT
59 
60  public:
65  enum StringCount {
68  };
69 
74  enum Instrument {
77  };
78 
80  CChord(const QString & chord = "\\gtab{}{0:}", QObject *parent = 0);
81 
83  ~CChord();
84 
90  bool isValid() const;
91 
96  QString toString();
97 
102  void fromString(const QString & gtab);
103 
108  QPixmap* toPixmap();
109 
116  QString name() const;
117 
122  void setName(const QString & name);
123 
130  QString fret() const;
131 
136  void setFret(const QString & fret);
137 
144  QString strings() const;
145 
150  void setStrings(const QString & strings);
151 
158  Instrument instrument() const;
159 
164  void setInstrument(const Instrument & instrument);
165 
172  bool isImportant() const;
173 
178  void setImportant(bool value);
179 
186  QColor color();
187 
193  void setDrawBorder(bool value);
194 
195 private:
196  void fillEllipse(QPainter* painter, const QRect & rect, const QBrush & brush);
197 
198  Instrument m_instrument;
199  QString m_name;
200  QString m_fret;
201  QString m_strings;
202  bool m_important;
203  bool m_isValid;
204  bool m_drawBorder;
205  QPixmap *m_pixmap;
206 
207  static QRegExp reChordWithFret;
208  static QRegExp reChordWithoutFret;
209 };
210 #endif // __CHORD_HH__