mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:46:03 +00:00
Fix previous commit.
This commit is contained in:
parent
ed942cc4d4
commit
f556d7e103
@ -29,6 +29,8 @@ ConnectionsWindow::ConnectionsWindow(FortManager *fortManager, QWidget *parent)
|
||||
{
|
||||
setupUi();
|
||||
setupController();
|
||||
|
||||
syncAutoScroll();
|
||||
}
|
||||
|
||||
void ConnectionsWindow::setupController()
|
||||
@ -193,27 +195,14 @@ void ConnectionsWindow::setupLogBlockedIp()
|
||||
|
||||
void ConnectionsWindow::setupAutoScroll()
|
||||
{
|
||||
const auto syncAutoScroll = [&] {
|
||||
if (settings()->connAutoScroll()) {
|
||||
connect(connListModel(), &QAbstractItemModel::rowsInserted, m_connListView,
|
||||
&QAbstractItemView::scrollToBottom);
|
||||
} else {
|
||||
disconnect(connListModel(), &QAbstractItemModel::rowsInserted, m_connListView,
|
||||
&QAbstractItemView::scrollToBottom);
|
||||
}
|
||||
};
|
||||
m_cbAutoScroll = ControlUtil::createCheckBox(settings()->connAutoScroll(), [&](bool checked) {
|
||||
if (settings()->connAutoScroll() == checked)
|
||||
return;
|
||||
|
||||
syncAutoScroll();
|
||||
settings()->setConnAutoScroll(checked);
|
||||
|
||||
m_cbAutoScroll = ControlUtil::createCheckBox(
|
||||
settings()->connAutoScroll(), [&, syncAutoScroll](bool checked) {
|
||||
if (settings()->connAutoScroll() == checked)
|
||||
return;
|
||||
|
||||
settings()->setConnAutoScroll(checked);
|
||||
|
||||
syncAutoScroll();
|
||||
});
|
||||
syncAutoScroll();
|
||||
});
|
||||
}
|
||||
|
||||
void ConnectionsWindow::setupTableConnList()
|
||||
@ -281,6 +270,19 @@ void ConnectionsWindow::setupTableConnsChanged()
|
||||
connect(m_connListView, &TableView::currentIndexChanged, this, refreshTableConnsChanged);
|
||||
}
|
||||
|
||||
void ConnectionsWindow::syncAutoScroll()
|
||||
{
|
||||
if (settings()->connAutoScroll()) {
|
||||
connect(connListModel(), &QAbstractItemModel::rowsInserted, m_connListView,
|
||||
&QAbstractItemView::scrollToBottom);
|
||||
|
||||
m_connListView->scrollToBottom();
|
||||
} else {
|
||||
disconnect(connListModel(), &QAbstractItemModel::rowsInserted, m_connListView,
|
||||
&QAbstractItemView::scrollToBottom);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionsWindow::deleteConn(int row)
|
||||
{
|
||||
const auto connRow = connListModel()->connRowAt(row);
|
||||
|
@ -42,6 +42,8 @@ private:
|
||||
void setupAppInfoRow();
|
||||
void setupTableConnsChanged();
|
||||
|
||||
void syncAutoScroll();
|
||||
|
||||
void deleteConn(int row);
|
||||
|
||||
void deleteSelectedConns();
|
||||
|
Loading…
Reference in New Issue
Block a user