2018-03-25 Fred Gleason <fredg@paravelsystems.com>

* Added support for notifications to rdclilogedit(1).
This commit is contained in:
Fred Gleason
2018-03-25 16:07:36 -04:00
parent 5d0e1786a2
commit e915b2f3a8
4 changed files with 21 additions and 1 deletions

View File

@@ -16745,3 +16745,5 @@
'make dist' target.
2018-03-25 Fred Gleason <fredg@paravelsystems.com>
* Added support for notifications to rdlogmanager(1).
2018-03-25 Fred Gleason <fredg@paravelsystems.com>
* Added support for notifications to rdclilogedit(1).

View File

@@ -113,7 +113,10 @@ void MainObject::Deletelog(QString logname)
RDLog *log=new RDLog(logname);
if(log->exists()) {
if(TryLock(log_lock,logname)) {
if(!log->remove(rda->station(),rda->user(),rda->config())) {
if(log->remove(rda->station(),rda->user(),rda->config())) {
SendNotification(RDNotification::DeleteAction,log->name());
}
else {
fprintf(stderr,
"deletelog: audio deletion error, log not deleted\n");
}
@@ -406,6 +409,7 @@ void MainObject::Save()
edit_log->
setModifiedDatetime(QDateTime(QDate::currentDate(),QTime::currentTime()));
edit_modified=false;
SendNotification(RDNotification::ModifyAction,edit_log->name());
}
@@ -437,6 +441,7 @@ void MainObject::Saveas(const QString &logname)
delete edit_log;
edit_log=log;
edit_modified=false;
SendNotification(RDNotification::AddAction,edit_log->name());
}
else {
fprintf(stderr,"saveas: log already exists\n");

View File

@@ -167,6 +167,17 @@ void MainObject::PrintPrompt() const
}
void MainObject::SendNotification(RDNotification::Action action,
const QString &logname)
{
RDNotification *notify=new RDNotification(RDNotification::LogType,
action,QVariant(logname));
rda->ripc()->sendNotification(*notify);
qApp->processEvents();
delete notify;
}
int main(int argc,char *argv[])
{
QApplication a(argc,argv,false);

View File

@@ -28,6 +28,7 @@
#include <rdlog.h>
#include <rdlog_event.h>
#include <rdloglock.h>
#include <rdnotification.h>
#define RDCLILOGEDIT_USAGE "[options]\n"
@@ -73,6 +74,7 @@ class MainObject : public QObject
void DispatchCommand(QString cmd);
QString ListLine(RDLogEvent *evt,int line) const;
void PrintPrompt() const;
void SendNotification(RDNotification::Action action,const QString &logname);
bool edit_quiet_option;
QString edit_accum;
bool edit_modified;