2020-08-28 Fred Gleason <fredg@paravelsystems.com>

* Added an 'RDNotification::FeedType' value to the
	'RDNotification::Type' enumeration.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-08-28 13:40:11 -04:00
parent b2809f6aca
commit 288b7a9826
10 changed files with 102 additions and 36 deletions

View File

@ -20277,3 +20277,6 @@
2020-08-28 Fred Gleason <fredg@paravelsystems.com>
* Added sanity checks for Air and Expiration datetimes to the
'Editing Item' dialog in rdcastmanager(1).
2020-08-28 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDNotification::FeedType' value to the
'RDNotification::Type' enumeration.

View File

@ -119,6 +119,10 @@ bool RDNotification::read(const QString &str)
notify_id=QVariant(args[3].toUInt());
break;
case RDNotification::FeedType:
notify_id=QVariant(args[3]);
break;
case RDNotification::NullType:
case RDNotification::LastType:
break;
@ -174,6 +178,10 @@ QString RDNotification::write() const
ret+=QString().sprintf("%u",notify_id.toUInt());
break;
case RDNotification::FeedType:
ret+=notify_id.toString();
break;
case RDNotification::NullType:
case RDNotification::LastType:
break;
@ -211,6 +219,10 @@ QString RDNotification::typeString(RDNotification::Type type)
ret="FEED_ITEM";
break;
case RDNotification::FeedType:
ret="FEED";
break;
case RDNotification::NullType:
case RDNotification::LastType:
break;

View File

@ -28,7 +28,7 @@ class RDNotification
{
public:
enum Type {NullType=0,CartType=1,LogType=2,PypadType=3,DropboxType=4,
CatchEventType=5,FeedItemType=6,LastType=7};
CatchEventType=5,FeedItemType=6,FeedType=7,LastType=8};
enum Action {NoAction=0,AddAction=1,DeleteAction=2,ModifyAction=3,
LastAction=4};
RDNotification(Type type,Action action,const QVariant &id);

View File

@ -139,6 +139,15 @@ void RDRipc::sendGpoCart(int matrix)
}
void RDRipc::sendNotification(RDNotification::Type type,
RDNotification::Action action,const QVariant &id)
{
RDNotification *notify=new RDNotification(type,action,id);
sendNotification(*notify);
delete notify;
}
void RDRipc::sendNotification(const RDNotification &notify)
{
SendCommand("ON "+notify.write()+"!");

View File

@ -55,6 +55,8 @@ class RDRipc : public QObject
void sendGpoMask(int matrix);
void sendGpiCart(int matrix);
void sendGpoCart(int matrix);
void sendNotification(RDNotification::Type type,
RDNotification::Action action,const QVariant &id);
void sendNotification(const RDNotification &notify);
void sendOnairFlag();
void sendRml(RDMacro *macro);

View File

@ -383,11 +383,7 @@ void EditCast::okData()
if(!cast_feed->postXmlConditional("RDCastManager",this)) {
return;
}
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::ModifyAction,
cast_cast->id());
rda->ripc()->sendNotification(*notify);
delete notify;
done(0);
}

View File

@ -249,10 +249,11 @@ void ListCasts::addCartData()
list_casts_view->ensureItemVisible(item);
delete edit_cast;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
rda->ripc()->sendNotification(*notify);
delete notify;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
}
@ -281,10 +282,11 @@ void ListCasts::addFileData()
list_casts_view->ensureItemVisible(item);
delete edit_cast;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
rda->ripc()->sendNotification(*notify);
delete notify;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
}
@ -314,7 +316,12 @@ void ListCasts::addLogData()
RefreshItem(item);
list_casts_view->setSelected(item,true);
list_casts_view->ensureItemVisible(item);
//delete cast;
delete cast;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
}
else {
QMessageBox::warning(this,"RDCastManager - "+tr("Posting Error"),
@ -330,11 +337,6 @@ void ListCasts::addLogData()
}
}
delete d;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::AddAction,cast_id);
rda->ripc()->sendNotification(*notify);
delete notify;
}
@ -347,6 +349,12 @@ void ListCasts::editData()
EditCast *edit_cast=new EditCast(item->id(),this);
if(edit_cast->exec()==0) {
RefreshItem(item);
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::ModifyAction,item->id());
}
delete edit_cast;
}
@ -413,11 +421,11 @@ void ListCasts::deleteData()
delete pd;
delete cast;
delete item;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::DeleteAction,cast_id);
rda->ripc()->sendNotification(*notify);
delete notify;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
list_feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::DeleteAction,cast_id);
}

View File

@ -100,6 +100,12 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
cast_greencheckmark_map=new QPixmap(greencheckmark_xpm);
cast_redx_map=new QPixmap(redx_xpm);
//
// Notifications
//
connect(rda->ripc(),SIGNAL(notificationReceived(RDNotification *)),
this,SLOT(notificationReceivedData(RDNotification *)));
//
// Feed List
//
@ -218,6 +224,34 @@ void MainWidget::feedDoubleclickedData(Q3ListViewItem *,const QPoint &,int)
}
void MainWidget::notificationReceivedData(RDNotification *notify)
{
QString keyname;
RDListViewItem *item=NULL;
if(notify->type()==RDNotification::FeedType) {
keyname=notify->id().toString();
switch(notify->action()) {
case RDNotification::ModifyAction:
item=(RDListViewItem *)cast_feed_list->firstChild();
while(item!=NULL) {
if(item->text(1)==keyname) {
RefreshItem(item);
}
item=(RDListViewItem *)item->nextSibling();
}
break;
case RDNotification::NoAction:
case RDNotification::AddAction:
case RDNotification::DeleteAction:
case RDNotification::LastAction:
break;
}
}
}
void MainWidget::quitMainWidget()
{
exit(0);

View File

@ -43,6 +43,7 @@ class MainWidget : public RDWidget
void userChangedData();
void feedClickedData(Q3ListViewItem *item);
void feedDoubleclickedData(Q3ListViewItem *item,const QPoint &pt,int col);
void notificationReceivedData(RDNotification *notify);
void quitMainWidget();
protected:

View File

@ -128,7 +128,6 @@ void MainObject::ProcessFeed(const QString &key_name)
QDateTime now=QDateTime::currentDateTime();
QString now_str="\""+now.toString("yyyy-MM-dd hh:mm:ss")+"\"";
QString err_msg;
RDFeed *feed=new RDFeed(key_name,rda->config(),this);
//
@ -164,11 +163,12 @@ void MainObject::ProcessFeed(const QString &key_name)
q->value(0).toUInt(),cast->itemTitle().toUtf8().constData(),
feed->keyName().toUtf8().constData());
delete cast;
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::DeleteAction,
q->value(0).toUInt());
rda->ripc()->sendNotification(*notify);
delete notify;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedItemType,
RDNotification::DeleteAction,
q->value(0).toUInt());
deleted=true;
}
if(feed->postXml(&err_msg)) {
@ -176,11 +176,12 @@ void MainObject::ProcessFeed(const QString &key_name)
"repost of XML for feed \"%s\" triggered by cast id %u",
key_name.toUtf8().constData(),q->value(0).toUInt());
if(!deleted) {
RDNotification *notify=new RDNotification(RDNotification::FeedItemType,
RDNotification::ModifyAction,
q->value(0).toUInt());
rda->ripc()->sendNotification(*notify);
delete notify;
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
feed->keyName());
rda->ripc()->sendNotification(RDNotification::FeedType,
RDNotification::ModifyAction,
feed->keyName());
}
}
else {