summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-18 13:59:21 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-18 13:59:21 (GMT)
commit021fb855d978dd2f8459acaef2665bcda6cc5a4f (patch)
tree5eba6ff3eb7ae3f40f6ba8d2333abb3e0b77b89a
parent2eee4f8f385901d47fccd0b1287f8af9964a8038 (diff)
Remove duplicate check
-rw-r--r--src/loadcategoriesjob.cpp133
1 files changed, 64 insertions, 69 deletions
diff --git a/src/loadcategoriesjob.cpp b/src/loadcategoriesjob.cpp
index c49c328..58edf1d 100644
--- a/src/loadcategoriesjob.cpp
+++ b/src/loadcategoriesjob.cpp
@@ -103,84 +103,79 @@ void LoadCategoriesJob::start()
mCustomCategories.clear();
mQtKdeCategories.clear();
mFoundOverrideRule = false;
+ const int number(mCategories.count());
+ QList<KDebugSettingsUtil::LoadLoggingCategory> qtCategories = KDebugSettingsUtil::readLoggingQtCategories(mFileName);
+ for (int i = 0; i < number; ++i) {
+ KdeLoggingCategory kdeCat = mCategories.at(i);
+ bool foundInConfigFile = false;
+ Q_FOREACH (const KDebugSettingsUtil::LoadLoggingCategory &cat, qtCategories) {
+ if (cat.logName == kdeCat.logName) {
- const QString envPath = mFileName;
-
- if (!envPath.isEmpty()) {
- const int number(mCategories.count());
- QList<KDebugSettingsUtil::LoadLoggingCategory> qtCategories = KDebugSettingsUtil::readLoggingQtCategories(envPath);
- for (int i = 0; i < number; ++i) {
- KdeLoggingCategory kdeCat = mCategories.at(i);
- bool foundInConfigFile = false;
- Q_FOREACH (const KDebugSettingsUtil::LoadLoggingCategory &cat, qtCategories) {
- if (cat.logName == kdeCat.logName) {
-
- LoggingCategory tmp;
- LoggingCategory::LoggingType newType = canDisplayType(cat.loggingTypes);
- if (newType != LoggingCategory::Undefined) {
- tmp.loggingType = canDisplayType(cat.loggingTypes);
- if (tmp.loggingType == LoggingCategory::Off) {
- tmp.enabled = false;
- }
- tmp.description = kdeCat.description;
- tmp.logName = kdeCat.logName;
-
- mQtKdeCategories.append(tmp);
- foundInConfigFile = true;
- qtCategories.removeAll(cat);
- break;
+ LoggingCategory tmp;
+ LoggingCategory::LoggingType newType = canDisplayType(cat.loggingTypes);
+ if (newType != LoggingCategory::Undefined) {
+ tmp.loggingType = canDisplayType(cat.loggingTypes);
+ if (tmp.loggingType == LoggingCategory::Off) {
+ tmp.enabled = false;
}
- }
- if (cat.logName == QLatin1String("*")) {
- mFoundOverrideRule = true;
+ tmp.description = kdeCat.description;
+ tmp.logName = kdeCat.logName;
+
+ mQtKdeCategories.append(tmp);
+ foundInConfigFile = true;
+ qtCategories.removeAll(cat);
+ break;
}
}
- if (!foundInConfigFile) {
- LoggingCategory tmp;
- tmp.description = kdeCat.description;
- tmp.logName = kdeCat.logName;
- tmp.loggingType = LoggingCategory::Info;
- mQtKdeCategories.append(tmp);
+ if (cat.logName == QLatin1String("*")) {
+ mFoundOverrideRule = true;
}
}
+ if (!foundInConfigFile) {
+ LoggingCategory tmp;
+ tmp.description = kdeCat.description;
+ tmp.logName = kdeCat.logName;
+ tmp.loggingType = LoggingCategory::Info;
+ mQtKdeCategories.append(tmp);
+ }
+ }
- //qDebug()<<" KEEP "<< qtCategories.count();
- Q_FOREACH (const KDebugSettingsUtil::LoadLoggingCategory &cat, qtCategories) {
-
- QMapIterator<KDebugSettingsUtil::LoadLoggingCategory::LogType, KDebugSettingsUtil::LoadLoggingCategory::Status> i(cat.loggingTypes);
- while (i.hasNext()) {
- i.next();
- if (i.value() != KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus) {
- LoggingCategory tmp;
- tmp.logName = cat.logName;
- switch (i.key()) {
- case KDebugSettingsUtil::LoadLoggingCategory::Unknown:
- tmp.loggingType = LoggingCategory::Undefined;
- break;
- case KDebugSettingsUtil::LoadLoggingCategory::Off:
- tmp.loggingType = LoggingCategory::Off;
- tmp.enabled = false;
- break;
- case KDebugSettingsUtil::LoadLoggingCategory::Info:
- tmp.loggingType = LoggingCategory::Info;
- break;
- case KDebugSettingsUtil::LoadLoggingCategory::Warning:
- tmp.loggingType = LoggingCategory::Warning;
- break;
- case KDebugSettingsUtil::LoadLoggingCategory::Debug:
- tmp.loggingType = LoggingCategory::Debug;
- break;
- case KDebugSettingsUtil::LoadLoggingCategory::Critical:
- tmp.loggingType = LoggingCategory::Critical;
- break;
- case KDebugSettingsUtil::LoadLoggingCategory::All:
- tmp.loggingType = LoggingCategory::All;
- break;
- }
- tmp.enabled = (i.value() == KDebugSettingsUtil::LoadLoggingCategory::Enabled);
- mCustomCategories.append(tmp);
+ //qDebug()<<" KEEP "<< qtCategories.count();
+ Q_FOREACH (const KDebugSettingsUtil::LoadLoggingCategory &cat, qtCategories) {
+ QMapIterator<KDebugSettingsUtil::LoadLoggingCategory::LogType, KDebugSettingsUtil::LoadLoggingCategory::Status> i(cat.loggingTypes);
+ while (i.hasNext()) {
+ i.next();
+ if (i.value() != KDebugSettingsUtil::LoadLoggingCategory::UnknownStatus) {
+ LoggingCategory tmp;
+ tmp.logName = cat.logName;
+ switch (i.key()) {
+ case KDebugSettingsUtil::LoadLoggingCategory::Unknown:
+ tmp.loggingType = LoggingCategory::Undefined;
+ break;
+ case KDebugSettingsUtil::LoadLoggingCategory::Off:
+ tmp.loggingType = LoggingCategory::Off;
+ tmp.enabled = false;
+ break;
+ case KDebugSettingsUtil::LoadLoggingCategory::Info:
+ tmp.loggingType = LoggingCategory::Info;
+ break;
+ case KDebugSettingsUtil::LoadLoggingCategory::Warning:
+ tmp.loggingType = LoggingCategory::Warning;
+ break;
+ case KDebugSettingsUtil::LoadLoggingCategory::Debug:
+ tmp.loggingType = LoggingCategory::Debug;
+ break;
+ case KDebugSettingsUtil::LoadLoggingCategory::Critical:
+ tmp.loggingType = LoggingCategory::Critical;
+ break;
+ case KDebugSettingsUtil::LoadLoggingCategory::All:
+ tmp.loggingType = LoggingCategory::All;
+ break;
}
+ tmp.enabled = (i.value() == KDebugSettingsUtil::LoadLoggingCategory::Enabled);
+ mCustomCategories.append(tmp);
+
}
}
}