diff --git a/ChangeLog b/ChangeLog index f1dcf2f6..3411f6e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20874,3 +20874,6 @@ 2021-01-22 Fred Gleason * Refactored the 'Edit Host' dialog in rdadmin(1) to use the model-based API. +2021-01-22 Fred Gleason + * Modified the 'Edit Deck' dialog in rdadmin(1) to use + 'RDStationListModel'. diff --git a/lib/rdstationlistmodel.cpp b/lib/rdstationlistmodel.cpp index 10d2978b..3b9cb219 100644 --- a/lib/rdstationlistmodel.cpp +++ b/lib/rdstationlistmodel.cpp @@ -22,11 +22,13 @@ #include "rdescape_string.h" #include "rdstationlistmodel.h" -RDStationListModel::RDStationListModel(const QString &localhost_name, +RDStationListModel::RDStationListModel(bool incl_none, + const QString &localhost_name, QObject *parent) : QAbstractTableModel(parent) { d_localhost_name=localhost_name; + d_include_none=incl_none; // // Column Attributes @@ -269,6 +271,17 @@ void RDStationListModel::updateModel() d_hostnames.clear(); d_texts.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;inext()) { d_hostnames.push_back(QString()); diff --git a/lib/rdstationlistmodel.h b/lib/rdstationlistmodel.h index 9f172cda..0c4e7932 100644 --- a/lib/rdstationlistmodel.h +++ b/lib/rdstationlistmodel.h @@ -41,7 +41,8 @@ class RDStationListModel : public QAbstractTableModel { Q_OBJECT public: - RDStationListModel(const QString &localhost_name,QObject *parent=0); + RDStationListModel(bool incl_none,const QString &localhost_name, + QObject *parent=0); ~RDStationListModel(); QPalette palette(); void setPalette(const QPalette &pal); @@ -69,6 +70,7 @@ class RDStationListModel : public QAbstractTableModel QFont d_font; QFont d_bold_font; QString d_localhost_name; + bool d_include_none; QList d_headers; QList d_alignments; QStringList d_hostnames; diff --git a/rdadmin/edit_decks.cpp b/rdadmin/edit_decks.cpp index 84274a7b..2ad1b27d 100644 --- a/rdadmin/edit_decks.cpp +++ b/rdadmin/edit_decks.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell RDCatch Deck Configuration // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // 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 @@ -42,13 +42,10 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) : RDDialog(parent) { - setModal(true); - // // Fix the Window Size // - setMinimumWidth(sizeHint().width()); - setMinimumHeight(sizeHint().height()); + setMinimumSize(sizeHint()); setMaximumHeight(sizeHint().height()); edit_station=station; @@ -73,6 +70,11 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) label->setGeometry(35,14,100,22); label->setAlignment(Qt::AlignRight); + // + // Models + // + edit_station_model=new RDStationListModel(true,"",this); + // // Settings Label // @@ -141,7 +143,7 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) // edit_swstation_box=new QComboBox(this); 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->setFont(labelFont()); 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("160 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_play_channel); ReadRecord(0); @@ -374,6 +369,7 @@ EditDecks::~EditDecks() delete edit_audition_deck; delete edit_errorrml_edit; delete edit_catch_conf; + delete edit_station_model; } @@ -545,7 +541,7 @@ void EditDecks::closeData() WriteRecord(0); WriteRecord(edit_record_channel); WriteRecord(edit_play_channel); - done(0); + done(true); } diff --git a/rdadmin/edit_decks.h b/rdadmin/edit_decks.h index dd2144c8..cf3f2025 100644 --- a/rdadmin/edit_decks.h +++ b/rdadmin/edit_decks.h @@ -21,20 +21,18 @@ #ifndef EDIT_DECKS_H #define EDIT_DECKS_H -#include - -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include #include -#include +#include class EditDecks : public RDDialog { @@ -87,6 +85,7 @@ class EditDecks : public RDDialog QComboBox *edit_bitrate_box; QLabel *edit_swstation_label; QComboBox *edit_swstation_box; + RDStationListModel *edit_station_model; QLabel *edit_swmatrix_label; QComboBox *edit_swmatrix_box; std::vector edit_matrix_ids; diff --git a/rdadmin/edit_station.cpp b/rdadmin/edit_station.cpp index fa8271da..9b653e54 100644 --- a/rdadmin/edit_station.cpp +++ b/rdadmin/edit_station.cpp @@ -76,7 +76,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // Models // station_username_model=new RDUserListModel(this); - station_station_model=new RDStationListModel(sname,this); + station_station_model=new RDStationListModel(false,sname,this); // // Station Name diff --git a/rdadmin/list_stations.cpp b/rdadmin/list_stations.cpp index aa0d3bf6..3d00b054 100644 --- a/rdadmin/list_stations.cpp +++ b/rdadmin/list_stations.cpp @@ -83,7 +83,7 @@ ListStations::ListStations(QWidget *parent) list_stations_view->setShowGrid(false); list_stations_view->setSortingEnabled(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->setPalette(palette()); list_stations_view->setModel(list_stations_model); @@ -92,16 +92,6 @@ ListStations::ListStations(QWidget *parent) connect(list_stations_model,SIGNAL(modelReset()), list_stations_view,SLOT(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_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; -} -*/ diff --git a/rdadmin/rdadmin_cs.ts b/rdadmin/rdadmin_cs.ts index f20a2f46..7f3ec9b1 100644 --- a/rdadmin/rdadmin_cs.ts +++ b/rdadmin/rdadmin_cs.ts @@ -1088,7 +1088,7 @@ eingeben um die Audioressourcendatenbank zu füllen. [none] - [žádný] + [žádný] Channel assignments will not be available for this host as audio resource data diff --git a/rdadmin/rdadmin_de.ts b/rdadmin/rdadmin_de.ts index 677936ac..1c898d15 100644 --- a/rdadmin/rdadmin_de.ts +++ b/rdadmin/rdadmin_de.ts @@ -1010,7 +1010,7 @@ eingeben um die Audioressourcendatenbank zu füllen. [none] - [keine] + [keine] Channel assignments will not be available for this host as audio resource data diff --git a/rdadmin/rdadmin_es.ts b/rdadmin/rdadmin_es.ts index c9c911de..dda79a31 100644 --- a/rdadmin/rdadmin_es.ts +++ b/rdadmin/rdadmin_es.ts @@ -1086,7 +1086,7 @@ y un respaldo de la base de datos se guardó en [none] - [ninguno] + [ninguno] No Audio Configuration Data diff --git a/rdadmin/rdadmin_fr.ts b/rdadmin/rdadmin_fr.ts index 5249b379..1c23698c 100644 --- a/rdadmin/rdadmin_fr.ts +++ b/rdadmin/rdadmin_fr.ts @@ -711,10 +711,6 @@ 192 kbps/chan - - [none] - - 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 diff --git a/rdadmin/rdadmin_nb.ts b/rdadmin/rdadmin_nb.ts index 0833f16a..964e0976 100644 --- a/rdadmin/rdadmin_nb.ts +++ b/rdadmin/rdadmin_nb.ts @@ -992,7 +992,7 @@ for lydressursar. [none] - [ingen] + [ingen] Channel assignments will not be available for this host as audio resource data diff --git a/rdadmin/rdadmin_nn.ts b/rdadmin/rdadmin_nn.ts index 0833f16a..964e0976 100644 --- a/rdadmin/rdadmin_nn.ts +++ b/rdadmin/rdadmin_nn.ts @@ -992,7 +992,7 @@ for lydressursar. [none] - [ingen] + [ingen] Channel assignments will not be available for this host as audio resource data diff --git a/rdadmin/rdadmin_pt_BR.ts b/rdadmin/rdadmin_pt_BR.ts index 7f4531ed..2159cde3 100644 --- a/rdadmin/rdadmin_pt_BR.ts +++ b/rdadmin/rdadmin_pt_BR.ts @@ -981,7 +981,7 @@ Isto para popular os recursos de áudio na Base de Dados. [none] - [Nenhum] + [Nenhum] Channel assignments will not be available for this host as audio resource data