~ubuntu-branches/ubuntu/trusty/hud/trusty-updates

« back to all changes in this revision

Viewing changes to service/QueryImpl.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-01-20 19:43:59 UTC
  • mfrom: (1.1.26)
  • Revision ID: package-import@ubuntu.com-20140120194359-jxxxqtd4ql9elvpf
Tags: 13.10.1+14.04.20140120-0ubuntu1
* New rebuild forced
* Automatic snapshot from revision 362

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3, as published
 
6
 * by the Free Software Foundation.
 
7
 *
 
8
 * This program 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 General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Author: Pete Woods <pete.woods@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef HUD_SERVICE_QUERYIMPL_H_
 
20
#define HUD_SERVICE_QUERYIMPL_H_
 
21
 
 
22
#include <common/ResultsModel.h>
 
23
#include <common/AppstackModel.h>
 
24
#include <service/ApplicationList.h>
 
25
#include <service/Query.h>
 
26
#include <service/Voice.h>
 
27
 
 
28
#include <QDBusContext>
 
29
#include <QDBusConnection>
 
30
#include <QDBusServiceWatcher>
 
31
#include <QDBusVariant>
 
32
#include <QScopedPointer>
 
33
#include <QSharedPointer>
 
34
 
 
35
class QueryAdaptor;
 
36
 
 
37
namespace hud {
 
38
namespace service {
 
39
 
 
40
class HudService;
 
41
 
 
42
class Q_DECL_EXPORT QueryImpl: public Query, protected QDBusContext {
 
43
Q_OBJECT
 
44
public:
 
45
        QueryImpl(unsigned int id, const QString &query, const QString &sender,
 
46
                        HudService &service, ApplicationList::Ptr applicationList,
 
47
                        Voice::Ptr voice, const QDBusConnection &connection,
 
48
                        QObject *parent = 0);
 
49
 
 
50
        virtual ~QueryImpl();
 
51
 
 
52
        const QDBusObjectPath & path() const override;
 
53
 
 
54
        const QList<Result> & results() const override;
 
55
 
 
56
        QString appstackModel() const override;
 
57
 
 
58
        QString currentQuery() const override;
 
59
 
 
60
        QString resultsModel() const override;
 
61
 
 
62
        Q_PROPERTY(QStringList ToolbarItems READ toolbarItems)
 
63
        QStringList toolbarItems() const override;
 
64
 
 
65
public Q_SLOTS:
 
66
        void CloseQuery();
 
67
 
 
68
        void ExecuteCommand(const QDBusVariant &item, uint timestamp);
 
69
 
 
70
        QString ExecuteParameterized(const QDBusVariant &item, uint timestamp,
 
71
                        QString &prefix, QString &baseAction, QDBusObjectPath &actionPath,
 
72
                        QDBusObjectPath &modelPath, int &modelSection);
 
73
 
 
74
        void ExecuteToolbar(const QString &item, uint timestamp);
 
75
 
 
76
        int UpdateApp(const QString &app);
 
77
 
 
78
        int UpdateQuery(const QString &query);
 
79
 
 
80
        int VoiceQuery(QString &query);
 
81
 
 
82
protected Q_SLOTS:
 
83
        void serviceUnregistered(const QString &service);
 
84
 
 
85
        void refresh();
 
86
 
 
87
protected:
 
88
        void updateToken(Window::Ptr window);
 
89
 
 
90
        void notifyPropertyChanged(const QString& interface,
 
91
                        const QString& propertyName);
 
92
 
 
93
        QScopedPointer<QueryAdaptor> m_adaptor;
 
94
 
 
95
        QDBusConnection m_connection;
 
96
 
 
97
        QDBusObjectPath m_path;
 
98
 
 
99
        HudService &m_service;
 
100
 
 
101
        ApplicationList::Ptr m_applicationList;
 
102
 
 
103
        Voice::Ptr m_voice;
 
104
 
 
105
        QString m_query;
 
106
 
 
107
        QDBusServiceWatcher m_serviceWatcher;
 
108
 
 
109
        QSharedPointer<hud::common::ResultsModel> m_resultsModel;
 
110
 
 
111
        QSharedPointer<hud::common::AppstackModel> m_appstackModel;
 
112
 
 
113
        QList<Result> m_results;
 
114
 
 
115
        WindowToken::Ptr m_windowToken;
 
116
};
 
117
 
 
118
}
 
119
}
 
120
 
 
121
#endif /* HUD_SERVICE_QUERYIMPL_H_ */