mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Improve performance of the UDP reference application message_aggregator
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8107 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
494ece8e37
commit
5d442bb596
@ -12,10 +12,10 @@ namespace
|
||||
QT_TRANSLATE_NOOP ("BeaconsModel", "DT"),
|
||||
QT_TRANSLATE_NOOP ("BeaconsModel", "Frequency"),
|
||||
QT_TRANSLATE_NOOP ("BeaconsModel", "Drift"),
|
||||
QT_TRANSLATE_NOOP ("BeaconsModel", "Callsign"),
|
||||
QT_TRANSLATE_NOOP ("BeaconsModel", "Grid"),
|
||||
QT_TRANSLATE_NOOP ("BeaconsModel", "Power"),
|
||||
QT_TRANSLATE_NOOP ("BeaconsModel", "Live"),
|
||||
QT_TRANSLATE_NOOP ("BeaconsModel", "Callsign"),
|
||||
};
|
||||
|
||||
QString live_string (bool off_air)
|
||||
@ -60,7 +60,7 @@ namespace
|
||||
live->setTextAlignment (Qt::AlignHCenter);
|
||||
|
||||
QList<QStandardItem *> row {
|
||||
new QStandardItem {client_id}, time_item, snr_item, dt, freq, dri, new QStandardItem {callsign}, gd, pwr, live};
|
||||
new QStandardItem {client_id}, time_item, snr_item, dt, freq, dri, gd, pwr, live, new QStandardItem {callsign}};
|
||||
Q_FOREACH (auto& item, row)
|
||||
{
|
||||
item->setEditable (false);
|
||||
@ -98,10 +98,10 @@ void BeaconsModel::add_beacon_spot (bool is_new, QString const& client_id, QTime
|
||||
&& item (row, 3)->data ().toFloat () == delta_time
|
||||
&& item (row, 4)->data ().value<Frequency> () == frequency
|
||||
&& data (index (row, 5)).toInt () == drift
|
||||
&& data (index (row, 6)).toString () == callsign
|
||||
&& data (index (row, 7)).toString () == grid
|
||||
&& data (index (row, 8)).toInt () == power
|
||||
&& data (index (row, 9)).toString () == live_string (off_air))
|
||||
&& data (index (row, 6)).toString () == live_string (off_air)
|
||||
&& data (index (row, 9)).toString () == callsign)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ QVariant ClientWidget::IdFilterModel::data (QModelIndex const& proxy_index, int
|
||||
{
|
||||
switch (proxy_index.column ())
|
||||
{
|
||||
case 6: // message
|
||||
case 8: // message
|
||||
{
|
||||
auto message = QSortFilterProxyModel::data (proxy_index).toString ();
|
||||
if (base_call_re_.pattern ().size ()
|
||||
@ -130,6 +130,7 @@ ClientWidget::ClientWidget (QAbstractItemModel * decodes_model, QAbstractItemMod
|
||||
, rx_df_label_ {new QLabel}
|
||||
, tx_df_label_ {new QLabel}
|
||||
, report_label_ {new QLabel}
|
||||
, columns_resized_ {false}
|
||||
{
|
||||
// set up widgets
|
||||
decodes_proxy_model_.setSourceModel (decodes_model);
|
||||
@ -246,12 +247,13 @@ void ClientWidget::decode_added (bool /*is_new*/, QString const& client_id, QTim
|
||||
, float /*delta_time*/, quint32 /*delta_frequency*/, QString const& /*mode*/
|
||||
, QString const& /*message*/, bool /*low_confidence*/, bool /*off_air*/)
|
||||
{
|
||||
if (client_id == id_)
|
||||
if (client_id == id_ && !columns_resized_)
|
||||
{
|
||||
decodes_stack_->setCurrentIndex (0);
|
||||
decodes_table_view_->resizeColumnsToContents ();
|
||||
decodes_table_view_->scrollToBottom ();
|
||||
columns_resized_ = true;
|
||||
}
|
||||
decodes_table_view_->scrollToBottom ();
|
||||
}
|
||||
|
||||
void ClientWidget::beacon_spot_added (bool /*is_new*/, QString const& client_id, QTime /*time*/, qint32 /*snr*/
|
||||
@ -259,11 +261,20 @@ void ClientWidget::beacon_spot_added (bool /*is_new*/, QString const& client_id,
|
||||
, QString const& /*callsign*/, QString const& /*grid*/, qint32 /*power*/
|
||||
, bool /*off_air*/)
|
||||
{
|
||||
if (client_id == id_)
|
||||
if (client_id == id_ && !columns_resized_)
|
||||
{
|
||||
decodes_stack_->setCurrentIndex (1);
|
||||
beacons_table_view_->resizeColumnsToContents ();
|
||||
columns_resized_ = true;
|
||||
}
|
||||
beacons_table_view_->scrollToBottom ();
|
||||
}
|
||||
|
||||
void ClientWidget::clear_decodes (QString const& client_id)
|
||||
{
|
||||
if (client_id == id_)
|
||||
{
|
||||
columns_resized_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
, float delta_time, Frequency delta_frequency, qint32 drift
|
||||
, QString const& callsign, QString const& grid, qint32 power
|
||||
, bool off_air);
|
||||
Q_SLOT void clear_decodes (QString const& client_id);
|
||||
|
||||
Q_SIGNAL void do_reply (QModelIndex const&, quint8 modifier);
|
||||
Q_SIGNAL void do_halt_tx (QString const& id, bool auto_only);
|
||||
@ -78,6 +79,7 @@ private:
|
||||
QLabel * rx_df_label_;
|
||||
QLabel * tx_df_label_;
|
||||
QLabel * report_label_;
|
||||
bool columns_resized_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,9 +16,9 @@ namespace
|
||||
QT_TRANSLATE_NOOP ("DecodesModel", "DT"),
|
||||
QT_TRANSLATE_NOOP ("DecodesModel", "DF"),
|
||||
QT_TRANSLATE_NOOP ("DecodesModel", "Md"),
|
||||
QT_TRANSLATE_NOOP ("DecodesModel", "Message"),
|
||||
QT_TRANSLATE_NOOP ("DecodesModel", "Confidence"),
|
||||
QT_TRANSLATE_NOOP ("DecodesModel", "Live"),
|
||||
QT_TRANSLATE_NOOP ("DecodesModel", "Message"),
|
||||
};
|
||||
|
||||
QString confidence_string (bool low_confidence)
|
||||
@ -63,7 +63,7 @@ namespace
|
||||
live->setTextAlignment (Qt::AlignHCenter);
|
||||
|
||||
QList<QStandardItem *> row {
|
||||
new QStandardItem {client_id}, time_item, snr_item, dt, df, md, new QStandardItem {message}, confidence, live};
|
||||
new QStandardItem {client_id}, time_item, snr_item, dt, df, md, confidence, live, new QStandardItem {message}};
|
||||
Q_FOREACH (auto& item, row)
|
||||
{
|
||||
item->setEditable (false);
|
||||
@ -101,9 +101,9 @@ void DecodesModel::add_decode (bool is_new, QString const& client_id, QTime time
|
||||
&& item (row, 3)->data ().toFloat () == delta_time
|
||||
&& item (row, 4)->data ().toUInt () == delta_frequency
|
||||
&& data (index (row, 5)).toString () == mode
|
||||
&& data (index (row, 6)).toString () == message
|
||||
&& data (index (row, 7)).toString () == confidence_string (low_confidence)
|
||||
&& data (index (row, 8)).toString () == live_string (off_air))
|
||||
&& data (index (row, 6)).toString () == live_string (off_air)
|
||||
&& data (index (row, 8)).toString () == message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -145,7 +145,7 @@ void DecodesModel::do_reply (QModelIndex const& source, quint8 modifiers)
|
||||
, item (row, 3)->data ().toFloat ()
|
||||
, item (row, 4)->data ().toInt ()
|
||||
, data (index (row, 5)).toString ()
|
||||
, data (index (row, 6)).toString ()
|
||||
, data (index (row, 8)).toString ()
|
||||
, confidence_string (true) == data (index (row, 7)).toString ()
|
||||
, modifiers);
|
||||
}
|
||||
|
@ -145,6 +145,7 @@ void MessageAggregatorMainWindow::add_client (QString const& id, QString const&
|
||||
connect (server_, &MessageServer::status_update, dock, &ClientWidget::update_status);
|
||||
connect (server_, &MessageServer::decode, dock, &ClientWidget::decode_added);
|
||||
connect (server_, &MessageServer::WSPR_decode, dock, &ClientWidget::beacon_spot_added);
|
||||
connect (server_, &MessageServer::clear_decodes, dock, &ClientWidget::clear_decodes);
|
||||
connect (dock, &ClientWidget::do_reply, decodes_model_, &DecodesModel::do_reply);
|
||||
connect (dock, &ClientWidget::do_halt_tx, server_, &MessageServer::halt_tx);
|
||||
connect (dock, &ClientWidget::do_free_text, server_, &MessageServer::free_text);
|
||||
|
Loading…
Reference in New Issue
Block a user