Debian Codegraph @

src/modules/GLErrorHistory.h

raw
1 // Copyright 2004 "Gilles Degottex"
2
3 // This file is part of "fmit"
4
5 // "fmit" is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // "fmit" is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19
20
21 #ifndef _GLErrorHistory_h_
22 #define _GLErrorHistory_h_
23
24 #include <deque>
25 using namespace std;
26 #include <QOpenGLWidget>
27 #include <qspinbox.h>
28 #include <qsettings.h>
29 #include <qaction.h>
30 class QTimer;
31 #include <Music/Music.h>
32 #include "View.h"
33
34 class GLErrorHistory : public QOpenGLWidget, public View
35 {
36 Q_OBJECT
37
38 virtual void mouseReleaseEvent(QMouseEvent* e){View::mouseReleaseEvent(e);}
39
40 QFont m_font;
41
42 void drawTicksCent(int r, int ticks_size);
43 void drawTextTickCent(int r, int dy);
44
45 public:
46 GLErrorHistory(QWidget* parent);
47
48 struct Note
49 {
50 int ht;
51 QString factor;
52 float min_err;
53 float max_err;
54 float avg_err;
55 deque<float> errors;
56 void init();
57 Note(int h);
58 Note(int h, int num, int den);
59 Note(int h, float cents);
60 void addError(float err);
61 QString getName() const;
62 };
63 deque<Note> m_notes;
64 void addNote(GLErrorHistory::Note note);
65 void addError(float err);
66
67 // settings
68 QAction* setting_keep;
69 QAction* setting_useCents;
70 QAction* setting_autoScroll;
71 QSpinBox* setting_spinScale;
72 QSpinBox* setting_hScale;
73 virtual void save();
74 virtual void load();
75 virtual void clearSettings();
76
77 public slots:
78 void initializeGL();
79 void paintGL();
80 void resizeGL( int w, int h );
81 // void paintEvent(QPaintEvent * event);
82 void keepPreviousNotes(bool keep);
83 void autoScroll(bool autoScroll);
84 };
85
86 #endif // _GLErrorHistory_h_
87