diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp index bdbad0e69..48b914d12 100644 --- a/widgets/displaytext.cpp +++ b/widgets/displaytext.cpp @@ -19,6 +19,7 @@ #include "Network/LotWUsers.hpp" #include "models/DecodeHighlightingModel.hpp" #include "logbook/logbook.h" +#include "Logger.hpp" #include "qt_helpers.hpp" #include "moc_displaytext.cpp" @@ -212,9 +213,25 @@ void DisplayText::insertText(QString const& text, QColor bg, QColor fg void DisplayText::extend_vertical_scrollbar (int min, int max) { - if (high_volume_ - && m_config && m_config->decodes_from_top ()) + static int mod_last; + static int height; + if (high_volume_ && m_config && m_config->decodes_from_top ()) { + 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); + } if (max && max != modified_vertical_scrollbar_max_) { auto vp_margins = viewportMargins (); diff --git a/widgets/displaytext.h b/widgets/displaytext.h index b0db7ca8b..9ceeeeffd 100644 --- a/widgets/displaytext.h +++ b/widgets/displaytext.h @@ -66,7 +66,7 @@ private: QHash<QString, QPair<QColor, QColor>> highlighted_calls_; bool high_volume_; QMetaObject::Connection vertical_scroll_connection_; - int modified_vertical_scrollbar_max_; + long long modified_vertical_scrollbar_max_; }; #endif // DISPLAYTEXT_H diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index babb87a6b..7d6bf6bd5 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -3907,12 +3907,11 @@ void MainWindow::readFromStdout() //readFromStdout bool bProcessMsgNormally=ui->respondComboBox->currentText()=="CQ: First" or (ui->respondComboBox->currentText()=="CQ: Max Dist" and m_ActiveStationsWidget==NULL) or (m_ActiveStationsWidget!=NULL and !m_ActiveStationsWidget->isVisible()); - if (decodedtext.messageWords().length() >= 2) { - QString t=decodedtext.messageWords()[2]; - if(t.contains("R+") or t.contains("R-") or t=="R" or t=="RRR" or t=="RR73") bProcessMsgNormally=true; - } - else { - bProcessMsgNormally=true; + if (decodedtext.messageWords().length() >= 3) { + QString t=decodedtext.messageWords()[2]; + if(t.contains("R+") or t.contains("R-") or t=="R" or t=="RRR" or t=="RR73") bProcessMsgNormally=true; + } else { + bProcessMsgNormally=true; } if(bProcessMsgNormally) { m_bDoubleClicked=true; @@ -4602,7 +4601,7 @@ void MainWindow::guiUpdate() if(m_ntx==2 or m_ntx==3) { QStringList t=ui->tx2->text().split(' ', SkipEmptyParts); int n=t.size(); - m_xSent=t.at(n-2) + " " + t.at(n-1); + if (n > 3) m_xSent=t.at(n-2) + " " + t.at(n-1); } } } @@ -5394,6 +5393,10 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie MessageBox::information_message (this, tr ("Should you switch to RTTY contest mode?")); } + // This is necessary to prevent crashes caused by double-clicking messages with <...> in certain QSO situations. + if((SpecOp::EU_VHF==m_specOp or SpecOp::RTTY==m_specOp or SpecOp::FIELD_DAY==m_specOp) + and message.string().contains("<...>")) return; + if(SpecOp::EU_VHF==m_specOp and message_words.at(2).contains(m_baseCall) and (!message_words.at(3).contains(qso_partner_base_call)) and (!m_bDoubleClicked)) { return; @@ -9652,15 +9655,23 @@ list1Done: m_foxQSO[hc].tFoxRrpt = -1; //Have not received R+rpt m_foxQSO[hc].tFoxTxRR73 = -1; //Have not sent RR73 rm_tb4(hc); //Remove this Hound from tb4 - if(list2.size()==m_Nslots) goto list2Done; - if(m_foxQSO.count()>=2*m_Nslots) goto list2Done; + + if(list2.size()==m_Nslots) { + break; + } + + if(m_foxQSO.count()>=5*3 /* could have 5 slots * 3 states ([0-2],4,5) */) { + break; + } } list2Done: + n1=list1.size(); n2=list2.size(); n3=qMax(n1,n2); if(n3>m_Nslots) n3=m_Nslots; + for(int i=0; i<n3; i++) { hc1=""; fm=""; diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index 189f42d40..da211a228 100644 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -772,14 +772,18 @@ int CPlotter::rxFreq() {return m_rxFreq;} //rxFreq void CPlotter::mouseMoveEvent (QMouseEvent * event) { int x=event->x(); - int y=event->y(); - float pdB=10.0*(m_h-y)/m_vpixperdiv + 20.0; - if(y<(m_h-m_h2)) { - QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x)))); + if (!m_bTotalPower){ + QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x)))); } else { - QString t; - t=t.asprintf("%4.1f dB",pdB); - QToolTip::showText(event->globalPos(),t); + int y=event->y(); + float pdB=10.0*(m_h-y)/m_vpixperdiv + 20.0; + if(y<(m_h-m_h2)) { + QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x)))); + } else { + QString t; + t=t.asprintf("%4.1f dB",pdB); + QToolTip::showText(event->globalPos(),t); + } } QWidget::mouseMoveEvent(event); }