diff --git a/MetaDataRegistry.cpp b/MetaDataRegistry.cpp index bf2aab5d4..6ce9a7f92 100644 --- a/MetaDataRegistry.cpp +++ b/MetaDataRegistry.cpp @@ -15,6 +15,7 @@ #include "models/IARURegions.hpp" #include "models/DecodeHighlightingModel.hpp" #include "widgets/FrequencyLineEdit.hpp" +#include "widgets/DateTimeEdit.hpp" QItemEditorFactory * item_editor_factory () { @@ -34,6 +35,9 @@ void register_types () item_editor_factory ()->registerEditor (qMetaTypeId (), new QStandardItemEditorCreator ()); //auto frequency_delta_type_id = qRegisterMetaType ("FrequencyDelta"); item_editor_factory ()->registerEditor (qMetaTypeId (), new QStandardItemEditorCreator ()); + auto factory = new QItemEditorFactory; + factory->registerEditor (qMetaTypeId (), new QStandardItemEditorCreator ()); + QItemEditorFactory::setDefaultFactory (factory); // Frequency list model qRegisterMetaTypeStreamOperators ("Item_v2"); diff --git a/item_delegates/DateTimeAsSecsSinceEpochDelegate.hpp b/item_delegates/DateTimeAsSecsSinceEpochDelegate.hpp deleted file mode 100644 index a666ed323..000000000 --- a/item_delegates/DateTimeAsSecsSinceEpochDelegate.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef DATE_TIME_AS_SECS_SINCE_EPOCH_DELEGATE_HPP_ -#define DATE_TIME_AS_SECS_SINCE_EPOCH_DELEGATE_HPP_ - -#include -#include -#include -#include -#include -#include -#include - -class DateTimeAsSecsSinceEpochDelegate final - : public QStyledItemDelegate -{ -public: - DateTimeAsSecsSinceEpochDelegate (QObject * parent = nullptr) - : QStyledItemDelegate {parent} - { - } - - static QVariant to_secs_since_epoch (QDateTime const& date_time) - { - return date_time.toMSecsSinceEpoch () / 1000ull; - } - - static QDateTime to_date_time (QModelIndex const& index, int role = Qt::DisplayRole) - { - return to_date_time (index.model ()->data (index, role)); - } - - static QDateTime to_date_time (QVariant const& value) - { - return QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC); - } - - QString displayText (QVariant const& value, QLocale const& locale) const override - { - 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 - { - std::unique_ptr editor {new QDateTimeEdit {parent}}; - editor->setDisplayFormat (parent->locale ().dateFormat (QLocale::ShortFormat) + " hh:mm:ss"); - 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 - { - static_cast (editor)->setDateTime (to_date_time (index, Qt::EditRole)); - } - - void setModelData (QWidget * editor, QAbstractItemModel * model, QModelIndex const& index) const override - { - model->setData (index, to_secs_since_epoch (static_cast (editor)->dateTime ())); - } - - void updateEditorGeometry (QWidget * editor, QStyleOptionViewItem const& option, QModelIndex const& /*index*/) const override - { - editor->setGeometry (option.rect); - } -}; - -#endif diff --git a/item_delegates/item_delegates.pri b/item_delegates/item_delegates.pri index 153ad4271..026e1ca57 100644 --- a/item_delegates/item_delegates.pri +++ b/item_delegates/item_delegates.pri @@ -8,5 +8,4 @@ HEADERS += \ item_delegates/ForeignKeyDelegate.hpp \ item_delegates/FrequencyItemDelegate.hpp \ item_delegates/CallsignDelegate.hpp \ - item_delegates/MaidenheadLocatorDelegate.hpp \ - item_delegates/DateTimeAsSecsSinceEpochDelegate.hpp + item_delegates/MaidenheadLocatorDelegate.hpp diff --git a/models/CabrilloLog.cpp b/models/CabrilloLog.cpp index 1fee9b148..6849cdd61 100644 --- a/models/CabrilloLog.cpp +++ b/models/CabrilloLog.cpp @@ -21,6 +21,23 @@ class CabrilloLog::impl final public: impl (Configuration const *); + QVariant data (QModelIndex const& index, int role) const + { + auto value = QSqlTableModel::data (index, role); + if (index.column () == fieldIndex ("when") + && (Qt::DisplayRole == role || Qt::EditRole == role)) + { + auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC); + if (Qt::DisplayRole == role) + { + QLocale locale; + return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss"); + } + value = t; + } + return value; + } + QString cabrillo_frequency_string (Radio::Frequency frequency) const; Configuration const * configuration_; diff --git a/models/FoxLog.cpp b/models/FoxLog.cpp index 773a5308f..debb08afc 100644 --- a/models/FoxLog.cpp +++ b/models/FoxLog.cpp @@ -21,6 +21,23 @@ class FoxLog::impl final public: impl (Configuration const * configuration); + QVariant data (QModelIndex const& index, int role) const + { + auto value = QSqlTableModel::data (index, role); + if (index.column () == fieldIndex ("when") + && (Qt::DisplayRole == role || Qt::EditRole == role)) + { + auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC); + if (Qt::DisplayRole == role) + { + QLocale locale; + return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss"); + } + value = t; + } + return value; + } + Configuration const * configuration_; QSqlQuery mutable dupe_query_; QSqlQuery mutable export_query_; diff --git a/widgets/CabrilloLogWindow.cpp b/widgets/CabrilloLogWindow.cpp index 44a52cc6b..2f7b44d4a 100644 --- a/widgets/CabrilloLogWindow.cpp +++ b/widgets/CabrilloLogWindow.cpp @@ -6,7 +6,6 @@ #include "Configuration.hpp" #include "models/Bands.hpp" #include "item_delegates/ForeignKeyDelegate.hpp" -#include "item_delegates/DateTimeAsSecsSinceEpochDelegate.hpp" #include "item_delegates/CallsignDelegate.hpp" #include "pimpl_impl.hpp" @@ -64,7 +63,6 @@ CabrilloLogWindow::CabrilloLogWindow (QSettings * settings, Configuration const m_->format_model_.setSourceModel (m_->log_model_); m_->ui_.log_table_view->setModel (&m_->format_model_); set_log_view (m_->ui_.log_table_view); - m_->ui_.log_table_view->setItemDelegateForColumn (2, new DateTimeAsSecsSinceEpochDelegate {this}); m_->ui_.log_table_view->setItemDelegateForColumn (3, new CallsignDelegate {this}); m_->ui_.log_table_view->setItemDelegateForColumn (6, new ForeignKeyDelegate {configuration->bands (), 0, this}); auto h_header = m_->ui_.log_table_view->horizontalHeader (); diff --git a/widgets/CabrilloLogWindow.ui b/widgets/CabrilloLogWindow.ui index efefe5d3c..35b4d597d 100644 --- a/widgets/CabrilloLogWindow.ui +++ b/widgets/CabrilloLogWindow.ui @@ -19,6 +19,9 @@ <html><head/><body><p>Right-click here for available actions.</p></body></html> + + Right-click here for available actions. + true diff --git a/widgets/FoxLogWindow.cpp b/widgets/FoxLogWindow.cpp index 36f20b85b..9c29a30ad 100644 --- a/widgets/FoxLogWindow.cpp +++ b/widgets/FoxLogWindow.cpp @@ -13,7 +13,6 @@ #include "models/Bands.hpp" #include "models/FoxLog.hpp" #include "item_delegates/ForeignKeyDelegate.hpp" -#include "item_delegates/DateTimeAsSecsSinceEpochDelegate.hpp" #include "item_delegates/CallsignDelegate.hpp" #include "item_delegates/MaidenheadLocatorDelegate.hpp" #include "pimpl_impl.hpp" @@ -42,7 +41,6 @@ FoxLogWindow::FoxLogWindow (QSettings * settings, Configuration const * configur m_->ui_.setupUi (this); m_->ui_.log_table_view->setModel (m_->log_->model ()); set_log_view (m_->ui_.log_table_view); - m_->ui_.log_table_view->setItemDelegateForColumn (1, new DateTimeAsSecsSinceEpochDelegate {this}); m_->ui_.log_table_view->setItemDelegateForColumn (2, new CallsignDelegate {this}); m_->ui_.log_table_view->setItemDelegateForColumn (3, new MaidenheadLocatorDelegate {this}); m_->ui_.log_table_view->setItemDelegateForColumn (6, new ForeignKeyDelegate {configuration->bands (), 0, this}); diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index 0942dc750..75be401d0 100644 --- a/widgets/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -340,7 +340,7 @@ - <html><head/><body><p>Enter this QSO in log</p></body></html> + Enter this QSO in log Log &QSO @@ -372,7 +372,7 @@ - <html><head/><body><p>Toggle monitoring On/Off</p></body></html> + Toggle monitoring On/Off QPushButton:checked { @@ -407,6 +407,9 @@ <html><head/><body><p>Erase right window. Double-click to erase both windows.</p></body></html> + + Erase right window. Double-click to erase both windows. + &Erase @@ -420,6 +423,9 @@ <html><head/><body><p>Clear the accumulating message average.</p></body></html> + + Clear the accumulating message average. + Clear Avg @@ -436,6 +442,9 @@ <html><head/><body><p>Decode most recent Rx period at QSO Frequency</p></body></html> + + Decode most recent Rx period at QSO Frequency + QPushButton:checked { background-color: cyan; @@ -466,6 +475,9 @@ <html><head/><body><p>Toggle Auto-Tx On/Off</p></body></html> + + Toggle Auto-Tx On/Off + QPushButton:checked { background-color: red; @@ -506,6 +518,9 @@ <html><head/><body><p>Toggle a pure Tx tone On/Off</p></body></html> + + Toggle a pure Tx tone On/Off + QPushButton:checked { background-color: red; @@ -590,6 +605,15 @@ QLabel[oob="true"] { <html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html> + + Rx Signal + + + 30dB recommended when only noise present +Green when good +Red when clipping may occur +Yellow when too low + QFrame::Panel @@ -706,6 +730,9 @@ QLabel[oob="true"] { 2 + + dxCallEntry + @@ -795,6 +822,9 @@ QLabel[oob="true"] { 2 + + dxGridEntry + @@ -883,6 +913,9 @@ QLabel[oob="true"] { <html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html> + + If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode. + QPushButton { font-family: helvetica; @@ -947,6 +980,12 @@ QPushButton[state="ok"] { <html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html> + + Frequncy entry + + + Select operating band or enter frequency in MHz or enter kHz increment followed by k. + true @@ -1038,6 +1077,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Check to keep Tx frequency fixed when double-clicking on decoded text.</p></body></html> + + Check to keep Tx frequency fixed when double-clicking on decoded text. + Hold Tx Freq @@ -1155,6 +1197,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Synchronizing threshold. Lower numbers accept weaker sync signals.</p></body></html> + + Synchronizing threshold. Lower numbers accept weaker sync signals. + Qt::AlignCenter @@ -1179,6 +1224,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Check to use short-format messages.</p></body></html> + + Check to use short-format messages. + Sh @@ -1189,6 +1237,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Check to enable JT9 fast modes</p></body></html> + + Check to enable JT9 fast modes + Fast @@ -1199,6 +1250,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Check to enable automatic sequencing of Tx messages based on received messages.</p></body></html> + + Check to enable automatic sequencing of Tx messages based on received messages. + Auto Seq @@ -1209,6 +1263,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Check to call the first decoded responder to my CQ.</p></body></html> + + Check to call the first decoded responder to my CQ. + Call 1st @@ -1234,6 +1291,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences.</p></body></html> + + Check to Tx in even-numbered minutes or sequences, starting at 0; uncheck for odd sequences. + Tx even/1st @@ -1249,6 +1309,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Frequency to call CQ on in kHz above the current MHz</p></body></html> + + Frequency to call CQ on in kHz above the current MHz + Tx CQ @@ -1271,6 +1334,10 @@ QPushButton[state="ok"] { <html><head/><body><p>Check this to call CQ on the &quot;Tx CQ&quot; frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on.</p><p>Not available to nonstandard callsign holders.</p></body></html> + + Check this to call CQ on the "Tx CQ" frequency. Rx will be on the current frequency and the CQ message wiill include the current Rx frequency so callers know which frequency to reply on. +Not available to nonstandard callsign holders. + @@ -1290,6 +1357,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Submode determines tone spacing; A is narrowest.</p></body></html> + + Submode determines tone spacing; A is narrowest. + Qt::AlignCenter @@ -1333,6 +1403,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Check to monitor Sh messages.</p></body></html> + + Check to monitor Sh messages. + SWL @@ -1364,6 +1437,11 @@ QPushButton[state="ok"] { <html><head/><body><p>Check this to start recording calibration data.<br/>While measuring calibration correction is disabled.<br/>When not checked you can view the calibration results.</p></body></html> + + Check this to start recording calibration data. +While measuring calibration correction is disabled. +When not checked you can view the calibration results. + Measure @@ -1376,6 +1454,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB).</p></body></html> + + Signal report: Signal-to-noise ratio in 2500 Hz reference bandwidth (dB). + Qt::AlignCenter @@ -1398,6 +1479,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Tx/Rx or Frequency calibration sequence length</p></body></html> + + Tx/Rx or Frequency calibration sequence length + Qt::AlignCenter @@ -1496,6 +1580,9 @@ QPushButton[state="ok"] { <html><head/><body><p>Double-click on another caller to queue that call for your next QSO.</p></body></html> + + Double-click on another caller to queue that call for your next QSO. + Next Call @@ -1551,6 +1638,10 @@ QPushButton[state="ok"] { <html><head/><body><p>Send this message in next Tx interval</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html> + + Send this message in next Tx interval +Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders) + margin-left: 10%; margin-right: 0% @@ -1586,6 +1677,10 @@ QPushButton[state="ok"] { <html><head/><body><p>Switch to this Tx message NOW</p><p>Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders)</p></body></html> + + Switch to this Tx message NOW +Double click to toggle the use of the Tx1 message to start a QSO with a station (not allowed for type 1 compound call holders) + Qt::LeftToRight @@ -1627,6 +1722,10 @@ QPushButton[state="ok"] { <html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to reset to the standard 73 message</p></body></html> + + Send this message in next Tx interval +Double-click to reset to the standard 73 message + margin-left: 10%; margin-right: 0% @@ -1675,6 +1774,11 @@ QPushButton[state="ok"] { <html><head/><body><p>Send this message in next Tx interval</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html> + + Send this message in next Tx interval +Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type 2 compound call holders) +RR73 messages should only be used when you are reasonably confident that no message repetitions will be required + margin-left: 10%; margin-right: 0% @@ -1691,6 +1795,11 @@ QPushButton[state="ok"] { <html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders)</p><p>RR73 messages should only be used when you are reasonably confident that no message repetitions will be required</p></body></html> + + Switch to this Tx message NOW +Double-click to toggle between RRR and RR73 messages in Tx4 (not allowed for type2 compound call holders) +RR73 messages should only be used when you are reasonably confident that no message repetitions will be required + padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% @@ -1707,6 +1816,10 @@ QPushButton[state="ok"] { <html><head/><body><p>Switch to this Tx message NOW</p><p>Double-click to reset to the standard 73 message</p></body></html> + + Switch to this Tx message NOW +Double-click to reset to the standard 73 message + padding-left: 15%; padding-right: 15%; padding-top: 3%; padding-bottom: 3% @@ -2524,6 +2637,9 @@ list. The list can be maintained in Settings (F2). <html><head/><body><p>6 digit locators cause 2 different mesages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol.</p></body></html> + + 6 digit locators cause 2 different mesages to be sent, the second contains the full locator but only a hashed callsign, other stations must have decoded the first once before they can decode your call in the second. Check this option to only send 4 digit locators if it will avoid the two message protocol. + Prefer type 1 messages @@ -3306,14 +3422,6 @@ list. The list can be maintained in Settings (F2). Fox log - - - Reset Fox log ... - - - <html><head/><body><p>Ths will erase the file FoxQSO.txt and delete the Fox log file which is used for dupe detection.</p></body></html> - - FT8 DXpedition Mode User Guide diff --git a/widgets/widgets.pri b/widgets/widgets.pri index 24ddd5a3c..eef0c7857 100644 --- a/widgets/widgets.pri +++ b/widgets/widgets.pri @@ -19,7 +19,8 @@ HEADERS += \ widgets/echoplot.h widgets/echograph.h widgets/fastgraph.h \ widgets/fastplot.h widgets/MessageBox.hpp widgets/colorhighlighting.h \ widgets/ExportCabrillo.h widgets/AbstractLogWindow.hpp \ - widgets/FoxLogWindow.hpp widgets/CabrilloLogWindow.hpp + widgets/FoxLogWindow.hpp widgets/CabrilloLogWindow.hpp \ + widgets/DateTimeEdit.hpp FORMS += \ widgets/mainwindow.ui widgets/about.ui \