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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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