mirror of
https://github.com/tnodir/fort
synced 2024-11-15 05:46:03 +00:00
UI: QuotaManager: Process Quota exceed action
This commit is contained in:
parent
660c049d48
commit
cb6558e1f2
@ -271,13 +271,6 @@ void FortManager::setupConfManager()
|
||||
void FortManager::setupQuotaManager()
|
||||
{
|
||||
connect(IoC<QuotaManager>(), &QuotaManager::alert, this, [&](qint8 alertType) {
|
||||
auto confManager = IoC<ConfManager>();
|
||||
auto conf = confManager->conf();
|
||||
if (conf->ini().quotaStopInetTraffic() && !conf->stopInetTraffic()) {
|
||||
conf->setStopInetTraffic(true);
|
||||
confManager->saveFlags();
|
||||
}
|
||||
|
||||
IoC<WindowManager>()->showInfoBox(
|
||||
QuotaManager::alertTypeText(alertType), tr("Quota Alert"));
|
||||
});
|
||||
|
@ -74,7 +74,7 @@ void QuotaManager::checkQuotaDay(qint32 trafDay)
|
||||
if (m_trafDayBytes > m_quotaDayBytes) {
|
||||
setQuotaDayAlerted(trafDay);
|
||||
|
||||
emit alert(AlertDay);
|
||||
processQuotaExceed(AlertDay);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ void QuotaManager::checkQuotaMonth(qint32 trafMonth)
|
||||
if (m_trafMonthBytes > m_quotaMonthBytes) {
|
||||
setQuotaMonthAlerted(trafMonth);
|
||||
|
||||
emit alert(AlertMonth);
|
||||
processQuotaExceed(AlertMonth);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,3 +151,16 @@ void QuotaManager::setQuotaMonthAlerted(int v)
|
||||
confManager->saveIni();
|
||||
}
|
||||
}
|
||||
|
||||
void QuotaManager::processQuotaExceed(AlertType alertType)
|
||||
{
|
||||
auto confManager = IoC<ConfManager>();
|
||||
FirewallConf *conf = confManager->conf();
|
||||
|
||||
if (conf->ini().quotaStopInetTraffic() && !conf->stopInetTraffic()) {
|
||||
conf->setStopInetTraffic(true);
|
||||
confManager->saveFlags();
|
||||
}
|
||||
|
||||
emit alert(alertType);
|
||||
}
|
||||
|
@ -38,6 +38,9 @@ protected:
|
||||
virtual int quotaMonthAlerted() const;
|
||||
virtual void setQuotaMonthAlerted(qint32 v);
|
||||
|
||||
private:
|
||||
void processQuotaExceed(AlertType alertType);
|
||||
|
||||
private:
|
||||
int m_quotaDayAlerted = 0;
|
||||
int m_quotaMonthAlerted = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user