summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opierec/vumeter.cpp130
-rw-r--r--noncore/multimedia/opierec/vumeter.h8
2 files changed, 47 insertions, 91 deletions
diff --git a/noncore/multimedia/opierec/vumeter.cpp b/noncore/multimedia/opierec/vumeter.cpp
index 8bab2f2..0edc806 100644
--- a/noncore/multimedia/opierec/vumeter.cpp
+++ b/noncore/multimedia/opierec/vumeter.cpp
@@ -1,6 +1,13 @@
+//************************************************************
+//=======-VUMeter
+///// copyright : (C) 1999 by Martin Lorenz
+////// email : lorenz@ch.tum.de
+
#include "vumeter.h"
#include "qtrec.h"
+
+#include <qpe/config.h>
#include <qtimer.h>
-#include <math.h>
#include <qdrawutl.h>
+
#include <opie2/odebug.h>
@@ -8,7 +15,3 @@ using namespace Opie::Core;
-//************************************************************
-//===========================================================-VUMeter
-
-///// copyright : (C) 1999 bY Martin Lorenz
-////// email : lorenz@ch.tum.de
+#include <math.h>
@@ -17,3 +20,2 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
{
-// qDebug("Making VUMeter");
int tracks = tr;
@@ -24,3 +26,2 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
peak[i] = hold[i] = 32768;
-// i_peak[i]=i_hold[i]=32768;
holdTime[i] = 20;
@@ -28,9 +29,11 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
- para.onOff = true;
- para.hold = 20;
- para.update = 25; //timer
- para.leds = 17;
- para.reso = 3;
- para.resoFactor = pow(2, para.reso/6.0);
+ readConf();
+// QColor c;
+// c.setHsv( (x * 255)/w, 255, 255 );// rainbow effect
+// c.setRgb( 255, 0, 255);
+// p.setPen(c);
+
+ //rainbow effect
+ if( colorScheme = 0 ) {
for( i = 0; i < para.leds; i++) color[i] = green;
@@ -38,2 +41,11 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
color[2] = color[3] = color[4] = color[5] = yellow;
+ } else {
+ int j = para.leds - 4;
+ for( i = 0; i < para.leds; i++) {
+ int i16 = (j);// & 15;
+ color[i] = QColor(( 15 - i16) * 16, 255, 255, QColor::Hsv);
+ owarn << color[i].name() << oendl;
+ j--;
+ }
+ }
@@ -43,19 +55,3 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
-
-// vuProp= new QPopupMenu(NULL,"vu popoup");
-// vuProp->insertItem(("O&n"),this,SLOT(slotOn()),0,0 );
-// vuProp->setItemEnabled(0, FALSE);
-// vuProp->insertItem(("O&ff"),this,SLOT(slotOff()), 0,1);
-// vuProp->insertSeparator();
-// vuProp->insertItem(("&Properties..."),this,SLOT(slotProps()) );
-
-// dia=new VUMeterDialog(&para);
-// connect(dia, SIGNAL(accepted()), this, SLOT(update()) );
- // QtRec *qtrecPtr;
-
-// if(qtrecPtr->tab_2->isActiveWindow())
-// vuTimer->start( 50 /*para.update*/, FALSE);
-// startTimer();
connect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot()));
-// update();
}
@@ -63,3 +59,3 @@ VUMeter::VUMeter(QWidget *parent, const char *name, const int tr)
VUMeter::~VUMeter(){
-// delete vuProp;
+ writeConf();
}
@@ -70,4 +66,2 @@ void VUMeter::update(){
if (para.onOff) {
-// vuProp->setItemEnabled(0, FALSE);
-// vuProp->setItemEnabled(1, TRUE);
disconnect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot()));
@@ -75,4 +69,2 @@ void VUMeter::update(){
} else {
-// vuProp->setItemEnabled(0, TRUE);
-// vuProp->setItemEnabled(1, FALSE);
disconnect(vuTimer, SIGNAL(timeout()), this , SLOT(timeSlot()));
@@ -85,5 +77,2 @@ void VUMeter::slotOn() {
para.onOff=true;
-// dia->updatePara();
-// vuProp->setItemEnabled(0, FALSE);
-// vuProp->setItemEnabled(1, TRUE);
}
@@ -93,5 +82,2 @@ void VUMeter::slotOff() {
para.onOff=false;
-// dia->updatePara();
-// vuProp->setItemEnabled(0, TRUE);
-// vuProp->setItemEnabled(1, FALSE);
}
@@ -100,3 +86,2 @@ void VUMeter::slotProps() {
qDebug("VU-Dialog");
-// dia->show();
}
@@ -111,4 +96,2 @@ void VUMeter::mousePressEvent(QMouseEvent* e) {
Q_UNUSED(e);
-// if (e->button() == RightButton)
-// vuProp->popup(QCursor::pos() );
}
@@ -140,6 +123,2 @@ void VUMeter::resize() {
else {
-// QColor c;
- //c.setHsv( (x * 255)/w, 255, 255 );// rainbow effect
- // c.setRgb( 255, 0, 255);
-// p.setPen(c);
painter.setPen(green);
@@ -156,6 +135,4 @@ void VUMeter::resize() {
painter.drawRect(ox+dx*i,oy+dy*(para.leds)-2,sx,2*dy-1);
-// painter.drawRect(ox+dx*i,oy+dy*(15)+1,sx,2*dy-1);
painter.setPen(black);
painter.drawText(textOffset+ox+dx*i,oy+dy*(para.leds)-2,sx,2*dy,AlignCenter,str);
-// painter.drawText(textOffset+ox+dx*i,oy+dy*(15),sx,2*dy,AlignCenter,str);
}
@@ -173,6 +150,3 @@ void VUMeter::timeSlot() {
peak[i] /= para.resoFactor;
-// i_peak[i] /= (int)para.resoFactor;
}
-//cout <<"VU "<<peak[0]<<"\n";
-
}
@@ -182,6 +156,2 @@ void VUMeter::paint() {
float p, h ;
-// int i_p, i_h;
-//draw background in resizeEvent
-//cout <<x <<" "<<y <<" "<<dx<<" " <<dy <<" vumeter.paint\n";
-// qDebug("paint()\n");
QPainter painter;
@@ -191,8 +161,5 @@ void VUMeter::paint() {
for(i=0;i<tracks+2;i++) {
-// i_p=i_peak[i]; i_h=i_hold[i];
p=peak[i]; h=hold[i];
if (p>=32767) p=32768;
-// if (i_p>=32767) i_p=32768;
if (h>=32767) h=32768;
-// if (i_h>=32767) i_h=32768;
for(k=para.leds+1; k>=2; k--) {
@@ -200,6 +167,4 @@ void VUMeter::paint() {
if (p>=32768) { //LED on
-// if (i_p>=32768) { //LED on
painter.setBrush(color[c]);
} else { //LED off
- //painter.setPen(color[c].dark(300));
painter.setBrush(color[c].dark(300));
@@ -207,3 +172,2 @@ void VUMeter::paint() {
if (h>=32768) { //LED-Frame on
-// if (i_h>=32768) { //LED-Frame on
painter.setPen(color[c]);
@@ -214,6 +178,4 @@ void VUMeter::paint() {
p*=para.resoFactor; h*=para.resoFactor;
-// i_p*=(int)para.resoFactor; i_h*=(int)para.resoFactor;
}
if (--holdTime[i]<=0) hold[i]=peak[i];
-// if (--holdTime[i]<=0) i_hold[i]=i_peak[i];
}
@@ -236,4 +198,2 @@ void VUMeter::setPeak(float a[]) {
int i;
-// owarn <<"set peak float"<< a[0]<< oendl;
-
for(i=0;i<tracks+2;i++) {
@@ -254,12 +214,13 @@ void VUMeter::stopTimer() {
void VUMeter::readConf() {
-// Config config("QtRec");
-// config->setGroup("VU-Meter");
-
-// para.onOff=config->readBoolEntry("OnOff", true ) ;
-// para.update=config->readNumEntry("Update", 50 );
-// para.hold=config->readNumEntry("Hold", 20 );
-// para.reso=config->readNumEntry("Resolution", 3 );
-// para.leds=config->readNumEntry("LEDs", 16 );
-// para.resoFactor=pow(2,para.reso/6.0);
+ Config config("OpieRec");
+ config.setGroup("VU-Meter");
+
+ para.onOff = config.readBoolEntry("OnOff", true);
+ para.update = config.readNumEntry("Update", 25);
+ para.hold = config.readNumEntry("Hold", 20);
+ para.reso = config.readNumEntry("Resolution", 3);
+ para.leds = config.readNumEntry("LEDs", 20);
+ para.resoFactor = pow(2, para.reso / 6.0);
+ colorScheme = config.readNumEntry("colorScheme", 0);
// update();
@@ -270,11 +231,10 @@ void VUMeter::readConf() {
void VUMeter::writeConf() {
-// Config config("QtRec");
-// config->setGroup("VU-Meter");
-
-// config->writeEntry("OnOff" ,para.onOff );
-// config->writeEntry("Update" ,para.update );
-// config->writeEntry("Hold" ,para.hold );
-// config->writeEntry("Resolution" , para.reso );
-// config->writeEntry("LEDs" , para.leds);
-
+ Config config("OpieRec");
+ config.setGroup("VU-Meter");
+
+ config.writeEntry("OnOff", para.onOff);
+ config.writeEntry("Update", para.update);
+ config.writeEntry("Hold", para.hold);
+ config.writeEntry("Resolution", para.reso);
+ config.writeEntry("LEDs", para.leds);
}
diff --git a/noncore/multimedia/opierec/vumeter.h b/noncore/multimedia/opierec/vumeter.h
index e167686..435dff5 100644
--- a/noncore/multimedia/opierec/vumeter.h
+++ b/noncore/multimedia/opierec/vumeter.h
@@ -48,5 +48,3 @@ protected:
private:
- //bool status;
- int tracks;
-// VUPara para; // dialogs.h
+ int tracks, colorScheme;
float resoFactor;
@@ -57,7 +55,5 @@ private:
- // VUMeterDialog *dia;
- QPixmap *buffer, *warning; /// ?
+ QPixmap *buffer, *warning;
QPopupMenu *vuProp;
QColor color[37];
-
};