diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a21782c..02f2ddf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,8 +95,6 @@ include(VersionCompute) #------------------------------------------------------------------------------# option(WSJT_QDEBUG_TO_FILE "Redirect Qt debugging messages to a trace file.") -option(WSJT_TRACE_CAT "Debugging option that turns on CAT diagnostics.") -option(WSJT_TRACE_CAT_POLLS "Debugging option that turns on CAT diagnostics during polling.") option(WSJT_HAMLIB_TRACE "Debugging option that turns on minimal Hamlib internal diagnostics.") option(WSJT_RIG_NONE_CAN_SPLIT "Allow split operation with \"None\" as rig.") @@ -121,26 +119,6 @@ cmake_dependent_option( "CMAKE_BUILD_TYPE STREQUAL Debug" OFF) -#------------------------------------------------------------------------------# -# Handle Qt debugging statements in release builds. -#------------------------------------------------------------------------------# - -if (WSJT_QDEBUG_IN_RELEASE) - # context info in Qt message handler in release configuration - set_property( - DIRECTORY - APPEND - PROPERTY COMPILE_DEFINITIONS $<$>:QT_MESSAGELOGCONTEXT> - ) -else (WSJT_QDEBUG_IN_RELEASE) - # disable Qt trace and warning messages from release configurations - set_property( - DIRECTORY - APPEND - PROPERTY COMPILE_DEFINITIONS $<$>:QT_NO_DEBUG_OUTPUT;QT_NO_WARNING_OUTPUT> - ) -endif (WSJT_QDEBUG_IN_RELEASE) - #------------------------------------------------------------------------------# # Ensure we have required library dependencies; we'll need headers from the # Boost and FFTW3 libraries. diff --git a/CMakeLists.txt.legacy b/CMakeLists.txt.legacy index a92d42bf..162bf7a1 100644 --- a/CMakeLists.txt.legacy +++ b/CMakeLists.txt.legacy @@ -89,8 +89,6 @@ option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts files (WARNING: make clean will delete the source .ts files! Danger!)") option (WSJT_SHARED_RUNTIME "Debugging option that allows running from a shared Cloud directory.") option (WSJT_QDEBUG_TO_FILE "Redirect Qt debuging messages to a trace file.") -option (WSJT_TRACE_CAT "Debugging option that turns on CAT diagnostics.") -option (WSJT_TRACE_CAT_POLLS "Debugging option that turns on CAT diagnostics during polling.") option (WSJT_HAMLIB_TRACE "Debugging option that turns on minimal Hamlib internal diagnostics.") option (WSJT_SKIP_MANPAGES "Skip *nix manpage generation." ON) option (WSJT_RIG_NONE_CAN_SPLIT "Allow split operation with \"None\" as rig.") diff --git a/Configuration.cpp b/Configuration.cpp index d311d314..eccaf349 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -880,10 +880,7 @@ bool Configuration::is_dummy_rig () const bool Configuration::transceiver_online () { -#if WSJT_TRACE_CAT qDebug () << "Configuration::transceiver_online: " << m_->cached_rig_state_; -#endif - return m_->have_rig (); } @@ -894,44 +891,31 @@ int Configuration::transceiver_resolution () const void Configuration::transceiver_offline () { -#if WSJT_TRACE_CAT qDebug () << "Configuration::transceiver_offline:" << m_->cached_rig_state_; -#endif - m_->close_rig (); } void Configuration::transceiver_frequency (Frequency f) { -#if WSJT_TRACE_CAT qDebug () << "Configuration::transceiver_frequency:" << f << m_->cached_rig_state_; -#endif m_->transceiver_frequency (f); } void Configuration::transceiver_tx_frequency (Frequency f) { -#if WSJT_TRACE_CAT qDebug () << "Configuration::transceiver_tx_frequency:" << f << m_->cached_rig_state_; -#endif - m_->transceiver_tx_frequency (f); } void Configuration::transceiver_mode (MODE mode) { -#if WSJT_TRACE_CAT qDebug () << "Configuration::transceiver_mode:" << mode << m_->cached_rig_state_; -#endif - m_->transceiver_mode (mode); } void Configuration::transceiver_ptt (bool on) { -#if WSJT_TRACE_CAT qDebug () << "Configuration::transceiver_ptt:" << on << m_->cached_rig_state_; -#endif m_->transceiver_ptt (on); @@ -951,9 +935,7 @@ void Configuration::transceiver_ptt (bool on) void Configuration::sync_transceiver (bool force_signal, bool enforce_mode_and_split) { -#if WSJT_TRACE_CAT qDebug () << "Configuration::sync_transceiver: force signal:" << force_signal << "enforce_mode_and_split:" << enforce_mode_and_split << m_->cached_rig_state_; -#endif m_->sync_transceiver (force_signal); if (!enforce_mode_and_split) @@ -3667,9 +3649,7 @@ void Configuration::impl::sync_transceiver (bool /*force_signal*/) void Configuration::impl::handle_transceiver_update (TransceiverState const& state, unsigned sequence_number) { -#if WSJT_TRACE_CAT qDebug () << "Configuration::handle_transceiver_update: Transceiver State #:" << sequence_number << state; -#endif // only follow rig on some information, ignore other stuff cached_rig_state_.online (state.online ()); @@ -3717,10 +3697,7 @@ void Configuration::impl::handle_transceiver_update (TransceiverState const& sta void Configuration::impl::handle_transceiver_failure (QString const& reason) { -#if WSJT_TRACE_CAT qDebug () << "Configuration::handle_transceiver_failure: reason:" << reason; -#endif - close_rig (); ui_->test_PTT_push_button->setChecked (false); diff --git a/DXLabSuiteCommanderTransceiver.cpp b/DXLabSuiteCommanderTransceiver.cpp index 4a89b4a0..fb3adf9c 100644 --- a/DXLabSuiteCommanderTransceiver.cpp +++ b/DXLabSuiteCommanderTransceiver.cpp @@ -251,11 +251,7 @@ void DXLabSuiteCommanderTransceiver::do_mode (MODE m) void DXLabSuiteCommanderTransceiver::poll () { -#if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS - bool quiet {false}; -#else - bool quiet {true}; -#endif + bool quiet {!transceiverbase_js8().isDebugEnabled()}; auto reply = command_with_reply ("CmdGetFreq", quiet); if (0 == reply.indexOf (" +Do not let youself be confused: +This source file does not presently take part in the build. Decoder::Decoder(QObject *parent): QObject(parent) @@ -158,3 +160,5 @@ void Worker::start(QString path, QStringList args){ void Worker::quit(){ setProcess(nullptr); } + +Q_LOGGING_CATEGORY(decoder_js8, "decoder.js8", QtWarningMsg) diff --git a/Decoder.h b/Decoder.h index 3a958183..0acd6d95 100644 --- a/Decoder.h +++ b/Decoder.h @@ -7,7 +7,7 @@ #include "ProcessThread.h" -#include +#include #include #include #include @@ -87,5 +87,6 @@ private: QThread m_thread; }; +Q_DECLARE_LOGGING_CATEGORY(decoder_js8) #endif // DECODER_H diff --git a/EmulateSplitTransceiver.cpp b/EmulateSplitTransceiver.cpp index 7e84919e..2941e255 100644 --- a/EmulateSplitTransceiver.cpp +++ b/EmulateSplitTransceiver.cpp @@ -19,9 +19,8 @@ EmulateSplitTransceiver::EmulateSplitTransceiver (std::unique_ptr w void EmulateSplitTransceiver::set (TransceiverState const& s, unsigned sequence_number) noexcept { -#if WSJT_TRACE_CAT qDebug () << "EmulateSplitTransceiver::set: state:" << s << "#:" << sequence_number; -#endif + // save for use in updates rx_frequency_ = s.frequency (); tx_frequency_ = s.tx_frequency (); @@ -37,9 +36,7 @@ void EmulateSplitTransceiver::set (TransceiverState const& s, unsigned sequence_ void EmulateSplitTransceiver::handle_update (TransceiverState const& state, unsigned sequence_number) { -#if WSJT_TRACE_CAT qDebug () << "EmulateSplitTransceiver::handle_update: from wrapped:" << state; -#endif if (state.split ()) { @@ -55,9 +52,7 @@ void EmulateSplitTransceiver::handle_update (TransceiverState const& state, new_state.tx_frequency (tx_frequency_); new_state.split (split_); -#if WSJT_TRACE_CAT qDebug () << "EmulateSplitTransceiver::handle_update: signalling:" << state; -#endif // signal emulated state Q_EMIT update (new_state, sequence_number); diff --git a/HRDTransceiver.cpp b/HRDTransceiver.cpp index 2381bdd0..d0ad8e79 100644 --- a/HRDTransceiver.cpp +++ b/HRDTransceiver.cpp @@ -179,13 +179,11 @@ int HRDTransceiver::do_start () radios_.push_back (std::forward_as_tuple (entries[0].toUInt (), entries[1])); } -#if WSJT_TRACE_CAT TRACE_CAT ("HRDTransceiver", "radios:-"); Q_FOREACH (auto const& radio, radios_) { TRACE_CAT ("HRDTransceiver", "\t[" << std::get<0> (radio) << "] " << std::get<1> (radio)); } -#endif auto current_radio_name = send_command ("get radio", false, false, true); HRD_info << "Current radio: " << current_radio_name << "\n"; @@ -401,14 +399,12 @@ void HRDTransceiver::map_modes (int dropdown, ModeMap *map) map->push_back (std::forward_as_tuple (FM, find_dropdown_selection (dropdown, QRegularExpression ("^(FM|FM\\(N\\)|FM-N|WFM)$")))); map->push_back (std::forward_as_tuple (DIG_FM, find_dropdown_selection (dropdown, QRegularExpression ("^(PKT-FM|PKT|FM)$")))); -#if WSJT_TRACE_CAT TRACE_CAT ("HRDTransceiver", "for dropdown" << dropdown_names_[dropdown]); std::for_each (map->begin (), map->end (), [this, dropdown] (ModeMap::value_type const& item) { auto const& rhs = std::get<1> (item); TRACE_CAT ("HRDTransceiver", '\t' << std::get<0> (item) << "<->" << (rhs.size () ? dropdowns_[dropdown_names_[dropdown]][rhs.front ()] : "None")); }); -#endif } int HRDTransceiver::lookup_mode (MODE mode, ModeMap const& map) const @@ -887,41 +883,40 @@ bool HRDTransceiver::is_button_checked (int button_index, bool no_debug) void HRDTransceiver::poll () { -#if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS - bool quiet {false}; - qDebug () << "+++++++ poll dump +++++++"; - qDebug () << "reversed:" << reversed_; - is_button_checked (vfo_A_button_); - is_button_checked (vfo_B_button_); - is_button_checked (vfo_toggle_button_); - is_button_checked (split_mode_button_); - is_button_checked (split_off_button_); - is_button_checked (rx_A_button_); - is_button_checked (rx_B_button_); - get_dropdown (receiver_dropdown_); - is_button_checked (tx_A_button_); - is_button_checked (tx_B_button_); - is_button_checked (ptt_button_); - is_button_checked (alt_ptt_button_); - get_dropdown (mode_A_dropdown_); - get_dropdown (mode_B_dropdown_); - is_button_checked (data_mode_toggle_button_); - is_button_checked (data_mode_on_button_); - is_button_checked (data_mode_off_button_); - if (data_mode_dropdown_ >=0 - && data_mode_dropdown_selection_off_.size () - && data_mode_dropdown_selection_on_.size ()) + bool quiet {hrdtransceiver_js8().isDebugEnabled()}; + if (!quiet) { - get_dropdown (data_mode_dropdown_); + qDebug () << "+++++++ poll dump +++++++"; + qDebug () << "reversed:" << reversed_; + is_button_checked (vfo_A_button_); + is_button_checked (vfo_B_button_); + is_button_checked (vfo_toggle_button_); + is_button_checked (split_mode_button_); + is_button_checked (split_off_button_); + is_button_checked (rx_A_button_); + is_button_checked (rx_B_button_); + get_dropdown (receiver_dropdown_); + is_button_checked (tx_A_button_); + is_button_checked (tx_B_button_); + is_button_checked (ptt_button_); + is_button_checked (alt_ptt_button_); + get_dropdown (mode_A_dropdown_); + get_dropdown (mode_B_dropdown_); + is_button_checked (data_mode_toggle_button_); + is_button_checked (data_mode_on_button_); + is_button_checked (data_mode_off_button_); + if (data_mode_dropdown_ >=0 + && data_mode_dropdown_selection_off_.size () + && data_mode_dropdown_selection_on_.size ()) + { + get_dropdown (data_mode_dropdown_); + } + if (!split_mode_dropdown_write_only_) + { + get_dropdown (split_mode_dropdown_); + } + qDebug () << "------- poll dump -------"; } - if (!split_mode_dropdown_write_only_) - { - get_dropdown (split_mode_dropdown_); - } - qDebug () << "------- poll dump -------"; -#else - bool quiet {true}; -#endif if (split_off_button_ >= 0) { diff --git a/HamlibTransceiver.cpp b/HamlibTransceiver.cpp index 9c53188c..ffd658e9 100644 --- a/HamlibTransceiver.cpp +++ b/HamlibTransceiver.cpp @@ -161,17 +161,14 @@ void HamlibTransceiver::register_transceivers (TransceiverFactory::Transceivers { rig_set_debug_callback (debug_callback, nullptr); -#if WSJT_HAMLIB_TRACE -#if WSJT_HAMLIB_VERBOSE_TRACE - rig_set_debug (RIG_DEBUG_TRACE); -#else - rig_set_debug (RIG_DEBUG_VERBOSE); -#endif -#elif defined (NDEBUG) - rig_set_debug (RIG_DEBUG_ERR); -#else - rig_set_debug (RIG_DEBUG_WARN); -#endif + if (hamlibtransceiver_js8().isDebugEnabled()) + rig_set_debug (RIG_DEBUG_TRACE); + else if (hamlibtransceiver_js8().isInfoEnabled()) + rig_set_debug (RIG_DEBUG_VERBOSE); + else if (hamlibtransceiver_js8().isWarningEnabled()) + rig_set_debug (RIG_DEBUG_WARN); + else + rig_set_debug (RIG_DEBUG_ERR); rig_load_all_backends (); rig_list_foreach_model (register_callback, registry); @@ -915,13 +912,10 @@ void HamlibTransceiver::do_mode (MODE mode) void HamlibTransceiver::poll () { -#if !WSJT_TRACE_CAT_POLLS -#if defined (NDEBUG) - rig_set_debug (RIG_DEBUG_ERR); -#else - rig_set_debug (RIG_DEBUG_WARN); -#endif -#endif + if(hamlibtransceiver_js8().isDebugEnabled()) + rig_set_debug (RIG_DEBUG_WARN); + else + rig_set_debug (RIG_DEBUG_ERR); freq_t f; rmode_t m; @@ -1034,19 +1028,14 @@ void HamlibTransceiver::poll () } } -#if !WSJT_TRACE_CAT_POLLS -#if WSJT_HAMLIB_TRACE -#if WSJT_HAMLIB_VERBOSE_TRACE - rig_set_debug (RIG_DEBUG_TRACE); -#else - rig_set_debug (RIG_DEBUG_VERBOSE); -#endif -#elif defined (NDEBUG) - rig_set_debug (RIG_DEBUG_ERR); -#else - rig_set_debug (RIG_DEBUG_WARN); -#endif -#endif + if (hamlibtransceiver_js8().isDebugEnabled()) + rig_set_debug (RIG_DEBUG_TRACE); + else if (hamlibtransceiver_js8().isInfoEnabled()) + rig_set_debug (RIG_DEBUG_VERBOSE); + else if (hamlibtransceiver_js8().isWarningEnabled()) + rig_set_debug (RIG_DEBUG_WARN); + else + rig_set_debug (RIG_DEBUG_ERR); } void HamlibTransceiver::do_ptt (bool on) diff --git a/MessageClient.cpp b/MessageClient.cpp index 5155365c..159ee10d 100644 --- a/MessageClient.cpp +++ b/MessageClient.cpp @@ -12,6 +12,8 @@ #include "pimpl_impl.hpp" #include "moc_MessageClient.cpp" +Q_DECLARE_LOGGING_CATEGORY(messageclient_js8) + /******************************************************************************/ // Constants /******************************************************************************/ diff --git a/PSKReporter.cpp b/PSKReporter.cpp index 529a125c..8c0f1991 100755 --- a/PSKReporter.cpp +++ b/PSKReporter.cpp @@ -31,6 +31,8 @@ #include "moc_PSKReporter.cpp" +Q_DECLARE_LOGGING_CATEGORY(pskreporter_js8) + /******************************************************************************/ // Constants /******************************************************************************/ diff --git a/README.md b/README.md index 7693f689..d3b73e4d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ JS8Call is a derivative of the WSJT-X application, restructured and redesigned f # Building JS8Call From Sourcecode Instructions can be found in [docs](docs) in the source tree for building JS8Call on MacOS, Linux and Windows, as well as a contributor's guide. + +# Debugging JS8Call + +You can get a lot of debug output reporting what the program does by setting the environment variable `QT_LOGGING_RULES` to an appropriate value. + +The value `*.js8=true` gives you all output there is. + +Each line starts with a "logging category". These can be used to filter, so fewer lines you are not interested in will be given. + +For example, if you are interested in lines starting with `mainwindow.js8` and `configuration.js8` only, to debug a certain problem, set `QT_LOGGING_RULES` to `mainwindow.js8=true;configuration.js8=true` to just see what those two have to say. + +You find `decoder.js8` a bit too noisy, you may use the value `*.js8=true;decoder.js8=false` to silence it, but still see all the others. + +The official documentation of what we are using here can be found at [https://doc.qt.io/qt-6/qloggingcategory.html#checking-category-configuration](https://doc.qt.io/qt-6/qloggingcategory.html#checking-category-configuration). + # History * July 6, 2017 - The initial idea of using a modification to the FT8 protocol to support long-form QSOs was developed by Jordan, KN4CRD, and submitted to the WSJT-X mailing list: https://sourceforge.net/p/wsjt/mailman/message/35931540/ * August 31, 2017 - Jordan, KN4CRD, did a little development and modified WSJT-X to support long-form QSOs using the existing FT8 protocol: https://sourceforge.net/p/wsjt/mailman/message/36020051/ He sent a video example to the WSJT-X group: https://widefido.wistia.com/medias/7bb1uq62ga @@ -146,4 +161,4 @@ on 11.0 or later, but I've only tested it on 14.6, 14.7, and 15.3. Testing on Linux and Windows has been ably provided by Joe Counsil, K0OG, who does the bulk of the grunt work while I largely just type things and drink coffee. -Allan Bazinet, W6BAZ \ No newline at end of file +Allan Bazinet, W6BAZ diff --git a/SpotClient.cpp b/SpotClient.cpp index 3fdbac51..bac24b63 100644 --- a/SpotClient.cpp +++ b/SpotClient.cpp @@ -8,6 +8,8 @@ #include "pimpl_impl.hpp" #include "moc_SpotClient.cpp" +Q_DECLARE_LOGGING_CATEGORY(spotclient_js8) + /******************************************************************************/ // Constants /******************************************************************************/ diff --git a/TransceiverBase.cpp b/TransceiverBase.cpp index ef77d51e..b2beff76 100644 --- a/TransceiverBase.cpp +++ b/TransceiverBase.cpp @@ -240,3 +240,5 @@ void TransceiverBase::offline (QString const& reason) // don't care } } + +Q_LOGGING_CATEGORY(transceiverbase_js8, "transceiverbase.js8", QtWarningMsg) diff --git a/TransceiverBase.hpp b/TransceiverBase.hpp index ea981d44..ae61e73b 100644 --- a/TransceiverBase.hpp +++ b/TransceiverBase.hpp @@ -4,7 +4,7 @@ #include #include - +#include #include "Transceiver.hpp" // @@ -154,17 +154,10 @@ private: unsigned last_sequence_number_; // from set state operation }; + // some trace macros -#if WSJT_TRACE_CAT -#define TRACE_CAT(FAC, MSG) qDebug () << QString {"%1::%2:"}.arg ((FAC)).arg (__func__) << MSG -#else -#define TRACE_CAT(FAC, MSG) -#endif - -#if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS -#define TRACE_CAT_POLL(FAC, MSG) qDebug () << QString {"%1::%2:"}.arg ((FAC)).arg (__func__) << MSG -#else -#define TRACE_CAT_POLL(FAC, MSG) -#endif +Q_DECLARE_LOGGING_CATEGORY(transceiverbase_js8) +#define TRACE_CAT(FAC, MSG) qCDebug (transceiverbase_js8) << QString {"%1::%2:"}.arg ((FAC)).arg (__func__) << MSG +#define TRACE_CAT_POLL(FAC, MSG) qCDebug (transceiverbase_js8) << QString {"%1::%2:"}.arg ((FAC)).arg (__func__) << MSG #endif diff --git a/commons.h b/commons.h index ea8b588a..57f475ea 100644 --- a/commons.h +++ b/commons.h @@ -20,12 +20,6 @@ #define JS8_ALLOW_EXTENDED 1 // allow extended latin-1 capital charset #define JS8_AUTO_SYNC 1 // enable the experimental auto sync feature -#ifdef QT_DEBUG -#define JS8_DEBUG_DECODE 0 // emit debug statements for the decode pipeline -#else -#define JS8_DEBUG_DECODE 0 -#endif - #define JS8_NUM_SYMBOLS 79 #define JS8_ENABLE_JS8A 1 #define JS8_ENABLE_JS8B 1 diff --git a/mainwindow.cpp b/mainwindow.cpp index 5e59021f..bb23e6fe 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -57,6 +57,7 @@ #include "soundout.h" #include "soundin.h" #include "Modulator.hpp" +#include "Decoder.h" #include "Detector.hpp" #include "plotter.h" #include "about.h" @@ -4629,11 +4630,15 @@ void MainWindow::guiUpdate() std::fill_n(std::begin(msgsent), 22, ' '); std::copy_n(std::begin(message), 12, std::begin(msgsent)); - qDebug() << "-> msg:" << message; - qDebug() << "-> bit:" << m_i3bit; - - for (int i = 0; i < 7; ++i) qDebug() << "-> tone" << i << "=" << itone[i]; - for (int i = JS8_NUM_SYMBOLS - 7; i < JS8_NUM_SYMBOLS; ++i) qDebug() << "-> tone" << i << "=" << itone[i]; + if(mainwindow_js8().isDebugEnabled()) + { + qDebug() << "-> msg:" << message; + qDebug() << "-> bit:" << m_i3bit; + for (int i = 0; i < 7; ++i) + qDebug() << "-> tone" << i << "=" << itone[i]; + for (int i = JS8_NUM_SYMBOLS - 7; i < JS8_NUM_SYMBOLS; ++i) + qDebug() << "-> tone" << i << "=" << itone[i]; + } msgibits = m_i3bit; msgsent[22] = 0; @@ -11299,3 +11304,6 @@ MainWindow::wisdomFileName() const { return QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("js8call_wisdom.dat")).toLocal8Bit(); } + +Q_LOGGING_CATEGORY(decoder_js8, "decoder.js8", QtWarningMsg) +Q_LOGGING_CATEGORY(mainwindow_js8, "mainwindow.js8", QtWarningMsg) diff --git a/wsjtx_config.h.in b/wsjtx_config.h.in index edddd9c6..1bf85f2b 100644 --- a/wsjtx_config.h.in +++ b/wsjtx_config.h.in @@ -19,8 +19,6 @@ extern "C" { #cmakedefine01 WSJT_SHARED_RUNTIME #cmakedefine01 WSJT_QDEBUG_TO_FILE #cmakedefine01 WSJT_QDEBUG_IN_RELEASE -#cmakedefine01 WSJT_TRACE_CAT -#cmakedefine01 WSJT_TRACE_CAT_POLLS #cmakedefine01 WSJT_HAMLIB_TRACE #cmakedefine01 WSJT_HAMLIB_VERBOSE_TRACE #cmakedefine01 WSJT_ENABLE_EXPERIMENTAL_FEATURES