Debian Codegraph @

src/modules/GLStatistics.h

raw
1 // Copyright 2007 "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 _GLStatistics_h_
22 #define _GLStatistics_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 GLStatistics : public QOpenGLWidget, public View
35 {
36 Q_OBJECT
37
38 QFont m_font;
39
40 virtual void mouseReleaseEvent(QMouseEvent* e){View::mouseReleaseEvent(e);}
41
42 void drawTicksCent(int r, int dx, int dy);
43 void drawTextTickCent(int r, int dx);
44
45 public:
46 GLStatistics(QWidget* parent);
47
48 struct AverageNote
49 {
50 int ht;
51 deque<float> errs;
52 float err_mean;
53 float err_std;
54
55 void addErr(float err);
56
57 void init();
58 AverageNote();
59 AverageNote(int h);
60 AverageNote(int h, int num, int den);
61 AverageNote(int h, float cents);
62 QString factor;
63 QString getName() const;
64 };
65 vector<AverageNote> m_avg_notes;
66 void addNote(int ht, float err);
67 void addNote(int ht, int num, int den, float err);
68 void addNote(int ht, float cents, float err);
69 int m_current_ht;
70
71 // settings
72 QAction* setting_reset;
73 QAction* setting_keep_hidden;
74 QSpinBox* setting_keep_n_values;
75 QAction* setting_show_std;
76 QAction* setting_scale_auto;
77 QSpinBox* setting_scale_min;
78 QSpinBox* setting_scale_max;
79 QAction* setting_showTolerance;
80 QAction* setting_useCents;
81 QSpinBox* setting_spinScale;
82 virtual void save();
83 virtual void load();
84 virtual void clearSettings();
85
86 public slots:
87 void initializeGL();
88 void paintGL();
89 void resizeGL( int w, int h );
90
91 void reset();
92 void resizeScale();
93 };
94
95 #endif // _GLErrorHistory_h_