diff --git a/ChangeLog b/ChangeLog index def027c2..6bf3934d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20926,3 +20926,11 @@ * Added 'RDReplicatorListModel'. * Refactored the 'Rivendell Replicators' dialog in rdadmin(1) to use the model-based API. +2021-01-27 Fred Gleason + * Added a 'RDMatrix::id()' method. + * Added 'RDIconEngine::Switcher', 'RDIconEngine::Record', + 'RDIconEngine::Download' and 'RDIconEngine::Upload' icons to + 'RDIconEngine. + * Added 'RDMatrixListModel'. + * Refactored the 'Rivendell Switcher List' dialog in rdadmin(1) to + use the model-based API. diff --git a/lib/Makefile.am b/lib/Makefile.am index bb0e4e5f..a18068cf 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -186,6 +186,7 @@ dist_librd_la_SOURCES = dbversion.h\ rdmarker_button.cpp rdmarker_button.h\ rdmarker_edit.cpp rdmarker_edit.h\ rdmatrix.cpp rdmatrix.h\ + rdmatrixlistmodel.cpp rdmatrixlistmodel.h\ rdmblookup.cpp rdmblookup.h\ rdmeteraverage.cpp rdmeteraverage.h\ rdmixer.cpp rdmixer.h\ @@ -347,6 +348,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\ moc_rdmacro_event.cpp\ moc_rdmarker_bar.cpp\ moc_rdmarker_edit.cpp\ + moc_rdmatrixlistmodel.cpp\ moc_rdmblookup.cpp\ moc_rdmulticaster.cpp\ moc_rdoneshot.cpp\ diff --git a/lib/lib.pro b/lib/lib.pro index 2cb7f35f..411df80c 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -139,6 +139,7 @@ SOURCES += rdmacro_event.cpp SOURCES += rdmarker_button.cpp SOURCES += rdmarker_edit.cpp SOURCES += rdmatrix.cpp +SOURCES += rdmatrixlistmodel.cpp SOURCES += rdmblookup.cpp SOURCES += rdmonitor_config.cpp SOURCES += rdnotification.cpp @@ -303,6 +304,7 @@ HEADERS += rdmacro_event.h HEADERS += rdmarker_button.h HEADERS += rdmarker_edit.h HEADERS += rdmatrix.h +HEADERS += rdmatrixlistmodel.h HEADERS += rdmblookup.h HEADERS += rdmonitor_config.h HEADERS += rdnotification.h diff --git a/lib/librd_cs.ts b/lib/librd_cs.ts index b19a674d..942ce9dc 100644 --- a/lib/librd_cs.ts +++ b/lib/librd_cs.ts @@ -3239,6 +3239,41 @@ Bitte Kofiguration prüfen und erneut versuchen. + + RDMatrixListModel + + Description + + + + Matrix + + + + Type + + + + Inputs + + + + Outputs + + + + GPIs + + + + GPOs + + + + [none] + + + RDMbLookup diff --git a/lib/librd_de.ts b/lib/librd_de.ts index bb887e2a..32a17b97 100644 --- a/lib/librd_de.ts +++ b/lib/librd_de.ts @@ -3220,6 +3220,41 @@ Bitte Kofiguration prüfen und erneut versuchen. + + RDMatrixListModel + + Description + + + + Matrix + + + + Type + + + + Inputs + + + + Outputs + + + + GPIs + + + + GPOs + + + + [none] + + + RDMbLookup diff --git a/lib/librd_es.ts b/lib/librd_es.ts index a8e0639d..b05f107f 100644 --- a/lib/librd_es.ts +++ b/lib/librd_es.ts @@ -3207,6 +3207,41 @@ Do you still want to proceed? + + RDMatrixListModel + + Description + + + + Matrix + + + + Type + + + + Inputs + + + + Outputs + + + + GPIs + + + + GPOs + + + + [none] + + + RDMbLookup diff --git a/lib/librd_fr.ts b/lib/librd_fr.ts index ad68bebf..726462cf 100644 --- a/lib/librd_fr.ts +++ b/lib/librd_fr.ts @@ -2643,6 +2643,41 @@ Do you want to overwrite it? + + RDMatrixListModel + + Description + + + + Matrix + + + + Type + + + + Inputs + + + + Outputs + + + + GPIs + + + + GPOs + + + + [none] + + + RDMbLookup diff --git a/lib/librd_nb.ts b/lib/librd_nb.ts index 2c44215c..0e501f2b 100644 --- a/lib/librd_nb.ts +++ b/lib/librd_nb.ts @@ -3174,6 +3174,41 @@ Sjekk eksportoppsettet ditt og prøv att. + + RDMatrixListModel + + Description + + + + Matrix + + + + Type + + + + Inputs + + + + Outputs + + + + GPIs + + + + GPOs + + + + [none] + + + RDMbLookup diff --git a/lib/librd_nn.ts b/lib/librd_nn.ts index 2c44215c..0e501f2b 100644 --- a/lib/librd_nn.ts +++ b/lib/librd_nn.ts @@ -3174,6 +3174,41 @@ Sjekk eksportoppsettet ditt og prøv att. + + RDMatrixListModel + + Description + + + + Matrix + + + + Type + + + + Inputs + + + + Outputs + + + + GPIs + + + + GPOs + + + + [none] + + + RDMbLookup diff --git a/lib/librd_pt_BR.ts b/lib/librd_pt_BR.ts index 40ce5659..c5528930 100644 --- a/lib/librd_pt_BR.ts +++ b/lib/librd_pt_BR.ts @@ -3209,6 +3209,41 @@ Por Favor, cheque suas configurações e tenbte outra vez. + + RDMatrixListModel + + Description + + + + Matrix + + + + Type + + + + Inputs + + + + Outputs + + + + GPIs + + + + GPOs + + + + [none] + + + RDMbLookup diff --git a/lib/rdiconengine.cpp b/lib/rdiconengine.cpp index f462308c..671cabc3 100644 --- a/lib/rdiconengine.cpp +++ b/lib/rdiconengine.cpp @@ -111,6 +111,10 @@ #include "../icons/greenball.xpm" #include "../icons/redball.xpm" #include "../icons/whiteball.xpm" +#include "../icons/switch3.xpm" +#include "../icons/record.xpm" +#include "../icons/upload.xpm" +#include "../icons/download.xpm" #include "../icons/host-16x16.xpm" @@ -256,6 +260,11 @@ RDIconEngine::RDIconEngine() d_list_icons.push_back(QPixmap(redball_xpm)); d_list_icons.push_back(QPixmap(whiteball_xpm)); d_list_icons.push_back(QPixmap(blueball_xpm)); + d_list_icons.push_back(QPixmap(switch3_xpm)); + d_list_icons.push_back(QPixmap(record_xpm)); + d_list_icons.push_back(QPixmap(rss_xpm)); + d_list_icons.push_back(QPixmap(upload_xpm)); + d_list_icons.push_back(QPixmap(download_xpm)); // // Create Station Icon diff --git a/lib/rdiconengine.h b/lib/rdiconengine.h index faad2169..057d5d9b 100644 --- a/lib/rdiconengine.h +++ b/lib/rdiconengine.h @@ -31,7 +31,7 @@ class RDIconEngine { public: enum IconType {GreenCheck=0,RedX=1,GreenBall=2,RedBall=3,WhiteBall=4, - BlueBall=5}; + BlueBall=5,Switcher=6,Record=7,Download=8,Upload=9}; enum Application {Rivendell=0,RdAdmin=1,RdAirPlay=2,RdCartSlots=3, RdCastManager=4,RdCatch=5,RdLibrary=6,RdLogEdit=7, RdLogManager=8,RdPanel=9,LastApplication=10}; diff --git a/lib/rdmatrix.cpp b/lib/rdmatrix.cpp index 76c1d409..df801c85 100644 --- a/lib/rdmatrix.cpp +++ b/lib/rdmatrix.cpp @@ -179,8 +179,56 @@ int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]= RDMatrix::RDMatrix(const QString &station,int matrix) { + QString sql; + RDSqlQuery *q=NULL; + + sql=QString("select ")+ + "ID "+ // 00 + "from MATRICES where "+ + "STATION_NAME=\""+RDEscapeString(station)+"\" && "+ + QString().sprintf("MATRIX=%d",matrix); + q=new RDSqlQuery(sql); + if(q->first()) { + mx_id=q->value(0).toInt(); + } + else { + mx_id=-1; + } + delete q; + mx_station=station; mx_number=matrix; + +} + + +RDMatrix::RDMatrix(int matrix_id) +{ + QString sql; + RDSqlQuery *q=NULL; + + sql=QString("select ")+ + "STATION_NAME," // 00 + "MATRIX "+ /// 01 + "from MATRICES where "+ + QString().sprintf("ID=%d",matrix_id); + q=new RDSqlQuery(sql); + if(q->first()) { + mx_station=q->value(0).toString(); + mx_number=q->value(1).toInt(); + } + else { + mx_number=-1; + } + delete q; + + mx_id=matrix_id; +} + + +int RDMatrix::id() const +{ + return mx_id; } @@ -198,12 +246,7 @@ int RDMatrix::matrix() const bool RDMatrix::exists() const { - QString sql=QString().sprintf("select TYPE from MATRICES where MATRIX=%d", - mx_number); - RDSqlQuery *q=new RDSqlQuery(sql); - bool result=q->first(); - delete q; - return result; + return (mx_id>=0)&&(mx_number>=0); } diff --git a/lib/rdmatrix.h b/lib/rdmatrix.h index 1dd82433..3133e06b 100644 --- a/lib/rdmatrix.h +++ b/lib/rdmatrix.h @@ -62,6 +62,8 @@ class RDMatrix DynamicGpioControl=26,GpioStepSize=27, LivewireGpioButtonControl=28,LastControl=29}; RDMatrix(const QString &station,int matrix); + RDMatrix(int matrix_id); + int id() const; QString station() const; int matrix() const; bool exists() const; @@ -119,6 +121,7 @@ class RDMatrix void SetRow(const QString ¶m,const QString &value) const; void SetRow(const QString ¶m,int value) const; void SetRow(const QString ¶m,unsigned value) const; + int mx_id; QString mx_station; int mx_number; }; diff --git a/lib/rdmatrixlistmodel.cpp b/lib/rdmatrixlistmodel.cpp new file mode 100644 index 00000000..0494e1ed --- /dev/null +++ b/lib/rdmatrixlistmodel.cpp @@ -0,0 +1,335 @@ +// rdmatrixlistmodel.cpp +// +// Data model for Rivendell matrix devices +// +// (C) Copyright 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 +// 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 "rdmatrix.h" +#include "rdmatrixlistmodel.h" + +RDMatrixListModel::RDMatrixListModel(const QString &hostname,bool incl_none, + QObject *parent) + : QAbstractTableModel(parent) +{ + d_station_name=hostname; + d_include_none=incl_none; + + // + // Column Attributes + // + unsigned left=Qt::AlignLeft|Qt::AlignVCenter; + // unsigned center=Qt::AlignCenter; + unsigned right=Qt::AlignRight|Qt::AlignVCenter; + + d_headers.push_back(tr("Description")); + d_alignments.push_back(left); + + d_headers.push_back(tr("Matrix")); + d_alignments.push_back(right); + + d_headers.push_back(tr("Type")); + d_alignments.push_back(left); + + d_headers.push_back(tr("Inputs")); + d_alignments.push_back(right); + + d_headers.push_back(tr("Outputs")); + d_alignments.push_back(right); + + d_headers.push_back(tr("GPIs")); + d_alignments.push_back(right); + + d_headers.push_back(tr("GPOs")); + d_alignments.push_back(right); + + updateModel(); +} + + +RDMatrixListModel::~RDMatrixListModel() +{ +} + + +QPalette RDMatrixListModel::palette() +{ + return d_palette; +} + + +void RDMatrixListModel::setPalette(const QPalette &pal) +{ + d_palette=pal; +} + + +void RDMatrixListModel::setFont(const QFont &font) +{ + d_font=font; + d_bold_font=font; + d_bold_font.setWeight(QFont::Bold); +} + + +int RDMatrixListModel::columnCount(const QModelIndex &parent) const +{ + return d_headers.size(); +} + + +int RDMatrixListModel::rowCount(const QModelIndex &parent) const +{ + return d_texts.size(); +} + + +QVariant RDMatrixListModel::headerData(int section,Qt::Orientation orient, + int role) const +{ + if((orient==Qt::Horizontal)&&(role==Qt::DisplayRole)) { + return d_headers.at(section); + } + return QVariant(); +} + + +QVariant RDMatrixListModel::data(const QModelIndex &index,int role) const +{ + QString str; + int col=index.column(); + int row=index.row(); + + if(rowiconEngine()->listIcon(RDIconEngine::Switcher); + } + 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(); +} + + +int RDMatrixListModel::matrixId(const QModelIndex &row) const +{ + return d_ids.at(row.row()); +} + + +int RDMatrixListModel::matrixNumber(const QModelIndex &row) const +{ + return d_texts.at(row.row()).at(1).toInt(); +} + + +QModelIndex RDMatrixListModel::addMatrix(RDMatrix *mtx) +{ + // + // Find the insertion offset + // + QString name=mtx->name(); + int offset=d_texts.size(); + for(int i=0;i list; + for(int i=0;iid()); + d_texts.insert(offset,list); + updateRowLine(offset); + endInsertRows(); + + return createIndex(offset,0); +} + + +void RDMatrixListModel::removeMatrix(const QModelIndex &row) +{ + beginRemoveRows(QModelIndex(),row.row(),row.row()); + + d_ids.removeAt(row.row()); + d_texts.removeAt(row.row()); + + endRemoveRows(); +} + + +void RDMatrixListModel::removeMatrix(int id) +{ + for(int i=0;ifirst()) { + updateRow(row.row(),q); + emit dataChanged(createIndex(row.row(),0), + createIndex(row.row(),columnCount())); + } + delete q; + } +} + + +void RDMatrixListModel::refresh(int id) +{ + for(int i=0;i texts; + + RDSqlQuery *q=NULL; + QString sql=sqlFields()+ + "where "+ + "STATION_NAME=\""+RDEscapeString(d_station_name)+"\" "+ + "order by MATRICES.NAME "; + beginResetModel(); + d_ids.clear(); + d_texts.clear(); + if(d_include_none) { + d_ids.push_back(-1); + d_texts.push_back(texts); + d_texts.back().push_back(tr("[none]")); + for(int i=1;inext()) { + d_ids.push_back(-1); + d_texts.push_back(texts); + updateRow(d_texts.size()-1,q); + } + delete q; + endResetModel(); +} + + +void RDMatrixListModel::updateRowLine(int line) +{ + if(linefirst()) { + updateRow(line,q); + } + delete q; + } +} + + +void RDMatrixListModel::updateRow(int row,RDSqlQuery *q) +{ + QList texts; + + d_ids.back()=q->value(0).toInt(); + + // Description + texts.push_back(q->value(1)); + + // Matrix Number + texts.push_back(QString().sprintf("%d",q->value(2).toInt())); + + // Type + texts.push_back(RDMatrix::typeString((RDMatrix::Type)q->value(3).toUInt())); + + // Inputs + texts.push_back(QString().sprintf("%d",q->value(4).toInt())); + + // Outputs + texts.push_back(QString().sprintf("%d",q->value(5).toInt())); + + // GPIs + texts.push_back(QString().sprintf("%d",q->value(6).toInt())); + + // GPOs + texts.push_back(QString().sprintf("%d",q->value(7).toInt())); + + d_texts[row]=texts; +} + + +QString RDMatrixListModel::sqlFields() const +{ + QString sql=QString("select ")+ + "MATRICES.ID,"+ // 00 + "MATRICES.NAME,"+ // 01 + "MATRICES.MATRIX,"+ // 02 + "MATRICES.TYPE,"+ // 03 + "MATRICES.INPUTS,"+ // 04 + "MATRICES.OUTPUTS,"+ // 05 + "MATRICES.GPIS,"+ // 06 + "MATRICES.GPOS "+ // 07 + "from MATRICES "; + + return sql; +} diff --git a/lib/rdmatrixlistmodel.h b/lib/rdmatrixlistmodel.h new file mode 100644 index 00000000..6283b90b --- /dev/null +++ b/lib/rdmatrixlistmodel.h @@ -0,0 +1,82 @@ +// rdmatrixlistmodel.h +// +// Data model for Rivendell matrix devices +// +// (C) Copyright 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 +// 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 RDMATRIXLISTMODEL_H +#define RDMATRIXLISTMODEL_H + +#include +#include +#include +#include + +#include +#include +#include +#include + +// +// MAINTAINERS NOTE +// +// We could arguably just use a QSqlQueryModel for this, but rolling our own +// lets us use the same backend-facing API pattern as the other Rivendell +// models. +// +class RDMatrixListModel : public QAbstractTableModel +{ + Q_OBJECT + public: + RDMatrixListModel(const QString &hostname,bool incl_none,QObject *parent=0); + ~RDMatrixListModel(); + 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; + int matrixId(const QModelIndex &row) const; + int matrixNumber(const QModelIndex &row) const; + QModelIndex addMatrix(RDMatrix *mtx); + void removeMatrix(const QModelIndex &row); + void removeMatrix(int id); + void refresh(const QModelIndex &row); + void refresh(int id); + + protected: + void updateModel(); + void updateRowLine(int line); + void updateRow(int row,RDSqlQuery *q); + QString sqlFields() const; + + private: + QPalette d_palette; + QFont d_font; + QFont d_bold_font; + QList d_headers; + QList d_alignments; + QList > d_texts; + QList d_ids; + bool d_include_none; + QString d_station_name; +}; + + +#endif // RDMATRIXLISTMODEL_H diff --git a/rdadmin/edit_matrix.cpp b/rdadmin/edit_matrix.cpp index a9cba858..83cc5776 100644 --- a/rdadmin/edit_matrix.cpp +++ b/rdadmin/edit_matrix.cpp @@ -1167,13 +1167,13 @@ void EditMatrix::okData() if(!WriteMatrix()) { return; } - done(0); + done(true); } void EditMatrix::cancelData() { - done(1); + done(false); } diff --git a/rdadmin/list_matrices.cpp b/rdadmin/list_matrices.cpp index 4a59031a..baace26a 100644 --- a/rdadmin/list_matrices.cpp +++ b/rdadmin/list_matrices.cpp @@ -2,7 +2,7 @@ // // List Rivendell Matrices // -// (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 @@ -18,10 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include -#include #include #include "add_matrix.h" @@ -32,8 +31,6 @@ ListMatrices::ListMatrices(QString station,QWidget *parent) : RDDialog(parent) { - setModal(true); - // // Fix the Window Size // @@ -52,6 +49,21 @@ ListMatrices::ListMatrices(QString station,QWidget *parent) // // Matrix List Box // + list_view=new RDTableView(this); + list_model=new RDMatrixListModel(station,false,this); + list_model->setFont(defaultFont()); + list_model->setPalette(palette()); + list_view->setModel(list_model); + list_title_label= + new QLabel(list_view,tr("&Replicators:"),this); + list_title_label->setFont(labelFont()); + connect(list_view,SIGNAL(doubleClicked(const QModelIndex &)), + this,SLOT(doubleClickedData(const QModelIndex &))); + connect(list_model,SIGNAL(modelReset()), + list_view,SLOT(resizeColumnsToContents())); + list_view->resizeColumnsToContents(); + + /* list_view=new Q3ListView(this,"list_box"); list_title_label=new QLabel(list_view,tr("Switchers:"),this); list_title_label->setFont(labelFont()); @@ -67,7 +79,7 @@ ListMatrices::ListMatrices(QString station,QWidget *parent) this,SLOT(doubleClickedData(Q3ListViewItem *,const QPoint &,int))); RefreshList(); - + */ // // Add Button // @@ -131,47 +143,53 @@ void ListMatrices::addData() return; } delete add; - RDMatrix *matrix=new RDMatrix(list_station,matrix_num); - EditMatrix *edit=new EditMatrix(matrix,this); - if(edit->exec()!=0) { - DeleteMatrix(matrix_num); + RDMatrix *mtx=new RDMatrix(list_station,matrix_num); + EditMatrix *edit=new EditMatrix(mtx,this); + if(edit->exec()) { + list_matrix_modified[matrix_num]=true; + QModelIndex row=list_model->addMatrix(mtx); + if(row.isValid()) { + list_view->selectRow(row.row()); + } } else { - list_matrix_modified[matrix_num]=true; - AddList(matrix_num); + DeleteMatrix(mtx); } delete edit; - delete matrix; + delete mtx; } void ListMatrices::editData() { - if(list_view->selectedItem()==NULL) { + QModelIndexList rows=list_view->selectionModel()->selectedRows(); + + if(rows.size()!=1) { return; } - int matrix_num=list_view->currentItem()->text(0).toInt(); - RDMatrix *matrix=new RDMatrix(list_station,matrix_num); - Q3ListViewItem *item=list_view->selectedItem(); - EditMatrix *edit=new EditMatrix(matrix,this); - if(edit->exec()==0) { - RefreshRecord(item); - list_matrix_modified[matrix_num]=true; + int matrix_id=list_model->matrixId(rows.first()); + RDMatrix *mtx=new RDMatrix(matrix_id); + EditMatrix *d=new EditMatrix(mtx,this); + if(d->exec()) { + list_matrix_modified[mtx->matrix()]=true; + list_model->refresh(rows.first()); } - delete edit; - delete matrix; + delete d; + delete mtx; } void ListMatrices::deleteData() { - if(list_view->currentItem()==NULL) { + QModelIndexList rows=list_view->selectionModel()->selectedRows(); + + if(rows.size()!=1) { return; } - int matrix=list_view->currentItem()->text(0).toInt(); - + RDMatrix *mtx=new RDMatrix(list_model->matrixId(rows.first())); QString msg=tr("Are you sure you want to delete switcher")+ - " \""+list_view->currentItem()->text(0)+":"+list_view->currentItem()->text(1)+"\" "+ + " \""+QString().sprintf("%d",mtx->matrix())+":"+ + mtx->name()+"\" "+ tr("on")+" \""+list_station+"\"?"+"\n"+ tr("ALL references to this switcher will be deleted!"); if(QMessageBox::warning(this,tr("Deleting Switcher"),msg, @@ -179,14 +197,12 @@ void ListMatrices::deleteData() QMessageBox::Yes) { return; } - DeleteMatrix(matrix); - list_matrix_modified[matrix]=true; - RefreshList(); + DeleteMatrix(mtx); + list_matrix_modified[mtx->matrix()]=true; } -void ListMatrices::doubleClickedData(Q3ListViewItem *item,const QPoint &pt, - int col) +void ListMatrices::doubleClickedData(const QModelIndex &index) { editData(); } @@ -224,46 +240,48 @@ void ListMatrices::resizeEvent(QResizeEvent *e) } -void ListMatrices::DeleteMatrix(int matrix) +void ListMatrices::DeleteMatrix(RDMatrix *mtx) { QString sql=QString("delete from MATRICES where ")+ "STATION_NAME=\""+RDEscapeString(list_station)+"\" && "+ - QString().sprintf("MATRIX=%d",matrix); + QString().sprintf("MATRIX=%d",mtx->matrix()); RDSqlQuery *q=new RDSqlQuery(sql); delete q; sql=QString("delete from INPUTS where ")+ "STATION_NAME=\""+RDEscapeString(list_station)+"\" && "+ - QString().sprintf("MATRIX=%d",matrix); + QString().sprintf("MATRIX=%d",mtx->matrix()); q=new RDSqlQuery(sql); delete q; sql=QString("delete from OUTPUTS where ")+ "STATION_NAME=\""+RDEscapeString(list_station)+"\" && "+ - QString().sprintf("MATRIX=%d",matrix); + QString().sprintf("MATRIX=%d",mtx->matrix()); q=new RDSqlQuery(sql); delete q; sql=QString("delete from SWITCHER_NODES where ")+ "STATION_NAME=\""+RDEscapeString(list_station)+"\" && "+ - QString().sprintf("MATRIX=%d",matrix); + QString().sprintf("MATRIX=%d",mtx->matrix()); q=new RDSqlQuery(sql); delete q; sql=QString("delete from GPIS where ")+ "STATION_NAME=\""+RDEscapeString(list_station)+"\" && "+ - QString().sprintf("MATRIX=%d",matrix); + QString().sprintf("MATRIX=%d",mtx->matrix()); q=new RDSqlQuery(sql); delete q; sql=QString("delete from GPOS where ")+ "STATION_NAME=\""+RDEscapeString(list_station)+"\" && "+ - QString().sprintf("MATRIX=%d",matrix); + QString().sprintf("MATRIX=%d",mtx->matrix()); q=new RDSqlQuery(sql); delete q; sql=QString("delete from VGUEST_RESOURCES where ")+ "STATION_NAME=\""+RDEscapeString(list_station)+"\" && "+ - QString().sprintf("MATRIX_NUM=%d",matrix); + QString().sprintf("MATRIX_NUM=%d",mtx->matrix()); q=new RDSqlQuery(sql); delete q; + + list_model->removeMatrix(mtx->id()); } - +/* void ListMatrices::RefreshList() { Q3ListViewItem *l; @@ -285,10 +303,11 @@ void ListMatrices::RefreshList() } delete q; } - +*/ void ListMatrices::AddList(int matrix_num) { + /* RDMatrix *matrix=new RDMatrix(list_station,matrix_num); Q3ListViewItem *item=new Q3ListViewItem(list_view); item->setText(0,QString().sprintf("%d",matrix_num)); @@ -297,12 +316,14 @@ void ListMatrices::AddList(int matrix_num) delete matrix; list_view->setCurrentItem(item); list_view->setSelected(item,true); + */ } - +/* void ListMatrices::RefreshRecord(Q3ListViewItem *item) { RDMatrix *matrix=new RDMatrix(list_station,item->text(0).toInt()); item->setText(1,matrix->name()); delete matrix; } +*/ diff --git a/rdadmin/list_matrices.h b/rdadmin/list_matrices.h index e9f3e515..d1001977 100644 --- a/rdadmin/list_matrices.h +++ b/rdadmin/list_matrices.h @@ -2,7 +2,7 @@ // // List Rivendell Matrices // -// (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 @@ -21,14 +21,14 @@ #ifndef LIST_MATRICES_H #define LIST_MATRICES_H -#include - -#include -#include +#include +#include #include #include #include +#include +#include class ListMatrices : public RDDialog { @@ -43,19 +43,18 @@ class ListMatrices : public RDDialog void addData(); void editData(); void deleteData(); - void doubleClickedData(Q3ListViewItem *item,const QPoint &pt,int col); + void doubleClickedData(const QModelIndex &); void closeData(); protected: void resizeEvent(QResizeEvent *e); private: - void DeleteMatrix(int matrix); - void RefreshList(); + void DeleteMatrix(RDMatrix *mtx); void AddList(int matrix_num); - void RefreshRecord(Q3ListViewItem *item); QLabel *list_title_label; - Q3ListView *list_view; + RDTableView *list_view; + RDMatrixListModel *list_model; QPushButton *list_add_button; QPushButton *list_edit_button; QPushButton *list_delete_button; @@ -65,5 +64,4 @@ class ListMatrices : public RDDialog }; -#endif - +#endif // LIST_MATRICES_H diff --git a/rdadmin/rdadmin_cs.ts b/rdadmin/rdadmin_cs.ts index ed3cbdf6..c74e1096 100644 --- a/rdadmin/rdadmin_cs.ts +++ b/rdadmin/rdadmin_cs.ts @@ -5761,19 +5761,19 @@ Stále ještě jej chcete smazat? Switchers: - Přepínače: + Přepínače: MATRIX - MATICE + MATICE DESCRIPTION - POPIS + POPIS TYPE - TYP + TYP &Add @@ -5793,19 +5793,19 @@ Stále ještě jej chcete smazat? Are you sure you want to delete switcher - Opravdu chcete smazat tento přepínač + Opravdu chcete smazat tento přepínač on - na + na ALL references to this switcher will be deleted! - VŠECHNY odkazy na tento přepínač budou smazány! + VŠECHNY odkazy na tento přepínač budou smazány! Deleting Switcher - Mazání přepínače + Mazání přepínače Local GPIO @@ -5863,6 +5863,10 @@ Stále ještě jej chcete smazat? BroadcastTools SRC-16 BroadcastTools SRC-16 + + &Replicators: + &Zopakování: + ListPypads diff --git a/rdadmin/rdadmin_de.ts b/rdadmin/rdadmin_de.ts index d5e9f362..8b5a8601 100644 --- a/rdadmin/rdadmin_de.ts +++ b/rdadmin/rdadmin_de.ts @@ -5407,19 +5407,19 @@ Generieren Switchers: - Schalter: + Schalter: MATRIX - MATRIX + MATRIX DESCRIPTION - BESCHREIBUNG + BESCHREIBUNG TYPE - TYP + TYP &Add @@ -5439,19 +5439,19 @@ Generieren Are you sure you want to delete switcher - Sind Sie sicher, daß sie diesen Schalter löschen wollen + Sind Sie sicher, daß sie diesen Schalter löschen wollen on - An + An ALL references to this switcher will be deleted! - ALLE Referenzen zu diesem Switcher werden gelöscht! + ALLE Referenzen zu diesem Switcher werden gelöscht! Deleting Switcher - Lösche Schalter + Lösche Schalter Local GPIO @@ -5509,6 +5509,10 @@ Generieren BroadcastTools SRC-16 BroadcastTools SRC-16 + + &Replicators: + + ListPypads diff --git a/rdadmin/rdadmin_es.ts b/rdadmin/rdadmin_es.ts index 4e063d5a..0620240a 100644 --- a/rdadmin/rdadmin_es.ts +++ b/rdadmin/rdadmin_es.ts @@ -5712,19 +5712,15 @@ Do you still want to delete it? Switchers: - Suicheras: - - - MATRIX - + Suicheras: DESCRIPTION - DESCRIPCIÓN + DESCRIPCIÓN TYPE - TIPO + TIPO &Add @@ -5744,19 +5740,19 @@ Do you still want to delete it? Are you sure you want to delete switcher - ¿Está seguro de borrar la suichera + ¿Está seguro de borrar la suichera on - en + en ALL references to this switcher will be deleted! - ¡TODAS las referencias a esta suichera serán borradas! + ¡TODAS las referencias a esta suichera serán borradas! Deleting Switcher - Borrando suichera + Borrando suichera Local GPIO @@ -5774,6 +5770,10 @@ Do you still want to delete it? Local Audio Adapter Adaptador de Audio Local + + &Replicators: + &Replicadores: + ListPypads diff --git a/rdadmin/rdadmin_fr.ts b/rdadmin/rdadmin_fr.ts index 61cc00a6..250e94ce 100644 --- a/rdadmin/rdadmin_fr.ts +++ b/rdadmin/rdadmin_fr.ts @@ -4435,22 +4435,6 @@ Permissions Rivendell Switcher List - - Switchers: - - - - MATRIX - - - - DESCRIPTION - - - - TYPE - - &Add @@ -4467,6 +4451,10 @@ Permissions &Close + + &Replicators: + + Are you sure you want to delete switcher diff --git a/rdadmin/rdadmin_nb.ts b/rdadmin/rdadmin_nb.ts index 3d98d89a..94305bcb 100644 --- a/rdadmin/rdadmin_nb.ts +++ b/rdadmin/rdadmin_nb.ts @@ -5272,19 +5272,19 @@ Klikk på "Lisens"-knappen for fleire opplysningar. Switchers: - Svitsjarar: + Svitsjarar: MATRIX - MATRISE + MATRISE DESCRIPTION - SKILDRING + SKILDRING TYPE - TYPE + TYPE &Add @@ -5304,19 +5304,19 @@ Klikk på "Lisens"-knappen for fleire opplysningar. Are you sure you want to delete switcher - Er du sikker på at du vil sletta svitsjaren + Er du sikker på at du vil sletta svitsjaren on - + ALL references to this switcher will be deleted! - ALLE referansar til denne svitsjaren blir sletta! + ALLE referansar til denne svitsjaren blir sletta! Deleting Switcher - Slettar svitsjar + Slettar svitsjar Local GPIO @@ -5366,6 +5366,10 @@ Klikk på "Lisens"-knappen for fleire opplysningar. BroadcastTools SS4.4 BroadcastTools SS4.4 + + &Replicators: + + ListPypads diff --git a/rdadmin/rdadmin_nn.ts b/rdadmin/rdadmin_nn.ts index 3d98d89a..94305bcb 100644 --- a/rdadmin/rdadmin_nn.ts +++ b/rdadmin/rdadmin_nn.ts @@ -5272,19 +5272,19 @@ Klikk på "Lisens"-knappen for fleire opplysningar. Switchers: - Svitsjarar: + Svitsjarar: MATRIX - MATRISE + MATRISE DESCRIPTION - SKILDRING + SKILDRING TYPE - TYPE + TYPE &Add @@ -5304,19 +5304,19 @@ Klikk på "Lisens"-knappen for fleire opplysningar. Are you sure you want to delete switcher - Er du sikker på at du vil sletta svitsjaren + Er du sikker på at du vil sletta svitsjaren on - + ALL references to this switcher will be deleted! - ALLE referansar til denne svitsjaren blir sletta! + ALLE referansar til denne svitsjaren blir sletta! Deleting Switcher - Slettar svitsjar + Slettar svitsjar Local GPIO @@ -5366,6 +5366,10 @@ Klikk på "Lisens"-knappen for fleire opplysningar. BroadcastTools SS4.4 BroadcastTools SS4.4 + + &Replicators: + + ListPypads diff --git a/rdadmin/rdadmin_pt_BR.ts b/rdadmin/rdadmin_pt_BR.ts index 671623a0..dfe77f16 100644 --- a/rdadmin/rdadmin_pt_BR.ts +++ b/rdadmin/rdadmin_pt_BR.ts @@ -5387,19 +5387,19 @@ Você ainda quer Deletar? Switchers: - Switchers: + Switchers: MATRIX - MATRIX + MATRIX DESCRIPTION - DESCRIÇÃO + DESCRIÇÃO TYPE - TIPO + TIPO &Add @@ -5419,19 +5419,19 @@ Você ainda quer Deletar? Are you sure you want to delete switcher - Tem certeza que quer deletar este switcher? + Tem certeza que quer deletar este switcher? on - Ligado + Ligado ALL references to this switcher will be deleted! - TODAS as referências deste switcher serão deletadas + TODAS as referências deste switcher serão deletadas Deleting Switcher - Deletando Switcher + Deletando Switcher Local GPIO @@ -5481,6 +5481,10 @@ Você ainda quer Deletar? BroadcastTools SS4.4 BroadcastTools SS4.4 + + &Replicators: + + ListPypads