Unity Action API
 All Classes Functions Enumerations Enumerator Properties Pages
unity-action.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_ACTION
18 #define UNITY_ACTION_ACTION
19 
20 namespace unity {
21 namespace action {
22  class Action;
23 }
24 }
25 
26 #include <QObject>
27 #include <QVariant>
28 #include <QScopedPointer>
29 
30 class Q_DECL_EXPORT unity::action::Action : public QObject
31 {
32  Q_OBJECT
33  Q_DISABLE_COPY(Action)
34  Q_ENUMS(Type)
35 
36  Q_PROPERTY(QString name
37  READ name
38  WRITE setName
39  NOTIFY nameChanged)
40  Q_PROPERTY(QString text
41  READ text
42  WRITE setText
43  NOTIFY textChanged)
44  Q_PROPERTY(QString iconName
45  READ iconName
46  WRITE setIconName
47  NOTIFY iconNameChanged)
48  Q_PROPERTY(QString description
49  READ description
50  WRITE setDescription
51  NOTIFY descriptionChanged)
52  Q_PROPERTY(QString keywords
53  READ keywords
54  WRITE setKeywords
55  NOTIFY keywordsChanged)
56  Q_PROPERTY(bool enabled
57  READ enabled
58  WRITE setEnabled
59  NOTIFY enabledChanged)
60  Q_PROPERTY(unity::action::Action::Type parameterType
61  READ parameterType
62  WRITE setParameterType
63  NOTIFY parameterTypeChanged)
64 
65 public:
66 
67  enum Type {
72  Real
73  };
74 
75  explicit Action(QObject *parent = 0);
76  virtual ~Action();
77 
78  QString name() const;
79  void setName(const QString &value);
80 
81  QString text() const;
82  void setText(const QString &value);
83 
84  QString iconName() const;
85  void setIconName(const QString &value);
86 
87  QString description() const;
88  void setDescription(const QString &value);
89 
90  QString keywords() const;
91  void setKeywords(const QString &value);
92 
93  bool enabled() const;
94  void setEnabled(bool value);
95 
96  Type parameterType() const;
97  void setParameterType(Type value);
98 
99 public slots:
100  void trigger(QVariant value = QVariant());
101 
102 signals:
103  void nameChanged(const QString &value);
104  void textChanged(const QString &value);
105  void iconNameChanged(const QString &value);
106  void descriptionChanged(const QString &value);
107  void keywordsChanged(const QString &value);
108  void enabledChanged(bool value);
109  void parameterTypeChanged(unity::action::Action::Type value);
110 
111  void triggered(QVariant value);
112 
113 private:
114  class Private;
115  QScopedPointer<Private> d;
116 };
117 Q_DECLARE_METATYPE(unity::action::Action::Type)
118 #endif
Definition: unity-action.h:68
void trigger(QVariant value=QVariant())
Definition: unity-action.cpp:406
Definition: unity-action.h:70
void triggered(QVariant value)
Definition: unity-action.h:69
Action(QObject *parent=0)
Definition: unity-action.cpp:262
Definition: unity-action.h:71
The main action class.
Definition: unity-action.h:30
Type
Available parameter types.
Definition: unity-action.h:67