Skip to content

Commit 1665a12

Browse files
committed
Fixed time AM/PM are not translated
1 parent df7db5f commit 1665a12

File tree

7 files changed

+14
-28
lines changed

7 files changed

+14
-28
lines changed

models/AlertTableModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ QVariant AlertTableModel::data(const QModelIndex& index, int role) const
2929
case COLUMN_FREQ: return QSTRING_FREQ(selectedRecord.alert.spot.freq);
3030
case COLUMN_MODE: return selectedRecord.alert.spot.modeGroupString;
3131
case COLUMN_UPDATED: return selectedRecord.counter;
32-
case COLUMN_LAST_UPDATE: return selectedRecord.alert.spot.dateTime.toString(locale.formatTimeLongWithoutTZ());
32+
case COLUMN_LAST_UPDATE: return locale.toString(selectedRecord.alert.spot.dateTime,locale.formatTimeLongWithoutTZ());
3333
case COLUMN_LAST_COMMENT: return selectedRecord.alert.spot.comment;
3434
case COLUMN_MEMBER: return selectedRecord.alert.spot.memberList2StringList().join(",");
3535
default: return QVariant();

ui/BandmapWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void BandmapWidget::updateStations()
219219
QPen(QColor(192,192,192))));
220220

221221
const QString &callsignTmp = lower.value().callsign;
222-
const QString &timeTmp = lower.value().dateTime.toString(locale.formatTimeShort());
222+
const QString &timeTmp = locale.toString(lower.value().dateTime, locale.formatTimeShort());
223223

224224
QGraphicsTextItem* text = bandmapScene->addText(callsignTmp + " @ " + timeTmp);
225225
text->document()->setDocumentMargin(0);

ui/ClockWidget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void ClockWidget::updateClock()
4949
QDateTime now = QDateTime::currentDateTime().toTimeZone(QTimeZone::utc());
5050
QColor textColor = qApp->palette().color(QPalette::Text);
5151
clockItem->setDefaultTextColor(textColor);
52-
clockItem->setPlainText(now.toString(locale.formatTimeLongWithoutTZ()));
52+
clockItem->setPlainText(locale.toString(now, locale.formatTimeLongWithoutTZ()));
5353

5454
if (now.time().second() == 0)
5555
{
@@ -95,8 +95,8 @@ void ClockWidget::updateSun()
9595
sunrise = QTime::fromMSecsSinceStartOfDay(static_cast<int>(fmod(Jrise, 1.0) * MSECS_PER_DAY));
9696
sunset = QTime::fromMSecsSinceStartOfDay(static_cast<int>(fmod(Jset, 1.0) * MSECS_PER_DAY));
9797

98-
ui->sunRiseLabel->setText(sunrise.toString(locale.formatTimeShort()));
99-
ui->sunSetLabel->setText(sunset.toString(locale.formatTimeShort()));
98+
ui->sunRiseLabel->setText(locale.toString(sunrise, locale.formatTimeShort()));
99+
ui->sunSetLabel->setText(locale.toString(sunset, locale.formatTimeShort()));
100100
}
101101
else
102102
{

ui/DxWidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ QVariant DxTableModel::data(const QModelIndex& index, int role) const
5959
switch ( index.column() )
6060
{
6161
case 0:
62-
return spot.dateTime.toString(locale.formatTimeLongWithoutTZ());
62+
return locale.toString(spot.dateTime, locale.formatTimeLongWithoutTZ());
6363
case 1:
6464
return spot.callsign;
6565
case 2:
@@ -174,7 +174,7 @@ QVariant WCYTableModel::data(const QModelIndex& index, int role) const
174174
switch ( index.column() )
175175
{
176176
case 0:
177-
return spot.time.toString(locale.formatTimeLongWithoutTZ());
177+
return locale.toString(spot.time, locale.formatTimeLongWithoutTZ());
178178
case 1:
179179
return spot.KIndex;
180180
case 2:
@@ -252,7 +252,7 @@ QVariant WWVTableModel::data(const QModelIndex& index, int role) const
252252
switch ( index.column() )
253253
{
254254
case 0:
255-
return spot.time.toString(locale.formatTimeLongWithoutTZ());
255+
return locale.toString(spot.time, locale.formatTimeLongWithoutTZ());
256256
case 1:
257257
return spot.SFI;
258258
case 2:
@@ -317,7 +317,7 @@ QVariant ToAllTableModel::data(const QModelIndex& index, int role) const
317317

318318
switch (index.column()) {
319319
case 0:
320-
return spot.time.toString(locale.formatTimeLongWithoutTZ());
320+
return locale.toString(spot.time, locale.formatTimeLongWithoutTZ());
321321
case 1:
322322
return spot.spotter;
323323
case 2:

ui/ImportDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void ImportDialog::saveImportDetails(const QString &importDetail, const QString
215215
QTextStream out(&file);
216216
out << tr("QLog Import Summary") << "\n"
217217
<< "\n"
218-
<< tr("Import date") << ": " << currTime.toString(locale.formatDateShortWithYYYY()) << " " << currTime.toString(locale.formatTimeLongWithoutTZ()) << " UTC\n"
218+
<< tr("Import date") << ": " << currTime.toString(locale.formatDateShortWithYYYY()) << " " << locale.toString(currTime, locale.formatTimeLongWithoutTZ()) << " UTC\n"
219219
<< tr("Imported file") << ": " << filename
220220
<< "\n\n"
221221
<< tr("Imported: %n contact(s)", "", count) << "\n"

ui/NewContactWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2199,7 +2199,7 @@ void NewContactWidget::updatePartnerLocTime()
21992199

22002200
if ( partnerTimeZone.isValid() )
22012201
{
2202-
ui->partnerLocTimeInfo->setText(QDateTime::currentDateTime().toTimeZone(partnerTimeZone).toString(locale.formatTimeLong())
2202+
ui->partnerLocTimeInfo->setText(locale.toString(QDateTime::currentDateTime().toTimeZone(partnerTimeZone), locale.formatTimeLong())
22032203
+ " (" + getGreeting() +")");
22042204
}
22052205
}

ui/StyleItemDelegate.h

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,6 @@ class DateFormatDelegate : public QStyledItemDelegate {
8888
}
8989
};
9090

91-
class TimeFormatDelegate : public QStyledItemDelegate {
92-
private:
93-
LogLocale locale;
94-
public:
95-
TimeFormatDelegate(QObject* parent = 0) :
96-
QStyledItemDelegate(parent) { }
97-
98-
QString displayText(const QVariant& value, const QLocale&) const
99-
{
100-
// own Locale
101-
102-
return value.toTime().toString(locale.formatTimeLongWithoutTZ());
103-
}
104-
};
105-
10691
class TimestampFormatDelegate : public QStyledItemDelegate {
10792
private:
10893
LogLocale locale;
@@ -112,8 +97,9 @@ class TimestampFormatDelegate : public QStyledItemDelegate {
11297

11398
QString displayText(const QVariant& value, const QLocale&) const
11499
{
115-
// own Locale
116-
return value.toDateTime().toTimeZone(QTimeZone::utc()).toString(locale.formatDateShortWithYYYY() + " " + locale.formatTimeLongWithoutTZ());
100+
return locale.toString(value.toDateTime().toTimeZone(QTimeZone::utc()), locale.formatDateShortWithYYYY()
101+
+ " "
102+
+ locale.formatTimeLongWithoutTZ());
117103
}
118104

119105
QWidget* createEditor(QWidget* parent,

0 commit comments

Comments
 (0)