1 // Copyright 2004 "Gilles Degottex"
3 // This file is part of "fmit"
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.
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.
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
21 static const unsigned char g_icon_sample[] = {
22 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
23 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20,
24 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x05,
25 0xf4, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0xbd, 0x97, 0x7b, 0x4c, 0x53,
26 0x57, 0x1c, 0xc7, 0x3f, 0xf7, 0xb6, 0x45, 0x28, 0x30, 0x9e, 0xad, 0x83,
27 0x20, 0x54, 0x59, 0x7c, 0x4d, 0x2a, 0xc4, 0x81, 0x32, 0x61, 0xd9, 0xa6,
28 0x53, 0xa7, 0x7f, 0xcc, 0x39, 0x97, 0xa9, 0xd9, 0xe2, 0x96, 0xe8, 0x5e,
29 0xd9, 0xcc, 0x92, 0x6d, 0x71, 0x4b, 0x36, 0x71, 0x89, 0x71, 0x5b, 0xf6,
30 0x7e, 0xc5, 0x25, 0x2e, 0x3e, 0x92, 0xc5, 0xa9, 0x51, 0x36, 0x63, 0x34,
31 0x46, 0x74, 0xce, 0x21, 0x8f, 0x39, 0x03, 0x14, 0xd4, 0x55, 0x44, 0x10,
32 0x54, 0x1e, 0xe5, 0xd5, 0x16, 0xda, 0x52, 0x68, 0xef, 0xd9, 0x1f, 0xb7,
33 0x76, 0x20, 0x05, 0x04, 0x93, 0x7d, 0x93, 0x9b, 0x7b, 0xee, 0x39, 0xbf,
34 0x7b, 0xbe, 0xdf, 0x73, 0xee, 0xef, 0xfc, 0x7e, 0xbf, 0x2b, 0x71, 0xf7,
35 0xd0, 0x03, 0xd3, 0x81, 0x24, 0x20, 0x05, 0xf0, 0x02, 0x95, 0x80, 0x15,
36 0x18, 0x18, 0xc7, 0x3c, 0x43, 0x20, 0x8d, 0x31, 0x1e, 0x0d, 0x3c, 0x0f,
37 0xac, 0x07, 0xa6, 0x00, 0x3a, 0x20, 0x02, 0x88, 0x04, 0x7c, 0x40, 0x77,
38 0x80, 0xdc, 0x0d, 0x5c, 0x07, 0x8e, 0x01, 0x3f, 0x06, 0xc4, 0xdd, 0x93,
39 0x00, 0x09, 0x78, 0x19, 0xf8, 0x10, 0x48, 0x04, 0x26, 0x85, 0x87, 0x6b,
40 0x31, 0x3f, 0x98, 0x48, 0x96, 0xd9, 0x48, 0x96, 0xd9, 0x88, 0xdb, 0xe3,
41 0xa3, 0xaa, 0xda, 0x46, 0x85, 0xc5, 0x86, 0xf5, 0x6a, 0x17, 0x3e, 0x9f,
42 0x42, 0x80, 0xb8, 0x0d, 0xd8, 0x01, 0x7c, 0x06, 0xf8, 0x27, 0x22, 0x20,
43 0x0a, 0x28, 0x02, 0x1e, 0x04, 0xa2, 0x17, 0x2e, 0x48, 0x66, 0xdb, 0x07,
44 0x79, 0x64, 0xcc, 0x4e, 0x44, 0xa3, 0x51, 0xcd, 0xbd, 0x52, 0x02, 0x92,
45 0x18, 0x20, 0x0c, 0x27, 0x00, 0x7d, 0x7d, 0x3e, 0x8a, 0xcb, 0x6e, 0xb1,
46 0xb9, 0xa0, 0x98, 0x86, 0x46, 0x07, 0x80, 0x0b, 0xb8, 0x0c, 0xac, 0x00,
47 0xda, 0xc7, 0x23, 0x20, 0x01, 0x38, 0x0b, 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0x96, 0x23, 0x8a, 0xe3, 0x95,
63 0xe1, 0x3c, 0x97, 0xdb, 0x42, 0x47, 0x67, 0x1f, 0x15, 0x16, 0x9b, 0x84,
64 0x7a, 0x6a, 0xfe, 0x42, 0xfd, 0x24, 0x43, 0x20, 0x07, 0xee, 0x6f, 0x03,
65 0xc6, 0x25, 0x8f, 0xa7, 0xb1, 0x76, 0xf5, 0x4c, 0x9a, 0x35, 0xcb, 0xf1,
66 0xc8, 0xc9, 0xe3, 0x26, 0x07, 0xf0, 0x78, 0xfa, 0x39, 0x57, 0xed, 0xe6,
67 0x7c, 0xeb, 0x3c, 0x3e, 0x7a, 0x3f, 0x97, 0xa9, 0x69, 0x31, 0xa0, 0xfa,
68 0xd6, 0xf7, 0xa1, 0xec, 0xe5, 0xc0, 0xb5, 0x4e, 0x92, 0xd0, 0x7c, 0xb5,
69 0xfd, 0x51, 0x5c, 0x52, 0x2a, 0x2d, 0xf2, 0xe2, 0x09, 0x91, 0x03, 0x38,
70 0x7b, 0x3d, 0x80, 0x60, 0xe7, 0xd9, 0x64, 0x44, 0x58, 0x3c, 0x9f, 0x6c,
71 0x0d, 0xee, 0x7c, 0x02, 0x30, 0x6c, 0x55, 0x32, 0xea, 0x71, 0x0b, 0x9b,
72 0x66, 0x8a, 0x25, 0x39, 0x29, 0x8a, 0x56, 0xf9, 0x71, 0x90, 0x34, 0x77,
73 0xda, 0x8d, 0x53, 0x00, 0x74, 0x3b, 0x3d, 0x14, 0x5e, 0xce, 0xe1, 0xe1,
74 0xf9, 0xc9, 0x48, 0x52, 0x50, 0xc0, 0xb0, 0x95, 0xc9, 0x40, 0x1e, 0x10,
75 0x9f, 0x65, 0x36, 0x02, 0xe0, 0x92, 0x52, 0x27, 0x4c, 0x0e, 0xe0, 0xec,
76 0x71, 0x07, 0xdb, 0x75, 0xb6, 0x08, 0xa2, 0x22, 0x75, 0xa4, 0x4f, 0x8d,
77 0x05, 0x08, 0x03, 0x56, 0x85, 0x12, 0xf0, 0x30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, 0xf2, 0x53, 0x6b, 0x11, 0x51, 0xd3,
108 0xd9, 0x51, 0x96, 0x87, 0xf5, 0xba, 0x1d, 0x4f, 0x5f, 0xff, 0xa8, 0x84,
109 0x83, 0x11, 0xa6, 0x93, 0x28, 0x48, 0xff, 0x9d, 0x9c, 0x6d, 0x7b, 0x91,
110 0xac, 0x0e, 0x6c, 0x0f, 0xc5, 0x73, 0xff, 0x85, 0x2e, 0x84, 0x2a, 0xe0,
111 0x11, 0xa0, 0x6e, 0xb0, 0xbd, 0x3c, 0xa8, 0xbd, 0x06, 0x68, 0xb6, 0xb5,
112 0xbb, 0xd9, 0xf0, 0xe6, 0x49, 0x84, 0xb3, 0x96, 0x97, 0x32, 0x8f, 0x92,
113 0x14, 0x37, 0x66, 0x59, 0x17, 0xc4, 0xac, 0x14, 0xc1, 0x37, 0xcf, 0x9c,
114 0x25, 0xe7, 0xb3, 0xc3, 0x48, 0x56, 0x07, 0x00, 0xc6, 0xba, 0x5e, 0xf6,
115 0xbf, 0x38, 0x15, 0xd4, 0x6a, 0xba, 0x08, 0xb5, 0xc6, 0x0c, 0x62, 0x70,
116 0xd6, 0xf1, 0x00, 0x7f, 0x03, 0xcb, 0x1b, 0x1a, 0x9d, 0x51, 0xbf, 0x1c,
117 0xb2, 0x62, 0x9e, 0x11, 0xc1, 0xeb, 0x4f, 0x76, 0xa1, 0x9d, 0x14, 0x4b,
118 0x8b, 0x33, 0x0a, 0x8f, 0x57, 0x61, 0x78, 0x15, 0x27, 0x30, 0xc4, 0x68,
119 0x58, 0x93, 0x7d, 0x83, 0x57, 0x72, 0xff, 0x26, 0xfa, 0x54, 0x35, 0xe1,
120 0x6f, 0xec, 0x85, 0xb2, 0x32, 0x98, 0xea, 0x83, 0x57, 0xcd, 0xcc, 0x4e,
121 0x8f, 0xa1, 0x27, 0x42, 0xa1, 0xec, 0xb2, 0x33, 0x06, 0x58, 0x0e, 0xec,
122 0x41, 0xad, 0xaa, 0x43, 0x16, 0xa5, 0x0f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, 0x8a, 0xbd, 0x42, 0x88, 0xe6, 0x83, 0x42, 0xfc,
138 0x9c, 0x2f, 0xc4, 0x77, 0xf9, 0xc2, 0xbb, 0x3b, 0x4f, 0x3c, 0x90, 0x12,
139 0x2e, 0x00, 0x07, 0x50, 0x70, 0xb7, 0xa9, 0x2f, 0x35, 0xb0, 0x1b, 0x79,
140 0xc0, 0x5c, 0x54, 0x47, 0x92, 0x81, 0x0e, 0xd4, 0x5a, 0xef, 0x34, 0xaa,
141 0xff, 0xdc, 0xae, 0xf9, 0xd2, 0x81, 0x13, 0xc0, 0xb4, 0xd5, 0x8b, 0x93,
142 0xe5, 0x03, 0xfb, 0x0f, 0x20, 0xf7, 0xb7, 0x41, 0xd1, 0xd7, 0xe0, 0x94,
143 0x70, 0xea, 0xfd, 0x98, 0xde, 0x3a, 0x4f, 0x77, 0x8f, 0x6f, 0xd4, 0x7f,
144 0x86, 0x7b, 0x45, 0x0c, 0x50, 0x06, 0xb8, 0x73, 0x33, 0x62, 0x45, 0x5f,
145 0xf3, 0x71, 0x21, 0x5a, 0x0e, 0x0b, 0xb1, 0x27, 0x4f, 0x88, 0xe3, 0xf9,
146 0x62, 0xe3, 0x53, 0x93, 0x05, 0xd0, 0x21, 0x8f, 0x31, 0xc9, 0xbd, 0xc0,
147 0x81, 0xba, 0x63, 0x85, 0x65, 0x35, 0x76, 0xfb, 0xec, 0xec, 0x55, 0x74,
148 0xf7, 0x0c, 0xc0, 0xbc, 0x59, 0x88, 0x38, 0x68, 0x53, 0x4f, 0xe9, 0x84,
149 0x7f, 0x6a, 0xc7, 0x8b, 0x77, 0x81, 0xf6, 0xd8, 0x68, 0xad, 0x58, 0xf5,
150 0x58, 0xa2, 0x58, 0xba, 0xd0, 0x20, 0x00, 0x05, 0x38, 0xf8, 0x7f, 0x09,
151 0x00, 0xd5, 0x87, 0x4e, 0x01, 0x0d, 0xc0, 0x25, 0xe0, 0x73, 0xc0, 0xf0,
152 0x2f, 0xf1, 0xc1, 0x43, 0x84, 0x70, 0x5c, 0x14, 0x05, 0x00, 0x00, 0x00,
153 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
162 #include <qtooltip.h>
164 #include <qboxlayout.h>
165 #include <qwidgetaction.h>
167 GLSample::GLSample(QWidget* parent)
169 , View(tr("Wave form"), this)
174 img.loadFromData(g_icon_sample, sizeof(g_icon_sample), "PNG");
175 setting_show->setIcon(QIcon(img));
176 setting_show->setChecked(false);
179 setting_hasFading = new QAction(tr("Show fading"), this);
180 setting_hasFading->setCheckable(true);
181 connect(setting_hasFading, SIGNAL(toggled(bool)), this, SLOT(updateGL()));
182 m_popup_menu.addAction(setting_hasFading);
184 QHBoxLayout* numFadingActionLayout = new QHBoxLayout(&m_popup_menu);
186 QLabel* numFadingActionTitle = new QLabel(tr("Number of fading"), &m_popup_menu);
187 numFadingActionLayout->addWidget(numFadingActionTitle);
189 setting_spinNumFading = new QSpinBox(&m_popup_menu);
190 setting_spinNumFading->setMinimum(1);
191 setting_spinNumFading->setMaximum(10000);
192 setting_spinNumFading->setSingleStep(1);
193 setting_spinNumFading->setValue(20);
194 setting_spinNumFading->setToolTip(tr("Number of fading"));
195 connect(setting_spinNumFading, SIGNAL(valueChanged(int)), this, SLOT(updateGL()));
196 numFadingActionLayout->addWidget(setting_spinNumFading);
198 QWidget* numFadingActionWidget = new QWidget(&m_popup_menu);
199 numFadingActionWidget->setLayout(numFadingActionLayout);
201 QWidgetAction* numFadingAction = new QWidgetAction(&m_popup_menu);
202 numFadingAction->setDefaultWidget(numFadingActionWidget);
203 m_popup_menu.addAction(numFadingAction);
206 void GLSample::save()
208 s_settings->setValue("hasFading", setting_hasFading->isChecked());
209 s_settings->setValue("spinNumFading", setting_spinNumFading->value());
211 void GLSample::load()
213 setting_hasFading->setChecked(s_settings->value("hasFading", setting_hasFading->isChecked()).toBool());
214 setting_spinNumFading->setValue(s_settings->value("spinNumFading", setting_spinNumFading->value()).toInt());
216 void GLSample::clearSettings()
218 s_settings->remove("hasFading");
219 s_settings->remove("spinNumFading");
222 GLSample::Sample::Sample(double t, const deque<double>& d)
227 for(size_t i=0; i<data.size(); i++)
228 max_value = max(max_value, abs(data[i]));
231 void GLSample::add(double time, const deque<double>& data)
233 m_samples.push_front(Sample(time, data));
235 if(setting_hasFading->isChecked())
236 while(!m_samples.empty() && int(m_samples.size())>setting_spinNumFading->value())
237 m_samples.pop_back();
239 while(!m_samples.empty() && m_samples.size()>1)
240 m_samples.pop_back();
243 void GLSample::initializeGL()
245 // Set the clear color to black
246 glClearColor(1.0, 1.0, 1.0, 0.0);
248 // glShadeModel( GL_FLAT );
249 glShadeModel( GL_SMOOTH );
254 void GLSample::paintGL()
256 glClear(GL_COLOR_BUFFER_BIT);
259 string str = tr("Wave form").toStdString();
260 glColor3f(0.75,0.75,0.75);
261 glRasterPos2i(2, height()-20);
262 for(size_t i = 0; i < str.size(); i++)
263 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, (unsigned char)str[i]);
268 glColor3f(gray, gray, gray);
269 glVertex2i(0, height()/2);
270 glVertex2i(width(), height()/2);
273 if(m_max_value==0.0) m_max_value = 1.0;
276 if(!m_samples.empty())
279 for(int j=m_samples.size()-1; j>=0; j--)
281 m_max_value = max(m_max_value, abs(m_samples[j].max_value));
282 if(!setting_hasFading->isChecked()) j=-1;
285 for(int j=m_samples.size()-1; j>=0; j--)
289 glBegin(GL_LINE_STRIP);
290 float grey = float(j)/m_samples.size();
291 glColor3f(grey, grey, grey);
292 int size = m_samples[j].data.size();
293 float step = float(width())/size;
294 for(int i=size-1; i>0; i--)
295 glVertex2i(int((size-i-1)*step), int((m_samples[j].data[i]/m_max_value)*height()/2 + height()/2));
296 glVertex2i(width(), int((m_samples[j].data[0]/m_max_value)*height()/2 + height()/2));
300 if(!setting_hasFading->isChecked()) j=-1;
307 void GLSample::resizeGL( int w, int h )
309 // Set the new viewport size
310 glViewport(0, 0, (GLint)w, (GLint)h);
312 // Choose the projection matrix to be the matrix
313 // manipulated by the following calls
314 glMatrixMode(GL_PROJECTION);
316 // Set the projection matrix to be the identity matrix
319 // Define the dimensions of the Orthographic Viewing Volume
320 glOrtho(0.0, w, 0.0, h, 0.0, 1.0);
322 // Choose the modelview matrix to be the matrix
323 // manipulated by further calls
324 glMatrixMode(GL_MODELVIEW);