2018-08-17 Fred Gleason <fredg@paravelsystems.com>

* Fixed the incorrect background color in the meters in rdcatch(1).
This commit is contained in:
Fred Gleason 2018-08-17 12:38:16 -04:00
parent 8abcc89174
commit a385a50645
3 changed files with 54 additions and 61 deletions

View File

@ -17480,3 +17480,5 @@
2018-08-17 Fred Gleason <fredg@paravelsystems.com> 2018-08-17 Fred Gleason <fredg@paravelsystems.com>
* Fixed problems with dragged carts setting the correct color * Fixed problems with dragged carts setting the correct color
when dropped on a sound panel button. when dropped on a sound panel button.
2018-08-17 Fred Gleason <fredg@paravelsystems.com>
* Fixed the incorrect background color in the meters in rdcatch(1).

View File

@ -3,7 +3,7 @@
// This implements a widget that represents a stereo audio level meter, // This implements a widget that represents a stereo audio level meter,
// complete with labels and scale. // complete with labels and scale.
// //
// (C) Copyright 2002-2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License // it under the terms of the GNU Library General Public License
@ -19,29 +19,21 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
#include <qwidget.h> #include <stdio.h>
#include <qstring.h>
#include <qcolor.h>
#include <qfont.h> #include <qfont.h>
#include <qfontmetrics.h> #include <qfontmetrics.h>
#include <qcolor.h>
#include <qpainter.h> #include <qpainter.h>
#include <qpushbutton.h> #include <qstring.h>
#include <qsize.h> #include <qwidget.h>
//Added by qt3to4:
#include <QPaintEvent>
#include <stdio.h>
#include <qslider.h>
#include <q3buttongroup.h>
#include <qsizepolicy.h>
#include <qmessagebox.h>
#include <rdplaymeter.h> #include "rdplaymeter.h"
RDPlayMeter::RDPlayMeter(RDSegMeter::Orientation orient,QWidget *parent) RDPlayMeter::RDPlayMeter(RDSegMeter::Orientation orient,QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
meter_label=QString(""); meter_label=QString("");
setBackgroundColor(Qt::black);
orientation=orient; orientation=orient;
makeFont(); makeFont();
meter=new RDSegMeter(orientation,this); meter=new RDSegMeter(orientation,this);
@ -218,22 +210,26 @@ void RDPlayMeter::paintEvent(QPaintEvent *paintEvent)
// Setup // Setup
// //
QPainter *p=new QPainter(this); QPainter *p=new QPainter(this);
p->fillRect(0,0,width(),height(),Qt::black);
p->setFont(label_font); p->setFont(label_font);
p->setPen(Qt::white); p->setPen(Qt::white);
if(!meter_label.isEmpty()) { if(!meter_label.isEmpty()) {
switch(orientation) { switch(orientation) {
case RDSegMeter::Left: case RDSegMeter::Left:
p->drawText(width()-height()+meter_label_x,height()-2,meter_label); p->drawText(width()-height()+meter_label_x,height()-2,meter_label);
break; break;
case RDSegMeter::Right:
p->drawText(meter_label_x,height()-2,meter_label); case RDSegMeter::Right:
break; p->drawText(meter_label_x,height()-2,meter_label);
case RDSegMeter::Up: break;
p->drawText(meter_label_x,height()-3,meter_label);
break; case RDSegMeter::Up:
case RDSegMeter::Down: p->drawText(meter_label_x,height()-3,meter_label);
p->drawText(meter_label_x,width()-1,meter_label); break;
break;
case RDSegMeter::Down:
p->drawText(meter_label_x,width()-1,meter_label);
break;
} }
} }
p->end(); p->end();
@ -244,29 +240,28 @@ void RDPlayMeter::paintEvent(QPaintEvent *paintEvent)
void RDPlayMeter::makeFont() void RDPlayMeter::makeFont()
{ {
switch(orientation) { switch(orientation) {
case RDSegMeter::Left: case RDSegMeter::Left:
label_font=QFont("helvetica",height()-2,QFont::Bold); label_font=QFont("helvetica",height()-2,QFont::Bold);
label_font.setPixelSize(height()-2); label_font.setPixelSize(height()-2);
meter_label_x=(height()-QFontMetrics(label_font). meter_label_x=(height()-QFontMetrics(label_font).width(meter_label))/2;
width(meter_label))/2; break;
break;
case RDSegMeter::Right: case RDSegMeter::Right:
label_font=QFont("helvetica",height()-2,QFont::Bold); label_font=QFont("helvetica",height()-2,QFont::Bold);
label_font.setPixelSize(height()-2); label_font.setPixelSize(height()-2);
meter_label_x=(height()-QFontMetrics(label_font). meter_label_x=(height()-QFontMetrics(label_font).width(meter_label))/2;
width(meter_label))/2; break;
break;
case RDSegMeter::Up: case RDSegMeter::Up:
label_font=QFont("helvetica",width()-2,QFont::Bold); label_font=QFont("helvetica",width()-2,QFont::Bold);
label_font.setPixelSize(width()-2); label_font.setPixelSize(width()-2);
meter_label_x=(width()-QFontMetrics(label_font). meter_label_x=(width()-QFontMetrics(label_font).width(meter_label))/2;
width(meter_label))/2; break;
break;
case RDSegMeter::Down: case RDSegMeter::Down:
label_font=QFont("helvetica",width()-2,QFont::Bold); label_font=QFont("helvetica",width()-2,QFont::Bold);
label_font.setPixelSize(width()-2); label_font.setPixelSize(width()-2);
meter_label_x=(width()-QFontMetrics(label_font). meter_label_x=(width()-QFontMetrics(label_font).width(meter_label))/2;
width(meter_label))/2; break;
break;
} }
} }

View File

@ -2,7 +2,7 @@
// //
// A playback audio meter widget. // A playback audio meter widget.
// //
// (C) Copyright 2002-2003,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License // it under the terms of the GNU Library General Public License
@ -21,20 +21,16 @@
#ifndef RDPLAYMETER_H #ifndef RDPLAYMETER_H
#define RDPLAYMETER_H #define RDPLAYMETER_H
#include <qwidget.h>
#include <qcolor.h> #include <qcolor.h>
#include <qpainter.h>
#include <qsize.h>
#include <qsizepolicy.h>
#include <qstring.h>
#include <qrect.h>
#include <qfont.h> #include <qfont.h>
//Added by qt3to4: #include <qpainter.h>
#include <QPaintEvent> #include <qrect.h>
#include <qsize.h>
#include <qstring.h>
#include <qwidget.h>
#include <rdsegmeter.h> #include <rdsegmeter.h>
class RDPlayMeter : public QWidget class RDPlayMeter : public QWidget
{ {
Q_OBJECT Q_OBJECT