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

* Added support for log notifications to rdairplay(1).
This commit is contained in:
Fred Gleason 2018-03-25 17:29:31 -04:00
parent de202521da
commit 1057fb16d2
3 changed files with 32 additions and 63 deletions

View File

@ -16749,3 +16749,5 @@
* Added support for notifications to rdclilogedit(1). * Added support for notifications to rdclilogedit(1).
2018-03-25 Fred Gleason <fredg@paravelsystems.com> 2018-03-25 Fred Gleason <fredg@paravelsystems.com>
* Added support for log notifications to the RDXport service. * Added support for log notifications to the RDXport service.
2018-03-25 Fred Gleason <fredg@paravelsystems.com>
* Added support for log notifications to rdairplay(1).

View File

@ -146,13 +146,6 @@ LogPlay::LogPlay(int id,QSocketDevice *nn_sock,QString logname,
play_grace_timer=new QTimer(this); play_grace_timer=new QTimer(this);
connect(play_grace_timer,SIGNAL(timeout()), connect(play_grace_timer,SIGNAL(timeout()),
this,SLOT(graceTimerData())); this,SLOT(graceTimerData()));
//
// Rescan Timer
//
play_rescan_timer=new QTimer(this);
connect(play_rescan_timer,SIGNAL(timeout()),this,SLOT(rescanEventsData()));
play_rescan_timer->start(LOGPLAY_RESCAN_INTERVAL);
} }
@ -487,9 +480,6 @@ void LogPlay::duckVolume(int level,int fade,int mport)
void LogPlay::makeNext(int line,bool refresh_status) void LogPlay::makeNext(int line,bool refresh_status)
{ {
play_next_line=line; play_next_line=line;
if(refresh_status) {
RefreshEvents(line,LOGPLAY_LOOKAHEAD_EVENTS);
}
SendNowNext(); SendNowNext();
SetTransTimer(); SetTransTimer();
UpdatePostPoint(); UpdatePostPoint();
@ -597,7 +587,7 @@ void LogPlay::append(const QString &log_name)
bool LogPlay::refresh() bool LogPlay::refresh()
{ {
RDLogLine *s; RDLogLine *s;
RDLogLine *d; RDLogLine *d;
int prev_line; int prev_line;
@ -616,6 +606,7 @@ bool LogPlay::refresh()
emit refreshStatusChanged(true); emit refreshStatusChanged(true);
if((size()==0)||(play_log==NULL)) { if((size()==0)||(play_log==NULL)) {
emit refreshStatusChanged(false); emit refreshStatusChanged(false);
emit refreshabilityChanged(false);
return true; return true;
} }
@ -746,7 +737,7 @@ bool LogPlay::refresh()
SetTransTimer(); SetTransTimer();
emit transportChanged(); emit transportChanged();
emit reloaded(); emit reloaded();
if(!play_refreshable) { if(play_refreshable) {
play_refreshable=false; play_refreshable=false;
emit refreshabilityChanged(play_refreshable); emit refreshabilityChanged(play_refreshable);
} }
@ -1675,21 +1666,6 @@ void LogPlay::timescalingSupportedData(int card,bool state)
} }
void LogPlay::rescanEventsData()
{
int start_pos=play_rescan_pos;
int start_size=LOGPLAY_RESCAN_SIZE;
if((start_pos+start_size)>=size()) {
start_size=size()-start_pos;
play_rescan_pos=0;
}
else {
play_rescan_pos+=LOGPLAY_RESCAN_SIZE;
}
RefreshEvents(start_pos,start_size);
}
void LogPlay::auditionStartedData() void LogPlay::auditionStartedData()
{ {
if(play_audition_head_played) { if(play_audition_head_played) {
@ -1742,6 +1718,32 @@ void LogPlay::notificationReceivedData(RDNotification *notify)
} }
} }
} }
if(notify->type()==RDNotification::LogType) {
//
// Check Refreshability
//
if((play_log!=NULL)&&(notify->id().toString()==play_log->name())) {
if((!play_log->exists())||(play_log->linkDatetime()!=play_link_datetime)||
(play_log->modifiedDatetime()<=play_modified_datetime)) {
if(play_refreshable) {
play_refreshable=false;
emit refreshabilityChanged(play_refreshable);
}
}
else {
if(play_log->autoRefresh()) {
refresh();
}
else {
if(!play_refreshable) {
play_refreshable=true;
emit refreshabilityChanged(play_refreshable);
}
}
}
}
}
} }
@ -2680,37 +2682,6 @@ void LogPlay::RefreshEvents(int line,int line_quan,bool force_update)
} }
} }
} }
//
// Check Refreshability
//
if(play_log!=NULL) {
if((!play_log->exists())||(play_log->linkDatetime()!=play_link_datetime)||
(play_log->modifiedDatetime()<=play_modified_datetime)) {
if(play_refreshable) {
play_refreshable=false;
emit refreshabilityChanged(play_refreshable);
}
}
else {
if(play_log->autoRefresh()) {
refresh();
}
else {
if(!play_refreshable) {
play_refreshable=true;
emit refreshabilityChanged(play_refreshable);
}
}
}
}
/*
if(play_id==0) {
printf("LogPlay::RefreshEvents(%d,%d) took: %d msec\n",line,line_quan,
st.msecsTo(QTime::currentTime()));
}
*/
} }
@ -2726,9 +2697,6 @@ void LogPlay::Playing(int id)
emit played(line); emit played(line);
AdvanceActiveEvent(); AdvanceActiveEvent();
UpdatePostPoint(); UpdatePostPoint();
// TEST
RefreshEvents(line,LOGPLAY_LOOKAHEAD_EVENTS);
//
LogPlayEvent(logline); LogPlayEvent(logline);
emit transportChanged(); emit transportChanged();
} }

View File

@ -131,7 +131,7 @@ class LogPlay : public QObject,public RDLogEvent
void macroFinishedData(); void macroFinishedData();
void macroStoppedData(); void macroStoppedData();
void timescalingSupportedData(int card,bool state); void timescalingSupportedData(int card,bool state);
void rescanEventsData(); // void rescanEventsData();
void auditionStartedData(); void auditionStartedData();
void auditionStoppedData(); void auditionStoppedData();
void notificationReceivedData(RDNotification *notify); void notificationReceivedData(RDNotification *notify);
@ -232,7 +232,6 @@ class LogPlay : public QObject,public RDLogEvent
bool play_timescaling_supported[RD_MAX_CARDS]; bool play_timescaling_supported[RD_MAX_CARDS];
QString play_svc_name; QString play_svc_name;
QString play_defaultsvc_name; QString play_defaultsvc_name;
QTimer *play_rescan_timer;
int play_rescan_pos; int play_rescan_pos;
RDLog *play_log; RDLog *play_log;
QDateTime play_link_datetime; QDateTime play_link_datetime;