2012-05-22 17:09:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "displaytext.h"
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <vector>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <algorithm>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QMouseEvent>
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-25 01:48:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QDateTime>
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-05 12:22:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QTextCharFormat>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <QTextCursor>
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QTextBlock>
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-16 20:27:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QMenu>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <QAction>
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QListIterator>
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QRegularExpression>
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-08 18:03:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QScrollBar>
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-11 11:45:17 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "Configuration.hpp"
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-27 12:36:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "Decoder/decodedtext.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-02 12:45:05 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "Network/LotWUsers.hpp"
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-07 17:49:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "models/DecodeHighlightingModel.hpp"
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "logbook/logbook.h"
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-06 14:54:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "Logger.hpp"
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-13 08:53:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-01 12:37:52 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "qt_helpers.hpp"
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												Added support for use of "Standard" locations for writable files.
         This allows  writable files  to be  located in  the "correct"
         location for  each platform rather  than in the  directory of
         the  executable  which, in  general,  is  not recommended  or
         allowed in some cases.
         A preprocessor macro  WSJT_STANDARD_FILE_LOCATIONS is used to
         switch be tween old and new functionality, currently it is on
         by default.  It  can be turned off by defining  it to a false
         value (0)  or more simply  with cmake-gui setting  the option
         with  the same  name.  JTAlert  can  only work  with the  old
         non-standard file  locations until  Laurie VK3AMA  chooses to
         support the new file locations.
         Even  if the  above is  not  enabled; the  QSettings file  is
         written to a  user specific location so it will  be shared by
         all instances  of the  program (i.e.  across  upgrades).  See
         below for multiple concurrent instance support changes.
Added a command line parser module for Fortran.
         Added 'lib/options.f90'  to facilitate more  complex argument
         passing to jt9 to cover explicit file locations.
Changed the way multiple concurrent instances are handled.
         This is  to allow the program  to be run multiple  times from
         the same installation directory.
         A new wsjtx command line  optional argument is available "-r"
         or  "--rig"   which  enables  multiple   concurrent  instance
         support.  The  parameter of the  new option is a  unique name
         signifying  a rig  or equivalent.   The name  is used  as the
         shared memory segment key and  in window titles.  The name is
         also used to  access unique settings files  and writable data
         files like ALL.TXT  and log files.  No attempt  has been made
         to share these files between concurrent instances.
         If  "-r" or  "--rig" is  used  without a  parameter it  still
         enables  multiple   concurrent  instance  support   for  that
         instance.  All instances must use  a unique parameter, one of
         which may be empty.
         The        rig       name        is       appended        the
         QCoreApplication::applicationName() for convenient usage like
         window titles.
Set non Qt locale to "C".
         This ensures that C library functions give consistent results
         whatever the  system locale is set  to.  QApplication follows
         the system locale as before.  Thus using QApplication and its
         descendants  like widgets  and QString  for all  user visible
         formating will give correct l10n and using C/C++ library will
         give consistent formatting across locales.
Added top level C++ exception handling to main.cpp.
         Because  the   new  transceiver  framework   uses  exceptions
         internally, the main function now handles any exceptions that
         aren't caught.
Retired devsetup, replaced with Configuration.
         Configuration  is  a  class  that encapsulates  most  of  the
         configuration  behavior.   Because  rig configuration  is  so
         closely coupled with rig operation, Configuration serves as a
         proxy  for   access  to  the  rig   control  functions.   See
         Configuration.hpp  for  more  details  of  the  Configuration
         interface.
Menu changes.
         Various checkable  menu actions moved  from main menu  to the
         Configuration  dialog.   The  whole settings  menu  has  been
         retired with  the single  "Settings..."  action moved  to the
         file  menu  for  consistency  on  Mac  where  it  appears  as
         "Preferences" in line with Mac guidelines.
New data models for data used by the application.
         ADIF amateur band parameters,  free text message macros, spot
         working   frequencies  and,   station  information   (station
         descriptions and transverter offsets per band) each implement
         the  QAbstractItemModel interface  allowing them  to be  used
         directly with  Qt view widgets  (Bands.hpp, FrequencyList.hpp
         and, StationList.hpp).  Configuration  manages maintenance of
         an instance of  all but the former of the  above models.  The
         ADIF band  model is  owned by  Configuration but  requires no
         user maintenance as it is immutable.
Band combo box gets more functionality.
         This  widget is  now an  editable QComboBox  with some  extra
         input capabilities.
         The popup list is still the list of spot working frequencies,
         now  showing the  actual  frequency decorated  with the  band
         name.  This  allows multiple  spot frequencies  on a  band if
         required.
         The  line edit  allows direct  frequency entry  in mega-Hertz
         with  a completer  built  in to  suggest  the available  spot
         working frequencies.   It also  allows band name  entry where
         the  first  available  spot working  frequency  is  selected.
         Recognized band names are those  that are defined by the ADIF
         specification and  can be found  in in the  implementation of
         the ADIF bands model (Bands.cpp).
         If an out of band frequency  is chosen, the line edit shows a
         warning red  background and the  text "OOB".  Out of  band is
         only defined  by the  ADIF band limits  which in  general are
         wider than any entities regulations.
Qt 5.2 now supports default audio i/p and o/p devices.
         These devices are placeholders  for whatever the user defines
         as the  default device.   Because of  this they  need special
         treatment as  the actual device  used is chosen at  open time
         behind the scenes.
Close-down behavior is simplified.
         The close-down  semantics were broken such  that some objects
         were not being shut down cleanly, this required amendments to
         facilitate correct close down of threads.
User font selection added to Configuration UI.
         Buttons to set the application font and the font for the band
         and  Rx frequency  activity widgets  have been  added to  the
         Configuration UI to replace the file based font size control.
Free text macros now selected directly.
         The free text line edit  widgets are now editable combo boxes
         that have  the current free  text macro definitions  as their
         popup  list.   The old  context  menu  to  do this  has  been
         retired.
Astronomical data window dynamically formatted and has font a chooser.
         This window is now autonomous,  has its own font chooser and,
         dynamically resizes to cover the contents.
Double click to Tx enabled now has its own widget in the status bar.
QDir used for portable path and file name handling throughout.
The  "Monitor", "Decode",  "Enable  Tx" and,  "Tune"  buttons are  now
checkable.
         Being checkable allows these  buttons control their own state
         and rendering.
Calls to PSK Reporter interface simplified.
         In   mainwindow.cpp  the   calls   to   this  interface   are
         rationalized to just 3 locations.
Manipulation of ALL.TXT simplified.
         Moved, where possible, to common functions.
Elevated frequency types to be Qt types.
         Frequency  and FrequencyDelta  defined as  Qt types  in their
         meta-type system  (Radio.hpp).  They  are integral  types for
         maximum accuracy.
Re-factored rig control calls in mainwindow.cpp.
         The new  Configuration proxy  access to rig  control required
         many changes  (mostly simplifications) to the  MainWindow rig
         control code.  Some  common code has been  gathered in member
         functions   like   qsy(),   monitor(),   band_changed()   and
         auto_tx_mode().
Rig control enhancements.
         The  rig control  for  clients interface  is  declared as  an
         abstract    interface   (See    Transceiver.hpp).    Concrete
         implementations of this interface are provided for the Hamlib
         rig  control library,  DX Lab  Suite Commander  via a  TCP/IP
         command channel, Ham  Radio Deluxe also via  a TCP/IP command
         channel and, OmniRig via its Windows COM server interface.
         Concrete Transceiver implementations are expected to be moved
         to a separate thread after construction since many operations
         are blocking  and not suitable  for running in a  GUI thread.
         To facilitate this all  instantiation of concrete Transceiver
         instances are handled by  Configuration using a factory class
         (TransceiverFactory)   for   configuration  parameter   based
         instantiation.
         Various   common  functionality   shared  by   different  rig
         interface implementations  are factored out into  helper base
         classes that  implement or delegate parts  of the Transceiver
         interface.  They  are TransceiverBase  which caches  state to
         minimize expensive rig commands, it also maps the Transceiver
         interface  into a  more  convenient  form for  implementation
         (template methods).  PollingTransceiver that provides a state
         polling   mechanism  that   only   reports  actual   changes.
         EmulateSplitTransceiver  that  provides  split  operation  by
         QSYing on PTT state changes.
         EmulateSplitTransceiver can  be used with  any implementation
         as  it follows  the GoF  Decorator pattern  and can  wrap any
         Transceiver implementation.
         OmniRigTransceiver is  derived directly  from TransceiverBase
         since  it doesn't  require  polling due  to its  asynchronous
         nature.  OmniRigTransceiver is only built on Windows as it is
         a COM server client.  To build  it you must first install the
         OmniRig     client     on     the     development     machine
         (http://www.dxatlas.com/omnirig/).
         DXLabSuiteCommanderTransceiver          derives          from
         PollingTransceiver since  it is a  synchronous communications
         channel.   No  third  party  library  is  required  for  this
         interface.
         HRDTransceiver also derives from PollingTransceiver.  The HRD
         interface  library has  been  reverse  engineered to  provide
         functionality with  all available versions of  HRD.  No third
         party libraries are required.
         HamlibTransceiver  likewise  derives from  PollingTransceiver
         since  the Hamlib  asynchronous interface  is non-functional.
         Although this  class will interface with  the release version
         of Hamlib (1.2.15.3);  for correct operation on  most rigs it
         needs to  run with the  latest master branch code  of Hamlib.
         During development many changes to Hamlib have been submitted
         and accepted,  hence this requirement.  Hamlib  source can be
         obtained from git://git.code.sf.net/p/hamlib/code  and at the
         time of writing he master branch was at SHA 6e4432.
         The Hamlib interface directly calls the "C" interface and the
         modified rigclass.{h,cpp} files have been retired.
         There is a rig type selection of "None" which may be used for
         non-CAT  rigs, this  is actually  a connection  to the  dummy
         Hamlib device.
         PollingTransvceiver   derives    from   TransceiverBase   and
         TransceiverBase derives from the Transceiver interface.
         Each interface implementation offers  some possibility of PTT
         control via  a different serial  port than the CAT  port.  We
         also support PTT  control directly via a  second serial port.
         This is done  by delegating to a dummy  Hamlib instance which
         is   only   used   for   PTT  control.    This   means   that
         DXLabSuiteCommanderTransceiver,       HRDTransceiver      and
         OmniRigTransceiver  always  wrap  a  dummy  HamlibTransceiver
         instance.  The  factory class TransceiverFactory  manages all
         these constructional complexities.
         Serial port  selection combo  boxes are  now editable  with a
         manually  entered value  being  saved to  the settings  file.
         This allows  a non-standard  port device  to be  used without
         having to edit the settings file manually.
         For TCP/IP  network CAT  interfaces; the network  address and
         port  may  be specified  allowing  the  target device  to  be
         located on a different machine  from the one running wsjtx if
         required.  The  default used when  the address field  is left
         blank is the correct one for normal usage on the local host.
         Selecting a polling  interval of zero is  no longer possible,
         this  is because  the rig  control capability  can no  longer
         support one way connection.  This  is in line with most other
         CAT control software.
         In the Configuration dialog there are options to select split
         mode  control  by  the  software  and  mode  control  by  the
         software.  For  the former  "None", "Rig"  and "Fake  it" are
         available,  for  the latter  "None",  "USB"  and, "Data"  are
         available.  Because  tone generation is implicitly  linked to
         split mode  operation; it is  no longer possible to  have the
         software in split  mode and the rig not or  vice versa.  This
         may mean some rigs cannot be used in split mode and therefore
         not in dual JT65+JT9 until  issues with CAT control with that
         rig are  resolved.  Single  mode with VOX  keying and  no CAT
         control are still possible so even the most basic transceiver
         setup is supported as before.
         Configuration now  supports a  frequency offset  suitable for
         transverter   operation.     The   station    details   model
         (StationList.hpp) includes  a column  to store an  offset for
         each band if required.
CMake build script improvements.
         The CMakeLists.txt from the  'lib' directory has been retired
         with its  contents merged into the  top level CMakeLists.txt.
         Install  target support  has been  greatly improved  with the
         Release build  configuration now building a  fully standalone
         installation  on Mac  and Windows.   The Debug  configuration
         still   builds   an   installation   that   has   environment
         dependencies for  external libraries, which is  desirable for
         testing and debugging.
         Package target  support is largely complete  for Mac, Windows
         and, Linux, it should be possible to build release installers
         directly from CMake/CPack.
         Cmake FindXXXX.cmake  modules have been added  to improve the
         location of fftw-3 and Hamlib packages.
         Version numbers are now stored in Versions.cmake and work in
         concert with automatic svn revision lookup during build.  The
         version string becomes 'rlocal'± if there are any uncommitted
         changes in the build source tree.
Moved resource like files to Qt resources.
      	 Because location of resource files  (when they cannot go into
      	 the  installation directory  because of  packaging rules)  is
      	 hard to standardize.  I have used the Qt  resource system for
      	 all ancillary data files. Some  like kvasd.dat are dumped out
      	 to the temp (working directory)  because they are accessed by
      	 an external program, others like the audio samples are copied
      	 out so  they appear in  the data directory under  the default
      	 save directory.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3929 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
											
										 
										
											2014-03-26 13:21:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "moc_displaytext.cpp"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-16 20:27:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								DisplayText::DisplayText(QWidget *parent)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  : QTextEdit(parent)
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  , m_config {nullptr}
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-16 20:27:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  , erase_action_ {new QAction {tr ("&Erase"), this}}
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-08 18:03:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  , high_volume_ {false}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  , modified_vertical_scrollbar_max_ {-1}
							 | 
						
					
						
							
								
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  setReadOnly (true);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-31 17:47:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  setUndoRedoEnabled (false);
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  viewport ()->setCursor (Qt::ArrowCursor);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  setWordWrapMode (QTextOption::NoWrap);
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-16 20:27:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // max lines to limit heap usage
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  document ()->setMaximumBlockCount (5000);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // context menu erase action
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  setContextMenuPolicy (Qt::CustomContextMenu);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  connect (this, &DisplayText::customContextMenuRequested, [this] (QPoint const& position) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      auto * menu = createStandardContextMenu (position);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      menu->addAction (erase_action_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      menu->exec (mapToGlobal (position));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      delete menu;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    });
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  connect (erase_action_, &QAction::triggered, this, &DisplayText::erase);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void DisplayText::erase ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  clear ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Q_EMIT erased ();
							 | 
						
					
						
							
								
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-05 12:22:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::setContentFont(QFont const& font)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  char_font_ = font;
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-05 12:22:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  selectAll ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto cursor = textCursor ();
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  cursor.beginEditBlock ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto char_format = cursor.charFormat ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  char_format.setFont (char_font_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  cursor.mergeCharFormat (char_format);
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-05 12:22:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  cursor.clearSelection ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  cursor.movePosition (QTextCursor::End);
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 20:25:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // position so viewport scrolled to left
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  cursor.movePosition (QTextCursor::Up);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  cursor.movePosition (QTextCursor::StartOfLine);
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  cursor.endEditBlock ();
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 20:25:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-08 18:03:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!high_volume_ || !m_config || !m_config->decodes_from_top ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      setTextCursor (cursor);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      ensureCursorVisible ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-05 12:22:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-06 21:49:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  Q_EMIT selectCallsign(e->modifiers ());
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-11 11:45:17 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-04-10 20:25:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::insertLineSpacer(QString const& line)
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-12 17:23:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  insertText (line, "#d3d3d3");
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-25 01:48:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  using Highlight = DecodeHighlightingModel::Highlight;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  using highlight_types = std::vector<Highlight>;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Highlight set_colours (Configuration const * config, QColor * bg, QColor * fg, highlight_types const& types)
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    Highlight result = Highlight::CQ;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (config)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        QListIterator<DecodeHighlightingModel::HighlightInfo> it {config->decode_highlighting ().items ()};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // iterate in reverse to honor priorities
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        it.toBack ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        while (it.hasPrevious ())
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            auto const& item = it.previous ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            auto const& type = std::find (types.begin (), types.end (), item.type_);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            if (type != types.end () && item.enabled_)
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                if (item.background_.style () != Qt::NoBrush)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    *bg = item.background_.color ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                if (item.foreground_.style () != Qt::NoBrush)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    *fg = item.foreground_.color ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                result = item.type_;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return result;            // highest priority enabled highlighting
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-12 17:23:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::insertText(QString const& text, QColor bg, QColor fg
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             , QString const& call1, QString const& call2, QTextCursor::MoveOperation location)
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-25 01:48:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto cursor = textCursor ();
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-12 17:23:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  cursor.movePosition (location);
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto block_format = cursor.blockFormat ();
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto format = cursor.blockCharFormat ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  format.setFont (char_font_);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 10:31:23 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  block_format.clearBackground ();
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (bg.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      block_format.setBackground (bg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  format.clearForeground ();
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (fg.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      format.setForeground (fg);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (cursor.position ())
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      cursor.insertBlock (block_format, format);
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      cursor.setBlockFormat (block_format);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      cursor.setBlockCharFormat (format);
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  int text_index {0};
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto temp_format = format;
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (call1.size ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      auto call_index = text.indexOf (call1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (call_index != -1) // sanity check
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          auto pos = highlighted_calls_.find (call1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          if (pos != highlighted_calls_.end ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              cursor.insertText(text.left (call_index));
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              if (pos.value ().first.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                  temp_format.setBackground (pos.value ().first);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              if (pos.value ().second.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                  temp_format.setForeground (pos.value ().second);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              cursor.insertText(text.mid (call_index, call1.size ()), temp_format);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              text_index = call_index + call1.size ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (call2.size ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      auto call_index = text.indexOf (call2, text_index);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (call_index != -1) // sanity check
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          auto pos = highlighted_calls_.find (call2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          if (pos != highlighted_calls_.end ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              temp_format = format;
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              cursor.insertText(text.mid (text_index, call_index - text_index), format);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              if (pos.value ().second.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                  temp_format.setBackground (pos.value ().first);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              if (pos.value ().second.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                  temp_format.setForeground (pos.value ().second);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              cursor.insertText(text.mid (call_index, call2.size ()), temp_format);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              text_index = call_index + call2.size ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  cursor.insertText(text.mid (text_index), format);
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // position so viewport scrolled to left
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  cursor.movePosition (QTextCursor::StartOfLine);
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-08 18:03:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!high_volume_ || !m_config || !m_config->decodes_from_top ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      setTextCursor (cursor);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      ensureCursorVisible ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-04 18:03:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  document ()->setMaximumBlockCount (document ()->maximumBlockCount ());
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-08 18:03:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::extend_vertical_scrollbar (int min, int max)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-06 14:54:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  static int mod_last;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  static int height;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (high_volume_ && m_config && m_config->decodes_from_top ())
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-08 18:03:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-06 14:54:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      auto m = modified_vertical_scrollbar_max_;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (m != mod_last) { height = m - mod_last;mod_last = m; }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      //auto vp_margins2 = viewportMargins ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (height == 0 && m > viewport()->height()) height =  abs( - viewport()->height());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      //LOG_INFO ("scrollbar min=" << min << " max="  << max << " mod=" << modified_vertical_scrollbar_max_ << " height=" << viewport()->height() << " top=" << vp_margins2.top() << " bottom=" << vp_margins2.bottom()) << " height=" << height << " mod_last=" << mod_last;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (max > 60000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          QString tmp = toPlainText();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          while (tmp != NULL && tmp.length() > 100 &&  max > 50000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            tmp.remove(0, tmp.indexOf("\n")+1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            max -= height;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          setPlainText(tmp);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-08 18:03:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (max && max != modified_vertical_scrollbar_max_)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          auto vp_margins = viewportMargins ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          // add enough to vertical scroll bar range to allow last
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          // decode to just scroll of the top of the view port
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          max += viewport ()->height () - vp_margins.top () - vp_margins.bottom ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          modified_vertical_scrollbar_max_ = max;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      verticalScrollBar ()->setRange (min, max);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void DisplayText::new_period ()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  extend_vertical_scrollbar (verticalScrollBar ()->minimum (), verticalScrollBar ()->maximum ());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (high_volume_ && m_config && m_config->decodes_from_top () && !vertical_scroll_connection_)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      vertical_scroll_connection_ = connect (verticalScrollBar (), &QScrollBar::rangeChanged
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                             , [this] (int min, int max) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                               extend_vertical_scrollbar (min, max );
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                             });
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  verticalScrollBar ()->setSliderPosition (verticalScrollBar ()->maximum ());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 01:03:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								QString DisplayText::appendWorkedB4 (QString message, QString call, QString const& grid,
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                     QColor * bg, QColor * fg, LogBook const& logBook,
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                     QString const& currentBand, QString const& currentMode,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                     QString extra)
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 05:11:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  QString countryName;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bool callB4;
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-03 16:31:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bool callB4onBand;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bool countryB4;
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-03 16:31:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bool countryB4onBand;
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-24 14:42:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bool gridB4;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool gridB4onBand;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bool continentB4;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool continentB4onBand;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool CQZoneB4;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool CQZoneB4onBand;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool ITUZoneB4;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bool ITUZoneB4onBand;
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-24 14:42:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 05:11:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if(call.length()==2) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    int i0=message.indexOf("CQ "+call);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    call=message.mid(i0+6,-1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    i0=call.indexOf(" ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    call=call.mid(0,i0);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(call.length()<3) return message;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(!call.contains(QRegExp("[0-9]|[A-Z]"))) return message;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-30 22:20:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto const& looked_up = logBook.countries ()->lookup (call);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  logBook.match (call, currentMode, grid, looked_up, callB4, countryB4, gridB4, continentB4, CQZoneB4, ITUZoneB4);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  logBook.match (call, currentMode, grid, looked_up, callB4onBand, countryB4onBand, gridB4onBand,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 continentB4onBand, CQZoneB4onBand, ITUZoneB4onBand, currentBand);
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-29 14:38:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if(grid=="") {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    gridB4=true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    gridB4onBand=true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-03 16:31:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-22 12:41:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if(callB4onBand) m_points=0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-22 22:08:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  message = message.trimmed ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  highlight_types types;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // no shortcuts here as some types may be disabled
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!countryB4) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::DXCC);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(!countryB4onBand) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::DXCCBand);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(!gridB4) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::Grid);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(!gridB4onBand) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::GridBand);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!callB4) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::Call);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(!callB4onBand) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::CallBand);
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-03 16:31:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!continentB4) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::Continent);
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-04 17:55:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if(!continentB4onBand) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::ContinentBand);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!CQZoneB4) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::CQZone);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(!CQZoneB4onBand) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::CQZoneBand);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!ITUZoneB4) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::ITUZone);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(!ITUZoneB4onBand) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    types.push_back (Highlight::ITUZoneBand);
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-04 17:55:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 01:03:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (m_config && m_config->lotw_users ().user (call))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      types.push_back (Highlight::LotW);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  types.push_back (Highlight::CQ);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  auto top_highlight = set_colours (m_config, bg, fg, types);
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-22 22:08:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  switch (top_highlight)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Highlight::Continent:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Highlight::ContinentBand:
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      extra += AD1CCty::continent (looked_up.continent);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      break;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Highlight::CQZone:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Highlight::CQZoneBand:
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      extra += QString {"CQ Zone %1"}.arg (looked_up.CQ_zone);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      break;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Highlight::ITUZone:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case Highlight::ITUZoneBand:
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      extra += QString {"ITU Zone %1"}.arg (looked_up.ITU_zone);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      break;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (m_bPrincipalPrefix)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          extra += looked_up.primary_prefix;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          auto countryName = looked_up.entity_name;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          // do some obvious abbreviations
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Islands", "Is.");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Island", "Is.");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("North ", "N. ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Northern ", "N. ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("South ", "S. ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("East ", "E. ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Eastern ", "E. ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("West ", "W. ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Western ", "W. ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Central ", "C. ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace (" and ", " & ");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Republic", "Rep.");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("United States", "U.S.A.");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Fed. Rep. of ", "");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("French ", "Fr.");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("Asiatic", "AS");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("European", "EU");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          countryName.replace ("African", "AF");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          extra += countryName;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-08 12:36:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    m_CQPriority=DecodeHighlightingModel::highlight_name(top_highlight);
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-22 22:08:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-30 14:23:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(((m_points == 00) or (m_points == -1)) and m_bDisplayPoints) return message;
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return leftJustifyAppendage (message, extra);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-22 11:22:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								QString DisplayText::leftJustifyAppendage (QString message, QString const& appendage0) const
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-22 11:22:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  QString appendage=appendage0;
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-22 12:41:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if(m_bDisplayPoints and (m_points>0)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    appendage=" " + QString::number(m_points);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if(m_points<10) appendage=" " + appendage;
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-22 11:22:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (appendage.size ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // allow for seconds
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      int padding {message.indexOf (" ") > 4 ? 2 : 0};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // use a nbsp to save the start of appended text so we can find
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // it again later, align appended data at a fixed column if
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // there is space otherwise let it float to the right
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      int space_count {40 + padding - message.size ()};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (space_count > 0) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        message += QString {space_count, QChar {' '}};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      message += QChar::Nbsp + appendage;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-01 05:11:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return message;
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-30 02:27:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall,
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                     QString const& mode,
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-30 02:27:57 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                     bool displayDXCCEntity, LogBook const& logBook,
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-20 18:27:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                     QString const& currentBand, bool ppfx, bool bCQonly,
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-22 12:41:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                     bool haveFSpread, float fSpread, bool bDisplayPoints, int points)
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-22 12:41:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  m_points=points;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  m_bDisplayPoints=bDisplayPoints;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-04 17:55:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  m_bPrincipalPrefix=ppfx;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  QColor bg;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  QColor fg;
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-22 22:08:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  bool CQcall = false;
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-11 14:35:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto is_73 = decodedText.messageWords().filter (QRegularExpression {"^(73|RR73)$"}).size();
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-22 22:08:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (decodedText.string ().contains (" CQ ")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      || decodedText.string ().contains (" CQDX ")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      || decodedText.string ().contains (" QRZ "))
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2017-09-22 22:08:56 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      CQcall = true;
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 01:03:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (bCQonly) return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-03 16:31:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto message = decodedText.string();
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  QString dxCall;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  QString dxGrid;
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-24 14:42:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  decodedText.deCallAndGrid (/*out*/ dxCall, dxGrid);
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-24 15:51:29 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(!dxGrid.contains(grid_regexp)) dxGrid="";
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  message = message.left (message.indexOf (QChar::Nbsp)).trimmed (); // strip appended info
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  QString extra;
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-20 18:27:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (haveFSpread)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-22 01:05:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      extra += QString {"%1"}.arg (fSpread, 5, 'f', fSpread < 0.95 ? 3 : 2) + QChar {' '};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-30 19:40:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto ap_pos = message.lastIndexOf (QRegularExpression {R"((?:\?\s)?(?:a[0-9]|q[0-9][0-9*]?)$)"});
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-22 01:05:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (ap_pos >= 0)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      extra += message.mid (ap_pos) + QChar {' '};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      message = message.left (ap_pos).trimmed ();
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-20 18:27:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-08 12:36:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  m_CQPriority="";
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-11 14:35:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (CQcall || (is_73 && (m_config->highlight_73 ())))
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 01:03:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (displayDXCCEntity)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          // if enabled add the DXCC entity and B4 status to the end of the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          // preformated text line t1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          auto currentMode = mode;
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-11 14:35:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          message = appendWorkedB4 (message, dxCall, dxGrid, &bg, &fg
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                    , logBook, currentBand, currentMode, extra);
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 01:03:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      else
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          message = leftJustifyAppendage (message, extra);
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-01 16:19:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          highlight_types types {Highlight::CQ};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          if (m_config && m_config->lotw_users ().user (decodedText.CQersCall()))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              types.push_back (Highlight::LotW);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 01:03:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          set_colours (m_config, &bg, &fg, types);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 00:00:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-21 00:29:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      message = leftJustifyAppendage (message, extra);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-08 12:36:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-21 16:49:03 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (myCall.size ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      QString regexp {"[ <]" + myCall + "[ >]"};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (Radio::is_compound_callsign (myCall))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          regexp = "(?:" + regexp + "|[ <]" + Radio::base_callsign (myCall) + "[ >])";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if ((decodedText.clean_string () + " ").contains (QRegularExpression {regexp}))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          highlight_types types {Highlight::MyCall};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          set_colours (m_config, &bg, &fg, types);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-12 17:23:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  insertText (message.trimmed (), bg, fg, decodedText.call (), dxCall);
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-25 01:48:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-20 13:47:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                         bool bFastMode, double TRperiod)
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-25 01:48:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-17 19:35:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    QString t1=" @  ";
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-28 10:19:46 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(modeTx=="FT4") t1=" +  ";
							 | 
						
					
						
							
								
									
										
										
										
											2017-06-27 13:36:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(modeTx=="FT8") t1=" ~  ";
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-17 19:35:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(modeTx=="JT4") t1=" $  ";
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-04 15:55:03 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(modeTx=="Q65") t1=" :  ";
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-17 19:35:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(modeTx=="JT65") t1=" #  ";
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-13 17:52:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(modeTx=="MSK144") t1=" &  ";
							 | 
						
					
						
							
								
									
										
										
										
											2020-07-23 18:51:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(modeTx=="FST4") t1=" `  ";
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-25 01:48:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    QString t2;
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-07 02:56:57 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    t2 = t2.asprintf("%4d",txFreq);
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    QString t;
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-20 13:47:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(bFastMode or modeTx=="FT8" or modeTx=="FT4" or (TRperiod<60)) {
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "  Tx      " + t2 + t1 + text;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-07 17:09:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    } else if(modeTx.mid(0,6)=="FT8fox") {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        " Tx" + modeTx.mid(7) + " " + text;
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "  Tx      " + t2 + t1 + text;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 00:26:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    QColor bg;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    QColor fg;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-26 03:24:36 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    highlight_types types {Highlight::Tx};
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-18 21:11:39 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set_colours (m_config, &bg, &fg, types);
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-12 17:23:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    insertText (t, bg, fg);
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-15 12:24:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void DisplayText::displayQSY(QString text)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + "            " + text;
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-12 17:23:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  insertText (t, "hotpink");
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-03 18:27:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-12 17:23:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::displayHoundToBeCalled(QString t, bool bAtTop, QColor bg, QColor fg)
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-03 18:27:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-12 17:23:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (bAtTop)  t = t + "\n"; // need a newline when insertion at top
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  insertText(t, bg, fg, "", "", bAtTop ? QTextCursor::Start : QTextCursor::End);
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-03 18:27:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void update_selection (QTextCursor& cursor, QColor const& bg, QColor const& fg)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    QTextCharFormat format {cursor.charFormat ()};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (bg.isValid ())
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        format.setBackground (bg);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        format.clearBackground ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (fg.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        format.setForeground (fg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        format.clearForeground ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    cursor.mergeCharFormat (format);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  void reset_selection (QTextCursor& cursor)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // restore previous text format, we rely on the text
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // char format at he start of the selection being the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // old one which should be the case
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    auto c2 = cursor;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    c2.setPosition (c2.selectionStart ());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    cursor.setCharFormat (c2.charFormat ());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  QString get_timestamp (QTextCursor& cursor)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    QString timestamp;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (cursor.movePosition (QTextCursor::PreviousCharacter)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        && cursor.movePosition (QTextCursor::StartOfLine)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        && cursor.movePosition (QTextCursor::EndOfWord, QTextCursor::KeepAnchor)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        && cursor.hasSelection ())
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        timestamp = cursor.selectedText ();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cursor.movePosition (QTextCursor::StartOfLine);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return timestamp;
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-29 14:38:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg,
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                      QColor const& fg, bool last_period_only)
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!callsign.size ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-04 03:41:11 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  auto regexp = callsign;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // allow for hashed callsigns and escape any regexp metacharacters
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  QRegularExpression target {QString {"<?"}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             + regexp.replace (QLatin1Char {'+'}, QLatin1String {"\\+"})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                 .replace (QLatin1Char {'.'}, QLatin1String {"\\."})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                 .replace (QLatin1Char {'?'}, QLatin1String {"\\?"})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             + QString {">?"}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             , QRegularExpression::DontCaptureOption};
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  QTextCharFormat old_format {currentCharFormat ()};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  QTextCursor cursor {document ()};
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (last_period_only)
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      // highlight each instance of the given callsign (word) in the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // current period
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      cursor.movePosition (QTextCursor::End);
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      QTextCursor period_start {cursor};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      QTextCursor prior {cursor};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      auto period_timestamp = get_timestamp (period_start);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      while (period_timestamp.size () && period_timestamp == get_timestamp (prior))
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          period_start = prior;
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-05 17:55:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      cursor = period_start;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      while (!cursor.isNull ())
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-05 17:55:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords);
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          if (!cursor.isNull () && cursor.hasSelection ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              if (bg.isValid () || fg.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  update_selection (cursor, bg, fg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  reset_selection (cursor);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      auto pos = highlighted_calls_.find (callsign);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (bg.isValid () || fg.isValid ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          auto colours = qMakePair (bg, fg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          if (pos == highlighted_calls_.end ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              pos = highlighted_calls_.insert (callsign.toUpper (), colours);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              pos.value () = colours; // update colours
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          while (!cursor.isNull ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              if (!cursor.isNull () && cursor.hasSelection ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  update_selection (cursor, bg, fg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-01 16:09:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      else
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        {
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-01 16:09:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          if (pos != highlighted_calls_.end ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              highlighted_calls_.erase (pos);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          QTextCursor cursor {document ()};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          while (!cursor.isNull ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            {
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-24 16:33:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              if (!cursor.isNull () && cursor.hasSelection ())
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  reset_selection (cursor);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-28 22:25:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  setCurrentCharFormat (old_format);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |