Commit 6c1cfe15 authored by Laurent Montel's avatar Laurent Montel 😁

GIT_SILENT: coding style

parent 3267f85e
......@@ -25,12 +25,10 @@
CategoryTypeComboBoxTest::CategoryTypeComboBoxTest(QObject *parent)
: QObject(parent)
{
}
CategoryTypeComboBoxTest::~CategoryTypeComboBoxTest()
{
}
void CategoryTypeComboBoxTest::shouldHaveDefaultValue()
......
......@@ -25,12 +25,10 @@
CategoryWarningTest::CategoryWarningTest(QObject *parent)
: QObject(parent)
{
}
CategoryWarningTest::~CategoryWarningTest()
{
}
void CategoryWarningTest::shouldHaveDefaultValue()
......
......@@ -27,12 +27,10 @@
ConfigureCustomSettingDialogTest::ConfigureCustomSettingDialogTest(QObject *parent)
: QObject(parent)
{
}
ConfigureCustomSettingDialogTest::~ConfigureCustomSettingDialogTest()
{
}
void ConfigureCustomSettingDialogTest::shouldHaveDefaultValue()
......@@ -43,7 +41,6 @@ void ConfigureCustomSettingDialogTest::shouldHaveDefaultValue()
QVERIFY(!buttonBox->button(QDialogButtonBox::Ok)->isEnabled());
ConfigureCustomSettingWidget *widget = dlg.findChild<ConfigureCustomSettingWidget *>(QStringLiteral("customsettingwidget"));
QVERIFY(widget);
}
QTEST_MAIN(ConfigureCustomSettingDialogTest)
......@@ -30,12 +30,10 @@
ConfigureCustomSettingWidgetTest::ConfigureCustomSettingWidgetTest(QObject *parent)
: QObject(parent)
{
}
ConfigureCustomSettingWidgetTest::~ConfigureCustomSettingWidgetTest()
{
}
void ConfigureCustomSettingWidgetTest::shouldHaveDefaultValue()
......
......@@ -29,12 +29,10 @@
CustomDebugSettingsPageTest::CustomDebugSettingsPageTest(QObject *parent)
: QObject(parent)
{
}
CustomDebugSettingsPageTest::~CustomDebugSettingsPageTest()
{
}
void CustomDebugSettingsPageTest::shouldHaveDefaultValue()
......@@ -49,13 +47,11 @@ void CustomDebugSettingsPageTest::shouldHaveDefaultValue()
QCOMPARE(listWidget->selectionMode(), QAbstractItemView::MultiSelection);
QCOMPARE(listWidget->count(), 0);
KListWidgetSearchLine *searchLine = page.findChild<KListWidgetSearchLine *>(QStringLiteral("searchline"));
QVERIFY(searchLine);
QVERIFY(!searchLine->placeholderText().isEmpty());
QCOMPARE(searchLine->listWidget(), listWidget);
QPushButton *addButton = page.findChild<QPushButton *>(QStringLiteral("add_rule"));
QVERIFY(addButton);
QVERIFY(addButton->isEnabled());
......
......@@ -27,12 +27,10 @@
EnvironmentSettingsRulesPageTest::EnvironmentSettingsRulesPageTest(QObject *parent)
: QObject(parent)
{
}
EnvironmentSettingsRulesPageTest::~EnvironmentSettingsRulesPageTest()
{
}
void EnvironmentSettingsRulesPageTest::shouldHaveDefaultValue()
......
......@@ -29,12 +29,10 @@
KDEApplicationDebugSettingPageTest::KDEApplicationDebugSettingPageTest(QObject *parent)
: QObject(parent)
{
}
KDEApplicationDebugSettingPageTest::~KDEApplicationDebugSettingPageTest()
{
}
void KDEApplicationDebugSettingPageTest::shouldHaveDefaultValue()
......
......@@ -25,12 +25,10 @@
KDEApplicationTreeListWidgetTest::KDEApplicationTreeListWidgetTest(QObject *parent) : QObject(parent)
{
}
KDEApplicationTreeListWidgetTest::~KDEApplicationTreeListWidgetTest()
{
}
void KDEApplicationTreeListWidgetTest::shouldHaveDefaultValue()
......
......@@ -35,7 +35,6 @@ KDebugSettingsDialogTest::KDebugSettingsDialogTest(QObject *parent)
KDebugSettingsDialogTest::~KDebugSettingsDialogTest()
{
}
void KDebugSettingsDialogTest::shouldHaveDefaultValue()
......@@ -48,9 +47,9 @@ void KDebugSettingsDialogTest::shouldHaveDefaultValue()
QVERIFY(tab);
for (int i = 0; i < tab->count(); ++i) {
const QString objName = tab->widget(i)->objectName();
const bool hasCorrectName = (objName == QStringLiteral("kdeapplicationsettingspage")) ||
(objName == QStringLiteral("customsettingspage")) ||
(objName == QStringLiteral("environmentsettingsrulespage"));
const bool hasCorrectName = (objName == QStringLiteral("kdeapplicationsettingspage"))
|| (objName == QStringLiteral("customsettingspage"))
|| (objName == QStringLiteral("environmentsettingsrulespage"));
QVERIFY(hasCorrectName);
}
QPushButton *saveAs = buttonBox->findChild<QPushButton *>(QStringLiteral("saveas_button"));
......
......@@ -26,12 +26,10 @@
KDebugSettingUtilTest::KDebugSettingUtilTest(QObject *parent)
: QObject(parent)
{
}
KDebugSettingUtilTest::~KDebugSettingUtilTest()
{
}
void KDebugSettingUtilTest::shouldParseKdeLoggingLine_data()
......
......@@ -41,7 +41,6 @@ private Q_SLOTS:
void shouldReadRenameCategories_data();
void shouldReadRenameCategories();
};
#endif // KDEBUGSETTINGUTILTEST_H
......@@ -29,12 +29,10 @@
LoadCategoriesJobTest::LoadCategoriesJobTest(QObject *parent)
: QObject(parent)
{
}
LoadCategoriesJobTest::~LoadCategoriesJobTest()
{
}
void LoadCategoriesJobTest::shouldHaveDefaultValue()
......@@ -69,8 +67,8 @@ void LoadCategoriesJobTest::shouldReadRules_data()
qtKdeCategories.append(kauthInfo);
QTest::newRow("emptywithlistkdeloggingcategories") << QStringLiteral("rulebeforerulessectionfiles.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List()
<< qtKdeCategories;
<< LoggingCategory::List()
<< qtKdeCategories;
qtKdeCategories[0] = LoggingCategory(QStringLiteral("KPasswdServer (KIO)"), QStringLiteral("org.kde.kio.kpasswdserver"), LoggingCategory::Off, false);
......@@ -115,11 +113,11 @@ void LoadCategoriesJobTest::shouldReadRules_data()
<< qtKdeCategories;
QTest::newRow("oneelementonelinecritical") << QStringLiteral("oneelementonelinecritical.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List()
<< qtKdeCategories;
<< LoggingCategory::List()
<< qtKdeCategories;
QTest::newRow("oneelementtwolinecritical") << QStringLiteral("oneelementtwolinecritical.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List()
<< qtKdeCategories;
<< LoggingCategory::List()
<< qtKdeCategories;
qtKdeCategories[0] = LoggingCategory(QStringLiteral("KPasswdServer (KIO)"), QStringLiteral("org.kde.kio.kpasswdserver"), LoggingCategory::Debug, true);
......@@ -129,14 +127,14 @@ void LoadCategoriesJobTest::shouldReadRules_data()
// Duplicate entries
qtKdeCategories[0] = LoggingCategory(QStringLiteral("KPasswdServer (KIO)"), QStringLiteral("org.kde.kio.kpasswdserver"), LoggingCategory::All, true);
QTest::newRow("duplicates") << QStringLiteral("duplicates.ini") << QStringLiteral("correct.categories") << false
<< LoggingCategory::List()
<< qtKdeCategories;
<< LoggingCategory::List()
<< qtKdeCategories;
// Duplicate entries with duplicate categories
qtKdeCategories[0] = LoggingCategory(QStringLiteral("KPasswdServer (KIO)"), QStringLiteral("org.kde.kio.kpasswdserver"), LoggingCategory::All, true);
QTest::newRow("duplicates") << QStringLiteral("duplicates.ini") << QStringLiteral("duplicates.categories") << false
<< LoggingCategory::List()
<< qtKdeCategories;
<< LoggingCategory::List()
<< qtKdeCategories;
// Test with extract elements
LoggingCategory::List customCategories;
......@@ -148,8 +146,8 @@ void LoadCategoriesJobTest::shouldReadRules_data()
qtKdeCategories[0] = LoggingCategory(QStringLiteral("KPasswdServer (KIO)"), QStringLiteral("org.kde.kio.kpasswdserver"), LoggingCategory::Debug, true);
QTest::newRow("oneelementdebugandanextract") << QStringLiteral("oneelementdebugandanextract.ini") << QStringLiteral("correct.categories") << false
<< customCategories
<< qtKdeCategories;
<< customCategories
<< qtKdeCategories;
// Test with extract elements
customCategories.clear();
......@@ -159,8 +157,8 @@ void LoadCategoriesJobTest::shouldReadRules_data()
customCategories.append(customTmp);
QTest::newRow("oneelementdebugandanextractfalse") << QStringLiteral("oneelementdebugandanextractfalse.ini") << QStringLiteral("correct.categories") << false
<< customCategories
<< qtKdeCategories;
<< customCategories
<< qtKdeCategories;
//Test without categories
qtKdeCategories.clear();
......@@ -194,8 +192,8 @@ void LoadCategoriesJobTest::shouldReadRules_data()
customTmp.enabled = false;
customCategories.append(customTmp);
QTest::newRow("testwithoutcategorieswarning") << QStringLiteral("testwithoutcategorieswarning.ini") << QString() << false
<< customCategories
<< qtKdeCategories;
<< customCategories
<< qtKdeCategories;
}
void LoadCategoriesJobTest::shouldReadRules()
......
......@@ -25,12 +25,10 @@
LoggingCategoryTest::LoggingCategoryTest(QObject *parent)
: QObject(parent)
{
}
LoggingCategoryTest::~LoggingCategoryTest()
{
}
void LoggingCategoryTest::shouldHaveDefaultValue()
......
......@@ -25,12 +25,10 @@
RenameCategoryTest::RenameCategoryTest(QObject *parent)
: QObject(parent)
{
}
RenameCategoryTest::~RenameCategoryTest()
{
}
void RenameCategoryTest::shouldParseRenameLine_data()
......@@ -64,5 +62,4 @@ void RenameCategoryTest::shouldParseRenameLine()
QCOMPARE(cat.isValid(), valid);
}
QTEST_MAIN(RenameCategoryTest)
......@@ -18,7 +18,6 @@
*/
#include "saverulesjobtest.h"
#include "../src/loadcategoriesjob.h"
#include "../src/saverulesjob.h"
......@@ -45,11 +44,9 @@ void compareFile(const QString &name)
QCOMPARE(proc.exitCode(), 0);
}
SaveRulesJobTest::SaveRulesJobTest(QObject *parent)
: QObject(parent)
{
}
void SaveRulesJobTest::shouldSaveLoadRules_data()
......@@ -73,7 +70,6 @@ void SaveRulesJobTest::shouldSaveLoadRules()
const LoggingCategory::List qtKdeCategories = job.qtKdeCategories();
SaveRulesJob saveJob;
saveJob.setFileName(QLatin1String(KDEBUGSETTINGS_DATA_DIR) + QLatin1Char('/') + filename + QStringLiteral("-generated.ref"));
saveJob.setListCustom(customCategories);
......
......@@ -18,7 +18,6 @@
*/
#ifndef SAVERULESJOBTEST_H
#define SAVERULESJOBTEST_H
......
......@@ -37,7 +37,6 @@ CategoryTypeComboBox::CategoryTypeComboBox(bool customType, QWidget *parent)
CategoryTypeComboBox::~CategoryTypeComboBox()
{
}
void CategoryTypeComboBox::setType(LoggingCategory::LoggingType type)
......@@ -58,7 +57,7 @@ LoggingCategory::LoggingType CategoryTypeComboBox::type() const
bool CategoryTypeComboBox::loggingCategoryIsNotDefault() const
{
return (type() != LoggingCategory::Info);
return type() != LoggingCategory::Info;
}
void CategoryTypeComboBox::setDefaultCategories(const LoggingCategory::LoggingType &defaultCategories)
......
......@@ -32,6 +32,4 @@ CategoryWarning::CategoryWarning(QWidget *parent)
CategoryWarning::~CategoryWarning()
{
}
......@@ -44,12 +44,10 @@ ConfigureCustomSettingDialog::ConfigureCustomSettingDialog(QWidget *parent)
buttonOk->setEnabled(false);
connect(mCustomSettingWidget, &ConfigureCustomSettingWidget::enableButton, buttonOk, &QWidget::setEnabled);
mainLayout->addWidget(buttonBox);
}
ConfigureCustomSettingDialog::~ConfigureCustomSettingDialog()
{
}
void ConfigureCustomSettingDialog::setRule(const QString &rule)
......
......@@ -61,7 +61,6 @@ ConfigureCustomSettingWidget::ConfigureCustomSettingWidget(QWidget *parent)
ConfigureCustomSettingWidget::~ConfigureCustomSettingWidget()
{
}
void ConfigureCustomSettingWidget::slotTextChanged(const QString &text)
......@@ -128,4 +127,3 @@ QString ConfigureCustomSettingWidget::rule() const
}
return ruleStr;
}
......@@ -81,7 +81,6 @@ CustomDebugSettingsPage::CustomDebugSettingsPage(QWidget *parent)
CustomDebugSettingsPage::~CustomDebugSettingsPage()
{
}
void CustomDebugSettingsPage::updateButtons()
......
......@@ -25,12 +25,11 @@
EnvironmentPlainTextEdit::EnvironmentPlainTextEdit(QWidget *parent)
: QTextEdit(parent)
{
{
}
EnvironmentPlainTextEdit::~EnvironmentPlainTextEdit()
{
}
void EnvironmentPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
......
......@@ -39,12 +39,12 @@ EnvironmentSettingsRulesPage::EnvironmentSettingsRulesPage(QWidget *parent)
EnvironmentSettingsRulesPage::~EnvironmentSettingsRulesPage()
{
}
void EnvironmentSettingsRulesPage::setRules(const QString &rules)
{
const QString information = QStringLiteral("<qt><b>") + i18n("These rules cannot be edited with this application. You need to set them in QT_LOGGING_RULES variable directly.") + QStringLiteral("</b><qt>");
const QString information = QStringLiteral("<qt><b>") + i18n("These rules cannot be edited with this application. You need to set them in QT_LOGGING_RULES variable directly.") + QStringLiteral(
"</b><qt>");
QString newRules = rules;
mRichTextEdit->setHtml(information + i18n("Current rules:") + QStringLiteral("<br>") + newRules.replace(QLatin1String("\n"), QLatin1String("<br>")));
}
......@@ -60,7 +60,6 @@ KDEApplicationDebugSettingPage::KDEApplicationDebugSettingPage(QWidget *parent)
KDEApplicationDebugSettingPage::~KDEApplicationDebugSettingPage()
{
}
bool KDEApplicationDebugSettingPage::eventFilter(QObject *obj, QEvent *event)
......
......@@ -23,8 +23,8 @@
#include <QHeaderView>
KDEApplicationTreeListWidgetItem::KDEApplicationTreeListWidgetItem(const QString &category, QTreeWidget *parent)
: QTreeWidgetItem(parent),
mCategory(category)
: QTreeWidgetItem(parent)
, mCategory(category)
{
mCategoryTypeCombobox = new CategoryTypeComboBox(false);
treeWidget()->setItemWidget(this, CategoryType, mCategoryTypeCombobox);
......@@ -32,7 +32,6 @@ KDEApplicationTreeListWidgetItem::KDEApplicationTreeListWidgetItem(const QString
KDEApplicationTreeListWidgetItem::~KDEApplicationTreeListWidgetItem()
{
}
void KDEApplicationTreeListWidgetItem::setType(LoggingCategory::LoggingType type)
......@@ -71,7 +70,6 @@ KDEApplicationTreeListWidget::KDEApplicationTreeListWidget(QWidget *parent)
KDEApplicationTreeListWidget::~KDEApplicationTreeListWidget()
{
}
void KDEApplicationTreeListWidget::selectAllDebugCategories()
......@@ -134,4 +132,3 @@ void KDEApplicationTreeListWidget::restoreToDefault()
itemWidget->setType(LoggingCategory::Info);
}
}
......@@ -176,7 +176,6 @@ void KDebugSettingsDialog::readCategoriesFiles(const QString &path)
}
}
const QByteArray rulesFilePath = qgetenv("QT_LOGGING_CONF");
if (!rulesFilePath.isEmpty()) {
const QList<KDebugSettingsUtil::LoadLoggingCategory> envCategories = KDebugSettingsUtil::readLoggingQtCategories(QString::fromLatin1(rulesFilePath));
......
......@@ -195,8 +195,7 @@ KDebugSettingsUtil::LineLoggingQtCategory KDebugSettingsUtil::parseLineLoggingQt
LineLoggingQtCategory lineCategory;
int equalPos = line.indexOf(QLatin1Char('='));
if ((equalPos != -1)
&& (line.lastIndexOf(QLatin1Char('=')) == equalPos)) {
&& (line.lastIndexOf(QLatin1Char('=')) == equalPos)) {
const QString pattern = line.left(equalPos);
const QString valueStr = line.mid(equalPos + 1);
if (valueStr == QLatin1String("true")) {
......
......@@ -28,16 +28,14 @@
#include "loggingcategory.h"
#include "renamecategory.h"
namespace KDebugSettingsUtil
{
namespace KDebugSettingsUtil {
struct LineLoggingQtCategory {
LineLoggingQtCategory()
: enabled(true),
type(Unknown)
: enabled(true)
, type(Unknown)
{
}
enum LoggingType {
Unknown = 0,
Info,
......@@ -51,12 +49,14 @@ struct LineLoggingQtCategory {
{
return !logName.isEmpty();
}
bool operator ==(const LineLoggingQtCategory &other) const
{
return (enabled == other.enabled) &&
(type == other.type) &&
(logName == other.logName);
return (enabled == other.enabled)
&& (type == other.type)
&& (logName == other.logName);
}
bool enabled;
LoggingType type;
QString logName;
......@@ -85,6 +85,7 @@ struct LoadLoggingCategory {
loggingTypes.insert(static_cast<LoadLoggingCategory::LogType>(i), UnknownStatus);
}
}
typedef QVector<LoadLoggingCategory> List;
bool isValid() const
......@@ -95,9 +96,10 @@ struct LoadLoggingCategory {
bool operator ==(const LoadLoggingCategory &other) const
{
//qDebug() << " logname " << logName << " other.logName :" << other.logName;
return (logName == other.logName) &&
(loggingTypes == other.loggingTypes);
return (logName == other.logName)
&& (loggingTypes == other.loggingTypes);
}
QString logName;
QMap<LoadLoggingCategory::LogType, LoadLoggingCategory::Status> loggingTypes;
};
......
......@@ -22,18 +22,17 @@
KdeLoggingCategory::KdeLoggingCategory()
{
}
bool KdeLoggingCategory::operator ==(const KdeLoggingCategory &other) const
{
return (description == other.description) &&
(logName == other.logName) && (defaultCategory == other.defaultCategory);
return (description == other.description)
&& (logName == other.logName) && (defaultCategory == other.defaultCategory);
}
bool KdeLoggingCategory::operator !=(const KdeLoggingCategory &other) const
{
return ! operator==(other);
return !operator==(other);
}
bool KdeLoggingCategory::isValid() const
......
......@@ -23,7 +23,6 @@
LoadCategoriesJob::LoadCategoriesJob()
{
}
void LoadCategoriesJob::setFileName(const QString &filename)
......@@ -56,38 +55,38 @@ LoggingCategory::LoggingType canDisplayType(const QMap<KDebugSettingsUtil::LoadL
return LoggingCategory::All;
} else if (all == KDebugSettingsUtil::LoadLoggingCategory::Disabled) {
return LoggingCategory::Off;
} else if (warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
debug == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
info == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
} else if (warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& debug == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& info == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
return LoggingCategory::All;
} else if (debug == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
} else if (debug == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
return LoggingCategory::Debug;
} else if (info == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
} else if (info == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
return LoggingCategory::Info;
} else if (warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
} else if (warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
return LoggingCategory::Warning;
} else if (critical == KDebugSettingsUtil::LoadLoggingCategory::Enabled) {
return LoggingCategory::Critical;
} else if (info == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
warning == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus &&
debug == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus &&
critical == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus) {
} else if (info == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& warning == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus
&& debug == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus
&& critical == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus) {
return LoggingCategory::Undefined;
} else if (warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
info == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus &&
debug == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus &&
critical == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus) {
} else if (warning == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& info == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus
&& debug == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus
&& critical == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus) {
return LoggingCategory::Undefined;
} else if (debug == KDebugSettingsUtil::LoadLoggingCategory::Enabled &&
info == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus &&
warning == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus &&
critical == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus) {
} else if (debug == KDebugSettingsUtil::LoadLoggingCategory::Enabled
&& info == KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus