Unity 8
 All Classes Functions
hudclient.h
1 /*
2  * Copyright (C) 2012, 2013 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef HUDCLIENT_H
18 #define HUDCLIENT_H
19 
20 #include <QObject>
21 
22 #include <hud-client.h>
23 
24 class DeeListModel;
25 class QAbstractItemModel;
26 
27 class HudClient : public QObject
28 {
29  Q_OBJECT
30  Q_PROPERTY(DeeListModel* results READ results)
31  Q_PROPERTY(QAbstractItemModel* toolBarModel READ toolBarModel)
32 
33 public:
34  HudClient();
35  ~HudClient();
36 
37  DeeListModel *results() const;
38 
39  QAbstractItemModel *toolBarModel() const;
40 
41  Q_INVOKABLE void executeCommand(int index);
42  Q_INVOKABLE void setQuery(const QString &new_query);
43  Q_INVOKABLE void startVoiceQuery();
44  Q_INVOKABLE void executeParametrizedAction(const QVariant &values);
45  Q_INVOKABLE void updateParametrizedAction(const QVariant &values);
46  Q_INVOKABLE void cancelParametrizedAction();
47  Q_INVOKABLE void executeToolBarAction(HudClientQueryToolbarItems action);
48 
49  void modelReady(bool needDisconnect);
50  void modelReallyReady(bool needDisconnect);
51  void queryModelsChanged();
52 
53 Q_SIGNALS:
54  void voiceQueryLoading();
55  void voiceQueryListening();
56  void voiceQueryHeardSomething();
57  void voiceQueryFailed();
58  void voiceQueryFinished(const QString &query);
59  void commandExecuted();
60  void showParametrizedAction(const QString &action, const QVariant &items);
61 
62 private:
63  HudClientQuery *m_clientQuery;
64  DeeListModel *m_results;
65  QAbstractItemModel *m_toolBarModel;
66  int m_currentActionIndex;
67  HudClientParam *m_currentActionParam;
68 };
69 Q_DECLARE_METATYPE(HudClientQueryToolbarItems)
70 
71 #endif