2018-11-30 Fred Gleason <fredg@paravelsystems.com>

* 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.
This commit is contained in:
Fred Gleason 2018-11-30 07:52:56 -05:00
parent dbc7d4e327
commit 6eab09f51c
20 changed files with 232 additions and 88 deletions

View File

@ -18073,3 +18073,11 @@
2018-11-29 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in the 'RDTextFile()' function that caused zombification
of client programs.
2018-11-30 Fred Gleason <fredg@paravelsystems.com>
* 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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

@ -669,12 +669,24 @@
(<userinput>127.0.0.1</userinput>) here.
</para>
<para>
The <computeroutput>Editor Command:</computeroutput> can be used to
The <computeroutput>Audio Editor:</computeroutput> 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 <userinput>%f</userinput> wildcard to indicate the
name of the file to open.
</para>
<para>
The <computeroutput>Report Editor:</computeroutput> 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.
</para>
<note>
If left blank, the system will use the
<command>vi</command><manvolnum>1</manvolnum> editor running in an
<command>xterm</command><manvolnum>1</manvolnum> window
--i.e. <code>xterm -e vi</code>.
</note>
<para>
The <computeroutput>Time Offset:</computeroutput> field can be used
to specify a static time offset in milliseconds to by applied to

View File

@ -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

View File

@ -24,7 +24,7 @@
/*
* Current Database Version
*/
#define RD_VERSION_DATABASE 301
#define RD_VERSION_DATABASE 302
#endif // DBVERSION_H

View File

@ -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,

View File

@ -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;

View File

@ -2,7 +2,7 @@
//
// Spawn an external text file viewer.
//
// (C) Copyright 2002-2006,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2018 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
@ -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;i<f0.size();i++) {
args[i]=(char *)malloc(f0.at(i).toUtf8().size()+1);
strcpy(args[i],f0.at(i).toUtf8());
}
strcpy(tmpfile,RDTempDirectory::basePath()+"/rdreportXXXXXX");
int fd=mkstemp(tmpfile);
@ -55,10 +69,15 @@ bool RDTextFile(const QString &data,bool delete_on_exit)
rda->addTempFile(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;
}

View File

@ -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->

View File

@ -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;

View File

@ -3598,7 +3598,7 @@ Přepsat?</translation>
</message>
<message>
<source>Editor &amp;Command:</source>
<translation>&amp;Příkaz pro editor:</translation>
<translation type="obsolete">&amp;Příkaz pro editor:</translation>
</message>
<message>
<source> mS</source>
@ -3812,6 +3812,14 @@ nastaveném pro běh služby CAE pro naplnění databáze se zdroji zvuku.</tran
Ports</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report Editor</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditSvc</name>

View File

@ -3486,7 +3486,7 @@ Overwrite?</source>
</message>
<message>
<source>Editor &amp;Command:</source>
<translation>Editor-&amp;Kommando:</translation>
<translation type="obsolete">Editor-&amp;Kommando:</translation>
</message>
<message>
<source> mS</source>
@ -3697,6 +3697,14 @@ configured to run the CAE service in order to populate the audio resources datab
Ports</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report Editor</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditSvc</name>

View File

@ -3723,7 +3723,7 @@ del Equipo</translation>
</message>
<message>
<source>Editor &amp;Command:</source>
<translation>&amp;Comando editor:</translation>
<translation type="obsolete">&amp;Comando editor:</translation>
</message>
<message>
<source>Use Realtime Filtering</source>
@ -3821,6 +3821,14 @@ configured to run the CAE service in order to populate the audio resources datab
Ports</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report Editor</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditSvc</name>

View File

@ -3049,10 +3049,6 @@ Overwrite?</source>
<source>&amp;IP Address:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Editor &amp;Command:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> mS</source>
<translation type="unfinished"></translation>
@ -3230,6 +3226,14 @@ configured to run the CAE service in order to populate the audio resources datab
Ports</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report Editor</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditSvc</name>

View File

@ -3472,7 +3472,7 @@ Overwrite?</source>
</message>
<message>
<source>Editor &amp;Command:</source>
<translation>Redigerings&amp;kommando:</translation>
<translation type="obsolete">Redigerings&amp;kommando:</translation>
</message>
<message>
<source> mS</source>
@ -3662,6 +3662,14 @@ configured to run the CAE service in order to populate the audio resources datab
Ports</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report Editor</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditSvc</name>

View File

@ -3472,7 +3472,7 @@ Overwrite?</source>
</message>
<message>
<source>Editor &amp;Command:</source>
<translation>Redigerings&amp;kommando:</translation>
<translation type="obsolete">Redigerings&amp;kommando:</translation>
</message>
<message>
<source> mS</source>
@ -3662,6 +3662,14 @@ configured to run the CAE service in order to populate the audio resources datab
Ports</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report Editor</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditSvc</name>

View File

@ -3485,7 +3485,7 @@ Overwrite?</source>
</message>
<message>
<source>Editor &amp;Command:</source>
<translation>&amp;Editor :</translation>
<translation type="obsolete">&amp;Editor :</translation>
</message>
<message>
<source> mS</source>
@ -3685,6 +3685,14 @@ configured to run the CAE service in order to populate the audio resources datab
Ports</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report Editor</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditSvc</name>

View File

@ -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_schema<cur_schema)) {
DropColumn("STATIONS","REPORT_EDITOR_PATH");
WriteSchemaVersion(--cur_schema);
}
//
// Revert 301
//

View File

@ -140,7 +140,7 @@ void MainObject::InitializeSchemaMap() {
global_version_map["2.17"]=268;
global_version_map["2.18"]=272;
global_version_map["2.19"]=275;
global_version_map["3.0"]=301;
global_version_map["3.0"]=302;
}

View File

@ -9614,6 +9614,16 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
WriteSchemaVersion(++cur_schema);
}
if((cur_schema<302)&&(set_schema>cur_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...