mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-07 01:13:50 +02:00
2019-12-10 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDTextViewer()' function. * Added the ability to view a report at time of generation in rdlogmanager(1).
This commit is contained in:
parent
349efba0b5
commit
169e56f059
@ -19328,3 +19328,7 @@
|
||||
2019-12-10 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed typos in UI strings in rdlogmanager(1)'s 'Pick Report Dates'
|
||||
dialog.
|
||||
2019-12-10 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added an 'RDTextViewer()' function.
|
||||
* Added the ability to view a report at time of generation in
|
||||
rdlogmanager(1).
|
||||
|
@ -81,3 +81,41 @@ bool RDTextFile(const QString &data,bool delete_on_exit)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDTextViewer(const QString &filename)
|
||||
{
|
||||
QString editor=RD_LINUX_EDITOR;
|
||||
char cmd[PATH_MAX];
|
||||
char *args[64];
|
||||
|
||||
if(!rda->station()->reportEditorPath().trimmed().isEmpty()) {
|
||||
editor=rda->station()->reportEditorPath();
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
args[f0.size()]=(char *)malloc(filename.toUtf8().length()+1);
|
||||
strcpy(args[f0.size()],filename.toUtf8());
|
||||
|
||||
args[f0.size()+1]=(char *)NULL;
|
||||
|
||||
if(fork()==0) {
|
||||
execvp(cmd,args);
|
||||
_exit(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <qstring.h>
|
||||
|
||||
bool RDTextFile(const QString &data,bool delete_on_exit=true);
|
||||
bool RDTextViewer(const QString &filename);
|
||||
|
||||
|
||||
#endif // RDTEXTFILE_H
|
||||
|
@ -65,7 +65,8 @@ dist_rdlogmanager_SOURCES = add_clock.cpp add_clock.h\
|
||||
rdlogmanager.cpp rdlogmanager.h\
|
||||
rename_item.cpp rename_item.h\
|
||||
svc_rec.cpp svc_rec.h\
|
||||
svc_rec_dialog.cpp svc_rec_dialog.h
|
||||
svc_rec_dialog.cpp svc_rec_dialog.h\
|
||||
viewreportdialog.cpp viewreportdialog.h
|
||||
|
||||
nodist_rdlogmanager_SOURCES = moc_add_clock.cpp\
|
||||
moc_add_event.cpp\
|
||||
@ -91,7 +92,8 @@ nodist_rdlogmanager_SOURCES = moc_add_clock.cpp\
|
||||
moc_rdlogmanager.cpp\
|
||||
moc_rename_item.cpp\
|
||||
moc_svc_rec.cpp\
|
||||
moc_svc_rec_dialog.cpp
|
||||
moc_svc_rec_dialog.cpp\
|
||||
moc_viewreportdialog.cpp
|
||||
|
||||
rdlogmanager_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support
|
||||
|
||||
|
@ -46,6 +46,11 @@ PickReportDates::PickReportDates(const QString &svcname,QWidget *parent)
|
||||
setMaximumSize(sizeHint());
|
||||
setMinimumSize(sizeHint());
|
||||
|
||||
//
|
||||
// Dialogs
|
||||
//
|
||||
edit_viewreport_dialog=new ViewReportDialog(this);
|
||||
|
||||
//
|
||||
// Report List
|
||||
//
|
||||
@ -121,6 +126,7 @@ PickReportDates::PickReportDates(const QString &svcname,QWidget *parent)
|
||||
|
||||
PickReportDates::~PickReportDates()
|
||||
{
|
||||
delete edit_viewreport_dialog;
|
||||
}
|
||||
|
||||
|
||||
@ -205,9 +211,7 @@ void PickReportDates::generateData()
|
||||
edit_enddate_edit->date(),rda->station(),&out_path);
|
||||
switch(report->errorCode()) {
|
||||
case RDReport::ErrorOk:
|
||||
QMessageBox::information(this,"RDLogManager - "+tr("Report Complete"),
|
||||
tr("Report generated in")+" \""+out_path+
|
||||
"\".");
|
||||
edit_viewreport_dialog->exec(out_path);
|
||||
break;
|
||||
|
||||
case RDReport::ErrorCantOpen:
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
#include <rddialog.h>
|
||||
|
||||
#include "viewreportdialog.h"
|
||||
|
||||
class PickReportDates : public RDDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -46,6 +48,7 @@ class PickReportDates : public RDDialog
|
||||
QDateEdit *edit_startdate_edit;
|
||||
QDateEdit *edit_enddate_edit;
|
||||
QString edit_svcname;
|
||||
ViewReportDialog *edit_viewreport_dialog;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1497,16 +1497,12 @@ zprávu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report Complete</source>
|
||||
<translation>Zpráva úplná</translation>
|
||||
<translation type="obsolete">Zpráva úplná</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report complete!</source>
|
||||
<translation type="obsolete">Zpráva úplná!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report generated in</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -1487,16 +1487,12 @@ Report</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report Complete</source>
|
||||
<translation>Report komplett</translation>
|
||||
<translation type="obsolete">Report komplett</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report complete!</source>
|
||||
<translation type="obsolete">Report komplett!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report generated in</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -1500,16 +1500,12 @@ Reporte</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report Complete</source>
|
||||
<translation>Reporte completado</translation>
|
||||
<translation type="obsolete">Reporte completado</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report complete!</source>
|
||||
<translation type="obsolete">¡Reporte completado!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report generated in</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -1316,14 +1316,6 @@ Report</source>
|
||||
<source>This report type cannot span multiple months!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report Complete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report generated in</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -1490,16 +1490,12 @@ rapport</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report Complete</source>
|
||||
<translation>Rapporten ferdig</translation>
|
||||
<translation type="obsolete">Rapporten ferdig</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report complete!</source>
|
||||
<translation type="obsolete">Rapporten er ferdig!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report generated in</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -1490,16 +1490,12 @@ rapport</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report Complete</source>
|
||||
<translation>Rapporten ferdig</translation>
|
||||
<translation type="obsolete">Rapporten ferdig</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report complete!</source>
|
||||
<translation type="obsolete">Rapporten er ferdig!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report generated in</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -1491,16 +1491,12 @@ Relatório</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report Complete</source>
|
||||
<translation>Relatório Completo</translation>
|
||||
<translation type="obsolete">Relatório Completo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report complete!</source>
|
||||
<translation type="obsolete">Relatório Completo!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report generated in</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File Exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
96
rdlogmanager/viewreportdialog.cpp
Normal file
96
rdlogmanager/viewreportdialog.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
// viewreportdialog.cpp
|
||||
//
|
||||
// Offer to display a generated report.
|
||||
//
|
||||
// (C) Copyright 2002-2019 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
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#include <rdtextfile.h>
|
||||
|
||||
#include "viewreportdialog.h"
|
||||
|
||||
ViewReportDialog::ViewReportDialog(QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
//
|
||||
// Fix the Window Size
|
||||
//
|
||||
setMaximumSize(sizeHint());
|
||||
setMinimumSize(sizeHint());
|
||||
|
||||
|
||||
setWindowTitle("RDLogManager - "+tr("Report Complete"));
|
||||
view_message_label=new QLabel(this);
|
||||
view_message_label->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
view_message_label->setWordWrap(true);
|
||||
|
||||
view_view_button=new QPushButton(tr("View in")+"\n"+tr("Report Editor"),this);
|
||||
view_view_button->setFont(buttonFont());
|
||||
connect(view_view_button,SIGNAL(clicked()),this,SLOT(viewData()));
|
||||
|
||||
view_close_button=new QPushButton(tr("Close"),this);
|
||||
view_close_button->setFont(buttonFont());
|
||||
connect(view_close_button,SIGNAL(clicked()),this,SLOT(closeData()));
|
||||
}
|
||||
|
||||
|
||||
QSize ViewReportDialog::sizeHint() const
|
||||
{
|
||||
return QSize(300,120);
|
||||
}
|
||||
|
||||
|
||||
QSizePolicy ViewReportDialog::sizePolicy() const
|
||||
{
|
||||
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
|
||||
int ViewReportDialog::exec(const QString &rpt_filename)
|
||||
{
|
||||
view_report_filename=rpt_filename;
|
||||
view_message_label->
|
||||
setText(tr("Report generated in")+" \""+rpt_filename+"\".");
|
||||
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
|
||||
void ViewReportDialog::viewData()
|
||||
{
|
||||
if(!RDTextViewer(view_report_filename)) {
|
||||
QMessageBox::information(this,"RDLogManager - "+tr("Error"),
|
||||
tr("Unable to launce report viewer!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ViewReportDialog::closeData()
|
||||
{
|
||||
done(true);
|
||||
}
|
||||
|
||||
|
||||
void ViewReportDialog::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
view_message_label->setGeometry(10,10,size().width()-20,size().height()-80);
|
||||
|
||||
view_view_button->setGeometry(10,size().height()-60,110,50);
|
||||
|
||||
view_close_button->setGeometry(size().width()-90,size().height()-60,80,50);
|
||||
}
|
56
rdlogmanager/viewreportdialog.h
Normal file
56
rdlogmanager/viewreportdialog.h
Normal file
@ -0,0 +1,56 @@
|
||||
// viewreportdialog.h
|
||||
//
|
||||
// Offer to display a generated report.
|
||||
//
|
||||
// (C) Copyright 2002-2019 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
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef VIEWREPORTDIALOG_H
|
||||
#define VIEWREPORTDIALOG_H
|
||||
|
||||
#include <qcombobox.h>
|
||||
#include <qdatetimeedit.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <rddialog.h>
|
||||
|
||||
class ViewReportDialog : public RDDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ViewReportDialog(QWidget *parent=0);
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
|
||||
public slots:
|
||||
int exec(const QString &rpt_filename);
|
||||
|
||||
private slots:
|
||||
void viewData();
|
||||
void closeData();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
QLabel *view_message_label;
|
||||
QPushButton *view_view_button;
|
||||
QPushButton *view_close_button;
|
||||
QString view_report_filename;
|
||||
};
|
||||
|
||||
|
||||
#endif // VIEWREPORTDIALOG_H
|
Loading…
x
Reference in New Issue
Block a user