Merge branch 'deltecent-rdairplay-qt4'

This commit is contained in:
Fred Gleason 2018-11-09 12:49:44 -05:00
commit a836463fc0
5 changed files with 36 additions and 89 deletions

View File

@ -18001,3 +18001,5 @@
* Removed superceded 'StatusTip' class from rdmonitor(1).
2018-11-09 Fred Gleason <fredg@paravelsystems.com>
* Restored cart note bubbles in rdlibrary(1).
2018-11-09 Patrick Linstruth <patrick@deltecent.com>
* Fixed a regression in rdairplay(1) pie widget.

View File

@ -69,7 +69,6 @@
#define PIE_FINAL_COLOR Qt::black
#define PIE_FINAL_BG_COLOR Qt::white
#define PIE_ONAIR_COLOR Qt::red
#define PIE_ONAIR_OFF_COLOR Qt::gray
//
// Widget Colors

View File

@ -40,26 +40,38 @@ PieCounter::PieCounter(int count_length,QWidget *parent)
pie_op_mode=RDAirPlayConf::LiveAssist;
pie_trans_type=RDLogLine::Stop;
air_line=-1;
pie_onair=false;
const int ring = (PIE_COUNTER_BBOX-PIE_COUNTER_SIZE)/2;
QFont font=QFont("Helvetica",30,QFont::Bold);
font.setPixelSize(30);
onair_on_palette=palette();
onair_on_palette.setColor(QPalette::Background,PIE_ONAIR_COLOR);
onair_off_palette=palette();
setAutoFillBackground(true);
pie_time_label=new QLabel(":00",this,"pie_time_label");
pie_time_label->
setGeometry(PIE_X_PADDING+ring+25,PIE_Y_PADDING+ring+32,48,36);
time_label_palette=palette();
time_label_palette.setColor(QPalette::Background,Qt::lightGray);
time_label_palette.setColor(QPalette::Foreground,PIE_FINAL_COLOR);
pie_time_label->setPalette(time_label_palette);
pie_time_label->setFont(font);
pie_time_label->setAlignment(Qt::AlignCenter);
pie_time_label->setAutoFillBackground(true);
pie_time_label->hide();
pie_talk_label=new QLabel(":00",this,"pie_talk_label");
pie_talk_label->
setGeometry(PIE_X_PADDING+ring+25,PIE_Y_PADDING+ring+32,48,36);
QPalette pal=palette();
pal.
setColor(QPalette::Active,QColorGroup::Foreground,QColor(PIE_TALK_COLOR));
pie_talk_label->setPalette(pal);
talk_label_palette=palette();
talk_label_palette.setColor(QPalette::Background,Qt::lightGray);
talk_label_palette.setColor(QPalette::Foreground,PIE_TALK_COLOR);
pie_talk_label->setPalette(talk_label_palette);
pie_talk_label->setFont(font);
pie_talk_label->setAlignment(Qt::AlignCenter);
pie_talk_label->setAutoFillBackground(true);
pie_talk_label->hide();
pie_logline=NULL;
@ -160,15 +172,6 @@ void PieCounter::setLogline(RDLogLine *logline)
}
void PieCounter::setErasePixmap(const QPixmap &pix)
{
pie_pixmap=pix;
if(!pie_onair) {
QWidget::setErasePixmap(pie_pixmap);
}
}
void PieCounter::stop()
{
pie_running=false;
@ -181,20 +184,11 @@ void PieCounter::stop()
void PieCounter::setOnairFlag(bool state)
{
if(state) {
setBackgroundColor(PIE_ONAIR_COLOR);
QWidget::setErasePixmap(QPixmap());
pie_time_label->setBackgroundColor(PIE_ONAIR_COLOR);
pie_talk_label->setBackgroundColor(PIE_ONAIR_COLOR);
setPalette(onair_on_palette);
}
else {
setBackgroundColor(PIE_ONAIR_OFF_COLOR);
if(!pie_pixmap.isNull()) {
QWidget::setErasePixmap(pie_pixmap);
}
pie_time_label->setBackgroundColor(PIE_ONAIR_OFF_COLOR);
pie_talk_label->setBackgroundColor(PIE_ONAIR_OFF_COLOR);
setPalette(onair_off_palette);
}
pie_onair=state;
}
@ -238,6 +232,7 @@ void PieCounter::paintEvent(QPaintEvent *e)
{
int pie_pos=pie_length-pie_time;
static QPixmap pix=QPixmap(PIE_COUNTER_BBOX,PIE_COUNTER_BBOX);
pix.fill(Qt::transparent);
const int ring = (PIE_COUNTER_BBOX-PIE_COUNTER_SIZE)/2;
int angle=(int)(((double)pie_time*5760.0)/(double)pie_length);
int talk_start=
@ -253,14 +248,8 @@ void PieCounter::paintEvent(QPaintEvent *e)
if (pie_time > pie_count_length)
ring_angle = 0;
if(pie_onair||pie_pixmap.isNull()) {
p->fillRect(0,0,PIE_COUNTER_BBOX,PIE_COUNTER_BBOX,PIE_ONAIR_COLOR);
}
else {
p->drawPixmap(-PIE_X_PADDING,-PIE_Y_PADDING,pie_pixmap);
}
if((!pie_running)||(pie_length==0)||(angle>5760)) {
p->setBrush (PIE_FINAL_BG_COLOR);
p->setBrush(PIE_FINAL_BG_COLOR);
p->setPen(PIE_FINAL_BG_COLOR);
p->drawPie(0,0,PIE_COUNTER_BBOX,PIE_COUNTER_BBOX,0,5759);
p->setBrush(PIE_COUNTER_COLOR);
@ -270,7 +259,7 @@ void PieCounter::paintEvent(QPaintEvent *e)
else {
// Clear the pixmap
// This is the outer ring
p->setBrush (PIE_FINAL_BG_COLOR);
p->setBrush(PIE_FINAL_BG_COLOR);
p->setPen(PIE_FINAL_BG_COLOR);
p->drawPie(0,0,PIE_COUNTER_BBOX,PIE_COUNTER_BBOX,0,5759);
p->setBrush(PIE_FINAL_COLOR);
@ -298,8 +287,8 @@ void PieCounter::paintEvent(QPaintEvent *e)
if(((pie_time<pie_count_length)&&(pie_time>0))||
((((750+pie_talk_end-pie_pos)/1000)<100)&&
((pie_pos>=pie_talk_start)&&(pie_pos<=pie_talk_end)))) {
p->setBrush(PIE_ONAIR_OFF_COLOR);
p->setPen(PIE_ONAIR_OFF_COLOR);
p->setBrush(Qt::lightGray);
p->setPen(Qt::lightGray);
p->drawPie(ring+20,ring+20,PIE_COUNTER_SIZE-40,PIE_COUNTER_SIZE-40,0,5760);
}
}

View File

@ -67,7 +67,6 @@ class PieCounter : public QWidget
void start(int offset=0);
void stop();
void setLogline(RDLogLine *logline);
void setErasePixmap(const QPixmap &pix);
public slots:
void setOnairFlag(bool state);
@ -90,9 +89,12 @@ class PieCounter : public QWidget
RDAirPlayConf::OpMode pie_op_mode;
RDLogLine::TransType pie_trans_type;
int air_line;
QPalette time_label_palette;
QPalette talk_label_palette;
QPalette onair_on_palette;
QPalette onair_off_palette;
RDLogLine *pie_logline;
QPixmap pie_pixmap;
bool pie_onair;
};
#endif

View File

@ -88,12 +88,9 @@ MainWidget::MainWidget(QWidget *parent)
int ports[3];
QString start_rmls[3];
QString stop_rmls[3];
QPixmap *mainmap=NULL;
QPixmap *pm=NULL;
QPainter *pd=NULL;
QPixmap bgmap;
QString err_msg;
air_refresh_pixmap=NULL;
air_panel=NULL;
//
@ -233,15 +230,12 @@ MainWidget::MainWidget(QWidget *parent)
air_op_mode[i]=RDAirPlayConf::Previous;
}
air_editor_cmd=rda->station()->editorPath();
mainmap=new QPixmap(rda->airplayConf()->skinPath());
if(mainmap->isNull()||(mainmap->width()<1024)||(mainmap->height()<738)) {
delete mainmap;
mainmap=NULL;
bgmap=QPixmap(rda->airplayConf()->skinPath());
if(!bgmap.isNull()&&(bgmap.width()>=1024)&&(bgmap.height()>=738)) {
QPalette palette;
palette.setBrush(backgroundRole(),bgmap);
setPalette(palette);
}
else {
setErasePixmap(*mainmap);
}
//
// Load GPIO Channel Configuration
//
@ -428,15 +422,6 @@ MainWidget::MainWidget(QWidget *parent)
air_pie_end=rda->airplayConf()->pieEndPoint();
air_pie_counter->setOpMode(air_op_mode[0]);
air_pie_counter->setFocusPolicy(Qt::NoFocus);
if(mainmap!=NULL) {
pm=new QPixmap(1024,738);
pd=new QPainter(pm);
pd->drawPixmap(-426,-5,*mainmap);
pd->end();
air_pie_counter->setErasePixmap(*pm);
delete pd;
delete pm;
}
connect(air_master_timer,SIGNAL(timeout()),
air_pie_counter,SLOT(tickCounter()));
connect(rda->ripc(),SIGNAL(onairFlagChanged(bool)),
@ -568,14 +553,6 @@ MainWidget::MainWidget(QWidget *parent)
p.setColor(QColorGroup::Foreground,Qt::red);
air_refresh_label->setPalette(p);
air_refresh_label->setAlignment(Qt::AlignCenter);
if(mainmap!=NULL) {
air_refresh_pixmap=new QPixmap(1024,738);
pd=new QPainter(air_refresh_pixmap);
pd->drawPixmap(-390,-sizeHint().height()+65,*mainmap);
pd->end();
air_refresh_label->setErasePixmap(*air_refresh_pixmap);
delete pd;
}
//
// Meter Timer
@ -600,15 +577,6 @@ MainWidget::MainWidget(QWidget *parent)
air_panel->setLogfile(rda->config()->airplayLogname());
air_panel->setGeometry(510,140,air_panel->sizeHint().width(),
air_panel->sizeHint().height());
if(mainmap!=NULL) {
pm=new QPixmap(1024,738);
pd=new QPainter(pm);
pd->drawPixmap(-510,-140,*mainmap);
pd->end();
air_panel->setErasePixmap(*pm);
delete pd;
delete pm;
}
air_panel->setPauseEnabled(rda->airplayConf()->panelPauseEnabled());
air_panel->setCard(0,rda->airplayConf()->card(RDAirPlayConf::SoundPanel1Channel));
air_panel->setPort(0,rda->airplayConf()->port(RDAirPlayConf::SoundPanel1Channel));
@ -786,15 +754,6 @@ MainWidget::MainWidget(QWidget *parent)
air_pause_enabled,this);
air_button_list->setGeometry(10,140,air_button_list->sizeHint().width(),
air_button_list->sizeHint().height());
if(mainmap!=NULL) {
pm=new QPixmap(1024,738);
pd=new QPainter(pm);
pd->drawPixmap(-10,-140,*mainmap);
pd->end();
air_button_list->setErasePixmap(*pm);
delete pd;
delete pm;
}
connect(air_button_list,SIGNAL(selectClicked(int,int,RDLogLine::Status)),
this,SLOT(selectClickedData(int,int,RDLogLine::Status)));
connect(air_button_list,SIGNAL(cartDropped(int,int,RDLogLine *)),
@ -1916,13 +1875,9 @@ void MainWidget::timeModeData(RDAirPlayConf::TimeMode mode)
void MainWidget::refreshStatusChangedData(bool active)
{
if(active) {
air_refresh_label->setErasePixmap(QPixmap());
air_refresh_label->setText(tr("LOG\nREFRESHING"));
}
else {
if(air_refresh_pixmap!=NULL) {
air_refresh_label->setErasePixmap(*air_refresh_pixmap);
}
air_refresh_label->setText("");
}
//