From 7c8fbeacb8417d5e6f684cf48d5370657493f339 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 14 Oct 2022 18:45:38 -0400 Subject: [PATCH] 2022-10-14 Fred Gleason * Added a 'SERVICES.BYPASS_MODE' field to the database. * Added a 'SERVICES.MUS_TRANS_TYPE_OFFSET' field to the database. * Added a 'SERVICES.MUS_TRANS_TYPE_LENGTH' field to the database. * Added a 'SERVICES.MUS_TIME_TYPE_OFFSET' field to the database. * Added a 'SERVICES.MUS_TIME_TYPE_LENGTH' field to the database. * Added a 'IMPORT_TEMPLATES.TRANS_TYPE_OFFSET' field to the database. * Added a 'IMPORT_TEMPLATES.TRANS_TYPE_LENGTH' field to the database. * Added a 'IMPORT_TEMPLATES.TIME_TYPE_OFFSET' field to the database. * Added a 'IMPORT_TEMPLATES.TIME_TYPE_LENGTH' field to the database. * Added a 'IMPORTER_LINES.TRANS_TYPE' field to the database. * Added a 'IMPORTER_LINES.TIME_TYPE' field to the database. * Added a 'IMPORTER_LINES.GRACE_TIME' field to the database. * Incremented the database schema to 363. * Added a 'Bypass Grid Processing' dropdown to the 'Edit Service' dialog in rdadmin(1). * Added 'Transition Type' and 'Time Type' parameters to the music import parameters in the 'Edit Service' dialog in rdadmin(1). Signed-off-by: Fred Gleason --- ChangeLog | 18 ++ docs/examples/0320090805.tfc | 6 +- docs/tables/import_templates.txt | 5 + docs/tables/importer_lines.txt | 3 + docs/tables/services.txt | 17 +- lib/dbversion.h | 2 +- lib/rdlogimportmodel.cpp | 2 +- lib/rdlogimportmodel.h | 1 + lib/rdsvc.cpp | 68 +++++- lib/rdsvc.h | 5 +- rdadmin/edit_svc.cpp | 121 ++++++----- rdadmin/edit_svc.h | 10 +- rdadmin/importfields.cpp | 341 ++++++++++++++++++++++++------- rdadmin/importfields.h | 31 ++- rdadmin/test_import.cpp | 4 +- utils/rddbmgr/revertschema.cpp | 22 ++ utils/rddbmgr/schemamap.cpp | 2 +- utils/rddbmgr/updateschema.cpp | 69 +++++++ 18 files changed, 567 insertions(+), 160 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb09df72..3b82adc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23490,3 +23490,21 @@ 2022-10-13 Fred Gleason * Added a 'RedHat Enterprise Linux 9' subsection to the 'DISTRO-SPECIFIC NOTES' section of 'INSTALL'. +2022-10-14 Fred Gleason + * Added a 'SERVICES.BYPASS_MODE' field to the database. + * Added a 'SERVICES.MUS_TRANS_TYPE_OFFSET' field to the database. + * Added a 'SERVICES.MUS_TRANS_TYPE_LENGTH' field to the database. + * Added a 'SERVICES.MUS_TIME_TYPE_OFFSET' field to the database. + * Added a 'SERVICES.MUS_TIME_TYPE_LENGTH' field to the database. + * Added a 'IMPORT_TEMPLATES.TRANS_TYPE_OFFSET' field to the database. + * Added a 'IMPORT_TEMPLATES.TRANS_TYPE_LENGTH' field to the database. + * Added a 'IMPORT_TEMPLATES.TIME_TYPE_OFFSET' field to the database. + * Added a 'IMPORT_TEMPLATES.TIME_TYPE_LENGTH' field to the database. + * Added a 'IMPORTER_LINES.TRANS_TYPE' field to the database. + * Added a 'IMPORTER_LINES.TIME_TYPE' field to the database. + * Added a 'IMPORTER_LINES.GRACE_TIME' field to the database. + * Incremented the database schema to 363. + * Added a 'Bypass Grid Processing' dropdown to the 'Edit Service' + dialog in rdadmin(1). + * Added 'Transition Type' and 'Time Type' parameters to the music + import parameters in the 'Edit Service' dialog in rdadmin(1). diff --git a/docs/examples/0320090805.tfc b/docs/examples/0320090805.tfc index 5fc5145b..dd506197 100644 --- a/docs/examples/0320090805.tfc +++ b/docs/examples/0320090805.tfc @@ -1,6 +1,6 @@ -00:00:00 10001 Lonely Cowboy 00:02:53 GUID4567890123456789012345678901 -00:02:53 10002 E Song 00:03:27 GUID4567890123456789012345678902 -00:06:20 10003 Likeness 00:02:54 GUID4567890123456789012345678903 +00:00:00 10001 Lonely Cowboy 00:02:53 GUID4567890123456789012345678901 SEGUE SOFT +00:02:53 10002 E Song 00:03:27 GUID4567890123456789012345678902 PLAY HARD +00:06:20 10003 Likeness 00:02:54 GUID4567890123456789012345678903 STOP 00:09:14 10004 Atchafalaya 00:28:02 GUID4567890123456789012345678904 00:30:00 BREAK Spot Break 00:02:00 00:32:00 10005 Mr. Banks 00:03:54 GUID4567890123456789012345678905 diff --git a/docs/tables/import_templates.txt b/docs/tables/import_templates.txt index b379a266..9044100f 100644 --- a/docs/tables/import_templates.txt +++ b/docs/tables/import_templates.txt @@ -30,3 +30,8 @@ EVENT_ID_OFFSET int(11) EVENT_ID_LENGTH int(11) ANNC_TYPE_OFFSET int(11) ANNC_TYPE_LENGTH int(11) + +TRANS_TYPE_OFFSET int(11) +TRANS_TYPE_LENGTH int(11) +TIME_TYPE_OFFSET int(11) +TIME_TYPE_LENGTH int(11) diff --git a/docs/tables/importer_lines.txt b/docs/tables/importer_lines.txt index fcf507e5..45943fa4 100644 --- a/docs/tables/importer_lines.txt +++ b/docs/tables/importer_lines.txt @@ -16,6 +16,9 @@ START_SECS int(11) signed CART_NUMBER int(10) unsigned TITLE varchar(191) LENGTH int(11) signed +TRANS_TYPE int(11) signed RDLogLine::TransType +TIME_TYPE int(11) signed RDLogLine::TimeType +GRACE_TIME int(11) signed EXT_DATA varchar(32) EXT_EVENT_ID varchar(32) EXT_ANNC_TYPE varchar(8) diff --git a/docs/tables/services.txt b/docs/tables/services.txt index 7c8c8fe1..06b454a5 100644 --- a/docs/tables/services.txt +++ b/docs/tables/services.txt @@ -4,12 +4,13 @@ The SERVICES table holds data concerning each audio service configured on the system. Following is the layout of a record in the SERVICES table: -FIELD NAME TYPE REMARKS ---------------------------------------------------------------- -NAME varchar(10) unsigned Primary Key -DESCRIPTION varchar(191) -NAME_TEMPLATE varchar(191) -DESCRIPTION_TEMPLATE varchar(191) +FIELD NAME TYPE REMARKS +------------------------------------------------------------------------------ +NAME varchar(10) unsigned Primary Key +DESCRIPTION varchar(191) +BYPASS_MODE enum('N','Y') +NAME_TEMPLATE varchar(191) +DESCRIPTION_TEMPLATE varchar(191) PROGRAM_CODE varchar(191) CHAIN_LOG enum('N','Y') SUB_EVENT_INHERITANCE int(11) 0=Inherit from parent event, @@ -82,3 +83,7 @@ MUS_EVENT_ID_OFFSET int(11) MUS_EVENT_ID_LENGTH int(11) MUS_ANNC_TYPE_OFFSET int(11) MUS_ANNC_TYPE_LENGTH int(11) +MUS_TRANS_TYPE_OFFSET int(11) +MUS_TRANS_TYPE_LENGTH int(11) +MUS_TIME_TYPE_OFFSET int(11) +MUS_TIME_TYPE_LENGTH int(11) diff --git a/lib/dbversion.h b/lib/dbversion.h index 5e2bc998..fca6e9b9 100644 --- a/lib/dbversion.h +++ b/lib/dbversion.h @@ -24,7 +24,7 @@ /* * Current Database Version */ -#define RD_VERSION_DATABASE 362 +#define RD_VERSION_DATABASE 363 #endif // DBVERSION_H diff --git a/lib/rdlogimportmodel.cpp b/lib/rdlogimportmodel.cpp index 2bfc42d7..9d9ffa03 100644 --- a/lib/rdlogimportmodel.cpp +++ b/lib/rdlogimportmodel.cpp @@ -2,7 +2,7 @@ // // Data model for Rivendell log imports // -// (C) Copyright 2021 Fred Gleason +// (C) Copyright 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 diff --git a/lib/rdlogimportmodel.h b/lib/rdlogimportmodel.h index 3c7da0be..c8574e1e 100644 --- a/lib/rdlogimportmodel.h +++ b/lib/rdlogimportmodel.h @@ -28,6 +28,7 @@ #include #include +#include class RDLogImportModel : public QAbstractTableModel { diff --git a/lib/rdsvc.cpp b/lib/rdsvc.cpp index ced0296a..19959f2b 100644 --- a/lib/rdsvc.cpp +++ b/lib/rdsvc.cpp @@ -67,6 +67,19 @@ void RDSvc::setDescription(const QString &desc) const } +bool RDSvc::bypassMode() const +{ + return RDBool(RDGetSqlValue("SERVICES","NAME",svc_name,"BYPASS_MODE"). + toString()); +} + + +void RDSvc::setBypassMode(bool state) const +{ + SetRow("BYPASS_MODE",RDYesNo(state)); +} + + QString RDSvc::programCode() const { return RDGetSqlValue("SERVICES","NAME",svc_name,"PROGRAM_CODE"). @@ -442,6 +455,7 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, QString data_buf; QString eventid_buf; QString annctype_buf; + int grace_time=0; QString os_flag; int cartlen; QString sql; @@ -536,7 +550,11 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, "`"+src_str+"LEN_MINUTES_OFFSET`,"+ // 18 "`"+src_str+"LEN_MINUTES_LENGTH`,"+ // 19 "`"+src_str+"LEN_SECONDS_OFFSET`,"+ // 20 - "`"+src_str+"LEN_SECONDS_LENGTH` "+ // 21 + "`"+src_str+"LEN_SECONDS_LENGTH`,"+ // 21 + "`"+src_str+"TRANS_TYPE_OFFSET`,"+ // 22 + "`"+src_str+"TRANS_TYPE_LENGTH`,"+ // 23 + "`"+src_str+"TIME_TYPE_OFFSET`,"+ // 24 + "`"+src_str+"TIME_TYPE_LENGTH` "+ // 25 "from "+parser_table+" where `NAME`='"+RDEscapeString(parser_name)+"'"; q=new RDSqlQuery(sql); if(!q->first()) { @@ -565,6 +583,10 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, int minutes_len_length=q->value(19).toInt(); int seconds_len_offset=q->value(20).toInt(); int seconds_len_length=q->value(21).toInt(); + int trans_type_offset=q->value(22).toInt(); + int trans_type_length=q->value(23).toInt(); + int time_type_offset=q->value(24).toInt(); + int time_type_length=q->value(25).toInt(); delete q; @@ -588,6 +610,10 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, int file_line=0; while(fgets(buf,RD_MAX_IMPORT_LINE_LENGTH,infile)!=NULL) { str_buf=QString::fromUtf8(buf); + QString trans_type_buf; + RDLogLine::TransType trans_type=RDLogLine::NoTrans; + QString time_type_buf; + RDLogLine::TimeType time_type=RDLogLine::Relative; // // Cart Number @@ -648,6 +674,33 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, // title=str_buf.mid(title_offset,title_length).trimmed(); + // + // Transition Type + // + trans_type_buf=str_buf.mid(trans_type_offset,trans_type_length).trimmed(); + if(trans_type_buf.toLower()=="play") { + trans_type=RDLogLine::Play; + } + if(trans_type_buf.toLower()=="segue") { + trans_type=RDLogLine::Segue; + } + if(trans_type_buf.toLower()=="stop") { + trans_type=RDLogLine::Stop; + } + + // + // Time Type + // + time_type_buf=str_buf.mid(time_type_offset,time_type_length).trimmed(); + if(time_type_buf.toLower()=="soft") { + time_type=RDLogLine::Hard; + grace_time=-1; + } + if(time_type_buf.toLower()=="hard") { + time_type=RDLogLine::Hard; + grace_time=0; + } + // // Process Line // @@ -658,6 +711,9 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, // sql=QString("insert into `IMPORTER_LINES` set ")+ "`STATION_NAME`='"+RDEscapeString(svc_station->name())+"',"+ + QString::asprintf("`TRANS_TYPE`=%d,",trans_type)+ + QString::asprintf("`TIME_TYPE`=%d,",time_type)+ + QString::asprintf("`GRACE_TIME`=%d,",grace_time)+ QString::asprintf("`PROCESS_ID`=%d,",getpid())+ QString::asprintf("`FILE_LINE`=%u,",file_line)+ QString::asprintf("`LINE_ID`=%d,",line_id); @@ -1135,7 +1191,7 @@ bool RDSvc::linkLog(RDSvc::ImportSource src,const QDate &date, sql=QString("delete from `IMPORTER_LINES` where ")+ "`STATION_NAME`='"+RDEscapeString(svc_station->name())+"' && "+ QString::asprintf("`PROCESS_ID`=%u",getpid()); - // printf("Importer Table Cleanup SQL: %s\n",(const char *)sql); + // printf("Importer Table Cleanup SQL: %s\n",sql.toUtf8().constData()); RDSqlQuery::apply(sql); delete log_lock; @@ -1718,6 +1774,14 @@ QString RDSvc::FieldString(ImportField field) const case RDSvc::ExtAnncType: fieldname="ANNC_TYPE_"; break; + + case RDSvc::TransType: + fieldname="TRANS_TYPE_"; + break; + + case RDSvc::TimeType: + fieldname="TIME_TYPE_"; + break; } return fieldname; } diff --git a/lib/rdsvc.h b/lib/rdsvc.h index a132a62e..9e00e8f1 100644 --- a/lib/rdsvc.h +++ b/lib/rdsvc.h @@ -38,7 +38,8 @@ class RDSvc : public QObject enum ImportSource {Traffic=0,Music=1}; enum ImportField {CartNumber=0,ExtData=3,ExtEventId=4,ExtAnncType=5, Title=6,StartHours=7,StartMinutes=8,StartSeconds=9, - LengthHours=10,LengthMinutes=11,LengthSeconds=12}; + LengthHours=10,LengthMinutes=11,LengthSeconds=12, + TransType=13,TimeType=14}; enum ShelflifeOrigin {OriginAirDate=0,OriginCreationDate=1}; enum SubEventInheritance {ParentEvent=0,SchedFile=1}; RDSvc(QString svcname,RDStation *station,RDConfig *config,QObject *parent=0); @@ -46,6 +47,8 @@ class RDSvc : public QObject bool exists() const; QString description() const; void setDescription(const QString &desc) const; + bool bypassMode() const; + void setBypassMode(bool state) const; QString programCode() const; void setProgramCode(const QString &str) const; QString nameTemplate() const; diff --git a/rdadmin/edit_svc.cpp b/rdadmin/edit_svc.cpp index bd2b3e69..5e7b7e67 100644 --- a/rdadmin/edit_svc.cpp +++ b/rdadmin/edit_svc.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Service // -// (C) Copyright 2002-2021 Fred Gleason +// (C) Copyright 2002-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 @@ -36,8 +36,6 @@ EditSvc::EditSvc(QString svc,QWidget *parent) : RDDialog(parent) { - setModal(true); - QString sql; RDSqlQuery *q; QString group; @@ -46,10 +44,8 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // // Fix the Window Size // - setMinimumWidth(sizeHint().width()); - setMaximumWidth(sizeHint().width()); - setMinimumHeight(sizeHint().height()); - setMaximumHeight(sizeHint().height()); + setMinimumSize(sizeHint()); + setMinimumSize(sizeHint()); svc_svc=new RDSvc(svc,rda->station(),rda->config()); @@ -124,11 +120,24 @@ EditSvc::EditSvc(QString svc,QWidget *parent) label->setGeometry(10,115,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + // + // Bypass Grid Processing + // + svc_bypass_box=new QComboBox(this); + svc_bypass_box->setGeometry(185,136,60,19); + svc_bypass_box->insertItem(0,tr("No")); + svc_bypass_box->insertItem(1,tr("Yes")); + connect(svc_bypass_box,SIGNAL(activated(const QString &)), + this,SLOT(textChangedData(const QString &))); + label=new QLabel(tr("Bypass Grid Processing")+":",this); + label->setGeometry(10,136,170,19); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + // // Inline Event Inheritance Log // svc_sub_event_inheritance_box=new QComboBox(this); - svc_sub_event_inheritance_box->setGeometry(185,136,240,19); + svc_sub_event_inheritance_box->setGeometry(185,157,240,19); svc_sub_event_inheritance_box-> insertItem((int)RDSvc::ParentEvent,tr("From Relative Position")); svc_sub_event_inheritance_box-> @@ -136,45 +145,45 @@ EditSvc::EditSvc(QString svc,QWidget *parent) connect(svc_sub_event_inheritance_box,SIGNAL(activated(const QString &)), this,SLOT(textChangedData(const QString &))); label=new QLabel(tr("Inline Event Start/Length")+":",this); - label->setGeometry(10,136,170,19); + label->setGeometry(10,157,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Voicetracking Group // svc_voice_group_box=new QComboBox(this); - svc_voice_group_box->setGeometry(185,157,240,19); + svc_voice_group_box->setGeometry(185,178,180,19); svc_voice_group_box->insertItem(0,tr("[none]")); label=new QLabel(tr("Voicetrack Group:"),this); - label->setGeometry(10,157,170,19); + label->setGeometry(10,178,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Autospot Group // svc_autospot_group_box=new QComboBox(this); - svc_autospot_group_box->setGeometry(185,178,240,19); + svc_autospot_group_box->setGeometry(185,199,180,19); svc_autospot_group_box->insertItem(0,tr("[none]")); label=new QLabel(tr("AutoSpot Group:"),this); - label->setGeometry(10,178,170,19); + label->setGeometry(10,199,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Chain Log // svc_chain_box=new QCheckBox(this); - svc_chain_box->setGeometry(30,201,15,15); + svc_chain_box->setGeometry(30,222,15,15); label=new QLabel(tr("Insert CHAIN TO at log end"),this); - label->setGeometry(50,201,170,19); + label->setGeometry(50,222,170,19); label->setAlignment(Qt::AlignLeft); // // Default Auto Refresh // svc_autorefresh_box=new QCheckBox(this); - svc_autorefresh_box->setGeometry(230,201,15,15); + svc_autorefresh_box->setGeometry(230,222,15,15); label=new QLabel(tr("Enable AutoRefresh By Default"),this); - label->setGeometry(250,201,200,19); + label->setGeometry(250,222,200,19); label->setAlignment(Qt::AlignLeft); // @@ -259,7 +268,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Traffic Import Section // label=new QLabel(tr("Traffic Data Import"),this); - label->setGeometry(10,231,160,24); + label->setGeometry(10,252,160,24); label->setFont(sectionLabelFont()); label->setAlignment(Qt::AlignLeft); @@ -267,11 +276,11 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Linux Traffic Import Path // svc_tfc_path_edit=new QLineEdit(this); - svc_tfc_path_edit->setGeometry(185,255,240,19); + svc_tfc_path_edit->setGeometry(185,276,240,19); svc_tfc_path_edit->setMaxLength(191); svc_tfc_path_edit->setValidator(validator); label=new QLabel(tr("Import Path:"),this); - label->setGeometry(10,255,170,19); + label->setGeometry(10,276,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_path_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -280,10 +289,10 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Linux Traffic Preimport Command // svc_tfc_preimport_cmd_edit=new QLineEdit(this); - svc_tfc_preimport_cmd_edit->setGeometry(185,276,240,19); + svc_tfc_preimport_cmd_edit->setGeometry(185,297,240,19); svc_tfc_preimport_cmd_edit->setValidator(validator); label=new QLabel(tr("Preimport Command:"),this); - label->setGeometry(10,276,170,19); + label->setGeometry(10,297,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_preimport_cmd_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -292,10 +301,10 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Note Cart // svc_tfc_label_cart_edit=new QLineEdit(this); - svc_tfc_label_cart_edit->setGeometry(185,297,240,19); + svc_tfc_label_cart_edit->setGeometry(185,318,240,19); svc_tfc_label_cart_edit->setMaxLength(32); label=new QLabel(tr("Insert Marker String")+":",this); - label->setGeometry(10,297,170,19); + label->setGeometry(10,318,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_label_cart_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -304,10 +313,10 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Track String // svc_tfc_track_edit=new QLineEdit(this); - svc_tfc_track_edit->setGeometry(185,318,240,19); + svc_tfc_track_edit->setGeometry(185,339,240,19); svc_tfc_track_edit->setMaxLength(32); label=new QLabel(tr("Insert Voice Track String:"),this); - label->setGeometry(10,318,170,19); + label->setGeometry(10,339,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_track_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -316,9 +325,9 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Traffic Import Template // svc_tfc_import_template_box=new QComboBox(this); - svc_tfc_import_template_box->setGeometry(185,339,240,19); + svc_tfc_import_template_box->setGeometry(185,360,240,19); label=new QLabel(tr("Import Template:"),this); - label->setGeometry(10,339,170,19); + label->setGeometry(10,360,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_import_template_box,SIGNAL(activated(int)), this,SLOT(tfcTemplateActivatedData(int))); @@ -326,15 +335,15 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // // Traffic Parser Settings // - svc_tfc_fields=new ImportFields(this); - svc_tfc_fields->setGeometry(10,360,svc_tfc_fields->sizeHint().width(), + svc_tfc_fields=new ImportFields(RDSvc::Traffic,this); + svc_tfc_fields->setGeometry(10,381,svc_tfc_fields->sizeHint().width(), svc_tfc_fields->sizeHint().height()); // // Traffic Test Button // button=new QPushButton(this); - button->setGeometry(360,360,60,40); + button->setGeometry(360,381,60,40); button->setFont(buttonFont()); button->setText(tr("Test \nTraffic")); connect(button,SIGNAL(clicked()),this,SLOT(trafficData())); @@ -343,7 +352,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Traffic Copy Button // svc_tfc_copy_button=new QPushButton(this); - svc_tfc_copy_button->setGeometry(360,410,60,40); + svc_tfc_copy_button->setGeometry(360,431,60,40); svc_tfc_copy_button->setFont(buttonFont()); svc_tfc_copy_button->setText(tr("Copy To\nCustom")); connect(svc_tfc_copy_button,SIGNAL(clicked()),this,SLOT(trafficCopyData())); @@ -352,7 +361,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Music Import Section // label=new QLabel(tr("Music Data Import"),this); - label->setGeometry(445,234,160,24); + label->setGeometry(445,252,160,24); label->setFont(sectionLabelFont()); label->setAlignment(Qt::AlignLeft); @@ -360,11 +369,11 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Linux Music Import Path // svc_mus_path_edit=new QLineEdit(this); - svc_mus_path_edit->setGeometry(620,256,240,19); + svc_mus_path_edit->setGeometry(620,277,240,19); svc_mus_path_edit->setMaxLength(191); svc_mus_path_edit->setValidator(validator); label=new QLabel(tr("Import Path:"),this); - label->setGeometry(450,256,165,19); + label->setGeometry(450,277,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_path_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -373,11 +382,11 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Linux Music Preimport Command // svc_mus_preimport_cmd_edit=new QLineEdit(this); - svc_mus_preimport_cmd_edit->setGeometry(620,276,240,19); + svc_mus_preimport_cmd_edit->setGeometry(620,297,240,19); svc_mus_preimport_cmd_edit->setValidator(validator); label= new QLabel(tr("Preimport Command:"),this); - label->setGeometry(450,276,165,19); + label->setGeometry(450,297,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_preimport_cmd_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -386,10 +395,10 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Label Cart // svc_mus_label_cart_edit=new QLineEdit(this); - svc_mus_label_cart_edit->setGeometry(620,297,240,19); + svc_mus_label_cart_edit->setGeometry(620,318,240,19); svc_mus_label_cart_edit->setMaxLength(32); label=new QLabel(tr("Insert Marker String")+":",this); - label->setGeometry(450,297,165,19); + label->setGeometry(450,318,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_label_cart_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -398,10 +407,10 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Insert Voice Track String // svc_mus_track_edit=new QLineEdit(this); - svc_mus_track_edit->setGeometry(620,318,240,19); + svc_mus_track_edit->setGeometry(620,339,240,19); svc_mus_track_edit->setMaxLength(255); label=new QLabel(tr("Insert Voice Track String:"),this); - label->setGeometry(450,318,165,19); + label->setGeometry(450,339,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_track_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -410,10 +419,10 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Insert Spot Break String // svc_mus_break_edit=new QLineEdit(this); - svc_mus_break_edit->setGeometry(620,339,240,19); + svc_mus_break_edit->setGeometry(620,360,240,19); svc_mus_break_edit->setMaxLength(255); label=new QLabel(tr("Insert Traffic Break String:"),this); - label->setGeometry(450,339,165,19); + label->setGeometry(450,360,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_break_edit,SIGNAL(textChanged(const QString &)), this,SLOT(textChangedData(const QString &))); @@ -422,9 +431,9 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Music Import Template // svc_mus_import_template_box=new QComboBox(this); - svc_mus_import_template_box->setGeometry(620,360,240,19); + svc_mus_import_template_box->setGeometry(620,381,240,19); label=new QLabel(tr("Import Template:"),this); - label->setGeometry(450,360,165,19); + label->setGeometry(450,381,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_import_template_box,SIGNAL(activated(int)), this,SLOT(musTemplateActivatedData(int))); @@ -432,15 +441,17 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // // Music Parser Settings // - svc_mus_fields=new ImportFields(this); - svc_mus_fields->setGeometry(445,381,svc_mus_fields->sizeHint().width(), + svc_mus_fields=new ImportFields(RDSvc::Music,this); + connect(svc_bypass_box,SIGNAL(activated(int)), + svc_mus_fields,SLOT(setBypassMode(int))); + svc_mus_fields->setGeometry(445,402,svc_mus_fields->sizeHint().width(), svc_mus_fields->sizeHint().height()); // // Music Test Button // button=new QPushButton(this); - button->setGeometry(795,381,60,40); + button->setGeometry(795,402,60,40); button->setFont(buttonFont()); button->setText(tr("Test \nMusic")); connect(button,SIGNAL(clicked()),this,SLOT(musicData())); @@ -449,7 +460,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // Music Copy Button // svc_mus_copy_button=new QPushButton(this); - svc_mus_copy_button->setGeometry(795,431,60,40); + svc_mus_copy_button->setGeometry(795,452,60,40); svc_mus_copy_button->setFont(buttonFont()); svc_mus_copy_button->setText(tr("Copy To\nCustom")); connect(svc_mus_copy_button,SIGNAL(clicked()),this,SLOT(musicCopyData())); @@ -500,6 +511,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_name_edit->setText(svc_svc->name()); svc_description_edit->setText(svc_svc->description()); + svc_bypass_box->setCurrentIndex(svc_svc->bypassMode()); svc_program_code_edit->setText(svc_svc->programCode()); svc_name_template_edit->setText(svc_svc->nameTemplate()); svc_description_template_edit->setText(svc_svc->descriptionTemplate()); @@ -576,7 +588,7 @@ EditSvc::~EditSvc() QSize EditSvc::sizeHint() const { - return QSize(870,691); + return QSize(870,712+42); } @@ -668,7 +680,7 @@ void EditSvc::tfcTemplateActivatedData(int index) svc_tfc_import_template_box->currentText()); } - svc_tfc_fields->setFields(svc_svc,RDSvc::Traffic); + svc_tfc_fields->setFields(svc_svc); svc_tfc_fields->setEnabled(index==0); svc_tfc_copy_button->setEnabled(index!=0); import_changed=true; @@ -701,7 +713,7 @@ void EditSvc::musTemplateActivatedData(int index) svc_mus_import_template_box->currentText()); } - svc_mus_fields->setFields(svc_svc,RDSvc::Music); + svc_mus_fields->setFields(svc_svc); svc_mus_fields->setEnabled(index==0); svc_mus_copy_button->setEnabled(index!=0); import_changed=true; @@ -751,6 +763,7 @@ void EditSvc::TestDataImport(RDSvc::ImportSource src) void EditSvc::Save() { svc_svc->setDescription(svc_description_edit->text()); + svc_svc->setBypassMode(svc_bypass_box->currentIndex()); svc_svc->setProgramCode(svc_program_code_edit->text()); svc_svc->setNameTemplate(svc_name_template_edit->text().trimmed()); svc_svc->setDescriptionTemplate(svc_description_template_edit->text()); @@ -781,7 +794,7 @@ void EditSvc::Save() setPreimportCommand(RDSvc::Traffic,svc_tfc_preimport_cmd_edit->text()); if(svc_tfc_import_template_box->currentIndex()==0) { svc_svc->setImportTemplate(RDSvc::Traffic,""); - svc_tfc_fields->readFields(svc_svc,RDSvc::Traffic); + svc_tfc_fields->readFields(svc_svc); } else { svc_svc->setImportTemplate(RDSvc::Traffic, @@ -793,7 +806,7 @@ void EditSvc::Save() svc_svc->setPreimportCommand(RDSvc::Music,svc_mus_preimport_cmd_edit->text()); if(svc_mus_import_template_box->currentIndex()==0) { svc_svc->setImportTemplate(RDSvc::Music,""); - svc_mus_fields->readFields(svc_svc,RDSvc::Music); + svc_mus_fields->readFields(svc_svc); } else { svc_svc->setImportTemplate(RDSvc::Music, diff --git a/rdadmin/edit_svc.h b/rdadmin/edit_svc.h index 642de06f..08f2c878 100644 --- a/rdadmin/edit_svc.h +++ b/rdadmin/edit_svc.h @@ -2,7 +2,7 @@ // // Edit a Rivendell Service // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-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 @@ -63,6 +63,10 @@ class EditSvc : public RDDialog QLineEdit *svc_program_code_edit; QLineEdit *svc_name_template_edit; QLineEdit *svc_description_template_edit; + + QComboBox *svc_bypass_box; + + QComboBox *svc_sub_event_inheritance_box; QComboBox *svc_voice_group_box; QComboBox *svc_autospot_group_box; QLineEdit *svc_tfc_path_edit; @@ -78,7 +82,6 @@ class EditSvc : public RDDialog QLineEdit *svc_mus_label_cart_edit; QLineEdit *svc_mus_break_edit; QLineEdit *svc_mus_track_edit; - QComboBox *svc_sub_event_inheritance_box; QCheckBox *svc_chain_box; QCheckBox *svc_autorefresh_box; QCheckBox *svc_loglife_box; @@ -95,5 +98,4 @@ class EditSvc : public RDDialog }; -#endif - +#endif // EDIT_SVC_H diff --git a/rdadmin/importfields.cpp b/rdadmin/importfields.cpp index 590c1e26..2957d573 100644 --- a/rdadmin/importfields.cpp +++ b/rdadmin/importfields.cpp @@ -2,7 +2,7 @@ // // Import Parser Parameters for RDAdmin. // -// (C) Copyright 2010-2021 Fred Gleason +// (C) Copyright 2010-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 @@ -22,21 +22,23 @@ #include "importfields.h" -ImportFields::ImportFields(QWidget *parent) +ImportFields::ImportFields(RDSvc::ImportSource src,QWidget *parent) : RDWidget(parent) { QLabel *label; import_changed=false; + bypass_mode=false; + import_source=src; // - // Traffic Cartname Parser Data Section + // Cartname Parser Data Section // label=new QLabel(tr("Cart Number:"),this); label->setGeometry(0,0,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Cart Offset + // Cart Offset // cart_offset_spin=new QSpinBox(this); cart_offset_spin->setGeometry(175,0,50,19); @@ -48,7 +50,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Cart Length + // Cart Length // cart_length_spin=new QSpinBox(this); cart_length_spin->setGeometry(285,0,50,19); @@ -91,14 +93,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Start Hours Parser Data Section + // Start Hours Parser Data Section // label=new QLabel(tr("Start Time - Hours:"),this); label->setGeometry(0,42,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Start Hours Offset + // Start Hours Offset // hours_offset_spin=new QSpinBox(this); hours_offset_spin->setGeometry(175,42,50,19); @@ -110,7 +112,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Start Hours Length + // Start Hours Length // hours_length_spin=new QSpinBox(this); hours_length_spin->setGeometry(285,42,50,19); @@ -122,14 +124,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Start Minutes Parser Data Section + // Start Minutes Parser Data Section // label=new QLabel(tr("Start Time - Minutes:"),this); label->setGeometry(0,63,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Start Minutes Offset + // Start Minutes Offset // minutes_offset_spin=new QSpinBox(this); minutes_offset_spin->setGeometry(175,63,50,19); @@ -141,7 +143,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Start Minutes Length + // Start Minutes Length // minutes_length_spin=new QSpinBox(this); minutes_length_spin->setGeometry(285,63,50,19); @@ -153,14 +155,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Start Seconds Parser Data Section + // Start Seconds Parser Data Section // label=new QLabel(tr("Start Time - Seconds:"),this); label->setGeometry(0,84,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Start Seconds Offset + // Start Seconds Offset // seconds_offset_spin=new QSpinBox(this); seconds_offset_spin->setGeometry(175,84,50,19); @@ -172,7 +174,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Start Seconds Length + // Start Seconds Length // seconds_length_spin=new QSpinBox(this); seconds_length_spin->setGeometry(285,84,50,19); @@ -184,14 +186,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Length Hours Parser Data Section + // Length Hours Parser Data Section // label=new QLabel(tr("Length - Hours:"),this); label->setGeometry(0,106,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Length Hours Offset + // Length Hours Offset // len_hours_offset_spin=new QSpinBox(this); len_hours_offset_spin->setGeometry(175,106,50,19); @@ -203,7 +205,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Length Hours Length + // Length Hours Length // len_hours_length_spin=new QSpinBox(this); len_hours_length_spin->setGeometry(285,106,50,19); @@ -215,14 +217,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Length Minutes Parser Data Section + // Length Minutes Parser Data Section // label=new QLabel(tr("Length - Minutes:"),this); label->setGeometry(0,127,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Length Minutes Offset + // Length Minutes Offset // len_minutes_offset_spin=new QSpinBox(this); len_minutes_offset_spin->setGeometry(175,127,50,19); @@ -234,7 +236,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Length Minutes Length + // Length Minutes Length // len_minutes_length_spin=new QSpinBox(this); len_minutes_length_spin->setGeometry(285,127,50,19); @@ -246,14 +248,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Length Seconds Parser Data Section + // Length Seconds Parser Data Section // label=new QLabel(tr("Length - Seconds:"),this); label->setGeometry(0,148,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Length Seconds Offset + // Length Seconds Offset // len_seconds_offset_spin=new QSpinBox(this); len_seconds_offset_spin->setGeometry(175,148,50,19); @@ -265,7 +267,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Length Seconds Length + // Length Seconds Length // len_seconds_length_spin=new QSpinBox(this); len_seconds_length_spin->setGeometry(285,148,50,19); @@ -277,14 +279,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic GUID Parser Data Section + // GUID Parser Data Section // label=new QLabel(tr("Globally Unique ID:"),this); label->setGeometry(0,169,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Contract # Offset + // Contract # Offset // data_offset_spin=new QSpinBox(this); data_offset_spin->setGeometry(175,169,50,19); @@ -296,7 +298,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Contract # Length + // Contract # Length // data_length_spin=new QSpinBox(this); data_length_spin->setGeometry(285,169,50,19); @@ -308,14 +310,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Event ID Parser Data Section + // Event ID Parser Data Section // label=new QLabel(tr("Event ID:"),this); label->setGeometry(0,190,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Event ID Offset + // Event ID Offset // event_id_offset_spin=new QSpinBox(this); event_id_offset_spin->setGeometry(175,190,50,19); @@ -327,7 +329,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Event ID Length + // Event ID Length // event_id_length_spin=new QSpinBox(this); event_id_length_spin->setGeometry(285,190,50,19); @@ -339,14 +341,14 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Announcement Type Parser Data Section + // Announcement Type Parser Data Section // label=new QLabel(tr("Annc. Type:"),this); label->setGeometry(0,211,125,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Traffic Announcement Type Offset + // Announcement Type Offset // annctype_offset_spin=new QSpinBox(this); annctype_offset_spin->setGeometry(175,211,50,19); @@ -358,7 +360,7 @@ ImportFields::ImportFields(QWidget *parent) this,SLOT(valueChangedData(int))); // - // Traffic Announcement Type Length + // Announcement Type Length // annctype_length_spin=new QSpinBox(this); annctype_length_spin->setGeometry(285,211,50,19); @@ -368,11 +370,96 @@ ImportFields::ImportFields(QWidget *parent) label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(annctype_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); + + // + // Transition Type Parser Data Section + // + trans_type_label=new QLabel(tr("Transition Type")+":",this); + trans_type_label->setGeometry(0,232,125,19); + trans_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + trans_type_label->setVisible(import_source==RDSvc::Music); + trans_type_label->setEnabled(bypass_mode); + + // + // Transition Type Offset + // + trans_type_offset_spin=new QSpinBox(this); + trans_type_offset_spin->setGeometry(175,232,50,19); + trans_type_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); + trans_type_offset_spin->setVisible(import_source==RDSvc::Music); + trans_type_offset_spin->setEnabled(bypass_mode); + trans_type_offset_label=new QLabel(tr("Offset:"),this); + trans_type_offset_label->setGeometry(125,232,45,19); + trans_type_offset_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + trans_type_offset_label->setVisible(import_source==RDSvc::Music); + trans_type_offset_label->setEnabled(bypass_mode); + connect(trans_type_offset_spin,SIGNAL(valueChanged(int)), + this,SLOT(valueChangedData(int))); + + // + // Transition Type Length + // + trans_type_length_spin=new QSpinBox(this); + trans_type_length_spin->setGeometry(285,232,50,19); + trans_type_length_spin->setRange(0,8); + trans_type_length_spin->setVisible(import_source==RDSvc::Music); + trans_type_length_spin->setEnabled(bypass_mode); + trans_type_length_label=new QLabel(tr("Length:"),this); + trans_type_length_label->setGeometry(230,232,50,19); + trans_type_length_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + trans_type_length_label->setVisible(import_source==RDSvc::Music); + trans_type_length_label->setEnabled(bypass_mode); + connect(trans_type_length_spin,SIGNAL(valueChanged(int)), + this,SLOT(valueChangedData(int))); + + // + // Time Type Parser Data Section + // + time_type_label=new QLabel(tr("Time Type")+":",this); + time_type_label->setGeometry(0,253,125,19); + time_type_label->setVisible(import_source==RDSvc::Music); + time_type_label->setEnabled(bypass_mode); + time_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + + // + // Time Type Offset + // + time_type_offset_spin=new QSpinBox(this); + time_type_offset_spin->setGeometry(175,253,50,19); + time_type_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); + time_type_offset_spin->setVisible(import_source==RDSvc::Music); + time_type_offset_spin->setEnabled(bypass_mode); + time_type_offset_label=new QLabel(tr("Offset:"),this); + time_type_offset_label->setGeometry(125,253,45,19); + time_type_offset_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + time_type_offset_label->setVisible(import_source==RDSvc::Music); + time_type_offset_label->setEnabled(bypass_mode); + connect(time_type_offset_spin,SIGNAL(valueChanged(int)), + this,SLOT(valueChangedData(int))); + + // + // Time Type Length + // + time_type_length_spin=new QSpinBox(this); + time_type_length_spin->setGeometry(285,253,50,19); + time_type_length_spin->setRange(0,8); + time_type_length_spin->setVisible(import_source==RDSvc::Music); + time_type_length_spin->setEnabled(bypass_mode); + time_type_length_label=new QLabel(tr("Length:"),this); + time_type_length_label->setGeometry(230,253,50,19); + time_type_length_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + time_type_length_label->setVisible(import_source==RDSvc::Music); + time_type_length_label->setEnabled(bypass_mode); + connect(time_type_length_spin,SIGNAL(valueChanged(int)), + this,SLOT(valueChangedData(int))); } QSize ImportFields::sizeHint() const { + if(import_source==RDSvc::Music) { + return QSize(335,230+42); + } return QSize(335,230); } @@ -389,70 +476,168 @@ bool ImportFields::changed() const } -void ImportFields::readFields(RDSvc *svc,RDSvc::ImportSource type) +void ImportFields::readFields(RDSvc *svc) { - svc->setImportOffset(type,RDSvc::CartNumber,cart_offset_spin->value()); - svc->setImportLength(type,RDSvc::CartNumber,cart_length_spin->value()); - svc->setImportOffset(type,RDSvc::Title,title_offset_spin->value()); - svc->setImportLength(type,RDSvc::Title,title_length_spin->value()); - svc->setImportOffset(type,RDSvc::StartHours,hours_offset_spin->value()); - svc->setImportLength(type,RDSvc::StartHours,hours_length_spin->value()); - svc->setImportOffset(type,RDSvc::StartMinutes,minutes_offset_spin->value()); - svc->setImportLength(type,RDSvc::StartMinutes,minutes_length_spin->value()); - svc->setImportOffset(type,RDSvc::StartSeconds,seconds_offset_spin->value()); - svc->setImportLength(type,RDSvc::StartSeconds,seconds_length_spin->value()); - svc->setImportOffset(type,RDSvc::LengthHours,len_hours_offset_spin->value()); - svc->setImportLength(type,RDSvc::LengthHours,len_hours_length_spin->value()); - svc->setImportOffset(type,RDSvc::LengthMinutes, + svc->setImportOffset(import_source,RDSvc::CartNumber, + cart_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::CartNumber, + cart_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::Title,title_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::Title,title_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::StartHours, + hours_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::StartHours, + hours_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::StartMinutes, + minutes_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::StartMinutes, + minutes_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::StartSeconds, + seconds_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::StartSeconds, + seconds_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::LengthHours, + len_hours_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::LengthHours, + len_hours_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::LengthMinutes, len_minutes_offset_spin->value()); - svc->setImportLength(type,RDSvc::LengthMinutes, + svc->setImportLength(import_source,RDSvc::LengthMinutes, len_minutes_length_spin->value()); - svc->setImportOffset(type,RDSvc::LengthSeconds, + svc->setImportOffset(import_source,RDSvc::LengthSeconds, len_seconds_offset_spin->value()); - svc->setImportLength(type,RDSvc::LengthSeconds, + svc->setImportLength(import_source,RDSvc::LengthSeconds, len_seconds_length_spin->value()); - svc->setImportOffset(type,RDSvc::ExtData,data_offset_spin->value()); - svc->setImportLength(type,RDSvc::ExtData,data_length_spin->value()); - svc->setImportOffset(type,RDSvc::ExtEventId,event_id_offset_spin->value()); - svc->setImportLength(type,RDSvc::ExtEventId,event_id_length_spin->value()); - svc->setImportOffset(type,RDSvc::ExtAnncType,annctype_offset_spin->value()); - svc->setImportLength(type,RDSvc::ExtAnncType,annctype_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::ExtData, + data_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::ExtData,data_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::ExtEventId, + event_id_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::ExtEventId, + event_id_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::ExtAnncType, + annctype_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::ExtAnncType, + annctype_length_spin->value()); + if(import_source==RDSvc::Music) { + svc->setImportOffset(import_source,RDSvc::TransType, + trans_type_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::TransType, + trans_type_length_spin->value()); + svc->setImportOffset(import_source,RDSvc::TimeType, + time_type_offset_spin->value()); + svc->setImportLength(import_source,RDSvc::TimeType, + time_type_length_spin->value()); + } import_changed=false; } -void ImportFields::setFields(RDSvc *svc,RDSvc::ImportSource type) +void ImportFields::setFields(RDSvc *svc) { - cart_offset_spin->setValue(svc->importOffset(type,RDSvc::CartNumber)); - cart_length_spin->setValue(svc->importLength(type,RDSvc::CartNumber)); - title_offset_spin->setValue(svc->importOffset(type,RDSvc::Title)); - title_length_spin->setValue(svc->importLength(type,RDSvc::Title)); - hours_offset_spin->setValue(svc->importOffset(type,RDSvc::StartHours)); - hours_length_spin->setValue(svc->importLength(type,RDSvc::StartHours)); - minutes_offset_spin->setValue(svc->importOffset(type,RDSvc::StartMinutes)); - minutes_length_spin->setValue(svc->importLength(type,RDSvc::StartMinutes)); - seconds_offset_spin->setValue(svc->importOffset(type,RDSvc::StartSeconds)); - seconds_length_spin->setValue(svc->importLength(type,RDSvc::StartSeconds)); - len_hours_offset_spin->setValue(svc->importOffset(type,RDSvc::LengthHours)); - len_hours_length_spin->setValue(svc->importLength(type,RDSvc::LengthHours)); + setBypassMode(svc->bypassMode()); + cart_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::CartNumber)); + cart_length_spin-> + setValue(svc->importLength(import_source,RDSvc::CartNumber)); + title_offset_spin->setValue(svc->importOffset(import_source,RDSvc::Title)); + title_length_spin->setValue(svc->importLength(import_source,RDSvc::Title)); + hours_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::StartHours)); + hours_length_spin-> + setValue(svc->importLength(import_source,RDSvc::StartHours)); + minutes_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::StartMinutes)); + minutes_length_spin-> + setValue(svc->importLength(import_source,RDSvc::StartMinutes)); + seconds_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::StartSeconds)); + seconds_length_spin-> + setValue(svc->importLength(import_source,RDSvc::StartSeconds)); + len_hours_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::LengthHours)); + len_hours_length_spin-> + setValue(svc->importLength(import_source,RDSvc::LengthHours)); len_minutes_offset_spin-> - setValue(svc->importOffset(type,RDSvc::LengthMinutes)); + setValue(svc->importOffset(import_source,RDSvc::LengthMinutes)); len_minutes_length_spin-> - setValue(svc->importLength(type,RDSvc::LengthMinutes)); + setValue(svc->importLength(import_source,RDSvc::LengthMinutes)); len_seconds_offset_spin-> - setValue(svc->importOffset(type,RDSvc::LengthSeconds)); + setValue(svc->importOffset(import_source,RDSvc::LengthSeconds)); len_seconds_length_spin-> - setValue(svc->importLength(type,RDSvc::LengthSeconds)); - data_offset_spin->setValue(svc->importOffset(type,RDSvc::ExtData)); - data_length_spin->setValue(svc->importLength(type,RDSvc::ExtData)); - event_id_offset_spin->setValue(svc->importOffset(type,RDSvc::ExtEventId)); - event_id_length_spin->setValue(svc->importLength(type,RDSvc::ExtEventId)); - annctype_offset_spin->setValue(svc->importOffset(type,RDSvc::ExtAnncType)); - annctype_length_spin->setValue(svc->importLength(type,RDSvc::ExtAnncType)); + setValue(svc->importLength(import_source,RDSvc::LengthSeconds)); + data_offset_spin->setValue(svc->importOffset(import_source,RDSvc::ExtData)); + data_length_spin->setValue(svc->importLength(import_source,RDSvc::ExtData)); + event_id_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::ExtEventId)); + event_id_length_spin-> + setValue(svc->importLength(import_source,RDSvc::ExtEventId)); + annctype_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::ExtAnncType)); + annctype_length_spin-> + setValue(svc->importLength(import_source,RDSvc::ExtAnncType)); + if(import_source==RDSvc::Music) { + trans_type_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::TransType)); + trans_type_length_spin-> + setValue(svc->importLength(import_source,RDSvc::TransType)); + time_type_offset_spin-> + setValue(svc->importOffset(import_source,RDSvc::TimeType)); + time_type_length_spin-> + setValue(svc->importLength(import_source,RDSvc::TimeType)); + } import_changed=false; } +bool ImportFields::bypassMode() const +{ + return bypass_mode; +} + + +void ImportFields::setBypassMode(bool state) +{ + if(state!=bypass_mode) { + trans_type_label->setEnabled(state); + trans_type_offset_label->setEnabled(state); + trans_type_offset_spin->setEnabled(state); + trans_type_length_label->setEnabled(state); + trans_type_length_spin->setEnabled(state); + time_type_label->setEnabled(state); + time_type_offset_label->setEnabled(state); + time_type_offset_spin->setEnabled(state); + time_type_length_label->setEnabled(state); + time_type_length_spin->setEnabled(state); + + bypass_mode=state; + import_changed=true; + } +} + + +void ImportFields::setBypassMode(int n) +{ + setBypassMode((bool)n); +} + + +void ImportFields::setEnabled(bool state) +{ + QWidget::setEnabled(state); + trans_type_label->setEnabled(state&&bypass_mode); + trans_type_offset_label->setEnabled(state&&bypass_mode); + trans_type_offset_spin->setEnabled(state&&bypass_mode); + trans_type_length_label->setEnabled(state&&bypass_mode); + trans_type_length_spin->setEnabled(state&&bypass_mode); + time_type_label->setEnabled(state&&bypass_mode); + time_type_offset_label->setEnabled(state&&bypass_mode); + time_type_offset_spin->setEnabled(state&&bypass_mode); + time_type_length_label->setEnabled(state&&bypass_mode); + time_type_length_spin->setEnabled(state&&bypass_mode); +} + + void ImportFields::valueChangedData(int) { import_changed=true; diff --git a/rdadmin/importfields.h b/rdadmin/importfields.h index b6539fd7..1b0f657c 100644 --- a/rdadmin/importfields.h +++ b/rdadmin/importfields.h @@ -2,7 +2,7 @@ // // Import Parser Parameters for RDAdmin. // -// (C) Copyright 2010-2019 Fred Gleason +// (C) Copyright 2010-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 @@ -17,13 +17,12 @@ // License along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -// #ifndef IMPORTFIELDS_H #define IMPORTFIELDS_H -#include -#include +#include +#include #include #include @@ -32,17 +31,25 @@ class ImportFields : public RDWidget { Q_OBJECT public: - ImportFields(QWidget *parent=0); + ImportFields(RDSvc::ImportSource src,QWidget *parent=0); QSize sizeHint() const; QSizePolicy sizePolicy() const; bool changed() const; - void readFields(RDSvc *svc,RDSvc::ImportSource type); - void setFields(RDSvc *svc,RDSvc::ImportSource type); + void readFields(RDSvc *svc); + void setFields(RDSvc *svc); + bool bypassMode() const; + void setBypassMode(bool state); + + public slots: + void setBypassMode(int n); + void setEnabled(bool state); private slots: void valueChangedData(int); private: + RDSvc::ImportSource import_source; + bool bypass_mode; bool import_changed; QSpinBox *cart_offset_spin; QSpinBox *cart_length_spin; @@ -66,6 +73,16 @@ class ImportFields : public RDWidget QSpinBox *data_length_spin; QSpinBox *event_id_offset_spin; QSpinBox *event_id_length_spin; + QLabel *trans_type_label; + QLabel *trans_type_offset_label; + QSpinBox *trans_type_offset_spin; + QLabel *trans_type_length_label; + QSpinBox *trans_type_length_spin; + QLabel *time_type_label; + QLabel *time_type_offset_label; + QSpinBox *time_type_offset_spin; + QLabel *time_type_length_label; + QSpinBox *time_type_length_spin; }; diff --git a/rdadmin/test_import.cpp b/rdadmin/test_import.cpp index 01820371..9731d675 100644 --- a/rdadmin/test_import.cpp +++ b/rdadmin/test_import.cpp @@ -164,8 +164,8 @@ void TestImport::importData() QString sql=QString("delete from `IMPORTER_LINES` where ")+ "`STATION_NAME`='"+RDEscapeString(rda->station()->name())+"' && "+ QString::asprintf("`PROCESS_ID`=%u",getpid()); - // printf("IMPORTER_LINES cleanup SQL: %s\n",(const char *)sql); - RDSqlQuery::apply(sql); + printf("IMPORTER_LINES cleanup SQL: %s\n",sql.toUtf8().constData()); + // RDSqlQuery::apply(sql); } diff --git a/utils/rddbmgr/revertschema.cpp b/utils/rddbmgr/revertschema.cpp index b952d90d..a876852c 100644 --- a/utils/rddbmgr/revertschema.cpp +++ b/utils/rddbmgr/revertschema.cpp @@ -41,6 +41,28 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg) // NEW SCHEMA REVERSIONS GO HERE... + // + // Revert 363 + // + if((cur_schema==363)&&(set_schemacur_schema)) { + sql=QString("alter table `SERVICES` ")+ + "add column `BYPASS_MODE` enum('N','Y') not null default 'N' "+ + "after `DESCRIPTION`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `SERVICES` ")+ + "add column `MUS_TRANS_TYPE_OFFSET` int after `MUS_ANNC_TYPE_LENGTH`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `SERVICES` ")+ + "add column `MUS_TRANS_TYPE_LENGTH` int after `MUS_TRANS_TYPE_OFFSET`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `SERVICES` ")+ + "add column `MUS_TIME_TYPE_OFFSET` int after `MUS_TRANS_TYPE_LENGTH`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `SERVICES` ")+ + "add column `MUS_TIME_TYPE_LENGTH` int after `MUS_TIME_TYPE_OFFSET`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + + sql=QString("alter table `IMPORT_TEMPLATES` ")+ + "add column `TRANS_TYPE_OFFSET` int after `ANNC_TYPE_LENGTH`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `IMPORT_TEMPLATES` ")+ + "add column `TRANS_TYPE_LENGTH` int after `TRANS_TYPE_OFFSET`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `IMPORT_TEMPLATES` ")+ + "add column `TIME_TYPE_OFFSET` int after `TRANS_TYPE_LENGTH`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `IMPORT_TEMPLATES` ")+ + "add column `TIME_TYPE_LENGTH` int after `TIME_TYPE_OFFSET`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + + sql=QString("alter table `IMPORTER_LINES` ")+ + "add column `TRANS_TYPE` int not null default 255 after `LENGTH`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `IMPORTER_LINES` ")+ + "add column `TIME_TYPE` int not null default 0 after `TRANS_TYPE`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + sql=QString("alter table `IMPORTER_LINES` ")+ + "add column `GRACE_TIME` int not null default 0 after `TIME_TYPE`"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + + WriteSchemaVersion(++cur_schema); + } + + // NEW SCHEMA UPDATES GO HERE...