hemeraplanet.h
1 #ifndef HEMERA_PLANET_H
2 #define HEMERA_PLANET_H
3 
4 #include <HemeraCore/AsyncInitDBusObject>
5 
6 namespace Hemera {
7 
8 class ServiceInfo;
9 
10 class PlanetPrivate;
59 {
60  Q_OBJECT
61  Q_DISABLE_COPY(Planet)
62  Q_DECLARE_PRIVATE_D(d_h_ptr, Planet)
63 
64  Q_PROPERTY(QStringList activeSatellites READ activeSatellites NOTIFY activeSatellitesChanged)
65  Q_PROPERTY(QStringList launchedSatellites READ launchedSatellites NOTIFY launchedSatellitesChanged)
66 
67 public:
72  enum class ActivationPolicy {
77  FullyExplicit = 0,
79  ActivateOnLaunch = 1 << 0,
84  KeepAtMostOneActive = 1 << 1,
85 
86 
87  // ALIASES
93  };
94  Q_DECLARE_FLAGS(ActivationPolicies, ActivationPolicy)
95 
96  explicit Planet(QObject* parent);
97  virtual ~Planet();
98 
99  QStringList launchedSatellites() const;
100  QStringList activeSatellites() const;
101 
102  ActivationPolicies activationPolicies() const;
103 
104 protected Q_SLOTS:
115  void setActivationPolicies(ActivationPolicies policies);
116 
117  Operation *launchSatellite(const QString &orbitName);
118  Operation *launchSatellite(const Hemera::ServiceInfo &service);
119  Operation *shutdownSatellite(const QString &satellite);
120  Operation *shutdownAllSatellites();
121 
122  Operation *activateSatellites(const QStringList &satellites);
123  Operation *deactivateSatellites(const QStringList &satellites);
124  Operation *deactivateAllSatellites();
125 
126  virtual Operation *handleActivationRequest(const QString &from, const QStringList &activation) = 0;
127  virtual Operation *handleOpenURLRequest(const QString &from, const QUrl &url, bool tryActivation) = 0;
128  virtual Operation *handleLaunchRequest(const QString &from, const QString &serviceId) = 0;
129  virtual Operation *handleShutdownRequest(const QString &from, const QString &serviceId) = 0;
130 
131 Q_SIGNALS:
132  void activeSatellitesChanged(const QStringList &activeSatellites);
133  void launchedSatellitesChanged(const QStringList &launchedSatellites);
134 
135 private:
136  friend class InternalPlanetInterface;
137 };
138 }
139 
140 Q_DECLARE_OPERATORS_FOR_FLAGS(Hemera::Planet::ActivationPolicies)
141 
142 #endif // HEMERA_PLANET_H
void setActivationPolicies(ActivationPolicies policies)
Definition: hemeraplanet.cpp:118
Definition: hemeraqmlappliance.cpp:3
A pending asynchronous operation.
Definition: hemeraoperation.h:33
Registers the current application as a Planet, allowing satellites management.
Definition: hemeraplanet.h:58
An asynchronous object performing a late initialization.
Definition: hemeraasyncinitobject.h:34
When a satellite gets launched, it also gets activated immediately.
ActivationPolicy
Definition: hemeraplanet.h:72