mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-06-18 06:13:23 -04:00
Ensure that "Start new period decodes at top" still works after several hours. Patch from Mike W9MDB.
This commit is contained in:
parent
db936dffc1
commit
ffe6ed7a1c
@ -19,6 +19,7 @@
|
|||||||
#include "Network/LotWUsers.hpp"
|
#include "Network/LotWUsers.hpp"
|
||||||
#include "models/DecodeHighlightingModel.hpp"
|
#include "models/DecodeHighlightingModel.hpp"
|
||||||
#include "logbook/logbook.h"
|
#include "logbook/logbook.h"
|
||||||
|
#include "Logger.hpp"
|
||||||
|
|
||||||
#include "qt_helpers.hpp"
|
#include "qt_helpers.hpp"
|
||||||
#include "moc_displaytext.cpp"
|
#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)
|
void DisplayText::extend_vertical_scrollbar (int min, int max)
|
||||||
{
|
{
|
||||||
if (high_volume_
|
static int mod_last;
|
||||||
&& m_config && m_config->decodes_from_top ())
|
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_)
|
if (max && max != modified_vertical_scrollbar_max_)
|
||||||
{
|
{
|
||||||
auto vp_margins = viewportMargins ();
|
auto vp_margins = viewportMargins ();
|
||||||
|
@ -66,7 +66,7 @@ private:
|
|||||||
QHash<QString, QPair<QColor, QColor>> highlighted_calls_;
|
QHash<QString, QPair<QColor, QColor>> highlighted_calls_;
|
||||||
bool high_volume_;
|
bool high_volume_;
|
||||||
QMetaObject::Connection vertical_scroll_connection_;
|
QMetaObject::Connection vertical_scroll_connection_;
|
||||||
int modified_vertical_scrollbar_max_;
|
long long modified_vertical_scrollbar_max_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DISPLAYTEXT_H
|
#endif // DISPLAYTEXT_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user