Home · All Classes · All Namespaces · Modules · Functions · Files
readiness-helper.h
1 
23 #ifndef _TelepathyQt_readiness_helper_h_HEADER_GUARD_
24 #define _TelepathyQt_readiness_helper_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/Feature>
31 
32 #include <QMap>
33 #include <QSet>
34 #include <QSharedDataPointer>
35 #include <QStringList>
36 
37 class QDBusError;
38 
39 namespace Tp
40 {
41 
42 class DBusProxy;
43 class PendingOperation;
44 class PendingReady;
45 class RefCounted;
46 
47 class TP_QT_EXPORT ReadinessHelper : public QObject
48 {
49  Q_OBJECT
50  Q_DISABLE_COPY(ReadinessHelper)
51 
52 public:
53  typedef void (*IntrospectFunc)(void *data);
54 
55  struct Introspectable {
56  public:
58  Introspectable(const QSet<uint> &makesSenseForStatuses,
59  const Features &dependsOnFeatures,
60  const QStringList &dependsOnInterfaces,
61  IntrospectFunc introspectFunc,
62  void *introspectFuncData,
63  bool critical = false);
64  Introspectable(const Introspectable &other);
65  ~Introspectable();
66 
67  Introspectable &operator=(const Introspectable &other);
68 
69  private:
70  friend class ReadinessHelper;
71 
72  struct Private;
73  friend struct Private;
74  QSharedDataPointer<Private> mPriv;
75  };
76  typedef QMap<Feature, Introspectable> Introspectables;
77 
79  uint currentStatus = 0,
80  const Introspectables &introspectables = Introspectables(),
81  QObject *parent = 0);
83  uint currentStatus = 0,
84  const Introspectables &introspectables = Introspectables(),
85  QObject *parent = 0);
86  ~ReadinessHelper();
87 
88  void addIntrospectables(const Introspectables &introspectables);
89 
90  uint currentStatus() const;
91  void setCurrentStatus(uint currentStatus);
92  void forceCurrentStatus(uint currentStatus);
93 
94  QStringList interfaces() const;
95  void setInterfaces(const QStringList &interfaces);
96 
97  Features requestedFeatures() const;
98  Features actualFeatures() const;
99  Features missingFeatures() const;
100 
101  bool isReady(const Feature &feature,
102  QString *errorName = 0, QString *errorMessage = 0) const;
103  bool isReady(const Features &features,
104  QString *errorName = 0, QString *errorMessage = 0) const;
105  PendingReady *becomeReady(const Features &requestedFeatures);
106 
107  void setIntrospectCompleted(const Feature &feature, bool success,
108  const QString &errorName = QString(),
109  const QString &errorMessage = QString());
110  void setIntrospectCompleted(const Feature &feature, bool success,
111  const QDBusError &error);
112 
113 Q_SIGNALS:
114  void statusReady(uint status);
115 
116 private Q_SLOTS:
117  TP_QT_NO_EXPORT void iterateIntrospection();
118 
119  TP_QT_NO_EXPORT void onProxyInvalidated(Tp::DBusProxy *proxy,
120  const QString &errorName, const QString &errorMessage);
121 
122 private:
123  struct Private;
124  friend struct Private;
125  Private *mPriv;
126 };
127 
128 } // Tp
129 
130 #endif
The ReadinessHelper::Introspectable class represents a introspectable used by ReadinessHelper.
Definition: readiness-helper.h:55
The Features class represents a list of Feature.
Definition: feature.h:61
The RefCounted class is a base class for shared objects used by SharedPtr.
Definition: shared-ptr.h:42
The DBusProxy class is a base class representing a remote object available over D-Bus.
Definition: dbus-proxy.h:42
The PendingReady class represents the features requested and the reply to a request for an object to ...
Definition: pending-ready.h:40
QMap< Feature, Introspectable > Introspectables
Definition: readiness-helper.h:76
The Feature class represents a feature that can be enabled on demand.
Definition: feature.h:41
The ReadinessHelper class is a helper class used by the introspection process.
Definition: readiness-helper.h:47


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt 0.9.4