mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-09-02 13:17:49 -04:00
Fixes several QDateTime time spec issues that effected contest logs and Cabrillo exports
This commit is contained in:
parent
42d68ff84e
commit
94bbe52c73
@ -1,8 +1,10 @@
|
|||||||
#ifndef DATE_TIME_AS_SECS_SINCE_EPOCH_DELEGATE_HPP_
|
#ifndef DATE_TIME_AS_SECS_SINCE_EPOCH_DELEGATE_HPP_
|
||||||
#define DATE_TIME_AS_SECS_SINCE_EPOCH_DELEGATE_HPP_
|
#define DATE_TIME_AS_SECS_SINCE_EPOCH_DELEGATE_HPP_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <QLocale>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QDateTimeEdit>
|
#include <QDateTimeEdit>
|
||||||
@ -33,12 +35,16 @@ public:
|
|||||||
|
|
||||||
QString displayText (QVariant const& value, QLocale const& locale) const override
|
QString displayText (QVariant const& value, QLocale const& locale) const override
|
||||||
{
|
{
|
||||||
return locale.toString (to_date_time (value), QLocale::ShortFormat);
|
return locale.toString (to_date_time (value), locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const& /*option*/, QModelIndex const& /*index*/) const override
|
QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const& /*option*/, QModelIndex const& /*index*/) const override
|
||||||
{
|
{
|
||||||
return new QDateTimeEdit {parent};
|
std::unique_ptr<QDateTimeEdit> editor {new QDateTimeEdit {parent}};
|
||||||
|
editor->setTimeSpec (Qt::UTC); // needed because it ignores time
|
||||||
|
// spec of the QDateTime that it is
|
||||||
|
// set from
|
||||||
|
return editor.release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEditorData (QWidget * editor, QModelIndex const& index) const override
|
void setEditorData (QWidget * editor, QModelIndex const& index) const override
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDebug>
|
|
||||||
#include "Configuration.hpp"
|
#include "Configuration.hpp"
|
||||||
#include "Bands.hpp"
|
#include "Bands.hpp"
|
||||||
#include "qt_db_helpers.hpp"
|
#include "qt_db_helpers.hpp"
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "logbook/logbook.h"
|
#include "logbook/logbook.h"
|
||||||
#include "MessageBox.hpp"
|
#include "MessageBox.hpp"
|
||||||
|
@ -81,6 +81,9 @@
|
|||||||
<property name="displayFormat">
|
<property name="displayFormat">
|
||||||
<string>dd/MM/yyyy HH:mm:ss</string>
|
<string>dd/MM/yyyy HH:mm:ss</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="timeSpec">
|
||||||
|
<enum>Qt::UTC</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -113,6 +116,9 @@
|
|||||||
<property name="displayFormat">
|
<property name="displayFormat">
|
||||||
<string>dd/MM/yyyy HH:mm:ss</string>
|
<string>dd/MM/yyyy HH:mm:ss</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="timeSpec">
|
||||||
|
<enum>Qt::UTC</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -188,7 +188,7 @@ namespace
|
|||||||
|
|
||||||
int ms_minute_error ()
|
int ms_minute_error ()
|
||||||
{
|
{
|
||||||
auto const& now = QDateTime::currentDateTime ();
|
auto const& now = QDateTime::currentDateTimeUtc ();
|
||||||
auto const& time = now.time ();
|
auto const& time = now.time ();
|
||||||
auto second = time.second ();
|
auto second = time.second ();
|
||||||
return now.msecsTo (now.addSecs (second > 30 ? 60 - second : -second)) - time.msec ();
|
return now.msecsTo (now.addSecs (second > 30 ? 60 - second : -second)) - time.msec ();
|
||||||
@ -1508,7 +1508,7 @@ QString MainWindow::save_wave_file (QString const& name, short const * data, int
|
|||||||
BWFFile::InfoDictionary list_info {
|
BWFFile::InfoDictionary list_info {
|
||||||
{{{'I','S','R','C'}}, source.toLocal8Bit ()},
|
{{{'I','S','R','C'}}, source.toLocal8Bit ()},
|
||||||
{{{'I','S','F','T'}}, program_title (revision ()).simplified ().toLocal8Bit ()},
|
{{{'I','S','F','T'}}, program_title (revision ()).simplified ().toLocal8Bit ()},
|
||||||
{{{'I','C','R','D'}}, QDateTime::currentDateTime ()
|
{{{'I','C','R','D'}}, QDateTime::currentDateTimeUtc ()
|
||||||
.toString ("yyyy-MM-ddTHH:mm:ss.zzzZ").toLocal8Bit ()},
|
.toString ("yyyy-MM-ddTHH:mm:ss.zzzZ").toLocal8Bit ()},
|
||||||
{{{'I','C','M','T'}}, comment.toLocal8Bit ()},
|
{{{'I','C','M','T'}}, comment.toLocal8Bit ()},
|
||||||
};
|
};
|
||||||
@ -2712,7 +2712,7 @@ void MainWindow::msgAvgDecode2()
|
|||||||
|
|
||||||
void MainWindow::decode() //decode()
|
void MainWindow::decode() //decode()
|
||||||
{
|
{
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTimeUtc ();
|
||||||
if( m_dateTimeLastTX.isValid () ) {
|
if( m_dateTimeLastTX.isValid () ) {
|
||||||
qint64 isecs_since_tx = m_dateTimeLastTX.secsTo(now);
|
qint64 isecs_since_tx = m_dateTimeLastTX.secsTo(now);
|
||||||
dec_data.params.lapcqonly= (isecs_since_tx > 600);
|
dec_data.params.lapcqonly= (isecs_since_tx > 600);
|
||||||
@ -3266,7 +3266,7 @@ void MainWindow::pskPost (DecodedText const& decodedtext)
|
|||||||
if(grid.contains (grid_regexp)) {
|
if(grid.contains (grid_regexp)) {
|
||||||
// qDebug() << "To PSKreporter:" << deCall << grid << frequency << msgmode << snr;
|
// qDebug() << "To PSKreporter:" << deCall << grid << frequency << msgmode << snr;
|
||||||
psk_Reporter->addRemoteStation(deCall,grid,QString::number(frequency),msgmode,
|
psk_Reporter->addRemoteStation(deCall,grid,QString::number(frequency),msgmode,
|
||||||
QString::number(snr),QString::number(QDateTime::currentDateTime().toTime_t()));
|
QString::number(snr),QString::number(QDateTime::currentDateTimeUtc ().toTime_t()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3399,7 +3399,7 @@ void MainWindow::guiUpdate()
|
|||||||
if(m_tune) m_bTxTime=true; //"Tune" takes precedence
|
if(m_tune) m_bTxTime=true; //"Tune" takes precedence
|
||||||
|
|
||||||
if(m_transmitting or m_auto or m_tune) {
|
if(m_transmitting or m_auto or m_tune) {
|
||||||
m_dateTimeLastTX = QDateTime::currentDateTime ();
|
m_dateTimeLastTX = QDateTime::currentDateTimeUtc ();
|
||||||
|
|
||||||
// Check for "txboth" (testing purposes only)
|
// Check for "txboth" (testing purposes only)
|
||||||
QFile f(m_appDir + "/txboth");
|
QFile f(m_appDir + "/txboth");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user