diff --git a/ChangeLog b/ChangeLog index 6d6c3d4c..0c65a7f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21207,3 +21207,6 @@ 2021-02-25 Fred Gleason * Fixed regressions that caused progress dialogs to appear when starting up applications. +2021-02-25 Fred Gleason + * Fixed regressions in rdairplay(1) that caused incorrect color + rendering. diff --git a/lib/rdpanel_button.cpp b/lib/rdpanel_button.cpp index a312396f..70dcffb8 100644 --- a/lib/rdpanel_button.cpp +++ b/lib/rdpanel_button.cpp @@ -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; diff --git a/lib/rdpanel_button.h b/lib/rdpanel_button.h index e9cb8072..4977f805 100644 --- a/lib/rdpanel_button.h +++ b/lib/rdpanel_button.h @@ -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); diff --git a/rdairplay/loglinebox.cpp b/rdairplay/loglinebox.cpp index 656f0c04..1e54f53d 100644 --- a/rdairplay/loglinebox.cpp +++ b/rdairplay/loglinebox.cpp @@ -19,6 +19,7 @@ // #include +#include #include #include @@ -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; diff --git a/rdairplay/mode_display.cpp b/rdairplay/mode_display.cpp index 83914be0..2bb63b8d 100644 --- a/rdairplay/mode_display.cpp +++ b/rdairplay/mode_display.cpp @@ -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; diff --git a/rdairplay/mode_display.h b/rdairplay/mode_display.h index d6c04e1a..216cf7b6 100644 --- a/rdairplay/mode_display.h +++ b/rdairplay/mode_display.h @@ -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]; diff --git a/rdairplay/post_counter.cpp b/rdairplay/post_counter.cpp index 8ab3d0f2..a06c3fb0 100644 --- a/rdairplay/post_counter.cpp +++ b/rdairplay/post_counter.cpp @@ -2,7 +2,7 @@ // // The post counter widget for Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 -#include +#include +#include #include @@ -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); diff --git a/rdairplay/post_counter.h b/rdairplay/post_counter.h index e17e485c..5cac4c03 100644 --- a/rdairplay/post_counter.h +++ b/rdairplay/post_counter.h @@ -46,6 +46,7 @@ class PostCounter : public RDPushButton protected: void keyPressEvent(QKeyEvent *e); + void resizeEvent(QResizeEvent *e); private: void UpdateDisplay(); diff --git a/rdairplay/start_button.cpp b/rdairplay/start_button.cpp index 295989d5..840c7203 100644 --- a/rdairplay/start_button.cpp +++ b/rdairplay/start_button.cpp @@ -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; } diff --git a/rdairplay/stop_counter.cpp b/rdairplay/stop_counter.cpp index acf9cb86..37f2e9b1 100644 --- a/rdairplay/stop_counter.cpp +++ b/rdairplay/stop_counter.cpp @@ -18,6 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // +#include #include #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); diff --git a/rdairplay/stop_counter.h b/rdairplay/stop_counter.h index 88a568ec..2e47996b 100644 --- a/rdairplay/stop_counter.h +++ b/rdairplay/stop_counter.h @@ -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; diff --git a/rdairplay/wall_clock.cpp b/rdairplay/wall_clock.cpp index 79d709da..030c0755 100644 --- a/rdairplay/wall_clock.cpp +++ b/rdairplay/wall_clock.cpp @@ -18,6 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // +#include #include #include @@ -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)); +} + diff --git a/rdairplay/wall_clock.h b/rdairplay/wall_clock.h index 0b075f37..16220a95 100644 --- a/rdairplay/wall_clock.h +++ b/rdairplay/wall_clock.h @@ -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;