mirror of
https://github.com/tnodir/fort
synced 2024-11-15 13:46:48 +00:00
UI: Avoid CLang warnings.
This commit is contained in:
parent
123ed6c261
commit
7d99d09736
4
src/ui/3rdparty/sqlite/sqlitedb.cpp
vendored
4
src/ui/3rdparty/sqlite/sqlitedb.cpp
vendored
@ -384,7 +384,9 @@ bool SqliteDb::importDb(const QString &sourceFilePath,
|
|||||||
|
|
||||||
beginTransaction();
|
beginTransaction();
|
||||||
|
|
||||||
for (const auto &tableName : tableNames(srcSchema)) {
|
const auto srcTableNames = tableNames(srcSchema);
|
||||||
|
|
||||||
|
for (const auto &tableName : srcTableNames) {
|
||||||
const auto dstColumns = columnNames(tableName, dstSchema);
|
const auto dstColumns = columnNames(tableName, dstSchema);
|
||||||
if (dstColumns.isEmpty())
|
if (dstColumns.isEmpty())
|
||||||
continue; // new schema doesn't contain old table
|
continue; // new schema doesn't contain old table
|
||||||
|
@ -11,7 +11,8 @@ TableView::TableView(QWidget *parent) :
|
|||||||
QVector<int> TableView::selectedRows() const
|
QVector<int> TableView::selectedRows() const
|
||||||
{
|
{
|
||||||
QSet<int> rowsSet;
|
QSet<int> rowsSet;
|
||||||
for (const auto index : selectedIndexes()) {
|
const auto indexes = selectedIndexes();
|
||||||
|
for (const auto index : indexes) {
|
||||||
rowsSet.insert(index.row());
|
rowsSet.insert(index.row());
|
||||||
}
|
}
|
||||||
rowsSet.insert(currentIndex().row());
|
rowsSet.insert(currentIndex().row());
|
||||||
|
@ -120,7 +120,7 @@ void AddressesPage::setupIncludeAddresses()
|
|||||||
{
|
{
|
||||||
m_includeAddresses = new AddressesColumn();
|
m_includeAddresses = new AddressesColumn();
|
||||||
|
|
||||||
connect(m_includeAddresses->cbUseAll(), &QCheckBox::toggled, [&](bool checked) {
|
connect(m_includeAddresses->cbUseAll(), &QCheckBox::toggled, this, [&](bool checked) {
|
||||||
if (addressGroup()->includeAll() == checked)
|
if (addressGroup()->includeAll() == checked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ void AddressesPage::setupIncludeAddresses()
|
|||||||
|
|
||||||
ctrl()->setConfFlagsEdited(true);
|
ctrl()->setConfFlagsEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_includeAddresses->editIpText(), &QPlainTextEdit::textChanged, [&] {
|
connect(m_includeAddresses->editIpText(), &QPlainTextEdit::textChanged, this, [&] {
|
||||||
const auto ipText = m_includeAddresses->editIpText()->toPlainText();
|
const auto ipText = m_includeAddresses->editIpText()->toPlainText();
|
||||||
|
|
||||||
if (addressGroup()->includeText() == ipText)
|
if (addressGroup()->includeText() == ipText)
|
||||||
@ -144,7 +144,7 @@ void AddressesPage::setupExcludeAddresses()
|
|||||||
{
|
{
|
||||||
m_excludeAddresses = new AddressesColumn();
|
m_excludeAddresses = new AddressesColumn();
|
||||||
|
|
||||||
connect(m_excludeAddresses->cbUseAll(), &QCheckBox::toggled, [&](bool checked) {
|
connect(m_excludeAddresses->cbUseAll(), &QCheckBox::toggled, this, [&](bool checked) {
|
||||||
if (addressGroup()->excludeAll() == checked)
|
if (addressGroup()->excludeAll() == checked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ void AddressesPage::setupExcludeAddresses()
|
|||||||
|
|
||||||
ctrl()->setConfFlagsEdited(true);
|
ctrl()->setConfFlagsEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_excludeAddresses->editIpText(), &QPlainTextEdit::textChanged, [&] {
|
connect(m_excludeAddresses->editIpText(), &QPlainTextEdit::textChanged, this, [&] {
|
||||||
const auto ipText = m_excludeAddresses->editIpText()->toPlainText();
|
const auto ipText = m_excludeAddresses->editIpText()->toPlainText();
|
||||||
|
|
||||||
if (addressGroup()->excludeText() == ipText)
|
if (addressGroup()->excludeText() == ipText)
|
||||||
|
@ -267,7 +267,7 @@ void ApplicationsPage::setupTabBar()
|
|||||||
addTab(appGroup->name());
|
addTab(appGroup->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_tabBar, &QTabBar::tabCloseRequested, [&](int index) {
|
connect(m_tabBar, &QTabBar::tabCloseRequested, this, [&](int index) {
|
||||||
if (m_tabBar->count() <= 1)
|
if (m_tabBar->count() <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ void ApplicationsPage::setupTabBar()
|
|||||||
|
|
||||||
ctrl()->setConfEdited(true);
|
ctrl()->setConfEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_tabBar, &QTabBar::tabMoved, [&](int from, int to) {
|
connect(m_tabBar, &QTabBar::tabMoved, this, [&](int from, int to) {
|
||||||
conf()->moveAppGroup(from, to);
|
conf()->moveAppGroup(from, to);
|
||||||
ctrl()->setConfEdited(true);
|
ctrl()->setConfEdited(true);
|
||||||
});
|
});
|
||||||
@ -324,7 +324,7 @@ void ApplicationsPage::setupGroupPeriod()
|
|||||||
{
|
{
|
||||||
m_ctpGroupPeriod = new CheckTimePeriod();
|
m_ctpGroupPeriod = new CheckTimePeriod();
|
||||||
|
|
||||||
connect(m_ctpGroupPeriod->checkBox(), &QCheckBox::toggled, [&](bool checked) {
|
connect(m_ctpGroupPeriod->checkBox(), &QCheckBox::toggled, this, [&](bool checked) {
|
||||||
if (appGroup()->periodEnabled() == checked)
|
if (appGroup()->periodEnabled() == checked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ void ApplicationsPage::setupGroupPeriod()
|
|||||||
|
|
||||||
ctrl()->setConfEdited(true);
|
ctrl()->setConfEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_ctpGroupPeriod->timeEdit1(), &QTimeEdit::userTimeChanged, [&](const QTime &time) {
|
connect(m_ctpGroupPeriod->timeEdit1(), &QTimeEdit::userTimeChanged, this, [&](const QTime &time) {
|
||||||
const auto timeStr = CheckTimePeriod::fromTime(time);
|
const auto timeStr = CheckTimePeriod::fromTime(time);
|
||||||
|
|
||||||
if (appGroup()->periodFrom() == timeStr)
|
if (appGroup()->periodFrom() == timeStr)
|
||||||
@ -342,7 +342,7 @@ void ApplicationsPage::setupGroupPeriod()
|
|||||||
|
|
||||||
ctrl()->setConfEdited(true);
|
ctrl()->setConfEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_ctpGroupPeriod->timeEdit2(), &QTimeEdit::userTimeChanged, [&](const QTime &time) {
|
connect(m_ctpGroupPeriod->timeEdit2(), &QTimeEdit::userTimeChanged, this, [&](const QTime &time) {
|
||||||
const auto timeStr = CheckTimePeriod::fromTime(time);
|
const auto timeStr = CheckTimePeriod::fromTime(time);
|
||||||
|
|
||||||
if (appGroup()->periodTo() == timeStr)
|
if (appGroup()->periodTo() == timeStr)
|
||||||
@ -389,7 +389,7 @@ void ApplicationsPage::setupGroupLimitIn()
|
|||||||
{
|
{
|
||||||
m_cscLimitIn = createGroupLimit();
|
m_cscLimitIn = createGroupLimit();
|
||||||
|
|
||||||
connect(m_cscLimitIn->checkBox(), &QCheckBox::toggled, [&](bool checked) {
|
connect(m_cscLimitIn->checkBox(), &QCheckBox::toggled, this, [&](bool checked) {
|
||||||
if (appGroup()->limitInEnabled() == checked)
|
if (appGroup()->limitInEnabled() == checked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ void ApplicationsPage::setupGroupLimitIn()
|
|||||||
|
|
||||||
ctrl()->setConfEdited(true);
|
ctrl()->setConfEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_cscLimitIn->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_cscLimitIn->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
const auto kbytes = quint32(value);
|
const auto kbytes = quint32(value);
|
||||||
|
|
||||||
if (appGroup()->speedLimitIn() == kbytes)
|
if (appGroup()->speedLimitIn() == kbytes)
|
||||||
@ -413,7 +413,7 @@ void ApplicationsPage::setupGroupLimitOut()
|
|||||||
{
|
{
|
||||||
m_cscLimitOut = createGroupLimit();
|
m_cscLimitOut = createGroupLimit();
|
||||||
|
|
||||||
connect(m_cscLimitOut->checkBox(), &QCheckBox::toggled, [&](bool checked) {
|
connect(m_cscLimitOut->checkBox(), &QCheckBox::toggled, this, [&](bool checked) {
|
||||||
if (appGroup()->limitOutEnabled() == checked)
|
if (appGroup()->limitOutEnabled() == checked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ void ApplicationsPage::setupGroupLimitOut()
|
|||||||
|
|
||||||
ctrl()->setConfEdited(true);
|
ctrl()->setConfEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_cscLimitOut->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_cscLimitOut->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
const auto kbytes = quint32(value);
|
const auto kbytes = quint32(value);
|
||||||
|
|
||||||
if (appGroup()->speedLimitOut() == kbytes)
|
if (appGroup()->speedLimitOut() == kbytes)
|
||||||
@ -465,7 +465,7 @@ void ApplicationsPage::setupBlockApps()
|
|||||||
m_blockApps = new AppsColumn();
|
m_blockApps = new AppsColumn();
|
||||||
m_blockApps->icon()->setPixmap(QPixmap(":/images/stop.png"));
|
m_blockApps->icon()->setPixmap(QPixmap(":/images/stop.png"));
|
||||||
|
|
||||||
connect(m_blockApps->editText(), &QPlainTextEdit::textChanged, [&] {
|
connect(m_blockApps->editText(), &QPlainTextEdit::textChanged, this, [&] {
|
||||||
const auto text = m_blockApps->editText()->toPlainText();
|
const auto text = m_blockApps->editText()->toPlainText();
|
||||||
|
|
||||||
if (appGroup()->blockText() == text)
|
if (appGroup()->blockText() == text)
|
||||||
@ -482,7 +482,7 @@ void ApplicationsPage::setupAllowApps()
|
|||||||
m_allowApps = new AppsColumn();
|
m_allowApps = new AppsColumn();
|
||||||
m_allowApps->icon()->setPixmap(QPixmap(":/images/arrow_switch.png"));
|
m_allowApps->icon()->setPixmap(QPixmap(":/images/arrow_switch.png"));
|
||||||
|
|
||||||
connect(m_allowApps->editText(), &QPlainTextEdit::textChanged, [&] {
|
connect(m_allowApps->editText(), &QPlainTextEdit::textChanged, this, [&] {
|
||||||
const auto text = m_allowApps->editText()->toPlainText();
|
const auto text = m_allowApps->editText()->toPlainText();
|
||||||
|
|
||||||
if (appGroup()->allowText() == text)
|
if (appGroup()->allowText() == text)
|
||||||
|
@ -84,7 +84,7 @@ void SchedulePage::retranslateTaskDetails()
|
|||||||
|
|
||||||
void SchedulePage::setupTaskListModel()
|
void SchedulePage::setupTaskListModel()
|
||||||
{
|
{
|
||||||
connect(m_taskListModel, &TaskListModel::dataEdited, [&] {
|
connect(m_taskListModel, &TaskListModel::dataEdited, this, [&] {
|
||||||
setScheduleEdited(true);
|
setScheduleEdited(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ void SchedulePage::setupTableTasks()
|
|||||||
|
|
||||||
m_tableTasks->setModel(taskListModel());
|
m_tableTasks->setModel(taskListModel());
|
||||||
|
|
||||||
connect(m_tableTasks, &TableView::doubleClicked, [&](const QModelIndex &index) {
|
connect(m_tableTasks, &TableView::doubleClicked, this, [&](const QModelIndex &index) {
|
||||||
const auto taskInfo = taskListModel()->taskInfoAt(index.row());
|
const auto taskInfo = taskListModel()->taskInfoAt(index.row());
|
||||||
if (taskInfo->type() == TaskInfo::ZoneDownloader) {
|
if (taskInfo->type() == TaskInfo::ZoneDownloader) {
|
||||||
fortManager()->showZonesWindow();
|
fortManager()->showZonesWindow();
|
||||||
@ -173,13 +173,13 @@ void SchedulePage::setupTaskInterval()
|
|||||||
m_cscTaskInterval->spinBox()->setRange(1, 24 * 30 * 12); // ~Year
|
m_cscTaskInterval->spinBox()->setRange(1, 24 * 30 * 12); // ~Year
|
||||||
m_cscTaskInterval->setValues(taskIntervalHourValues);
|
m_cscTaskInterval->setValues(taskIntervalHourValues);
|
||||||
|
|
||||||
connect(m_cscTaskInterval->checkBox(), &QCheckBox::toggled, [&](bool checked) {
|
connect(m_cscTaskInterval->checkBox(), &QCheckBox::toggled, this, [&](bool checked) {
|
||||||
const int taskIndex = currentTaskIndex();
|
const int taskIndex = currentTaskIndex();
|
||||||
const auto index = taskListModel()->index(taskIndex, 0);
|
const auto index = taskListModel()->index(taskIndex, 0);
|
||||||
|
|
||||||
taskListModel()->setData(index, checked, TaskListModel::RoleEnabled);
|
taskListModel()->setData(index, checked, TaskListModel::RoleEnabled);
|
||||||
});
|
});
|
||||||
connect(m_cscTaskInterval->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_cscTaskInterval->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
const int taskIndex = currentTaskIndex();
|
const int taskIndex = currentTaskIndex();
|
||||||
const auto index = taskListModel()->index(taskIndex, 1);
|
const auto index = taskListModel()->index(taskIndex, 1);
|
||||||
|
|
||||||
|
@ -320,19 +320,19 @@ void StatisticsPage::setupClearMenu()
|
|||||||
m_actResetTotal = menu->addAction(QString());
|
m_actResetTotal = menu->addAction(QString());
|
||||||
m_actClearAll = menu->addAction(QString());
|
m_actClearAll = menu->addAction(QString());
|
||||||
|
|
||||||
connect(m_actRemoveApp, &QAction::triggered, [&] {
|
connect(m_actRemoveApp, &QAction::triggered, this, [&] {
|
||||||
if (!fortManager()->showQuestionBox(tr("Are you sure to remove statistics for selected application?")))
|
if (!fortManager()->showQuestionBox(tr("Are you sure to remove statistics for selected application?")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
appStatModel()->remove(appListCurrentIndex());
|
appStatModel()->remove(appListCurrentIndex());
|
||||||
});
|
});
|
||||||
connect(m_actResetTotal, &QAction::triggered, [&] {
|
connect(m_actResetTotal, &QAction::triggered, this, [&] {
|
||||||
if (!fortManager()->showQuestionBox(tr("Are you sure to reset total statistics?")))
|
if (!fortManager()->showQuestionBox(tr("Are you sure to reset total statistics?")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
trafListModel()->resetAppTotals();
|
trafListModel()->resetAppTotals();
|
||||||
});
|
});
|
||||||
connect(m_actClearAll, &QAction::triggered, [&] {
|
connect(m_actClearAll, &QAction::triggered, this, [&] {
|
||||||
if (!fortManager()->showQuestionBox(tr("Are you sure to clear all statistics?")))
|
if (!fortManager()->showQuestionBox(tr("Are you sure to clear all statistics?")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ void StatisticsPage::setupActivePeriod()
|
|||||||
{
|
{
|
||||||
m_ctpActivePeriod = new CheckTimePeriod();
|
m_ctpActivePeriod = new CheckTimePeriod();
|
||||||
|
|
||||||
connect(m_ctpActivePeriod->checkBox(), &QCheckBox::toggled, [&](bool checked) {
|
connect(m_ctpActivePeriod->checkBox(), &QCheckBox::toggled, this, [&](bool checked) {
|
||||||
if (conf()->activePeriodEnabled() == checked)
|
if (conf()->activePeriodEnabled() == checked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ void StatisticsPage::setupActivePeriod()
|
|||||||
|
|
||||||
ctrl()->setConfFlagsEdited(true);
|
ctrl()->setConfFlagsEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_ctpActivePeriod->timeEdit1(), &QTimeEdit::userTimeChanged, [&](const QTime &time) {
|
connect(m_ctpActivePeriod->timeEdit1(), &QTimeEdit::userTimeChanged, this, [&](const QTime &time) {
|
||||||
const auto timeStr = CheckTimePeriod::fromTime(time);
|
const auto timeStr = CheckTimePeriod::fromTime(time);
|
||||||
|
|
||||||
if (conf()->activePeriodFrom() == timeStr)
|
if (conf()->activePeriodFrom() == timeStr)
|
||||||
@ -487,7 +487,7 @@ void StatisticsPage::setupActivePeriod()
|
|||||||
|
|
||||||
ctrl()->setConfFlagsEdited(true);
|
ctrl()->setConfFlagsEdited(true);
|
||||||
});
|
});
|
||||||
connect(m_ctpActivePeriod->timeEdit2(), &QTimeEdit::userTimeChanged, [&](const QTime &time) {
|
connect(m_ctpActivePeriod->timeEdit2(), &QTimeEdit::userTimeChanged, this, [&](const QTime &time) {
|
||||||
const auto timeStr = CheckTimePeriod::fromTime(time);
|
const auto timeStr = CheckTimePeriod::fromTime(time);
|
||||||
|
|
||||||
if (conf()->activePeriodTo() == timeStr)
|
if (conf()->activePeriodTo() == timeStr)
|
||||||
@ -514,7 +514,7 @@ void StatisticsPage::setupMonthStart()
|
|||||||
m_lscMonthStart->setNamesByValues();
|
m_lscMonthStart->setNamesByValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_lscMonthStart->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_lscMonthStart->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
if (conf()->monthStart() == value)
|
if (conf()->monthStart() == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ void StatisticsPage::setupTrafHourKeepDays()
|
|||||||
m_lscTrafHourKeepDays = createSpinCombo(-1, 9999);
|
m_lscTrafHourKeepDays = createSpinCombo(-1, 9999);
|
||||||
m_lscTrafHourKeepDays->setValues(trafKeepDayValues);
|
m_lscTrafHourKeepDays->setValues(trafKeepDayValues);
|
||||||
|
|
||||||
connect(m_lscTrafHourKeepDays->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_lscTrafHourKeepDays->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
if (conf()->trafHourKeepDays() == value)
|
if (conf()->trafHourKeepDays() == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -544,7 +544,7 @@ void StatisticsPage::setupTrafDayKeepDays()
|
|||||||
m_lscTrafDayKeepDays = createSpinCombo(-1, 9999);
|
m_lscTrafDayKeepDays = createSpinCombo(-1, 9999);
|
||||||
m_lscTrafDayKeepDays->setValues(trafKeepDayValues);
|
m_lscTrafDayKeepDays->setValues(trafKeepDayValues);
|
||||||
|
|
||||||
connect(m_lscTrafDayKeepDays->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_lscTrafDayKeepDays->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
if (conf()->trafDayKeepDays() == value)
|
if (conf()->trafDayKeepDays() == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ void StatisticsPage::setupTrafMonthKeepMonths()
|
|||||||
m_lscTrafMonthKeepMonths = createSpinCombo(-1, 9999);
|
m_lscTrafMonthKeepMonths = createSpinCombo(-1, 9999);
|
||||||
m_lscTrafMonthKeepMonths->setValues(trafKeepMonthValues);
|
m_lscTrafMonthKeepMonths->setValues(trafKeepMonthValues);
|
||||||
|
|
||||||
connect(m_lscTrafMonthKeepMonths->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_lscTrafMonthKeepMonths->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
if (conf()->trafMonthKeepMonths() == value)
|
if (conf()->trafMonthKeepMonths() == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -574,7 +574,7 @@ void StatisticsPage::setupQuotaDayMb()
|
|||||||
m_lscQuotaDayMb = createSpinCombo(0, 1024 * 1024, " MiB");
|
m_lscQuotaDayMb = createSpinCombo(0, 1024 * 1024, " MiB");
|
||||||
m_lscQuotaDayMb->setValues(quotaValues);
|
m_lscQuotaDayMb->setValues(quotaValues);
|
||||||
|
|
||||||
connect(m_lscQuotaDayMb->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_lscQuotaDayMb->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
const quint32 mbytes = quint32(value);
|
const quint32 mbytes = quint32(value);
|
||||||
|
|
||||||
if (conf()->quotaDayMb() == mbytes)
|
if (conf()->quotaDayMb() == mbytes)
|
||||||
@ -591,7 +591,7 @@ void StatisticsPage::setupQuotaMonthMb()
|
|||||||
m_lscQuotaMonthMb = createSpinCombo(0, 1024 * 1024, " MiB");
|
m_lscQuotaMonthMb = createSpinCombo(0, 1024 * 1024, " MiB");
|
||||||
m_lscQuotaMonthMb->setValues(quotaValues);
|
m_lscQuotaMonthMb->setValues(quotaValues);
|
||||||
|
|
||||||
connect(m_lscQuotaMonthMb->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(m_lscQuotaMonthMb->spinBox(), QOverload<int>::of(&QSpinBox::valueChanged), this, [&](int value) {
|
||||||
const quint32 mbytes = quint32(value);
|
const quint32 mbytes = quint32(value);
|
||||||
|
|
||||||
if (conf()->quotaMonthMb() == mbytes)
|
if (conf()->quotaMonthMb() == mbytes)
|
||||||
@ -688,10 +688,10 @@ void StatisticsPage::setupAppInfoRow()
|
|||||||
|
|
||||||
m_labelAppCompanyName = ControlUtil::createLabel();
|
m_labelAppCompanyName = ControlUtil::createLabel();
|
||||||
|
|
||||||
connect(m_btAppCopyPath, &QAbstractButton::clicked, [&] {
|
connect(m_btAppCopyPath, &QAbstractButton::clicked, this, [&] {
|
||||||
GuiUtil::setClipboardData(appListCurrentPath());
|
GuiUtil::setClipboardData(appListCurrentPath());
|
||||||
});
|
});
|
||||||
connect(m_btAppOpenFolder, &QAbstractButton::clicked, [&] {
|
connect(m_btAppOpenFolder, &QAbstractButton::clicked, this, [&] {
|
||||||
OsUtil::openFolder(appListCurrentPath());
|
OsUtil::openFolder(appListCurrentPath());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ void ProgramsWindow::setupAppEditForm()
|
|||||||
m_formAppEdit->setLayout(layout);
|
m_formAppEdit->setLayout(layout);
|
||||||
m_formAppEdit->setMinimumWidth(500);
|
m_formAppEdit->setMinimumWidth(500);
|
||||||
|
|
||||||
connect(m_btSelectFile, &QAbstractButton::clicked, [&] {
|
connect(m_btSelectFile, &QAbstractButton::clicked, this, [&] {
|
||||||
const auto filePath = ControlUtil::getOpenFileName(
|
const auto filePath = ControlUtil::getOpenFileName(
|
||||||
m_labelEditPath->text(),
|
m_labelEditPath->text(),
|
||||||
tr("Programs (*.exe);;All files (*.*)"));
|
tr("Programs (*.exe);;All files (*.*)"));
|
||||||
@ -280,14 +280,14 @@ void ProgramsWindow::setupAppEditForm()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_rbAllowApp, &QRadioButton::toggled, [&](bool checked) {
|
connect(m_rbAllowApp, &QRadioButton::toggled, this, [&](bool checked) {
|
||||||
m_cbBlockAppNone->setEnabled(checked);
|
m_cbBlockAppNone->setEnabled(checked);
|
||||||
m_cscBlockAppIn->setEnabled(checked);
|
m_cscBlockAppIn->setEnabled(checked);
|
||||||
m_cbBlockAppAt->setEnabled(checked);
|
m_cbBlockAppAt->setEnabled(checked);
|
||||||
m_dteBlockAppAt->setEnabled(checked);
|
m_dteBlockAppAt->setEnabled(checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_btEditOk, &QAbstractButton::clicked, [&] {
|
connect(m_btEditOk, &QAbstractButton::clicked, this, [&] {
|
||||||
if (saveAppEditForm()) {
|
if (saveAppEditForm()) {
|
||||||
m_formAppEdit->close();
|
m_formAppEdit->close();
|
||||||
}
|
}
|
||||||
@ -355,24 +355,24 @@ QLayout *ProgramsWindow::setupHeader()
|
|||||||
|
|
||||||
m_actPurgeApps = editMenu->addAction(QIcon(":/images/bin_empty.png"), QString());
|
m_actPurgeApps = editMenu->addAction(QIcon(":/images/bin_empty.png"), QString());
|
||||||
|
|
||||||
connect(m_actAllowApp, &QAction::triggered, [&] {
|
connect(m_actAllowApp, &QAction::triggered, this, [&] {
|
||||||
updateSelectedApps(false);
|
updateSelectedApps(false);
|
||||||
});
|
});
|
||||||
connect(m_actBlockApp, &QAction::triggered, [&] {
|
connect(m_actBlockApp, &QAction::triggered, this, [&] {
|
||||||
updateSelectedApps(true);
|
updateSelectedApps(true);
|
||||||
});
|
});
|
||||||
connect(m_actAddApp, &QAction::triggered, [&] {
|
connect(m_actAddApp, &QAction::triggered, this, [&] {
|
||||||
updateAppEditForm(false);
|
updateAppEditForm(false);
|
||||||
});
|
});
|
||||||
connect(m_actEditApp, &QAction::triggered, [&] {
|
connect(m_actEditApp, &QAction::triggered, this, [&] {
|
||||||
updateAppEditForm(true);
|
updateAppEditForm(true);
|
||||||
});
|
});
|
||||||
connect(m_actRemoveApp, &QAction::triggered, [&] {
|
connect(m_actRemoveApp, &QAction::triggered, this, [&] {
|
||||||
if (fortManager()->showQuestionBox(tr("Are you sure to remove selected program(s)?"))) {
|
if (fortManager()->showQuestionBox(tr("Are you sure to remove selected program(s)?"))) {
|
||||||
deleteSelectedApps();
|
deleteSelectedApps();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(m_actPurgeApps, &QAction::triggered, [&] {
|
connect(m_actPurgeApps, &QAction::triggered, this, [&] {
|
||||||
if (fortManager()->showQuestionBox(tr("Are you sure to remove all non-existent programs?"))) {
|
if (fortManager()->showQuestionBox(tr("Are you sure to remove all non-existent programs?"))) {
|
||||||
appListModel()->purgeApps();
|
appListModel()->purgeApps();
|
||||||
}
|
}
|
||||||
@ -482,10 +482,10 @@ void ProgramsWindow::setupAppInfoRow()
|
|||||||
|
|
||||||
m_labelAppCompanyName = ControlUtil::createLabel();
|
m_labelAppCompanyName = ControlUtil::createLabel();
|
||||||
|
|
||||||
connect(m_btAppCopyPath, &QAbstractButton::clicked, [&] {
|
connect(m_btAppCopyPath, &QAbstractButton::clicked, this, [&] {
|
||||||
GuiUtil::setClipboardData(appListCurrentPath());
|
GuiUtil::setClipboardData(appListCurrentPath());
|
||||||
});
|
});
|
||||||
connect(m_btAppOpenFolder, &QAbstractButton::clicked, [&] {
|
connect(m_btAppOpenFolder, &QAbstractButton::clicked, this, [&] {
|
||||||
OsUtil::openFolder(appListCurrentPath());
|
OsUtil::openFolder(appListCurrentPath());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -198,12 +198,12 @@ void ZonesWindow::setupZoneEditForm()
|
|||||||
m_formZoneEdit->setLayout(layout);
|
m_formZoneEdit->setLayout(layout);
|
||||||
m_formZoneEdit->setMinimumWidth(500);
|
m_formZoneEdit->setMinimumWidth(500);
|
||||||
|
|
||||||
connect(m_cbCustomUrl, &QCheckBox::toggled, [&](bool checked) {
|
connect(m_cbCustomUrl, &QCheckBox::toggled, this, [&](bool checked) {
|
||||||
m_editUrl->setEnabled(checked);
|
m_editUrl->setEnabled(checked);
|
||||||
m_editFormData->setEnabled(checked);
|
m_editFormData->setEnabled(checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_btEditOk, &QAbstractButton::clicked, [&] {
|
connect(m_btEditOk, &QAbstractButton::clicked, this, [&] {
|
||||||
if (saveZoneEditForm()) {
|
if (saveZoneEditForm()) {
|
||||||
m_formZoneEdit->close();
|
m_formZoneEdit->close();
|
||||||
}
|
}
|
||||||
@ -245,13 +245,13 @@ QLayout *ZonesWindow::setupHeader()
|
|||||||
m_actRemoveZone = editMenu->addAction(QIcon(":/images/map_delete.png"), QString());
|
m_actRemoveZone = editMenu->addAction(QIcon(":/images/map_delete.png"), QString());
|
||||||
m_actRemoveZone->setShortcut(Qt::Key_Delete);
|
m_actRemoveZone->setShortcut(Qt::Key_Delete);
|
||||||
|
|
||||||
connect(m_actAddZone, &QAction::triggered, [&] {
|
connect(m_actAddZone, &QAction::triggered, this, [&] {
|
||||||
updateZoneEditForm(false);
|
updateZoneEditForm(false);
|
||||||
});
|
});
|
||||||
connect(m_actEditZone, &QAction::triggered, [&] {
|
connect(m_actEditZone, &QAction::triggered, this, [&] {
|
||||||
updateZoneEditForm(true);
|
updateZoneEditForm(true);
|
||||||
});
|
});
|
||||||
connect(m_actRemoveZone, &QAction::triggered, [&] {
|
connect(m_actRemoveZone, &QAction::triggered, this, [&] {
|
||||||
if (fortManager()->showQuestionBox(tr("Are you sure to remove selected zone?"))) {
|
if (fortManager()->showQuestionBox(tr("Are you sure to remove selected zone?"))) {
|
||||||
deleteSelectedZone();
|
deleteSelectedZone();
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,7 @@ void FortManager::showGraphWindow()
|
|||||||
|
|
||||||
m_graphWindowState->install(m_graphWindow);
|
m_graphWindowState->install(m_graphWindow);
|
||||||
|
|
||||||
connect(m_graphWindow, &GraphWindow::aboutToClose, [this] {
|
connect(m_graphWindow, &GraphWindow::aboutToClose, this, [this] {
|
||||||
closeGraphWindow();
|
closeGraphWindow();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -871,7 +871,7 @@ void FortManager::updateTrayMenuFlags()
|
|||||||
m_allowAllNewAction->setChecked(conf()->allowAllNew());
|
m_allowAllNewAction->setChecked(conf()->allowAllNew());
|
||||||
|
|
||||||
int appGroupIndex = 0;
|
int appGroupIndex = 0;
|
||||||
for (QAction *action : m_appGroupActions) {
|
for (QAction *action : qAsConst(m_appGroupActions)) {
|
||||||
const auto appGroup = conf()->appGroups().at(appGroupIndex++);
|
const auto appGroup = conf()->appGroups().at(appGroupIndex++);
|
||||||
|
|
||||||
action->setEnabled(editEnabled);
|
action->setEnabled(editEnabled);
|
||||||
|
@ -212,6 +212,9 @@ public:
|
|||||||
|
|
||||||
QString appUpdatesUrl() const { return APP_UPDATES_URL; }
|
QString appUpdatesUrl() const { return APP_UPDATES_URL; }
|
||||||
|
|
||||||
|
bool confMigrated() const;
|
||||||
|
bool confCanMigrate(QString &viaVersion) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void iniChanged();
|
void iniChanged();
|
||||||
void startWithWindowsChanged();
|
void startWithWindowsChanged();
|
||||||
@ -221,9 +224,6 @@ public slots:
|
|||||||
void readConfIni(FirewallConf &conf) const;
|
void readConfIni(FirewallConf &conf) const;
|
||||||
bool writeConfIni(const FirewallConf &conf);
|
bool writeConfIni(const FirewallConf &conf);
|
||||||
|
|
||||||
bool confMigrated() const;
|
|
||||||
bool confCanMigrate(QString &viaVersion) const;
|
|
||||||
|
|
||||||
void bulkUpdateBegin();
|
void bulkUpdateBegin();
|
||||||
void bulkUpdateEnd();
|
void bulkUpdateEnd();
|
||||||
|
|
||||||
|
@ -209,7 +209,8 @@ bool TaskInfoZoneDownloader::containsZoneId(quint32 &zonesMask, int zoneId) cons
|
|||||||
|
|
||||||
void TaskInfoZoneDownloader::removeOrphanCacheFiles()
|
void TaskInfoZoneDownloader::removeOrphanCacheFiles()
|
||||||
{
|
{
|
||||||
for (const auto fi : QDir(cachePath()).entryInfoList(QDir::Files)) {
|
const auto fileInfos = QDir(cachePath()).entryInfoList(QDir::Files);
|
||||||
|
for (const auto &fi : fileInfos) {
|
||||||
const auto zoneId = fi.baseName().toInt();
|
const auto zoneId = fi.baseName().toInt();
|
||||||
if (zoneId != 0 && !containsZoneId(m_zonesMask, zoneId)) {
|
if (zoneId != 0 && !containsZoneId(m_zonesMask, zoneId)) {
|
||||||
FileUtil::removeFile(fi.filePath());
|
FileUtil::removeFile(fi.filePath());
|
||||||
|
@ -89,7 +89,7 @@ void TaskManager::runExpiredTasks()
|
|||||||
const QDateTime now = DateUtil::now();
|
const QDateTime now = DateUtil::now();
|
||||||
bool enabledTaskExists = false;
|
bool enabledTaskExists = false;
|
||||||
|
|
||||||
for (TaskInfo *taskInfo : m_taskInfos) {
|
for (TaskInfo *taskInfo : qAsConst(m_taskInfos)) {
|
||||||
if (!taskInfo->enabled())
|
if (!taskInfo->enabled())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -73,7 +73,9 @@ QVector<QStringRef> TaskZoneDownloader::parseAddresses(const QString &text,
|
|||||||
// Parse lines
|
// Parse lines
|
||||||
const QRegularExpression re(pattern());
|
const QRegularExpression re(pattern());
|
||||||
|
|
||||||
for (const auto line : text.splitRef('\n', QString::SkipEmptyParts)) {
|
const auto lines = text.splitRef('\n', QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
for (const auto &line : lines) {
|
||||||
if (line.startsWith('#')
|
if (line.startsWith('#')
|
||||||
|| line.startsWith(';')) // commented line
|
|| line.startsWith(';')) // commented line
|
||||||
continue;
|
continue;
|
||||||
|
@ -38,8 +38,10 @@ void TranslationManager::setupTranslation()
|
|||||||
|
|
||||||
m_locales.append(QLocale(QLocale::English, QLocale::UnitedStates));
|
m_locales.append(QLocale(QLocale::English, QLocale::UnitedStates));
|
||||||
|
|
||||||
for (const QFileInfo &fileInfo : QDir(i18nDir())
|
const auto i18nFileInfos = QDir(i18nDir())
|
||||||
.entryInfoList(QStringList() << ("*" TRANSLATION_FILE_SUFFIX))) {
|
.entryInfoList(QStringList() << ("*" TRANSLATION_FILE_SUFFIX));
|
||||||
|
|
||||||
|
for (const QFileInfo &fileInfo : i18nFileInfos) {
|
||||||
const QString localeName = fileInfo.completeBaseName().mid(prefixLen);
|
const QString localeName = fileInfo.completeBaseName().mid(prefixLen);
|
||||||
const QLocale locale(localeName);
|
const QLocale locale(localeName);
|
||||||
|
|
||||||
|
@ -401,8 +401,9 @@ bool ConfUtil::parseAppsText(int groupIndex, bool blocked, const QString &text,
|
|||||||
quint32 &prefixAppsSize,
|
quint32 &prefixAppsSize,
|
||||||
quint32 &exeAppsSize)
|
quint32 &exeAppsSize)
|
||||||
{
|
{
|
||||||
for (const QStringRef &line :
|
const auto lines = text.splitRef(QLatin1Char('\n'));
|
||||||
text.splitRef(QLatin1Char('\n'))) {
|
|
||||||
|
for (const QStringRef &line : lines) {
|
||||||
const QStringRef lineTrimmed = line.trimmed();
|
const QStringRef lineTrimmed = line.trimmed();
|
||||||
if (lineTrimmed.isEmpty()
|
if (lineTrimmed.isEmpty()
|
||||||
|| lineTrimmed.startsWith('#')) // commented line
|
|| lineTrimmed.startsWith('#')) // commented line
|
||||||
|
@ -25,7 +25,9 @@ QString FileUtil::kernelNameToDrive(const QString &kernelName)
|
|||||||
{
|
{
|
||||||
const QString kernelNameLower = kernelName.toLower();
|
const QString kernelNameLower = kernelName.toLower();
|
||||||
|
|
||||||
for (const QFileInfo &fi : QDir::drives()) {
|
const auto drives = QDir::drives();
|
||||||
|
|
||||||
|
for (const QFileInfo &fi : drives) {
|
||||||
const QString driveName = fi.path().left(2);
|
const QString driveName = fi.path().left(2);
|
||||||
const QString driveKernelName = driveToKernelName(driveName);
|
const QString driveKernelName = driveToKernelName(driveName);
|
||||||
|
|
||||||
|
@ -146,10 +146,12 @@ void Logger::checkLogFiles()
|
|||||||
int count = LOGGER_KEEP_FILES;
|
int count = LOGGER_KEEP_FILES;
|
||||||
|
|
||||||
// Remove old files
|
// Remove old files
|
||||||
for (const QString &fileName : m_dir.entryList(
|
const auto fileNames = m_dir.entryList(
|
||||||
QStringList() << (QLatin1String(LOGGER_FILE_PREFIX) + '*'
|
QStringList() << (QLatin1String(LOGGER_FILE_PREFIX) + '*'
|
||||||
+ QLatin1String(LOGGER_FILE_SUFFIX)),
|
+ QLatin1String(LOGGER_FILE_SUFFIX)),
|
||||||
QDir::Files, QDir::Time)) {
|
QDir::Files, QDir::Time);
|
||||||
|
|
||||||
|
for (const QString &fileName : fileNames) {
|
||||||
if (--count < 0) {
|
if (--count < 0) {
|
||||||
QFile::remove(m_dir.filePath(fileName));
|
QFile::remove(m_dir.filePath(fileName));
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ void NativeEventFilter::unregisterHotKey(int hotKeyId)
|
|||||||
|
|
||||||
void NativeEventFilter::unregisterHotKeys()
|
void NativeEventFilter::unregisterHotKeys()
|
||||||
{
|
{
|
||||||
for (const int hotKeyId : m_keyIdMap) {
|
for (const int hotKeyId : qAsConst(m_keyIdMap)) {
|
||||||
UnregisterHotKey(nullptr, hotKeyId);
|
UnregisterHotKey(nullptr, hotKeyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ bool Ip4Range::fromList(const QVector<QStringRef> &list, int emptyNetMask, bool
|
|||||||
int pairSize = 0;
|
int pairSize = 0;
|
||||||
|
|
||||||
int lineNo = 0;
|
int lineNo = 0;
|
||||||
for (const auto line : list) {
|
for (const auto &line : list) {
|
||||||
++lineNo;
|
++lineNo;
|
||||||
|
|
||||||
const auto lineTrimmed = line.trimmed();
|
const auto lineTrimmed = line.trimmed();
|
||||||
@ -89,7 +89,7 @@ bool Ip4Range::fromList(const QVector<QStringRef> &list, int emptyNetMask, bool
|
|||||||
|| lineTrimmed.startsWith('#')) // commented line
|
|| lineTrimmed.startsWith('#')) // commented line
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
quint32 from, to;
|
quint32 from = 0, to = 0;
|
||||||
if (!parseAddressMask(lineTrimmed, from, to, emptyNetMask)) {
|
if (!parseAddressMask(lineTrimmed, from, to, emptyNetMask)) {
|
||||||
setErrorLineNo(lineNo);
|
setErrorLineNo(lineNo);
|
||||||
return false;
|
return false;
|
||||||
|
@ -46,13 +46,6 @@ public:
|
|||||||
return Ip4Pair{m_pairFromArray.at(i), m_pairToArray.at(i)};
|
return Ip4Pair{m_pairFromArray.at(i), m_pairToArray.at(i)};
|
||||||
}
|
}
|
||||||
|
|
||||||
signals:
|
|
||||||
void errorLineNoChanged();
|
|
||||||
void errorMessageChanged();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
QString toText() const;
|
QString toText() const;
|
||||||
|
|
||||||
// Parse IPv4 ranges
|
// Parse IPv4 ranges
|
||||||
@ -60,6 +53,13 @@ public slots:
|
|||||||
bool fromList(const QVector<QStringRef> &list, int emptyNetMask = 32,
|
bool fromList(const QVector<QStringRef> &list, int emptyNetMask = 32,
|
||||||
bool sort = true);
|
bool sort = true);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void errorLineNoChanged();
|
||||||
|
void errorMessageChanged();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setErrorLineNo(int lineNo);
|
void setErrorLineNo(int lineNo);
|
||||||
void setErrorMessage(const QString &errorMessage);
|
void setErrorMessage(const QString &errorMessage);
|
||||||
|
@ -28,13 +28,10 @@ public:
|
|||||||
&& m_handle != PROC_INVALID_HANDLE;
|
&& m_handle != PROC_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static quint32 currentPid();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
QString path(bool isKernelPath = false) const;
|
QString path(bool isKernelPath = false) const;
|
||||||
|
|
||||||
|
static quint32 currentPid();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openProcess();
|
void openProcess();
|
||||||
void closeProcess();
|
void closeProcess();
|
||||||
|
Loading…
Reference in New Issue
Block a user