aboutsummaryrefslogtreecommitdiff
path: root/src/kconfig_compiler/KConfigSourceGenerator.cpp
diff options
context:
space:
mode:
authorCyril Rossi <cyril.rossi@enioka.com>2020-02-03 13:50:17 +0100
committerCyril Rossi <cyril.rossi@enioka.com>2020-04-22 09:13:09 +0200
commit00213a3a0906f0e1b5fa97a9e8de235a1e3cdcbf (patch)
tree5638cbcaea1c46cf079f7232b1248c00b445d804 /src/kconfig_compiler/KConfigSourceGenerator.cpp
parentfb29718d3ac64bdc9e1f2a3d15a506f7798e4a76 (diff)
downloadkconfig-00213a3a0906f0e1b5fa97a9e8de235a1e3cdcbf.tar.gz
kconfig-00213a3a0906f0e1b5fa97a9e8de235a1e3cdcbf.tar.bz2
kconfig_compiler : generate kconfig settings with subgroup
Summary: Following D27059, add `parentGroupName` attribute to `group` element to generate kconfig settings with subgroups Reviewers: ervin, dfaure, #frameworks, meven Reviewed By: ervin, meven Subscribers: apol, meven, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27133
Diffstat (limited to 'src/kconfig_compiler/KConfigSourceGenerator.cpp')
-rw-r--r--src/kconfig_compiler/KConfigSourceGenerator.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/kconfig_compiler/KConfigSourceGenerator.cpp b/src/kconfig_compiler/KConfigSourceGenerator.cpp
index 0da8d4df..bb2694b2 100644
--- a/src/kconfig_compiler/KConfigSourceGenerator.cpp
+++ b/src/kconfig_compiler/KConfigSourceGenerator.cpp
@@ -333,6 +333,10 @@ void KConfigSourceGenerator::createNormalEntry(const CfgEntry *entry, const QStr
}
}
+ if (!entry->parentGroup.isEmpty()) {
+ stream() << " " << itemVarStr << "->setGroup(cg" << QString(entry->group).remove(QRegExp(QStringLiteral("\\W"))) << ");\n";
+ }
+
stream() << " addItem( " << itemVarStr;
QString quotedName = entry->name;
addQuotes(quotedName);
@@ -342,6 +346,11 @@ void KConfigSourceGenerator::createNormalEntry(const CfgEntry *entry, const QStr
stream() << " );\n";
}
+// TODO : Some compiler option won't work or generate bogus settings file.
+// * Does not manage properly Notifiers=true kcfgc option for parameterized entries :
+// ** KConfigCompilerSignallingItem generated with wrong userData parameter (4th one).
+// ** setWriteFlags() is missing.
+// * Q_PROPERTY signal won't work
void KConfigSourceGenerator::createIndexedEntry(const CfgEntry *entry, const QString &key)
{
for (int i = 0; i <= entry->paramMax; i++) {
@@ -410,8 +419,25 @@ void KConfigSourceGenerator::handleCurrentGroupChange(const CfgEntry *entry)
}
mCurrentGroup = entry->group;
- stream() << " setCurrentGroup( " << paramString(mCurrentGroup, parseResult.parameters) << " );";
- stream() << "\n\n";
+
+ if (!entry->parentGroup.isEmpty()) {
+ QString parentGroup = QString(entry->parentGroup).remove(QRegExp(QStringLiteral("\\W")));
+ if (!mConfigGroupList.contains(parentGroup)) {
+ stream() << " KConfigGroup cg" << parentGroup
+ << "(this->config(), " << paramString(entry->parentGroup, parseResult.parameters) << ");\n";
+ mConfigGroupList << parentGroup;
+ }
+ QString currentGroup = QString(mCurrentGroup).remove(QRegExp(QStringLiteral("\\W")));
+ if (!mConfigGroupList.contains(currentGroup)) {
+ stream() << " KConfigGroup cg" << currentGroup
+ << " = cg" << QString(entry->parentGroup).remove(QRegExp(QStringLiteral("\\W")))
+ << ".group(" << paramString(mCurrentGroup, parseResult.parameters) << ");\n";
+ mConfigGroupList << currentGroup;
+ }
+ } else {
+ stream() << " setCurrentGroup( " << paramString(mCurrentGroup, parseResult.parameters) << " );";
+ stream() << "\n\n";
+ }
}
void KConfigSourceGenerator::doConstructor()