diff options
Diffstat (limited to 'src/kconfig_compiler/KConfigSourceGenerator.cpp')
-rw-r--r-- | src/kconfig_compiler/KConfigSourceGenerator.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/kconfig_compiler/KConfigSourceGenerator.cpp b/src/kconfig_compiler/KConfigSourceGenerator.cpp index 33e0ed69..3e8a8156 100644 --- a/src/kconfig_compiler/KConfigSourceGenerator.cpp +++ b/src/kconfig_compiler/KConfigSourceGenerator.cpp @@ -313,13 +313,14 @@ void KConfigSourceGenerator::createEnums(const CfgEntry *entry) void KConfigSourceGenerator::createNormalEntry(const CfgEntry *entry, const QString &key) { + const QString itemVarStr = itemPath(entry, cfg()); const QString innerItemVarStr = innerItemVar(entry, cfg()); if (!entry->signalList.isEmpty()) { stream() << " " << innerItemVarStr << " = " << newInnerItem(entry, key, entry->defaultValue, cfg()) << '\n'; } - stream() << " " << itemPath(entry, cfg()) << " = " + stream() << " " << itemVarStr << " = " << newItem(entry, key, entry->defaultValue, cfg()) << '\n'; if (!entry->min.isEmpty()) { @@ -335,10 +336,16 @@ void KConfigSourceGenerator::createNormalEntry(const CfgEntry *entry, const QStr } if (cfg().allNotifiers || cfg().notifiers.contains(entry->name)) { - stream() << " " << itemPath(entry, cfg()) << "->setWriteFlags(KConfigBase::Notify);\n"; + stream() << " " << itemVarStr << "->setWriteFlags(KConfigBase::Notify);\n"; } - stream() << " addItem( " << itemPath(entry, cfg()); + for (const CfgEntry::Choice &choice : qAsConst(entry->choices.choices)) { + if (!choice.val.isEmpty()) { + stream() << " " << itemVarStr << "->setValueForChoice(QStringLiteral( \"" << choice.name << "\" ), QStringLiteral( \"" << choice.val << "\" ));\n"; + } + } + + stream() << " addItem( " << itemVarStr; QString quotedName = entry->name; addQuotes(quotedName); if (quotedName != key) { @@ -374,6 +381,12 @@ void KConfigSourceGenerator::createIndexedEntry(const CfgEntry *entry, const QSt stream() << " " << innerItemVarStr << "->setMaxValue(" << entry->max << ");\n"; } + for (const CfgEntry::Choice &choice : qAsConst(entry->choices.choices)) { + if (!choice.val.isEmpty()) { + stream() << " " << itemVarStr << "->setValueForChoice(QStringLiteral( \"" << choice.name << "\" ), QStringLiteral( \"" << choice.val << "\" ));\n"; + } + } + if (cfg().setUserTexts) { stream() << userTextsFunctions(entry, cfg(), itemVarStr, entry->paramName); } |