mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-28 22:52:37 +02:00
2021-02-01 Fred Gleason <fredg@paravelsystems.com>
* Added 'RDNodeSlotsModel'. * Refactored the 'Viewing Livewire Node' dialog in rdadmin(1) to use the model-based API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
7cc1bf621b
commit
e25bec42a2
@ -20961,3 +20961,7 @@
|
||||
* Added 'RDNodeListModel'.
|
||||
* Refactored the 'LivewireNode List' dialog in rdadmin(1) to use the
|
||||
model-based API.
|
||||
2021-02-01 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added 'RDNodeSlotsModel'.
|
||||
* Refactored the 'Viewing Livewire Node' dialog in rdadmin(1) to use
|
||||
the model-based API.
|
||||
|
@ -195,6 +195,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdmp4.cpp rdmp4.h\
|
||||
rdmulticaster.cpp rdmulticaster.h\
|
||||
rdnodelistmodel.cpp rdnodelistmodelh\
|
||||
rdnodeslotsmodel.cpp rdnodeslotsmodel.h\
|
||||
rdnotification.cpp rdnotification.h\
|
||||
rdoneshot.cpp rdoneshot.h\
|
||||
rdpam.cpp rdpam.h\
|
||||
@ -356,6 +357,7 @@ nodist_librd_la_SOURCES = moc_rd3emptycart.cpp\
|
||||
moc_rdmblookup.cpp\
|
||||
moc_rdmulticaster.cpp\
|
||||
moc_rdnodelistmodel.cpp\
|
||||
moc_rdnodeslotsmodel.cpp\
|
||||
moc_rdoneshot.cpp\
|
||||
moc_rdpanel_button.cpp\
|
||||
moc_rdpasswd.cpp\
|
||||
|
@ -144,6 +144,7 @@ SOURCES += rdmatrixlistmodel.cpp
|
||||
SOURCES += rdmblookup.cpp
|
||||
SOURCES += rdmonitor_config.cpp
|
||||
SOURCES += rdnodelistmodel.cpp
|
||||
SOURCES += rdnodeslotsmodel.cpp
|
||||
SOURCES += rdnotification.cpp
|
||||
SOURCES += rdoneshot.cpp
|
||||
SOURCES += rdpanel_button.cpp
|
||||
@ -312,6 +313,7 @@ HEADERS += rdmatrixlistmodel.h
|
||||
HEADERS += rdmblookup.h
|
||||
HEADERS += rdmonitor_config.h
|
||||
HEADERS += rdnodelistmodel.h
|
||||
HEADERS += rdnodeslotsmodel.h
|
||||
HEADERS += rdnotification.h
|
||||
HEADERS += rdoneshot.h
|
||||
HEADERS += rdpanel_button.h
|
||||
|
@ -3387,6 +3387,57 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDNodeSlotsModel</name>
|
||||
<message>
|
||||
<source>#</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Active</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shareable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chans</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gain</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>[unassigned]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Load</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
<message>
|
||||
|
@ -3368,6 +3368,57 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDNodeSlotsModel</name>
|
||||
<message>
|
||||
<source>#</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Active</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shareable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chans</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gain</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>[unassigned]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Load</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
<message>
|
||||
|
@ -3355,6 +3355,57 @@ Do you still want to proceed?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDNodeSlotsModel</name>
|
||||
<message>
|
||||
<source>#</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Active</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shareable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chans</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gain</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>[unassigned]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Load</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
<message>
|
||||
|
@ -2791,6 +2791,57 @@ Do you want to overwrite it?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDNodeSlotsModel</name>
|
||||
<message>
|
||||
<source>#</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Active</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shareable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chans</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gain</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>[unassigned]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Load</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
<message>
|
||||
|
@ -3322,6 +3322,57 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDNodeSlotsModel</name>
|
||||
<message>
|
||||
<source>#</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Active</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shareable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chans</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gain</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>[unassigned]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Load</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
<message>
|
||||
|
@ -3322,6 +3322,57 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDNodeSlotsModel</name>
|
||||
<message>
|
||||
<source>#</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Active</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shareable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chans</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gain</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>[unassigned]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Load</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
<message>
|
||||
|
@ -3357,6 +3357,57 @@ Por Favor, cheque suas configurações e tenbte outra vez.</translation>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDNodeSlotsModel</name>
|
||||
<message>
|
||||
<source>#</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Active</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shareable</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Chans</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Gain</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Output #</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>[unassigned]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Load</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
<message>
|
||||
|
240
lib/rdnodeslotsmodel.cpp
Normal file
240
lib/rdnodeslotsmodel.cpp
Normal file
@ -0,0 +1,240 @@
|
||||
// rdnodeslotsmodel.cpp
|
||||
//
|
||||
// Data model for Rivendell switcher nodes.
|
||||
//
|
||||
// (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 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 "rdapplication.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdnodeslotsmodel.h"
|
||||
|
||||
RDNodeSlotsModel::RDNodeSlotsModel(bool is_src,QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{
|
||||
d_is_source=is_src;
|
||||
d_base_output=0;
|
||||
|
||||
//
|
||||
// Column Attributes
|
||||
//
|
||||
unsigned left=Qt::AlignLeft|Qt::AlignVCenter;
|
||||
unsigned center=Qt::AlignCenter;
|
||||
unsigned right=Qt::AlignRight|Qt::AlignVCenter;
|
||||
|
||||
if(d_is_source) {
|
||||
d_headers.push_back(tr("#"));
|
||||
d_alignments.push_back(right);
|
||||
|
||||
d_headers.push_back(tr("Input #"));
|
||||
d_alignments.push_back(right);
|
||||
|
||||
d_headers.push_back(tr("Name"));
|
||||
d_alignments.push_back(left);
|
||||
|
||||
d_headers.push_back(tr("Active"));
|
||||
d_alignments.push_back(center);
|
||||
|
||||
d_headers.push_back(tr("Shareable"));
|
||||
d_alignments.push_back(center);
|
||||
|
||||
d_headers.push_back(tr("Chans"));
|
||||
d_alignments.push_back(center);
|
||||
|
||||
d_headers.push_back(tr("Gain"));
|
||||
d_alignments.push_back(right);
|
||||
}
|
||||
else {
|
||||
d_headers.push_back(tr("#"));
|
||||
d_alignments.push_back(right);
|
||||
|
||||
d_headers.push_back(tr("Output #"));
|
||||
d_alignments.push_back(right);
|
||||
|
||||
d_headers.push_back(tr("Name"));
|
||||
d_alignments.push_back(left);
|
||||
|
||||
d_headers.push_back(tr("Chans"));
|
||||
d_alignments.push_back(center);
|
||||
|
||||
d_headers.push_back(tr("Load"));
|
||||
d_alignments.push_back(center);
|
||||
|
||||
d_headers.push_back(tr("Gain"));
|
||||
d_alignments.push_back(right);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RDNodeSlotsModel::~RDNodeSlotsModel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QPalette RDNodeSlotsModel::palette()
|
||||
{
|
||||
return d_palette;
|
||||
}
|
||||
|
||||
|
||||
void RDNodeSlotsModel::setPalette(const QPalette &pal)
|
||||
{
|
||||
d_palette=pal;
|
||||
}
|
||||
|
||||
|
||||
void RDNodeSlotsModel::setFont(const QFont &font)
|
||||
{
|
||||
d_font=font;
|
||||
d_bold_font=font;
|
||||
d_bold_font.setWeight(QFont::Bold);
|
||||
}
|
||||
|
||||
|
||||
int RDNodeSlotsModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
return d_headers.size();
|
||||
}
|
||||
|
||||
|
||||
int RDNodeSlotsModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return d_texts.size();
|
||||
}
|
||||
|
||||
|
||||
QVariant RDNodeSlotsModel::headerData(int section,Qt::Orientation orient,
|
||||
int role) const
|
||||
{
|
||||
if((orient==Qt::Horizontal)&&(role==Qt::DisplayRole)) {
|
||||
return d_headers.at(section);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
QVariant RDNodeSlotsModel::data(const QModelIndex &index,int role) const
|
||||
{
|
||||
QString str;
|
||||
int col=index.column();
|
||||
int row=index.row();
|
||||
|
||||
if(row<d_texts.size()) {
|
||||
switch((Qt::ItemDataRole)role) {
|
||||
case Qt::DisplayRole:
|
||||
return d_texts.at(row).at(col);
|
||||
|
||||
case Qt::DecorationRole:
|
||||
// Nothing to do!
|
||||
break;
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
return d_alignments.at(col);
|
||||
|
||||
case Qt::FontRole:
|
||||
if(col==0) {
|
||||
return d_bold_font;
|
||||
}
|
||||
return d_font;
|
||||
|
||||
case Qt::TextColorRole:
|
||||
// Nothing to do!
|
||||
break;
|
||||
|
||||
case Qt::BackgroundRole:
|
||||
// Nothing to do!
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
void RDNodeSlotsModel::setBaseOutput(int output)
|
||||
{
|
||||
d_base_output=output;
|
||||
}
|
||||
|
||||
|
||||
void RDNodeSlotsModel::setSlotQuantity(int slot_quan)
|
||||
{
|
||||
beginResetModel();
|
||||
d_texts.clear();
|
||||
QList<QVariant> texts;
|
||||
for(int i=0;i<columnCount();i++) {
|
||||
texts.push_back(QVariant());
|
||||
}
|
||||
for(int i=0;i<slot_quan;i++) {
|
||||
d_texts.push_back(texts);
|
||||
d_texts.back()[0]=QString().sprintf("%d",i+1);
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
||||
void RDNodeSlotsModel::updateSource(unsigned id,RDLiveWireSource *src)
|
||||
{
|
||||
if(d_is_source) {
|
||||
int slotnum=src->slotNumber()-1;
|
||||
if(src->channelNumber()<=0) {
|
||||
d_texts[slotnum][1]=tr("[unassigned]");
|
||||
}
|
||||
else {
|
||||
d_texts[slotnum][1]=QString().sprintf("%d",src->channelNumber());
|
||||
}
|
||||
d_texts[slotnum][2]=src->primaryName();
|
||||
if(src->rtpEnabled()) {
|
||||
d_texts[slotnum][3]=tr("Yes");
|
||||
}
|
||||
else {
|
||||
d_texts[slotnum][3]=tr("No");
|
||||
}
|
||||
if(src->shareable()) {
|
||||
d_texts[slotnum][4]=tr("Yes");
|
||||
}
|
||||
else {
|
||||
d_texts[slotnum][4]=tr("No");
|
||||
}
|
||||
d_texts[slotnum][5]=QString().sprintf("%d",src->channels());
|
||||
d_texts[slotnum][6]=QString().sprintf("%4.1f",(float)src->inputGain()/10.0);
|
||||
|
||||
emit dataChanged(createIndex(slotnum,0),
|
||||
createIndex(slotnum,columnCount()-1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDNodeSlotsModel::updateDestination(unsigned id,RDLiveWireDestination *dst)
|
||||
{
|
||||
if(!d_is_source) {
|
||||
int slotnum=dst->slotNumber()-1;
|
||||
|
||||
d_texts[slotnum][1]=
|
||||
QString().sprintf("%u",d_base_output+dst->slotNumber()-1);
|
||||
d_texts[slotnum][2]=dst->primaryName();
|
||||
d_texts[slotnum][3]=QString().sprintf("%d",dst->channels());
|
||||
d_texts[slotnum][4]=RDLiveWireDestination::loadString(dst->load());
|
||||
d_texts[slotnum][5]=
|
||||
QString().sprintf("%4.1f",(float)dst->outputGain()/10.0);
|
||||
|
||||
emit dataChanged(createIndex(slotnum,0),
|
||||
createIndex(slotnum,columnCount()-1));
|
||||
}
|
||||
}
|
70
lib/rdnodeslotsmodel.h
Normal file
70
lib/rdnodeslotsmodel.h
Normal file
@ -0,0 +1,70 @@
|
||||
// rdnodeslotsmodel.h
|
||||
//
|
||||
// Data model for Rivendell switcher nodes.
|
||||
//
|
||||
// (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 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 RDNODESLOTSMODEL_H
|
||||
#define RDNODESLOTSMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QFont>
|
||||
#include <QList>
|
||||
#include <QPalette>
|
||||
#include <QTimer>
|
||||
|
||||
#include <rddb.h>
|
||||
#include <rdlivewire.h>
|
||||
#include <rdmatrix.h>
|
||||
#include <rdnotification.h>
|
||||
#include <rduser.h>
|
||||
|
||||
class RDNodeSlotsModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RDNodeSlotsModel(bool is_src,QObject *parent=0);
|
||||
~RDNodeSlotsModel();
|
||||
QPalette palette();
|
||||
void setPalette(const QPalette &pal);
|
||||
void setFont(const QFont &font);
|
||||
int columnCount(const QModelIndex &parent=QModelIndex()) const;
|
||||
int rowCount(const QModelIndex &parent=QModelIndex()) const;
|
||||
QVariant headerData(int section,Qt::Orientation orient,
|
||||
int role=Qt::DisplayRole) const;
|
||||
QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const;
|
||||
void setBaseOutput(int output);
|
||||
void setSlotQuantity(int slot_quan);
|
||||
|
||||
public slots:
|
||||
void updateSource(unsigned id,RDLiveWireSource *src);
|
||||
void updateDestination(unsigned id,RDLiveWireDestination *dst);
|
||||
|
||||
private:
|
||||
QPalette d_palette;
|
||||
QFont d_font;
|
||||
QFont d_bold_font;
|
||||
QList<QVariant> d_headers;
|
||||
QList<QVariant> d_alignments;
|
||||
QList<QList<QVariant> > d_texts;
|
||||
QList<int> d_ids;
|
||||
bool d_is_source;
|
||||
int d_base_output;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDNODESLOTSMODEL_H
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Edit a Rivendell LiveWire Node
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-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 General Public License version 2 as
|
||||
@ -30,8 +30,6 @@
|
||||
ViewNodeInfo::ViewNodeInfo(QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
setModal(true);
|
||||
|
||||
setWindowTitle("RDAdmin - "+tr("Viewing Livewire Node"));
|
||||
|
||||
//
|
||||
@ -46,12 +44,6 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent)
|
||||
view_livewire=new RDLiveWire(0,this);
|
||||
connect(view_livewire,SIGNAL(connected(unsigned)),
|
||||
this,SLOT(connectedData(unsigned)));
|
||||
connect(view_livewire,SIGNAL(sourceChanged(unsigned,RDLiveWireSource *)),
|
||||
this,SLOT(sourceChangedData(unsigned,RDLiveWireSource *)));
|
||||
connect(view_livewire,
|
||||
SIGNAL(destinationChanged(unsigned,RDLiveWireDestination *)),
|
||||
this,
|
||||
SLOT(destinationChangedData(unsigned,RDLiveWireDestination *)));
|
||||
|
||||
//
|
||||
// Node Hostname
|
||||
@ -159,25 +151,19 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent)
|
||||
label->setGeometry(15,98,90,20);
|
||||
label->setFont(labelFont());
|
||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||
view_sources_view=new RDListView(this);
|
||||
view_sources_view=new RDTableView(this);
|
||||
view_sources_view->setGeometry(10,118,sizeHint().width()-20,200);
|
||||
view_sources_view->setAllColumnsShowFocus(true);
|
||||
view_sources_view->setItemMargin(5);
|
||||
view_sources_view->addColumn(tr("#"));
|
||||
view_sources_view->setColumnAlignment(0,Qt::AlignCenter);
|
||||
view_sources_view->setColumnSortType(0,RDListView::LineSort);
|
||||
view_sources_view->addColumn(tr("Input #"));
|
||||
view_sources_view->setColumnAlignment(1,Qt::AlignRight);
|
||||
view_sources_view->addColumn(tr("Name"));
|
||||
view_sources_view->setColumnAlignment(2,Qt::AlignLeft);
|
||||
view_sources_view->addColumn(tr("Active"));
|
||||
view_sources_view->setColumnAlignment(3,Qt::AlignCenter);
|
||||
view_sources_view->addColumn(tr("Shareable"));
|
||||
view_sources_view->setColumnAlignment(4,Qt::AlignCenter);
|
||||
view_sources_view->addColumn(tr("Chans"));
|
||||
view_sources_view->setColumnAlignment(5,Qt::AlignCenter);
|
||||
view_sources_view->addColumn(tr("Gain"));
|
||||
view_sources_view->setColumnAlignment(6,Qt::AlignCenter);
|
||||
view_sources_model=new RDNodeSlotsModel(true,this);
|
||||
view_sources_model->setFont(defaultFont());
|
||||
view_sources_model->setPalette(palette());
|
||||
view_sources_view->setModel(view_sources_model);
|
||||
view_sources_view->resizeColumnsToContents();
|
||||
connect(view_sources_model,
|
||||
SIGNAL(dataChanged(const QModelIndex &,const QModelIndex &)),
|
||||
this,
|
||||
SLOT(sourceChangedData(const QModelIndex &,const QModelIndex &)));
|
||||
connect(view_livewire,SIGNAL(sourceChanged(unsigned,RDLiveWireSource *)),
|
||||
view_sources_model,SLOT(updateSource(unsigned,RDLiveWireSource *)));
|
||||
|
||||
//
|
||||
// Destinations List
|
||||
@ -186,24 +172,22 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent)
|
||||
label->setGeometry(15,325,90,20);
|
||||
label->setFont(labelFont());
|
||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||
view_destinations_view=new RDListView(this);
|
||||
view_destinations_view=new RDTableView(this);
|
||||
view_destinations_view->
|
||||
setGeometry(10,345,sizeHint().width()-20,200);
|
||||
view_destinations_view->setAllColumnsShowFocus(true);
|
||||
view_destinations_view->setItemMargin(5);
|
||||
view_destinations_view->addColumn(tr("#"));
|
||||
view_destinations_view->setColumnAlignment(0,Qt::AlignCenter);
|
||||
view_destinations_view->setColumnSortType(0,RDListView::LineSort);
|
||||
view_destinations_view->addColumn(tr("Output #"));
|
||||
view_destinations_view->setColumnAlignment(1,Qt::AlignRight);
|
||||
view_destinations_view->addColumn(tr("Name"));
|
||||
view_destinations_view->setColumnAlignment(2,Qt::AlignLeft);
|
||||
view_destinations_view->addColumn(tr("Chans"));
|
||||
view_destinations_view->setColumnAlignment(3,Qt::AlignCenter);
|
||||
view_destinations_view->addColumn(tr("Load"));
|
||||
view_destinations_view->setColumnAlignment(4,Qt::AlignCenter);
|
||||
view_destinations_view->addColumn(tr("Gain"));
|
||||
view_destinations_view->setColumnAlignment(5,Qt::AlignCenter);
|
||||
view_destinations_model=new RDNodeSlotsModel(false,this);
|
||||
view_destinations_model->setFont(defaultFont());
|
||||
view_destinations_model->setPalette(palette());
|
||||
view_destinations_view->setModel(view_destinations_model);
|
||||
view_destinations_view->resizeColumnsToContents();
|
||||
connect(view_destinations_model,
|
||||
SIGNAL(dataChanged(const QModelIndex &,const QModelIndex &)),
|
||||
this,
|
||||
SLOT(destinationChangedData(const QModelIndex &,const QModelIndex &)));
|
||||
connect(view_livewire,
|
||||
SIGNAL(destinationChanged(unsigned,RDLiveWireDestination *)),
|
||||
view_destinations_model,
|
||||
SLOT(updateDestination(unsigned,RDLiveWireDestination *)));
|
||||
|
||||
//
|
||||
// Close Button
|
||||
@ -234,7 +218,7 @@ void ViewNodeInfo::exec(const QString &hostname,Q_UINT16 port,
|
||||
{
|
||||
view_hostname_edit->setText(hostname);
|
||||
view_tcpport_edit->setText(QString().sprintf("%u",(unsigned)port));
|
||||
view_base_output=base_output;
|
||||
view_destinations_model->setBaseOutput(base_output);
|
||||
view_livewire->connectToHost(hostname,port,passwd,base_output);
|
||||
QDialog::exec();
|
||||
}
|
||||
@ -242,6 +226,9 @@ void ViewNodeInfo::exec(const QString &hostname,Q_UINT16 port,
|
||||
|
||||
void ViewNodeInfo::connectedData(unsigned id)
|
||||
{
|
||||
view_sources_model->setSlotQuantity(view_livewire->sources());
|
||||
view_destinations_model->setSlotQuantity(view_livewire->destinations());
|
||||
|
||||
view_protocol_edit->setText(view_livewire->protocolVersion());
|
||||
view_system_edit->setText(view_livewire->systemVersion());
|
||||
view_sources_edit->setText(QString().sprintf("%d",view_livewire->sources()));
|
||||
@ -262,36 +249,17 @@ void ViewNodeInfo::connectedData(unsigned id)
|
||||
}
|
||||
|
||||
|
||||
void ViewNodeInfo::sourceChangedData(unsigned id,RDLiveWireSource *src)
|
||||
void ViewNodeInfo::sourceChangedData(const QModelIndex &first,
|
||||
const QModelIndex &last)
|
||||
{
|
||||
RDListViewItem *item=(RDListViewItem *)view_sources_view->firstChild();
|
||||
while(item!=NULL) {
|
||||
if(item->text(0).toInt()==src->slotNumber()) {
|
||||
WriteSourceItem(src,item);
|
||||
return;
|
||||
}
|
||||
item=(RDListViewItem *)item->nextSibling();
|
||||
}
|
||||
item=new RDListViewItem(view_sources_view);
|
||||
item->setText(0,QString().sprintf("%d",src->slotNumber()));
|
||||
WriteSourceItem(src,item);
|
||||
view_sources_view->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
|
||||
void ViewNodeInfo::destinationChangedData(unsigned id,
|
||||
RDLiveWireDestination *dst)
|
||||
void ViewNodeInfo::destinationChangedData(const QModelIndex &first,
|
||||
const QModelIndex &last)
|
||||
{
|
||||
RDListViewItem *item=(RDListViewItem *)view_destinations_view->firstChild();
|
||||
while(item!=NULL) {
|
||||
if(item->text(0).toInt()==dst->slotNumber()) {
|
||||
WriteDestinationItem(dst,item);
|
||||
return;
|
||||
}
|
||||
item=(RDListViewItem *)item->nextSibling();
|
||||
}
|
||||
item=new RDListViewItem(view_destinations_view);
|
||||
item->setText(0,QString().sprintf("%d",dst->slotNumber()));
|
||||
WriteDestinationItem(dst,item);
|
||||
view_destinations_view->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
|
||||
@ -299,43 +267,3 @@ void ViewNodeInfo::closeData()
|
||||
{
|
||||
done(0);
|
||||
}
|
||||
|
||||
|
||||
void ViewNodeInfo::WriteSourceItem(RDLiveWireSource *src,RDListViewItem *item)
|
||||
{
|
||||
item->setLine(src->slotNumber());
|
||||
if(src->channelNumber()<=0) {
|
||||
item->setText(1,tr("[unassigned]"));
|
||||
}
|
||||
else {
|
||||
item->setText(1,QString().sprintf("%d",src->channelNumber()));
|
||||
}
|
||||
item->setText(2,src->primaryName());
|
||||
if(src->rtpEnabled()) {
|
||||
item->setText(3,tr("Yes"));
|
||||
}
|
||||
else {
|
||||
item->setText(3,tr("No"));
|
||||
}
|
||||
if(src->shareable()) {
|
||||
item->setText(4,tr("Yes"));
|
||||
}
|
||||
else {
|
||||
item->setText(4,tr("No"));
|
||||
}
|
||||
item->setText(5,QString().sprintf("%d",src->channels()));
|
||||
item->setText(6,QString().sprintf("%4.1f",(float)src->inputGain()/10.0));
|
||||
}
|
||||
|
||||
|
||||
void ViewNodeInfo::WriteDestinationItem(RDLiveWireDestination *dst,
|
||||
RDListViewItem *item)
|
||||
{
|
||||
item->setLine(dst->slotNumber());
|
||||
item->
|
||||
setText(1,QString().sprintf("%u",view_base_output+dst->slotNumber()-1));
|
||||
item->setText(2,dst->primaryName());
|
||||
item->setText(3,QString().sprintf("%d",dst->channels()));
|
||||
item->setText(4,RDLiveWireDestination::loadString(dst->load()));
|
||||
item->setText(5,QString().sprintf("%4.1f",(float)dst->outputGain()/10.0));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Edit a Rivendell Livewire Node
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-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 General Public License version 2 as
|
||||
@ -21,12 +21,11 @@
|
||||
#ifndef VIEW_NODE_INFO_H
|
||||
#define VIEW_NODE_INFO_H
|
||||
|
||||
#include <qlineedit.h>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include <rddialog.h>
|
||||
#include <rdlistview.h>
|
||||
#include <rdlistviewitem.h>
|
||||
#include <rdlivewire.h>
|
||||
#include <rdnodeslotsmodel.h>
|
||||
#include <rdtableview.h>
|
||||
|
||||
class ViewNodeInfo : public RDDialog
|
||||
{
|
||||
@ -42,13 +41,11 @@ class ViewNodeInfo : public RDDialog
|
||||
|
||||
private slots:
|
||||
void connectedData(unsigned id);
|
||||
void sourceChangedData(unsigned id,RDLiveWireSource *src);
|
||||
void destinationChangedData(unsigned id,RDLiveWireDestination *dst);
|
||||
void sourceChangedData(const QModelIndex &first,const QModelIndex &last);
|
||||
void destinationChangedData(const QModelIndex &first,const QModelIndex &last);
|
||||
void closeData();
|
||||
|
||||
private:
|
||||
void WriteSourceItem(RDLiveWireSource *src,RDListViewItem *item);
|
||||
void WriteDestinationItem(RDLiveWireDestination *dst,RDListViewItem *item);
|
||||
RDLiveWire *view_livewire;
|
||||
QLineEdit *view_hostname_edit;
|
||||
QLineEdit *view_tcpport_edit;
|
||||
@ -60,9 +57,10 @@ class ViewNodeInfo : public RDDialog
|
||||
QLineEdit *view_channels_edit;
|
||||
QLineEdit *view_gpis_edit;
|
||||
QLineEdit *view_gpos_edit;
|
||||
RDListView *view_sources_view;
|
||||
RDListView *view_destinations_view;
|
||||
unsigned view_base_output;
|
||||
RDTableView *view_sources_view;
|
||||
RDNodeSlotsModel *view_sources_model;
|
||||
RDTableView *view_destinations_view;
|
||||
RDNodeSlotsModel *view_destinations_model;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user