Changeset View
Changeset View
Standalone View
Standalone View
src/core/kcoreconfigskeleton.h
Show First 20 Lines • Show All 678 Lines • ▼ Show 20 Line(s) | 652 | public: | |||
---|---|---|---|---|---|
679 | void setMaxValue(qint64); | 679 | void setMaxValue(qint64); | ||
680 | 680 | | |||
681 | private: | 681 | private: | ||
682 | bool mHasMin : 1; | 682 | bool mHasMin : 1; | ||
683 | bool mHasMax : 1; | 683 | bool mHasMax : 1; | ||
684 | qint64 mMin; | 684 | qint64 mMin; | ||
685 | qint64 mMax; | 685 | qint64 mMax; | ||
686 | }; | 686 | }; | ||
687 | #ifndef KDE_NO_DEPRECATED | 687 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
688 | typedef KCONFIGCORE_DEPRECATED ItemLongLong ItemInt64; | 688 | typedef KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use ItemLongLong") ItemLongLong ItemInt64; | ||
689 | #endif | 689 | #endif | ||
690 | 690 | | |||
691 | /** | 691 | /** | ||
692 | * Class for handling enums. | 692 | * Class for handling enums. | ||
693 | */ | 693 | */ | ||
694 | class KCONFIGCORE_EXPORT ItemEnum: public ItemInt | 694 | class KCONFIGCORE_EXPORT ItemEnum: public ItemInt | ||
695 | { | 695 | { | ||
696 | public: | 696 | public: | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 772 | public: | |||
799 | void setMaxValue(quint64); | 799 | void setMaxValue(quint64); | ||
800 | 800 | | |||
801 | private: | 801 | private: | ||
802 | bool mHasMin : 1; | 802 | bool mHasMin : 1; | ||
803 | bool mHasMax : 1; | 803 | bool mHasMax : 1; | ||
804 | quint64 mMin; | 804 | quint64 mMin; | ||
805 | quint64 mMax; | 805 | quint64 mMax; | ||
806 | }; | 806 | }; | ||
807 | #ifndef KDE_NO_DEPRECATED | 807 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
808 | typedef KCONFIGCORE_DEPRECATED ItemULongLong ItemUInt64; | 808 | typedef KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use ItemULongLong") ItemULongLong ItemUInt64; | ||
809 | #endif | 809 | #endif | ||
810 | 810 | | |||
811 | /** | 811 | /** | ||
812 | * Class for handling a floating point preference item. | 812 | * Class for handling a floating point preference item. | ||
813 | */ | 813 | */ | ||
814 | class KCONFIGCORE_EXPORT ItemDouble: public KConfigSkeletonGenericItem < double > | 814 | class KCONFIGCORE_EXPORT ItemDouble: public KConfigSkeletonGenericItem < double > | ||
815 | { | 815 | { | ||
816 | public: | 816 | public: | ||
▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Line(s) | 1037 | public: | |||
1071 | * Read preferences from config file. All registered items are set to the | 1071 | * Read preferences from config file. All registered items are set to the | ||
1072 | * values read from disk. | 1072 | * values read from disk. | ||
1073 | * This method calls usrRead() after reading the settings of the | 1073 | * This method calls usrRead() after reading the settings of the | ||
1074 | * registered items from the KConfig. You can override usrRead() | 1074 | * registered items from the KConfig. You can override usrRead() | ||
1075 | * in derived classes if you have special requirements. | 1075 | * in derived classes if you have special requirements. | ||
1076 | */ | 1076 | */ | ||
1077 | void load(); | 1077 | void load(); | ||
1078 | 1078 | | |||
1079 | #ifndef KCONFIGCORE_NO_DEPRECATED | 1079 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
1080 | /** | 1080 | /** | ||
1081 | * @deprecated since 5.0, call load() instead (to reload from disk) or just read() | 1081 | * @deprecated since 5.0, call load() instead (to reload from disk) or just read() | ||
1082 | * if the underlying KConfig object is already up-to-date. | 1082 | * if the underlying KConfig object is already up-to-date. | ||
1083 | */ | 1083 | */ | ||
1084 | KCONFIGCORE_DEPRECATED void readConfig() | 1084 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::load() or KCoreConfigSkeleton::read()") | ||
1085 | void readConfig() | ||||
1085 | { | 1086 | { | ||
1086 | load(); | 1087 | load(); | ||
1087 | } | 1088 | } | ||
1088 | #endif | 1089 | #endif | ||
1089 | 1090 | | |||
1090 | /** | 1091 | /** | ||
1091 | * Read preferences from the KConfig object. | 1092 | * Read preferences from the KConfig object. | ||
1092 | * This method assumes that the KConfig object was previously loaded, | 1093 | * This method assumes that the KConfig object was previously loaded, | ||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Line(s) | |||||
1256 | * does not yet contain the key of this item. | 1257 | * does not yet contain the key of this item. | ||
1257 | * @param key Key used in config file. If key is null, name is used as key. | 1258 | * @param key Key used in config file. If key is null, name is used as key. | ||
1258 | * @return The created item | 1259 | * @return The created item | ||
1259 | */ | 1260 | */ | ||
1260 | ItemLongLong *addItemLongLong(const QString &name, qint64 &reference, | 1261 | ItemLongLong *addItemLongLong(const QString &name, qint64 &reference, | ||
1261 | qint64 defaultValue = 0, | 1262 | qint64 defaultValue = 0, | ||
1262 | const QString &key = QString()); | 1263 | const QString &key = QString()); | ||
1263 | 1264 | | |||
1265 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
1264 | /** | 1266 | /** | ||
1265 | * @deprecated | 1267 | * @deprecated Since 5.0, use addItemLongLong(). | ||
1266 | * Use addItemLongLong(). | | |||
1267 | */ | 1268 | */ | ||
1268 | #ifndef KDE_NO_DEPRECATED | 1269 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::addItemLongLong(...)") | ||
1269 | KCONFIGCORE_DEPRECATED ItemLongLong *addItemInt64(const QString &name, qint64 &reference, | 1270 | ItemLongLong *addItemInt64(const QString &name, qint64 &reference, | ||
1270 | qint64 defaultValue = 0, | 1271 | qint64 defaultValue = 0, | ||
1271 | const QString &key = QString()); | 1272 | const QString &key = QString()); | ||
1272 | #endif | 1273 | #endif | ||
1273 | 1274 | | |||
1274 | /** | 1275 | /** | ||
1275 | * Register an item of type quint64 | 1276 | * Register an item of type quint64 | ||
1276 | * | 1277 | * | ||
1277 | * @param name Name used to identify this setting. Names must be unique. | 1278 | * @param name Name used to identify this setting. Names must be unique. | ||
1278 | * @param reference Pointer to the variable, which is set by readConfig() | 1279 | * @param reference Pointer to the variable, which is set by readConfig() | ||
1279 | * calls and read by save() calls. | 1280 | * calls and read by save() calls. | ||
1280 | * @param defaultValue Default value, which is used when the config file | 1281 | * @param defaultValue Default value, which is used when the config file | ||
1281 | * does not yet contain the key of this item. | 1282 | * does not yet contain the key of this item. | ||
1282 | * @param key Key used in config file. If key is null, name is used as key. | 1283 | * @param key Key used in config file. If key is null, name is used as key. | ||
1283 | * @return The created item | 1284 | * @return The created item | ||
1284 | */ | 1285 | */ | ||
1285 | ItemULongLong *addItemULongLong(const QString &name, quint64 &reference, | 1286 | ItemULongLong *addItemULongLong(const QString &name, quint64 &reference, | ||
1286 | quint64 defaultValue = 0, | 1287 | quint64 defaultValue = 0, | ||
1287 | const QString &key = QString()); | 1288 | const QString &key = QString()); | ||
1288 | 1289 | | |||
1290 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
1289 | /** | 1291 | /** | ||
1290 | * @deprecated | 1292 | * @deprecated Since 5.0, use addItemULongLong(). | ||
1291 | * Use addItemULongLong(). | | |||
1292 | */ | 1293 | */ | ||
1293 | #ifndef KDE_NO_DEPRECATED | 1294 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::addItemULongLong(...)") | ||
1294 | KCONFIGCORE_DEPRECATED ItemULongLong *addItemUInt64(const QString &name, quint64 &reference, | 1295 | ItemULongLong *addItemUInt64(const QString &name, quint64 &reference, | ||
1295 | quint64 defaultValue = 0, | 1296 | quint64 defaultValue = 0, | ||
1296 | const QString &key = QString()); | 1297 | const QString &key = QString()); | ||
1297 | #endif | 1298 | #endif | ||
1298 | 1299 | | |||
1299 | /** | 1300 | /** | ||
1300 | * Register an item of type double. | 1301 | * Register an item of type double. | ||
1301 | * | 1302 | * | ||
1302 | * @param name Name used to identify this setting. Names must be unique. | 1303 | * @param name Name used to identify this setting. Names must be unique. | ||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Line(s) | 1469 | public Q_SLOTS: | |||
1470 | * Write preferences to config file. The values of all registered items are | 1471 | * Write preferences to config file. The values of all registered items are | ||
1471 | * written to disk. | 1472 | * written to disk. | ||
1472 | * This method calls usrSave() after writing the settings from the | 1473 | * This method calls usrSave() after writing the settings from the | ||
1473 | * registered items to the KConfig. You can override usrSave() | 1474 | * registered items to the KConfig. You can override usrSave() | ||
1474 | * in derived classes if you have special requirements. | 1475 | * in derived classes if you have special requirements. | ||
1475 | */ | 1476 | */ | ||
1476 | bool save(); | 1477 | bool save(); | ||
1477 | 1478 | | |||
1478 | #ifndef KCONFIGCORE_NO_DEPRECATED | 1479 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
1479 | /** | 1480 | /** | ||
1480 | * @deprecated since 5.0, call save() instead. | 1481 | * @deprecated since 5.0, call save() instead. | ||
1481 | */ | 1482 | */ | ||
1482 | KCONFIGCORE_DEPRECATED void writeConfig() | 1483 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::save()") | ||
1484 | void writeConfig() | ||||
1483 | { | 1485 | { | ||
1484 | save(); | 1486 | save(); | ||
1485 | } | 1487 | } | ||
1486 | #endif | 1488 | #endif | ||
1487 | 1489 | | |||
1488 | Q_SIGNALS: | 1490 | Q_SIGNALS: | ||
1489 | /** | 1491 | /** | ||
1490 | * This signal is emitted when the configuration change. | 1492 | * This signal is emitted when the configuration change. | ||
Show All 27 Lines | 1496 | protected: | |||
1518 | 1520 | | |||
1519 | /** | 1521 | /** | ||
1520 | * Perform the actual writing of the configuration file. | 1522 | * Perform the actual writing of the configuration file. | ||
1521 | * Override in derived classes to write special config values. | 1523 | * Override in derived classes to write special config values. | ||
1522 | * Called from @ref writeConfig() | 1524 | * Called from @ref writeConfig() | ||
1523 | */ | 1525 | */ | ||
1524 | virtual bool usrSave(); | 1526 | virtual bool usrSave(); | ||
1525 | 1527 | | |||
1528 | #if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) | ||||
1526 | /** | 1529 | /** | ||
1527 | * @deprecated since 5.0, override usrRead instead. This method is still called from usrRead | 1530 | * @deprecated since 5.0, override usrRead instead. This method is still called from usrRead | ||
1528 | * for compatibility. | 1531 | * for compatibility. | ||
1529 | */ | 1532 | */ | ||
1530 | KCONFIGCORE_DEPRECATED virtual void usrReadConfig(); | 1533 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Override KCoreConfigSkeleton::usrRead()") | ||
1534 | virtual void usrReadConfig(); | ||||
1535 | #endif | ||||
1531 | 1536 | | |||
1537 | #if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) | ||||
1532 | /** | 1538 | /** | ||
1533 | * @deprecated since 5.0, override usrSave instead. This method is still called from usrSave | 1539 | * @deprecated since 5.0, override usrSave instead. This method is still called from usrSave | ||
1534 | * for compatibility. | 1540 | * for compatibility. | ||
1535 | */ | 1541 | */ | ||
1536 | KCONFIGCORE_DEPRECATED virtual bool usrWriteConfig(); | 1542 | KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Override KCoreConfigSkeleton::usrSave()") | ||
1543 | virtual bool usrWriteConfig(); | ||||
1544 | #endif | ||||
1537 | 1545 | | |||
1538 | private: | 1546 | private: | ||
1539 | KCoreConfigSkeletonPrivate *const d; | 1547 | KCoreConfigSkeletonPrivate *const d; | ||
1540 | friend class KConfigSkeleton; | 1548 | friend class KConfigSkeleton; | ||
1541 | 1549 | | |||
1542 | }; | 1550 | }; | ||
1543 | 1551 | | |||
1544 | #endif | 1552 | #endif |