From 947b429723a89284e782bfee8b2984eec132cc35 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Wed, 7 Nov 2018 17:49:45 +0000 Subject: [PATCH] Start implememntation of database based Fox log model and a new Fox log window widget This change incorporates a reorganization of the GUI code with widgets, validators, models, and item delegates being moved to sub-directories. Relax the requirements of the ForeignKeyDelegate and related CandidateKeyFilter classes to allow them to work with constant model pointers for both referenced and referencing models. --- CMakeLists.txt | 116 ++-- Configuration.cpp | 38 +- Configuration.hpp | 2 +- Configuration.ui | 10 +- MetaDataRegistry.cpp | 10 +- Modulator.cpp | 2 +- MultiSettings.cpp | 2 +- NetworkAccessManager.hpp | 2 +- SampleDownloader.cpp | 2 +- SampleDownloader/Directory.cpp | 2 +- SampleDownloader/FileNode.cpp | 2 +- UDPExamples/ClientWidget.cpp | 2 +- WSPRBandHopping.cpp | 4 +- .../CandidateKeyFilter.cpp | 8 +- .../CandidateKeyFilter.hpp | 4 +- .../ForeignKeyDelegate.cpp | 4 +- .../ForeignKeyDelegate.hpp | 4 +- main.cpp | 9 +- Bands.cpp => models/Bands.cpp | 0 Bands.hpp => models/Bands.hpp | 0 .../DecodeHighlightingModel.cpp | 0 .../DecodeHighlightingModel.hpp | 0 models/FoxLog.cpp | 94 +++ models/FoxLog.hpp | 30 + FrequencyList.cpp => models/FrequencyList.cpp | 0 FrequencyList.hpp => models/FrequencyList.hpp | 0 IARURegions.cpp => models/IARURegions.cpp | 2 +- IARURegions.hpp => models/IARURegions.hpp | 0 Modes.cpp => models/Modes.cpp | 0 Modes.hpp => models/Modes.hpp | 0 StationList.cpp => models/StationList.cpp | 0 StationList.hpp => models/StationList.hpp | 0 .../CallsignValidator.cpp | 0 .../CallsignValidator.hpp | 0 .../ExchangeValidator.cpp | 0 .../ExchangeValidator.hpp | 0 .../LiveFrequencyValidator.cpp | 4 +- .../LiveFrequencyValidator.hpp | 0 .../MaidenheadLocatorValidator.cpp | 0 .../MaidenheadLocatorValidator.hpp | 0 .../DecodeHighlightingListView.cpp | 2 +- .../DecodeHighlightingListView.hpp | 0 .../DoubleClickablePushButton.cpp | 0 .../DoubleClickablePushButton.hpp | 0 .../DoubleClickableRadioButton.cpp | 0 .../DoubleClickableRadioButton.hpp | 0 .../ExportCabrillo.cpp | 0 ExportCabrillo.h => widgets/ExportCabrillo.h | 0 .../ExportCabrillo.ui | 0 widgets/FoxLogWindow.cpp | 148 +++++ widgets/FoxLogWindow.hpp | 65 ++ widgets/FoxLogWindow.ui | 109 ++++ .../FrequencyLineEdit.cpp | 0 .../FrequencyLineEdit.hpp | 90 +-- .../HelpTextWindow.cpp | 2 +- .../HelpTextWindow.hpp | 0 .../HintedSpinBox.cpp | 0 .../HintedSpinBox.hpp | 0 .../LettersSpinBox.cpp | 0 .../LettersSpinBox.hpp | 0 MessageBox.cpp => widgets/MessageBox.cpp | 0 MessageBox.hpp => widgets/MessageBox.hpp | 0 .../RestrictedSpinBox.cpp | 0 .../RestrictedSpinBox.hpp | 0 SplashScreen.cpp => widgets/SplashScreen.cpp | 0 SplashScreen.hpp => widgets/SplashScreen.hpp | 0 about.cpp => widgets/about.cpp | 0 about.h => widgets/about.h | 0 about.ui => widgets/about.ui | 200 +++--- astro.cpp => widgets/astro.cpp | 0 astro.h => widgets/astro.h | 0 astro.ui => widgets/astro.ui | 0 .../colorhighlighting.cpp | 2 +- .../colorhighlighting.h | 0 .../colorhighlighting.ui | 0 displaytext.cpp => widgets/displaytext.cpp | 2 +- displaytext.h => widgets/displaytext.h | 0 echograph.cpp => widgets/echograph.cpp | 0 echograph.h => widgets/echograph.h | 0 echograph.ui => widgets/echograph.ui | 588 +++++++++--------- echoplot.cpp => widgets/echoplot.cpp | 0 echoplot.h => widgets/echoplot.h | 0 fastgraph.cpp => widgets/fastgraph.cpp | 0 fastgraph.h => widgets/fastgraph.h | 0 fastgraph.ui => widgets/fastgraph.ui | 10 +- fastplot.cpp => widgets/fastplot.cpp | 0 fastplot.h => widgets/fastplot.h | 0 logqso.cpp => widgets/logqso.cpp | 4 +- logqso.h => widgets/logqso.h | 0 logqso.ui => widgets/logqso.ui | 0 mainwindow.cpp => widgets/mainwindow.cpp | 88 ++- mainwindow.h => widgets/mainwindow.h | 10 +- mainwindow.ui => widgets/mainwindow.ui | 14 +- .../messageaveraging.cpp | 0 .../messageaveraging.h | 0 .../messageaveraging.ui | 260 ++++---- meterwidget.cpp => widgets/meterwidget.cpp | 0 meterwidget.h => widgets/meterwidget.h | 0 plotter.cpp => widgets/plotter.cpp | 0 plotter.h => widgets/plotter.h | 0 signalmeter.cpp => widgets/signalmeter.cpp | 2 +- signalmeter.h => widgets/signalmeter.h | 0 widegraph.cpp => widgets/widegraph.cpp | 0 widegraph.h => widgets/widegraph.h | 0 widegraph.ui => widgets/widegraph.ui | 2 +- wsjtx.pro | 2 +- 106 files changed, 1231 insertions(+), 722 deletions(-) rename CandidateKeyFilter.cpp => item_delegates/CandidateKeyFilter.cpp (90%) rename CandidateKeyFilter.hpp => item_delegates/CandidateKeyFilter.hpp (89%) rename ForeignKeyDelegate.cpp => item_delegates/ForeignKeyDelegate.cpp (90%) rename ForeignKeyDelegate.hpp => item_delegates/ForeignKeyDelegate.hpp (89%) rename Bands.cpp => models/Bands.cpp (100%) rename Bands.hpp => models/Bands.hpp (100%) rename DecodeHighlightingModel.cpp => models/DecodeHighlightingModel.cpp (100%) rename DecodeHighlightingModel.hpp => models/DecodeHighlightingModel.hpp (100%) create mode 100644 models/FoxLog.cpp create mode 100644 models/FoxLog.hpp rename FrequencyList.cpp => models/FrequencyList.cpp (100%) rename FrequencyList.hpp => models/FrequencyList.hpp (100%) rename IARURegions.cpp => models/IARURegions.cpp (98%) rename IARURegions.hpp => models/IARURegions.hpp (100%) rename Modes.cpp => models/Modes.cpp (100%) rename Modes.hpp => models/Modes.hpp (100%) rename StationList.cpp => models/StationList.cpp (100%) rename StationList.hpp => models/StationList.hpp (100%) rename CallsignValidator.cpp => validators/CallsignValidator.cpp (100%) rename CallsignValidator.hpp => validators/CallsignValidator.hpp (100%) rename ExchangeValidator.cpp => validators/ExchangeValidator.cpp (100%) rename ExchangeValidator.hpp => validators/ExchangeValidator.hpp (100%) rename LiveFrequencyValidator.cpp => validators/LiveFrequencyValidator.cpp (98%) rename LiveFrequencyValidator.hpp => validators/LiveFrequencyValidator.hpp (100%) rename MaidenheadLocatorValidator.cpp => validators/MaidenheadLocatorValidator.cpp (100%) rename MaidenheadLocatorValidator.hpp => validators/MaidenheadLocatorValidator.hpp (100%) rename DecodeHighlightingListView.cpp => widgets/DecodeHighlightingListView.cpp (98%) rename DecodeHighlightingListView.hpp => widgets/DecodeHighlightingListView.hpp (100%) rename DoubleClickablePushButton.cpp => widgets/DoubleClickablePushButton.cpp (100%) rename DoubleClickablePushButton.hpp => widgets/DoubleClickablePushButton.hpp (100%) rename DoubleClickableRadioButton.cpp => widgets/DoubleClickableRadioButton.cpp (100%) rename DoubleClickableRadioButton.hpp => widgets/DoubleClickableRadioButton.hpp (100%) rename ExportCabrillo.cpp => widgets/ExportCabrillo.cpp (100%) rename ExportCabrillo.h => widgets/ExportCabrillo.h (100%) rename ExportCabrillo.ui => widgets/ExportCabrillo.ui (100%) create mode 100644 widgets/FoxLogWindow.cpp create mode 100644 widgets/FoxLogWindow.hpp create mode 100644 widgets/FoxLogWindow.ui rename FrequencyLineEdit.cpp => widgets/FrequencyLineEdit.cpp (100%) rename FrequencyLineEdit.hpp => widgets/FrequencyLineEdit.hpp (95%) rename HelpTextWindow.cpp => widgets/HelpTextWindow.cpp (96%) rename HelpTextWindow.hpp => widgets/HelpTextWindow.hpp (100%) rename HintedSpinBox.cpp => widgets/HintedSpinBox.cpp (100%) rename HintedSpinBox.hpp => widgets/HintedSpinBox.hpp (100%) rename LettersSpinBox.cpp => widgets/LettersSpinBox.cpp (100%) rename LettersSpinBox.hpp => widgets/LettersSpinBox.hpp (100%) rename MessageBox.cpp => widgets/MessageBox.cpp (100%) rename MessageBox.hpp => widgets/MessageBox.hpp (100%) rename RestrictedSpinBox.cpp => widgets/RestrictedSpinBox.cpp (100%) rename RestrictedSpinBox.hpp => widgets/RestrictedSpinBox.hpp (100%) rename SplashScreen.cpp => widgets/SplashScreen.cpp (100%) rename SplashScreen.hpp => widgets/SplashScreen.hpp (100%) rename about.cpp => widgets/about.cpp (100%) rename about.h => widgets/about.h (100%) rename about.ui => widgets/about.ui (95%) rename astro.cpp => widgets/astro.cpp (100%) rename astro.h => widgets/astro.h (100%) rename astro.ui => widgets/astro.ui (100%) rename colorhighlighting.cpp => widgets/colorhighlighting.cpp (98%) rename colorhighlighting.h => widgets/colorhighlighting.h (100%) rename colorhighlighting.ui => widgets/colorhighlighting.ui (100%) rename displaytext.cpp => widgets/displaytext.cpp (99%) rename displaytext.h => widgets/displaytext.h (100%) rename echograph.cpp => widgets/echograph.cpp (100%) rename echograph.h => widgets/echograph.h (100%) rename echograph.ui => widgets/echograph.ui (96%) rename echoplot.cpp => widgets/echoplot.cpp (100%) rename echoplot.h => widgets/echoplot.h (100%) rename fastgraph.cpp => widgets/fastgraph.cpp (100%) rename fastgraph.h => widgets/fastgraph.h (100%) rename fastgraph.ui => widgets/fastgraph.ui (97%) rename fastplot.cpp => widgets/fastplot.cpp (100%) rename fastplot.h => widgets/fastplot.h (100%) rename logqso.cpp => widgets/logqso.cpp (98%) rename logqso.h => widgets/logqso.h (100%) rename logqso.ui => widgets/logqso.ui (100%) rename mainwindow.cpp => widgets/mainwindow.cpp (99%) rename mainwindow.h => widgets/mainwindow.h (99%) rename mainwindow.ui => widgets/mainwindow.ui (99%) rename messageaveraging.cpp => widgets/messageaveraging.cpp (100%) rename messageaveraging.h => widgets/messageaveraging.h (100%) rename messageaveraging.ui => widgets/messageaveraging.ui (96%) rename meterwidget.cpp => widgets/meterwidget.cpp (100%) rename meterwidget.h => widgets/meterwidget.h (100%) rename plotter.cpp => widgets/plotter.cpp (100%) rename plotter.h => widgets/plotter.h (100%) rename signalmeter.cpp => widgets/signalmeter.cpp (99%) rename signalmeter.h => widgets/signalmeter.h (100%) rename widegraph.cpp => widgets/widegraph.cpp (100%) rename widegraph.h => widgets/widegraph.h (100%) rename widegraph.ui => widgets/widegraph.ui (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c48973fd7..371ae5760 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,22 +215,22 @@ set (WSJT_QT_CONF_DESTINATION ${QT_CONF_DESTINATION} CACHE PATH "Path for the qt # set (wsjt_qt_CXXSRCS qt_helpers.cpp - MessageBox.cpp + widgets/MessageBox.cpp MetaDataRegistry.cpp NetworkServerLookup.cpp revision_utils.cpp WFPalette.cpp Radio.cpp RadioMetaType.cpp - IARURegions.cpp - Bands.cpp - Modes.cpp - FrequencyList.cpp - StationList.cpp - FrequencyLineEdit.cpp - CandidateKeyFilter.cpp - ForeignKeyDelegate.cpp - LiveFrequencyValidator.cpp + models/IARURegions.cpp + models/Bands.cpp + models/Modes.cpp + models/FrequencyList.cpp + models/StationList.cpp + widgets/FrequencyLineEdit.cpp + item_delegates/CandidateKeyFilter.cpp + item_delegates/ForeignKeyDelegate.cpp + validators/LiveFrequencyValidator.cpp GetUserId.cpp TraceFile.cpp AudioDevice.cpp @@ -244,10 +244,10 @@ set (wsjt_qt_CXXSRCS DXLabSuiteCommanderTransceiver.cpp NetworkMessage.cpp MessageClient.cpp - LettersSpinBox.cpp - HintedSpinBox.cpp - RestrictedSpinBox.cpp - HelpTextWindow.cpp + widgets/LettersSpinBox.cpp + widgets/HintedSpinBox.cpp + widgets/RestrictedSpinBox.cpp + widgets/HelpTextWindow.cpp SampleDownloader.cpp SampleDownloader/DirectoryDelegate.cpp SampleDownloader/Directory.cpp @@ -255,15 +255,17 @@ set (wsjt_qt_CXXSRCS SampleDownloader/RemoteFile.cpp DisplayManual.cpp MultiSettings.cpp - MaidenheadLocatorValidator.cpp - CallsignValidator.cpp - SplashScreen.cpp + validators/MaidenheadLocatorValidator.cpp + validators/CallsignValidator.cpp + widgets/SplashScreen.cpp EqualizationToolsDialog.cpp - DoubleClickablePushButton.cpp - DoubleClickableRadioButton.cpp + widgets/DoubleClickablePushButton.cpp + widgets/DoubleClickableRadioButton.cpp LotWUsers.cpp - DecodeHighlightingModel.cpp - DecodeHighlightingListView.cpp + models/DecodeHighlightingModel.cpp + widgets/DecodeHighlightingListView.cpp + models/FoxLog.cpp + widgets/FoxLogWindow.cpp ) set (wsjt_qtmm_CXXSRCS @@ -286,31 +288,31 @@ set (wsjtx_CXXSRCS psk_reporter.cpp Modulator.cpp Detector.cpp - logqso.cpp - displaytext.cpp + widgets/logqso.cpp + widgets/displaytext.cpp decodedtext.cpp getfile.cpp soundout.cpp soundin.cpp - meterwidget.cpp - signalmeter.cpp - plotter.cpp - widegraph.cpp - echograph.cpp - echoplot.cpp - fastgraph.cpp - fastplot.cpp - about.cpp - astro.cpp - messageaveraging.cpp - colorhighlighting.cpp + widgets/meterwidget.cpp + widgets/signalmeter.cpp + widgets/plotter.cpp + widgets/widegraph.cpp + widgets/echograph.cpp + widgets/echoplot.cpp + widgets/fastgraph.cpp + widgets/fastplot.cpp + widgets/about.cpp + widgets/astro.cpp + widgets/messageaveraging.cpp + widgets/colorhighlighting.cpp WsprTxScheduler.cpp - mainwindow.cpp + widgets/mainwindow.cpp Configuration.cpp main.cpp wsprnet.cpp WSPRBandHopping.cpp - ExportCabrillo.cpp + widgets/ExportCabrillo.cpp ) set (wsjt_CXXSRCS @@ -612,6 +614,7 @@ set (wsjt_CSRCS set (wsjt_qt_UISRCS wf_palette_design_dialog.ui + widgets/FoxLogWindow.ui ) set (wsprsim_CSRCS @@ -635,17 +638,17 @@ set (wsprd_CSRCS ) set (wsjtx_UISRCS - mainwindow.ui - about.ui - astro.ui - colorhighlighting.ui - echograph.ui - fastgraph.ui - messageaveraging.ui - widegraph.ui - logqso.ui + widgets/mainwindow.ui + widgets/about.ui + widgets/astro.ui + widgets/colorhighlighting.ui + widgets/echograph.ui + widgets/fastgraph.ui + widgets/messageaveraging.ui + widgets/widegraph.ui + widgets/logqso.ui Configuration.ui - ExportCabrillo.ui + widgets/ExportCabrillo.ui ) set (UDP_library_CXXSRCS @@ -667,7 +670,7 @@ set (message_aggregator_CXXSRCS UDPExamples/DecodesModel.cpp UDPExamples/BeaconsModel.cpp UDPExamples/ClientWidget.cpp - MaidenheadLocatorValidator.cpp + validators/MaidenheadLocatorValidator.cpp ) set (message_aggregator_STYLESHEETS @@ -859,6 +862,7 @@ message (STATUS "hamlib_LIBRARY_DIRS: ${hamlib_LIBRARY_DIRS}") find_package (Qt5Widgets 5 REQUIRED) find_package (Qt5Multimedia 5 REQUIRED) find_package (Qt5PrintSupport 5 REQUIRED) +find_package (Qt5Sql 5 REQUIRED) if (WIN32) add_definitions (-DQT_NEEDS_QTMAIN) @@ -1139,7 +1143,7 @@ target_link_libraries (qcp Qt5::Widgets Qt5::PrintSupport) add_library (wsjt_qt STATIC ${wsjt_qt_CXXSRCS} ${wsjt_qt_GENUISRCS} ${GENAXSRCS}) # set wsjtx_udp exports to static variants target_compile_definitions (wsjt_qt PUBLIC UDP_STATIC_DEFINE) -target_link_libraries (wsjt_qt qcp Qt5::Widgets Qt5::Network) +target_link_libraries (wsjt_qt qcp Qt5::Widgets Qt5::Network Qt5::Sql) target_include_directories (wsjt_qt BEFORE PRIVATE ${hamlib_INCLUDE_DIRS}) if (WIN32) target_link_libraries (wsjt_qt Qt5::AxContainer Qt5::AxBase) @@ -1547,6 +1551,13 @@ if (NOT is_debug_build) PATTERN "*quick*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE PATTERN "*_debug${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE ) + install ( + FILES + ${QT_PLUGINS_DIR}/sqldrivers/libqsqlite${CMAKE_SHARED_LIBRARY_SUFFIX} + DESTINATION ${WSJT_PLUGIN_DESTINATION}/sqldrivers + CONFIGURATIONS Release MinSizeRel + #COMPONENT runtime + ) # install ( # DIRECTORY # ${QT_PLUGINS_DIR}/platforms @@ -1595,6 +1606,13 @@ if (NOT is_debug_build) PATTERN "*quick*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE PATTERN "*d${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE ) + install ( + FILES + ${QT_PLUGINS_DIR}/sqldrivers/qsqlite${CMAKE_SHARED_LIBRARY_SUFFIX} + DESTINATION ${WSJT_PLUGIN_DESTINATION}/sqldrivers + CONFIGURATIONS Release MinSizeRel + #COMPONENT runtime + ) # install ( # DIRECTORY # ${QT_PLUGINS_DIR}/platforms diff --git a/Configuration.cpp b/Configuration.cpp index 30a18a5c9..dbbf741ec 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -160,28 +160,30 @@ #include #include #include +#include +#include #include #include "pimpl_impl.hpp" #include "qt_helpers.hpp" #include "MetaDataRegistry.hpp" #include "SettingsGroup.hpp" -#include "FrequencyLineEdit.hpp" -#include "CandidateKeyFilter.hpp" -#include "ForeignKeyDelegate.hpp" +#include "widgets/FrequencyLineEdit.hpp" +#include "item_delegates/CandidateKeyFilter.hpp" +#include "item_delegates/ForeignKeyDelegate.hpp" #include "TransceiverFactory.hpp" #include "Transceiver.hpp" -#include "Bands.hpp" -#include "IARURegions.hpp" -#include "Modes.hpp" -#include "FrequencyList.hpp" -#include "StationList.hpp" +#include "models/Bands.hpp" +#include "models/IARURegions.hpp" +#include "models/Modes.hpp" +#include "models/FrequencyList.hpp" +#include "models/StationList.hpp" #include "NetworkServerLookup.hpp" -#include "MessageBox.hpp" -#include "MaidenheadLocatorValidator.hpp" -#include "CallsignValidator.hpp" +#include "widgets/MessageBox.hpp" +#include "validators/MaidenheadLocatorValidator.hpp" +#include "validators/CallsignValidator.hpp" #include "LotWUsers.hpp" -#include "DecodeHighlightingModel.hpp" +#include "models/DecodeHighlightingModel.hpp" #include "ui_Configuration.h" #include "moc_Configuration.cpp" @@ -1000,6 +1002,18 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network // this must be done after the default paths above are set read_settings (); + // set up SQLite database + if (!QSqlDatabase::drivers ().contains ("QSQLITE")) + { + throw std::runtime_error {"Failed to find SQLite Qt driver"}; + } + auto db = QSqlDatabase::addDatabase ("QSQLITE"); + db.setDatabaseName (writeable_data_dir_.absoluteFilePath ("db.sqlite")); + if (!db.open ()) + { + throw std::runtime_error {("Database Error: " + db.lastError ().text ()).toStdString ()}; + } + // conditionally load LotW users data ui_->LotW_CSV_fetch_push_button->setEnabled (false); connect (&lotw_users_, &LotWUsers::load_finished, [this] () { diff --git a/Configuration.hpp b/Configuration.hpp index 3f5bc1a50..1a6dcc681 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -5,7 +5,7 @@ #include #include "Radio.hpp" -#include "IARURegions.hpp" +#include "models/IARURegions.hpp" #include "AudioDevice.hpp" #include "Transceiver.hpp" diff --git a/Configuration.ui b/Configuration.ui index 977173c05..9c152096f 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -2,14 +2,6 @@ configuration_dialog - - - 0 - 0 - 679 - 619 - - Settings @@ -2832,7 +2824,7 @@ Right click for insert and delete options. DecodeHighlightingListView QListView -
DecodeHighlightingListView.hpp
+
widgets/DecodeHighlightingListView.hpp
diff --git a/MetaDataRegistry.cpp b/MetaDataRegistry.cpp index 14c4a1674..bf2aab5d4 100644 --- a/MetaDataRegistry.cpp +++ b/MetaDataRegistry.cpp @@ -5,16 +5,16 @@ #include #include "Radio.hpp" -#include "FrequencyList.hpp" +#include "models/FrequencyList.hpp" #include "AudioDevice.hpp" #include "Configuration.hpp" -#include "StationList.hpp" +#include "models/StationList.hpp" #include "Transceiver.hpp" #include "TransceiverFactory.hpp" #include "WFPalette.hpp" -#include "IARURegions.hpp" -#include "DecodeHighlightingModel.hpp" -#include "FrequencyLineEdit.hpp" +#include "models/IARURegions.hpp" +#include "models/DecodeHighlightingModel.hpp" +#include "widgets/FrequencyLineEdit.hpp" QItemEditorFactory * item_editor_factory () { diff --git a/Modulator.cpp b/Modulator.cpp index 5775926ea..a7564f6cf 100644 --- a/Modulator.cpp +++ b/Modulator.cpp @@ -3,7 +3,7 @@ #include #include #include -#include "mainwindow.h" +#include "widgets/mainwindow.h" // TODO: G4WJS - break this dependency #include "soundout.h" #include "commons.h" diff --git a/MultiSettings.cpp b/MultiSettings.cpp index d2e2b1388..f4798bc3f 100644 --- a/MultiSettings.cpp +++ b/MultiSettings.cpp @@ -30,7 +30,7 @@ #include "SettingsGroup.hpp" #include "qt_helpers.hpp" #include "SettingsGroup.hpp" -#include "MessageBox.hpp" +#include "widgets/MessageBox.hpp" #include "pimpl_impl.hpp" diff --git a/NetworkAccessManager.hpp b/NetworkAccessManager.hpp index df5a4edcd..1d1b79bce 100644 --- a/NetworkAccessManager.hpp +++ b/NetworkAccessManager.hpp @@ -7,7 +7,7 @@ #include #include -#include "MessageBox.hpp" +#include "widgets/MessageBox.hpp" class QNetworkRequest; class QIODevice; diff --git a/SampleDownloader.cpp b/SampleDownloader.cpp index 2ea930c1d..c5922bc2d 100644 --- a/SampleDownloader.cpp +++ b/SampleDownloader.cpp @@ -7,7 +7,7 @@ #include "pimpl_impl.hpp" #include "SettingsGroup.hpp" #include "SampleDownloader/Directory.hpp" -#include "MessageBox.hpp" +#include "widgets/MessageBox.hpp" #include "moc_SampleDownloader.cpp" diff --git a/SampleDownloader/Directory.cpp b/SampleDownloader/Directory.cpp index 92c1c5cdf..91918021d 100644 --- a/SampleDownloader/Directory.cpp +++ b/SampleDownloader/Directory.cpp @@ -21,7 +21,7 @@ #include "DirectoryNode.hpp" #include "FileNode.hpp" #include "revision_utils.hpp" -#include "MessageBox.hpp" +#include "widgets/MessageBox.hpp" #include "moc_Directory.cpp" diff --git a/SampleDownloader/FileNode.cpp b/SampleDownloader/FileNode.cpp index 85234f382..66864287a 100644 --- a/SampleDownloader/FileNode.cpp +++ b/SampleDownloader/FileNode.cpp @@ -6,7 +6,7 @@ #include #include "Directory.hpp" -#include "MessageBox.hpp" +#include "widgets/MessageBox.hpp" FileNode::FileNode (QTreeWidgetItem * parent , QNetworkAccessManager * network_manager diff --git a/UDPExamples/ClientWidget.cpp b/UDPExamples/ClientWidget.cpp index 06b09ba4d..10361d55d 100644 --- a/UDPExamples/ClientWidget.cpp +++ b/UDPExamples/ClientWidget.cpp @@ -3,7 +3,7 @@ #include #include -#include "MaidenheadLocatorValidator.hpp" +#include "validators/MaidenheadLocatorValidator.hpp" namespace { diff --git a/WSPRBandHopping.cpp b/WSPRBandHopping.cpp index 9657d0ca1..fd0167d51 100644 --- a/WSPRBandHopping.cpp +++ b/WSPRBandHopping.cpp @@ -11,8 +11,8 @@ #include "SettingsGroup.hpp" #include "Configuration.hpp" -#include "Bands.hpp" -#include "FrequencyList.hpp" +#include "models/Bands.hpp" +#include "models/FrequencyList.hpp" #include "WsprTxScheduler.h" #include "pimpl_impl.hpp" #include "moc_WSPRBandHopping.cpp" diff --git a/CandidateKeyFilter.cpp b/item_delegates/CandidateKeyFilter.cpp similarity index 90% rename from CandidateKeyFilter.cpp rename to item_delegates/CandidateKeyFilter.cpp index 47b36b68f..306e4102a 100644 --- a/CandidateKeyFilter.cpp +++ b/item_delegates/CandidateKeyFilter.cpp @@ -29,17 +29,17 @@ public: QModelIndex active_key_; }; -CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel * referenced_model +CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel const * referenced_model , int referenced_key_column , QObject * parent , int referenced_key_role) : QSortFilterProxyModel {parent} , m_ {referenced_key_column, referenced_key_role, nullptr, 0, Qt::EditRole} { - setSourceModel (referenced_model); + setSourceModel (const_cast (referenced_model)); } -CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel * referenced_model +CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel const * referenced_model , QAbstractItemModel const * referencing_model , int referenced_key_column , int referencing_key_column @@ -49,7 +49,7 @@ CandidateKeyFilter::CandidateKeyFilter (QAbstractItemModel * referenced_model : QSortFilterProxyModel {parent} , m_ {referenced_key_column, referenced_key_role, referencing_model, referencing_key_column, referencing_key_role} { - setSourceModel (referenced_model); + setSourceModel (const_cast (referenced_model)); } CandidateKeyFilter::~CandidateKeyFilter () diff --git a/CandidateKeyFilter.hpp b/item_delegates/CandidateKeyFilter.hpp similarity index 89% rename from CandidateKeyFilter.hpp rename to item_delegates/CandidateKeyFilter.hpp index 3fdd85243..27f1892b3 100644 --- a/CandidateKeyFilter.hpp +++ b/item_delegates/CandidateKeyFilter.hpp @@ -12,11 +12,11 @@ class CandidateKeyFilter final : public QSortFilterProxyModel { public: - explicit CandidateKeyFilter (QAbstractItemModel * referenced_model + explicit CandidateKeyFilter (QAbstractItemModel const * referenced_model , int referenced_key_column , QObject * parent = nullptr , int referenced_key_role = Qt::EditRole); - explicit CandidateKeyFilter (QAbstractItemModel * referenced_model + explicit CandidateKeyFilter (QAbstractItemModel const * referenced_model , QAbstractItemModel const * referencing_model , int referenced_key_column , int referencing_key_column diff --git a/ForeignKeyDelegate.cpp b/item_delegates/ForeignKeyDelegate.cpp similarity index 90% rename from ForeignKeyDelegate.cpp rename to item_delegates/ForeignKeyDelegate.cpp index 03f918213..576f677d2 100644 --- a/ForeignKeyDelegate.cpp +++ b/item_delegates/ForeignKeyDelegate.cpp @@ -4,7 +4,7 @@ #include "CandidateKeyFilter.hpp" -ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel * referenced_model +ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel const * referenced_model , int referenced_key_column , QObject * parent , int referenced_key_role) @@ -13,7 +13,7 @@ ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel * referenced_model { } -ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel * referenced_model +ForeignKeyDelegate::ForeignKeyDelegate (QAbstractItemModel const * referenced_model , QAbstractItemModel const * referencing_model , int referenced_key_column , int referencing_key_column diff --git a/ForeignKeyDelegate.hpp b/item_delegates/ForeignKeyDelegate.hpp similarity index 89% rename from ForeignKeyDelegate.hpp rename to item_delegates/ForeignKeyDelegate.hpp index 2ffb0e85b..01b03ee5b 100644 --- a/ForeignKeyDelegate.hpp +++ b/item_delegates/ForeignKeyDelegate.hpp @@ -18,13 +18,13 @@ class ForeignKeyDelegate final { public: // many to many relationship - explicit ForeignKeyDelegate (QAbstractItemModel * referenced_model + explicit ForeignKeyDelegate (QAbstractItemModel const * referenced_model , int referenced_key_column , QObject * parent = nullptr , int referenced_key_role = Qt::EditRole); // one to many (referenced to referencing) relationship - explicit ForeignKeyDelegate (QAbstractItemModel * referenced_model + explicit ForeignKeyDelegate (QAbstractItemModel const * referenced_model , QAbstractItemModel const * referencing_model , int referenced_key_column , int referencing_key_column diff --git a/main.cpp b/main.cpp index a1fcf7415..bc337bb7d 100644 --- a/main.cpp +++ b/main.cpp @@ -18,7 +18,6 @@ #include #include #include - #include #include @@ -27,13 +26,13 @@ #include "SettingsGroup.hpp" #include "TraceFile.hpp" #include "MultiSettings.hpp" -#include "mainwindow.h" +#include "widgets/mainwindow.h" #include "commons.h" #include "lib/init_random_seed.h" #include "Radio.hpp" -#include "FrequencyList.hpp" -#include "SplashScreen.hpp" -#include "MessageBox.hpp" // last to avoid nasty MS macro definitions +#include "models/FrequencyList.hpp" +#include "widgets/SplashScreen.hpp" +#include "widgets/MessageBox.hpp" // last to avoid nasty MS macro definitions extern "C" { // Fortran procedures we need diff --git a/Bands.cpp b/models/Bands.cpp similarity index 100% rename from Bands.cpp rename to models/Bands.cpp diff --git a/Bands.hpp b/models/Bands.hpp similarity index 100% rename from Bands.hpp rename to models/Bands.hpp diff --git a/DecodeHighlightingModel.cpp b/models/DecodeHighlightingModel.cpp similarity index 100% rename from DecodeHighlightingModel.cpp rename to models/DecodeHighlightingModel.cpp diff --git a/DecodeHighlightingModel.hpp b/models/DecodeHighlightingModel.hpp similarity index 100% rename from DecodeHighlightingModel.hpp rename to models/DecodeHighlightingModel.hpp diff --git a/models/FoxLog.cpp b/models/FoxLog.cpp new file mode 100644 index 000000000..4ab72b3c5 --- /dev/null +++ b/models/FoxLog.cpp @@ -0,0 +1,94 @@ +#include "FoxLog.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "pimpl_impl.hpp" + +class FoxLog::impl final + : public QSqlTableModel +{ +public: + impl (); + QSqlQuery insert_; +}; + +FoxLog::impl::impl () +{ + if (!database ().tables ().contains ("fox_log")) + { + QSqlQuery query; + if (!query.exec ("CREATE TABLE fox_log (" + " id INTEGER PRIMARY KEY AUTOINCREMENT," + " \"when\" DATETIME NOT NULL," + " call VARCHAR(20) NOT NULL," + " grid VARCHAR(4)," + " report_sent VARCHAR(3)," + " report_rcvd VARCHAR(3)," + " band VARCHAR(6) NOT NULL," + " CONSTRAINT no_dupes UNIQUE (call, band)" + ")")) + { + throw std::runtime_error {("SQL Error: " + query.lastError ().text ()).toStdString ()}; + } + } + + setEditStrategy (QSqlTableModel::OnRowChange); + setTable ("fox_log"); + setHeaderData (fieldIndex ("when"), Qt::Horizontal, tr ("Date and Time")); + setHeaderData (fieldIndex ("call"), Qt::Horizontal, tr ("Call")); + setHeaderData (fieldIndex ("grid"), Qt::Horizontal, tr ("Grid")); + setHeaderData (fieldIndex ("report_sent"), Qt::Horizontal, tr ("Sent")); + setHeaderData (fieldIndex ("report_rcvd"), Qt::Horizontal, tr ("Rcvd")); + setHeaderData (fieldIndex ("band"), Qt::Horizontal, tr ("Band")); + if (!select ()) + { + throw std::runtime_error {("SQL Error: " + lastError ().text ()).toStdString ()}; + } +} + +FoxLog::FoxLog () +{ +} + +FoxLog::~FoxLog () +{ +} + +QAbstractItemModel * FoxLog::model () +{ + return &*m_; +} + +bool FoxLog::add_QSO (QDateTime const& when, QString const& call, QString const& grid + , QString const& report_received, QString const& report_sent + , QString const& band) +{ + auto db = m_->database (); + auto record = m_->record (); + record.setValue ("when", when.toMSecsSinceEpoch () / 1000); + record.setValue ("call", call); + record.setValue ("grid", grid); + record.setValue ("report_sent", report_sent); + record.setValue ("report_rcvd", report_received); + record.setValue ("band", band); + if (!m_->insertRecord (-1, record)) + { + throw std::runtime_error {("SQL Error: " + m_->lastError ().text ()).toStdString ()}; + } + if (!m_->submitAll ()) + { + qDebug () << "type:" << m_->lastError ().type (); + if (QSqlError::TransactionError == m_->lastError ().type ()) + { + return false; + } + throw std::runtime_error {("SQL Error: " + m_->lastError ().text ()).toStdString ()}; + } + return true; +} diff --git a/models/FoxLog.hpp b/models/FoxLog.hpp new file mode 100644 index 000000000..64db0be89 --- /dev/null +++ b/models/FoxLog.hpp @@ -0,0 +1,30 @@ +#ifndef FOX_LOG_HPP_ +#define FOX_LOG_HPP_ + +#include +#include "pimpl_h.hpp" + +class QDateTime; +class QString; +class QAbstractItemModel; + +class FoxLog final + : private boost::noncopyable +{ +public: + explicit FoxLog (); + ~FoxLog (); + + // returns false if insert fails, dupe call+band + bool add_QSO (QDateTime const&, QString const& call, QString const& grid + , QString const& report_received, QString const& report_sent + , QString const& band); + + QAbstractItemModel * model (); + +private: + class impl; + pimpl m_; +}; + +#endif diff --git a/FrequencyList.cpp b/models/FrequencyList.cpp similarity index 100% rename from FrequencyList.cpp rename to models/FrequencyList.cpp diff --git a/FrequencyList.hpp b/models/FrequencyList.hpp similarity index 100% rename from FrequencyList.hpp rename to models/FrequencyList.hpp diff --git a/IARURegions.cpp b/models/IARURegions.cpp similarity index 98% rename from IARURegions.cpp rename to models/IARURegions.cpp index 0eb27d97b..25450ab47 100644 --- a/IARURegions.cpp +++ b/models/IARURegions.cpp @@ -1,4 +1,4 @@ -#include "IARURegions.hpp" +#include "models/IARURegions.hpp" #include diff --git a/IARURegions.hpp b/models/IARURegions.hpp similarity index 100% rename from IARURegions.hpp rename to models/IARURegions.hpp diff --git a/Modes.cpp b/models/Modes.cpp similarity index 100% rename from Modes.cpp rename to models/Modes.cpp diff --git a/Modes.hpp b/models/Modes.hpp similarity index 100% rename from Modes.hpp rename to models/Modes.hpp diff --git a/StationList.cpp b/models/StationList.cpp similarity index 100% rename from StationList.cpp rename to models/StationList.cpp diff --git a/StationList.hpp b/models/StationList.hpp similarity index 100% rename from StationList.hpp rename to models/StationList.hpp diff --git a/CallsignValidator.cpp b/validators/CallsignValidator.cpp similarity index 100% rename from CallsignValidator.cpp rename to validators/CallsignValidator.cpp diff --git a/CallsignValidator.hpp b/validators/CallsignValidator.hpp similarity index 100% rename from CallsignValidator.hpp rename to validators/CallsignValidator.hpp diff --git a/ExchangeValidator.cpp b/validators/ExchangeValidator.cpp similarity index 100% rename from ExchangeValidator.cpp rename to validators/ExchangeValidator.cpp diff --git a/ExchangeValidator.hpp b/validators/ExchangeValidator.hpp similarity index 100% rename from ExchangeValidator.hpp rename to validators/ExchangeValidator.hpp diff --git a/LiveFrequencyValidator.cpp b/validators/LiveFrequencyValidator.cpp similarity index 98% rename from LiveFrequencyValidator.cpp rename to validators/LiveFrequencyValidator.cpp index 35aaf57cc..6d2205807 100644 --- a/LiveFrequencyValidator.cpp +++ b/validators/LiveFrequencyValidator.cpp @@ -5,8 +5,8 @@ #include #include -#include "Bands.hpp" -#include "FrequencyList.hpp" +#include "models/Bands.hpp" +#include "models/FrequencyList.hpp" #include "moc_LiveFrequencyValidator.cpp" diff --git a/LiveFrequencyValidator.hpp b/validators/LiveFrequencyValidator.hpp similarity index 100% rename from LiveFrequencyValidator.hpp rename to validators/LiveFrequencyValidator.hpp diff --git a/MaidenheadLocatorValidator.cpp b/validators/MaidenheadLocatorValidator.cpp similarity index 100% rename from MaidenheadLocatorValidator.cpp rename to validators/MaidenheadLocatorValidator.cpp diff --git a/MaidenheadLocatorValidator.hpp b/validators/MaidenheadLocatorValidator.hpp similarity index 100% rename from MaidenheadLocatorValidator.hpp rename to validators/MaidenheadLocatorValidator.hpp diff --git a/DecodeHighlightingListView.cpp b/widgets/DecodeHighlightingListView.cpp similarity index 98% rename from DecodeHighlightingListView.cpp rename to widgets/DecodeHighlightingListView.cpp index 48644c9e5..31115d1f7 100644 --- a/DecodeHighlightingListView.cpp +++ b/widgets/DecodeHighlightingListView.cpp @@ -3,7 +3,7 @@ #include #include -#include "DecodeHighlightingModel.hpp" +#include "models/DecodeHighlightingModel.hpp" #include "MessageBox.hpp" #include "pimpl_impl.hpp" diff --git a/DecodeHighlightingListView.hpp b/widgets/DecodeHighlightingListView.hpp similarity index 100% rename from DecodeHighlightingListView.hpp rename to widgets/DecodeHighlightingListView.hpp diff --git a/DoubleClickablePushButton.cpp b/widgets/DoubleClickablePushButton.cpp similarity index 100% rename from DoubleClickablePushButton.cpp rename to widgets/DoubleClickablePushButton.cpp diff --git a/DoubleClickablePushButton.hpp b/widgets/DoubleClickablePushButton.hpp similarity index 100% rename from DoubleClickablePushButton.hpp rename to widgets/DoubleClickablePushButton.hpp diff --git a/DoubleClickableRadioButton.cpp b/widgets/DoubleClickableRadioButton.cpp similarity index 100% rename from DoubleClickableRadioButton.cpp rename to widgets/DoubleClickableRadioButton.cpp diff --git a/DoubleClickableRadioButton.hpp b/widgets/DoubleClickableRadioButton.hpp similarity index 100% rename from DoubleClickableRadioButton.hpp rename to widgets/DoubleClickableRadioButton.hpp diff --git a/ExportCabrillo.cpp b/widgets/ExportCabrillo.cpp similarity index 100% rename from ExportCabrillo.cpp rename to widgets/ExportCabrillo.cpp diff --git a/ExportCabrillo.h b/widgets/ExportCabrillo.h similarity index 100% rename from ExportCabrillo.h rename to widgets/ExportCabrillo.h diff --git a/ExportCabrillo.ui b/widgets/ExportCabrillo.ui similarity index 100% rename from ExportCabrillo.ui rename to widgets/ExportCabrillo.ui diff --git a/widgets/FoxLogWindow.cpp b/widgets/FoxLogWindow.cpp new file mode 100644 index 000000000..6dd557332 --- /dev/null +++ b/widgets/FoxLogWindow.cpp @@ -0,0 +1,148 @@ +#include "FoxLogWindow.hpp" + +#include +#include +#include +#include +#include +#include +#include + +#include "SettingsGroup.hpp" +#include "Configuration.hpp" +#include "models/Bands.hpp" +#include "item_delegates/ForeignKeyDelegate.hpp" +#include "widgets/MessageBox.hpp" +#include "qt_helpers.hpp" + +#include "ui_FoxLogWindow.h" + +namespace +{ + class DateTimeAsSecsSinceEpochItemDelegate final + : public QStyledItemDelegate + { + public: + DateTimeAsSecsSinceEpochItemDelegate (QObject * parent = nullptr) + : QStyledItemDelegate {parent} + { + } + + static QVariant to_secs_since_epoch (QDateTime const& date_time) + { + return date_time.toMSecsSinceEpoch () / 1000; + } + + 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 () * 1000); + } + + QString displayText (QVariant const& value, QLocale const& locale) const override + { + return locale.toString (to_date_time (value), QLocale::ShortFormat); + } + + QWidget * createEditor (QWidget * parent, QStyleOptionViewItem const& /*option*/, QModelIndex const& /*index*/) const override + { + return new QDateTimeEdit {parent}; + } + + 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); + } + }; +} + +FoxLogWindow::FoxLogWindow (QSettings * settings, Configuration const * configuration + , QAbstractItemModel * fox_log_model, QWidget * parent) + : QWidget {parent} + , settings_ {settings} + , configuration_ {configuration} + , ui_ {new Ui::FoxLogWindow} +{ + fox_log_model_.setSourceModel (fox_log_model); + setWindowTitle (QApplication::applicationName () + " - Fox Log"); + ui_->setupUi (this); + read_settings (); + change_font (configuration_->decoded_text_font ()); + ui_->log_table_view->setModel (&fox_log_model_); + ui_->log_table_view->setColumnHidden (0, true); + ui_->log_table_view->setItemDelegateForColumn (1, new DateTimeAsSecsSinceEpochItemDelegate {this}); + ui_->log_table_view->setItemDelegateForColumn (6, new ForeignKeyDelegate {configuration_->bands (), &fox_log_model_, 0, 6, this}); + ui_->log_table_view->setSelectionMode (QTableView::SingleSelection); + ui_->log_table_view->resizeColumnsToContents (); + ui_->rate_label->setNum (0); + ui_->queued_label->setNum (0); + ui_->callers_label->setNum (0); + connect (&fox_log_model_, &QAbstractItemModel::rowsInserted, [this] (QModelIndex const& parent, int first, int /*last*/) { + ui_->log_table_view->scrollTo (fox_log_model_.index (first, 0, parent)); + ui_->log_table_view->resizeColumnsToContents (); + // ui_->log_table_view->scrollToBottom (); + }); +} + +FoxLogWindow::~FoxLogWindow () +{ + if (isVisible ()) + { + write_settings (); + } +} + +void FoxLogWindow::closeEvent (QCloseEvent * e) +{ + write_settings (); + QWidget::closeEvent (e); +} + +void FoxLogWindow::read_settings () +{ + SettingsGroup g {settings_, "Fox Log Window"}; + restoreGeometry (settings_->value ("window/geometery").toByteArray ()); +} + +void FoxLogWindow::write_settings () const +{ + SettingsGroup g {settings_, "Fox Log Window"}; + settings_->setValue ("window/geometery", saveGeometry ()); +} + +void FoxLogWindow::change_font (QFont const& font) +{ + // ui_->log_table_view->setFont (font); + // ui_->log_table_view->horizontalHeader ()->setFont (font); + // ui_->log_table_view->verticalHeader ()->setFont (font); + fox_log_model_.set_font (font); +} + +void FoxLogWindow::callers (int n) +{ + ui_->callers_label->setNum (n); +} + +void FoxLogWindow::queued (int n) +{ + ui_->queued_label->setNum (n); +} + +void FoxLogWindow::rate (int n) +{ + ui_->rate_label->setNum (n); +} diff --git a/widgets/FoxLogWindow.hpp b/widgets/FoxLogWindow.hpp new file mode 100644 index 000000000..3b8fe6827 --- /dev/null +++ b/widgets/FoxLogWindow.hpp @@ -0,0 +1,65 @@ +#ifndef FOX_LOG_WINDOW_HPP_ +#define FOX_LOG_WINDOW_HPP_ + +#include +#include +#include + +class QSettings; +class Configuration; +class QFont; +class QDateTime; +class QAbstractItemModel; +namespace Ui +{ + class FoxLogWindow; +} + +// fix up font display as header font changes don't currently work +// from views (I think fixed in Qt 5.11.1) +class FontOverrideModel final + : public QIdentityProxyModel +{ +public: + FontOverrideModel (QObject * parent = nullptr) : QIdentityProxyModel {parent} {} + void set_font (QFont const& font) {font_ = font;} + QVariant data (QModelIndex const& index, int role) const override + { + if (Qt::FontRole == role) return font_; + return QIdentityProxyModel::data (index, role); + } + QVariant headerData (int section, Qt::Orientation orientation, int role) const override + { + if (Qt::FontRole == role) return font_; + return QIdentityProxyModel::headerData (section, orientation, role); + } +private: + QFont font_; +}; + +class FoxLogWindow final + : public QWidget +{ +public: + explicit FoxLogWindow (QSettings *, Configuration const *, QAbstractItemModel * fox_log_model + , QWidget * parent = nullptr); + ~FoxLogWindow (); + + void change_font (QFont const&); + void callers (int); + void queued (int); + void rate (int); + +private: + void closeEvent (QCloseEvent *) override; + + void read_settings (); + void write_settings () const; + + QSettings * settings_; + Configuration const * configuration_; + FontOverrideModel fox_log_model_; + QScopedPointer ui_; +}; + +#endif diff --git a/widgets/FoxLogWindow.ui b/widgets/FoxLogWindow.ui new file mode 100644 index 000000000..54edbbc52 --- /dev/null +++ b/widgets/FoxLogWindow.ui @@ -0,0 +1,109 @@ + + + FoxLogWindow + + + + 0 + 0 + 400 + 300 + + + + Fox Log + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Callers: + + + + + + + N + + + + + + + In progress: + + + + + + + N + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Rate: + + + + + + + N + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + diff --git a/FrequencyLineEdit.cpp b/widgets/FrequencyLineEdit.cpp similarity index 100% rename from FrequencyLineEdit.cpp rename to widgets/FrequencyLineEdit.cpp diff --git a/FrequencyLineEdit.hpp b/widgets/FrequencyLineEdit.hpp similarity index 95% rename from FrequencyLineEdit.hpp rename to widgets/FrequencyLineEdit.hpp index f59a37b07..dec0feb00 100644 --- a/FrequencyLineEdit.hpp +++ b/widgets/FrequencyLineEdit.hpp @@ -1,45 +1,45 @@ -#ifndef FREQUENCY_LINE_EDIT_HPP_ -#define FREQUENCY_LINE_EDIT_HPP_ - -#include - -#include "Radio.hpp" - -class QWidget; - -// -// MHz frequency line edits with validation -// -class FrequencyLineEdit final - : public QLineEdit -{ - Q_OBJECT; - Q_PROPERTY (Frequency frequency READ frequency WRITE frequency USER true); - -public: - using Frequency = Radio::Frequency; - - explicit FrequencyLineEdit (QWidget * parent = nullptr); - - // Property frequency implementation - Frequency frequency () const; - void frequency (Frequency); -}; - -class FrequencyDeltaLineEdit final - : public QLineEdit -{ - Q_OBJECT; - Q_PROPERTY (FrequencyDelta frequency_delta READ frequency_delta WRITE frequency_delta USER true); - -public: - using FrequencyDelta = Radio::FrequencyDelta; - - explicit FrequencyDeltaLineEdit (QWidget * parent = nullptr); - - // Property frequency_delta implementation - FrequencyDelta frequency_delta () const; - void frequency_delta (FrequencyDelta); -}; - -#endif +#ifndef FREQUENCY_LINE_EDIT_HPP_ +#define FREQUENCY_LINE_EDIT_HPP_ + +#include + +#include "Radio.hpp" + +class QWidget; + +// +// MHz frequency line edits with validation +// +class FrequencyLineEdit final + : public QLineEdit +{ + Q_OBJECT; + Q_PROPERTY (Frequency frequency READ frequency WRITE frequency USER true); + +public: + using Frequency = Radio::Frequency; + + explicit FrequencyLineEdit (QWidget * parent = nullptr); + + // Property frequency implementation + Frequency frequency () const; + void frequency (Frequency); +}; + +class FrequencyDeltaLineEdit final + : public QLineEdit +{ + Q_OBJECT; + Q_PROPERTY (FrequencyDelta frequency_delta READ frequency_delta WRITE frequency_delta USER true); + +public: + using FrequencyDelta = Radio::FrequencyDelta; + + explicit FrequencyDeltaLineEdit (QWidget * parent = nullptr); + + // Property frequency_delta implementation + FrequencyDelta frequency_delta () const; + void frequency_delta (FrequencyDelta); +}; + +#endif diff --git a/HelpTextWindow.cpp b/widgets/HelpTextWindow.cpp similarity index 96% rename from HelpTextWindow.cpp rename to widgets/HelpTextWindow.cpp index 84bc1d4ad..98c2b38e3 100644 --- a/HelpTextWindow.cpp +++ b/widgets/HelpTextWindow.cpp @@ -7,7 +7,7 @@ #include #include "qt_helpers.hpp" -#include +#include "widgets/MessageBox.hpp" HelpTextWindow::HelpTextWindow (QString const& title, QString const& file_name, QFont const& font, QWidget * parent) : QLabel {parent, Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint} diff --git a/HelpTextWindow.hpp b/widgets/HelpTextWindow.hpp similarity index 100% rename from HelpTextWindow.hpp rename to widgets/HelpTextWindow.hpp diff --git a/HintedSpinBox.cpp b/widgets/HintedSpinBox.cpp similarity index 100% rename from HintedSpinBox.cpp rename to widgets/HintedSpinBox.cpp diff --git a/HintedSpinBox.hpp b/widgets/HintedSpinBox.hpp similarity index 100% rename from HintedSpinBox.hpp rename to widgets/HintedSpinBox.hpp diff --git a/LettersSpinBox.cpp b/widgets/LettersSpinBox.cpp similarity index 100% rename from LettersSpinBox.cpp rename to widgets/LettersSpinBox.cpp diff --git a/LettersSpinBox.hpp b/widgets/LettersSpinBox.hpp similarity index 100% rename from LettersSpinBox.hpp rename to widgets/LettersSpinBox.hpp diff --git a/MessageBox.cpp b/widgets/MessageBox.cpp similarity index 100% rename from MessageBox.cpp rename to widgets/MessageBox.cpp diff --git a/MessageBox.hpp b/widgets/MessageBox.hpp similarity index 100% rename from MessageBox.hpp rename to widgets/MessageBox.hpp diff --git a/RestrictedSpinBox.cpp b/widgets/RestrictedSpinBox.cpp similarity index 100% rename from RestrictedSpinBox.cpp rename to widgets/RestrictedSpinBox.cpp diff --git a/RestrictedSpinBox.hpp b/widgets/RestrictedSpinBox.hpp similarity index 100% rename from RestrictedSpinBox.hpp rename to widgets/RestrictedSpinBox.hpp diff --git a/SplashScreen.cpp b/widgets/SplashScreen.cpp similarity index 100% rename from SplashScreen.cpp rename to widgets/SplashScreen.cpp diff --git a/SplashScreen.hpp b/widgets/SplashScreen.hpp similarity index 100% rename from SplashScreen.hpp rename to widgets/SplashScreen.hpp diff --git a/about.cpp b/widgets/about.cpp similarity index 100% rename from about.cpp rename to widgets/about.cpp diff --git a/about.h b/widgets/about.h similarity index 100% rename from about.h rename to widgets/about.h diff --git a/about.ui b/widgets/about.ui similarity index 95% rename from about.ui rename to widgets/about.ui index 84a59c63e..84157c4d2 100644 --- a/about.ui +++ b/widgets/about.ui @@ -1,100 +1,100 @@ - - - CAboutDlg - - - Qt::NonModal - - - About WSJT-X - - - - - - - - - - - Qt::AlignCenter - - - true - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - OK - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - okButton - clicked() - CAboutDlg - accept() - - - 321 - 120 - - - 186 - 71 - - - - - + + + CAboutDlg + + + Qt::NonModal + + + About WSJT-X + + + + + + + + + + + Qt::AlignCenter + + + true + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + okButton + clicked() + CAboutDlg + accept() + + + 321 + 120 + + + 186 + 71 + + + + + diff --git a/astro.cpp b/widgets/astro.cpp similarity index 100% rename from astro.cpp rename to widgets/astro.cpp diff --git a/astro.h b/widgets/astro.h similarity index 100% rename from astro.h rename to widgets/astro.h diff --git a/astro.ui b/widgets/astro.ui similarity index 100% rename from astro.ui rename to widgets/astro.ui diff --git a/colorhighlighting.cpp b/widgets/colorhighlighting.cpp similarity index 98% rename from colorhighlighting.cpp rename to widgets/colorhighlighting.cpp index 6cd751f92..c5e2289ee 100644 --- a/colorhighlighting.cpp +++ b/widgets/colorhighlighting.cpp @@ -4,7 +4,7 @@ #include #include "SettingsGroup.hpp" -#include "DecodeHighlightingModel.hpp" +#include "models/DecodeHighlightingModel.hpp" #include "ui_colorhighlighting.h" #include "moc_colorhighlighting.cpp" diff --git a/colorhighlighting.h b/widgets/colorhighlighting.h similarity index 100% rename from colorhighlighting.h rename to widgets/colorhighlighting.h diff --git a/colorhighlighting.ui b/widgets/colorhighlighting.ui similarity index 100% rename from colorhighlighting.ui rename to widgets/colorhighlighting.ui diff --git a/displaytext.cpp b/widgets/displaytext.cpp similarity index 99% rename from displaytext.cpp rename to widgets/displaytext.cpp index 97829a654..bc8b19675 100644 --- a/displaytext.cpp +++ b/widgets/displaytext.cpp @@ -15,7 +15,7 @@ #include "Configuration.hpp" #include "LotWUsers.hpp" -#include "DecodeHighlightingModel.hpp" +#include "models/DecodeHighlightingModel.hpp" #include "logbook/logbook.h" #include "qt_helpers.hpp" diff --git a/displaytext.h b/widgets/displaytext.h similarity index 100% rename from displaytext.h rename to widgets/displaytext.h diff --git a/echograph.cpp b/widgets/echograph.cpp similarity index 100% rename from echograph.cpp rename to widgets/echograph.cpp diff --git a/echograph.h b/widgets/echograph.h similarity index 100% rename from echograph.h rename to widgets/echograph.h diff --git a/echograph.ui b/widgets/echograph.ui similarity index 96% rename from echograph.ui rename to widgets/echograph.ui index 3840e78c2..470a2cc8c 100644 --- a/echograph.ui +++ b/widgets/echograph.ui @@ -1,294 +1,294 @@ - - - EchoGraph - - - - 0 - 0 - 625 - 336 - - - - - 0 - 0 - - - - - 570 - 0 - - - - Echo Graph - - - - 2 - - - 2 - - - 2 - - - - - 2 - - - - - true - - - - 0 - 0 - - - - - 273 - 200 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - 1 - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - - 60 - 0 - - - - <html><head/><body><p>Compression factor for frequency scale</p></body></html> - - - Bins/Pixel - - - 1 - - - 10 - - - - - - - Gain - - - - - - - <html><head/><body><p>Echo spectrum gain</p></body></html> - - - -30 - - - 30 - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - Zero - - - - - - - <html><head/><body><p>Echo spectrum zero</p></body></html> - - - -150 - - - 150 - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - - 60 - 0 - - - - <html><head/><body><p>Smoothing of echo spectrum</p></body></html> - - - Smooth - - - 20 - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - - 30 - 0 - - - - <html><head/><body><p>Number of echo transmissions averaged</p></body></html> - - - N: 0 - - - Qt::AlignCenter - - - - - - - - 50 - 16777215 - - - - <html><head/><body><p>Click to cycle through a sequence of colors and line widths.</p></body></html> - - - Colors - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - - - - - - EPlotter - QFrame -
plotter.h
- 1 -
-
- - -
+ + + EchoGraph + + + + 0 + 0 + 625 + 336 + + + + + 0 + 0 + + + + + 570 + 0 + + + + Echo Graph + + + + 2 + + + 2 + + + 2 + + + + + 2 + + + + + true + + + + 0 + 0 + + + + + 273 + 200 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + 1 + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + + 60 + 0 + + + + <html><head/><body><p>Compression factor for frequency scale</p></body></html> + + + Bins/Pixel + + + 1 + + + 10 + + + + + + + Gain + + + + + + + <html><head/><body><p>Echo spectrum gain</p></body></html> + + + -30 + + + 30 + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Zero + + + + + + + <html><head/><body><p>Echo spectrum zero</p></body></html> + + + -150 + + + 150 + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + + 60 + 0 + + + + <html><head/><body><p>Smoothing of echo spectrum</p></body></html> + + + Smooth + + + 20 + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + + 30 + 0 + + + + <html><head/><body><p>Number of echo transmissions averaged</p></body></html> + + + N: 0 + + + Qt::AlignCenter + + + + + + + + 50 + 16777215 + + + + <html><head/><body><p>Click to cycle through a sequence of colors and line widths.</p></body></html> + + + Colors + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + + + + + + EPlotter + QFrame +
widgets/plotter.h
+ 1 +
+
+ + +
diff --git a/echoplot.cpp b/widgets/echoplot.cpp similarity index 100% rename from echoplot.cpp rename to widgets/echoplot.cpp diff --git a/echoplot.h b/widgets/echoplot.h similarity index 100% rename from echoplot.h rename to widgets/echoplot.h diff --git a/fastgraph.cpp b/widgets/fastgraph.cpp similarity index 100% rename from fastgraph.cpp rename to widgets/fastgraph.cpp diff --git a/fastgraph.h b/widgets/fastgraph.h similarity index 100% rename from fastgraph.h rename to widgets/fastgraph.h diff --git a/fastgraph.ui b/widgets/fastgraph.ui similarity index 97% rename from fastgraph.ui rename to widgets/fastgraph.ui index 773c223ba..c62acad63 100644 --- a/fastgraph.ui +++ b/widgets/fastgraph.ui @@ -2,6 +2,14 @@ FastGraph + + + 0 + 0 + 707 + 253 + + Fast Graph @@ -229,7 +237,7 @@ FPlotter QFrame -
fastplot.h
+
widgets/fastplot.h
1
diff --git a/fastplot.cpp b/widgets/fastplot.cpp similarity index 100% rename from fastplot.cpp rename to widgets/fastplot.cpp diff --git a/fastplot.h b/widgets/fastplot.h similarity index 100% rename from fastplot.h rename to widgets/fastplot.h diff --git a/logqso.cpp b/widgets/logqso.cpp similarity index 98% rename from logqso.cpp rename to widgets/logqso.cpp index af58bed92..77324e52b 100644 --- a/logqso.cpp +++ b/widgets/logqso.cpp @@ -9,8 +9,8 @@ #include "logbook/logbook.h" #include "MessageBox.hpp" #include "Configuration.hpp" -#include "Bands.hpp" -#include "MaidenheadLocatorValidator.hpp" +#include "models/Bands.hpp" +#include "validators/MaidenheadLocatorValidator.hpp" #include "ui_logqso.h" #include "moc_logqso.cpp" diff --git a/logqso.h b/widgets/logqso.h similarity index 100% rename from logqso.h rename to widgets/logqso.h diff --git a/logqso.ui b/widgets/logqso.ui similarity index 100% rename from logqso.ui rename to widgets/logqso.ui diff --git a/mainwindow.cpp b/widgets/mainwindow.cpp similarity index 99% rename from mainwindow.cpp rename to widgets/mainwindow.cpp index 2c360a3ff..a76e0e430 100644 --- a/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -46,10 +46,10 @@ #include "logqso.h" #include "decodedtext.h" #include "Radio.hpp" -#include "Bands.hpp" +#include "models/Bands.hpp" #include "TransceiverFactory.hpp" -#include "StationList.hpp" -#include "LiveFrequencyValidator.hpp" +#include "models/StationList.hpp" +#include "validators/LiveFrequencyValidator.hpp" #include "MessageClient.hpp" #include "wsprnet.h" #include "signalmeter.h" @@ -57,12 +57,14 @@ #include "SampleDownloader.hpp" #include "Audio/BWFFile.hpp" #include "MultiSettings.hpp" -#include "MaidenheadLocatorValidator.hpp" -#include "CallsignValidator.hpp" -#include "ExchangeValidator.hpp" +#include "validators/MaidenheadLocatorValidator.hpp" +#include "validators/CallsignValidator.hpp" +#include "validators/ExchangeValidator.hpp" #include "EqualizationToolsDialog.hpp" #include "LotWUsers.hpp" #include "logbook/AD1CCty.hpp" +#include "models/FoxLog.hpp" +#include "FoXLogWindow.hpp" #include "ui_mainwindow.h" #include "moc_mainwindow.cpp" @@ -1032,7 +1034,8 @@ void MainWindow::writeSettings() m_settings->setValue("DXcall",ui->dxCallEntry->text()); m_settings->setValue("DXgrid",ui->dxGridEntry->text()); m_settings->setValue ("AstroDisplayed", m_astroWidget && m_astroWidget->isVisible()); - m_settings->setValue ("MsgAvgDisplayed", m_msgAvgWidget && m_msgAvgWidget->isVisible()); + m_settings->setValue ("MsgAvgDisplayed", m_msgAvgWidget && m_msgAvgWidget->isVisible ()); + m_settings->setValue ("FoxLogDisplayed", m_foxLogWindow && m_foxLogWindow->isVisible ()); m_settings->setValue ("FreeText", ui->freeTextMsg->currentText ()); m_settings->setValue("ShowMenus",ui->cbMenus->isChecked()); m_settings->setValue("CallFirst",ui->cbFirst->isChecked()); @@ -1107,6 +1110,7 @@ void MainWindow::readSettings() m_txFirst = m_settings->value("TxFirst",false).toBool(); auto displayAstro = m_settings->value ("AstroDisplayed", false).toBool (); auto displayMsgAvg = m_settings->value ("MsgAvgDisplayed", false).toBool (); + auto displayFoxLog = m_settings->value ("FoxLogDisplayed", false).toBool (); if (m_settings->contains ("FreeText")) ui->freeTextMsg->setCurrentText ( m_settings->value ("FreeText").toString ()); ui->cbMenus->setChecked(m_settings->value("ShowMenus",true).toBool()); @@ -1196,6 +1200,7 @@ void MainWindow::readSettings() checkMSK144ContestType(); if(displayMsgAvg) on_actionMessage_averaging_triggered(); + if (displayFoxLog) on_actionFox_Log_triggered (); } void MainWindow::checkMSK144ContestType() @@ -1236,6 +1241,9 @@ void MainWindow::setDecodedTextFont (QFont const& font) if (m_msgAvgWidget) { m_msgAvgWidget->changeFont (font); } + if (m_foxLogWindow) { + m_foxLogWindow->change_font (font); + } updateGeometry (); } @@ -2416,8 +2424,20 @@ void MainWindow::on_actionAstronomical_data_toggled (bool checked) void MainWindow::on_actionFox_Log_triggered() { - on_actionMessage_averaging_triggered(); - m_msgAvgWidget->foxLogSetup( static_cast (m_config.special_op_id()) ); + if (!m_foxLog) + { + m_foxLog.reset (new FoxLog); + } + if (!m_foxLogWindow) + { + m_foxLogWindow.reset (new FoxLogWindow {m_settings, &m_config, m_foxLog->model ()}); + + // Connect signals from fox log window + connect (this, &MainWindow::finished, m_foxLogWindow.data (), &FoxLogWindow::close); + } + m_foxLogWindow->showNormal (); + m_foxLogWindow->raise (); + m_foxLogWindow->activateWindow (); } void MainWindow::on_actionColors_triggered() @@ -3766,8 +3786,12 @@ void MainWindow::guiUpdate() //Once per second: if(nsec != m_sec0) { - if((!m_msgAvgWidget or (m_msgAvgWidget and !m_msgAvgWidget->isVisible())) - and (SpecOp::NONE < m_config.special_op_id()) and (SpecOp::HOUND > m_config.special_op_id())) on_actionFox_Log_triggered(); + // if((!m_msgAvgWidget or (m_msgAvgWidget and !m_msgAvgWidget->isVisible())) + // and (SpecOp::NONE < m_config.special_op_id()) and (SpecOp::HOUND > m_config.special_op_id())) on_actionFox_Log_triggered(); + if (SpecOp::FOX == m_config.special_op_id() && (!m_foxLogWindow || !m_foxLogWindow->isVisible ())) + { + on_actionFox_Log_triggered(); + } if(m_freqNominal!=0 and m_freqNominal<50000000 and m_config.enable_VHF_features()) { if(!m_bVHFwarned) vhfWarning(); } else { @@ -8021,9 +8045,10 @@ void MainWindow::houndCallers() m_nHoundsCalling++; // Number of accepted Hounds to be sorted } } - if(m_msgAvgWidget != NULL and m_msgAvgWidget->isVisible()) { - m_msgAvgWidget->foxLabCallers(nTotal); - } + if(m_foxLogWindow && m_foxLogWindow->isVisible ()) + { + m_foxLogWindow->callers (nTotal); + } // Sort and display accumulated list of Hound callers if(t.length()>30) { @@ -8179,21 +8204,23 @@ list2Done: if(hc1!="") { // Log this QSO! + auto QSO_time = QDateTime::currentDateTimeUtc (); m_hisCall=hc1; m_hisGrid=m_foxQSO[hc1].grid; m_rptSent=m_foxQSO[hc1].sent; m_rptRcvd=m_foxQSO[hc1].rcvd; - QDateTime logTime {QDateTime::currentDateTimeUtc ()}; - QString thc1=(m_hisCall + " ").mid(0,6); - if(m_hisCall.contains("/")) thc1=m_hisCall; - QString logLine=logTime.toString("yyyy-MM-dd hh:mm") + " " + thc1 + " " + - m_hisGrid + " " + m_rptSent + " " + m_rptRcvd + " " + m_lastBand; - if(m_msgAvgWidget != NULL and m_msgAvgWidget->isVisible()) { - m_msgAvgWidget->foxAddLog(logLine); - } - on_logQSOButton_clicked(); - writeFoxQSO(" Log: " + logLine.mid(17)); - m_foxRateQueue.enqueue(now); //Add present time in seconds to Rate queue. + if (!m_foxLogWindow) + { + on_actionFox_Log_triggered (); + } + if (m_foxLog->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, m_lastBand)) + { + writeFoxQSO (QString {" Log: %1 %2 %3 %4 %5"}.arg (m_hisCall).arg (m_hisGrid) + .arg (m_rptSent).arg (m_rptRcvd).arg (m_lastBand)); + on_logQSOButton_clicked(); + m_foxRateQueue.enqueue (now); //Add present time in seconds + //to Rate queue. + } m_loggedByFox[hc1] += (m_lastBand + " "); } @@ -8249,10 +8276,11 @@ Transmit: if(age < 3600) break; m_foxRateQueue.dequeue(); } - if(m_msgAvgWidget != NULL and m_msgAvgWidget->isVisible()) { - m_msgAvgWidget->foxLabRate(m_foxRateQueue.size()); - m_msgAvgWidget->foxLabQueued(m_foxQSOinProgress.count()); - } + if (m_foxLogWindow && m_foxLogWindow->isVisible ()) + { + m_foxLogWindow->rate (m_foxRateQueue.size ()); + m_foxLogWindow->queued (m_foxQSOinProgress.count ()); + } } void MainWindow::rm_tb4(QString houndCall) @@ -8312,7 +8340,7 @@ void MainWindow::foxGenWaveform(int i,QString fm) writeFoxQSO(t + fm.trimmed()); } -void MainWindow::writeFoxQSO(QString msg) +void MainWindow::writeFoxQSO(QString const& msg) { QString t; t.sprintf("%3d%3d%3d",m_houndQueue.count(),m_foxQSOinProgress.count(),m_foxQSO.count()); diff --git a/mainwindow.h b/widgets/mainwindow.h similarity index 99% rename from mainwindow.h rename to widgets/mainwindow.h index 9dce607ec..9ae612848 100644 --- a/mainwindow.h +++ b/widgets/mainwindow.h @@ -25,8 +25,8 @@ #include "AudioDevice.hpp" #include "commons.h" #include "Radio.hpp" -#include "Modes.hpp" -#include "FrequencyList.hpp" +#include "models/Modes.hpp" +#include "models/FrequencyList.hpp" #include "Configuration.hpp" #include "WSPRBandHopping.hpp" #include "Transceiver.hpp" @@ -69,6 +69,8 @@ class WideGraph; class LogQSO; class Transceiver; class MessageAveraging; +class FoxLogWindow; +class FoxLog; class ColorHighlighting; class MessageClient; class QTime; @@ -360,6 +362,8 @@ private: QScopedPointer m_prefixes; QScopedPointer m_mouseCmnds; QScopedPointer m_msgAvgWidget; + QScopedPointer m_foxLog; + QScopedPointer m_foxLogWindow; QScopedPointer m_colorHighlighting; QScopedPointer m_exportCabrillo; Transceiver::TransceiverState m_rigState; @@ -733,7 +737,7 @@ private: void foxRxSequencer(QString msg, QString houndCall, QString rptRcvd); void foxTxSequencer(); void foxGenWaveform(int i,QString fm); - void writeFoxQSO(QString msg); + void writeFoxQSO (QString const& msg); }; extern int killbyname(const char* progName); diff --git a/mainwindow.ui b/widgets/mainwindow.ui similarity index 99% rename from mainwindow.ui rename to widgets/mainwindow.ui index 1457a2caa..6d95597c3 100644 --- a/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -3353,38 +3353,38 @@ QPushButton[state="ok"] { DisplayText QTextEdit -
displaytext.h
+
widgets/displaytext.h
LettersSpinBox QSpinBox -
LettersSpinBox.hpp
+
widgets/LettersSpinBox.hpp
SignalMeter QFrame -
signalmeter.h
+
widgets/signalmeter.h
1
HintedSpinBox QSpinBox -
HintedSpinBox.hpp
+
widgets/HintedSpinBox.hpp
RestrictedSpinBox QSpinBox -
RestrictedSpinBox.hpp
+
widgets/RestrictedSpinBox.hpp
DoubleClickableRadioButton QRadioButton -
DoubleClickableRadioButton.hpp
+
widgets/DoubleClickableRadioButton.hpp
DoubleClickablePushButton QPushButton -
DoubleClickablePushButton.hpp
+
widgets/DoubleClickablePushButton.hpp
diff --git a/messageaveraging.cpp b/widgets/messageaveraging.cpp similarity index 100% rename from messageaveraging.cpp rename to widgets/messageaveraging.cpp diff --git a/messageaveraging.h b/widgets/messageaveraging.h similarity index 100% rename from messageaveraging.h rename to widgets/messageaveraging.h diff --git a/messageaveraging.ui b/widgets/messageaveraging.ui similarity index 96% rename from messageaveraging.ui rename to widgets/messageaveraging.ui index 7bb37df00..960611738 100644 --- a/messageaveraging.ui +++ b/widgets/messageaveraging.ui @@ -1,130 +1,130 @@ - - - MessageAveraging - - - - 0 - 0 - 354 - 268 - - - - Message Averaging - - - - - - - - UTC Sync DT Freq - - - 3 - - - - - - - QPlainTextEdit::NoWrap - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 77 - 20 - - - - Callers: 0 - - - - - - - - 77 - 20 - - - - In progress: 0 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 25 - 20 - - - - - - - - - 77 - 0 - - - - Logged: 0 - - - - - - - - 77 - 20 - - - - Rate: 0 - - - - - - - - - - - - + + + MessageAveraging + + + + 0 + 0 + 354 + 268 + + + + Message Averaging + + + + + + + + UTC Sync DT Freq + + + 3 + + + + + + + QPlainTextEdit::NoWrap + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 77 + 20 + + + + Callers: 0 + + + + + + + + 77 + 20 + + + + In progress: 0 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 25 + 20 + + + + + + + + + 77 + 0 + + + + Logged: 0 + + + + + + + + 77 + 20 + + + + Rate: 0 + + + + + + + + + + + + diff --git a/meterwidget.cpp b/widgets/meterwidget.cpp similarity index 100% rename from meterwidget.cpp rename to widgets/meterwidget.cpp diff --git a/meterwidget.h b/widgets/meterwidget.h similarity index 100% rename from meterwidget.h rename to widgets/meterwidget.h diff --git a/plotter.cpp b/widgets/plotter.cpp similarity index 100% rename from plotter.cpp rename to widgets/plotter.cpp diff --git a/plotter.h b/widgets/plotter.h similarity index 100% rename from plotter.h rename to widgets/plotter.h diff --git a/signalmeter.cpp b/widgets/signalmeter.cpp similarity index 99% rename from signalmeter.cpp rename to widgets/signalmeter.cpp index d1a27ad9a..715c8dbdd 100644 --- a/signalmeter.cpp +++ b/widgets/signalmeter.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include "meterwidget.h" #include "moc_signalmeter.cpp" diff --git a/signalmeter.h b/widgets/signalmeter.h similarity index 100% rename from signalmeter.h rename to widgets/signalmeter.h diff --git a/widegraph.cpp b/widgets/widegraph.cpp similarity index 100% rename from widegraph.cpp rename to widgets/widegraph.cpp diff --git a/widegraph.h b/widgets/widegraph.h similarity index 100% rename from widegraph.h rename to widgets/widegraph.h diff --git a/widegraph.ui b/widgets/widegraph.ui similarity index 99% rename from widegraph.ui rename to widgets/widegraph.ui index e5265ebef..d302fac6b 100644 --- a/widegraph.ui +++ b/widgets/widegraph.ui @@ -517,7 +517,7 @@ CPlotter QFrame -
plotter.h
+
widgets/plotter.h
1
diff --git a/wsjtx.pro b/wsjtx.pro index 846cc5463..0615a89b8 100644 --- a/wsjtx.pro +++ b/wsjtx.pro @@ -95,7 +95,7 @@ HEADERS += OmniRigTransceiver.hpp FORMS += mainwindow.ui about.ui Configuration.ui widegraph.ui astro.ui \ logqso.ui wf_palette_design_dialog.ui messageaveraging.ui echograph.ui \ - fastgraph.ui colorhighlighting.ui ExportCabrillo.ui + fastgraph.ui colorhighlighting.ui ExportCabrillo.ui FoxLogWindow.ui RC_FILE = wsjtx.rc RESOURCES = wsjtx.qrc