Changeset View
Changeset View
Standalone View
Standalone View
src/core/kcoreconfigskeleton.h
Show First 20 Lines • Show All 656 Lines • ▼ Show 20 Line(s) | 630 | public: | |||
---|---|---|---|---|---|
657 | void setMaxValue(qint64); | 657 | void setMaxValue(qint64); | ||
658 | 658 | | |||
659 | private: | 659 | private: | ||
660 | bool mHasMin : 1; | 660 | bool mHasMin : 1; | ||
661 | bool mHasMax : 1; | 661 | bool mHasMax : 1; | ||
662 | qint64 mMin; | 662 | qint64 mMin; | ||
663 | qint64 mMax; | 663 | qint64 mMax; | ||
664 | }; | 664 | }; | ||
665 | #ifndef KDE_NO_DEPRECATED | 665 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
666 | typedef KCONFIGCORE_DEPRECATED ItemLongLong ItemInt64; | 666 | typedef KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use ItemLongLong") ItemLongLong ItemInt64; | ||
667 | #endif | 667 | #endif | ||
668 | 668 | | |||
669 | /** | 669 | /** | ||
670 | * Class for handling enums. | 670 | * Class for handling enums. | ||
671 | */ | 671 | */ | ||
672 | class KCONFIGCORE_EXPORT ItemEnum: public ItemInt | 672 | class KCONFIGCORE_EXPORT ItemEnum: public ItemInt | ||
673 | { | 673 | { | ||
674 | public: | 674 | public: | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 750 | public: | |||
777 | void setMaxValue(quint64); | 777 | void setMaxValue(quint64); | ||
778 | 778 | | |||
779 | private: | 779 | private: | ||
780 | bool mHasMin : 1; | 780 | bool mHasMin : 1; | ||
781 | bool mHasMax : 1; | 781 | bool mHasMax : 1; | ||
782 | quint64 mMin; | 782 | quint64 mMin; | ||
783 | quint64 mMax; | 783 | quint64 mMax; | ||
784 | }; | 784 | }; | ||
785 | #ifndef KDE_NO_DEPRECATED | 785 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
786 | typedef KCONFIGCORE_DEPRECATED ItemULongLong ItemUInt64; | 786 | typedef KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use ItemULongLong") ItemULongLong ItemUInt64; | ||
787 | #endif | 787 | #endif | ||
788 | 788 | | |||
789 | /** | 789 | /** | ||
790 | * Class for handling a floating point preference item. | 790 | * Class for handling a floating point preference item. | ||
791 | */ | 791 | */ | ||
792 | class KCONFIGCORE_EXPORT ItemDouble: public KConfigSkeletonGenericItem < double > | 792 | class KCONFIGCORE_EXPORT ItemDouble: public KConfigSkeletonGenericItem < double > | ||
793 | { | 793 | { | ||
794 | public: | 794 | public: | ||
▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Line(s) | 1015 | public: | |||
1049 | * Read preferences from config file. All registered items are set to the | 1049 | * Read preferences from config file. All registered items are set to the | ||
1050 | * values read from disk. | 1050 | * values read from disk. | ||
1051 | * This method calls usrRead() after reading the settings of the | 1051 | * This method calls usrRead() after reading the settings of the | ||
1052 | * registered items from the KConfig. You can override usrRead() | 1052 | * registered items from the KConfig. You can override usrRead() | ||
1053 | * in derived classes if you have special requirements. | 1053 | * in derived classes if you have special requirements. | ||
1054 | */ | 1054 | */ | ||
1055 | void load(); | 1055 | void load(); | ||
1056 | 1056 | | |||
1057 | #ifndef KCONFIGCORE_NO_DEPRECATED | 1057 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
1058 | /** | 1058 | /** | ||
1059 | * @deprecated since 5.0, call load() instead (to reload from disk) or just read() | 1059 | * @deprecated since 5.0, call load() instead (to reload from disk) or just read() | ||
1060 | * if the underlying KConfig object is already up-to-date. | 1060 | * if the underlying KConfig object is already up-to-date. | ||
1061 | */ | 1061 | */ | ||
1062 | KCONFIGCORE_DEPRECATED void readConfig() | 1062 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::load() or KCoreConfigSkeleton::read()") | ||
1063 | void readConfig() | ||||
1063 | { | 1064 | { | ||
1064 | load(); | 1065 | load(); | ||
1065 | } | 1066 | } | ||
1066 | #endif | 1067 | #endif | ||
1067 | 1068 | | |||
1068 | /** | 1069 | /** | ||
1069 | * Read preferences from the KConfig object. | 1070 | * Read preferences from the KConfig object. | ||
1070 | * This method assumes that the KConfig object was previously loaded, | 1071 | * This method assumes that the KConfig object was previously loaded, | ||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Line(s) | |||||
1219 | * does not yet contain the key of this item. | 1220 | * does not yet contain the key of this item. | ||
1220 | * @param key Key used in config file. If key is null, name is used as key. | 1221 | * @param key Key used in config file. If key is null, name is used as key. | ||
1221 | * @return The created item | 1222 | * @return The created item | ||
1222 | */ | 1223 | */ | ||
1223 | ItemLongLong *addItemLongLong(const QString &name, qint64 &reference, | 1224 | ItemLongLong *addItemLongLong(const QString &name, qint64 &reference, | ||
1224 | qint64 defaultValue = 0, | 1225 | qint64 defaultValue = 0, | ||
1225 | const QString &key = QString()); | 1226 | const QString &key = QString()); | ||
1226 | 1227 | | |||
1228 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
1227 | /** | 1229 | /** | ||
1228 | * @deprecated | 1230 | * @deprecated Since 5.0, use addItemLongLong(). | ||
1229 | * Use addItemLongLong(). | | |||
1230 | */ | 1231 | */ | ||
1231 | #ifndef KDE_NO_DEPRECATED | 1232 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::addItemLongLong(...)") | ||
1232 | KCONFIGCORE_DEPRECATED ItemLongLong *addItemInt64(const QString &name, qint64 &reference, | 1233 | ItemLongLong *addItemInt64(const QString &name, qint64 &reference, | ||
1233 | qint64 defaultValue = 0, | 1234 | qint64 defaultValue = 0, | ||
1234 | const QString &key = QString()); | 1235 | const QString &key = QString()); | ||
1235 | #endif | 1236 | #endif | ||
1236 | 1237 | | |||
1237 | /** | 1238 | /** | ||
1238 | * Register an item of type quint64 | 1239 | * Register an item of type quint64 | ||
1239 | * | 1240 | * | ||
1240 | * @param name Name used to identify this setting. Names must be unique. | 1241 | * @param name Name used to identify this setting. Names must be unique. | ||
1241 | * @param reference Pointer to the variable, which is set by readConfig() | 1242 | * @param reference Pointer to the variable, which is set by readConfig() | ||
1242 | * calls and read by save() calls. | 1243 | * calls and read by save() calls. | ||
1243 | * @param defaultValue Default value, which is used when the config file | 1244 | * @param defaultValue Default value, which is used when the config file | ||
1244 | * does not yet contain the key of this item. | 1245 | * does not yet contain the key of this item. | ||
1245 | * @param key Key used in config file. If key is null, name is used as key. | 1246 | * @param key Key used in config file. If key is null, name is used as key. | ||
1246 | * @return The created item | 1247 | * @return The created item | ||
1247 | */ | 1248 | */ | ||
1248 | ItemULongLong *addItemULongLong(const QString &name, quint64 &reference, | 1249 | ItemULongLong *addItemULongLong(const QString &name, quint64 &reference, | ||
1249 | quint64 defaultValue = 0, | 1250 | quint64 defaultValue = 0, | ||
1250 | const QString &key = QString()); | 1251 | const QString &key = QString()); | ||
1251 | 1252 | | |||
1253 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
1252 | /** | 1254 | /** | ||
1253 | * @deprecated | 1255 | * @deprecated Since 5.0, use addItemULongLong(). | ||
1254 | * Use addItemULongLong(). | | |||
1255 | */ | 1256 | */ | ||
1256 | #ifndef KDE_NO_DEPRECATED | 1257 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::addItemULongLong(...)") | ||
1257 | KCONFIGCORE_DEPRECATED ItemULongLong *addItemUInt64(const QString &name, quint64 &reference, | 1258 | ItemULongLong *addItemUInt64(const QString &name, quint64 &reference, | ||
1258 | quint64 defaultValue = 0, | 1259 | quint64 defaultValue = 0, | ||
1259 | const QString &key = QString()); | 1260 | const QString &key = QString()); | ||
1260 | #endif | 1261 | #endif | ||
1261 | 1262 | | |||
1262 | /** | 1263 | /** | ||
1263 | * Register an item of type double. | 1264 | * Register an item of type double. | ||
1264 | * | 1265 | * | ||
1265 | * @param name Name used to identify this setting. Names must be unique. | 1266 | * @param name Name used to identify this setting. Names must be unique. | ||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Line(s) | 1432 | public Q_SLOTS: | |||
1433 | * Write preferences to config file. The values of all registered items are | 1434 | * Write preferences to config file. The values of all registered items are | ||
1434 | * written to disk. | 1435 | * written to disk. | ||
1435 | * This method calls usrSave() after writing the settings from the | 1436 | * This method calls usrSave() after writing the settings from the | ||
1436 | * registered items to the KConfig. You can override usrSave() | 1437 | * registered items to the KConfig. You can override usrSave() | ||
1437 | * in derived classes if you have special requirements. | 1438 | * in derived classes if you have special requirements. | ||
1438 | */ | 1439 | */ | ||
1439 | bool save(); | 1440 | bool save(); | ||
1440 | 1441 | | |||
1441 | #ifndef KCONFIGCORE_NO_DEPRECATED | 1442 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
1442 | /** | 1443 | /** | ||
1443 | * @deprecated since 5.0, call save() instead. | 1444 | * @deprecated since 5.0, call save() instead. | ||
1444 | */ | 1445 | */ | ||
1445 | KCONFIGCORE_DEPRECATED void writeConfig() | 1446 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::save()") | ||
1447 | void writeConfig() | ||||
1446 | { | 1448 | { | ||
1447 | save(); | 1449 | save(); | ||
1448 | } | 1450 | } | ||
1449 | #endif | 1451 | #endif | ||
1450 | 1452 | | |||
1451 | Q_SIGNALS: | 1453 | Q_SIGNALS: | ||
1452 | /** | 1454 | /** | ||
1453 | * This signal is emitted when the configuration change. | 1455 | * This signal is emitted when the configuration change. | ||
Show All 27 Lines | 1459 | protected: | |||
1481 | 1483 | | |||
1482 | /** | 1484 | /** | ||
1483 | * Perform the actual writing of the configuration file. | 1485 | * Perform the actual writing of the configuration file. | ||
1484 | * Override in derived classes to write special config values. | 1486 | * Override in derived classes to write special config values. | ||
1485 | * Called from @ref writeConfig() | 1487 | * Called from @ref writeConfig() | ||
1486 | */ | 1488 | */ | ||
1487 | virtual bool usrSave(); | 1489 | virtual bool usrSave(); | ||
1488 | 1490 | | |||
1491 | #if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) | ||||
1489 | /** | 1492 | /** | ||
1490 | * @deprecated since 5.0, override usrRead instead. This method is still called from usrRead | 1493 | * @deprecated since 5.0, override usrRead instead. This method is still called from usrRead | ||
1491 | * for compatibility. | 1494 | * for compatibility. | ||
1492 | */ | 1495 | */ | ||
1493 | KCONFIGCORE_DEPRECATED virtual void usrReadConfig(); | 1496 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Override KCoreConfigSkeleton::usrRead()") | ||
1497 | virtual void usrReadConfig(); | ||||
1498 | #endif | ||||
1494 | 1499 | | |||
1500 | #if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) | ||||
1495 | /** | 1501 | /** | ||
1496 | * @deprecated since 5.0, override usrSave instead. This method is still called from usrSave | 1502 | * @deprecated since 5.0, override usrSave instead. This method is still called from usrSave | ||
1497 | * for compatibility. | 1503 | * for compatibility. | ||
1498 | */ | 1504 | */ | ||
1499 | KCONFIGCORE_DEPRECATED virtual bool usrWriteConfig(); | 1505 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Override KCoreConfigSkeleton::usrSave()") | ||
1506 | virtual bool usrWriteConfig(); | ||||
1507 | #endif | ||||
1500 | 1508 | | |||
1501 | private: | 1509 | private: | ||
1502 | KCoreConfigSkeletonPrivate *const d; | 1510 | KCoreConfigSkeletonPrivate *const d; | ||
1503 | friend class KConfigSkeleton; | 1511 | friend class KConfigSkeleton; | ||
1504 | 1512 | | |||
1505 | }; | 1513 | }; | ||
1506 | 1514 | | |||
1507 | #endif | 1515 | #endif |