2021-08-13 Fred Gleason <fredg@paravelsystems.com>

* Fixed a regression in rdlibrary(1) that caused misaligned
	columns when generating a Cut Report.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-08-15 13:55:19 -04:00
parent d9925e0ee8
commit fcb3ad7b27
12 changed files with 62 additions and 37 deletions

View File

@ -329,8 +329,10 @@ See the specific headers in 'lib/' for details.
Value Outputs. The following methods are available for easily rendering Value Outputs. The following methods are available for easily rendering
properly formatted date/time strings in GUI module contexts: properly formatted date/time strings in GUI module contexts:
RDCoreApplication::timeString(const QTime &time,bool padded=false) const; RDCoreApplication::timeString(const QTime &time,
RDCoreApplication::tenthsTimeString(const QTime &time,bool padded=false) const; const QString &padding="") const;
RDCoreApplication::tenthsTimeString(const QTime &time,
const QString &padding="") const;
RDCoreApplication::shortDateString(const QDate &date) const; RDCoreApplication::shortDateString(const QDate &date) const;
RDCoreApplication::longDateString(const Date &date) const; RDCoreApplication::longDateString(const Date &date) const;

View File

@ -22266,3 +22266,8 @@
2021-08-13 Fred Gleason <fredg@paravelsystems.com> 2021-08-13 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in rdlibrary(1) that caused misaligned * Fixed a regression in rdlibrary(1) that caused misaligned
columns when generating a Cut Report. columns when generating a Cut Report.
2021-08-15 Fred Gleason <fredg@paravelsystems.com>
* Changed the second parameter of the
'RDCoreApplication::timeString()' and
'RDCoreApplication::tenthsTimeString()' to allow specification
of the character used for padding.

View File

@ -119,7 +119,7 @@ bool RDReport::ExportCutLog(const QString &filename,const QDate &startdate,
if(desc.isEmpty()) { if(desc.isEmpty()) {
desc=" "; desc=" ";
} }
*strm << rda->timeString(q->value(2).toTime(),true)+" "; *strm << rda->timeString(q->value(2).toTime()," ")+" ";
*strm << cart_num+" "; *strm << cart_num+" ";
*strm << RDReport::leftJustify(q->value(8).toString(),23)+" "; *strm << RDReport::leftJustify(q->value(8).toString(),23)+" ";
*strm << cut+" "; *strm << cut+" ";

View File

@ -109,7 +109,7 @@ bool RDReport::ExportMusicPlayout(const QString &filename,
} }
} }
cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt()); cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt());
*strm << rda->timeString(q->value(2).toDateTime().time(),true)+" "; *strm << rda->timeString(q->value(2).toDateTime().time()," ")+" ";
*strm << cart_num+" "; *strm << cart_num+" ";
*strm << cut+" "; *strm << cut+" ";
*strm << RDGetTimeLength(q->value(0).toInt(),true,false).right(5)+" "; *strm << RDGetTimeLength(q->value(0).toInt(),true,false).right(5)+" ";

View File

@ -124,7 +124,7 @@ bool RDReport::ExportTechnical(const QString &filename,const QDate &startdate,
} }
} }
cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt()); cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt());
*strm << rda->timeString(q->value(2).toTime(),true)+" "; *strm << rda->timeString(q->value(2).toTime()," ")+" ";
*strm << cart_num+" "; *strm << cart_num+" ";
*strm << cut+" "; *strm << cut+" ";
*strm << RDReport::leftJustify(q->value(8).toString(),23)+" "; *strm << RDReport::leftJustify(q->value(8).toString(),23)+" ";

View File

@ -112,7 +112,7 @@ bool RDReport::ExportTextLog(const QString &filename,const QDate &startdate,
} }
} }
cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt()); cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt());
*strm << rda->timeString(q->value(2).toTime(),true)+" "; *strm << rda->timeString(q->value(2).toTime()," ")+" ";
*strm << RDReport::rightJustify(cart_num,6)+" "; *strm << RDReport::rightJustify(cart_num,6)+" ";
*strm << cut+" "; *strm << cut+" ";
*strm << RDReport::leftJustify(q->value(8).toString(),23)+" "; *strm << RDReport::leftJustify(q->value(8).toString(),23)+" ";

View File

@ -360,27 +360,46 @@ QString RDCoreApplication::shortDateTimeString(const QDateTime &dt) const
} }
QString RDCoreApplication::timeString(const QTime &time,bool padded) const QString RDCoreApplication::timeString(const QTime &time,
const QString &padding) const
{ {
if(app_show_twelve_hour_time) { if(app_show_twelve_hour_time) {
if(padded) { QString time_str=time.toString(RD_TWELVE_HOUR_FORMAT);
return time.toString(RD_TWELVE_HOUR_PADDED_FORMAT); if(!padding.isEmpty()) {
if((time.hour()==0)||((time.hour()>=10)&&(time.hour()<13))||
(time.hour()>=22)) {
return time_str.left(8)+" "+time_str.right(2);
} }
return time.toString(RD_TWELVE_HOUR_FORMAT); return padding+time_str.left(7)+" "+time_str.right(2);
} }
return time.toString(RD_TWENTYFOUR_HOUR_FORMAT); if((time.hour()==0)||((time.hour()>=10)&&(time.hour()<13))||
(time.hour()>=22)) {
return time_str.left(8)+" "+time_str.right(2);
}
return time_str.left(7)+" "+time_str.right(2);
}
return time.toString(RD_TWENTYFOUR_HOUR_FORMAT).left(10);
} }
QString RDCoreApplication::tenthsTimeString(const QTime &time,bool padded) const QString RDCoreApplication::tenthsTimeString(const QTime &time,
const QString &padding) const
{ {
if(app_show_twelve_hour_time) { if(app_show_twelve_hour_time) {
if(padded) { QString time_str=time.toString(RD_TWELVE_HOUR_TENTHS_FORMAT);
return time.toString(RD_TWELVE_HOUR_TENTHS_PADDED_FORMAT); if(!padding.isEmpty()) {
if((time.hour()==0)||((time.hour()>=10)&&(time.hour()<13))||
(time.hour()>=22)) {
return time_str.left(10)+" "+time_str.right(2);
} }
return time.toString(RD_TWELVE_HOUR_TENTHS_FORMAT); return padding+time_str.left(9)+" "+time_str.right(2);
} }
return time.toString(RD_TWENTYFOUR_HOUR_TENTHS_FORMAT); if(((time.hour()>=10)&&(time.hour()<13))||(time.hour()>=22)) {
return time_str.left(10)+" "+time_str.right(2);
}
return time_str.left(9)+" "+time_str.right(2);
}
return time.toString(RD_TWENTYFOUR_HOUR_TENTHS_FORMAT).left(10);
} }

View File

@ -76,8 +76,8 @@ class RDCoreApplication : public QObject
QString shortDateFormat() const; QString shortDateFormat() const;
QString shortDateString(const QDate &date) const; QString shortDateString(const QDate &date) const;
QString shortDateTimeString(const QDateTime &dt) const; QString shortDateTimeString(const QDateTime &dt) const;
QString timeString(const QTime &time,bool padded=false) const; QString timeString(const QTime &time,const QString &padding="") const;
QString tenthsTimeString(const QTime &time,bool padded=false) const; QString tenthsTimeString(const QTime &time,const QString &padding="") const;
bool dropTable(const QString &tbl_name); bool dropTable(const QString &tbl_name);
void addTempFile(const QString &pathname); void addTempFile(const QString &pathname);
void syslog(int priority,const char *fmt,...) const; void syslog(int priority,const char *fmt,...) const;

View File

@ -381,7 +381,7 @@ int RDLogModel::validate(QString *report,const QDate &date)
rda->shortDateString(now.date())+" - "+ rda->shortDateString(now.date())+" - "+
rda->timeString(now.time())+"\n"; rda->timeString(now.time())+"\n";
*report+=QString("Log: ")+d_log_name+"\n"; *report+=QString("Log: ")+d_log_name+"\n";
*report+=QString("Effective Airdate: ")+date.toString("MM/dd/yyyy")+"\n"; *report+=QString("Effective Airdate: ")+rda->shortDateString(date)+"\n";
*report+="\n"; *report+="\n";
// //
@ -397,7 +397,7 @@ int RDLogModel::validate(QString *report,const QDate &date)
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
if(!q->first()) { if(!q->first()) {
*report+=QString(" ")+ *report+=QString(" ")+
logLine(i)->startTime(RDLogLine::Logged).toString("hh:mm:ss")+ rda->timeString(logLine(i)->startTime(RDLogLine::Logged))+
QString().sprintf(" - missing cart %06d",logLine(i)->cartNumber())+ QString().sprintf(" - missing cart %06d",logLine(i)->cartNumber())+
"\n"; "\n";
errs++; errs++;
@ -1028,18 +1028,17 @@ QString RDLogModel::StartTimeString(int line) const
if(ll!=NULL) { if(ll!=NULL) {
switch(ll->timeType()) { switch(ll->timeType()) {
case RDLogLine::Hard: case RDLogLine::Hard:
return QString("T")+ll->startTime(RDLogLine::Logged). return QString("T")+
toString("hh:mm:ss.zzz").left(10); rda->tenthsTimeString(ll->startTime(RDLogLine::Logged));
break; break;
default: default:
if(d_start_time_style==RDLogModel::Estimated) { if(d_start_time_style==RDLogModel::Estimated) {
if(ll->startTime(RDLogLine::Predicted).isNull()) { if(ll->startTime(RDLogLine::Predicted).isNull()) {
return blockStartTime(line).toString("hh:mm:ss.zzz").left(10); return rda->tenthsTimeString(blockStartTime(line));
} }
else { else {
return ll->startTime(RDLogLine::Predicted). return rda->tenthsTimeString(ll->startTime(RDLogLine::Predicted));
toString("hh:mm:ss.zzz").left(10);
} }
} }
else { // Scheduled else { // Scheduled
@ -1047,8 +1046,7 @@ QString RDLogModel::StartTimeString(int line) const
return QString(""); return QString("");
} }
else { else {
return ll->startTime(RDLogLine::Logged). return rda->tenthsTimeString(ll->startTime(RDLogLine::Logged));
toString("hh:mm:ss.zzz").left(10);
} }
} }
break; break;

View File

@ -221,12 +221,12 @@ void ListReports::GenerateEventReport(QString *report)
switch((RDRecording::StartType)q->value(1).toInt()) { switch((RDRecording::StartType)q->value(1).toInt()) {
case RDRecording::HardStart: case RDRecording::HardStart:
*report+=QString("Hard: ")+ *report+=QString("Hard: ")+
RDReport::leftJustify(rda->timeString(q->value(2).toTime(),true),11)+" "; RDReport::leftJustify(rda->timeString(q->value(2).toTime()," "),11)+" ";
break; break;
case RDRecording::GpiStart: case RDRecording::GpiStart:
*report+=QString("Gpi: ")+ *report+=QString("Gpi: ")+
RDReport::leftJustify(rda->timeString(q->value(2).toTime(),true),11)+" "; RDReport::leftJustify(rda->timeString(q->value(2).toTime()," "),11)+" ";
break; break;
} }
@ -238,12 +238,12 @@ void ListReports::GenerateEventReport(QString *report)
switch((RDRecording::EndType)q->value(3).toInt()) { switch((RDRecording::EndType)q->value(3).toInt()) {
case RDRecording::HardEnd: case RDRecording::HardEnd:
*report+=QString("Hard: ")+ *report+=QString("Hard: ")+
RDReport::leftJustify(rda->timeString(q->value(4).toTime(),true),11)+" "; RDReport::leftJustify(rda->timeString(q->value(4).toTime()," "),11)+" ";
break; break;
case RDRecording::GpiEnd: case RDRecording::GpiEnd:
*report+=QString("Gpi: ")+ *report+=QString("Gpi: ")+
RDReport::leftJustify(rda->timeString(q->value(4).toTime(),true),11)+" "; RDReport::leftJustify(rda->timeString(q->value(4).toTime()," "),11)+" ";
break; break;
case RDRecording::LengthEnd: case RDRecording::LengthEnd:
@ -477,10 +477,10 @@ void ListReports::GenerateXloadReport(QString *report)
// Start Time // Start Time
// //
if(rda->showTwelveHourTime()) { if(rda->showTwelveHourTime()) {
*report+=RDReport::leftJustify(rda->timeString(q->value(1).toTime(),true),11)+" "; *report+=RDReport::leftJustify(rda->timeString(q->value(1).toTime()," "),11)+" ";
} }
else { else {
*report+=RDReport::leftJustify(rda->timeString(q->value(1).toTime(),true),8)+" "; *report+=RDReport::leftJustify(rda->timeString(q->value(1).toTime()," "),8)+" ";
} }
// //

View File

@ -209,7 +209,7 @@ void ListReports::GenerateLogReport(QString *report)
*report+=" "; *report+=" ";
} }
if(!logline->startTime(RDLogLine::Imported).isNull()) { if(!logline->startTime(RDLogLine::Imported).isNull()) {
*report+=RDReport::leftJustify(rda->tenthsTimeString(logline->startTime(RDLogLine::Logged),true),13)+" "; *report+=RDReport::leftJustify(rda->tenthsTimeString(logline->startTime(RDLogLine::Logged),"0"),13)+" ";
} }
else { else {
*report+=" "; *report+=" ";
@ -235,7 +235,7 @@ void ListReports::GenerateLogReport(QString *report)
*report+=" "; *report+=" ";
*report+=" "; *report+=" ";
*report+=" :00 "; *report+=" :00 ";
*report+=RDReport::leftJustify(logline->markerComment(),30)+" "; *report+=RDReport::leftJustify(logline->markerComment(),33)+" ";
*report+=" "; *report+=" ";
break; break;
@ -260,7 +260,8 @@ void ListReports::GenerateLogReport(QString *report)
*report+=" "; *report+=" ";
*report+=" "; *report+=" ";
*report+=" "; *report+=" ";
*report+=RDReport::leftJustify(logline->markerLabel(),30)+" "; *report+=RDReport::leftJustify(logline->markerLabel(),33)+" ";
*report+=" ";
break; break;
case RDLogLine::OpenBracket: case RDLogLine::OpenBracket:

View File

@ -531,7 +531,7 @@ void MainWidget::reportData()
// Voice Tracks // Voice Tracks
// //
report+= report+=
QString().sprintf("%3u/%-3u ",q->value(8).toUInt(),q->value(7).toUInt()); QString().sprintf("%3u/%-3u ",q->value(7).toUInt(),q->value(8).toUInt());
// //
// Start Date // Start Date