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>
* Fixed problems with dragged carts setting the correct color
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,
// 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
// it under the terms of the GNU Library General Public License
@ -19,29 +19,21 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qwidget.h>
#include <qstring.h>
#include <stdio.h>
#include <qcolor.h>
#include <qfont.h>
#include <qfontmetrics.h>
#include <qcolor.h>
#include <qpainter.h>
#include <qpushbutton.h>
#include <qsize.h>
//Added by qt3to4:
#include <QPaintEvent>
#include <stdio.h>
#include <qslider.h>
#include <q3buttongroup.h>
#include <qsizepolicy.h>
#include <qmessagebox.h>
#include <qstring.h>
#include <qwidget.h>
#include <rdplaymeter.h>
#include "rdplaymeter.h"
RDPlayMeter::RDPlayMeter(RDSegMeter::Orientation orient,QWidget *parent)
: QWidget(parent)
{
meter_label=QString("");
setBackgroundColor(Qt::black);
orientation=orient;
makeFont();
meter=new RDSegMeter(orientation,this);
@ -218,6 +210,7 @@ void RDPlayMeter::paintEvent(QPaintEvent *paintEvent)
// Setup
//
QPainter *p=new QPainter(this);
p->fillRect(0,0,width(),height(),Qt::black);
p->setFont(label_font);
p->setPen(Qt::white);
if(!meter_label.isEmpty()) {
@ -225,12 +218,15 @@ void RDPlayMeter::paintEvent(QPaintEvent *paintEvent)
case RDSegMeter::Left:
p->drawText(width()-height()+meter_label_x,height()-2,meter_label);
break;
case RDSegMeter::Right:
p->drawText(meter_label_x,height()-2,meter_label);
break;
case RDSegMeter::Up:
p->drawText(meter_label_x,height()-3,meter_label);
break;
case RDSegMeter::Down:
p->drawText(meter_label_x,width()-1,meter_label);
break;
@ -247,26 +243,25 @@ void RDPlayMeter::makeFont()
case RDSegMeter::Left:
label_font=QFont("helvetica",height()-2,QFont::Bold);
label_font.setPixelSize(height()-2);
meter_label_x=(height()-QFontMetrics(label_font).
width(meter_label))/2;
meter_label_x=(height()-QFontMetrics(label_font).width(meter_label))/2;
break;
case RDSegMeter::Right:
label_font=QFont("helvetica",height()-2,QFont::Bold);
label_font.setPixelSize(height()-2);
meter_label_x=(height()-QFontMetrics(label_font).
width(meter_label))/2;
meter_label_x=(height()-QFontMetrics(label_font).width(meter_label))/2;
break;
case RDSegMeter::Up:
label_font=QFont("helvetica",width()-2,QFont::Bold);
label_font.setPixelSize(width()-2);
meter_label_x=(width()-QFontMetrics(label_font).
width(meter_label))/2;
meter_label_x=(width()-QFontMetrics(label_font).width(meter_label))/2;
break;
case RDSegMeter::Down:
label_font=QFont("helvetica",width()-2,QFont::Bold);
label_font.setPixelSize(width()-2);
meter_label_x=(width()-QFontMetrics(label_font).
width(meter_label))/2;
meter_label_x=(width()-QFontMetrics(label_font).width(meter_label))/2;
break;
}
}

View File

@ -2,7 +2,7 @@
//
// 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
// it under the terms of the GNU Library General Public License
@ -21,20 +21,16 @@
#ifndef RDPLAYMETER_H
#define RDPLAYMETER_H
#include <qwidget.h>
#include <qcolor.h>
#include <qpainter.h>
#include <qsize.h>
#include <qsizepolicy.h>
#include <qstring.h>
#include <qrect.h>
#include <qfont.h>
//Added by qt3to4:
#include <QPaintEvent>
#include <qpainter.h>
#include <qrect.h>
#include <qsize.h>
#include <qstring.h>
#include <qwidget.h>
#include <rdsegmeter.h>
class RDPlayMeter : public QWidget
{
Q_OBJECT