mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 11:20:49 +08:00
feat: support to disable scrolling when viewing logs
This commit is contained in:
parent
7a61b892b1
commit
2481bd75d3
@ -191,6 +191,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||
connect(infoWidget, &ConnectionInfoWidget::OnEditRequested, this, &MainWindow::OnEditRequested);
|
||||
connect(infoWidget, &ConnectionInfoWidget::OnJsonEditRequested, this, &MainWindow::OnEditJsonRequested);
|
||||
//
|
||||
connect(masterLogBrowser->verticalScrollBar(), &QSlider::valueChanged, this, &MainWindow::OnLogScrollbarValueChanged);
|
||||
//
|
||||
// Setup System tray icons and menus
|
||||
qvAppTrayIcon->setToolTip(TRAY_TOOLTIP_PREFIX);
|
||||
@ -920,6 +921,14 @@ void MainWindow::OnGroupDeleted(const GroupId &id, const QList<ConnectionId> &co
|
||||
groupNodes.remove(id);
|
||||
}
|
||||
|
||||
void MainWindow::OnLogScrollbarValueChanged(int value)
|
||||
{
|
||||
if (masterLogBrowser->verticalScrollBar()->maximum() == value)
|
||||
qvLogAutoScoll = true;
|
||||
else
|
||||
qvLogAutoScoll = false;
|
||||
}
|
||||
|
||||
void MainWindow::on_locateBtn_clicked()
|
||||
{
|
||||
auto id = KernelInstance->CurrentConnection();
|
||||
@ -1014,6 +1023,8 @@ void MainWindow::on_action_RCM_toQvLog_triggered()
|
||||
|
||||
void MainWindow::on_masterLogBrowser_textChanged()
|
||||
{
|
||||
if (!qvLogAutoScoll)
|
||||
return;
|
||||
auto bar = masterLogBrowser->verticalScrollBar();
|
||||
bar->setValue(bar->maximum());
|
||||
}
|
||||
|
@ -99,6 +99,8 @@ class MainWindow
|
||||
//
|
||||
void ReloadRecentConnectionList();
|
||||
void OnRecentConnectionsMenuReadyToShow();
|
||||
//
|
||||
void OnLogScrollbarValueChanged(int value);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
@ -154,6 +156,7 @@ class MainWindow
|
||||
QTextDocument *qvLogDocument = new QTextDocument(this);
|
||||
//
|
||||
int qvLogTimerId = -1;
|
||||
bool qvLogAutoScoll = true;
|
||||
QMenu *logRCM_Menu = new QMenu(this);
|
||||
QAction *action_RCM_tovCoreLog = new QAction(tr("Switch to vCore log"), this);
|
||||
QAction *action_RCM_toQvLog = new QAction(tr("Switch to Qv2ray log"), this);
|
||||
|
Loading…
Reference in New Issue
Block a user