summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-03-21 10:31:06 (UTC)
committer llornkcor <llornkcor>2005-03-21 10:31:06 (UTC)
commit18825d8195f05d1a82affc0111f524371dbdeb5f (patch) (unidiff)
treeaa807f10454b77496bb18a24569e12bf38acb7cf
parentda645ace9b556dd132ac998cd124fa1e062e0032 (diff)
downloadopie-18825d8195f05d1a82affc0111f524371dbdeb5f.zip
opie-18825d8195f05d1a82affc0111f524371dbdeb5f.tar.gz
opie-18825d8195f05d1a82affc0111f524371dbdeb5f.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/vumeter.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/noncore/multimedia/opierec/vumeter.cpp b/noncore/multimedia/opierec/vumeter.cpp
index c28dbe4..6a3f7c2 100644
--- a/noncore/multimedia/opierec/vumeter.cpp
+++ b/noncore/multimedia/opierec/vumeter.cpp
@@ -2,6 +2,7 @@
2//=======-VUMeter 2//=======-VUMeter
3///// copyright : (C) 1999 by Martin Lorenz 3///// copyright : (C) 1999 by Martin Lorenz
4////// email : lorenz@ch.tum.de 4////// email : lorenz@ch.tum.de
5// also copyright 2005 lpotter@trolltech.com
5 6
6#include "vumeter.h" 7#include "vumeter.h"
7#include "qtrec.h" 8#include "qtrec.h"
@@ -10,15 +11,12 @@
10#include <qtimer.h> 11#include <qtimer.h>
11#include <qdrawutl.h> 12#include <qdrawutl.h>
12 13
13#include <opie2/odebug.h>
14using namespace Opie::Core;
15
16#include <math.h> 14#include <math.h>
17 15
18VUMeter::VUMeter(QWidget *parent, const char *name, const int tr) 16VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
19 : QWidget( parent, name ) 17 : QWidget( parent, name )
20{ 18{
21 int tracks = tr; 19 tracks = tr;
22 int i; 20 int i;
23 21
24 qWarning("initialize peakvalues"); 22 qWarning("initialize peakvalues");
@@ -27,6 +25,8 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
27 holdTime[i] = 20; 25 holdTime[i] = 20;
28 } 26 }
29 27
28 colorScheme = 0;
29
30 readConf(); 30 readConf();
31 31
32 //rainbow effect 32 //rainbow effect
@@ -39,7 +39,6 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
39 for( i = 0; i < para.leds; i++) { 39 for( i = 0; i < para.leds; i++) {
40 int i16 = (j); 40 int i16 = (j);
41 color[i] = QColor(( 15 - i16) * 16, 255, 255, QColor::Hsv); 41 color[i] = QColor(( 15 - i16) * 16, 255, 255, QColor::Hsv);
42// owarn << color[i].name() << oendl;
43 j--; 42 j--;
44 } 43 }
45 } 44 }
@@ -52,11 +51,10 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
52} 51}
53 52
54VUMeter::~VUMeter(){ 53VUMeter::~VUMeter(){
55 writeConf(); 54// writeConf();
56} 55}
57 56
58void VUMeter::update(){ 57void VUMeter::update(){
59// qWarning("vumeter update");
60 vuTimer->start(para.update, FALSE); 58 vuTimer->start(para.update, FALSE);
61 if (para.onOff) { 59 if (para.onOff) {
62 disconnect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot())); 60 disconnect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot()));
@@ -69,16 +67,15 @@ void VUMeter::update(){
69 67
70void VUMeter::slotOn() { 68void VUMeter::slotOn() {
71 connect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot())); 69 connect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot()));
72 para.onOff=true; 70 para.onOff = true;
73} 71}
74 72
75void VUMeter::slotOff() { 73void VUMeter::slotOff() {
76 disconnect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot())); 74 disconnect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot()));
77 para.onOff=false; 75 para.onOff = false;
78} 76}
79 77
80void VUMeter::slotProps() { 78void VUMeter::slotProps() {
81 qDebug("VU-Dialog");
82} 79}
83 80
84void VUMeter::paintEvent(QPaintEvent* e) { 81void VUMeter::paintEvent(QPaintEvent* e) {
@@ -98,9 +95,9 @@ void VUMeter::resizeEvent(QResizeEvent* event) {
98} 95}
99 96
100void VUMeter::resize() { 97void VUMeter::resize() {
101 qWarning("resize VUMeter painting"); 98// qWarning("resize VUMeter painting");
102 if(buffer == 0) 99 if(buffer == 0)
103 qDebug("Dude NULL pixmap buffer!"); 100 qWarning("Dude NULL pixmap buffer!");
104 101
105 buffer->fill(black); 102 buffer->fill(black);
106 103
@@ -121,6 +118,7 @@ void VUMeter::resize() {
121 if (2 * dy - 2 == 10) textOffset = 1; 118 if (2 * dy - 2 == 10) textOffset = 1;
122 font = painter.font(); font.setPointSize( 2 * dy - 2); 119 font = painter.font(); font.setPointSize( 2 * dy - 2);
123 painter.setFont(font); 120 painter.setFont(font);
121
124 for(i = 0; i < tracks + 2; i++) { 122 for(i = 0; i < tracks + 2; i++) {
125 painter.setPen(green); painter.setBrush(green); 123 painter.setPen(green); painter.setBrush(green);
126 str.sprintf("%d",i+1); 124 str.sprintf("%d",i+1);
@@ -131,6 +129,7 @@ void VUMeter::resize() {
131 painter.setPen(black); 129 painter.setPen(black);
132 painter.drawText(textOffset + ox + dx * i, oy + dy * (para.leds) - 2, sx, 2 * dy, AlignCenter, str); 130 painter.drawText(textOffset + ox + dx * i, oy + dy * (para.leds) - 2, sx, 2 * dy, AlignCenter, str);
133 } 131 }
132
134 painter.end(); 133 painter.end();
135 paint(); 134 paint();
136 } 135 }
@@ -138,8 +137,6 @@ void VUMeter::resize() {
138 137
139void VUMeter::timeSlot() { 138void VUMeter::timeSlot() {
140 int i; 139 int i;
141// getting stuck here
142// qDebug("calling paint() from timeSlot()\n");
143 paint(); 140 paint();
144 for(i = 0; i < tracks + 2; i++) { 141 for(i = 0; i < tracks + 2; i++) {
145 peak[i] /= para.resoFactor; 142 peak[i] /= para.resoFactor;
@@ -180,8 +177,6 @@ void VUMeter::paint() {
180 177
181void VUMeter::setPeak(int a[]) { 178void VUMeter::setPeak(int a[]) {
182 int i; 179 int i;
183 //qDebug("set peak int");
184// cerr<<"setting peak\n";
185 for(i = 0; i < tracks + 2; i++) { 180 for(i = 0; i < tracks + 2; i++) {
186 if (a[i] > i_peak[i]) i_peak[i] = a[i]; 181 if (a[i] > i_peak[i]) i_peak[i] = a[i];
187 if (a[i] > i_hold[i]) { i_hold[i] = a[i]; holdTime[i] = para.hold; } 182 if (a[i] > i_hold[i]) { i_hold[i] = a[i]; holdTime[i] = para.hold; }