~unity-team/unity8/manual-qmltypes

« back to all changes in this revision

Viewing changes to tests/mocks/Unity/fake_scope.cpp

  • Committer: Michał Sawicz
  • Date: 2014-07-10 10:58:15 UTC
  • mfrom: (984.1.52 unity8)
  • Revision ID: michal.sawicz@canonical.com-20140710105815-bum6bjq3pur8s820
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
 */
16
16
 
 
17
#include <QUrl>
 
18
 
17
19
#include "fake_scope.h"
18
20
#include "fake_department.h"
19
21
#include "fake_resultsmodel.h"
35
37
{
36
38
}
37
39
 
38
 
QString Scope::id() const {
 
40
QString Scope::id() const
 
41
{
39
42
    return m_id;
40
43
}
41
44
 
42
 
QString Scope::name() const {
 
45
QString Scope::name() const
 
46
{
43
47
    return m_name;
44
48
}
45
49
 
46
 
QString Scope::searchQuery() const {
 
50
QString Scope::searchQuery() const
 
51
{
47
52
    return m_searchQuery;
48
53
}
49
54
 
50
 
QString Scope::iconHint() const {
 
55
QString Scope::iconHint() const
 
56
{
51
57
    return m_iconHint;
52
58
}
53
59
 
54
 
QString Scope::description() const {
 
60
QString Scope::description() const
 
61
{
55
62
    return m_description;
56
63
}
57
64
 
58
 
QString Scope::searchHint() const {
59
 
    return QString("");
60
 
}
61
 
 
62
 
QString Scope::shortcut() const {
63
 
    return QString("");
64
 
}
65
 
 
66
 
bool Scope::searchInProgress() const {
 
65
QString Scope::searchHint() const
 
66
{
 
67
    return QString("");
 
68
}
 
69
 
 
70
QString Scope::shortcut() const
 
71
{
 
72
    return QString("");
 
73
}
 
74
 
 
75
bool Scope::searchInProgress() const
 
76
{
67
77
    return m_searching;
68
78
}
69
79
 
70
 
unity::shell::scopes::CategoriesInterface* Scope::categories() const {
 
80
unity::shell::scopes::CategoriesInterface* Scope::categories() const
 
81
{
71
82
    return m_categories;
72
83
}
73
84
 
74
 
QString Scope::noResultsHint() const {
 
85
unity::shell::scopes::SettingsModelInterface* Scope::settings() const
 
86
{
 
87
    return nullptr;
 
88
}
 
89
 
 
90
QString Scope::noResultsHint() const
 
91
{
75
92
    return m_noResultsHint;
76
93
}
77
94
 
78
 
QString Scope::formFactor() const {
 
95
QString Scope::formFactor() const
 
96
{
79
97
    return m_formFactor;
80
98
}
81
99
 
82
 
bool Scope::visible() const {
 
100
bool Scope::visible() const
 
101
{
83
102
    return m_visible;
84
103
}
85
104
 
86
 
bool Scope::isActive() const {
 
105
bool Scope::isActive() const
 
106
{
87
107
    return m_isActive;
88
108
}
89
109
 
90
 
void Scope::setSearchQuery(const QString &str) {
 
110
void Scope::setSearchQuery(const QString &str)
 
111
{
91
112
    if (str != m_searchQuery) {
92
113
        m_searchQuery = str;
93
114
        Q_EMIT searchQueryChanged();
94
115
    }
95
116
}
96
117
 
97
 
void Scope::setFormFactor(const QString &str) {
 
118
void Scope::setFormFactor(const QString &str)
 
119
{
98
120
    if (str != m_formFactor) {
99
121
        m_formFactor = str;
100
122
        Q_EMIT formFactorChanged();
101
123
    }
102
124
}
103
125
 
104
 
void Scope::setActive(const bool active) {
 
126
void Scope::setActive(const bool active)
 
127
{
105
128
    if (active != m_isActive) {
106
129
        m_isActive = active;
107
130
        Q_EMIT isActiveChanged();
108
131
    }
109
132
}
110
133
 
111
 
void Scope::setSearchInProgress(const bool inProg) {
 
134
void Scope::setSearchInProgress(const bool inProg)
 
135
{
112
136
    if (inProg != m_searching) {
113
137
        m_searching = inProg;
114
138
        Q_EMIT searchInProgressChanged();
115
139
    }
116
140
}
117
141
 
118
 
void Scope::setNoResultsHint(const QString& str) {
 
142
void Scope::setNoResultsHint(const QString& str)
 
143
{
119
144
    if (str != m_noResultsHint) {
120
145
        m_noResultsHint = str;
121
146
        Q_EMIT noResultsHintChanged();
157
182
 
158
183
QVariantMap Scope::customizations() const
159
184
{
160
 
    return QVariantMap();
 
185
    QVariantMap m;
 
186
    if (m_id == "clickscope") {
 
187
        m["background-color"] = "red";
 
188
        m["foreground-color"] = "blue";
 
189
    } else if (m_id == "MockScope5") {
 
190
        QVariantMap pageHeader;
 
191
        pageHeader["logo"] = QUrl("../../../tests/qmltests/Components/tst_PageHeader/logo-ubuntu-orange.svg");
 
192
        m["page-header"] = pageHeader;
 
193
    }
 
194
    return m;
161
195
}
162
196
 
163
197
unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
182
216
    m_currentDeparment = id;
183
217
    Q_EMIT currentDepartmentIdChanged();
184
218
}
 
219
 
 
220
void Scope::performQuery(const QString& query)
 
221
{
 
222
    Q_UNUSED(query);
 
223
}