JobWriter: add direction change in notes

StationWriter: do the same
Odt: add translation text for direction reverse
This commit is contained in:
Filippo Gentile 2022-02-11 01:45:17 +01:00
parent a005f0f49e
commit 11637625f8
3 changed files with 33 additions and 4 deletions

View file

@ -79,8 +79,8 @@ JobWriter::JobWriter(database &db) :
"stops.departure," "stops.departure,"
"stops.type," "stops.type,"
"stops.description," "stops.description,"
"t1.name," "t1.name, t2.name,"
"t2.name" "g1.track_side, g2.track_side"
" FROM stops" " FROM stops"
" JOIN stations ON stations.id=stops.station_id" " JOIN stations ON stations.id=stops.station_id"
" LEFT JOIN station_gate_connections g1 ON g1.id=stops.in_gate_conn" " LEFT JOIN station_gate_connections g1 ON g1.id=stops.in_gate_conn"
@ -685,6 +685,19 @@ void JobWriter::writeJob(QXmlStreamWriter& xml, db_id jobId, JobCategory jobCat)
if(trackName.isEmpty()) if(trackName.isEmpty())
trackName = stop.get<QString>(8); //Use out gate to get track name trackName = stop.get<QString>(8); //Use out gate to get track name
utils::Side entranceSide = utils::Side(stop.get<int>(9));
utils::Side exitSide = utils::Side(stop.get<int>(10));
if(entranceSide == exitSide && stop.column_type(9) != SQLITE_NULL && stop.column_type(10) != SQLITE_NULL)
{
//Train enters and leaves from same track side, add reversal to description
QString descr2 = Odt::text(Odt::jobReverseDirection);
if(!descr.isEmpty())
descr2.append('\n'); //Separate from manually set description
descr2.append(descr);
descr = descr2;
}
const bool isTransit = stopType == 1; const bool isTransit = stopType == 1;
qDebug() << "(Loop) Job:" << jobId << "Stop:" << stopId; qDebug() << "(Loop) Job:" << jobId << "Stop:" << stopId;

View file

@ -132,6 +132,9 @@ public:
static constexpr Text jobStopPassingsShort = QT_TRANSLATE_NOOP3("Odt", "Passes", "Job stop passings abbreviated column"); static constexpr Text jobStopPassingsShort = QT_TRANSLATE_NOOP3("Odt", "Passes", "Job stop passings abbreviated column");
static constexpr Text notes = QT_TRANSLATE_NOOP3("Odt", "Notes", "Job stop table"); static constexpr Text notes = QT_TRANSLATE_NOOP3("Odt", "Notes", "Job stop table");
//Job stops
static constexpr Text jobReverseDirection = QT_TRANSLATE_NOOP3("Odt", "Reverse direction", "Job stop table");
//Shift //Shift
static constexpr Text shiftCoverTitle = QT_TRANSLATE_NOOP3("Odt", "SHIFT %1", "Shift title in shift sheet cover"); static constexpr Text shiftCoverTitle = QT_TRANSLATE_NOOP3("Odt", "SHIFT %1", "Shift title in shift sheet cover");
static constexpr Text shiftDocTitle = QT_TRANSLATE_NOOP3("Odt", "Shift %1", "Shift sheet document title for metadata"); static constexpr Text shiftDocTitle = QT_TRANSLATE_NOOP3("Odt", "Shift %1", "Shift sheet document title for metadata");

View file

@ -64,8 +64,8 @@ StationWriter::StationWriter(database &db) :
"stops.departure," "stops.departure,"
"stops.type," "stops.type,"
"stops.description," "stops.description,"
"t1.name," "t1.name, t2.name,"
"t2.name" "g1.track_side, g2.track_side"
" FROM stops" " FROM stops"
" JOIN jobs ON jobs.id=stops.job_id" " JOIN jobs ON jobs.id=stops.job_id"
" LEFT JOIN station_gate_connections g1 ON g1.id=stops.in_gate_conn" " LEFT JOIN station_gate_connections g1 ON g1.id=stops.in_gate_conn"
@ -408,6 +408,19 @@ void StationWriter::writeStation(QXmlStreamWriter &xml, db_id stationId, QString
if(stop.platform.isEmpty()) if(stop.platform.isEmpty())
stop.platform = r.get<QString>(8); //Use out gate to get track name stop.platform = r.get<QString>(8); //Use out gate to get track name
utils::Side entranceSide = utils::Side(r.get<int>(9));
utils::Side exitSide = utils::Side(r.get<int>(10));
if(entranceSide == exitSide && r.column_type(9) != SQLITE_NULL && r.column_type(10) != SQLITE_NULL)
{
//Train enters and leaves from same track side, add reversal to description
QString descr2 = Odt::text(Odt::jobReverseDirection);
if(!stop.description.isEmpty())
descr2.append('\n'); //Separate from manually set description
descr2.append(stop.description);
stop.description = descr2;
}
const bool isTransit = stopType == 1; const bool isTransit = stopType == 1;
//BIG TODO: if this is First or Last stop of this job //BIG TODO: if this is First or Last stop of this job