00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _Q_PROFILE_VALUE_H_
00020 #define _Q_PROFILE_VALUE_H_
00021
00022 #include <QPointer>
00023 #include <QFileSystemWatcher>
00024 #include <QString>
00025 #include <meegocontrolexport.h>
00026 #include "qtrackedvariant.h"
00027
00033 class MC_EXPORT QProfileValue : public QTrackedVariant
00034 {
00035 Q_OBJECT
00036
00037 public:
00038 QProfileValue (const QString &key, bool setAllProfiles = false);
00039 ~QProfileValue ();
00040
00044 enum RangeType
00045 {
00046 Interval,
00047 List,
00048 Invalid
00049 };
00050
00051 QList<QVariant> possibleValues (RangeType *p_rangeType = NULL);
00052
00053 protected:
00054 virtual void fetchFromBackend ();
00055 virtual void realSetValue (const QVariant &newValue);
00056 virtual bool stopWatchFiles ();
00057 virtual bool startWatchFile (const QString &filename);
00058
00059 private slots:
00060 void fileChanged (const QString &filename);
00061
00062 private:
00063 static int nTrackedValues;
00064 static void notifyValue (
00065 const char *profile,
00066 const char *key,
00067 const char *val,
00068 const char *type,
00069 QProfileValue *self);
00070 void addNotify ();
00071 void delNotify ();
00072 QStringList getType (QString &theKey, QString &theProfile);
00073
00074 private:
00075 bool m_setAllProfiles;
00076 QPointer<QFileSystemWatcher> m_FileWatcher;
00077 bool m_MissingFile;
00078
00079 #ifdef UNIT_TEST
00080 friend class Ut_ProfileValueTests;
00081 #endif
00082 };
00083
00084 #endif