From 887320e6623bfd363df494c2d61264c799c332d7 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 17 May 2021 17:40:22 +0300 Subject: [PATCH] UI: IniUser: Rename conn*() to stat*(). --- src/ui/conf/inioptions.h | 3 --- src/ui/form/opt/pages/statisticspage.cpp | 11 +++++---- src/ui/form/stat/statisticswindow.cpp | 16 ++++++------ src/ui/user/iniuser.h | 31 +++++++++++++----------- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/ui/conf/inioptions.h b/src/ui/conf/inioptions.h index 0144e8be..93b77644 100644 --- a/src/ui/conf/inioptions.h +++ b/src/ui/conf/inioptions.h @@ -71,9 +71,6 @@ public: } void setTrafMonthKeepMonths(int v) { setValue("stat/trafMonthKeepMonths", v); } - int trafUnit() const { return valueInt("stat/trafUnit"); } - void setTrafUnit(int v) { setValue("stat/trafUnit", v); } - int allowedIpKeepCount() const { return valueInt("stat/allowedIpKeepCount", DEFAULT_LOG_IP_KEEP_COUNT); diff --git a/src/ui/form/opt/pages/statisticspage.cpp b/src/ui/form/opt/pages/statisticspage.cpp index 248dc363..c99a6daa 100644 --- a/src/ui/form/opt/pages/statisticspage.cpp +++ b/src/ui/form/opt/pages/statisticspage.cpp @@ -17,6 +17,7 @@ #include #include "../../../appinfo/appinfocache.h" +#include "../../../conf/confmanager.h" #include "../../../conf/firewallconf.h" #include "../../../fortmanager.h" #include "../../../fortsettings.h" @@ -313,13 +314,13 @@ void StatisticsPage::setupTrafUnits() m_traphUnits = ControlUtil::createLabel(); m_comboTrafUnit = ControlUtil::createComboBox(QStringList(), [&](int index) { - if (ini()->trafUnit() == index) + if (iniUser()->statTrafUnit() == index) return; - ini()->setTrafUnit(index); + iniUser()->setStatTrafUnit(index); updateTableTrafUnit(); - setIniEdited(); + confManager()->saveIniUser(); }); } @@ -809,12 +810,12 @@ void StatisticsPage::updatePage() void StatisticsPage::updateTrafUnit() { - m_comboTrafUnit->setCurrentIndex(ini()->trafUnit()); + m_comboTrafUnit->setCurrentIndex(iniUser()->statTrafUnit()); } void StatisticsPage::updateTableTrafUnit() { - const auto trafUnit = static_cast(ini()->trafUnit()); + const auto trafUnit = static_cast(iniUser()->statTrafUnit()); if (trafListModel()->unit() != trafUnit) { trafListModel()->setUnit(trafUnit); diff --git a/src/ui/form/stat/statisticswindow.cpp b/src/ui/form/stat/statisticswindow.cpp index cf479839..f66e4aa0 100644 --- a/src/ui/form/stat/statisticswindow.cpp +++ b/src/ui/form/stat/statisticswindow.cpp @@ -268,11 +268,11 @@ void StatisticsWindow::setupLogBlockedIp() void StatisticsWindow::setupAutoScroll() { - m_cbAutoScroll = ControlUtil::createCheckBox(iniUser()->connAutoScroll(), [&](bool checked) { - if (iniUser()->connAutoScroll() == checked) + m_cbAutoScroll = ControlUtil::createCheckBox(iniUser()->statAutoScroll(), [&](bool checked) { + if (iniUser()->statAutoScroll() == checked) return; - iniUser()->setConnAutoScroll(checked); + iniUser()->setStatAutoScroll(checked); confManager()->saveIniUser(); syncAutoScroll(); @@ -282,11 +282,11 @@ void StatisticsWindow::setupAutoScroll() void StatisticsWindow::setupShowHostNames() { m_cbShowHostNames = - ControlUtil::createCheckBox(iniUser()->connShowHostNames(), [&](bool checked) { - if (iniUser()->connShowHostNames() == checked) + ControlUtil::createCheckBox(iniUser()->statShowHostNames(), [&](bool checked) { + if (iniUser()->statShowHostNames() == checked) return; - iniUser()->setConnShowHostNames(checked); + iniUser()->setStatShowHostNames(checked); confManager()->saveIniUser(); syncShowHostNames(); @@ -364,7 +364,7 @@ void StatisticsWindow::setupTableConnsChanged() void StatisticsWindow::syncAutoScroll() { - if (iniUser()->connAutoScroll()) { + if (iniUser()->statAutoScroll()) { connect(connListModel(), &QAbstractItemModel::rowsInserted, m_connListView, &QAbstractItemView::scrollToBottom); @@ -377,7 +377,7 @@ void StatisticsWindow::syncAutoScroll() void StatisticsWindow::syncShowHostNames() { - connListModel()->setResolveAddress(iniUser()->connShowHostNames()); + connListModel()->setResolveAddress(iniUser()->statShowHostNames()); } void StatisticsWindow::deleteConn(int row) diff --git a/src/ui/user/iniuser.h b/src/ui/user/iniuser.h index 12f1fc3f..f588fa38 100644 --- a/src/ui/user/iniuser.h +++ b/src/ui/user/iniuser.h @@ -19,9 +19,9 @@ public: QString hotKeyPrograms() const { return valueText("hotKey/programs"); } QString hotKeyOptions() const { return valueText("hotKey/options"); } - QString hotKeyZones() const { return valueText("hotKey/zones"); } + QString hotKeyStatistics() const { return valueText("hotKey/statistics"); } QString hotKeyGraph() const { return valueText("hotKey/graph"); } - QString hotKeyConnections() const { return valueText("hotKey/connections"); } + QString hotKeyZones() const { return valueText("hotKey/zones"); } QString hotKeyFilter() const { return valueText("hotKey/filter", "Ctrl+Alt+Shift+F"); } QString hotKeyStopTraffic() const { return valueText("hotKey/stopTraffic"); } QString hotKeyStopInetTraffic() const { return valueText("hotKey/stopInetTraffic"); } @@ -86,23 +86,26 @@ public: bool graphWindowMaximized() const { return valueBool("graphWindow/maximized"); } void setGraphWindowMaximized(bool on) { setValue("graphWindow/maximized", on); } - QRect connWindowGeometry() const { return value("connWindow/geometry").toRect(); } - void setConnWindowGeometry(const QRect &v) { setValue("connWindow/geometry", v); } + QRect statWindowGeometry() const { return value("statWindow/geometry").toRect(); } + void setStatWindowGeometry(const QRect &v) { setValue("statWindow/geometry", v); } - bool connWindowMaximized() const { return valueBool("connWindow/maximized"); } - void setConnWindowMaximized(bool on) { setValue("connWindow/maximized", on); } + bool statWindowMaximized() const { return valueBool("statWindow/maximized"); } + void setStatWindowMaximized(bool on) { setValue("statWindow/maximized", on); } - int connListHeaderVersion() const { return valueInt("connWindow/connListHeaderVersion"); } - void setConnListHeaderVersion(int v) { setValue("connWindow/connListHeaderVersion", v); } + int statTrafUnit() const { return valueInt("statWindow/trafUnit"); } + void setStatTrafUnit(int v) { setValue("statWindow/trafUnit", v); } - QByteArray connListHeader() const { return valueByteArray("connWindow/connListHeader"); } - void setConnListHeader(const QByteArray &v) { setValue("connWindow/connListHeader", v); } + int connListHeaderVersion() const { return valueInt("statWindow/connListHeaderVersion"); } + void setConnListHeaderVersion(int v) { setValue("statWindow/connListHeaderVersion", v); } - bool connAutoScroll() const { return valueBool("connWindow/autoScroll"); } - void setConnAutoScroll(bool on) { setValue("connWindow/autoScroll", on); } + QByteArray connListHeader() const { return valueByteArray("statWindow/connListHeader"); } + void setConnListHeader(const QByteArray &v) { setValue("statWindow/connListHeader", v); } - bool connShowHostNames() const { return valueBool("connWindow/showHostNames"); } - void setConnShowHostNames(bool on) { setValue("connWindow/showHostNames", on); } + bool statAutoScroll() const { return valueBool("statWindow/autoScroll"); } + void setStatAutoScroll(bool on) { setValue("statWindow/autoScroll", on); } + + bool statShowHostNames() const { return valueBool("statWindow/showHostNames"); } + void setStatShowHostNames(bool on) { setValue("statWindow/showHostNames", on); } private: QString m_defaultLanguage;