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

* Modified reports in rdlogedit(1) to display UTF-8 strings
	correctly.
This commit is contained in:
Fred Gleason 2018-08-02 17:27:49 -04:00
parent dfa5438a65
commit ec6207c7d6
11 changed files with 103 additions and 96 deletions

View File

@ -17299,3 +17299,6 @@
2018-08-02 Fred Gleason <fredg@paravelsystems.com>
* Modified reports in rdadmin(1) to display UTF-8 strings
correctly.
2018-08-02 Fred Gleason <fredg@paravelsystems.com>
* Modified reports in rdlogedit(1) to display UTF-8 strings
correctly.

View File

@ -28,6 +28,7 @@
#include "rdescape_string.h"
#include "rdlog.h"
#include "rdlog_event.h"
#include "rdreport.h"
//
// Global Classes
@ -199,14 +200,11 @@ int RDLogEvent::validate(QString *report,const QDate &date)
// Report Header
//
*report="Rivendell Log Exception Report\n";
*report+=
QString().
sprintf("Generated at: %s - %s\n",
(const char *)QDate::currentDate().toString("MM/dd/yyyy"),
(const char *)QTime::currentTime().toString("hh:mm:ss"));
*report+=QString().sprintf("Log: %s\n",(const char *)log_name);
*report+=QString().sprintf("Effective Airdate: %s\n",
(const char *)date.toString("MM/dd/yyyy"));
*report=QString("Generated at: ")+
QDate::currentDate().toString("MM/dd/yyyy")+" - "+
QTime::currentTime().toString("hh:mm:ss")+"\n";
*report+=QString("Log: ")+log_name+"\n";
*report+=QString("Effective Airdate: ")+date.toString("MM/dd/yyyy")+"\n";
*report+="\n";
//
@ -214,15 +212,17 @@ int RDLogEvent::validate(QString *report,const QDate &date)
//
for(int i=0;i<size();i++) {
if(logLine(i)->cartNumber()>0) {
sql=QString().sprintf("select TYPE,TITLE from CART where NUMBER=%d",
logLine(i)->cartNumber());
sql=QString("select ")+
"TYPE,"+ // 00
"TITLE "+ // 01
"from CART where "+
QString().sprintf("NUMBER=%d",logLine(i)->cartNumber());
q=new RDSqlQuery(sql);
if(!q->first()) {
*report+=QString().
sprintf(" %s - missing cart %06d\n",
(const char *)logLine(i)->startTime(RDLogLine::Logged).
toString("hh:mm:ss"),
logLine(i)->cartNumber());
*report+=QString(" ")+
logLine(i)->startTime(RDLogLine::Logged).toString("hh:mm:ss")+
QString().sprintf(" - missing cart %06d",logLine(i)->cartNumber())+
"\n";
errs++;
}
else {

View File

@ -2,7 +2,7 @@
//
// List and Generate Log Reports
//
// (C) Copyright 2002-2006,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2006,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
@ -18,18 +18,15 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qdialog.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qsqldatabase.h>
#include <qmessagebox.h>
#include <rdconf.h>
#include <rdtextfile.h>
#include <rddatedialog.h>
#include <rdreport.h>
#include <rdtextfile.h>
#include <globals.h>
#include <list_reports.h>
#include "globals.h"
#include "list_reports.h"
ListReports::ListReports(const QString &logname,const QString &description,
const QString service_name,const QDate &start_date,
@ -53,7 +50,7 @@ ListReports::ListReports(const QString &logname,const QString &description,
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
setCaption(tr("RDLibrary Reports"));
setCaption("RDLogEdit - "+tr("Reports"));
//
// Create Fonts
@ -187,18 +184,16 @@ void ListReports::GenerateLogReport(QString *report)
if(!list_end_date.isNull()) {
end_date=list_end_date.toString("MM/dd/yyyy");
}
*report=" Rivendell Log Listing\n";
*report+=QString().
sprintf("Generated: %s Log: %-30s Description: %s\n",
(const char *)QDateTime(QDate::currentDate(),QTime::currentTime()).
toString("MM/dd/yyyy - hh:mm:ss"),
(const char *)list_log_name.left(30),
(const char *)list_description.left(27));
*report+=QString().
sprintf("Service: %-10s AutoRefresh Enabled: %-3s Start Date: %-10s End Date: %s\n",
(const char *)list_service_name,
(const char *)refresh,
(const char *)start_date,(const char *)end_date);
*report=RDReport::center("Rivendell Log Listing",132)+"\n";
// *report=" Rivendell Log Listing\n";
*report+=QString("Generated: ")+
QDateTime::currentDateTime().toString("MM/dd/yyyy")+" Log: "+
RDReport::leftJustify(list_log_name,30)+
" Description: "+RDReport::leftJustify(list_description,27)+"\n";
*report+=QString("Service: ")+RDReport::leftJustify(list_service_name,10)+
" AutoRefresh Enabled: "+RDReport::leftJustify(refresh,3)+" "+
RDReport::leftJustify(start_date,10)+" "+end_date+"\n";
*report+="\n";
*report+="-Type-- -Time---- Trans -Cart- -Group---- -Length- -Title--------------------------- -Artist----------------------- -Source----- Line\n";
@ -212,8 +207,7 @@ void ListReports::GenerateLogReport(QString *report)
//
// Type
//
*report+=QString().sprintf("%-7s ",
(const char *)RDLogLine::typeText(logline->type()));
*report+=RDReport::leftJustify(RDLogLine::typeText(logline->type()),7)+" ";
//
// Time
@ -225,10 +219,7 @@ void ListReports::GenerateLogReport(QString *report)
*report+=" ";
}
if(!logline->startTime(RDLogLine::Imported).isNull()) {
*report+=QString().sprintf("%-8s ",
(const char *)logline->
startTime(RDLogLine::Logged).
toString("hh:mm:ss"));
*report+=RDReport::leftJustify(logline->startTime(RDLogLine::Logged).toString("hh:mm:ss"),8)+" ";
}
else {
*report+=" ";
@ -237,24 +228,16 @@ void ListReports::GenerateLogReport(QString *report)
//
// Transition Type
//
*report+=QString().sprintf("%-5s ",
(const char *)RDLogLine::transText(logline->transType()).left(5));
*report+=RDReport::leftJustify(RDLogLine::transText(logline->transType()).left(5),5)+" ";
switch(logline->type()) {
case RDLogLine::Cart:
case RDLogLine::Macro:
*report+=QString().sprintf("%06u ",logline->cartNumber());
*report+=QString().sprintf("%-10s ",
(const char *)logline->groupName());
*report+=QString().sprintf("%8s ",(const char *)
RDGetTimeLength(logline->forcedLength(),
false,false));
*report+=
QString().sprintf("%-33s ",
(const char *)logline->title().left(33));
*report+=
QString().sprintf("%-30s ",
(const char *)logline->artist().left(30));
*report+=RDReport::leftJustify(logline->groupName(),10)+" ";
*report+=RDReport::rightJustify(RDGetTimeLength(logline->forcedLength(),false,false),8)+" ";
*report+=RDReport::leftJustify(logline->title(),33)+" ";
*report+=RDReport::leftJustify(logline->artist(),30)+" ";
break;
case RDLogLine::Marker:
@ -262,9 +245,7 @@ void ListReports::GenerateLogReport(QString *report)
*report+=" ";
*report+=" ";
*report+=" :00 ";
*report+=
QString().sprintf("%-30s ",
(const char *)logline->markerComment().left(30));
*report+=RDReport::leftJustify(logline->markerComment(),30)+" ";
*report+=" ";
break;
@ -289,10 +270,7 @@ void ListReports::GenerateLogReport(QString *report)
*report+=" ";
*report+=" ";
*report+=" ";
*report+=
QString().sprintf("%-30s ",
(const char *)logline->markerLabel().left(30));
*report+=" ";
*report+=RDReport::leftJustify(logline->markerLabel(),30)+" ";
break;
case RDLogLine::OpenBracket:
@ -304,8 +282,7 @@ void ListReports::GenerateLogReport(QString *report)
//
// Source
//
*report+=QString().sprintf("%-12s ",
(const char *)RDLogLine::sourceText(logline->source()));
*report+=RDReport::leftJustify(RDLogLine::sourceText(logline->source()),12)+" ";
//
// Line

View File

@ -51,6 +51,7 @@
#include <rdescape_string.h>
#include <rdloglock.h>
#include <rdmixer.h>
#include <rdreport.h>
#include <rdstation.h>
#include <rdtextfile.h>
@ -548,20 +549,28 @@ void MainWidget::reportData()
//
// Generate Header
//
report=" Rivendell Log Listing\n";
report+=QString().
sprintf("Generated: %s\n",
(const char *)QDateTime(QDate::currentDate(),QTime::currentTime()).
toString("MM/dd/yyyy - hh:mm:ss"));
report=RDReport::center("Rivendell Log Listing",132)+"\n";
report+=QString("Generated: ")+QDateTime::currentDateTime().toString("MM/dd/yyyy - hh:mm:ss")+"\n";
report+="\n";
report+="Rdy -Log Name-------------------- -Description----------------- -Service------------ Mus Tfc Tracks- Start Date -End Date- -Mod Date-\n";
//
// Report Body
//
sql="select NAME,DESCRIPTION,SERVICE,MUSIC_LINKS,MUSIC_LINKED,\
TRAFFIC_LINKS,TRAFFIC_LINKED,COMPLETED_TRACKS,SCHEDULED_TRACKS,\
START_DATE,END_DATE,MODIFIED_DATETIME from LOGS order by NAME";
sql=QString("select ")+
"NAME,"+ // 00
"DESCRIPTION,"+ // 01
"SERVICE,"+ // 02
"MUSIC_LINKS,"+ // 03
"MUSIC_LINKED,"+ // 04
"TRAFFIC_LINKS,"+ // 05
"TRAFFIC_LINKED,"+ // 06
"COMPLETED_TRACKS,"+ // 07
"SCHEDULED_TRACKS,"+ // 08
"START_DATE,"+ // 09
"END_DATE,"+ // 10
"MODIFIED_DATETIME "+ // 11
"from LOGS order by NAME ";
q=new RDSqlQuery(sql);
while(q->next()) {
//
@ -579,27 +588,23 @@ void MainWidget::reportData()
//
// Log Name
//
report+=QString().sprintf("%-29s ",
(const char *)q->value(0).toString().left(29));
report+=RDReport::leftJustify(q->value(0).toString(),29)+" ";
//
// Description
//
report+=QString().sprintf("%-29s ",
(const char *)q->value(1).toString().left(29));
report+=RDReport::leftJustify(q->value(1).toString(),29)+" ";
//
// Service
//
report+=QString().sprintf("%-20s ",
(const char *)q->value(2).toString().left(20));
report+=RDReport::leftJustify(q->value(2).toString(),20)+" ";
//
// Music Linked
//
if(q->value(3).toInt()>0) {
report+=QString().sprintf(" %s ",
(const char *)q->value(4).toString());
report+=QString(" ")+q->value(4).toString()+" ";
}
else {
report+="n/a ";
@ -609,8 +614,7 @@ void MainWidget::reportData()
// Traffic Linked
//
if(q->value(5).toInt()>0) {
report+=QString().sprintf(" %s ",
(const char *)q->value(6).toString());
report+=QString(" ")+q->value(6).toString()+" ";
}
else {
report+="n/a ";
@ -629,8 +633,7 @@ void MainWidget::reportData()
report+="[none] ";
}
else {
report+=QString().sprintf("%s ",
(const char *)q->value(9).toDate().toString("MM/dd/yyyy"));
report+=q->value(9).toDate().toString("MM/dd/yyyy")+" ";
}
//
@ -640,6 +643,7 @@ void MainWidget::reportData()
report+="[none] ";
}
else {
report+=q->value(10).toDate().toString("MM/dd/yyyy")+" ";
report+=QString().sprintf("%s ",
(const char *)q->value(10).toDate().toString("MM/dd/yyyy"));
}
@ -647,8 +651,7 @@ void MainWidget::reportData()
//
// Last Modified Date
//
report+=QString().sprintf("%s",
(const char *)q->value(11).toDate().toString("MM/dd/yyyy"));
report+=q->value(11).toDate().toString("MM/dd/yyyy");
//
// End of Line

View File

@ -706,7 +706,7 @@ vybrané služby!</translation>
<name>ListReports</name>
<message>
<source>RDLibrary Reports</source>
<translation>Zprávy RDLibrary</translation>
<translation type="obsolete">Zprávy RDLibrary</translation>
</message>
<message>
<source>Log Listing</source>
@ -748,6 +748,10 @@ vybrané služby!</translation>
<source>&amp;Select</source>
<translation>&amp;Vybrat</translation>
</message>
<message>
<source>Reports</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>

View File

@ -706,7 +706,7 @@ Gruppe des ausgewählten Service!</translation>
<name>ListReports</name>
<message>
<source>RDLibrary Reports</source>
<translation>RDLibrary Reports</translation>
<translation type="obsolete">RDLibrary Reports</translation>
</message>
<message>
<source>Log Listing</source>
@ -748,6 +748,10 @@ Gruppe des ausgewählten Service!</translation>
<source>&amp;Select</source>
<translation>Au&amp;swählen</translation>
</message>
<message>
<source>Reports</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>

View File

@ -706,7 +706,7 @@ desactivado para el servicio especificado!</translation>
<name>ListReports</name>
<message>
<source>RDLibrary Reports</source>
<translation>Reportes de RDLibrary</translation>
<translation type="obsolete">Reportes de RDLibrary</translation>
</message>
<message>
<source>Log Listing</source>
@ -748,6 +748,10 @@ desactivado para el servicio especificado!</translation>
<source>&amp;Select</source>
<translation>&amp;Seleccionar</translation>
</message>
<message>
<source>Reports</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>

View File

@ -645,10 +645,6 @@ group for the specified service!</source>
</context>
<context>
<name>ListReports</name>
<message>
<source>RDLibrary Reports</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Log Listing</source>
<translation type="unfinished"></translation>
@ -689,6 +685,10 @@ group for the specified service!</source>
<source>&amp;Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reports</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>

View File

@ -728,7 +728,7 @@ som er skrudd av for denne tenesta!</translation>
<name>ListReports</name>
<message>
<source>RDLibrary Reports</source>
<translation>RDLibrary-rapportar</translation>
<translation type="obsolete">RDLibrary-rapportar</translation>
</message>
<message>
<source>Log Listing</source>
@ -770,6 +770,10 @@ som er skrudd av for denne tenesta!</translation>
<source>&amp;Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reports</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>

View File

@ -728,7 +728,7 @@ som er skrudd av for denne tenesta!</translation>
<name>ListReports</name>
<message>
<source>RDLibrary Reports</source>
<translation>RDLibrary-rapportar</translation>
<translation type="obsolete">RDLibrary-rapportar</translation>
</message>
<message>
<source>Log Listing</source>
@ -770,6 +770,10 @@ som er skrudd av for denne tenesta!</translation>
<source>&amp;Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reports</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>

View File

@ -708,7 +708,7 @@ Ação se Evento anterior estiver sendo executado</translation>
<name>ListReports</name>
<message>
<source>RDLibrary Reports</source>
<translation>Relatórios da RDBiblio</translation>
<translation type="obsolete">Relatórios da RDBiblio</translation>
</message>
<message>
<source>Log Listing</source>
@ -750,6 +750,10 @@ Ação se Evento anterior estiver sendo executado</translation>
<source>No exceptions found.</source>
<translation>Exceções não Encontradas.</translation>
</message>
<message>
<source>Reports</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>