swift
contextapplicationproxy.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_CORE_CONTEXT_CONTEXTAPPLICATION_PROXY_H
7 #define SWIFT_CORE_CONTEXT_CONTEXTAPPLICATION_PROXY_H
8 
9 #include <QObject>
10 #include <QSet>
11 #include <QString>
12 #include <QStringList>
13 #include <QTimer>
14 
16 #include "core/corefacadeconfig.h"
17 #include "core/swiftcoreexport.h"
18 #include "misc/statusmessage.h"
19 #include "misc/valuecache.h"
20 
21 // clazy:excludeall=const-signal-or-slot
22 
23 class QDBusConnection;
24 
25 namespace swift::misc
26 {
27  class CGenericDBusInterface;
28 }
29 
30 namespace swift::core
31 {
32  class CCoreFacade;
33  namespace context
34  {
38  {
39  Q_OBJECT
40  friend class IContextApplication;
41 
42  public:
44  ~CContextApplicationProxy() override = default;
45 
46  public slots:
48  void changeSettings(const swift::misc::CValueCachePacket &settings,
49  const swift::misc::CIdentifier &origin) override;
50 
52  swift::misc::CValueCachePacket getAllSettings() const override;
53 
55  QStringList getUnsavedSettingsKeys() const override;
56 
58  swift::core::context::CSettingsDictionary getUnsavedSettingsKeysDescribed() const override;
59 
61  void synchronizeLocalSettings() override;
62 
64  swift::misc::CStatusMessage saveSettings(const QString &keyPrefix = {}) override;
65 
67  swift::misc::CStatusMessage saveSettingsByKey(const QStringList &keys) override;
68 
70  swift::misc::CStatusMessage loadSettings() override;
71 
73  void registerHotkeyActions(const QStringList &actions, const swift::misc::CIdentifier &origin) override;
74 
76  void callHotkeyActionRemotely(const QString &action, bool argument,
77  const swift::misc::CIdentifier &origin) override;
78 
80  swift::misc::CIdentifier registerApplication(const swift::misc::CIdentifier &application) override;
81 
83  void unregisterApplication(const swift::misc::CIdentifier &application) override;
84 
86  swift::misc::CIdentifierList getRegisteredApplications() const override;
87 
89  swift::misc::CIdentifier getApplicationIdentifier() const override;
90 
94  static bool isContextResponsive(const QString &dbusAddress, QString &msg, int timeoutMs = 1500);
95 
96  protected:
99  : IContextApplication(mode, runtime)
100  {}
101 
103  CContextApplicationProxy(const QString &serviceName, QDBusConnection &connection,
105 
106  private:
107  swift::misc::CGenericDBusInterface *m_dBusInterface = nullptr;
108  QSet<swift::misc::CIdentifier> m_proxyPingIdentifiers;
109  QTimer m_pingTimer;
110 
112  void relaySignals(const QString &serviceName, QDBusConnection &connection);
113 
115  void reRegisterApplications();
116 
117  void processRemoteHotkeyActionCall(const QString &action, bool argument,
118  const swift::misc::CIdentifier &origin);
119  };
120  } // namespace context
121 } // namespace swift::core
122 
123 #endif // SWIFT_CORE_CONTEXT_CONTEXTAPPLICATION_PROXY_H
ContextMode
How to handle a given context.
The class providing facades (the contexts) for all DBus relevant operations.
Definition: corefacade.h:57
CContextApplicationProxy(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime)
Constructor.
Used for hand written interface based on virtual methods.
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition: identifier.h:29
Value object encapsulating a list of object identifiers.
Streamable status message, e.g.
Value class used for signalling changed values in the cache.
Definition: valuecache.h:67
Backend services of the swift project, like dealing with the network or the simulators.
Definition: actionbind.cpp:7
Free functions in swift::misc.
#define SWIFT_CORE_EXPORT
Export a class or function from the library.