diff --git a/ChangeLog b/ChangeLog index 3d8156c8..b8538d5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18073,3 +18073,11 @@ 2018-11-29 Fred Gleason * Fixed a bug in the 'RDTextFile()' function that caused zombification of client programs. +2018-11-30 Fred Gleason + * Added a 'STATIONS.REPORT_EDITOR_PATH' field to the database. + * Incremented the database version to 302. + * Added a 'Report Editor' control to the 'Edit Host' dialog in + rdadmin(1). + * Modified the report generator to use the editor specified in the + 'Report Editor' control rather than than the value of the $VISUAL + environmental variable. diff --git a/docs/opsguide/rdadmin.host_dialog.png b/docs/opsguide/rdadmin.host_dialog.png index 184f7a6b..f39d01ed 100644 Binary files a/docs/opsguide/rdadmin.host_dialog.png and b/docs/opsguide/rdadmin.host_dialog.png differ diff --git a/docs/opsguide/rdadmin.xml b/docs/opsguide/rdadmin.xml index d503fd1f..125004af 100644 --- a/docs/opsguide/rdadmin.xml +++ b/docs/opsguide/rdadmin.xml @@ -669,12 +669,24 @@ (127.0.0.1) here. - The Editor Command: can be used to + The Audio Editor: can be used to specify an external audio editor for use by rdlibrary(1). If desired, the value should consist of the command invocation needed to start the edit, with a %f wildcard to indicate the name of the file to open. + + The Report Editor: can be used to + specify an external text editor to be used to display reports. + If desired, the value should consist of the command invocation + needed to start the editor. + + + If left blank, the system will use the + vi1 editor running in an + xterm1 window + --i.e. xterm -e vi. + The Time Offset: field can be used to specify a static time offset in milliseconds to by applied to diff --git a/docs/tables/stations.txt b/docs/tables/stations.txt index 6327fdc4..80bb8426 100644 --- a/docs/tables/stations.txt +++ b/docs/tables/stations.txt @@ -7,8 +7,8 @@ FIELD NAME TYPE REMARKS NAME varchar(64) Primary Key SHORT_NAME varchar(64) DESCRIPTION varchar(64) Indexed -USER_NAME varchar(255) Current User -DEFAULT_NAME varchar(255) Default User +USER_NAME varchar(191) Current User +DEFAULT_NAME varchar(191) Default User IPV4_ADDRESS varchar(15) HTTP_STATION varchar(64) From STATIONS.NAME CAE_STATION varchar(64) From STATIONS.NAME @@ -17,11 +17,12 @@ BROADCAST_SECURITY int(10) unsigned 0=HostSec, 1=UserSec HEARTBEAT_CART int(10) unsigned HEARTBEAT_INTERVAL int(10) unsigned STARTUP_CART int(10) unsigned -EDITOR_PATH varchar(255) +EDITOR_PATH varchar(191) +REPORT_EDITOR_PATH varchar(191) FILTER_MODE int(11) 0=Synchronous, 1=Asynchronous START_JACK enum('Y','N') JACK_SERVER_NAME varchar(64) -JACK_COMMAND_LINE varchar(255) +JACK_COMMAND_LINE varchar(191) JACK_PORTS int(11) signed CUE_CARD int(11) signed CUE_PORT int(11) signed diff --git a/lib/dbversion.h b/lib/dbversion.h index 0bd4413e..172e654c 100644 --- a/lib/dbversion.h +++ b/lib/dbversion.h @@ -24,7 +24,7 @@ /* * Current Database Version */ -#define RD_VERSION_DATABASE 301 +#define RD_VERSION_DATABASE 302 #endif // DBVERSION_H diff --git a/lib/rdstation.cpp b/lib/rdstation.cpp index 1bf64796..02087e20 100644 --- a/lib/rdstation.cpp +++ b/lib/rdstation.cpp @@ -257,6 +257,19 @@ void RDStation::setEditorPath(const QString &cmd) } +QString RDStation::reportEditorPath() const +{ + return RDGetSqlValue("STATIONS","NAME",station_name,"REPORT_EDITOR_PATH"). + toString(); +} + + +void RDStation::setReportEditorPath(const QString &cmd) +{ + SetRow("REPORT_EDITOR_PATH",cmd); +} + + RDStation::FilterMode RDStation::filterMode() const { return (RDStation::FilterMode)RDGetSqlValue("STATIONS","NAME",station_name, diff --git a/lib/rdstation.h b/lib/rdstation.h index 6154931d..7258a571 100644 --- a/lib/rdstation.h +++ b/lib/rdstation.h @@ -64,6 +64,8 @@ class RDStation void setStartupCart(unsigned cartnum) const; QString editorPath() const; void setEditorPath(const QString &cmd); + QString reportEditorPath() const; + void setReportEditorPath(const QString &cmd); RDStation::FilterMode filterMode() const; void setFilterMode(RDStation::FilterMode mode) const; bool startJack() const; diff --git a/lib/rdtextfile.cpp b/lib/rdtextfile.cpp index aebb273e..26c2b08c 100644 --- a/lib/rdtextfile.cpp +++ b/lib/rdtextfile.cpp @@ -2,7 +2,7 @@ // // Spawn an external text file viewer. // -// (C) Copyright 2002-2006,2016-2017 Fred Gleason +// (C) Copyright 2002-2018 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 @@ -35,13 +35,27 @@ bool RDTextFile(const QString &data,bool delete_on_exit) { char tmpfile[256]; - char editor[256]; + QString editor=RD_LINUX_EDITOR; + char cmd[PATH_MAX]; + char *args[64]; - if(getenv("VISUAL")==NULL) { - strncpy(editor,RD_LINUX_EDITOR,256); + if(!rda->station()->reportEditorPath().trimmed().isEmpty()) { + editor=rda->station()->reportEditorPath(); } - else { - strncpy(editor,getenv("VISUAL"),256); + memset(args,0,sizeof(args)); + QStringList f0=editor.split(" ",QString::SkipEmptyParts); + if(f0.size()>64) { + QMessageBox::warning(NULL,"File Error", + "Too many arguments to report editor!"); + return false; + } + strncpy(cmd,f0.at(0).toUtf8(),PATH_MAX); + QStringList f1=f0.at(0).split("/"); + args[0]=(char *)malloc(f1.back().toUtf8().size()+1); + strcpy(args[0],f1.back().toUtf8()); + for(int i=1;iaddTempFile(tmpfile); } - char *args[]={editor,tmpfile,(char *)NULL}; + args[f0.size()]=(char *)malloc(strlen(tmpfile)+1); + strcpy(args[f0.size()],tmpfile); + + args[f0.size()+1]=(char *)NULL; + if(fork()==0) { - execvp(editor,args); - exit(1); + execvp(cmd,args); + _exit(1); } + return true; } diff --git a/rdadmin/edit_station.cpp b/rdadmin/edit_station.cpp index 2e743ed8..8e39054c 100644 --- a/rdadmin/edit_station.cpp +++ b/rdadmin/edit_station.cpp @@ -46,6 +46,7 @@ #include "edit_jack.h" #include "list_matrices.h" #include "edit_rdairplay.h" + #include "edit_rdlibrary.h" #include "edit_rdlogedit.h" #include "edit_rdpanel.h" @@ -145,14 +146,24 @@ EditStation::EditStation(QString sname,QWidget *parent) station_address_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // - // Station Editor Command + // Audio Editor Command // - station_editor_cmd_edit=new QLineEdit(this); - station_editor_cmd_edit->setMaxLength(255); - station_editor_cmd_label= - new QLabel(station_editor_cmd_edit,tr("Editor &Command:"),this); - station_editor_cmd_label->setFont(font); - station_editor_cmd_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + station_audio_editor_edit=new QLineEdit(this); + station_audio_editor_edit->setMaxLength(191); + station_audio_editor_label= + new QLabel(station_audio_editor_edit,tr("Audio Editor")+":",this); + station_audio_editor_label->setFont(font); + station_audio_editor_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + + // + // Report Editor Command + // + station_report_editor_edit=new QLineEdit(this); + station_report_editor_edit->setMaxLength(191); + station_report_editor_label= + new QLabel(station_report_editor_edit,tr("Report Editor")+":",this); + station_report_editor_label->setFont(font); + station_report_editor_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Station Time Offset @@ -455,7 +466,8 @@ EditStation::EditStation(QString sname,QWidget *parent) station_short_name_edit->setText(station_station->shortName()); station_description_edit->setText(station_station->description()); station_address_edit->setText(station_station->address().toString()); - station_editor_cmd_edit->setText(station_station->editorPath()); + station_audio_editor_edit->setText(station_station->editorPath()); + station_report_editor_edit->setText(station_station->reportEditorPath()); station_timeoffset_box->setValue(station_station->timeOffset()); unsigned cartnum=station_station->startupCart(); if(cartnum>0) { @@ -568,8 +580,7 @@ EditStation::~EditStation() QSize EditStation::sizeHint() const { - return QSize(395,723); - return QSize(375,723); + return QSize(395,744); } @@ -688,7 +699,9 @@ void EditStation::okData() station_station->setDefaultName(station_default_name_edit->currentText()); station_station->setAddress(addr); station_station-> - setEditorPath(station_editor_cmd_edit->text()); + setEditorPath(station_audio_editor_edit->text()); + station_station-> + setReportEditorPath(station_report_editor_edit->text()); station_station->setTimeOffset(station_timeoffset_box->value()); cartnum=station_startup_cart_edit->text().toUInt(&ok); if(ok&&(cartnum<=999999)) { @@ -884,83 +897,86 @@ void EditStation::resizeEvent(QResizeEvent *e) station_address_edit->setGeometry(115,95,120,19); station_address_label->setGeometry(10,95,100,19); - station_editor_cmd_edit->setGeometry(115,116,size().width()-130,19); - station_editor_cmd_label->setGeometry(10,116,100,19); + station_audio_editor_edit->setGeometry(115,116,size().width()-130,19); + station_audio_editor_label->setGeometry(10,116,100,19); - station_timeoffset_box->setGeometry(115,137,80,19); - station_timeoffset_label->setGeometry(10,137,100,19); + station_report_editor_edit->setGeometry(115,137,size().width()-130,19); + station_report_editor_label->setGeometry(10,137,100,19); - station_startup_cart_edit->setGeometry(115,158,60,19); - station_startup_cart_label->setGeometry(10,158,100,19); - station_startup_select_button->setGeometry(180,157,50,22); + station_timeoffset_box->setGeometry(115,158,80,19); + station_timeoffset_label->setGeometry(10,158,100,19); - station_cue_sel->setGeometry(90,179,110,117); - station_cue_sel_label->setGeometry(10,179,100,19); + station_startup_cart_edit->setGeometry(115,179,60,19); + station_startup_cart_label->setGeometry(10,179,100,19); + station_startup_select_button->setGeometry(180,179,50,22); - station_start_cart_edit->setGeometry(270,179,60,20); - station_start_cart_label->setGeometry(205,179,60,20); - station_start_cart_button->setGeometry(335,178,50,22); + station_cue_sel->setGeometry(90,200,110,117); + station_cue_sel_label->setGeometry(10,200,100,19); - station_stop_cart_edit->setGeometry(270,201,60,20); - station_stop_cart_label->setGeometry(205,201,60,20); - station_stop_cart_button->setGeometry(335,200,50,22); + station_start_cart_edit->setGeometry(270,200,60,20); + station_start_cart_label->setGeometry(205,200,60,20); + station_start_cart_button->setGeometry(335,199,50,22); - station_heartbeat_box->setGeometry(10,226,15,15); - station_heartbeat_label->setGeometry(30,224,150,20); + station_stop_cart_edit->setGeometry(270,222,60,20); + station_stop_cart_label->setGeometry(205,222,60,20); + station_stop_cart_button->setGeometry(335,221,50,22); - station_filter_box->setGeometry(210,226,15,15); - station_filter_label->setGeometry(230,226,150,20); + station_heartbeat_box->setGeometry(10,247,15,15); + station_heartbeat_label->setGeometry(30,245,150,20); - station_hbcart_edit->setGeometry(65,248,60,19); - station_hbcart_label->setGeometry(10,248,50,19); - station_hbcart_button->setGeometry(140,245,60,26); + station_filter_box->setGeometry(210,247,15,15); + station_filter_label->setGeometry(230,247,150,20); - station_hbinterval_spin->setGeometry(275,248,45,19); - station_hbinterval_label->setGeometry(220,248,50,19); - station_hbinterval_unit->setGeometry(325,248,100,19); + station_hbcart_edit->setGeometry(65,269,60,19); + station_hbcart_label->setGeometry(10,269,50,19); + station_hbcart_button->setGeometry(140,266,60,26); - station_maint_box->setGeometry(10,275,15,15); - station_maint_label->setGeometry(30,273,size().width()-40,20); + station_hbinterval_spin->setGeometry(275,269,45,19); + station_hbinterval_label->setGeometry(220,269,50,19); + station_hbinterval_unit->setGeometry(325,269,100,19); - station_dragdrop_box->setGeometry(10,296,15,15); - station_dragdrop_label->setGeometry(30,293,size().width()-40,20); + station_maint_box->setGeometry(10,296,15,15); + station_maint_label->setGeometry(30,294,size().width()-40,20); - station_panel_enforce_box->setGeometry(25,314,15,15); - station_panel_enforce_label->setGeometry(45,312,size().width()-55,20); + station_dragdrop_box->setGeometry(10,317,15,15); + station_dragdrop_label->setGeometry(30,314,size().width()-40,20); - station_systemservices_groupbox->setGeometry(10,339,size().width()-20,60); + station_panel_enforce_box->setGeometry(25,335,15,15); + station_panel_enforce_label->setGeometry(45,333,size().width()-55,20); - station_http_station_box->setGeometry(145,354,size().width()-165,19); - station_http_station_label->setGeometry(11,354,130,19); + station_systemservices_groupbox->setGeometry(10,360,size().width()-20,60); - station_cae_station_box->setGeometry(145,375,size().width()-165,19); - station_cae_station_label->setGeometry(11,375,130,19); + station_http_station_box->setGeometry(145,375,size().width()-165,19); + station_http_station_label->setGeometry(11,375,130,19); - station_rdlibrary_button->setGeometry(20,413,80,50); + station_cae_station_box->setGeometry(145,396,size().width()-165,19); + station_cae_station_label->setGeometry(11,396,130,19); - station_rdcatch_button->setGeometry(110,413,80,50); + station_rdlibrary_button->setGeometry(20,434,80,50); - station_rdairplay_button->setGeometry(200,413,80,50); + station_rdcatch_button->setGeometry(110,434,80,50); - station_rdpanel_button->setGeometry(290,413,80,50); + station_rdairplay_button->setGeometry(200,434,80,50); - station_rdlogedit_button->setGeometry(20,473,80,50); + station_rdpanel_button->setGeometry(290,434,80,50); - station_rdcartslots_button->setGeometry(110,473,80,50); + station_rdlogedit_button->setGeometry(20,494,80,50); - station_dropboxes_button->setGeometry(200,473,80,50); + station_rdcartslots_button->setGeometry(110,494,80,50); - station_switchers_button->setGeometry(290,473,80,50); + station_dropboxes_button->setGeometry(200,494,80,50); - station_hostvars_button->setGeometry(20,533,80,50); + station_switchers_button->setGeometry(290,494,80,50); - station_audioports_button->setGeometry(110,533,80,50); + station_hostvars_button->setGeometry(20,554,80,50); - station_ttys_button->setGeometry(200,533,80,50); + station_audioports_button->setGeometry(110,554,80,50); - station_adapters_button->setGeometry(290,533,80,50); + station_ttys_button->setGeometry(200,554,80,50); - station_jack_button->setGeometry(155,593,80,50); + station_adapters_button->setGeometry(290,554,80,50); + + station_jack_button->setGeometry(155,614,80,50); station_ok_button->setGeometry(size().width()-180,size().height()-60,80,50); station_cancel_button-> diff --git a/rdadmin/edit_station.h b/rdadmin/edit_station.h index caa88d4c..546a3dea 100644 --- a/rdadmin/edit_station.h +++ b/rdadmin/edit_station.h @@ -90,8 +90,10 @@ class EditStation : public QDialog QComboBox *station_default_name_edit; QLabel *station_address_label; QLineEdit *station_address_edit; - QLabel *station_editor_cmd_label; - QLineEdit *station_editor_cmd_edit; + QLabel *station_audio_editor_label; + QLineEdit *station_audio_editor_edit; + QLabel *station_report_editor_label; + QLineEdit *station_report_editor_edit; QLabel *station_timeoffset_label; QSpinBox *station_timeoffset_box; QLabel *station_startup_cart_label; diff --git a/rdadmin/rdadmin_cs.ts b/rdadmin/rdadmin_cs.ts index 6514ad75..f3c0d177 100644 --- a/rdadmin/rdadmin_cs.ts +++ b/rdadmin/rdadmin_cs.ts @@ -3598,7 +3598,7 @@ Přepsat? Editor &Command: - &Příkaz pro editor: + &Příkaz pro editor: mS @@ -3812,6 +3812,14 @@ nastaveném pro běh služby CAE pro naplnění databáze se zdroji zvuku. + + Audio Editor + + + + Report Editor + + EditSvc diff --git a/rdadmin/rdadmin_de.ts b/rdadmin/rdadmin_de.ts index 62d256e8..9d63d308 100644 --- a/rdadmin/rdadmin_de.ts +++ b/rdadmin/rdadmin_de.ts @@ -3486,7 +3486,7 @@ Overwrite? Editor &Command: - Editor-&Kommando: + Editor-&Kommando: mS @@ -3697,6 +3697,14 @@ configured to run the CAE service in order to populate the audio resources datab Ports + + Audio Editor + + + + Report Editor + + EditSvc diff --git a/rdadmin/rdadmin_es.ts b/rdadmin/rdadmin_es.ts index b019fdcf..151df141 100644 --- a/rdadmin/rdadmin_es.ts +++ b/rdadmin/rdadmin_es.ts @@ -3723,7 +3723,7 @@ del Equipo Editor &Command: - &Comando editor: + &Comando editor: Use Realtime Filtering @@ -3821,6 +3821,14 @@ configured to run the CAE service in order to populate the audio resources datab Ports + + Audio Editor + + + + Report Editor + + EditSvc diff --git a/rdadmin/rdadmin_fr.ts b/rdadmin/rdadmin_fr.ts index 9770e30b..4b021dbe 100644 --- a/rdadmin/rdadmin_fr.ts +++ b/rdadmin/rdadmin_fr.ts @@ -3049,10 +3049,6 @@ Overwrite? &IP Address: - - Editor &Command: - - mS @@ -3230,6 +3226,14 @@ configured to run the CAE service in order to populate the audio resources datab Ports + + Audio Editor + + + + Report Editor + + EditSvc diff --git a/rdadmin/rdadmin_nb.ts b/rdadmin/rdadmin_nb.ts index 92298f12..bc0dd723 100644 --- a/rdadmin/rdadmin_nb.ts +++ b/rdadmin/rdadmin_nb.ts @@ -3472,7 +3472,7 @@ Overwrite? Editor &Command: - Redigerings&kommando: + Redigerings&kommando: mS @@ -3662,6 +3662,14 @@ configured to run the CAE service in order to populate the audio resources datab Ports + + Audio Editor + + + + Report Editor + + EditSvc diff --git a/rdadmin/rdadmin_nn.ts b/rdadmin/rdadmin_nn.ts index 92298f12..bc0dd723 100644 --- a/rdadmin/rdadmin_nn.ts +++ b/rdadmin/rdadmin_nn.ts @@ -3472,7 +3472,7 @@ Overwrite? Editor &Command: - Redigerings&kommando: + Redigerings&kommando: mS @@ -3662,6 +3662,14 @@ configured to run the CAE service in order to populate the audio resources datab Ports + + Audio Editor + + + + Report Editor + + EditSvc diff --git a/rdadmin/rdadmin_pt_BR.ts b/rdadmin/rdadmin_pt_BR.ts index b8337be3..98505192 100644 --- a/rdadmin/rdadmin_pt_BR.ts +++ b/rdadmin/rdadmin_pt_BR.ts @@ -3485,7 +3485,7 @@ Overwrite? Editor &Command: - &Editor : + &Editor : mS @@ -3685,6 +3685,14 @@ configured to run the CAE service in order to populate the audio resources datab Ports + + Audio Editor + + + + Report Editor + + EditSvc diff --git a/utils/rddbmgr/revertschema.cpp b/utils/rddbmgr/revertschema.cpp index 2ef4cfea..6b9eedc6 100644 --- a/utils/rddbmgr/revertschema.cpp +++ b/utils/rddbmgr/revertschema.cpp @@ -40,6 +40,15 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg) // NEW SCHEMA REVERSIONS GO HERE... + // + // Revert 302 + // + if((cur_schema==302)&&(set_schemacur_schema)) { + sql=QString("alter table STATIONS add column ")+ + "REPORT_EDITOR_PATH varchar(191) after EDITOR_PATH"; + if(!RDSqlQuery::apply(sql,err_msg)) { + return false; + } + + WriteSchemaVersion(++cur_schema); + } + // NEW SCHEMA UPDATES GO HERE...