2021-10-20 Fred Gleason <fredg@paravelsystems.com>

* Modified various elements in rdairplay(1) so as to better respect
	platform styling hints.
	* Modified the marker readouts in rdlibrary(1) so as to better respect
	platform styling hints.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-10-22 13:38:46 -04:00
parent 90656ef63f
commit a5f7a957a1
6 changed files with 96 additions and 25 deletions

View File

@ -22527,3 +22527,8 @@
2021-10-20 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdairplay(1) that caused the '-style' switch
to be ignored.
2021-10-20 Fred Gleason <fredg@paravelsystems.com>
* Modified various elements in rdairplay(1) so as to better respect
platform styling hints.
* Modified the marker readouts in rdlibrary(1) so as to better respect
platform styling hints.

View File

@ -1655,7 +1655,7 @@ QColor RDLogModel::cellTextColor(int col,int line,RDLogLine *ll) const
return ll->groupColor();
}
return d_palette.color(QPalette::Foreground);
return RDGetTextColor(rowBackgroundColor(line,ll));
}

View File

@ -30,6 +30,14 @@ RDMarkerReadout::RDMarkerReadout(RDMarkerHandle::PointerRole role,
d_roles.push_back(role);
d_selected_marker=RDMarkerHandle::LastRole;
d_default_palette=palette();
d_selected_palette=palette();
d_selected_palette.
setColor(QPalette::Window,d_selected_palette.color(QPalette::Highlight));
d_selected_palette.
setColor(QPalette::WindowText,
d_selected_palette.color(QPalette::HighlightedText));
d_label=new QLabel(RDMarkerHandle::pointerRoleText(role),this);
d_label->setAlignment(Qt::AlignCenter);
d_label->setFont(labelFont());
@ -44,6 +52,7 @@ RDMarkerReadout::RDMarkerReadout(RDMarkerHandle::PointerRole role,
d_edits.push_back(new QLabel(this));
d_edits.back()->setFrameShape(QFrame::Box);
d_edits.back()->setFrameShadow(QFrame::Sunken);
d_edits.back()->setFont(defaultFont());
d_edits.back()->setAlignment(Qt::AlignCenter);
d_edits.back()->setText("0:00:00");
}
@ -55,6 +64,7 @@ RDMarkerReadout::RDMarkerReadout(RDMarkerHandle::PointerRole role,
d_edits.push_back(new QLabel(this));
d_edits.back()->setFrameShape(QFrame::Box);
d_edits.back()->setFrameShadow(QFrame::Sunken);
d_edits.back()->setFont(defaultFont());
d_edits.back()->setAlignment(Qt::AlignCenter);
d_edits.back()->setText("0:00:00");
}
@ -155,13 +165,17 @@ void RDMarkerReadout::setSelectedMarkers(RDMarkerHandle::PointerRole start_role,
{
if(d_roles.contains(start_role)||d_roles.contains(end_role)) {
for(int i=0;i<d_edits.size();i++) {
d_edits.at(i)->setFont(labelFont());
d_edits.at(i)->setStyleSheet("background-color:#FFFF00");
d_edits.at(i)->setPalette(d_selected_palette);
d_edits.at(i)->
setStyleSheet("color:"+
d_selected_palette.color(QPalette::HighlightedText).name()+
";background-color:"+
d_selected_palette.color(QPalette::Window).name());
}
}
else {
for(int i=0;i<d_edits.size();i++) {
d_edits.at(i)->setFont(defaultFont());
d_edits.at(i)->setPalette(d_default_palette);
d_edits.at(i)->setStyleSheet("");
}
}

View File

@ -23,6 +23,7 @@
#include <QLabel>
#include <QList>
#include <QPalette>
#include <rdmarkerview.h>
#include <rdpushbutton.h>
@ -52,6 +53,8 @@ class RDMarkerReadout : public RDPushButton
QList<RDMarkerHandle::PointerRole> d_roles;
RDMarkerHandle::PointerRole d_selected_marker;
int d_pointers[RDMarkerHandle::LastRole];
QPalette d_default_palette;
QPalette d_selected_palette;
};

View File

@ -87,6 +87,28 @@ LogLineBox::LogLineBox(RDAirPlayConf *conf,QWidget *parent)
//
// Create Palettes
//
line_default_palette=QGuiApplication::palette();
line_chain_palette=QGuiApplication::palette();
line_chain_palette.setColor(QPalette::Window,LOGLINEBOX_CHAIN_COLOR);
line_chain_palette.setColor(QPalette::WindowText,Qt::black);
line_error_palette=QGuiApplication::palette();
line_error_palette.setColor(QPalette::Window,LOGLINEBOX_MISSING_COLOR);
line_error_palette.setColor(QPalette::WindowText,Qt::white);
line_evergreen_palette=QGuiApplication::palette();
line_evergreen_palette.setColor(QPalette::Window,LOGLINEBOX_EVERGREEN_COLOR);
line_evergreen_palette.setColor(QPalette::WindowText,Qt::white);
line_marker_palette=QGuiApplication::palette();
line_marker_palette.setColor(QPalette::Window,LOGLINEBOX_MARKER_COLOR);
line_marker_palette.setColor(QPalette::WindowText,Qt::black);
line_chain_palette=QGuiApplication::palette();
line_chain_palette.setColor(QPalette::Window,LOGLINEBOX_CHAIN_COLOR);
line_chain_palette.setColor(QPalette::WindowText,Qt::black);
line_unchanged_stop_palette=QGuiApplication::palette();
line_unchanged_stop_palette.setColor(QPalette::Active,QPalette::Highlight,
QColor(BAR_UNCHANGED_STOPPING_COLOR));
@ -133,10 +155,6 @@ LogLineBox::LogLineBox(RDAirPlayConf *conf,QWidget *parent)
QColor(RD_CUSTOM_TRANSITION_COLOR));
line_text_palette=QGuiApplication::palette();
line_text_palette.setColor(QPalette::Active,QPalette::Foreground,
QColor(Qt::black));
line_text_palette.setColor(QPalette::Inactive,QPalette::Foreground,
QColor(Qt::black));
//
// Count Up
@ -378,7 +396,7 @@ void LogLineBox::setMode(LogLineBox::Mode mode)
line_down_label->hide();
line_position_bar->hide();
line_description_label->hide();
line_comment_label->setGeometry(5,18,sizeHint().width()-10,31);
line_comment_label->setGeometry(5,18,sizeHint().width()-10,30);
break;
}
line_mode=mode;
@ -464,6 +482,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
line_down_label->setText("0:00:00");
line_comment_label->clear();
line_title_label->setText(tr("[CART NOT FOUND]"));
SetPalette(line_error_palette,Qt::black);
switch(cart->type()) {
case RDCart::Audio:
case RDCart::Macro:
@ -491,15 +510,16 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
line_comment_label->clear();
line_icon_label->setPixmap(*line_playout_map);
line_title_label->setText(logline->title());
SetPalette(line_error_palette,logline->groupColor());
}
else {
line_cart_label->
setText(QString::asprintf("%06u",logline->cartNumber()));
if(line_logline->evergreen()) {
// setBackgroundColor(QColor(LOGLINEBOX_EVERGREEN_COLOR));
SetPalette(line_evergreen_palette,logline->groupColor());
}
else {
// setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR));
SetPalette(line_default_palette,logline->groupColor());
}
if(line_logline->source()==RDLogLine::Tracker) {
line_icon_label->setPixmap(*line_track_cart_map);
@ -567,7 +587,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
setText(line_logline->resolveWildcards(line_outcue_template));
}
else {
// setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR));
SetPalette(line_error_palette,logline->groupColor());
line_cut_label->clear();
line_outcue_label->setText(tr("[NO VALID CUT AVAILABLE]"));
}
@ -584,7 +604,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
case RDLogLine::Marker:
line_icon_label->setPixmap(*line_notemarker_map);
// setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR));
SetPalette(line_marker_palette,logline->groupColor());
line_title_label->hide();
line_description_label->hide();
line_artist_label->hide();
@ -599,7 +619,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
case RDLogLine::Track:
line_icon_label->setPixmap(*line_mic16_map);
// setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR));
SetPalette(line_marker_palette,logline->groupColor());
line_title_label->hide();
line_description_label->hide();
line_artist_label->hide();
@ -614,7 +634,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
case RDLogLine::MusicLink:
line_icon_label->setPixmap(*line_music_map);
// setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR));
SetPalette(line_marker_palette,logline->groupColor());
line_title_label->hide();
line_description_label->hide();
line_artist_label->hide();
@ -629,7 +649,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
case RDLogLine::TrafficLink:
line_icon_label->setPixmap(*line_traffic_map);
// setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR));
SetPalette(line_marker_palette,logline->groupColor());
line_title_label->hide();
line_description_label->hide();
line_artist_label->hide();
@ -644,7 +664,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
case RDLogLine::Chain:
line_icon_label->setPixmap(*line_chain_map);
// setBackgroundColor(QColor(LOGLINEBOX_CHAIN_COLOR));
SetPalette(line_chain_palette,logline->groupColor());
line_title_label->setText(logline->markerLabel());
line_description_label->setText("");
line_artist_label->setText(logline->markerComment());
@ -665,10 +685,10 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type,
cut=new RDCut(QString::asprintf("%06u_%03u",logline->cartNumber(),
logline->cutNumber()));
if(!cart->exists()) {
// setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR));
SetPalette(line_error_palette,logline->groupColor());
}
else {
// setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR));
SetPalette(line_default_palette,logline->groupColor());
}
line_cart_label->setText(QString::asprintf("%06u",cart->number()));
line_cut_label->setText("");
@ -712,7 +732,7 @@ void LogLineBox::setTimer(int msecs)
void LogLineBox::clear()
{
// setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR));
SetPalette(line_default_palette,Qt::black);
line_cart_label->setText("");
line_cut_label->setText("");
line_group_label->setText("");
@ -834,7 +854,12 @@ void LogLineBox::mouseDoubleClickEvent(QMouseEvent *e)
void LogLineBox::resizeEvent(QResizeEvent *e)
{
line_comment_label->setGeometry(5,18,size().width()-10,62);
if(line_mode==LogLineBox::Full) {
line_comment_label->setGeometry(5,18,size().width()-10,15);
}
else {
line_comment_label->setGeometry(5,18,size().width()-10,62);
}
line_icon_label->setGeometry(5,3,16,16);
line_cart_label->setGeometry(23,3,48,16);
@ -845,9 +870,9 @@ void LogLineBox::resizeEvent(QResizeEvent *e)
line_length_label->setGeometry(327,3,50,16);
line_trans_label->setGeometry(379,3,48,16);
line_title_label->setGeometry(5,18,size().width()-10,18);
line_title_label->setGeometry(5,18,size().width()-10,16);
line_artist_label->setGeometry(5,33,size().width()-10,16);
line_artist_label->setGeometry(5,32,size().width()-10,15);
line_outcue_label->setGeometry(5,
48,
@ -868,8 +893,9 @@ void LogLineBox::paintEvent(QPaintEvent *e)
{
QPainter *p=new QPainter(this);
p->fillRect(0,0,size().width()-2,size().height()-2,
QGuiApplication::palette().color(QPalette::Background));
p->drawRect(0,0,size().width()-2,size().height()-2);
palette().color(QPalette::Window));
p->setPen(palette().color(QPalette::Dark));
p->drawRect(0,0,size().width()-1,size().height()-1);
p->end();
delete p;
}
@ -895,6 +921,23 @@ void LogLineBox::dropEvent(QDropEvent *e)
}
void LogLineBox::SetPalette(const QPalette &pal,const QColor &grp_color)
{
// printf("%d:SetPalette(%s,%s)\n",log_line,
// pal.color(QPalette::WindowText).name().toUtf8().constData(),
// pal.color(QPalette::Window).name().toUtf8().constData());
setPalette(pal);
setStyleSheet("color:"+pal.color(QPalette::WindowText).name()+
";background-color:"+pal.color(QPalette::Window).name());
QPalette pal1=pal;
pal1.setColor(QPalette::WindowText,grp_color);
line_group_label->setPalette(pal1);
line_group_label->
setStyleSheet("color:"+pal1.color(QPalette::WindowText).name()+
";background-color:"+pal1.color(QPalette::Window).name());
}
void LogLineBox::UpdateCountdown()
{
QTime current=QTime::currentTime().addMSecs(rda->station()->timeOffset());

View File

@ -75,6 +75,7 @@ class LogLineBox : public RDWidget
void dropEvent(QDropEvent *e);
private:
void SetPalette(const QPalette &pal,const QColor &grp_color);
void UpdateCountdown();
void PrintTime();
LogLineBox::Mode line_mode;
@ -103,6 +104,11 @@ class LogLineBox : public RDWidget
QFont line_font;
QFont talk_font;
QFont line_bold_font;
QPalette line_chain_palette;
QPalette line_default_palette;
QPalette line_error_palette;
QPalette line_evergreen_palette;
QPalette line_marker_palette;
QPalette line_unchanged_stop_palette;
QPalette line_unchanged_play_palette;
QPalette line_changed_stop_palette;