diff --git a/ChangeLog b/ChangeLog index 5579bbdf..2a1ce4e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23002,3 +23002,6 @@ the added event. 2022-04-29 Fred Gleason * Added an 'RDNotification::dump()' method. +2022-04-30 Fred Gleason + * Fixed a regression in rdcatch(1) that caused changes in events + to fail to be propagated to other rdcatch(1) instances. diff --git a/lib/rdnotification.cpp b/lib/rdnotification.cpp index 37ee1bea..b4de38b1 100644 --- a/lib/rdnotification.cpp +++ b/lib/rdnotification.cpp @@ -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; } diff --git a/rdcatch/rdcatch.cpp b/rdcatch/rdcatch.cpp index 96ae09a7..0053f1c5 100644 --- a/rdcatch/rdcatch.cpp +++ b/rdcatch/rdcatch.cpp @@ -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 *adds) { for(unsigned i=0;isize();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; } diff --git a/rdcatch/recordlistmodel.cpp b/rdcatch/recordlistmodel.cpp index 65537bd7..604a5625 100644 --- a/rdcatch/recordlistmodel.cpp +++ b/rdcatch/recordlistmodel.cpp @@ -2,7 +2,7 @@ // // Data model for Rivendell RDCatch events. // -// (C) Copyright 2021 Fred Gleason +// (C) Copyright 2021-2022 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 @@ -439,6 +439,8 @@ bool RecordListModel::refresh(unsigned id) for(int i=0;itype()==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 texts; diff --git a/rdcatch/recordlistmodel.h b/rdcatch/recordlistmodel.h index 308d7b8d..19ea24af 100644 --- a/rdcatch/recordlistmodel.h +++ b/rdcatch/recordlistmodel.h @@ -2,7 +2,7 @@ // // Data model for Rivendell RDCatch events // -// (C) Copyright 2021 Fred Gleason +// (C) Copyright 2021-2022 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 @@ -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);