Unity Action API
 All Classes Functions Enumerations Enumerator Properties Pages
unity-action-manager.h
1 /* This file is part of unity-action-api
2  * Copyright 2013 Canonical Ltd.
3  *
4  * unity-action-api is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * unity-action-api is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranties of
10  * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11  * PURPOSE. See the GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef UNITY_ACTION_MANAGER
18 #define UNITY_ACTION_MANAGER
19 
20 namespace unity {
21 namespace action {
22  class ActionManager;
23  class ActionContext;
24  class Action;
25 }
26 }
27 
28 #include <QObject>
29 #include <QScopedPointer>
30 
31 class Q_DECL_EXPORT unity::action::ActionManager : public QObject
32 {
33  Q_OBJECT
34  Q_DISABLE_COPY(ActionManager)
35 
36  Q_PROPERTY(unity::action::ActionContext *globalContext
37  READ globalContext)
38 
39 public:
40 
41  explicit ActionManager(QObject *parent = 0);
42  virtual ~ActionManager();
43 
44  Q_INVOKABLE void addAction(unity::action::Action *action);
45  Q_INVOKABLE void removeAction(unity::action::Action *action);
46 
47  Q_INVOKABLE unity::action::ActionContext *globalContext();
48 
49  Q_INVOKABLE void addLocalContext(unity::action::ActionContext *context);
50 
51  Q_INVOKABLE void removeLocalContext(unity::action::ActionContext *context);
52  QSet<ActionContext *> localContexts() const;
53 
54  QSet<Action *> actions() const;
55 
56 signals:
57  void localContextsChanged();
58  void actionsChanged();
59 
60  Q_REVISION(1) void quit();
61 
62 private:
63  class Private;
64  QScopedPointer<Private> d;
65 };
66 #endif
Definition: unity-action-context.h:31
Q_INVOKABLE void removeLocalContext(unity::action::ActionContext *context)
Definition: unity-action-manager.cpp:509
Q_INVOKABLE void addAction(unity::action::Action *action)
Definition: unity-action-manager.cpp:426
Definition: unity-action-manager.h:31
ActionManager(QObject *parent=0)
Definition: unity-action-manager.cpp:338
QSet< Action * > actions() const
Definition: unity-action-manager.cpp:543
The main action class.
Definition: unity-action.h:30
Q_INVOKABLE void addLocalContext(unity::action::ActionContext *context)
Definition: unity-action-manager.cpp:473
Q_INVOKABLE void removeAction(unity::action::Action *action)
Definition: unity-action-manager.cpp:444
QSet< ActionContext * > localContexts() const
Definition: unity-action-manager.cpp:531