2022-07-27 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in rdadmin(1) that permitted immutable switcher endpoint
	names to be edited.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-07-27 17:48:35 -04:00
parent 1167501802
commit 0bb0e6e766
6 changed files with 67 additions and 6 deletions

View File

@ -23197,3 +23197,6 @@
* Fixed a bug in the 'Software Authority Protocol' switcher/GPIO
driver in ripcd(8) that failed to initialize matrix endpoints
correctly at startup.
2022-07-27 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdadmin(1) that permitted immutable switcher endpoint
names to be edited.

View File

@ -264,7 +264,6 @@ void RDEndpointListModel::updateModel()
d_texts.back().push_back(QVariant());
}
}
// printf("SQL: %s\n",sql.toUtf8().constData());
q=new RDSqlQuery(sql);
while(q->next()) {
d_ids.push_back(-1);

View File

@ -2,7 +2,7 @@
//
// Abstract a Rivendell Switcher Matrix
//
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2022 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
@ -177,6 +177,55 @@ int __mx_default_values[RDMatrix::LastType][RDMatrix::LastControl]=
{1,0,0,12345,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0} // GVC 7000
};
int __mx_endpoints_are_editable_values[RDMatrix::LastType]=
{
true, // Local GPIO
true, // Generic GPIO
true, // Generic Serial
true, // SAS 32000
true, // SAS 64000
true, // Unity4k
true, // BT SS 8.2
true, // BT 10x1
true, // SAS 64000 GPI
true, // BT 16x1
true, // BT 8x2
true, // BT ACS 8.2
false, // SAS USI
true, // BT 16x2
true, // BT SS 12.4
true, // Local Adapter
true, // vGuest
true, // BT SS16.4
true, // StarGuide 3
true, // BT SS 4.2
true, // Livewire LWRP Audio
true, // Quartz 1
true, // BT SS 4.4
true, // BT SRC8 III
true, // BT SRC16
true, // Harlond
true, // ACU-1 Prophet
true, // LiveWire Multicast GPIO
true, // 360 AM16
true, // LiveWire LWRP GPIO
true, // BT Sentinel 4 Web
true, // BT GPI-16
true, // Modem Lines
false, // Software Authority
true, // SAS 16000
true, // Ross NK/SCP
true, // BT ADMS 44.22
true, // BT SS 4.1 MLR
true, // Modbus
true, // Kernel GPIO
true, // WheatNet SLIO
true, // WheatNet LIO
true, // BT Universal 4.1 MLR>>Web
true, // BT SS 2.1
true // GVC 7000
};
RDMatrix::RDMatrix(const QString &station,int matrix)
{
QString sql;
@ -886,6 +935,12 @@ int RDMatrix::defaultControlValue(RDMatrix::Type type,
}
bool RDMatrix::endpointsAreEditable(RDMatrix::Type type)
{
return __mx_endpoints_are_editable_values[type];
}
QString RDMatrix::GetEndpointName(int pointnum,const QString &table) const
{
QString sql=QString("select `NAME` from ")+table+" where "+

View File

@ -116,6 +116,7 @@ class RDMatrix
static bool controlActive(RDMatrix::Type type,RDMatrix::Control control);
static int defaultControlValue(RDMatrix::Type type,
RDMatrix::Control control);
static bool endpointsAreEditable(RDMatrix::Type type);
private:
QString GetEndpointName(int pointnum,const QString &table) const;

View File

@ -64,8 +64,10 @@ ListEndpoints::ListEndpoints(RDMatrix *matrix,RDMatrix::Endpoint endpoint,
list_type_label=new QLabel(list_table,this);
list_type_label->setFont(labelFont());
list_type_label->setGeometry(14,5,85,19);
if(RDMatrix::endpointsAreEditable(list_matrix->type())) {
connect(list_list_view,SIGNAL(doubleClicked(const QModelIndex &)),
this,SLOT(doubleClickedData(const QModelIndex &)));
}
connect(list_list_model,SIGNAL(modelReset()),
list_list_view,SLOT(resizeColumnsToContents()));
list_list_view->resizeColumnsToContents();
@ -77,7 +79,8 @@ ListEndpoints::ListEndpoints(RDMatrix *matrix,RDMatrix::Endpoint endpoint,
list_edit_button->setFont(buttonFont());
list_edit_button->setText(tr("Edit"));
connect(list_edit_button,SIGNAL(clicked()),this,SLOT(editData()));
list_edit_button->setDisabled(list_readonly);
list_edit_button->
setEnabled(RDMatrix::endpointsAreEditable(list_matrix->type()));
//
// Cancel Button

View File

@ -56,7 +56,7 @@ class ListEndpoints : public RDDialog
QPushButton *list_close_button;
int list_size;
QString list_table;
bool list_readonly;
// bool list_readonly;
};