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> 2021-02-25 Fred Gleason <fredg@paravelsystems.com>
* Fixed regressions that caused progress dialogs to appear when * Fixed regressions that caused progress dialogs to appear when
starting up applications. 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) void RDPanelButton::mousePressEvent(QMouseEvent *e)
{ {
button_move_count=10; button_move_count=10;

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
// //
// The post counter widget for Rivendell // 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 // 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 // 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. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// //
#include <qpixmap.h> #include <QGuiApplication>
#include <qpainter.h> #include <QPainter>
#include <rdapplication.h> #include <rdapplication.h>
@ -38,13 +38,19 @@ PostCounter::PostCounter(QWidget *parent)
// //
// Generate Palettes // Generate Palettes
// //
post_idle_palette=palette(); post_idle_palette=QGuiApplication::palette();
post_early_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= 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= 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; post_offset = 0;
UpdateDisplay(); 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() void PostCounter::UpdateDisplay()
{ {
QColor color=palette().color(QPalette::Background); QColor color=QGuiApplication::palette().color(QPalette::Inactive,
QColor system_button_text_color=palette().buttonText().color(); QPalette::Background);
QColor text_color=QGuiApplication::palette().buttonText().color();
QString str; QString str;
QString point; QString point;
QString state; QString state;
@ -150,7 +163,7 @@ void PostCounter::UpdateDisplay()
color=POSTPOINT_ONTIME_COLOR; color=POSTPOINT_ONTIME_COLOR;
} }
} }
system_button_text_color=Qt::color1; text_color=Qt::color1;
} }
else { else {
state="--------"; state="--------";
@ -165,7 +178,7 @@ void PostCounter::UpdateDisplay()
QPixmap pix(size().width()-2,size().height()-2); QPixmap pix(size().width()-2,size().height()-2);
QPainter *p=new QPainter(&pix); QPainter *p=new QPainter(&pix);
p->fillRect(0,0,size().width()-2,size().height()-2,color); 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->setFont(subLabelFont());
p->drawText((size().width()-2-p-> p->drawText((size().width()-2-p->
fontMetrics().width(point))/2,22,point); fontMetrics().width(point))/2,22,point);

View File

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

View File

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

View File

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

View File

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

View File

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