17 |
17 |
18 #ifndef HSWIDGETCOMPONENTREGISTRY_H |
18 #ifndef HSWIDGETCOMPONENTREGISTRY_H |
19 #define HSWIDGETCOMPONENTREGISTRY_H |
19 #define HSWIDGETCOMPONENTREGISTRY_H |
20 |
20 |
21 #include <QObject> |
21 #include <QObject> |
|
22 #include <QVariant> |
|
23 #include <qservicemanager.h> |
|
24 |
|
25 |
22 |
26 |
23 #include "hsdomainmodeldatastructures.h" |
27 #include "hsdomainmodeldatastructures.h" |
24 #include "hsdomainmodel_global.h" |
28 #include "hsdomainmodel_global.h" |
|
29 #include "cadefs.h" |
25 |
30 |
26 #include "hstest_global.h" |
31 #include "hstest_global.h" |
27 HOMESCREEN_TEST_CLASS(TestRuntimeServices) |
32 HOMESCREEN_TEST_CLASS(TestRuntimeServices) |
28 |
33 |
29 class HsWidgetComponent; |
34 class HsWidgetComponent; |
30 class QSignalMapper; |
35 class CaEntry; |
|
36 class HsWidgetComponentDescriptor; |
|
37 |
|
38 QTM_USE_NAMESPACE |
31 |
39 |
32 class HSDOMAINMODEL_EXPORT HsWidgetComponentRegistry : public QObject |
40 class HSDOMAINMODEL_EXPORT HsWidgetComponentRegistry : public QObject |
33 { |
41 { |
34 Q_OBJECT |
42 Q_OBJECT |
35 |
43 |
36 public: |
44 public: |
37 static HsWidgetComponentRegistry *instance(); |
45 static HsWidgetComponentRegistry *instance(); |
38 ~HsWidgetComponentRegistry(); |
46 ~HsWidgetComponentRegistry(); |
39 |
47 |
40 HsWidgetComponent *component(const QString &uri); |
48 HsWidgetComponent *component(const QString &uri); |
41 |
49 |
|
50 void uninstallComponent(const HsWidgetComponentDescriptor &componentDescriptor); |
|
51 |
42 private: |
52 private: |
43 Q_DISABLE_COPY(HsWidgetComponentRegistry) |
53 Q_DISABLE_COPY(HsWidgetComponentRegistry) |
44 HsWidgetComponentRegistry(QObject *parent = 0); |
54 HsWidgetComponentRegistry(QObject *parent = 0); |
45 |
55 |
|
56 void handleEntryAdded(const CaEntry &entry, const QString &uri); |
|
57 void handleEntryRemoved(const CaEntry &entry, const QString &uri); |
|
58 void handleEntryUpdated(const CaEntry &entry, const QString &uri); |
|
59 void registerService(const CaEntry &entry, const QString& uri, bool reset = false ); |
|
60 |
|
61 |
46 private slots: |
62 private slots: |
47 void onAboutToUninstall(const QString &uri); |
63 void onEntryChanged(const CaEntry &entry, ChangeType changeType); |
48 |
64 |
49 private: |
65 private: |
50 QHash<QString, HsWidgetComponent *> mRegistry; |
66 QHash<QString, HsWidgetComponent *> mRegistry; |
51 static QScopedPointer<HsWidgetComponentRegistry> mInstance; |
67 QServiceManager mServiceManager; |
52 QScopedPointer<QSignalMapper> mSignalMapper; |
68 static HsWidgetComponentRegistry *mInstance; |
|
69 |
53 HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices) |
70 HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices) |
54 }; |
71 }; |
55 |
72 |
56 #endif // HSWIDGETCOMPONENTREGISTRY_H |
73 #endif // HSWIDGETCOMPONENTREGISTRY_H |