UI: Avoid CLang warnings.

This commit is contained in:
Nodir Temirkhodjaev 2020-05-13 15:28:06 +03:00
parent 123ed6c261
commit 7d99d09736
21 changed files with 93 additions and 83 deletions

View File

@ -384,7 +384,9 @@ bool SqliteDb::importDb(const QString &sourceFilePath,
beginTransaction();
for (const auto &tableName : tableNames(srcSchema)) {
const auto srcTableNames = tableNames(srcSchema);
for (const auto &tableName : srcTableNames) {
const auto dstColumns = columnNames(tableName, dstSchema);
if (dstColumns.isEmpty())
continue; // new schema doesn't contain old table

View File

@ -11,7 +11,8 @@ TableView::TableView(QWidget *parent) :
QVector<int> TableView::selectedRows() const
{
QSet<int> rowsSet;
for (const auto index : selectedIndexes()) {
const auto indexes = selectedIndexes();
for (const auto index : indexes) {
rowsSet.insert(index.row());
}
rowsSet.insert(currentIndex().row());

View File

@ -120,7 +120,7 @@ void AddressesPage::setupIncludeAddresses()
{
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)
return;
@ -128,7 +128,7 @@ void AddressesPage::setupIncludeAddresses()
ctrl()->setConfFlagsEdited(true);
});
connect(m_includeAddresses->editIpText(), &QPlainTextEdit::textChanged, [&] {
connect(m_includeAddresses->editIpText(), &QPlainTextEdit::textChanged, this, [&] {
const auto ipText = m_includeAddresses->editIpText()->toPlainText();
if (addressGroup()->includeText() == ipText)
@ -144,7 +144,7 @@ void AddressesPage::setupExcludeAddresses()
{
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)
return;
@ -152,7 +152,7 @@ void AddressesPage::setupExcludeAddresses()
ctrl()->setConfFlagsEdited(true);
});
connect(m_excludeAddresses->editIpText(), &QPlainTextEdit::textChanged, [&] {
connect(m_excludeAddresses->editIpText(), &QPlainTextEdit::textChanged, this, [&] {
const auto ipText = m_excludeAddresses->editIpText()->toPlainText();
if (addressGroup()->excludeText() == ipText)

View File

@ -267,7 +267,7 @@ void ApplicationsPage::setupTabBar()
addTab(appGroup->name());
}
connect(m_tabBar, &QTabBar::tabCloseRequested, [&](int index) {
connect(m_tabBar, &QTabBar::tabCloseRequested, this, [&](int index) {
if (m_tabBar->count() <= 1)
return;
@ -276,7 +276,7 @@ void ApplicationsPage::setupTabBar()
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);
ctrl()->setConfEdited(true);
});
@ -324,7 +324,7 @@ void ApplicationsPage::setupGroupPeriod()
{
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)
return;
@ -332,7 +332,7 @@ void ApplicationsPage::setupGroupPeriod()
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);
if (appGroup()->periodFrom() == timeStr)
@ -342,7 +342,7 @@ void ApplicationsPage::setupGroupPeriod()
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);
if (appGroup()->periodTo() == timeStr)
@ -389,7 +389,7 @@ void ApplicationsPage::setupGroupLimitIn()
{
m_cscLimitIn = createGroupLimit();
connect(m_cscLimitIn->checkBox(), &QCheckBox::toggled, [&](bool checked) {
connect(m_cscLimitIn->checkBox(), &QCheckBox::toggled, this, [&](bool checked) {
if (appGroup()->limitInEnabled() == checked)
return;
@ -397,7 +397,7 @@ void ApplicationsPage::setupGroupLimitIn()
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);
if (appGroup()->speedLimitIn() == kbytes)
@ -413,7 +413,7 @@ void ApplicationsPage::setupGroupLimitOut()
{
m_cscLimitOut = createGroupLimit();
connect(m_cscLimitOut->checkBox(), &QCheckBox::toggled, [&](bool checked) {
connect(m_cscLimitOut->checkBox(), &QCheckBox::toggled, this, [&](bool checked) {
if (appGroup()->limitOutEnabled() == checked)
return;
@ -421,7 +421,7 @@ void ApplicationsPage::setupGroupLimitOut()
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);
if (appGroup()->speedLimitOut() == kbytes)
@ -465,7 +465,7 @@ void ApplicationsPage::setupBlockApps()
m_blockApps = new AppsColumn();
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();
if (appGroup()->blockText() == text)
@ -482,7 +482,7 @@ void ApplicationsPage::setupAllowApps()
m_allowApps = new AppsColumn();
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();
if (appGroup()->allowText() == text)

View File

@ -84,7 +84,7 @@ void SchedulePage::retranslateTaskDetails()
void SchedulePage::setupTaskListModel()
{
connect(m_taskListModel, &TaskListModel::dataEdited, [&] {
connect(m_taskListModel, &TaskListModel::dataEdited, this, [&] {
setScheduleEdited(true);
});
}
@ -117,7 +117,7 @@ void SchedulePage::setupTableTasks()
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());
if (taskInfo->type() == TaskInfo::ZoneDownloader) {
fortManager()->showZonesWindow();
@ -173,13 +173,13 @@ void SchedulePage::setupTaskInterval()
m_cscTaskInterval->spinBox()->setRange(1, 24 * 30 * 12); // ~Year
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 auto index = taskListModel()->index(taskIndex, 0);
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 auto index = taskListModel()->index(taskIndex, 1);

View File

@ -320,19 +320,19 @@ void StatisticsPage::setupClearMenu()
m_actResetTotal = 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?")))
return;
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?")))
return;
trafListModel()->resetAppTotals();
});
connect(m_actClearAll, &QAction::triggered, [&] {
connect(m_actClearAll, &QAction::triggered, this, [&] {
if (!fortManager()->showQuestionBox(tr("Are you sure to clear all statistics?")))
return;
@ -469,7 +469,7 @@ void StatisticsPage::setupActivePeriod()
{
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)
return;
@ -477,7 +477,7 @@ void StatisticsPage::setupActivePeriod()
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);
if (conf()->activePeriodFrom() == timeStr)
@ -487,7 +487,7 @@ void StatisticsPage::setupActivePeriod()
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);
if (conf()->activePeriodTo() == timeStr)
@ -514,7 +514,7 @@ void StatisticsPage::setupMonthStart()
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)
return;
@ -529,7 +529,7 @@ void StatisticsPage::setupTrafHourKeepDays()
m_lscTrafHourKeepDays = createSpinCombo(-1, 9999);
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)
return;
@ -544,7 +544,7 @@ void StatisticsPage::setupTrafDayKeepDays()
m_lscTrafDayKeepDays = createSpinCombo(-1, 9999);
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)
return;
@ -559,7 +559,7 @@ void StatisticsPage::setupTrafMonthKeepMonths()
m_lscTrafMonthKeepMonths = createSpinCombo(-1, 9999);
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)
return;
@ -574,7 +574,7 @@ void StatisticsPage::setupQuotaDayMb()
m_lscQuotaDayMb = createSpinCombo(0, 1024 * 1024, " MiB");
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);
if (conf()->quotaDayMb() == mbytes)
@ -591,7 +591,7 @@ void StatisticsPage::setupQuotaMonthMb()
m_lscQuotaMonthMb = createSpinCombo(0, 1024 * 1024, " MiB");
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);
if (conf()->quotaMonthMb() == mbytes)
@ -688,10 +688,10 @@ void StatisticsPage::setupAppInfoRow()
m_labelAppCompanyName = ControlUtil::createLabel();
connect(m_btAppCopyPath, &QAbstractButton::clicked, [&] {
connect(m_btAppCopyPath, &QAbstractButton::clicked, this, [&] {
GuiUtil::setClipboardData(appListCurrentPath());
});
connect(m_btAppOpenFolder, &QAbstractButton::clicked, [&] {
connect(m_btAppOpenFolder, &QAbstractButton::clicked, this, [&] {
OsUtil::openFolder(appListCurrentPath());
});

View File

@ -270,7 +270,7 @@ void ProgramsWindow::setupAppEditForm()
m_formAppEdit->setLayout(layout);
m_formAppEdit->setMinimumWidth(500);
connect(m_btSelectFile, &QAbstractButton::clicked, [&] {
connect(m_btSelectFile, &QAbstractButton::clicked, this, [&] {
const auto filePath = ControlUtil::getOpenFileName(
m_labelEditPath->text(),
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_cscBlockAppIn->setEnabled(checked);
m_cbBlockAppAt->setEnabled(checked);
m_dteBlockAppAt->setEnabled(checked);
});
connect(m_btEditOk, &QAbstractButton::clicked, [&] {
connect(m_btEditOk, &QAbstractButton::clicked, this, [&] {
if (saveAppEditForm()) {
m_formAppEdit->close();
}
@ -355,24 +355,24 @@ QLayout *ProgramsWindow::setupHeader()
m_actPurgeApps = editMenu->addAction(QIcon(":/images/bin_empty.png"), QString());
connect(m_actAllowApp, &QAction::triggered, [&] {
connect(m_actAllowApp, &QAction::triggered, this, [&] {
updateSelectedApps(false);
});
connect(m_actBlockApp, &QAction::triggered, [&] {
connect(m_actBlockApp, &QAction::triggered, this, [&] {
updateSelectedApps(true);
});
connect(m_actAddApp, &QAction::triggered, [&] {
connect(m_actAddApp, &QAction::triggered, this, [&] {
updateAppEditForm(false);
});
connect(m_actEditApp, &QAction::triggered, [&] {
connect(m_actEditApp, &QAction::triggered, this, [&] {
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)?"))) {
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?"))) {
appListModel()->purgeApps();
}
@ -482,10 +482,10 @@ void ProgramsWindow::setupAppInfoRow()
m_labelAppCompanyName = ControlUtil::createLabel();
connect(m_btAppCopyPath, &QAbstractButton::clicked, [&] {
connect(m_btAppCopyPath, &QAbstractButton::clicked, this, [&] {
GuiUtil::setClipboardData(appListCurrentPath());
});
connect(m_btAppOpenFolder, &QAbstractButton::clicked, [&] {
connect(m_btAppOpenFolder, &QAbstractButton::clicked, this, [&] {
OsUtil::openFolder(appListCurrentPath());
});

View File

@ -198,12 +198,12 @@ void ZonesWindow::setupZoneEditForm()
m_formZoneEdit->setLayout(layout);
m_formZoneEdit->setMinimumWidth(500);
connect(m_cbCustomUrl, &QCheckBox::toggled, [&](bool checked) {
connect(m_cbCustomUrl, &QCheckBox::toggled, this, [&](bool checked) {
m_editUrl->setEnabled(checked);
m_editFormData->setEnabled(checked);
});
connect(m_btEditOk, &QAbstractButton::clicked, [&] {
connect(m_btEditOk, &QAbstractButton::clicked, this, [&] {
if (saveZoneEditForm()) {
m_formZoneEdit->close();
}
@ -245,13 +245,13 @@ QLayout *ZonesWindow::setupHeader()
m_actRemoveZone = editMenu->addAction(QIcon(":/images/map_delete.png"), QString());
m_actRemoveZone->setShortcut(Qt::Key_Delete);
connect(m_actAddZone, &QAction::triggered, [&] {
connect(m_actAddZone, &QAction::triggered, this, [&] {
updateZoneEditForm(false);
});
connect(m_actEditZone, &QAction::triggered, [&] {
connect(m_actEditZone, &QAction::triggered, this, [&] {
updateZoneEditForm(true);
});
connect(m_actRemoveZone, &QAction::triggered, [&] {
connect(m_actRemoveZone, &QAction::triggered, this, [&] {
if (fortManager()->showQuestionBox(tr("Are you sure to remove selected zone?"))) {
deleteSelectedZone();
}

View File

@ -471,7 +471,7 @@ void FortManager::showGraphWindow()
m_graphWindowState->install(m_graphWindow);
connect(m_graphWindow, &GraphWindow::aboutToClose, [this] {
connect(m_graphWindow, &GraphWindow::aboutToClose, this, [this] {
closeGraphWindow();
});
@ -871,7 +871,7 @@ void FortManager::updateTrayMenuFlags()
m_allowAllNewAction->setChecked(conf()->allowAllNew());
int appGroupIndex = 0;
for (QAction *action : m_appGroupActions) {
for (QAction *action : qAsConst(m_appGroupActions)) {
const auto appGroup = conf()->appGroups().at(appGroupIndex++);
action->setEnabled(editEnabled);

View File

@ -212,6 +212,9 @@ public:
QString appUpdatesUrl() const { return APP_UPDATES_URL; }
bool confMigrated() const;
bool confCanMigrate(QString &viaVersion) const;
signals:
void iniChanged();
void startWithWindowsChanged();
@ -221,9 +224,6 @@ public slots:
void readConfIni(FirewallConf &conf) const;
bool writeConfIni(const FirewallConf &conf);
bool confMigrated() const;
bool confCanMigrate(QString &viaVersion) const;
void bulkUpdateBegin();
void bulkUpdateEnd();

View File

@ -209,7 +209,8 @@ bool TaskInfoZoneDownloader::containsZoneId(quint32 &zonesMask, int zoneId) cons
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();
if (zoneId != 0 && !containsZoneId(m_zonesMask, zoneId)) {
FileUtil::removeFile(fi.filePath());

View File

@ -89,7 +89,7 @@ void TaskManager::runExpiredTasks()
const QDateTime now = DateUtil::now();
bool enabledTaskExists = false;
for (TaskInfo *taskInfo : m_taskInfos) {
for (TaskInfo *taskInfo : qAsConst(m_taskInfos)) {
if (!taskInfo->enabled())
continue;

View File

@ -73,7 +73,9 @@ QVector<QStringRef> TaskZoneDownloader::parseAddresses(const QString &text,
// Parse lines
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('#')
|| line.startsWith(';')) // commented line
continue;

View File

@ -38,8 +38,10 @@ void TranslationManager::setupTranslation()
m_locales.append(QLocale(QLocale::English, QLocale::UnitedStates));
for (const QFileInfo &fileInfo : QDir(i18nDir())
.entryInfoList(QStringList() << ("*" TRANSLATION_FILE_SUFFIX))) {
const auto i18nFileInfos = QDir(i18nDir())
.entryInfoList(QStringList() << ("*" TRANSLATION_FILE_SUFFIX));
for (const QFileInfo &fileInfo : i18nFileInfos) {
const QString localeName = fileInfo.completeBaseName().mid(prefixLen);
const QLocale locale(localeName);

View File

@ -401,8 +401,9 @@ bool ConfUtil::parseAppsText(int groupIndex, bool blocked, const QString &text,
quint32 &prefixAppsSize,
quint32 &exeAppsSize)
{
for (const QStringRef &line :
text.splitRef(QLatin1Char('\n'))) {
const auto lines = text.splitRef(QLatin1Char('\n'));
for (const QStringRef &line : lines) {
const QStringRef lineTrimmed = line.trimmed();
if (lineTrimmed.isEmpty()
|| lineTrimmed.startsWith('#')) // commented line

View File

@ -25,7 +25,9 @@ QString FileUtil::kernelNameToDrive(const QString &kernelName)
{
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 driveKernelName = driveToKernelName(driveName);

View File

@ -146,10 +146,12 @@ void Logger::checkLogFiles()
int count = LOGGER_KEEP_FILES;
// Remove old files
for (const QString &fileName : m_dir.entryList(
QStringList() << (QLatin1String(LOGGER_FILE_PREFIX) + '*'
+ QLatin1String(LOGGER_FILE_SUFFIX)),
QDir::Files, QDir::Time)) {
const auto fileNames = m_dir.entryList(
QStringList() << (QLatin1String(LOGGER_FILE_PREFIX) + '*'
+ QLatin1String(LOGGER_FILE_SUFFIX)),
QDir::Files, QDir::Time);
for (const QString &fileName : fileNames) {
if (--count < 0) {
QFile::remove(m_dir.filePath(fileName));
}

View File

@ -52,7 +52,7 @@ void NativeEventFilter::unregisterHotKey(int hotKeyId)
void NativeEventFilter::unregisterHotKeys()
{
for (const int hotKeyId : m_keyIdMap) {
for (const int hotKeyId : qAsConst(m_keyIdMap)) {
UnregisterHotKey(nullptr, hotKeyId);
}

View File

@ -81,7 +81,7 @@ bool Ip4Range::fromList(const QVector<QStringRef> &list, int emptyNetMask, bool
int pairSize = 0;
int lineNo = 0;
for (const auto line : list) {
for (const auto &line : list) {
++lineNo;
const auto lineTrimmed = line.trimmed();
@ -89,7 +89,7 @@ bool Ip4Range::fromList(const QVector<QStringRef> &list, int emptyNetMask, bool
|| lineTrimmed.startsWith('#')) // commented line
continue;
quint32 from, to;
quint32 from = 0, to = 0;
if (!parseAddressMask(lineTrimmed, from, to, emptyNetMask)) {
setErrorLineNo(lineNo);
return false;

View File

@ -46,13 +46,6 @@ public:
return Ip4Pair{m_pairFromArray.at(i), m_pairToArray.at(i)};
}
signals:
void errorLineNoChanged();
void errorMessageChanged();
public slots:
void clear();
QString toText() const;
// Parse IPv4 ranges
@ -60,6 +53,13 @@ public slots:
bool fromList(const QVector<QStringRef> &list, int emptyNetMask = 32,
bool sort = true);
signals:
void errorLineNoChanged();
void errorMessageChanged();
public slots:
void clear();
private:
void setErrorLineNo(int lineNo);
void setErrorMessage(const QString &errorMessage);

View File

@ -28,13 +28,10 @@ public:
&& m_handle != PROC_INVALID_HANDLE;
}
static quint32 currentPid();
signals:
public slots:
QString path(bool isKernelPath = false) const;
static quint32 currentPid();
private:
void openProcess();
void closeProcess();