Mercurial > hg > forks > UniversalIndentGUI
comparison src/UiGuiSettings.h @ 751:ac165b6ae67e
Done some refactoring:
- Moved includes into the cpp files where possible and using class pre-declarations if possible
- Made class member variable names begin with an underscore
- Made by uic created header files be used as class members instead of inherting them
- Renamed some variables to reflect their purpose better
- Added some NULL initializations and added some comments
- Rearranged some include and declaration code parts to be consistent and better readable
- Updated for QScintilla 2.4.5
- Made UiGuiSettings be accessed via a shared pointer only
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1028 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Thu, 14 Oct 2010 19:52:47 +0000 |
parents | ca1bafc93ee2 |
children | f3631db17328 |
comparison
equal
deleted
inserted
replaced
750:a884b5861e93 | 751:ac165b6ae67e |
---|---|
18 ***************************************************************************/ | 18 ***************************************************************************/ |
19 | 19 |
20 #ifndef UIGUISETTINGS_H | 20 #ifndef UIGUISETTINGS_H |
21 #define UIGUISETTINGS_H | 21 #define UIGUISETTINGS_H |
22 | 22 |
23 //TODO: Move to cpp and add pre declarations. | |
24 #include <QObject> | 23 #include <QObject> |
25 #include <QString> | |
26 #include <QSettings> | |
27 #include <QPoint> | |
28 #include <QSize> | |
29 #include <QDir> | |
30 #include <QDate> | |
31 #include <QStringList> | 24 #include <QStringList> |
32 #include <QCoreApplication> | 25 #include <QMultiMap> |
26 #include <QSharedPointer> | |
27 | |
28 class QSettings; | |
29 | |
33 | 30 |
34 class UiGuiSettings : public QObject | 31 class UiGuiSettings : public QObject |
35 { | 32 { |
36 Q_OBJECT | 33 Q_OBJECT |
37 private: | 34 private: |
38 UiGuiSettings(); | 35 UiGuiSettings(); |
39 static UiGuiSettings* instance; | 36 static QWeakPointer<UiGuiSettings> _instance; |
40 | 37 |
41 public: | 38 public: |
42 static UiGuiSettings* getInstance(); | 39 static QSharedPointer<UiGuiSettings> getInstance(); |
43 static void deleteInstance(); | |
44 ~UiGuiSettings(); | 40 ~UiGuiSettings(); |
45 | 41 |
46 bool registerObjectProperty(QObject *obj, const QString &propertyName, const QString &settingName); | 42 bool registerObjectProperty(QObject *obj, const QString &propertyName, const QString &settingName); |
47 bool registerObjectPropertyRecursive(QObject *obj); | 43 bool registerObjectPropertyRecursive(QObject *obj); |
48 bool setObjectPropertyToSettingValue(QObject *obj, const QString &propertyName, const QString &settingName); | 44 bool setObjectPropertyToSettingValue(QObject *obj, const QString &propertyName, const QString &settingName); |
68 | 64 |
69 private: | 65 private: |
70 void readAvailableTranslations(); | 66 void readAvailableTranslations(); |
71 | 67 |
72 //! Stores the mnemonics of the available translations. | 68 //! Stores the mnemonics of the available translations. |
73 QStringList availableTranslations; | 69 QStringList _availableTranslations; |
74 | 70 |
75 //! The settings file. | 71 //! The settings file. |
76 QSettings *qsettings; | 72 QSettings *_qsettings; |
77 | 73 |
78 //! Maps an QObject to a string list containing the property name and the associated setting name. | 74 //! Maps an QObject to a string list containing the property name and the associated setting name. |
79 QMap<QObject*, QStringList> registeredObjectProperties; | 75 QMap<QObject*, QStringList> _registeredObjectProperties; |
80 | 76 |
81 //! Maps QObjects to a string list containing the method name and the associated setting name. | 77 //! Maps QObjects to a string list containing the method name and the associated setting name. |
82 QMultiMap<QObject*, QStringList> registeredObjectSlots; | 78 QMultiMap<QObject*, QStringList> _registeredObjectSlots; |
83 | 79 |
84 QString indenterDirctoryStr; | 80 QString _indenterDirctoryStr; |
85 }; | 81 }; |
86 | 82 |
87 #endif // UIGUISETTINGS_H | 83 #endif // UIGUISETTINGS_H |