WSJT-X/widgets/displaytext.h
Bill Somerville c6688534cd
Performance improvements to decode highlighting
The Highlight  Callsign (13)  UDP message now  operates in  a slightly
different way.  The  "Highlight last" field, when  true valued, causes
all  instances of  the specified  callsign  to be  highlighted in  the
decoding  period. This  allows external  applications to  highlight DX
callsigns even when  multiple stations are calling  them.  Before this
was  unlikely to  work since  the external  application would  have to
respond to  Decode (2) UDP  messages exceedingly quickly  to guarantee
successful highlighting  before another decode  with the same  DX call
was  printed.   There  should  be  no  changes  required  to  external
applications acting  as servers  to the  WSJT-X UDP  Message Protocol,
although  using  the  version  of the  Highlight  Callsign  (13)  with
"Highlight   last"  should   not  be   required  for   adhoc  callsign
highlighting. It should be reserved for commonly recurring targets and
limited to  no more than 100  active highlighting requests at  any one
time, otherwise there may be performance impacts on WSJT-X.
2020-05-24 16:33:14 +01:00

69 lines
2.3 KiB
C++

// -*- Mode: C++ -*-
#ifndef DISPLAYTEXT_H
#define DISPLAYTEXT_H
#include <QTextEdit>
#include <QFont>
#include <QHash>
#include <QPair>
#include <QString>
#include "Decoder/decodedtext.h"
class QAction;
class Configuration;
class LogBook;
class DisplayText
: public QTextEdit
{
Q_OBJECT
public:
explicit DisplayText(QWidget *parent = nullptr);
void set_configuration (Configuration const * configuration, bool high_volume = false)
{
disconnect (vertical_scroll_connection_);
m_config = configuration;
high_volume_ = high_volume;
}
void setContentFont (QFont const&);
void insertLineSpacer(QString const&);
void displayDecodedText(DecodedText const& decodedText, QString const& myCall, QString const& mode,
bool displayDXCCEntity, LogBook const& logBook,
QString const& currentBand=QString {}, bool ppfx=false, bool bCQonly=false);
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq, bool bFastMode);
void displayQSY(QString text);
void displayFoxToBeCalled(QString t, QColor bg = QColor {}, QColor fg = QColor {});
void new_period ();
QString CQPriority(){return m_CQPriority;};
Q_SIGNAL void selectCallsign (Qt::KeyboardModifiers);
Q_SIGNAL void erased ();
Q_SLOT void appendText (QString const& text, QColor bg = QColor {}, QColor fg = QColor {}
, QString const& call1 = QString {}, QString const& call2 = QString {});
Q_SLOT void erase ();
Q_SLOT void highlight_callsign (QString const& callsign, QColor const& bg, QColor const& fg, bool last_period_only);
private:
void mouseDoubleClickEvent (QMouseEvent *) override;
void extend_vertical_scrollbar (int min, int max);
Configuration const * m_config;
bool m_bPrincipalPrefix;
QString m_CQPriority;
QString appendWorkedB4(QString message, QString callsign
, QString const& grid, QColor * bg, QColor * fg
, LogBook const& logBook, QString const& currentBand
, QString const& currentMode);
QFont char_font_;
QAction * erase_action_;
QHash<QString, QPair<QColor, QColor>> highlighted_calls_;
bool high_volume_;
QMetaObject::Connection vertical_scroll_connection_;
int modified_vertical_scrollbar_max_;
};
#endif // DISPLAYTEXT_H