mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-08 16:37:46 +02:00
2021-07-06 Fred Gleason <fredg@paravelsystems.com>
* Modified the start buttons in rdcartslots(1) to display channel labels. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
cd9db41011
commit
fcace16d02
@ -22008,3 +22008,6 @@
|
|||||||
2021-07-06 Fred Gleason <fredg@paravelsystems.com>
|
2021-07-06 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Modified the sound panel buttons in rdpanel(1) to display channel
|
* Modified the sound panel buttons in rdpanel(1) to display channel
|
||||||
labels when playing.
|
labels when playing.
|
||||||
|
2021-07-06 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Modified the start buttons in rdcartslots(1) to display channel
|
||||||
|
labels.
|
||||||
|
@ -244,6 +244,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
|||||||
rdsimpleplayer.cpp rdsimpleplayer.h\
|
rdsimpleplayer.cpp rdsimpleplayer.h\
|
||||||
rdslider.cpp rdslider.h\
|
rdslider.cpp rdslider.h\
|
||||||
rdslotbox.cpp rdslotbox.h\
|
rdslotbox.cpp rdslotbox.h\
|
||||||
|
rdslotbutton.cpp rdslotbutton.h\
|
||||||
rdslotdialog.cpp rdslotdialog.h\
|
rdslotdialog.cpp rdslotdialog.h\
|
||||||
rdslotoptions.cpp rdslotoptions.h\
|
rdslotoptions.cpp rdslotoptions.h\
|
||||||
rdsocket.cpp rdsocket.h\
|
rdsocket.cpp rdsocket.h\
|
||||||
@ -410,6 +411,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
|||||||
moc_rdsocket.cpp\
|
moc_rdsocket.cpp\
|
||||||
moc_rdsound_panel.cpp\
|
moc_rdsound_panel.cpp\
|
||||||
moc_rdslotbox.cpp\
|
moc_rdslotbox.cpp\
|
||||||
|
moc_rdslotbutton.cpp\
|
||||||
moc_rdslotdialog.cpp\
|
moc_rdslotdialog.cpp\
|
||||||
moc_rdstationlistmodel.cpp\
|
moc_rdstationlistmodel.cpp\
|
||||||
moc_rdstereometer.cpp\
|
moc_rdstereometer.cpp\
|
||||||
|
@ -183,6 +183,7 @@ SOURCES += rdsettings.cpp
|
|||||||
SOURCES += rdservicelistmodel.cpp
|
SOURCES += rdservicelistmodel.cpp
|
||||||
SOURCES += rdsimpleplayer.cpp
|
SOURCES += rdsimpleplayer.cpp
|
||||||
SOURCES += rdslider.cpp
|
SOURCES += rdslider.cpp
|
||||||
|
SOURCES += rdslotbutton.cpp
|
||||||
SOURCES += rdsocket.cpp
|
SOURCES += rdsocket.cpp
|
||||||
SOURCES += rdsocketstrings.cpp
|
SOURCES += rdsocketstrings.cpp
|
||||||
SOURCES += rdsound_panel.cpp
|
SOURCES += rdsound_panel.cpp
|
||||||
@ -370,6 +371,7 @@ HEADERS += rdservicelistmodel.h
|
|||||||
HEADERS += rdsettings.h
|
HEADERS += rdsettings.h
|
||||||
HEADERS += rdsimpleplayer.h
|
HEADERS += rdsimpleplayer.h
|
||||||
HEADERS += rdslider.h
|
HEADERS += rdslider.h
|
||||||
|
HEADERS += rdslotbutton.h
|
||||||
HEADERS += rdsocket.h
|
HEADERS += rdsocket.h
|
||||||
HEADERS += rdsocketstrings.h
|
HEADERS += rdsocketstrings.h
|
||||||
HEADERS += rdsound_panel.h
|
HEADERS += rdsound_panel.h
|
||||||
|
@ -87,10 +87,13 @@ RDCartSlot::RDCartSlot(int slotnum,RDRipc *ripc,RDCae *cae,RDStation *station,
|
|||||||
//
|
//
|
||||||
// Start Button
|
// Start Button
|
||||||
//
|
//
|
||||||
slot_start_button=new QPushButton(QString().sprintf("%d",slotnum+1),this);
|
slot_start_button=new RDSlotButton(slotnum,this);
|
||||||
|
slot_start_button->setPortLabel(slot_options->outputPortLabel());
|
||||||
slot_start_button->setGeometry(0,0,sizeHint().height(),sizeHint().height());
|
slot_start_button->setGeometry(0,0,sizeHint().height(),sizeHint().height());
|
||||||
slot_start_button->setFont(hugeButtonFont());
|
slot_start_button->setFont(hugeButtonFont());
|
||||||
slot_start_button->setDisabled(true);
|
slot_start_button->setDisabled(true);
|
||||||
|
connect(slot_deck,SIGNAL(stateChanged(int,RDPlayDeck::State)),
|
||||||
|
slot_start_button,SLOT(setState(int,RDPlayDeck::State)));
|
||||||
connect(slot_start_button,SIGNAL(clicked()),this,SLOT(startData()));
|
connect(slot_start_button,SIGNAL(clicked()),this,SLOT(startData()));
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -473,7 +476,6 @@ void RDCartSlot::stateChangedData(int id,RDPlayDeck::State state)
|
|||||||
LogPlayout(state);
|
LogPlayout(state);
|
||||||
slot_start_button->
|
slot_start_button->
|
||||||
setEnabled(slot_options->mode()==RDSlotOptions::CartDeckMode);
|
setEnabled(slot_options->mode()==RDSlotOptions::CartDeckMode);
|
||||||
slot_start_button->setPalette(slot_playing_color);
|
|
||||||
slot_load_button->setDisabled(true);
|
slot_load_button->setDisabled(true);
|
||||||
slot_options_button->setDisabled(true);
|
slot_options_button->setDisabled(true);
|
||||||
break;
|
break;
|
||||||
@ -483,7 +485,6 @@ void RDCartSlot::stateChangedData(int id,RDPlayDeck::State state)
|
|||||||
LogPlayout(state);
|
LogPlayout(state);
|
||||||
slot_start_button->
|
slot_start_button->
|
||||||
setEnabled(slot_options->mode()==RDSlotOptions::CartDeckMode);
|
setEnabled(slot_options->mode()==RDSlotOptions::CartDeckMode);
|
||||||
slot_start_button->setPalette(slot_ready_color);
|
|
||||||
slot_load_button->setEnabled(true);
|
slot_load_button->setEnabled(true);
|
||||||
slot_options_button->setEnabled(true);
|
slot_options_button->setEnabled(true);
|
||||||
slot_box->setTimer(0);
|
slot_box->setTimer(0);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// The cart slot widget.
|
// The cart slot widget.
|
||||||
//
|
//
|
||||||
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2012-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
|
||||||
@ -25,6 +25,7 @@
|
|||||||
#include <rdcueeditdialog.h>
|
#include <rdcueeditdialog.h>
|
||||||
#include <rdlistsvcs.h>
|
#include <rdlistsvcs.h>
|
||||||
#include <rdslotbox.h>
|
#include <rdslotbox.h>
|
||||||
|
#include <rdslotbutton.h>
|
||||||
#include <rdslotdialog.h>
|
#include <rdslotdialog.h>
|
||||||
#include <rdwidget.h>
|
#include <rdwidget.h>
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ class RDCartSlot : public RDWidget
|
|||||||
void SetInput(bool state);
|
void SetInput(bool state);
|
||||||
void LogPlayout(RDPlayDeck::State state);
|
void LogPlayout(RDPlayDeck::State state);
|
||||||
void ClearTempCart();
|
void ClearTempCart();
|
||||||
QPushButton *slot_start_button;
|
RDSlotButton *slot_start_button;
|
||||||
QPushButton *slot_load_button;
|
QPushButton *slot_load_button;
|
||||||
QPushButton *slot_options_button;
|
QPushButton *slot_options_button;
|
||||||
std::vector<QString> *slot_svc_names;
|
std::vector<QString> *slot_svc_names;
|
||||||
|
122
lib/rdslotbutton.cpp
Normal file
122
lib/rdslotbutton.cpp
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
// rdslotbutton.cpp
|
||||||
|
//
|
||||||
|
// Start/stop button for rdcartslots(1).
|
||||||
|
//
|
||||||
|
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Library General Public License
|
||||||
|
// version 2 as published by the Free Software Foundation.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public
|
||||||
|
// License along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QBitmap>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
|
#include "rdslotbutton.h"
|
||||||
|
|
||||||
|
RDSlotButton::RDSlotButton(int slotnum,QWidget *parent,RDConfig *c)
|
||||||
|
: QPushButton(parent), RDFontEngine(c)
|
||||||
|
{
|
||||||
|
d_slot_number=slotnum;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Palettes
|
||||||
|
//
|
||||||
|
d_ready_color=
|
||||||
|
QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR),
|
||||||
|
palette().color(QPalette::Background));
|
||||||
|
d_playing_color=
|
||||||
|
QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR),
|
||||||
|
palette().color(QPalette::Background));
|
||||||
|
setFocusPolicy(Qt::NoFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int RDSlotButton::slotNumber() const
|
||||||
|
{
|
||||||
|
return d_slot_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString RDSlotButton::portLabel() const
|
||||||
|
{
|
||||||
|
return d_port_label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDSlotButton::setState(int id,RDPlayDeck::State state)
|
||||||
|
{
|
||||||
|
switch(state) {
|
||||||
|
case RDPlayDeck::Playing:
|
||||||
|
setPalette(d_playing_color);
|
||||||
|
WriteKeycap();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RDPlayDeck::Stopped:
|
||||||
|
case RDPlayDeck::Finished:
|
||||||
|
setPalette(d_ready_color);
|
||||||
|
WriteKeycap();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RDPlayDeck::Stopping:
|
||||||
|
case RDPlayDeck::Paused:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDSlotButton::setPortLabel(const QString &str)
|
||||||
|
{
|
||||||
|
if(str!=d_port_label) {
|
||||||
|
d_port_label=str;
|
||||||
|
WriteKeycap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDSlotButton::resizeEvent(QResizeEvent *e)
|
||||||
|
{
|
||||||
|
setIconSize(QSize(size().width()-4,size().height()-4));
|
||||||
|
WriteKeycap();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDSlotButton::WriteKeycap()
|
||||||
|
{
|
||||||
|
int w=size().width();
|
||||||
|
int h=size().height();
|
||||||
|
|
||||||
|
QPixmap *pix=new QBitmap(w-4,h-4);
|
||||||
|
QPainter *p=new QPainter(pix);
|
||||||
|
p->setRenderHint(QPainter::Antialiasing,true);
|
||||||
|
p->setRenderHint(QPainter::SmoothPixmapTransform,true);
|
||||||
|
p->setPen(Qt::black);
|
||||||
|
p->setBrush(Qt::black);
|
||||||
|
p->fillRect(0,0,w,h,palette().color(QPalette::Background));
|
||||||
|
|
||||||
|
p->setFont(hugeButtonFont());
|
||||||
|
p->drawText((w-p->fontMetrics().width(QString().
|
||||||
|
sprintf("%d",1+d_slot_number)))/2,
|
||||||
|
p->fontMetrics().height(),
|
||||||
|
QString().sprintf("%d",1+d_slot_number));
|
||||||
|
|
||||||
|
p->setFont(bigLabelFont());
|
||||||
|
p->drawText((w-p->fontMetrics().width(d_port_label))/2,
|
||||||
|
3*h/4,
|
||||||
|
d_port_label);
|
||||||
|
|
||||||
|
p->end();
|
||||||
|
setIcon(*pix);
|
||||||
|
|
||||||
|
delete p;
|
||||||
|
delete pix;
|
||||||
|
}
|
54
lib/rdslotbutton.h
Normal file
54
lib/rdslotbutton.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// rdslotbutton.h
|
||||||
|
//
|
||||||
|
// Start/stop button for rdcartslots(1).
|
||||||
|
//
|
||||||
|
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Library General Public License
|
||||||
|
// version 2 as published by the Free Software Foundation.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public
|
||||||
|
// License along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef RDSLOTBUTTON_H
|
||||||
|
#define RDSLOTBUTTON_H
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include <rdfontengine.h>
|
||||||
|
#include <rdplay_deck.h>
|
||||||
|
|
||||||
|
class RDSlotButton : public QPushButton, public RDFontEngine
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
RDSlotButton(int slotnum,QWidget *parent,RDConfig *c=NULL);
|
||||||
|
int slotNumber() const;
|
||||||
|
QString portLabel() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setState(int id,RDPlayDeck::State state);
|
||||||
|
void setPortLabel(const QString &str);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void WriteKeycap();
|
||||||
|
int d_slot_number;
|
||||||
|
RDPlayDeck::State d_dstate;
|
||||||
|
QString d_port_label;
|
||||||
|
QPalette d_ready_color;
|
||||||
|
QPalette d_playing_color;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // RDSLOTBUTTON_H
|
@ -130,6 +130,12 @@ int RDSlotOptions::outputPort() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString RDSlotOptions::outputPortLabel() const
|
||||||
|
{
|
||||||
|
return set_output_port_label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RDSlotOptions::load()
|
bool RDSlotOptions::load()
|
||||||
{
|
{
|
||||||
bool ret=false;
|
bool ret=false;
|
||||||
@ -137,21 +143,25 @@ bool RDSlotOptions::load()
|
|||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
|
|
||||||
sql=QString("select ")+
|
sql=QString("select ")+
|
||||||
"`CARD`,"+ // 00
|
"`CARTSLOTS`.`CARD`,"+ // 00
|
||||||
"`INPUT_PORT`,"+ // 01
|
"`CARTSLOTS`.`INPUT_PORT`,"+ // 01
|
||||||
"`OUTPUT_PORT`,"+ // 02
|
"`CARTSLOTS`.`OUTPUT_PORT`,"+ // 02
|
||||||
"`MODE`,"+ // 03
|
"`CARTSLOTS`.`MODE`,"+ // 03
|
||||||
"`DEFAULT_MODE`,"+ // 04
|
"`CARTSLOTS`.`DEFAULT_MODE`,"+ // 04
|
||||||
"`HOOK_MODE`,"+ // 05
|
"`CARTSLOTS`.`HOOK_MODE`,"+ // 05
|
||||||
"`DEFAULT_HOOK_MODE`,"+ // 06
|
"`CARTSLOTS`.`DEFAULT_HOOK_MODE`,"+ // 06
|
||||||
"`STOP_ACTION`,"+ // 07
|
"`CARTSLOTS`.`STOP_ACTION`,"+ // 07
|
||||||
"`DEFAULT_STOP_ACTION`,"+ // 08
|
"`CARTSLOTS`.`DEFAULT_STOP_ACTION`,"+ // 08
|
||||||
"`CART_NUMBER`,"+ // 09
|
"`CARTSLOTS`.`CART_NUMBER`,"+ // 09
|
||||||
"`DEFAULT_CART_NUMBER`,"+ // 10
|
"`CARTSLOTS`.`DEFAULT_CART_NUMBER`,"+ // 10
|
||||||
"`SERVICE_NAME` "+ // 11
|
"`CARTSLOTS`.`SERVICE_NAME`,"+ // 11
|
||||||
"from `CARTSLOTS` where "+
|
"`AUDIO_OUTPUTS`.`LABEL` "+ // 12
|
||||||
"(`STATION_NAME`='"+RDEscapeString(set_stationname)+"')&&"+
|
"from `CARTSLOTS` left join `AUDIO_OUTPUTS` "+
|
||||||
QString().sprintf("(`SLOT_NUMBER`=%u)",set_slotno);
|
"on `CARTSLOTS`.`OUTPUT_PORT`=`AUDIO_OUTPUTS`.`PORT_NUMBER` where "+
|
||||||
|
"`AUDIO_OUTPUTS`.`STATION_NAME`='"+RDEscapeString(set_stationname)+"' && "+
|
||||||
|
"`AUDIO_OUTPUTS`.`CARD_NUMBER`=`CARTSLOTS`.`CARD` && "+
|
||||||
|
"`AUDIO_OUTPUTS`.`PORT_NUMBER`=`CARTSLOTS`.`OUTPUT_PORT` && "+
|
||||||
|
QString().sprintf("`CARTSLOTS`.`SLOT_NUMBER`=%u",set_slotno);
|
||||||
q=new RDSqlQuery(sql);
|
q=new RDSqlQuery(sql);
|
||||||
if(q->first()) {
|
if(q->first()) {
|
||||||
ret=true;
|
ret=true;
|
||||||
@ -162,6 +172,7 @@ bool RDSlotOptions::load()
|
|||||||
set_card=q->value(0).toInt();
|
set_card=q->value(0).toInt();
|
||||||
set_input_port=q->value(1).toInt();
|
set_input_port=q->value(1).toInt();
|
||||||
set_output_port=q->value(2).toInt();
|
set_output_port=q->value(2).toInt();
|
||||||
|
set_output_port_label=q->value(12).toString();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Mode
|
// Mode
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Container class for RDCartSlot options
|
// Container class for RDCartSlot options
|
||||||
//
|
//
|
||||||
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
|
// (C) Copyright 2012-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
|
||||||
@ -42,6 +42,7 @@ class RDSlotOptions
|
|||||||
int card() const;
|
int card() const;
|
||||||
int inputPort() const;
|
int inputPort() const;
|
||||||
int outputPort() const;
|
int outputPort() const;
|
||||||
|
QString outputPortLabel() const;
|
||||||
bool load();
|
bool load();
|
||||||
void save() const;
|
void save() const;
|
||||||
void clear();
|
void clear();
|
||||||
@ -57,6 +58,7 @@ class RDSlotOptions
|
|||||||
int set_card;
|
int set_card;
|
||||||
int set_input_port;
|
int set_input_port;
|
||||||
int set_output_port;
|
int set_output_port;
|
||||||
|
QString set_output_port_label;
|
||||||
QString set_stationname;
|
QString set_stationname;
|
||||||
unsigned set_slotno;
|
unsigned set_slotno;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user