aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2019-09-17 00:04:26 +0200
committerAleix Pol <aleixpol@kde.org>2019-10-04 01:30:56 +0200
commita23acd2f1535a94ef3f7477040890b175c3651b6 (patch)
tree8e0d3cb0f071b5cd64cbdeaebdf8716bd690462b
parentb80648cf56c6ffd414f3222fffed234fad859ba6 (diff)
downloadkconfig-a23acd2f1535a94ef3f7477040890b175c3651b6.tar.gz
kconfig-a23acd2f1535a94ef3f7477040890b175c3651b6.tar.bz2
Fix generating properties that start with an uppercase letter
Summary: We were not adjusting the property name to the getter letter-casing. Test Plan: See added test, also fixes the issue that made me realize this issue. Reviewers: #frameworks, davidedmundson Reviewed By: davidedmundson Subscribers: ngraham, aacid, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D24010
-rw-r--r--autotests/kconfig_compiler/test13.cpp.ref3
-rw-r--r--autotests/kconfig_compiler/test13.h.ref11
-rw-r--r--autotests/kconfig_compiler/test13.kcfg1
-rw-r--r--src/kconfig_compiler/kconfig_compiler.cpp4
4 files changed, 17 insertions, 2 deletions
diff --git a/autotests/kconfig_compiler/test13.cpp.ref b/autotests/kconfig_compiler/test13.cpp.ref
index 3beea1d0..0f62dc96 100644
--- a/autotests/kconfig_compiler/test13.cpp.ref
+++ b/autotests/kconfig_compiler/test13.cpp.ref
@@ -16,6 +16,9 @@ Test13::Test13( )
KConfigCompilerSignallingItem *itemBrightness;
itemBrightness = new KConfigCompilerSignallingItem(new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "brightness" ), mBrightness ), this, notifyFunction, signalBrightnessChanged);
addItem( itemBrightness, QStringLiteral( "brightness" ) );
+ KConfigSkeleton::ItemBool *itemStartsWithUppercase;
+ itemStartsWithUppercase = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "StartsWithUppercase" ), mStartsWithUppercase );
+ addItem( itemStartsWithUppercase, QStringLiteral( "StartsWithUppercase" ) );
}
Test13::~Test13()
diff --git a/autotests/kconfig_compiler/test13.h.ref b/autotests/kconfig_compiler/test13.h.ref
index 441643f7..6c67fc5d 100644
--- a/autotests/kconfig_compiler/test13.h.ref
+++ b/autotests/kconfig_compiler/test13.h.ref
@@ -47,6 +47,16 @@ class Test13 : public KConfigSkeleton
}
+ Q_PROPERTY(bool startsWithUppercase READ startsWithUppercase CONSTANT)
+ /**
+ Get StartsWithUppercase
+ */
+ bool startsWithUppercase() const
+ {
+ return mStartsWithUppercase;
+ }
+
+
enum {
signalBrightnessChanged = 0x1
};
@@ -62,6 +72,7 @@ class Test13 : public KConfigSkeleton
// kamoso
QUrl mPicturesDir;
double mBrightness;
+ bool mStartsWithUppercase;
private:
};
diff --git a/autotests/kconfig_compiler/test13.kcfg b/autotests/kconfig_compiler/test13.kcfg
index c4d36350..cf78c70e 100644
--- a/autotests/kconfig_compiler/test13.kcfg
+++ b/autotests/kconfig_compiler/test13.kcfg
@@ -7,5 +7,6 @@
<group name="kamoso">
<entry name="picturesDir" type="Url" />
<entry name="brightness" type="double" />
+ <entry name="StartsWithUppercase" type="bool" />
</group>
</kcfg>
diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp
index 4c823f7c..c7f2d9d9 100644
--- a/src/kconfig_compiler/kconfig_compiler.cpp
+++ b/src/kconfig_compiler/kconfig_compiler.cpp
@@ -1956,8 +1956,8 @@ int main(int argc, char **argv)
}
if (cfg.generateProperties) {
- h << " Q_PROPERTY(" << returnType << ' ' << n;
- h << " READ " << n;
+ h << " Q_PROPERTY(" << returnType << ' ' << getFunction(n);
+ h << " READ " << getFunction(n);
if (cfg.allMutators || cfg.mutators.contains(n)) {
const QString signal = changeSignalName(n);
h << " WRITE " << setFunction(n);