2021-01-22 Fred Gleason <fredg@paravelsystems.com>

* Modified the 'Edit Deck' dialog in rdadmin(1) to use
	'RDStationListModel'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-01-22 15:18:24 -05:00
parent d5c465d78f
commit 957e0516b9
14 changed files with 47 additions and 66 deletions

View File

@ -20874,3 +20874,6 @@
2021-01-22 Fred Gleason <fredg@paravelsystems.com> 2021-01-22 Fred Gleason <fredg@paravelsystems.com>
* Refactored the 'Edit Host' dialog in rdadmin(1) to use the * Refactored the 'Edit Host' dialog in rdadmin(1) to use the
model-based API. model-based API.
2021-01-22 Fred Gleason <fredg@paravelsystems.com>
* Modified the 'Edit Deck' dialog in rdadmin(1) to use
'RDStationListModel'.

View File

@ -22,11 +22,13 @@
#include "rdescape_string.h" #include "rdescape_string.h"
#include "rdstationlistmodel.h" #include "rdstationlistmodel.h"
RDStationListModel::RDStationListModel(const QString &localhost_name, RDStationListModel::RDStationListModel(bool incl_none,
const QString &localhost_name,
QObject *parent) QObject *parent)
: QAbstractTableModel(parent) : QAbstractTableModel(parent)
{ {
d_localhost_name=localhost_name; d_localhost_name=localhost_name;
d_include_none=incl_none;
// //
// Column Attributes // Column Attributes
@ -269,6 +271,17 @@ void RDStationListModel::updateModel()
d_hostnames.clear(); d_hostnames.clear();
d_texts.clear(); d_texts.clear();
d_icons.clear(); d_icons.clear();
if(d_include_none) {
d_hostnames.push_back(tr("[none]"));
d_texts.push_back(texts);
d_texts.back().push_back(tr("[none]"));
d_icons.push_back(texts);
for(int i=1;i<columnCount();i++) {
d_texts.back().push_back(QVariant());
d_icons.back().push_back(QVariant());
}
d_icons.push_back(texts);
}
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
while(q->next()) { while(q->next()) {
d_hostnames.push_back(QString()); d_hostnames.push_back(QString());

View File

@ -41,7 +41,8 @@ class RDStationListModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
public: public:
RDStationListModel(const QString &localhost_name,QObject *parent=0); RDStationListModel(bool incl_none,const QString &localhost_name,
QObject *parent=0);
~RDStationListModel(); ~RDStationListModel();
QPalette palette(); QPalette palette();
void setPalette(const QPalette &pal); void setPalette(const QPalette &pal);
@ -69,6 +70,7 @@ class RDStationListModel : public QAbstractTableModel
QFont d_font; QFont d_font;
QFont d_bold_font; QFont d_bold_font;
QString d_localhost_name; QString d_localhost_name;
bool d_include_none;
QList<QVariant> d_headers; QList<QVariant> d_headers;
QList<QVariant> d_alignments; QList<QVariant> d_alignments;
QStringList d_hostnames; QStringList d_hostnames;

View File

@ -2,7 +2,7 @@
// //
// Edit a Rivendell RDCatch Deck Configuration // Edit a Rivendell RDCatch Deck Configuration
// //
// (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 // 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,13 +42,10 @@
EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent)
: RDDialog(parent) : RDDialog(parent)
{ {
setModal(true);
// //
// Fix the Window Size // Fix the Window Size
// //
setMinimumWidth(sizeHint().width()); setMinimumSize(sizeHint());
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height());
edit_station=station; edit_station=station;
@ -73,6 +70,11 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent)
label->setGeometry(35,14,100,22); label->setGeometry(35,14,100,22);
label->setAlignment(Qt::AlignRight); label->setAlignment(Qt::AlignRight);
//
// Models
//
edit_station_model=new RDStationListModel(true,"",this);
// //
// Settings Label // Settings Label
// //
@ -141,7 +143,7 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent)
// //
edit_swstation_box=new QComboBox(this); edit_swstation_box=new QComboBox(this);
edit_swstation_box->setGeometry(125,190,250,24); edit_swstation_box->setGeometry(125,190,250,24);
edit_swstation_box->setInsertionPolicy(QComboBox::NoInsert); edit_swstation_box->setModel(edit_station_model);
edit_swstation_label=new QLabel(edit_swstation_box,tr("Switcher Host:"),this); edit_swstation_label=new QLabel(edit_swstation_box,tr("Switcher Host:"),this);
edit_swstation_label->setFont(labelFont()); edit_swstation_label->setFont(labelFont());
edit_swstation_label->setGeometry(10,190,110,24); edit_swstation_label->setGeometry(10,190,110,24);
@ -348,13 +350,6 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent)
edit_bitrate_box->insertItem(tr("128 kbps/chan")); edit_bitrate_box->insertItem(tr("128 kbps/chan"));
edit_bitrate_box->insertItem(tr("160 kbps/chan")); edit_bitrate_box->insertItem(tr("160 kbps/chan"));
edit_bitrate_box->insertItem(tr("192 kbps/chan")); edit_bitrate_box->insertItem(tr("192 kbps/chan"));
edit_swstation_box->insertItem(tr("[none]"));
RDSqlQuery *q=new RDSqlQuery("select NAME from STATIONS where \
NAME!=\"DEFAULT\"");
while(q->next()) {
edit_swstation_box->insertItem(q->value(0).toString());
}
delete q;
ReadRecord(edit_record_channel); ReadRecord(edit_record_channel);
ReadRecord(edit_play_channel); ReadRecord(edit_play_channel);
ReadRecord(0); ReadRecord(0);
@ -374,6 +369,7 @@ EditDecks::~EditDecks()
delete edit_audition_deck; delete edit_audition_deck;
delete edit_errorrml_edit; delete edit_errorrml_edit;
delete edit_catch_conf; delete edit_catch_conf;
delete edit_station_model;
} }
@ -545,7 +541,7 @@ void EditDecks::closeData()
WriteRecord(0); WriteRecord(0);
WriteRecord(edit_record_channel); WriteRecord(edit_record_channel);
WriteRecord(edit_play_channel); WriteRecord(edit_play_channel);
done(0); done(true);
} }

View File

@ -21,20 +21,18 @@
#ifndef EDIT_DECKS_H #ifndef EDIT_DECKS_H
#define EDIT_DECKS_H #define EDIT_DECKS_H
#include <vector> #include <QComboBox>
#include <QLabel>
#include <qsqldatabase.h> #include <QLineEdit>
#include <qcombobox.h> #include <QPushButton>
#include <qpushbutton.h> #include <QSpinBox>
#include <qspinbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <rdcardselector.h>
#include <rdcatch_conf.h>
#include <rddeck.h> #include <rddeck.h>
#include <rddialog.h> #include <rddialog.h>
#include <rdcardselector.h>
#include <rdstation.h> #include <rdstation.h>
#include <rdcatch_conf.h> #include <rdstationlistmodel.h>
class EditDecks : public RDDialog class EditDecks : public RDDialog
{ {
@ -87,6 +85,7 @@ class EditDecks : public RDDialog
QComboBox *edit_bitrate_box; QComboBox *edit_bitrate_box;
QLabel *edit_swstation_label; QLabel *edit_swstation_label;
QComboBox *edit_swstation_box; QComboBox *edit_swstation_box;
RDStationListModel *edit_station_model;
QLabel *edit_swmatrix_label; QLabel *edit_swmatrix_label;
QComboBox *edit_swmatrix_box; QComboBox *edit_swmatrix_box;
std::vector<int> edit_matrix_ids; std::vector<int> edit_matrix_ids;

View File

@ -76,7 +76,7 @@ EditStation::EditStation(QString sname,QWidget *parent)
// Models // Models
// //
station_username_model=new RDUserListModel(this); station_username_model=new RDUserListModel(this);
station_station_model=new RDStationListModel(sname,this); station_station_model=new RDStationListModel(false,sname,this);
// //
// Station Name // Station Name

View File

@ -83,7 +83,7 @@ ListStations::ListStations(QWidget *parent)
list_stations_view->setShowGrid(false); list_stations_view->setShowGrid(false);
list_stations_view->setSortingEnabled(false); list_stations_view->setSortingEnabled(false);
list_stations_view->setWordWrap(false); list_stations_view->setWordWrap(false);
list_stations_model=new RDStationListModel("",this); list_stations_model=new RDStationListModel(false,"",this);
list_stations_model->setFont(defaultFont()); list_stations_model->setFont(defaultFont());
list_stations_model->setPalette(palette()); list_stations_model->setPalette(palette());
list_stations_view->setModel(list_stations_model); list_stations_view->setModel(list_stations_model);
@ -92,16 +92,6 @@ ListStations::ListStations(QWidget *parent)
connect(list_stations_model,SIGNAL(modelReset()), connect(list_stations_model,SIGNAL(modelReset()),
list_stations_view,SLOT(resizeColumnsToContents())); list_stations_view,SLOT(resizeColumnsToContents()));
list_stations_view->resizeColumnsToContents(); list_stations_view->resizeColumnsToContents();
/*
list_box=new Q3ListBox(this);
QLabel *list_box_label=new QLabel(list_box,tr("Ho&sts:"),this);
list_box_label->setFont(labelFont());
list_box_label->setGeometry(14,10,85,19);
connect(list_box,SIGNAL(doubleClicked(Q3ListBoxItem *)),
this,SLOT(doubleClickedData(Q3ListBoxItem *)));
RefreshList();
*/
} }
@ -198,21 +188,3 @@ void ListStations::resizeEvent(QResizeEvent *e)
list_close_button->setGeometry(size().width()-90,size().height()-60,80,50); list_close_button->setGeometry(size().width()-90,size().height()-60,80,50);
list_stations_view->setGeometry(10,30,size().width()-110,size().height()-40); list_stations_view->setGeometry(10,30,size().width()-110,size().height()-40);
} }
/*
void ListStations::RefreshList(QString stationname)
{
QString sql;
RDSqlQuery *q;
list_box->clear();
q=new RDSqlQuery("select NAME from STATIONS");
while (q->next()) {
list_box->insertItem(q->value(0).toString());
if(stationname==list_box->text(list_box->count()-1)) {
list_box->setCurrentItem(list_box->count()-1);
}
}
delete q;
}
*/

View File

@ -1088,7 +1088,7 @@ eingeben um die Audioressourcendatenbank zu füllen.</translation>
</message> </message>
<message> <message>
<source>[none]</source> <source>[none]</source>
<translation>[žádný]</translation> <translation type="obsolete">[žádný]</translation>
</message> </message>
<message> <message>
<source>Channel assignments will not be available for this host as audio resource data <source>Channel assignments will not be available for this host as audio resource data

View File

@ -1010,7 +1010,7 @@ eingeben um die Audioressourcendatenbank zu füllen.</translation>
</message> </message>
<message> <message>
<source>[none]</source> <source>[none]</source>
<translation>[keine]</translation> <translation type="obsolete">[keine]</translation>
</message> </message>
<message> <message>
<source>Channel assignments will not be available for this host as audio resource data <source>Channel assignments will not be available for this host as audio resource data

View File

@ -1086,7 +1086,7 @@ y un respaldo de la base de datos se guardó en </translation>
</message> </message>
<message> <message>
<source>[none]</source> <source>[none]</source>
<translation>[ninguno]</translation> <translation type="obsolete">[ninguno]</translation>
</message> </message>
<message> <message>
<source>No Audio Configuration Data</source> <source>No Audio Configuration Data</source>

View File

@ -711,10 +711,6 @@
<source>192 kbps/chan</source> <source>192 kbps/chan</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>[none]</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Channel assignments will not be available for this host as audio resource data <source>Channel assignments will not be available for this host as audio resource data
has not yet been generated. Please start the Rivendell daemons on the host has not yet been generated. Please start the Rivendell daemons on the host

View File

@ -992,7 +992,7 @@ for lydressursar.</translation>
</message> </message>
<message> <message>
<source>[none]</source> <source>[none]</source>
<translation>[ingen]</translation> <translation type="obsolete">[ingen]</translation>
</message> </message>
<message> <message>
<source>Channel assignments will not be available for this host as audio resource data <source>Channel assignments will not be available for this host as audio resource data

View File

@ -992,7 +992,7 @@ for lydressursar.</translation>
</message> </message>
<message> <message>
<source>[none]</source> <source>[none]</source>
<translation>[ingen]</translation> <translation type="obsolete">[ingen]</translation>
</message> </message>
<message> <message>
<source>Channel assignments will not be available for this host as audio resource data <source>Channel assignments will not be available for this host as audio resource data

View File

@ -981,7 +981,7 @@ Isto para popular os recursos de áudio na Base de Dados.</translation>
</message> </message>
<message> <message>
<source>[none]</source> <source>[none]</source>
<translation>[Nenhum]</translation> <translation type="obsolete">[Nenhum]</translation>
</message> </message>
<message> <message>
<source>Channel assignments will not be available for this host as audio resource data <source>Channel assignments will not be available for this host as audio resource data