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


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