aboutsummaryrefslogtreecommitdiff
path: root/src/kconfig_compiler
AgeCommit message (Collapse)Author
2022-02-18KConfigCompiler: support ItemAccessors=true with signalling itemsFriedrich W. H. Kossebau
2022-01-22Make singleton teardown work with Qt6 as wellVolker Krause
In Qt6 the Q_GLOBAL_STATIC will already report to be null while it is in the process of being deleted, we therefore cannot access it anymore from destruction code path as we did before. This problem is hit for example by the Breeze style, making all 6 based widgets applications crash on exit without this.
2022-01-04Add Samir variable fix tooLaurent Montel
2021-12-27kconfig_compiler/CMakeLists.txt - use CMAKE_CROSSCOMPILINGAllen Winter
use the CMake variable CMAKE_CROSSCOMPILING to detect when cross-compiling instead of CMAKE_TOOLCHAIN_FILE. CMAKE_TOOLCHAIN_FILE can be set when not cross-compiling
2021-12-16WIP: Change the build system to enable building with Qt 6Ahmad Samir
This was built with: -DQT_MAJOR_VERSION=6 \ -DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.90.0 \ -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055a00 Move the include(KDEInstallDirs) call before the first find_package(Qt*, the former is what auto-detects the Qt version, and defaults to 5. This is needed to be able to build against Qt5 by default. All unit tests still pass.
2021-11-26README.dox: GENERATE_MOC is required for signalsDawid Wróbel
2021-11-23Use innerVarStr instead of varStr for choicesTomaz Canabrava
2021-11-23Add missing changesTomaz Canabrava
2021-09-19Allow KConfigXT to use KSharedConfig::openStateConfigAlexander Lohnau
Otherwise we force consumers to use the config location for state data, which is what we are trying to avoid. Task: https://phabricator.kde.org/T12549
2021-08-29Make enum value visible to QML when using GlobalEnum modeCarl Schwan
Now generate Q_ENUM(<enum-name>)
2021-08-28GIT_SILENT: we can use std::as_const directlyLaurent Montel
2021-08-13clang-tidy: one declaration per line; braces around statementsAhmad Samir
clang-tidy checks: readability-isolate-declaration and readability-braces-around-statements KF task: https://phabricator.kde.org/T14729 GIT_SILENT
2021-07-13Fix typos found by codespellChristophe Giboudeaux
GIT_SILENT
2021-07-12Update kconfig_compiler documentation with translation optionsCyril Rossi
2021-05-27Use more target-centric cmake codeFriedrich W. H. Kossebau
NO_CHANGELOG
2021-04-05kconfig_compiler: add override to generated destructorsDavid Faure
This fixes the clang warning globalsettings_kmail.h:58:5: warning: '~GlobalSettingsBase' overrides a destructor but is not marked 'override' [-Wsuggest-destructor-override]
2021-03-22[kconfig_compiler] Explicitly open input file for readingNicolas Fella
In Qt6 QDomDocument does not open the file itself any more
2021-03-16Remove old contact data from src/kconfig_compiler_README.doxDavid Hurka
2021-03-06Improve code readability by using QLatin1String::arg()Ahmad Samir
NO_CHANGELOG
2021-03-06kconfig_compiler: change how paramString() creates stringsAhmad Samir
Now it creates C++ code that uses QString::arg(Args...) instead of arg().arg(). AFAICS, the type of the "Args" is QString, so this should work.
2021-03-06Minor code optimisationAhmad Samir
- Use more range-for loops where appropriate - Use auto instead of the usually-long iterator type names - Use cbegin/cend(), to match the std:: containers, less confusion - Use qDeleteAll instead of a for loop - Make a QRE with a long-ish pattern static NO_CHANGELOG
2021-03-06Optimise string operations a bitAhmad Samir
- Use QString::arg(Args...) instead of .arg().arg() - Use QLatin1String for string comparisons, should be faster - Use QLatin1String::arg() for better readability - Add the comment dfaure suggested in the MR, to explain why it's '2%' then '%1' in a QString().arg().arg() NO_CHANGELOG
2021-03-01Add missing QTextStream::setCodec ifdefNicolas Fella
This was missed in https://invent.kde.org/frameworks/kconfig/-/merge_requests/41
2021-02-22Fix formatting in a couple of places after running clang-formatAhmad Samir
NO_CHANGELOG
2021-02-22Run clang-format on all cpp/h filesAhmad Samir
NO_CHANGELOG
2021-02-22Add a trailing comma to last member in enumAhmad Samir
GIT_SILENT
2021-02-06Minor code optimisationsAhmad Samir
- Use a global var for a QString that's used many times - Break up long-all-cap variable names, it makes it harder to read (and I've fixed one typo in one of those ALLCAPS) - Fix some clazy warnings, make global QString objects in unit tests static (so that the compiler doesn't create symbols for them, it doesn't matter in a unit test but KF code acts as a reference sometimes that others copy from, tip from dfaure) - Add TODO note about changing kconfig_compiler to generate C++ code that uses multi-arg QString::arg(QString, QString, QString) instead of QString::arg().arg() - More const; more QString::at() instead of operator[] where appropriate - Use a ternary where it makes the code more readable (and uses less lines :)) NO_CHANGELOG
2021-02-06Compile without implicit cast from ASCIIAhmad Samir
NO_CHANGELOG
2021-02-06General code cleanupAhmad Samir
Fix some clazy warnings, and some other minor code optimisations. NO_CHANGELOG
2021-02-04Fix kconfig_compiler doxygen formattingDavid Hurka
* Doxygen sections instead of markdown list items and HTML headers * More descriptive section titles * HTML Definition list instead of a wide HTML table for compiler options * HTML Definition list instead of a markdown item list for data types * Syntax highlighting for examples
2021-01-14Qt::dec & Qt::hex are already in Qt 5.14Friedrich W. H. Kossebau
NO_CHANGELOG
2020-10-23If include is define in .h remove it if it's defined in .cpp too (scripted)Laurent Montel
2020-10-10Port QRegExp to QRegularExpressionAhmad Samir
2020-08-10Add documentation for ParentInConstructor optionCyril Rossi
2020-04-22kconfig_compiler : generate kconfig settings with subgroupCyril Rossi
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
2020-04-21Fix some compiler warningsAhmad Samir
Summary: - Fix order of member initialisation (compiling with -Wreorder) - Use Q_UNUSED where needed - QAtomicInteger::loadRelaxed() has been available since Qt 5.14 Test Plan: make && ctest Reviewers: #frameworks, dfaure, apol Reviewed By: dfaure Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27158
2020-03-22KConfig: Convert to SPDX license statementsAndreas Cord-Landwehr
Summary: Convert license headers to SPDX statements and add license files as required by REUSE specification. Reviewers: cgiboudeaux Reviewed By: cgiboudeaux Subscribers: ognarb, cgiboudeaux, kde-frameworks-devel Tags: #frameworks Maniphest Tasks: T11550 Differential Revision: https://phabricator.kde.org/D27601
2020-03-08KconfigXT: Add a value attribute to Enum field choicesMéven Car
Summary: Allow to write choices such as : ``` <choices> <choice name="enum_name" value="I can't containt (anything)"></choice> <choice name="normal_choice"></choice> </choices> ``` Test Plan: ctest Reviewers: ervin, bport, crossi, #frameworks Reviewed By: ervin Subscribers: ngraham, davidre, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27463
2020-02-28fix min/max entries with dpointerHenri Chain
Summary: D27497 was causing cases with dpointer + min/max to fail Specifically, this okular build: https://build.kde.org/job/Applications/job/okular/job/kf5-qt5 SUSEQt5.12/175/console Test Plan: Added min/max to dpointer autotest Reviewers: meven, ervin Subscribers: kde-frameworks-devel, aacid Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27717
2020-02-25Fix code generation for entries with min/maxHenri Chain
Summary: - When GenerateProperties and Mutators are activated, the generated code did not handle min/max properly - In the case of a parameterized entry, generated code also did not handle min/max BUG: 418146 Test Plan: - auto tests included Reviewers: meven, crossi, ervin, bport, tcanabrava Reviewed By: meven, ervin Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27497
2020-02-19Fix is<PropertyName>Immutable generated propertyMéven Car
Summary: Relates to D26368 Test Plan: ctest Reviewers: hchain, ervin, bport, crossi, #frameworks Reviewed By: hchain, crossi Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27496
2020-02-14Make it compile against last qt5.15 without deprecated method. endl is ↵Laurent Montel
namespaced
2020-02-04Add an is<PropertyName>Immutable to know if a property is immutableMéven Car
Summary: Add a utility function is<Parameter>Immutable to access immutability quickly. Generated classes uses them internally to avoid code redundance. Sample: ``` /** Set blocked-by-default */ void setBlockedByDefault( bool v ) { if (v != mBlockedByDefault && !isBlockedByDefaultImmutable() ) { mBlockedByDefault = v; Q_EMIT blockedByDefaultChanged(); } } /** Is blocked-by-default Immutable */ bool isBlockedByDefaultImmutable() { return isImmutable( QStringLiteral( "blockedByDefault" ) ); } ``` ``` /** Set org.kde.ActivityManager.ResourceScoringEnabled */ void setResourceScoringEnabled( bool v ) { if (!isResourceScoringEnabledImmutable() ) mResourceScoringEnabled = v; } /** Is org.kde.ActivityManager.ResourceScoringEnabled Immutable */ bool isResourceScoringEnabledImmutable() { return isImmutable( QStringLiteral( "resourceScoringEnabled" ) ); } ``` Reviewers: ervin, #frameworks, dfaure Reviewed By: ervin Subscribers: dfaure, tcanabrava, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D26368
2020-01-24Port endl to \n as it's qt namespaced.Laurent Montel
Port "dec"/"hex" as it's Qt namespaced too
2020-01-23Port endl to "\n" as it's qt namespaced. Use directlyLaurent Montel
std::cout/std::cerr Summary: Port endl to "\n" as it's qt namespaced Test Plan: autotest ok Reviewers: dfaure Reviewed By: dfaure Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D26860
2020-01-22Refactor KConfigXTTomaz Canabrava
Summary: The current KConfigXT compiler is in a sad state: It's a massive file with loads of global variables that handle state, the generator is done within the main() function and it seems to have grown organically. There are no classes to separate logic / state / generation, what exists is code that generates code from a xml / ini pair, but it's hard to even discover what a bit of code is doing. The code istyle is C++ / Java from the nineties, which is not bad per see but it also uses quite a few things that are going to be deprecated in Qt 6 so I'm also taking the time make the code more streamlined with newer code style (no iterators, lambdas, auto usage, etc). The code that generates the files simplly pushes strings to a text stream, and it's hard to figure out when something starts or something ends: for instance, the code that generates the Constructor has more than sixty lines of code englobing some nested if - for - if - for constructs. Currently the code is "done" - there's one bug that I still need to find & fix regarding Translations, but the rest seems sane. The current testcode generates incorrect *whitespaces* regarding the old code (there's some parts that I feel that it's important to fix before merging, but overall, the whitespace changes are not bad and easier to handle, old code had a hand-counted amount of spaces before each line, new code has a function whitespace() that adds the current-and-correct amount of whitespaces based on indentation level that you start by startScope() and ends with endScope(). rest of the code still needs to be ported to it. I plan to fix the testcases whitespace by manually adding them, I'v fougth with the code for a while and added a few hacks there but I don't want to make the code hackish again. New code is not perfect by any means, but is a good step in the right direction. This code tries to Separate the compiler code into many different files / classes to be more obvious what's happening, and each class also has many helper methods to minimize copypaste. - CodeGenerator: Has base code for the header and source files that can be shared - HeaderGenerator: Logic for generating the header file - SourceGenerator: Logic for generating the source file - KcfgParser: Logic for parsing the kcfg file and extracting the information from the Xml file - CommonStructs: a header that contains the structs that are currently used everywhere. - KConfigParameters: (was CfgConfig - ConfigConfig, wat) - Has information passed via the kcfgc file - kcfg_compiler - will be renamed to main - start the other classes and generates the files. This code here currently has the begining of this separation, with the CodeGenerator and the HeaderGenerator in a ~good~ state, but unfinished. Test Plan: - Run the test cases, - Compare the diffs generated by the testcases and fix in the code the errors / differences - Run and compare real kde source with the new and old generators to look for errors Reviewers: #frameworks, ervin, bport, dfaure Reviewed By: dfaure Subscribers: davidre, bcooksley, cgiboudeaux, kossebau, bport, ngraham, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D26202
2020-01-17Revert "WIP: Refactor KConfigXT"Tomaz Canabrava
This reverts commit 98c32e29f50465d4d4e16bafdf0491edbfb422b0. This broke kdevelop and kmymoney. I'm workin on the fixes and more unittests for them.
2020-01-16WIP: Refactor KConfigXTTomaz Canabrava
Summary: The current KConfigXT compiler is in a sad state: It's a massive file with loads of global variables that handle state, the generator is done within the main() function and it seems to have grown organically. There are no classes to separate logic / state / generation, what exists is code that generates code from a xml / ini pair, but it's hard to even discover what a bit of code is doing. The code istyle is C++ / Java from the nineties, which is not bad per see but it also uses quite a few things that are going to be deprecated in Qt 6 so I'm also taking the time make the code more streamlined with newer code style (no iterators, lambdas, auto usage, etc). The code that generates the files simplly pushes strings to a text stream, and it's hard to figure out when something starts or something ends: for instance, the code that generates the Constructor has more than sixty lines of code englobing some nested if - for - if - for constructs. Currently the code is "done" - there's one bug that I still need to find & fix regarding Translations, but the rest seems sane. The current testcode generates incorrect *whitespaces* regarding the old code (there's some parts that I feel that it's important to fix before merging, but overall, the whitespace changes are not bad and easier to handle, old code had a hand-counted amount of spaces before each line, new code has a function whitespace() that adds the current-and-correct amount of whitespaces based on indentation level that you start by startScope() and ends with endScope(). rest of the code still needs to be ported to it. I plan to fix the testcases whitespace by manually adding them, I'v fougth with the code for a while and added a few hacks there but I don't want to make the code hackish again. New code is not perfect by any means, but is a good step in the right direction. This code tries to Separate the compiler code into many different files / classes to be more obvious what's happening, and each class also has many helper methods to minimize copypaste. - CodeGenerator: Has base code for the header and source files that can be shared - HeaderGenerator: Logic for generating the header file - SourceGenerator: Logic for generating the source file - KcfgParser: Logic for parsing the kcfg file and extracting the information from the Xml file - CommonStructs: a header that contains the structs that are currently used everywhere. - KConfigParameters: (was CfgConfig - ConfigConfig, wat) - Has information passed via the kcfgc file - kcfg_compiler - will be renamed to main - start the other classes and generates the files. This code here currently has the begining of this separation, with the CodeGenerator and the HeaderGenerator in a ~good~ state, but unfinished. Test Plan: - Run the test cases, - Compare the diffs generated by the testcases and fix in the code the errors / differences - Run and compare real kde source with the new and old generators to look for errors Reviewers: #frameworks, ervin, bport, dfaure Reviewed By: dfaure Subscribers: bport, ngraham, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D26202
2020-01-05Port QRegExp to QRegularExpressionAhmad Samir
Summary: Port QRegExp::exactMatch() by using QRegularExpression::anchoredPattern() to match the entire subject string. Remove filenameOnly(), it's been broken for a long time (QStringLiteral("[/\\]") is not a valid QRegExp pattern); besides it's not needed as QFileInfo::fileName() is used to get the filename. Test Plan: make && ctest Reviewers: #frameworks, dfaure, ervin, apol Reviewed By: dfaure, ervin Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D26177
2020-01-05dec and hex as namespaced in qt5.15Laurent Montel