aboutsummaryrefslogtreecommitdiff
path: root/src/kconfig_compiler/kconfig_compiler.cpp
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2015-03-09 21:55:24 +0100
committerMontel Laurent <montel@kde.org>2015-03-17 07:30:46 +0100
commit094c91f86baf1e82e55b435c07c5ba37ff107dd9 (patch)
treea69172e9f391f2af5114f17b1d091201b3488457 /src/kconfig_compiler/kconfig_compiler.cpp
parent270b5ef5abd5b0db5670ffb4473a161e0553e396 (diff)
downloadkconfig-094c91f86baf1e82e55b435c07c5ba37ff107dd9.tar.gz
kconfig-094c91f86baf1e82e55b435c07c5ba37ff107dd9.tar.bz2
Allow to generate qloggingcategories support.
Add new variable to specify it in *.kcfgc : "CategoryLoggingName" CHANGELOG: Allow to generate file with qloggingcategories support. REVIEW: 122931
Diffstat (limited to 'src/kconfig_compiler/kconfig_compiler.cpp')
-rw-r--r--src/kconfig_compiler/kconfig_compiler.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp
index 28b151c5..7be74226 100644
--- a/src/kconfig_compiler/kconfig_compiler.cpp
+++ b/src/kconfig_compiler/kconfig_compiler.cpp
@@ -96,7 +96,6 @@ public:
allDefaultGetters = (defaultGetters.count() == 1) && (defaultGetters.at(0).toLower() == "true");
globalEnums = codegenConfig.value("GlobalEnums", false).toBool();
useEnumTypes = codegenConfig.value("UseEnumTypes", false).toBool();
-
const QString trString = codegenConfig.value("TranslationSystem").toString().toLower();
if (trString == "kde") {
translationSystem = KdeTranslation;
@@ -106,6 +105,7 @@ public:
}
translationSystem = QtTranslation;
}
+ qCategoryLoggingName = codegenConfig.value("CategoryLoggingName", QString()).toString();
}
public:
@@ -128,6 +128,7 @@ public:
QStringList sourceIncludes;
QStringList mutators;
QStringList defaultGetters;
+ QString qCategoryLoggingName;
bool allMutators;
bool setUserTexts;
bool allDefaultGetters;
@@ -1364,6 +1365,16 @@ QString memberAccessorBody(CfgEntry *e, bool globalEnums, const CfgConfig &cfg)
// returns the member mutator implementation
// which should go in the h file if inline
// or the cpp file if not inline
+
+void addDebugMethod(QTextStream &out, const CfgConfig &cfg, const QString &n)
+{
+ if (cfg.qCategoryLoggingName.isEmpty()) {
+ out << " qDebug() << \"" << setFunction(n);
+ } else {
+ out << " qCDebug(" << cfg.qCategoryLoggingName << ") << \"" << setFunction(n);
+ }
+}
+
QString memberMutatorBody(CfgEntry *e, const CfgConfig &cfg)
{
QString result;
@@ -1375,7 +1386,7 @@ QString memberMutatorBody(CfgEntry *e, const CfgConfig &cfg)
if (e->minValue() != "0" || !isUnsigned(t)) { // skip writing "if uint<0" (#187579)
out << "if (v < " << e->minValue() << ")" << endl;
out << "{" << endl;
- out << " qDebug() << \"" << setFunction(n);
+ addDebugMethod(out, cfg, n);
out << ": value \" << v << \" is less than the minimum value of ";
out << e->minValue() << "\";" << endl;
out << " v = " << e->minValue() << ";" << endl;
@@ -1386,7 +1397,7 @@ QString memberMutatorBody(CfgEntry *e, const CfgConfig &cfg)
if (!e->maxValue().isEmpty()) {
out << endl << "if (v > " << e->maxValue() << ")" << endl;
out << "{" << endl;
- out << " qDebug() << \"" << setFunction(n);
+ addDebugMethod(out, cfg, n);
out << ": value \" << v << \" is greater than the maximum value of ";
out << e->maxValue() << "\";" << endl;
out << " v = " << e->maxValue() << ";" << endl;