Skip to content

Commit

Permalink
BUG: Make DICOM database table view headings translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
lassoan committed Apr 5, 2023
1 parent 66e8146 commit b6c829e
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion Libs/DICOM/Widgets/ctkDICOMTableView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,52 @@
#include <QSqlQuery>
#include <QSqlQueryModel>

//------------------------------------------------------------------------------
// List all column names for translation.
// They are specified in DisplayedName column of ColumnDisplayProperties table,
// (for example in dicom-schema.sql and dicom-qr-schema.sql) but Qt's lupdate
// tool cannot parse these files, therefore we need to list them here.
static const char* DisplayedColumnNames[] =
{
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Patient name"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Patient ID"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Birth date"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Birth time"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Sex"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Age"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Comments"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Date added"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Patient name"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Studies"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Last study date"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Study ID"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Study date"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Study time"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Study description"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Accession #"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Modalities"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Institution"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Referring physician"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Performing physician"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Date added"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Series"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Series #"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Series date"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Series time"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Series description"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Modality"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Body part"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Acquisition #"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Contrast agent"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Scanning sequence"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Echo #"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Temporal position"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Date added"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Size"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Count"),
QT_TRANSLATE_NOOP("ctkDICOMTableView", "Number of frames"),
};

//------------------------------------------------------------------------------
class ctkDICOMTableViewPrivate : public Ui_ctkDICOMTableView
{
Expand Down Expand Up @@ -195,7 +241,7 @@ void ctkDICOMTableViewPrivate::applyColumnProperties()
}

// Apply displayed name
QString displayedName = this->dicomDatabase->displayedNameForField(this->queryTableName, columnName);
QString displayedName = ctkDICOMTableView::tr(this->dicomDatabase->displayedNameForField(this->queryTableName, columnName).toUtf8());
this->dicomSQLModel.setHeaderData(col, Qt::Horizontal, displayedName, Qt::DisplayRole);

// Apply visibility
Expand Down

0 comments on commit b6c829e

Please sign in to comment.