2 * Copyright (C) 2011 Canonical, Ltd.
5 * Florian Boucault <florian.boucault@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/>.
29#include <UnityCore/Scope.h>
30#include <UnityCore/Results.h>
31#include <UnityCore/GLibWrapper.h>
33#include "categories.h"
38class Scope : public QObject
42 Q_PROPERTY(QString id READ id NOTIFY idChanged)
43 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
44 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
45 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
46 Q_PROPERTY(QString searchHint READ searchHint NOTIFY searchHintChanged)
47 Q_PROPERTY(bool searchInProgress READ searchInProgress NOTIFY searchInProgressChanged)
48 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
49 Q_PROPERTY(QString shortcut READ shortcut NOTIFY shortcutChanged)
50 Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
51 Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged)
52 Q_PROPERTY(Filters* filters READ filters NOTIFY filtersChanged)
54 Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
55 Q_PROPERTY(QString noResultsHint READ noResultsHint WRITE setNoResultsHint NOTIFY noResultsHintChanged)
56 Q_PROPERTY(QString formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged)
59 explicit Scope(QObject *parent = 0);
64 QString iconHint() const;
65 QString description() const;
66 QString searchHint() const;
68 QString shortcut() const;
69 bool connected() const;
70 bool searchInProgress() const;
71 Categories* categories() const;
72 Filters* filters() const;
73 QString searchQuery() const;
74 QString noResultsHint() const;
75 QString formFactor() const;
78 void setSearchQuery(const QString& search_query);
79 void setNoResultsHint(const QString& hint);
80 void setFormFactor(const QString& form_factor);
82 Q_INVOKABLE void activate(const QVariant &uri, const QVariant &icon_hint, const QVariant &category,
83 const QVariant &result_type, const QVariant &mimetype, const QVariant &title,
84 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata);
85 Q_INVOKABLE void preview(const QVariant &uri, const QVariant &icon_hint, const QVariant &category,
86 const QVariant &result_type, const QVariant &mimetype, const QVariant &title,
87 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata);
88 Q_INVOKABLE void cancelActivation();
90 void setUnityScope(const unity::dash::Scope::Ptr& scope);
91 unity::dash::Scope::Ptr unityScope() const;
94 void idChanged(const std::string&);
95 void dbusNameChanged(const std::string&);
96 void dbusPathChanged(const std::string&);
97 void nameChanged(const std::string&);
98 void iconHintChanged(const std::string&);
99 void descriptionChanged(const std::string&);
100 void searchHintChanged(const std::string&);
101 void searchInProgressChanged();
102 void visibleChanged(bool);
103 void shortcutChanged(const std::string&);
104 void connectedChanged(bool);
105 void categoriesChanged();
106 void searchQueryChanged();
107 void noResultsHintChanged();
108 void formFactorChanged();
109 void filtersChanged();
111 // signals triggered by activate(..) or preview(..) requests.
112 void previewReady(Preview *preview);
115 void gotoUri(const QString &uri);
117 void activateApplication(const QString &desktop);
120 void synchronizeStates();
121 void onSearchFinished(std::string const &, unity::glib::HintsMap const &, unity::glib::Error const&);
124 unity::dash::LocalResult createLocalResult(const QVariant &uri, const QVariant &icon_hint,
125 const QVariant &category, const QVariant &result_type,
126 const QVariant &mimetype, const QVariant &title,
127 const QVariant &comment, const QVariant &dnd_uri,
128 const QVariant &metadata);
129 void onActivated(unity::dash::LocalResult const& result, unity::dash::ScopeHandledType type, unity::glib::HintsMap const& hints);
130 void onPreviewReady(unity::dash::LocalResult const& result, unity::dash::Preview::Ptr const& preview);
131 void fallbackActivate(const QString& uri);
133 unity::dash::Scope::Ptr m_unityScope;
134 std::unique_ptr<Categories> m_categories;
135 std::unique_ptr<Filters> m_filters;
136 QString m_searchQuery;
137 QString m_noResultsHint;
138 QString m_formFactor;
139 bool m_searchInProgress;
140 unity::glib::Cancellable m_cancellable;
141 unity::glib::Cancellable m_previewCancellable;
144Q_DECLARE_METATYPE(Scope*)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list