2022-04-30 Fred Gleason <fredg@paravelsystems.com>

* Fixed a regression in rdcatch(1) that caused changes in events
	to fail to be propagated to other rdcatch(1) instances.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-04-30 15:04:09 -04:00
parent e66cf868e8
commit 7b4c3f1b48
5 changed files with 43 additions and 9 deletions

View File

@@ -23002,3 +23002,6 @@
the added event.
2022-04-29 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDNotification::dump()' method.
2022-04-30 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdcatch(1) that caused changes in events
to fail to be propagated to other rdcatch(1) instances.

View File

@@ -196,23 +196,23 @@ QString RDNotification::dump() const
switch((QMetaType::Type)id().type()) {
case QMetaType::Int:
ret+=QString::asprintf("id: %d",id().toInt());
ret+=QString::asprintf("id: %d\n",id().toInt());
break;
case QMetaType::UInt:
ret+=QString::asprintf("id: %u",id().toUInt());
ret+=QString::asprintf("id: %u\n",id().toUInt());
break;
case QMetaType::QString:
ret+="id: "+id().toString();
ret+="id: "+id().toString()+"\n";
break;
default:
ret+="Unknown QMetaType type value: %u\n",id().type();
break;
}
ret+="type: "+RDNotification::typeString(type());
ret+="action: "+RDNotification::actionString(action());
ret+="type: "+RDNotification::typeString(type())+"\n";
ret+="action: "+RDNotification::actionString(action())+"\n";
return ret;
}

View File

@@ -329,6 +329,9 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
catch_recordings_model=new RecordListModel(this);
catch_recordings_model->setFont(defaultFont());
catch_recordings_model->setPalette(palette());
connect(rda->ripc(),SIGNAL(notificationReceived(RDNotification *)),
catch_recordings_model
,SLOT(notificationReceivedData(RDNotification *)));
catch_recordings_view->setModel(catch_recordings_model);
catch_recordings_view->resizeColumnsToContents();
connect(catch_recordings_view,SIGNAL(doubleClicked(const QModelIndex &)),
@@ -1216,10 +1219,9 @@ void MainWidget::ProcessNewRecords(std::vector<int> *adds)
{
for(unsigned i=0;i<adds->size();i++) {
catch_recordings_model->addRecord(adds->at(i));
RDNotification *notify=
new RDNotification(RDNotification::CatchEventType,
RDNotification::ModifyAction,adds->at(i));
RDNotification::AddAction,adds->at(i));
rda->ripc()->sendNotification(*notify);
delete notify;
}

View File

@@ -2,7 +2,7 @@
//
// Data model for Rivendell RDCatch events.
//
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2021-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
@@ -439,6 +439,8 @@ bool RecordListModel::refresh(unsigned id)
for(int i=0;i<d_texts.size();i++) {
if(d_ids.at(i)==id) {
updateRowLine(i);
emit dataChanged(createIndex(i,0),
createIndex(i,columnCount()));
return true;
}
}
@@ -455,6 +457,30 @@ void RecordListModel::setFilterSql(const QString &sql)
}
void RecordListModel::notificationReceivedData(RDNotification *notify)
{
if(notify->type()==RDNotification::CatchEventType) {
switch(notify->action()) {
case RDNotification::AddAction:
addRecord(notify->id().toUInt());
break;
case RDNotification::ModifyAction:
refresh(notify->id().toUInt());
break;
case RDNotification::DeleteAction:
removeRecord(notify->id().toUInt());
break;
case RDNotification::NoAction:
case RDNotification::LastAction:
break;
}
}
}
void RecordListModel::updateModel()
{
QList<QVariant> texts;

View File

@@ -2,7 +2,7 @@
//
// Data model for Rivendell RDCatch events
//
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2021-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
@@ -65,6 +65,9 @@ class RecordListModel : public QAbstractTableModel
bool refresh(unsigned id);
void setFilterSql(const QString &sql);
public slots:
void notificationReceivedData(RDNotification *notify);
protected:
void updateModel();
void updateRowLine(int line);