Lomiri Action API
lomiri-action.h
1/* This file is part of lomiri-action-api
2 * Copyright 2013 Canonical Ltd.
3 *
4 * lomiri-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 * lomiri-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 LOMIRI_ACTION_ACTION
18#define LOMIRI_ACTION_ACTION
19
20namespace lomiri {
21namespace action {
22 class Action;
23}
24}
25
26#include <QObject>
27#include <QVariant>
28#include <QScopedPointer>
29
30class Q_DECL_EXPORT lomiri::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(lomiri::action::Action::Type parameterType
61 READ parameterType
62 WRITE setParameterType
63 NOTIFY parameterTypeChanged)
64
65public:
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
99public slots:
100 void trigger(QVariant value = QVariant());
101
102signals:
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(lomiri::action::Action::Type value);
110
111 void triggered(QVariant value);
112
113private:
114 class Private;
115 QScopedPointer<Private> d;
116};
117Q_DECLARE_METATYPE(lomiri::action::Action::Type)
118#endif
The main action class.
Definition: lomiri-action.h:31
Action(QObject *parent=0)
Definition: lomiri-action.cpp:262
QString text
Definition: lomiri-action.h:43
bool enabled
Definition: lomiri-action.h:59
QString iconName
Definition: lomiri-action.h:47
lomiri::action::Action::Type parameterType
Definition: lomiri-action.h:63
void trigger(QVariant value=QVariant())
Definition: lomiri-action.cpp:406
QString keywords
Definition: lomiri-action.h:55
Type
Available parameter types.
Definition: lomiri-action.h:67
@ String
Definition: lomiri-action.h:69
@ Bool
Definition: lomiri-action.h:71
@ None
Definition: lomiri-action.h:68
@ Integer
Definition: lomiri-action.h:70
QString name
Definition: lomiri-action.h:39
QString description
Definition: lomiri-action.h:51
void triggered(QVariant value)