2022-03-02 Fred Gleason <fredg@paravelsystems.com>

* Fixed a regression in rdcatch(1) that broke play-out events.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-03-02 13:28:47 -05:00
parent 8d10fbf5e1
commit 2c74a1b4ae
7 changed files with 71 additions and 67 deletions

View File

@ -22919,3 +22919,5 @@
groups.
2022-03-02 Fred Gleason <fredg@paravelsystems.com>
* Documented the 'TempDirectory=' directive in 'conf/rd.conf-sample'.
2022-03-02 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdcatch(1) that broke play-out events.

View File

@ -20,6 +20,8 @@
#include <QKeyEvent>
#include <rdescape_string.h>
#include "add_recording.h"
#include "edit_recording.h"
#include "edit_playout.h"
@ -34,7 +36,7 @@ extern RDStation *rdstation_conf;
AddRecording::AddRecording(QString *filter,QWidget *parent)
: RDDialog(parent)
{
add_id=-1;
add_record_id=NULL;
add_filter=filter;
setWindowTitle("RDCatch");
@ -144,9 +146,9 @@ QSizePolicy AddRecording::sizePolicy() const
}
int AddRecording::exec(RDRecording::Type *type,int rec_id)
int AddRecording::exec(unsigned *rec_id,RDRecording::Type *type)
{
add_id=rec_id;
add_record_id=rec_id;
add_type=type;
return QDialog::exec();
@ -155,7 +157,10 @@ int AddRecording::exec(RDRecording::Type *type,int rec_id)
void AddRecording::recordingData()
{
if(!catch_editrecording_dialog->exec(add_id,NULL)) {
*add_record_id=AddRecord(0);
if(!catch_editrecording_dialog->exec(*add_record_id,NULL)) {
DeleteRecord();
done(false);
return;
}
@ -166,7 +171,10 @@ void AddRecording::recordingData()
void AddRecording::playoutData()
{
if(!catch_editplayout_dialog->exec(add_id,NULL)) {
*add_record_id=AddRecord(128);
if(!catch_editplayout_dialog->exec(*add_record_id,NULL)) {
DeleteRecord();
done(false);
return;
}
@ -177,7 +185,10 @@ void AddRecording::playoutData()
void AddRecording::downloadData()
{
if(!catch_editdownload_dialog->exec(add_id,NULL)) {
*add_record_id=AddRecord(0);
if(!catch_editdownload_dialog->exec(*add_record_id,NULL)) {
DeleteRecord();
done(false);
return;
}
@ -188,7 +199,10 @@ void AddRecording::downloadData()
void AddRecording::uploadData()
{
if(!catch_editupload_dialog->exec(add_id,NULL)) {
*add_record_id=AddRecord(0);
if(!catch_editupload_dialog->exec(*add_record_id,NULL)) {
DeleteRecord();
done(false);
return;
}
@ -199,7 +213,10 @@ void AddRecording::uploadData()
void AddRecording::macroData()
{
if(!catch_editcartevent_dialog->exec(add_id,NULL)) {
*add_record_id=AddRecord(0);
if(!catch_editcartevent_dialog->exec(*add_record_id,NULL)) {
DeleteRecord();
done(false);
return;
}
@ -210,13 +227,13 @@ void AddRecording::macroData()
void AddRecording::switchData()
{
// EditSwitchEvent *recording=new EditSwitchEvent(add_id,NULL,this);
if(!catch_editswitchevent_dialog->exec(add_id,NULL)) {
// delete recording;
*add_record_id=AddRecord(0);
if(!catch_editswitchevent_dialog->exec(*add_record_id,NULL)) {
DeleteRecord();
done(false);
return;
}
// delete recording;
*add_type=RDRecording::SwitchEvent;
done(true);
}
@ -261,3 +278,25 @@ void AddRecording::closeEvent(QCloseEvent *e)
{
cancelData();
}
unsigned AddRecording::AddRecord(unsigned chan) const
{
QString sql;
sql=QString("insert into `RECORDINGS` set ")+
"`STATION_NAME`='"+RDEscapeString(rda->station()->name())+"',"+
QString::asprintf("`CHANNEL`=%u,",chan)+
"`CUT_NAME`=''";
return RDSqlQuery::run(sql).toUInt();
}
void AddRecording::DeleteRecord()
{
QString sql=QString("delete from `RECORDINGS` where ")+
QString::asprintf("`ID`=%u",*add_record_id);
RDSqlQuery::apply(sql);
*add_record_id=0;
add_record_id=NULL;
}

View File

@ -2,7 +2,7 @@
//
// Add a Rivendell RDCatch Event
//
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-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
@ -33,7 +33,7 @@ class AddRecording : public RDDialog
QSizePolicy sizePolicy() const;
public slots:
int exec(RDRecording::Type *type,int rec_id);
int exec(unsigned *rec_id,RDRecording::Type *type);
private slots:
void recordingData();
@ -50,7 +50,9 @@ class AddRecording : public RDDialog
void closeEvent(QCloseEvent *e);
private:
int add_id;
unsigned AddRecord(unsigned chan) const;
void DeleteRecord();
unsigned *add_record_id;
RDRecording::Type *add_type;
QString *add_filter;
QLabel *add_title_label;

View File

@ -2,7 +2,7 @@
//
// Edit a Rivendell RDCatch Playout
//
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-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
@ -26,7 +26,6 @@
#include "edit_playout.h"
#include "globals.h"
//EditPlayout::EditPlayout(int id,std::vector<int> *adds,QString *filter,
EditPlayout::EditPlayout(QString *filter,QWidget *parent)
: RDDialog(parent)
{
@ -50,11 +49,6 @@ EditPlayout::EditPlayout(QString *filter,QWidget *parent)
//
RDTextValidator *validator=new RDTextValidator(this);
//
// The Recording Record
//
// edit_recording=NULL;
//
// Dialogs
//
@ -110,11 +104,6 @@ EditPlayout::EditPlayout(QString *filter,QWidget *parent)
edit_saveas_button->setFont(buttonFont());
edit_saveas_button->setText(tr("Save As\nNew"));
connect(edit_saveas_button,SIGNAL(clicked()),this,SLOT(saveasData()));
/*
if(adds==NULL) {
edit_saveas_button->hide();
}
*/
//
// Ok Button
@ -132,20 +121,6 @@ EditPlayout::EditPlayout(QString *filter,QWidget *parent)
edit_cancel_button->setFont(buttonFont());
edit_cancel_button->setText(tr("Cancel"));
connect(edit_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
//
// Populate Data
//
/*
edit_event_widget->fromRecording(edit_recording->id());
edit_description_edit->setText(edit_recording->description());
edit_cutname=edit_recording->cutName();
edit_destination_edit->setText(RDCutPath(edit_cutname));
edit_dow_selector->fromRecording(edit_recording->id());
edit_oneshot_box->setChecked(edit_recording->oneShot());
locationChangedData(edit_event_widget->stationName(),
edit_event_widget->deckNumber());
*/
}

View File

@ -2,7 +2,7 @@
//
// Widget for setting basic event parameters in rdcatch(1)
//
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 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
@ -222,12 +222,15 @@ void EventWidget::fromRecording(unsigned record_id)
break;
case EventWidget::PlayEvent:
d_current_deck_number=q->value(2).toUInt()-128;
if(d_current_deck_number<=0) {
d_current_deck_number=1;
}
d_time_edit->setTime(q->value(3).toTime());
d_location_box->
setCurrentText(q->value(1).toString()+
QString::asprintf(" : %uP",q->value(2).toUInt()-128));
d_current_station_name=q->value(1).toString();
d_current_deck_number=q->value(2).toUInt()-128;
break;
case EventWidget::OtherEvent:
@ -239,6 +242,7 @@ void EventWidget::fromRecording(unsigned record_id)
}
}
delete q;
locationActivatedData(d_location_box->currentText());
}

View File

@ -276,6 +276,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
catch_editrecording_dialog=new EditRecording(&catch_filter,this);
catch_editswitchevent_dialog=new EditSwitchEvent(this);
catch_editupload_dialog=new EditUpload(&catch_filter,this);
catch_add_recording_dialog=new AddRecording(&catch_filter,this);
//
// Filter Selectors
@ -537,7 +538,6 @@ void MainWidget::nextEventData()
void MainWidget::addData()
{
RDSqlQuery *q;
int conn;
RDNotification *notify=NULL;
QModelIndex row;
@ -547,9 +547,8 @@ void MainWidget::addData()
return;
}
EnableScroll(false);
unsigned rec_id=AddRecord();
AddRecording *recording=new AddRecording(&catch_filter,this);
if(recording->exec(&type,rec_id)) {
unsigned rec_id=0;
if(catch_add_recording_dialog->exec(&rec_id,&type)) {
notify=new RDNotification(RDNotification::CatchEventType,
RDNotification::AddAction,rec_id);
rda->ripc()->sendNotification(*notify);
@ -565,12 +564,6 @@ void MainWidget::addData()
}
nextEventData();
}
else {
q=new RDSqlQuery(QString().
sprintf("delete from RECORDINGS where ID=%d",rec_id));
delete q;
}
delete recording;
}
@ -1219,18 +1212,6 @@ int MainWidget::ShowNextEvents(int day,QTime time,QTime *next)
}
unsigned MainWidget::AddRecord()
{
QString sql;
sql=QString("insert into `RECORDINGS` set ")+
"`STATION_NAME`='"+RDEscapeString(rda->station()->name())+"',"+
"`CHANNEL`=0,"+
"`CUT_NAME`=''";
return RDSqlQuery::run(sql).toUInt();
}
void MainWidget::ProcessNewRecords(std::vector<int> *adds)
{
for(unsigned i=0;i<adds->size();i++) {

View File

@ -2,7 +2,7 @@
//
// The Event Schedule Manager for Rivendell.
//
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-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
@ -33,6 +33,7 @@
#include <rdtransportbutton.h>
#include <rdwidget.h>
#include "add_recording.h"
#include "catch_monitor.h"
#include "catchtableview.h"
#include "deckmon.h"
@ -112,7 +113,6 @@ class MainWidget : public RDMainWindow
private:
int ShowNextEvents(int day,QTime time,QTime *next);
unsigned AddRecord();
void ProcessNewRecords(std::vector<int> *adds);
void EnableScroll(bool state);
void UpdateScroll();
@ -160,6 +160,7 @@ class MainWidget : public RDMainWindow
int catch_time_offset;
bool catch_host_warnings;
bool catch_resize;
AddRecording *catch_add_recording_dialog;
};