2021-07-06 Fred Gleason <fredg@paravelsystems.com>

* Modified the buttons in the Sound Panel widget in rdairplay(1) to
	display channel labels when playing.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-07-06 12:07:14 -04:00
parent aa5238acf2
commit 6da2004233
5 changed files with 55 additions and 19 deletions

View File

@ -22002,3 +22002,6 @@
2021-07-03 Fred Gleason <fredg@paravelsystems.com>
* Modified the buttons in the Button Log widget in rdairplay(1) to
display channel labels when playing.
2021-07-06 Fred Gleason <fredg@paravelsystems.com>
* Modified the buttons in the Sound Panel widget in rdairplay(1) to
display channel labels when playing.

View File

@ -1057,6 +1057,35 @@ QString RDAirPlayConf::channelText(RDAirPlayConf::Channel chan)
}
QString RDAirPlayConf::soundPanelChannelName(int mport)
{
return portLabel(RDAirPlayConf::soundPanelChannel(mport));
}
RDAirPlayConf::Channel RDAirPlayConf::soundPanelChannel(int mport)
{
switch(mport-1) {
case 0:
return RDAirPlayConf::SoundPanel1Channel;
case 1:
return RDAirPlayConf::SoundPanel2Channel;
case 2:
return RDAirPlayConf::SoundPanel3Channel;
case 3:
return RDAirPlayConf::SoundPanel4Channel;
case 4:
return RDAirPlayConf::SoundPanel5Channel;
}
return RDAirPlayConf::CueChannel;
}
QString RDAirPlayConf::logModeText(RDAirPlayConf::OpMode mode)
{
QString ret=QObject::tr("Unknown");

View File

@ -160,6 +160,8 @@ class RDAirPlayConf
void setLogNowCart(int lognum,unsigned cartnum) const;
unsigned logNextCart(int lognum) const;
void setLogNextCart(int lognum,unsigned cartnum) const;
QString soundPanelChannelName(int mport);
static Channel soundPanelChannel(int mport);
static QString channelText(RDAirPlayConf::Channel chan);
static QString logModeText(RDAirPlayConf::OpMode mode);

View File

@ -471,9 +471,11 @@ void RDPanelButton::WriteKeycap(int secs)
}
else {
if(button_active_length>=0) {
p->drawText(RDPANEL_BUTTON_MARGIN,size().height()-2-
RDPANEL_BUTTON_MARGIN,
RDGetTimeLength(button_active_length+1000,true,false));
QString lenstr=RDGetTimeLength(button_active_length+1000,true,false);
p->drawText(size().width()-p->fontMetrics().width(lenstr)-
RDPANEL_BUTTON_MARGIN-2,
size().height()-2-RDPANEL_BUTTON_MARGIN,
lenstr);
}
else {
p->drawText(RDPANEL_BUTTON_MARGIN,size().height()-2-
@ -482,20 +484,15 @@ void RDPanelButton::WriteKeycap(int secs)
}
}
else {
if(secs>8) {
p->drawText(RDPANEL_BUTTON_MARGIN,size().height()-2-RDPANEL_BUTTON_MARGIN,
RDGetTimeLength(1000*(secs+1),true,false));
}
else {
p->setFont(timerFont());
QString secstr=QString().sprintf(":%d",secs+1);
p->drawText(RDPANEL_BUTTON_MARGIN,size().height()-2-RDPANEL_BUTTON_MARGIN,secstr);
}
p->setFont(bannerFont());
QFontMetrics om(timerFont());
p->drawText(size().width()-2-om.width(button_output_text)-
RDPANEL_BUTTON_MARGIN,
size().height()-2-RDPANEL_BUTTON_MARGIN,button_output_text);
QString lenstr=RDGetTimeLength(button_active_length+1000,true,false);
p->drawText(size().width()-p->fontMetrics().width(lenstr)-
RDPANEL_BUTTON_MARGIN-2,
size().height()-2-RDPANEL_BUTTON_MARGIN,
lenstr);
p->setFont(bigLabelFont());
p->drawText((size().width()-p->fontMetrics().width(button_output_text))/2,
74*size().height()/100,
button_output_text);
}
}
p->end();

View File

@ -542,7 +542,9 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
channum[1]=2;
}
for(int i=0;i<PANEL_MAX_OUTPUTS;i++) {
air_panel->soundPanelWidget()->setOutputText(i,QString().sprintf("%d",next_output++));
air_panel->soundPanelWidget()->
setOutputText(i,rda->airplayConf()->soundPanelChannelName(next_output++));
//air_panel->soundPanelWidget()->setOutputText(i,QString().sprintf("%d",next_output++));
assigned=false;
for(int j=0;j<2;j++) {
if((air_panel->soundPanelWidget()->
@ -550,7 +552,10 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
(air_panel->soundPanelWidget()->
port((RDAirPlayConf::Channel)i)==air_log[0]->port(j))) {
air_panel->soundPanelWidget()->
setOutputText(i,QString().sprintf("%d",channum[j]));
setOutputText(i,rda->airplayConf()->
soundPanelChannelName(channum[j]));
//air_panel->soundPanelWidget()->
//setOutputText(i,QString().sprintf("%d",channum[j]));
next_output--;
assigned=true;
j=2;