2
* Copyright (C) 2012 Canonical, Ltd.
5
* Gerry Boland <gerry.boland@canonical.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 3.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
#include <QAbstractListModel>
27
#include <UnityCore/Hud.h>
29
class Hud : public QAbstractListModel
33
Q_PROPERTY(QString target READ target NOTIFY targetChanged)
34
Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
35
Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
38
explicit Hud(QObject *parent = 0);
42
ResultIdRole = Qt::UserRole+1,
51
QString target() const;
52
QString searchQuery() const;
53
bool connected() const;
56
void setSearchQuery(const QString&);
58
QVariant data(int role) const;
59
QHash<int, QByteArray> roleNames() const;
61
/* Implementation of virtual methods from QAbstractListModel */
62
QVariant data(const QModelIndex& index, int role = Hud::ResultIdRole) const;
63
int rowCount(const QModelIndex& parent = QModelIndex()) const;
65
Q_INVOKABLE void executeResult(const int) const;
66
Q_INVOKABLE void executeResultBySearch(const QString&) const;
67
Q_INVOKABLE void endSearch();
70
void searchQueryChanged();
72
void connectedChanged();
75
void onTargetChanged(const std::string);
76
void onConnectedChanged(const bool);
77
void onResultsUpdated(const unity::hud::Hud::Queries);
81
QString m_searchQuery;
82
unity::hud::Hud* m_unityHud;
83
unity::hud::Hud::Queries m_unityHudResults; //doubly-ended queue of 'Query's.
86
Q_DECLARE_METATYPE(Hud*)