qtmobility/src/publishsubscribe/gconflayer_linux_p.h
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    43 #define GCONFLAYER_H
    43 #define GCONFLAYER_H
    44 
    44 
    45 #include "qvaluespace_p.h"
    45 #include "qvaluespace_p.h"
    46 #include "qvaluespacepublisher.h"
    46 #include "qvaluespacepublisher.h"
    47 
    47 
    48 #include <QHash>
       
    49 #include <QSet>
    48 #include <QSet>
    50 #include <QByteArray>
    49 #include "gconfitem_p.h"
    51 #include <QMultiMap>
    50 #include <QMutex>
    52 
    51 
    53 QTM_BEGIN_NAMESPACE
    52 QTM_BEGIN_NAMESPACE
    54 
    53 
    55 class GConfLayer : public QAbstractValueSpaceLayer
    54 class GConfLayer : public QAbstractValueSpaceLayer
    56 {
    55 {
    93     /*virtual*/ void sync();
    92     /*virtual*/ void sync();
    94 
    93 
    95 public:
    94 public:
    96     static GConfLayer *instance();
    95     static GConfLayer *instance();
    97 
    96 
       
    97 private slots:
       
    98     void notifyChanged(const QString &key, const QVariant &value);
       
    99 
    98 private:
   100 private:
    99     struct GConfHandle {
   101     struct GConfHandle {
   100         GConfHandle(const QString &p)
   102         GConfHandle(const QString &p)
   101         :   path(p), refCount(1)
   103         :   path(p), refCount(1)
   102         {
   104         {
   118             return h;
   120             return h;
   119 
   121 
   120         return 0;
   122         return 0;
   121     }
   123     }
   122 
   124 
       
   125     //private methods not locking a mutex
       
   126     bool getValue(Handle handle, const QString &subPath, QVariant *data);
       
   127     Handle getItem(Handle parent, const QString &subPath);
       
   128     void doRemoveHandle(Handle handle);
       
   129 
   123 private:    //data
   130 private:    //data
   124     QHash<QByteArray, GConfHandle *> m_monitoringHandles;
   131     QSet<GConfHandle *> m_monitoringHandles;
   125     QSet<QString> m_monitoringPaths;
   132     QMap<QString, GConfItem *> m_monitoringItems;
       
   133     QMutex m_mutex;
   126 };
   134 };
   127 
   135 
   128 QTM_END_NAMESPACE
   136 QTM_END_NAMESPACE
   129 
   137 
   130 #endif //GCONFLAYER_H
   138 #endif //GCONFLAYER_H