From d46739294d04c72af1e434e414e1c012d7e78a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ven=20Car?= Date: Tue, 4 Feb 2020 16:03:52 +0100 Subject: Add an isImmutable to know if a property is immutable Summary: Add a utility function isImmutable 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 --- autotests/kconfig_compiler/test_dpointer.h.ref | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'autotests/kconfig_compiler/test_dpointer.h.ref') diff --git a/autotests/kconfig_compiler/test_dpointer.h.ref b/autotests/kconfig_compiler/test_dpointer.h.ref index 04938566..a0886a07 100644 --- a/autotests/kconfig_compiler/test_dpointer.h.ref +++ b/autotests/kconfig_compiler/test_dpointer.h.ref @@ -33,6 +33,12 @@ class TestDPointer : public KConfigSkeleton static bool autoSave(); + /** + Is Enable automatic saving of calendar Immutable + */ + static + bool isAutoSaveImmutable(); + /** Get Item object corresponding to AutoSave() */ @@ -50,6 +56,12 @@ class TestDPointer : public KConfigSkeleton static int autoSaveInterval(); + /** + Is Auto Save Interval Immutable + */ + static + bool isAutoSaveIntervalImmutable(); + /** Get Item object corresponding to AutoSaveInterval() */ @@ -67,6 +79,12 @@ class TestDPointer : public KConfigSkeleton static bool confirm(); + /** + Is Confirm deletes Immutable + */ + static + bool isConfirmImmutable(); + /** Get Item object corresponding to Confirm() */ @@ -84,6 +102,12 @@ class TestDPointer : public KConfigSkeleton static QString archiveFile(); + /** + Is Archive File Immutable + */ + static + bool isArchiveFileImmutable(); + /** Get Item object corresponding to ArchiveFile() */ @@ -101,6 +125,12 @@ class TestDPointer : public KConfigSkeleton static int destination(); + /** + Is New Events/Todos Should Immutable + */ + static + bool isDestinationImmutable(); + /** Get Item object corresponding to Destination() */ @@ -118,6 +148,12 @@ class TestDPointer : public KConfigSkeleton static int hourSize(); + /** + Is Hour Size Immutable + */ + static + bool isHourSizeImmutable(); + /** Get Item object corresponding to HourSize() */ @@ -135,6 +171,12 @@ class TestDPointer : public KConfigSkeleton static bool selectionStartsEditor(); + /** + Is Time range selection in agenda view starts event editor Immutable + */ + static + bool isSelectionStartsEditorImmutable(); + /** Get Item object corresponding to SelectionStartsEditor() */ @@ -152,6 +194,12 @@ class TestDPointer : public KConfigSkeleton static QStringList selectedPlugins(); + /** + Is SelectedPlugins Immutable + */ + static + bool isSelectedPluginsImmutable(); + /** Get Item object corresponding to SelectedPlugins() */ @@ -169,6 +217,12 @@ class TestDPointer : public KConfigSkeleton static QColor highlightColor(); + /** + Is Highlight color Immutable + */ + static + bool isHighlightColorImmutable(); + /** Get Item object corresponding to HighlightColor() */ @@ -186,6 +240,12 @@ class TestDPointer : public KConfigSkeleton static QColor agendaBgColor(); + /** + Is Agenda view background color Immutable + */ + static + bool isAgendaBgColorImmutable(); + /** Get Item object corresponding to AgendaBgColor() */ @@ -203,6 +263,12 @@ class TestDPointer : public KConfigSkeleton static QFont timeBarFont(); + /** + Is Time bar Immutable + */ + static + bool isTimeBarFontImmutable(); + /** Get Item object corresponding to TimeBarFont() */ -- cgit v1.2.1