Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
diagram-area.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 __DIAGRAM_AREA_HH__
20 #define __DIAGRAM_AREA_HH__
21 
22 
23 #include <QWidget>
24 #include <QModelIndex>
25 #include <QString>
26 #include <QList>
27 #include <QPoint>
28 #include <QVector>
29 
30 #include "chord.hh"
31 
32 class QPushButton;
33 class QTableView;
34 class QSortFilterProxyModel;
35 class CChordTableModel;
36 
97 class CDiagramArea : public QWidget
98 {
99  Q_OBJECT
100 
101  public:
103  CDiagramArea(QWidget *parent=0);
104 
109  bool isReadOnly() const;
110 
115  void setReadOnly(bool value);
116 
121  void setColumnCount(int value);
122 
127  void setRowCount(int value);
128 
133  QList< CChord* > chords();
134 
135 public slots:
140  void newDiagram();
141 
146  void addDiagram(const QString & chord);
147 
153  void editDiagram(QModelIndex index = QModelIndex());
154 
160  void removeDiagram(QModelIndex index = QModelIndex());
161 
166  void setTypeFilter(const CChord::Instrument & type);
167 
172  void setNameFilter(const QString & name);
173 
178  void setStringsFilter(const QString & strings);
179 
184  void clearFilters();
185 
186 private slots:
187  void update();
188  void resizeRows();
189  void onDiagramChanged();
190  void contextMenu(const QPoint & pos);
191  void onViewClicked(const QModelIndex &);
192 
193 signals:
200  void contentsChanged();
201 
207  void layoutChanged();
208 
213  void readOnlyModeChanged();
214 
218  void diagramClicked(CChord * diagram);
219 
220 private:
221  bool m_isReadOnly;
222  CChordTableModel *m_diagramModel;
223  QSortFilterProxyModel *m_proxyModel;
224  QTableView *m_diagramView;
225  QPushButton *m_addDiagramButton;
226 };
227 
228 
229 #endif //__DIAGRAM_AREA_HH__