2018-02-01 Fred Gleason <fredg@paravelsystems.com>

* Moved command-switch processing into RDApplication.
This commit is contained in:
Fred Gleason 2018-01-31 13:25:48 -05:00
parent 2103fa72c1
commit 3d380c4de8
73 changed files with 520 additions and 240 deletions

View File

@ -16617,3 +16617,5 @@
* Converted rdpanel(1) to use RDApplication.
2018-01-31 Fred Gleason <fredg@paravelsystems.com>
* Converted rdrepld(8) to use RDApplication.
2018-02-01 Fred Gleason <fredg@paravelsystems.com>
* Moved command-switch processing into RDApplication.

View File

@ -29,14 +29,18 @@
RDApplication *rda=NULL;
RDApplication::RDApplication(const QString &module_name,QObject *parent)
RDApplication::RDApplication(const QString &module_name,const QString &cmdname,
const QString &usage,QObject *parent)
: QObject(parent)
{
app_module_name=module_name;
app_command_name=cmdname;
app_usage=usage;
app_heartbeat=NULL;
app_airplay_conf=NULL;
app_cae=NULL;
app_cmd_switch=NULL;
app_config=NULL;
app_library_conf=NULL;
app_logedit_conf=NULL;
@ -80,6 +84,9 @@ RDApplication::~RDApplication()
if(app_cae!=NULL) {
delete app_cae;
}
if(app_cmd_switch!=NULL) {
delete app_cmd_switch;
}
if(app_ripc!=NULL) {
delete app_ripc;
}
@ -95,14 +102,14 @@ bool RDApplication::open(QString *err_msg)
//
// Read command switches
//
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"","");
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
app_cmd_switch=new RDCmdSwitch(qApp->argc(),qApp->argv(),app_command_name,
app_usage);
for(unsigned i=0;i<app_cmd_switch->keys();i++) {
if(app_cmd_switch->key(i)=="--skip-db-check") {
skip_db_check=true;
cmd->setProcessed(i,true);
app_cmd_switch->setProcessed(i,true);
}
}
delete cmd;
//
// Open rd.conf(5)
@ -157,6 +164,12 @@ RDCae *RDApplication::cae()
}
RDCmdSwitch *RDApplication::cmdSwitch()
{
return app_cmd_switch;
}
RDConfig *RDApplication::config()
{
return app_config;

View File

@ -25,6 +25,7 @@
#include <rdairplay_conf.h>
#include <rdcae.h>
#include <rdcmd_switch.h>
#include <rdconfig.h>
#include <rddb.h>
#include <rddbheartbeat.h>
@ -39,11 +40,13 @@ class RDApplication : public QObject
{
Q_OBJECT;
public:
RDApplication(const QString &module_name,QObject *parent=0);
RDApplication(const QString &module_name,const QString &cmdname,
const QString &usage,QObject *parent=0);
~RDApplication();
bool open(QString *err_msg);
RDAirPlayConf *airplayConf();
RDCae *cae();
RDCmdSwitch *cmdSwitch();
RDConfig *config();
RDLibraryConf *libraryConf();
RDLogeditConf *logeditConf();
@ -57,6 +60,7 @@ class RDApplication : public QObject
RDAirPlayConf *app_airplay_conf;
RDAirPlayConf *app_panel_conf;
RDCae *app_cae;
RDCmdSwitch *app_cmd_switch;
RDConfig *app_config;
RDLibraryConf *app_library_conf;
RDLogeditConf *app_logedit_conf;
@ -65,8 +69,9 @@ class RDApplication : public QObject
RDSystem *app_system;
RDUser *app_user;
RDDbHeartbeat *app_heartbeat;
QString app_command_name;
QString app_module_name;
QString app_command_name;
QString app_usage;
};
extern RDApplication *rda;

View File

@ -132,28 +132,41 @@ MainWidget::MainWidget(QWidget *parent)
//
air_startup_datetime=QDateTime(QDate::currentDate(),QTime::currentTime());
//
// Ensure that system daemons are running
//
RDInitializeDaemons();
//
// Open the Database
//
rda=new RDApplication("RDAirPlay","rdairplay",RDAIRPLAY_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDAirPlay - "+tr("Error"),err_msg);
exit(1);
}
connect(RDDbStatus(),SIGNAL(logText(RDConfig::LogPriority,const QString &)),
this,SLOT(logLine(RDConfig::LogPriority,const QString &)));
//
// Read Command Options
//
QString lineno;
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdairplay",
RDAIRPLAY_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
}
}
for(unsigned i=0;i<RDAIRPLAY_LOG_QUANTITY;i++) {
air_start_line[i]=0;
air_start_start[i]=false;
for(unsigned j=0;j<cmd->keys();j++) {
if(cmd->key(j)==QString().sprintf("--log%u",i+1)) {
air_start_logname[i]=cmd->value(j);
for(unsigned k=0;k<cmd->value(j).length();k++) {
if(cmd->value(j).at(k)==QChar(':')) {
for(unsigned j=0;j<rda->cmdSwitch()->keys();j++) {
if(rda->cmdSwitch()->key(j)==QString().sprintf("--log%u",i+1)) {
air_start_logname[i]=rda->cmdSwitch()->value(j);
for(unsigned k=0;k<rda->cmdSwitch()->value(j).length();k++) {
if(rda->cmdSwitch()->value(j).at(k)==QChar(':')) {
air_start_logname[i]=
RDDateTimeDecode(cmd->value(j).left(k),air_startup_datetime,
RDDateTimeDecode(rda->cmdSwitch()->value(j).left(k),
air_startup_datetime,
rda->station(),rda->config());
lineno=cmd->value(j).right(cmd->value(j).length()-(k+1));
lineno=rda->cmdSwitch()->value(j).right(rda->cmdSwitch()->value(j).
length()-(k+1));
if(lineno.right(1)=="+") {
air_start_start[i]=true;
lineno=lineno.left(lineno.length()-1);
@ -161,10 +174,18 @@ MainWidget::MainWidget(QWidget *parent)
air_start_line[i]=lineno.toInt();
}
}
rda->cmdSwitch()->setProcessed(j,true);
}
}
}
delete cmd;
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDAirPlay - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}
//
// Fix the Window Size
@ -203,28 +224,13 @@ MainWidget::MainWidget(QWidget *parent)
air_start_next=false;
air_next_button=0;
//
// Ensure that system daemons are running
//
RDInitializeDaemons();
air_action_mode=StartButton::Play;
rda=new RDApplication("RDAirPlay",this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDAirPlay - "+tr("Error"),err_msg);
exit(1);
}
logfile=rda->config()->airplayLogname();
str=QString("RDAirPlay")+" v"+VERSION+" - "+tr("Host:");
setCaption(str+" "+rda->config()->stationName());
connect (RDDbStatus(),SIGNAL(logText(RDConfig::LogPriority,const QString &)),
this,SLOT(logLine(RDConfig::LogPriority,const QString &)));
//
// Master Clock Timer
//

View File

@ -640,6 +640,10 @@ OBNOVEN</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ModeDisplay</name>

View File

@ -640,6 +640,10 @@ AKTUALISIERT</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ModeDisplay</name>

View File

@ -640,6 +640,10 @@ LISTA</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ModeDisplay</name>

View File

@ -640,6 +640,10 @@ DU LOG</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ModeDisplay</name>

View File

@ -650,6 +650,10 @@ LASTAR PÅ NYTT</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ModeDisplay</name>

View File

@ -650,6 +650,10 @@ LASTAR PÅ NYTT</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ModeDisplay</name>

View File

@ -646,6 +646,10 @@ LISTA</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ModeDisplay</name>

View File

@ -36,7 +36,6 @@
#include <rd.h>
#include <rdapplication.h>
#include <rdcheck_daemons.h>
#include <rdcmd_switch.h>
#include <rddbheartbeat.h>
#include "rdcartslots.h"
@ -58,19 +57,24 @@ MainWidget::MainWidget(QWidget *parent)
mfont.setPixelSize(12);
qApp->setFont(mfont);
rda=new RDApplication("RDCartSlots",this);
//
// Open the Database
//
rda=new RDApplication("RDCartSlots","rdcartslots",RDCARTSLOTS_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDCartSlots - "+tr("Error"),err_msg);
exit(1);
}
//
// Load the command-line arguments
// Read Command Options
//
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdcartslots",
RDCARTSLOTS_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDCartSlots - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}

View File

@ -21,5 +21,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -21,5 +21,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -21,5 +21,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -21,5 +21,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -21,5 +21,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -21,5 +21,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -38,7 +38,6 @@
#include <dbversion.h>
#include <rd.h>
#include <rdapplication.h>
#include <rdcmd_switch.h>
#include <rdconf.h>
#include <rddb.h>
#include <rdescape_string.h>
@ -69,16 +68,7 @@ MainWidget::MainWidget(QWidget *parent)
QString str2;
QString err_msg;
//
// Read Command Options
//
RDCmdSwitch *cmd=
new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdcastmanager","\n");
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
}
}
delete cmd;
cast_resize=false;
//
// Fix the Window Size
@ -86,12 +76,28 @@ MainWidget::MainWidget(QWidget *parent)
setMinimumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
rda=new RDApplication("RDCastManager",this);
//
// Open the Database/
//
rda=new RDApplication("RDCastManager","rdcastmanager",RDCASTMANAGER_USAGE,
this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDCastManager - "+tr("Error"),err_msg);
exit(1);
}
//
// Read Command Options
//
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDCastManager - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}
str1=QString("RDCastManager")+" v"+VERSION+" - "+tr("Host");
str2=QString(tr("User: [Unknown]"));
setCaption(str1+": "+rda->config()->stationName()+" "+str2);
@ -165,6 +171,8 @@ MainWidget::MainWidget(QWidget *parent)
cast_close_button->setFont(button_font);
cast_close_button->setText(tr("&Close"));
connect(cast_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget()));
cast_resize=true;
}
@ -220,9 +228,11 @@ void MainWidget::quitMainWidget()
void MainWidget::resizeEvent(QResizeEvent *e)
{
cast_feed_list->setGeometry(10,10,size().width()-20,size().height()-70);
cast_open_button->setGeometry(10,size().height()-55,80,50);
cast_close_button->setGeometry(size().width()-90,size().height()-55,80,50);
if(cast_resize) {
cast_feed_list->setGeometry(10,10,size().width()-20,size().height()-70);
cast_open_button->setGeometry(10,size().height()-55,80,50);
cast_close_button->setGeometry(size().width()-90,size().height()-55,80,50);
}
}

View File

@ -37,6 +37,8 @@
#include <rdlog_line.h>
#include <rdconfig.h>
#define RDCASTMANAGER_USAGE "\n"
class MainWidget : public QMainWindow
{
Q_OBJECT
@ -63,6 +65,7 @@ class MainWidget : public QMainWindow
QPixmap *cast_redx_map;
QPushButton *cast_open_button;
QPushButton *cast_close_button;
bool cast_resize;
};

View File

@ -339,6 +339,10 @@ přívod</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -328,6 +328,10 @@ Feed</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -278,6 +278,10 @@ Feed</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -265,6 +265,10 @@ Feed</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -327,6 +327,10 @@ straum</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -327,6 +327,10 @@ straum</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -293,6 +293,10 @@ Feed</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickReportDates</name>

View File

@ -42,7 +42,6 @@
#include <rdaudio_port.h>
#include <rdcatch.h>
#include <rdcheck_daemons.h>
#include <rdcmd_switch.h>
#include <rdconf.h>
#include <rdcut.h>
#include <rdcut_path.h>
@ -113,24 +112,42 @@ MainWidget::MainWidget(QWidget *parent)
{
QString str;
QString err_msg;
catch_resize=false;
catch_host_warnings=false;
catch_audition_stream=-1;
catch_scroll=false;
//
// Ensure the system daemons are running
//
RDInitializeDaemons();
//
// Open the Database
//
rda=new RDApplication("RDCatch","rdcatch",RDCATCH_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDCatch - "+tr("Error"),err_msg);
exit(1);
}
//
// Read Command Options
//
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdcatch",
RDCATCH_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--offline-host-warnings") {
catch_host_warnings=RDBool(cmd->value(i));
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(rda->cmdSwitch()->key(i)=="--offline-host-warnings") {
catch_host_warnings=RDBool(rda->cmdSwitch()->value(i));
rda->cmdSwitch()->setProcessed(i,true);
}
if(cmd->key(i)=="--skip-db-check") {
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDCatch - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}
delete cmd;
//
// Fix the Window Size
@ -183,22 +200,12 @@ MainWidget::MainWidget(QWidget *parent)
backgroundColor());
catch_scroll_color[1]=QPalette(backgroundColor(),backgroundColor());
//
// Ensure the system daemons are running
//
RDInitializeDaemons();
rda=new RDApplication("RDCatch",this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDCatch - "+tr("Error"),err_msg);
exit(1);
}
str=QString("RDCatch")+" v"+VERSION+" - "+tr("Host")+":";
setCaption(str+" "+rda->config()->stationName());
connect(RDDbStatus(),SIGNAL(logText(RDConfig::LogPriority,const QString &)),
this,SLOT(log(RDConfig::LogPriority,const QString &)));
//
// Allocate Global Resources
//
@ -322,11 +329,6 @@ order by CHANNEL",(const char *)q->value(0).toString().lower());
catch_monitor_view->hide();
}
//
// User
//
// catch_user=NULL;
//
// Filter Selectors
//
@ -577,6 +579,8 @@ order by CHANNEL",(const char *)q->value(0).toString().lower());
QTimer *timer=new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(resizeData()));
timer->start(1,true);
catch_resize=true;
}
void MainWidget::log(RDConfig::LogPriority prio,const QString &msg)
@ -1388,6 +1392,9 @@ void MainWidget::closeEvent(QCloseEvent *e)
void MainWidget::resizeEvent(QResizeEvent *e)
{
if(!catch_resize) {
return;
}
assert (e);
assert (catch_monitor_view);
if(catch_monitor.size()<=RDCATCH_MAX_VISIBLE_MONITORS) {

View File

@ -178,6 +178,7 @@ class MainWidget : public QWidget
int catch_time_offset;
QPixmap *catch_rivendell_map;
bool catch_host_warnings;
bool catch_resize;
};

View File

@ -1335,5 +1335,9 @@ nové</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1335,5 +1335,9 @@ Neu</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1279,5 +1279,9 @@ como Nuevo</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1265,5 +1265,9 @@ New</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1332,5 +1332,9 @@ ny</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1332,5 +1332,9 @@ ny</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -1335,5 +1335,9 @@ Novo</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -46,7 +46,6 @@
#include <rdaudio_port.h>
#include <rdcart_search_text.h>
#include <rdcheck_daemons.h>
#include <rdcmd_switch.cpp>
#include <rdconf.h>
#include <rdescape_string.h>
#include <rdmixer.h>
@ -89,32 +88,11 @@ MainWidget::MainWidget(QWidget *parent)
{
QString err_msg;
lib_resize=false;
profile_ripping=false;
lib_edit_pending=false;
lib_user_changed=false;
//
// Read Command Options
//
RDCmdSwitch *cmd=
new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlibrary",RDLIBRARY_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
cmd->setProcessed(i,true);
}
if(cmd->key(i)=="--profile-ripping") {
profile_ripping=true;
cmd->setProcessed(i,true);
}
if(!cmd->processed(i)) {
QMessageBox::warning(this,"RDLibrary - "+tr("Error"),
tr("Unknown command-line option")+
" \""+cmd->key(i)+"\".");
exit(256);
}
}
delete cmd;
//
// Fix the Window Size
//
@ -166,11 +144,31 @@ MainWidget::MainWidget(QWidget *parent)
//
RDInitializeDaemons();
rda=new RDApplication("RDLibrary",this);
//
// Open the Database
//
rda=new RDApplication("RDLibrary","rdlibrary",RDLIBRARY_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDLibrary - "+tr("Error"),err_msg);
exit(1);
}
//
// Read Command Options
//
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(rda->cmdSwitch()->key(i)=="--profile-ripping") {
profile_ripping=true;
rda->cmdSwitch()->setProcessed(i,true);
}
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDLibrary - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}
SetCaption("");
lib_import_path=RDGetHomeDir();
@ -466,6 +464,8 @@ MainWidget::MainWidget(QWidget *parent)
break;
}
lib_resize=true;
LoadGeometry();
}
@ -910,7 +910,8 @@ void MainWidget::closeEvent(QCloseEvent *e)
void MainWidget::resizeEvent(QResizeEvent *e)
{
switch(lib_filter_mode) {
if(lib_resize) {
switch(lib_filter_mode) {
case RDStation::FilterSynchronous:
lib_filter_edit->setGeometry(70,10,e->size().width()-170,20);
break;
@ -919,37 +920,38 @@ void MainWidget::resizeEvent(QResizeEvent *e)
lib_search_button->setGeometry(e->size().width()-180,10,80,50);
lib_filter_edit->setGeometry(70,10,e->size().width()-260,20);
break;
}
lib_clear_button->setGeometry(e->size().width()-90,10,80,50);
lib_filter_label->setGeometry(10,10,55,20);
lib_group_box->setGeometry(70,40,120,20);
lib_group_label->setGeometry(10,40,55,20);
lib_codes_box->setGeometry(330,40,120,20);
lib_codes_label->setGeometry(195,40,130,20);
lib_allowdrag_box->setGeometry(470,42,15,15);
lib_allowdrag_label->setGeometry(490,40,130,20);
lib_showaudio_box->setGeometry(70,67,15,15);
lib_showaudio_label->setGeometry(90,65,130,20);
lib_showmacro_box->setGeometry(230,67,15,15);
lib_showmacro_label->setGeometry(250,65,130,20);
lib_shownotes_box->setGeometry(390,67,15,15);
lib_shownotes_label->setGeometry(410,65,130,20);
lib_showmatches_box->setGeometry(550,67,15,15);
lib_showmatches_label->setGeometry(570,65,200,20);
lib_cart_list->
setGeometry(10,90,e->size().width()-20,e->size().height()-155);
lib_add_button->setGeometry(10,e->size().height()-60,80,50);
lib_edit_button->setGeometry(100,e->size().height()-60,80,50);
lib_delete_button->setGeometry(190,e->size().height()-60,80,50);
disk_gauge->setGeometry(285,e->size().height()-55,
e->size().width()-585,
disk_gauge->sizeHint().height());
lib_rip_button->
setGeometry(e->size().width()-290,e->size().height()-60,80,50);
lib_reports_button->
setGeometry(e->size().width()-200,e->size().height()-60,80,50);
lib_close_button->setGeometry(e->size().width()-90,e->size().height()-60,
80,50);
}
lib_clear_button->setGeometry(e->size().width()-90,10,80,50);
lib_filter_label->setGeometry(10,10,55,20);
lib_group_box->setGeometry(70,40,120,20);
lib_group_label->setGeometry(10,40,55,20);
lib_codes_box->setGeometry(330,40,120,20);
lib_codes_label->setGeometry(195,40,130,20);
lib_allowdrag_box->setGeometry(470,42,15,15);
lib_allowdrag_label->setGeometry(490,40,130,20);
lib_showaudio_box->setGeometry(70,67,15,15);
lib_showaudio_label->setGeometry(90,65,130,20);
lib_showmacro_box->setGeometry(230,67,15,15);
lib_showmacro_label->setGeometry(250,65,130,20);
lib_shownotes_box->setGeometry(390,67,15,15);
lib_shownotes_label->setGeometry(410,65,130,20);
lib_showmatches_box->setGeometry(550,67,15,15);
lib_showmatches_label->setGeometry(570,65,200,20);
lib_cart_list->
setGeometry(10,90,e->size().width()-20,e->size().height()-155);
lib_add_button->setGeometry(10,e->size().height()-60,80,50);
lib_edit_button->setGeometry(100,e->size().height()-60,80,50);
lib_delete_button->setGeometry(190,e->size().height()-60,80,50);
disk_gauge->setGeometry(285,e->size().height()-55,
e->size().width()-585,
disk_gauge->sizeHint().height());
lib_rip_button->
setGeometry(e->size().width()-290,e->size().height()-60,80,50);
lib_reports_button->
setGeometry(e->size().width()-200,e->size().height()-60,80,50);
lib_close_button->setGeometry(e->size().width()-90,e->size().height()-60,
80,50);
}

View File

@ -2,7 +2,7 @@
//
// The Production Utility for Rivendell.
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2004,2016-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
@ -147,7 +147,8 @@ class MainWidget : public QWidget
bool lib_edit_pending;
bool lib_user_changed;
QTimer *lib_user_timer;
bool lib_resize;
};
#endif
#endif // RDLIBRARY_H

View File

@ -1336,10 +1336,6 @@ Přesto smazat?</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command-line option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALBUM</source>
<translation type="unfinished"></translation>
@ -1348,6 +1344,10 @@ Přesto smazat?</translation>
<source>LABEL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecordCut</name>

View File

@ -1313,10 +1313,6 @@ verwendet. Trotzdem löschen?</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command-line option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALBUM</source>
<translation type="unfinished"></translation>
@ -1325,6 +1321,10 @@ verwendet. Trotzdem löschen?</translation>
<source>LABEL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecordCut</name>

View File

@ -1318,10 +1318,6 @@ Do you still want to delete it?</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command-line option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALBUM</source>
<translation type="unfinished"></translation>
@ -1330,6 +1326,10 @@ Do you still want to delete it?</source>
<source>LABEL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecordCut</name>

View File

@ -1150,10 +1150,6 @@ Do you still want to delete it?</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command-line option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALBUM</source>
<translation type="unfinished"></translation>
@ -1162,6 +1158,10 @@ Do you still want to delete it?</source>
<source>LABEL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecordCut</name>

View File

@ -1309,10 +1309,6 @@ Vil du sletta ho likevel?</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command-line option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALBUM</source>
<translation type="unfinished"></translation>
@ -1321,6 +1317,10 @@ Vil du sletta ho likevel?</translation>
<source>LABEL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecordCut</name>

View File

@ -1309,10 +1309,6 @@ Vil du sletta ho likevel?</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command-line option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALBUM</source>
<translation type="unfinished"></translation>
@ -1321,6 +1317,10 @@ Vil du sletta ho likevel?</translation>
<source>LABEL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecordCut</name>

View File

@ -1311,10 +1311,6 @@ Você ainda quer deletá-lo?</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command-line option</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ALBUM</source>
<translation type="unfinished"></translation>
@ -1323,6 +1319,10 @@ Você ainda quer deletá-lo?</translation>
<source>LABEL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RecordCut</name>

View File

@ -101,18 +101,10 @@ MainWidget::MainWidget(QWidget *parent)
{
QString str1;
QString str2;
log_log_list=NULL;
QString err_msg;
//
// Read Command Options
//
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogedit","\n");
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
}
}
delete cmd;
log_resize=false;
log_log_list=NULL;
//
// Fix the Window Size
@ -127,13 +119,28 @@ MainWidget::MainWidget(QWidget *parent)
RDInitializeDaemons();
#endif // WIN32
rda=new RDApplication("RDLogEdit",this);
//
// Open the Database
//
rda=new RDApplication("RDLogEdit","rdlogedit",RDLOGEDIT_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDLogEdit - "+tr("Error"),err_msg);
exit(1);
}
log_import_path=RDGetHomeDir();
//
// Read Command Options
//
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDLogEdit - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}
//
// CAE Connection
//
@ -298,6 +305,8 @@ MainWidget::MainWidget(QWidget *parent)
setCaption(QString().sprintf("%s: %s, %s",(const char *)str1,
(const char *)rda->config()->stationName(),
(const char *)str2));
log_resize=true;
}
@ -680,7 +689,7 @@ void MainWidget::quitMainWidget()
void MainWidget::resizeEvent(QResizeEvent *e)
{
if(log_log_list==NULL) {
if((log_log_list==NULL)||(!log_resize)) {
return;
}
log_filter_widget->setGeometry(10,10,size().width()-10,

View File

@ -2,7 +2,7 @@
//
// The Log Editor Utility for Rivendell.
//
// (C) Copyright 2002-2016 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
@ -36,13 +36,15 @@
#include <qcombobox.h>
#include <qlabel.h>
#include <rdlogfilter.h>
#include <rduser.h>
#include <rdripc.h>
#include <rdlibrary_conf.h>
#include <rdlog_line.h>
#include <rdlogfilter.h>
#include <rdripc.h>
#include <rduser.h>
#include <list_listviewitem.h>
#include "list_listviewitem.h"
#define RDLOGEDIT_USAGE "\n"
class MainWidget : public QMainWindow
{
@ -98,6 +100,7 @@ class MainWidget : public QMainWindow
QString log_filter;
QString log_group;
QString log_schedcode;
bool log_resize;
};

View File

@ -947,6 +947,10 @@ Vyhledejte svého správce systému kvůli aktualizaci!</translation>
<source>is in use by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RenderDialog</name>

View File

@ -937,6 +937,10 @@ Fortfahren?</translation>
<source>is in use by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RenderDialog</name>

View File

@ -943,6 +943,10 @@ See your system administrator for an update!</source>
<source>is in use by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RenderDialog</name>

View File

@ -846,6 +846,10 @@ Report</source>
<source>is in use by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RenderDialog</name>

View File

@ -955,6 +955,10 @@ Vil du halda fram?</translation>
<source>is in use by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RenderDialog</name>

View File

@ -955,6 +955,10 @@ Vil du halda fram?</translation>
<source>is in use by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RenderDialog</name>

View File

@ -934,6 +934,10 @@ Continuar?</translation>
<source>is in use by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RenderDialog</name>

View File

@ -48,6 +48,7 @@
MainWidget::MainWidget(QWidget *parent)
:QWidget(parent)
{
login_resize=false;
login_user_width=160;
QString str;
@ -55,16 +56,6 @@ MainWidget::MainWidget(QWidget *parent)
RDSqlQuery *q;
QString err_msg;
//
// Read Command Options
//
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogin","\n");
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
}
}
delete cmd;
//
// Fix the Window Size
//
@ -98,11 +89,24 @@ MainWidget::MainWidget(QWidget *parent)
//
RDInitializeDaemons();
rda=new RDApplication("RDLogin",this);
rda=new RDApplication("RDLogin","rdlogin",RDLOGIN_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDLogin - "+tr("Error"),err_msg);
exit(1);
}
//
// Read Command Options
//
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDLogin - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}
str=QString(tr("RDLogin - Station:"));
setCaption(str+" "+rda->config()->stationName());
@ -188,6 +192,8 @@ MainWidget::MainWidget(QWidget *parent)
cancel_button->setText(tr("&Cancel"));
connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
login_resize=true;
resizeEvent(NULL);
}
@ -287,15 +293,17 @@ void MainWidget::quitMainWidget()
void MainWidget::resizeEvent(QResizeEvent *e)
{
login_label->setGeometry(0,10,size().width(),21);
login_username_box->setGeometry(110,40,size().width()-120,19);
login_username_edit->setGeometry(110,40,size().width()-120,19);
login_username_label->setGeometry(10,40,85,19);
login_password_edit->setGeometry(110,61,size().width()-120,19);
login_password_label->setGeometry(10,61,85,19);
login_button->setGeometry(size().width()-270,size().height()-60,80,50);
logout_button->setGeometry(size().width()-180,size().height()-60,80,50);
cancel_button->setGeometry(size().width()-90,size().height()-60,80,50);
if(login_resize) {
login_label->setGeometry(0,10,size().width(),21);
login_username_box->setGeometry(110,40,size().width()-120,19);
login_username_edit->setGeometry(110,40,size().width()-120,19);
login_username_label->setGeometry(10,40,85,19);
login_password_edit->setGeometry(110,61,size().width()-120,19);
login_password_label->setGeometry(10,61,85,19);
login_button->setGeometry(size().width()-270,size().height()-60,80,50);
logout_button->setGeometry(size().width()-180,size().height()-60,80,50);
cancel_button->setGeometry(size().width()-90,size().height()-60,80,50);
}
}

View File

@ -30,6 +30,8 @@
#include <qlabel.h>
#include <qpushbutton.h>
#define RDLOGIN_USAGE "\n"
class MainWidget : public QWidget
{
Q_OBJECT
@ -63,6 +65,7 @@ class MainWidget : public QWidget
QPushButton *logout_button;
QPushButton *cancel_button;
int login_user_width;
bool login_resize;
};

View File

@ -59,5 +59,9 @@ uživatel</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -58,5 +58,9 @@ User</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -59,5 +59,9 @@ User</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -46,5 +46,9 @@ User</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -59,5 +59,9 @@ brukar</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -59,5 +59,9 @@ brukar</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -60,5 +60,9 @@ Padrão</translation>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -49,7 +49,9 @@ int RunLogOperation(int argc,char *argv[],const QString &svcname,
QApplication a(argc,argv,false);
rda=new RDApplication("RDLogManager");
//
// Open the Database
rda=new RDApplication("RDLogManager","rdlogmanager",RDLOGMANAGER_USAGE);
if(!rda->open(&err_msg)) {
fprintf(stderr,"rdlogmanager: %s\n",(const char *)err_msg);
exit(1);
@ -197,7 +199,7 @@ int RunReportOperation(int argc,char *argv[],const QString &rptname,
return 256;
}
rda=new RDApplication("RDLogManager");
rda=new RDApplication("RDLogManager","rdlogmanager",RDLOGMANAGER_USAGE);
if(!rda->open(&err_msg)) {
fprintf(stderr,"rdlogmanager: %s\n",(const char *)err_msg);
exit(1);

View File

@ -109,7 +109,10 @@ MainWidget::MainWidget(QWidget *parent)
RDInitializeDaemons();
#endif // WIN32
rda=new RDApplication("RDLogManager",this);
//
// Open the Database
//
rda=new RDApplication("RDLogManager","rdlogmanager",RDLOGMANAGER_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDLogManager - "+tr("Error"),err_msg);
exit(1);
@ -387,7 +390,6 @@ int main(int argc,char *argv[])
cmd->setProcessed(i,true);
}
if(cmd->key(i)=="--skip-db-check") {
skip_db_check=true;
cmd->setProcessed(i,true);
}
if (cmd->key(i)=="-s") {
@ -397,7 +399,7 @@ int main(int argc,char *argv[])
}
else {
fprintf(stderr,"rdlogmanager: missing argument to \"-s\"\n");
exit(256);
exit(2);
}
}
if (cmd->key(i)=="-r") {
@ -407,7 +409,7 @@ int main(int argc,char *argv[])
}
else {
fprintf(stderr,"rdlogmanager: missing argument to \"-r\"\n");
exit(256);
exit(2);
}
}
if (cmd->key(i)=="-d") {
@ -417,7 +419,7 @@ int main(int argc,char *argv[])
}
else {
fprintf(stderr,"rdlogmanager: missing argument to \"-d\"\n");
exit(256);
exit(2);
}
}
if (cmd->key(i)=="-e") {
@ -427,9 +429,14 @@ int main(int argc,char *argv[])
}
else {
fprintf(stderr,"rdlogmanager: missing argument to \"-e\"\n");
exit(256);
exit(2);
}
}
if(!cmd->processed(i)) {
fprintf(stderr,"rdlogmanager: unknown command option \"%s\"\n",
(const char *)cmd->key(i));
exit(2);
}
}
delete cmd;
if((!cmd_report.isNull())&&

View File

@ -84,16 +84,6 @@ MainWidget::MainWidget(QWidget *parent)
setMaximumHeight(sizeHint().height());
#endif // RESIZABLE
//
// Load the command-line arguments
//
RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdpanel",
RDPANEL_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
}
}
//
// Generate Fonts
//
@ -111,12 +101,27 @@ MainWidget::MainWidget(QWidget *parent)
//
RDInitializeDaemons();
rda=new RDApplication("RDPanel",this);
//
// Open the Database
//
rda=new RDApplication("RDPanel","rdpanel",RDPANEL_USAGE,this);
if(!rda->open(&err_msg)) {
QMessageBox::critical(this,"RDPanel - "+tr("Error"),err_msg);
exit(1);
}
//
// Read Command Options
//
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(!rda->cmdSwitch()->processed(i)) {
QMessageBox::critical(this,"RDPanel - "+tr("Error"),
tr("Unknown command option")+": "+
rda->cmdSwitch()->key(i));
exit(2);
}
}
//
// Master Clock Timer
//

View File

@ -21,5 +21,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -13,5 +13,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -21,5 +21,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -13,5 +13,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -13,5 +13,9 @@
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown command option</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -63,15 +63,7 @@ MainObject::MainObject(QObject *parent)
{
QString err_msg;
//
// Read Command Options
//
RDCmdSwitch *cmd=
new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdrepld",RDREPLD_USAGE);
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)=="--skip-db-check") {
}
}
debug=false;
//
// Make sure we're the only instance running
@ -81,16 +73,29 @@ MainObject::MainObject(QObject *parent)
exit(1);
}
rda=new RDApplication("rdrepld",this);
//
// Open the Database
//
rda=new RDApplication("rdrepld","rdrepld",RDREPLD_USAGE,this);
if(!rda->open(&err_msg)) {
fprintf(stderr,"rdrepld: %s\n",(const char *)err_msg);
exit(1);
}
//
// Initialize Data Structures
// Read Command Options
//
debug=false;
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
if(rda->cmdSwitch()->key(i)=="-d") {
debug=true;
rda->cmdSwitch()->setProcessed(i,true);
}
if(!rda->cmdSwitch()->processed(i)) {
fprintf(stderr,"rdrepld: unknown command option \"%s\"\n",
(const char *)rda->cmdSwitch()->key(i));
exit(2);
}
}
//
// Calculate Temporary Directory
@ -115,7 +120,7 @@ MainObject::MainObject(QObject *parent)
::signal(SIGTERM,SigHandler);
::signal(SIGCHLD,SigHandler);
if(!RDWritePid(RD_PID_DIR,"rdrepld.pid")) {
printf("rdrepld: aborting - can't write pid file\n");
fprintf(stderr,"rdrepld: aborting - can't write pid file\n");
exit(1);
}

View File

@ -26,12 +26,12 @@
#include <qobject.h>
#include <qtimer.h>
#include <rdconfig.h>
#include <rdcheck_daemons.h>
#include <rdconfig.h>
#include "replfactory.h"
#define RDREPLD_USAGE "[-d][--event-id=<id>]\n\nOptions:\n\n-d\n Set 'debug' mode, causing rdrepld(8) to stay in the foreground\n and print debugging info on standard output.\n\n"
#define RDREPLD_USAGE "[-d]\n\nOptions:\n\n-d\n Set 'debug' mode, causing rdrepld(8) to stay in the foreground\n and print debugging info on standard output.\n\n"
#define RD_RDREPLD_PID "rdrepl.pid"
#define RD_RDREPL_SCAN_INTERVAL 10000