2021-02-25 Fred Gleason <fredg@paravelsystems.com>

* Fixed regressions in rdairplay(1) that caused incorrect color
	rendering.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-02-25 11:40:22 -05:00
parent a68d6c70bb
commit f755f59651
13 changed files with 86 additions and 30 deletions

View File

@ -21207,3 +21207,6 @@
2021-02-25 Fred Gleason <fredg@paravelsystems.com>
* Fixed regressions that caused progress dialogs to appear when
starting up applications.
2021-02-25 Fred Gleason <fredg@paravelsystems.com>
* Fixed regressions in rdairplay(1) that caused incorrect color
rendering.

View File

@ -355,6 +355,12 @@ void RDPanelButton::keyReleaseEvent(QKeyEvent *e)
}
void RDPanelButton::resizeEvent(QResizeEvent *e)
{
setIconSize(QSize(size().width()-2,size().height()-2));
}
void RDPanelButton::mousePressEvent(QMouseEvent *e)
{
button_move_count=10;

View File

@ -80,6 +80,7 @@ class RDPanelButton : public RDPushButton
private slots:
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
void resizeEvent(QResizeEvent *e);
protected:
void mousePressEvent(QMouseEvent *e);

View File

@ -19,6 +19,7 @@
//
#include <QDrag>
#include <QGuiApplication>
#include <QMouseEvent>
#include <QPainter>
@ -82,48 +83,48 @@ LogLineBox::LogLineBox(RDAirPlayConf *conf,QWidget *parent)
//
// Create Palettes
//
line_unchanged_stop_palette=palette();
line_unchanged_stop_palette=QGuiApplication::palette();
line_unchanged_stop_palette.setColor(QPalette::Active,QPalette::Highlight,
QColor(BAR_UNCHANGED_STOPPING_COLOR));
line_unchanged_stop_palette.setColor(QPalette::Inactive,
QPalette::Highlight,
QColor(BAR_UNCHANGED_STOPPING_COLOR));
line_unchanged_play_palette=palette();
line_unchanged_play_palette=QGuiApplication::palette();
line_unchanged_play_palette.setColor(QPalette::Active,QPalette::Highlight,
QColor(BAR_UNCHANGED_TRANSITION_COLOR));
line_unchanged_play_palette.setColor(QPalette::Inactive,
QPalette::Highlight,
QColor(BAR_UNCHANGED_TRANSITION_COLOR));
line_changed_stop_palette=palette();
line_changed_stop_palette=QGuiApplication::palette();
line_changed_stop_palette.setColor(QPalette::Active,QPalette::Highlight,
QColor(BAR_CHANGED_STOPPING_COLOR));
line_changed_stop_palette.setColor(QPalette::Inactive,QPalette::Highlight,
QColor(BAR_CHANGED_STOPPING_COLOR));
line_changed_play_palette=palette();
line_changed_play_palette=QGuiApplication::palette();
line_changed_play_palette.setColor(QPalette::Active,QPalette::Highlight,
QColor(BAR_CHANGED_TRANSITION_COLOR));
line_changed_play_palette.setColor(QPalette::Inactive,QPalette::Highlight,
QColor(BAR_CHANGED_TRANSITION_COLOR));
line_time_palette=palette();
line_hard_palette=palette();
line_time_palette=QGuiApplication::palette();
line_hard_palette=QGuiApplication::palette();
line_hard_palette.setColor(QPalette::Active,QPalette::Foreground,
QColor(LOG_HARDTIME_TEXT_COLOR));
line_hard_palette.setColor(QPalette::Inactive,QPalette::Foreground,
QColor(LOG_HARDTIME_TEXT_COLOR));
line_timescale_palette=palette();
line_timescale_palette=QGuiApplication::palette();
line_timescale_palette.setColor(QPalette::Active,QPalette::Foreground,
QColor(LOGLINEBOX_TIMESCALE_COLOR));
line_timescale_palette.setColor(QPalette::Inactive,QPalette::Foreground,
QColor(LOGLINEBOX_TIMESCALE_COLOR));
line_transition_palette=palette();
line_transition_palette=QGuiApplication::palette();
line_transition_palette.setColor(QPalette::Active,QPalette::Foreground,
QColor(RD_CUSTOM_TRANSITION_COLOR));
line_transition_palette.setColor(QPalette::Inactive,QPalette::Foreground,
QColor(RD_CUSTOM_TRANSITION_COLOR));
line_text_palette=palette();
line_text_palette=QGuiApplication::palette();
line_text_palette.setColor(QPalette::Active,QPalette::Foreground,
QColor(Qt::black));
line_text_palette.setColor(QPalette::Inactive,QPalette::Foreground,
@ -400,12 +401,12 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
switch(line_logline->transType()) {
case RDLogLine::Stop:
line_trans_label->setText(tr("STOP"));
line_trans_label->setPalette(palette());
line_trans_label->setPalette(QGuiApplication::palette());
break;
case RDLogLine::Play:
line_trans_label->setText(tr("PLAY"));
line_trans_label->setPalette(palette());
line_trans_label->setPalette(QGuiApplication::palette());
break;
case RDLogLine::Segue:
@ -414,7 +415,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
line_trans_label->setPalette(line_transition_palette);
}
else {
line_trans_label->setPalette(palette());
line_trans_label->setPalette(QGuiApplication::palette());
}
break;
@ -830,7 +831,7 @@ void LogLineBox::paintEvent(QPaintEvent *e)
{
QPainter *p=new QPainter(this);
p->fillRect(0,0,sizeHint().width()-2,sizeHint().height()-2,
palette().color(QPalette::Background));
QGuiApplication::palette().color(QPalette::Background));
p->drawRect(0,0,sizeHint().width()-2,sizeHint().height()-2);
p->end();
delete p;

View File

@ -79,6 +79,12 @@ void ModeDisplay::setOpModeStyle(RDAirPlayConf::OpModeStyle style)
}
void ModeDisplay::resizeEvent(QResizeEvent *e)
{
setIconSize(QSize(size().width()-2,size().height()-2));
}
void ModeDisplay::WriteMap()
{
QString str;

View File

@ -40,6 +40,9 @@ class ModeDisplay : public RDPushButton
void setOpMode(int mach,RDAirPlayConf::OpMode mode);
void setOpModeStyle(RDAirPlayConf::OpModeStyle style);
protected:
void resizeEvent(QResizeEvent *e);
private:
void WriteMap();
RDAirPlayConf::OpMode mode_mode[RDAIRPLAY_LOG_QUANTITY];

View File

@ -2,7 +2,7 @@
//
// The post counter widget for Rivendell
//
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -18,8 +18,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qpixmap.h>
#include <qpainter.h>
#include <QGuiApplication>
#include <QPainter>
#include <rdapplication.h>
@ -38,13 +38,19 @@ PostCounter::PostCounter(QWidget *parent)
//
// Generate Palettes
//
post_idle_palette=palette();
post_idle_palette=QGuiApplication::palette();
post_early_palette=
QPalette(QColor(POSTPOINT_EARLY_COLOR),palette().color(QPalette::Background));
QPalette(QColor(POSTPOINT_EARLY_COLOR),
QGuiApplication::palette().color(QPalette::Inactive,
QPalette::Background));
post_ontime_palette=
QPalette(QColor(POSTPOINT_ONTIME_COLOR),palette().color(QPalette::Background));
QPalette(QColor(POSTPOINT_ONTIME_COLOR),
QGuiApplication::palette().color(QPalette::Inactive,
QPalette::Background));
post_late_palette=
QPalette(QColor(POSTPOINT_LATE_COLOR),palette().color(QPalette::Background));
QPalette(QColor(POSTPOINT_LATE_COLOR),
QGuiApplication::palette().color(QPalette::Inactive,
QPalette::Background));
post_offset = 0;
UpdateDisplay();
@ -115,10 +121,17 @@ void PostCounter::keyPressEvent(QKeyEvent *e)
}
void PostCounter::resizeEvent(QResizeEvent *e)
{
setIconSize(QSize(size().width()-2,size().height()-2));
}
void PostCounter::UpdateDisplay()
{
QColor color=palette().color(QPalette::Background);
QColor system_button_text_color=palette().buttonText().color();
QColor color=QGuiApplication::palette().color(QPalette::Inactive,
QPalette::Background);
QColor text_color=QGuiApplication::palette().buttonText().color();
QString str;
QString point;
QString state;
@ -150,7 +163,7 @@ void PostCounter::UpdateDisplay()
color=POSTPOINT_ONTIME_COLOR;
}
}
system_button_text_color=Qt::color1;
text_color=Qt::color1;
}
else {
state="--------";
@ -165,7 +178,7 @@ void PostCounter::UpdateDisplay()
QPixmap pix(size().width()-2,size().height()-2);
QPainter *p=new QPainter(&pix);
p->fillRect(0,0,size().width()-2,size().height()-2,color);
p->setPen(QColor(system_button_text_color));
p->setPen(QColor(text_color));
p->setFont(subLabelFont());
p->drawText((size().width()-2-p->
fontMetrics().width(point))/2,22,point);

View File

@ -46,6 +46,7 @@ class PostCounter : public RDPushButton
protected:
void keyPressEvent(QKeyEvent *e);
void resizeEvent(QResizeEvent *e);
private:
void UpdateDisplay();

View File

@ -236,6 +236,7 @@ void StartButton::Resize(int x,int y,int w,int h)
}
p->end();
setIcon(*pix);
setIconSize(QSize(w-2,h-2));
delete p;
delete pix;
}

View File

@ -18,6 +18,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <QGuiApplication>
#include <QPainter>
#include "stop_counter.h"
@ -113,10 +114,16 @@ void StopCounter::tickCounter()
}
void StopCounter::resizeEvent(QResizeEvent *e)
{
setIconSize(QSize(size().width()-2,size().height()-2));
}
void StopCounter::UpdateTime()
{
QString text;
QColor system_button_text_color = palette().buttonText().color();
QColor text_color = QGuiApplication::palette().buttonText().color();
int msecs=QTime::currentTime().
addMSecs(rda->station()->timeOffset()).msecsTo(stop_time);
@ -127,8 +134,9 @@ void StopCounter::UpdateTime()
old_msecs = msecs;
p->fillRect(0,0,sizeHint().width()-2,sizeHint().height()-2,
palette().color(QPalette::Background));
p->setPen(QColor(system_button_text_color));
QGuiApplication::palette().color(QPalette::Inactive,
QPalette::Background));
p->setPen(QColor(text_color));
p->setFont(subLabelFont());
p->drawText((sizeHint().width()-2-p->fontMetrics().width(stop_text))/2,22,
stop_text);

View File

@ -38,6 +38,9 @@ class StopCounter : public RDPushButton
void setTime(QTime time);
void tickCounter();
protected:
void resizeEvent(QResizeEvent *e);
private:
void UpdateTime();
QTime stop_time;

View File

@ -18,6 +18,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <QGuiApplication>
#include <QPainter>
#include <rdconf.h>
@ -94,7 +95,7 @@ void WallClock::tickClock()
{
static QString date;
QString accum;
QColor system_button_text_color = palette().buttonText().color();
QColor text_color = QGuiApplication::palette().buttonText().color();
static QPixmap *pix=new QPixmap(sizeHint().width()-2,sizeHint().height()-2);
static bool synced=true;
@ -140,8 +141,9 @@ void WallClock::tickClock()
p.setPen(Qt::color1);
}
else {
p.fillRect(0,0,width()-2,height()-2,palette().color(QPalette::Background));
p.setPen(QColor(system_button_text_color));
p.fillRect(0,0,width()-2,height()-2,QGuiApplication::palette().color(QPalette::Inactive,
QPalette::Background));
p.setPen(QColor(text_color));
}
p.setFont(subLabelFont());
p.drawText((size().width()-2-p.fontMetrics().width(date))/2,22,date);
@ -163,3 +165,10 @@ void WallClock::keyPressEvent(QKeyEvent *e)
{
e->ignore();
}
void WallClock::resizeEvent(QResizeEvent *e)
{
setIconSize(QSize(size().width()-2,size().height()-2));
}

View File

@ -47,6 +47,7 @@ class WallClock : public RDPushButton
protected:
void flashButton(bool state);
void keyPressEvent(QKeyEvent *e);
void resizeEvent(QResizeEvent *e);
private:
QTime previous_time,current_time;