Merge lp:~lukas-kde/unity8/appdrawer-search-more into lp:unity8
- appdrawer-search-more
- Merge into trunk
Status: | Needs review | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~lukas-kde/unity8/appdrawer-search-more | ||||
Merge into: | lp:unity8 | ||||
Prerequisite: | lp:~mzanetti/unity8/appdrawer-recent-apps | ||||
Diff against target: |
384 lines (+91/-25) 14 files modified
plugins/Greeter/Unity/Launcher/launcheritem.cpp (+13/-0) plugins/Greeter/Unity/Launcher/launcheritem.h (+3/-0) plugins/Unity/Launcher/appdrawermodel.cpp (+3/-0) plugins/Unity/Launcher/launcheritem.cpp (+13/-0) plugins/Unity/Launcher/launcheritem.h (+3/-0) plugins/Unity/Launcher/ualwrapper.cpp (+6/-4) plugins/Unity/Launcher/ualwrapper.h (+1/-0) plugins/Utils/appdrawerproxymodel.cpp (+24/-19) qml/Launcher/Drawer.qml (+1/-0) tests/mocks/Unity/Launcher/MockLauncherItem.cpp (+13/-0) tests/mocks/Unity/Launcher/MockLauncherItem.h (+3/-0) tests/plugins/Unity/Launcher/appdrawermodeltest.cpp (+6/-2) tests/plugins/Unity/Launcher/ualwrapper.cpp (+1/-0) tests/plugins/Unity/Launcher/ualwrapper.h (+1/-0) |
||||
To merge this branch: | bzr merge lp:~lukas-kde/unity8/appdrawer-search-more | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Needs Fixing | |
Albert Astals Cid (community) | Approve | ||
Review via email: mp+321998@code.launchpad.net |
This proposal supersedes a proposal from 2017-04-04.
Commit message
Appdrawer: search in more fields (appid and description), optimize and massively speed up
Description of the change
Prereq-archive: ppa:ci-
Appdrawer: search in more fields (appid and description), optimize and massively speed up
As I added more field to search in, it slowed down a bit. So I optimized the tiny bits throughout the AppDrawerProxyModel but the biggest bottleneck turned out to be the toplevel dynamicSortFilter in Drawer.qml
* Are there any related MPs required for this MP to build/function as expected? Please list.
Yes, https:/
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the UI, has there been a design review?
N/A
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
I guess the startsWith -> contains change is the most "controversial" change here.
Maybe contains should be only for description? What do others think?
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2918
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 2919. By Lukáš Tinkl
-
restore sortRole
Albert Astals Cid (aacid) wrote : | # |
> I guess the startsWith -> contains change is the most "controversial" change here.
>
> Maybe contains should be only for description? What do others think?
Given yesterday's news i guess it doesn't make sense to nitpick much over this.
Albert Astals Cid (aacid) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes
* Did CI run pass? If not, please explain why.
Waiting
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2918
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2919
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 2920. By Lukáš Tinkl
-
merge parent
- 2921. By Lukáš Tinkl
-
fix segfaulting test (add the missing description field)
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2921
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 2922. By Lukáš Tinkl
-
don't crash
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2922
https:/
Executed test runs:
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2922
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Lukáš Tinkl (lukas-kde) wrote : | # |
^^ now it fails to build on zesty because of ual not being up to date (wrt xenial)
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2922
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unmerged revisions
- 2922. By Lukáš Tinkl
-
don't crash
- 2921. By Lukáš Tinkl
-
fix segfaulting test (add the missing description field)
- 2920. By Lukáš Tinkl
-
merge parent
- 2919. By Lukáš Tinkl
-
restore sortRole
- 2918. By Lukáš Tinkl
- 2917. By Lukáš Tinkl
-
invalidate and sort only after the source model had been set
- 2916. By Lukáš Tinkl
-
massive speedup by not using dynamicFilter \o/
- 2915. By Lukáš Tinkl
-
optimize the filterString search
- 2914. By Lukáš Tinkl
-
perform the search in appName and Description too
Preview Diff
1 | === modified file 'plugins/Greeter/Unity/Launcher/launcheritem.cpp' | |||
2 | --- plugins/Greeter/Unity/Launcher/launcheritem.cpp 2017-04-06 13:50:59 +0000 | |||
3 | +++ plugins/Greeter/Unity/Launcher/launcheritem.cpp 2017-04-06 13:50:59 +0000 | |||
4 | @@ -89,6 +89,19 @@ | |||
5 | 89 | } | 89 | } |
6 | 90 | } | 90 | } |
7 | 91 | 91 | ||
8 | 92 | QString LauncherItem::description() const | ||
9 | 93 | { | ||
10 | 94 | return m_description; | ||
11 | 95 | } | ||
12 | 96 | |||
13 | 97 | void LauncherItem::setDescription(const QString &description) | ||
14 | 98 | { | ||
15 | 99 | if (m_description != description) { | ||
16 | 100 | m_description = description; | ||
17 | 101 | Q_EMIT descriptionChanged(m_description); | ||
18 | 102 | } | ||
19 | 103 | } | ||
20 | 104 | |||
21 | 92 | uint LauncherItem::popularity() const | 105 | uint LauncherItem::popularity() const |
22 | 93 | { | 106 | { |
23 | 94 | // Not exposing usage order in greeter session at this point. | 107 | // Not exposing usage order in greeter session at this point. |
24 | 95 | 108 | ||
25 | === modified file 'plugins/Greeter/Unity/Launcher/launcheritem.h' | |||
26 | --- plugins/Greeter/Unity/Launcher/launcheritem.h 2017-04-06 13:50:59 +0000 | |||
27 | +++ plugins/Greeter/Unity/Launcher/launcheritem.h 2017-04-06 13:50:59 +0000 | |||
28 | @@ -35,6 +35,7 @@ | |||
29 | 35 | QString name() const override; | 35 | QString name() const override; |
30 | 36 | QString icon() const override; | 36 | QString icon() const override; |
31 | 37 | QStringList keywords() const override; | 37 | QStringList keywords() const override; |
32 | 38 | QString description() const override; | ||
33 | 38 | uint popularity() const override; | 39 | uint popularity() const override; |
34 | 39 | bool pinned() const override; | 40 | bool pinned() const override; |
35 | 40 | bool running() const override; | 41 | bool running() const override; |
36 | @@ -52,6 +53,7 @@ | |||
37 | 52 | void setName(const QString &name); | 53 | void setName(const QString &name); |
38 | 53 | void setIcon(const QString &icon); | 54 | void setIcon(const QString &icon); |
39 | 54 | void setKeywords(const QStringList &keywords); | 55 | void setKeywords(const QStringList &keywords); |
40 | 56 | void setDescription(const QString &description); | ||
41 | 55 | void setPinned(bool pinned); | 57 | void setPinned(bool pinned); |
42 | 56 | void setRunning(bool running); | 58 | void setRunning(bool running); |
43 | 57 | void setRecent(bool recent); | 59 | void setRecent(bool recent); |
44 | @@ -67,6 +69,7 @@ | |||
45 | 67 | QString m_name; | 69 | QString m_name; |
46 | 68 | QString m_icon; | 70 | QString m_icon; |
47 | 69 | QStringList m_keywords; | 71 | QStringList m_keywords; |
48 | 72 | QString m_description; | ||
49 | 70 | bool m_pinned; | 73 | bool m_pinned; |
50 | 71 | bool m_running; | 74 | bool m_running; |
51 | 72 | bool m_recent; | 75 | bool m_recent; |
52 | 73 | 76 | ||
53 | === modified file 'plugins/Unity/Launcher/appdrawermodel.cpp' | |||
54 | --- plugins/Unity/Launcher/appdrawermodel.cpp 2017-04-06 13:50:59 +0000 | |||
55 | +++ plugins/Unity/Launcher/appdrawermodel.cpp 2017-04-06 13:50:59 +0000 | |||
56 | @@ -32,6 +32,7 @@ | |||
57 | 32 | } | 32 | } |
58 | 33 | LauncherItem* item = new LauncherItem(appId, info.name, info.icon, this); | 33 | LauncherItem* item = new LauncherItem(appId, info.name, info.icon, this); |
59 | 34 | item->setKeywords(info.keywords); | 34 | item->setKeywords(info.keywords); |
60 | 35 | item->setDescription(info.description); | ||
61 | 35 | item->setPopularity(info.popularity); | 36 | item->setPopularity(info.popularity); |
62 | 36 | m_list.append(item); | 37 | m_list.append(item); |
63 | 37 | } | 38 | } |
64 | @@ -59,6 +60,8 @@ | |||
65 | 59 | return m_list.at(index.row())->icon(); | 60 | return m_list.at(index.row())->icon(); |
66 | 60 | case RoleKeywords: | 61 | case RoleKeywords: |
67 | 61 | return m_list.at(index.row())->keywords(); | 62 | return m_list.at(index.row())->keywords(); |
68 | 63 | case RoleDescription: | ||
69 | 64 | return m_list.at(index.row())->description(); | ||
70 | 62 | case RoleUsage: | 65 | case RoleUsage: |
71 | 63 | return m_list.at(index.row())->popularity(); | 66 | return m_list.at(index.row())->popularity(); |
72 | 64 | } | 67 | } |
73 | 65 | 68 | ||
74 | === modified file 'plugins/Unity/Launcher/launcheritem.cpp' | |||
75 | --- plugins/Unity/Launcher/launcheritem.cpp 2017-04-06 13:50:59 +0000 | |||
76 | +++ plugins/Unity/Launcher/launcheritem.cpp 2017-04-06 13:50:59 +0000 | |||
77 | @@ -104,6 +104,19 @@ | |||
78 | 104 | } | 104 | } |
79 | 105 | } | 105 | } |
80 | 106 | 106 | ||
81 | 107 | QString LauncherItem::description() const | ||
82 | 108 | { | ||
83 | 109 | return m_description; | ||
84 | 110 | } | ||
85 | 111 | |||
86 | 112 | void LauncherItem::setDescription(const QString &description) | ||
87 | 113 | { | ||
88 | 114 | if (m_description != description) { | ||
89 | 115 | m_description = description; | ||
90 | 116 | Q_EMIT descriptionChanged(m_description); | ||
91 | 117 | } | ||
92 | 118 | } | ||
93 | 119 | |||
94 | 107 | bool LauncherItem::pinned() const | 120 | bool LauncherItem::pinned() const |
95 | 108 | { | 121 | { |
96 | 109 | return m_pinned; | 122 | return m_pinned; |
97 | 110 | 123 | ||
98 | === modified file 'plugins/Unity/Launcher/launcheritem.h' | |||
99 | --- plugins/Unity/Launcher/launcheritem.h 2017-04-06 13:50:59 +0000 | |||
100 | +++ plugins/Unity/Launcher/launcheritem.h 2017-04-06 13:50:59 +0000 | |||
101 | @@ -39,6 +39,7 @@ | |||
102 | 39 | QString name() const override; | 39 | QString name() const override; |
103 | 40 | QString icon() const override; | 40 | QString icon() const override; |
104 | 41 | QStringList keywords() const override; | 41 | QStringList keywords() const override; |
105 | 42 | QString description() const override; | ||
106 | 42 | uint popularity() const override; | 43 | uint popularity() const override; |
107 | 43 | bool pinned() const override; | 44 | bool pinned() const override; |
108 | 44 | bool running() const override; | 45 | bool running() const override; |
109 | @@ -56,6 +57,7 @@ | |||
110 | 56 | void setName(const QString &name); | 57 | void setName(const QString &name); |
111 | 57 | void setIcon(const QString &icon); | 58 | void setIcon(const QString &icon); |
112 | 58 | void setKeywords(const QStringList &keywords); | 59 | void setKeywords(const QStringList &keywords); |
113 | 60 | void setDescription(const QString &description); | ||
114 | 59 | void setPopularity(uint popularity); | 61 | void setPopularity(uint popularity); |
115 | 60 | void setPinned(bool pinned); | 62 | void setPinned(bool pinned); |
116 | 61 | void setRunning(bool running); | 63 | void setRunning(bool running); |
117 | @@ -72,6 +74,7 @@ | |||
118 | 72 | QString m_name; | 74 | QString m_name; |
119 | 73 | QString m_icon; | 75 | QString m_icon; |
120 | 74 | QStringList m_keywords; | 76 | QStringList m_keywords; |
121 | 77 | QString m_description; | ||
122 | 75 | uint m_popularity; | 78 | uint m_popularity; |
123 | 76 | bool m_pinned; | 79 | bool m_pinned; |
124 | 77 | bool m_running; | 80 | bool m_running; |
125 | 78 | 81 | ||
126 | === modified file 'plugins/Unity/Launcher/ualwrapper.cpp' | |||
127 | --- plugins/Unity/Launcher/ualwrapper.cpp 2017-04-06 13:50:59 +0000 | |||
128 | +++ plugins/Unity/Launcher/ualwrapper.cpp 2017-04-06 13:50:59 +0000 | |||
129 | @@ -66,14 +66,16 @@ | |||
130 | 66 | 66 | ||
131 | 67 | std::shared_ptr<Application> ualApp; | 67 | std::shared_ptr<Application> ualApp; |
132 | 68 | ualApp = Application::create(ualAppId, Registry::getDefault()); | 68 | ualApp = Application::create(ualAppId, Registry::getDefault()); |
133 | 69 | auto appInfo = ualApp->info(); | ||
134 | 69 | 70 | ||
135 | 70 | info.appId = appId; | 71 | info.appId = appId; |
139 | 71 | info.name = QString::fromStdString(ualApp->info()->name()); | 72 | info.name = QString::fromStdString(appInfo->name()); |
140 | 72 | info.icon = QString::fromStdString(ualApp->info()->iconPath()); | 73 | info.icon = QString::fromStdString(appInfo->iconPath()); |
141 | 73 | for (const std::string &keyword : ualApp->info()->keywords().value()) { | 74 | info.description = QString::fromStdString(appInfo->description()); |
142 | 75 | for (const std::string &keyword : appInfo->keywords().value()) { | ||
143 | 74 | info.keywords << QString::fromStdString(keyword); | 76 | info.keywords << QString::fromStdString(keyword); |
144 | 75 | } | 77 | } |
146 | 76 | info.popularity = ualApp->info()->popularity(); | 78 | info.popularity = appInfo->popularity(); |
147 | 77 | info.valid = true; | 79 | info.valid = true; |
148 | 78 | } catch (const std::runtime_error &e) { | 80 | } catch (const std::runtime_error &e) { |
149 | 79 | qWarning() << "ubuntu-app-launch threw an exception getting app info for appId:" << appId << ":" << e.what(); | 81 | qWarning() << "ubuntu-app-launch threw an exception getting app info for appId:" << appId << ":" << e.what(); |
150 | 80 | 82 | ||
151 | === modified file 'plugins/Unity/Launcher/ualwrapper.h' | |||
152 | --- plugins/Unity/Launcher/ualwrapper.h 2017-04-06 13:50:59 +0000 | |||
153 | +++ plugins/Unity/Launcher/ualwrapper.h 2017-04-06 13:50:59 +0000 | |||
154 | @@ -25,6 +25,7 @@ | |||
155 | 25 | bool valid = false; | 25 | bool valid = false; |
156 | 26 | QString name; | 26 | QString name; |
157 | 27 | QString icon; | 27 | QString icon; |
158 | 28 | QString description; | ||
159 | 28 | QStringList keywords; | 29 | QStringList keywords; |
160 | 29 | uint popularity = 0; | 30 | uint popularity = 0; |
161 | 30 | }; | 31 | }; |
162 | 31 | 32 | ||
163 | === modified file 'plugins/Utils/appdrawerproxymodel.cpp' | |||
164 | --- plugins/Utils/appdrawerproxymodel.cpp 2017-01-25 17:44:54 +0000 | |||
165 | +++ plugins/Utils/appdrawerproxymodel.cpp 2017-04-06 13:50:59 +0000 | |||
166 | @@ -25,7 +25,6 @@ | |||
167 | 25 | { | 25 | { |
168 | 26 | setSortRole(AppDrawerModelInterface::RoleName); | 26 | setSortRole(AppDrawerModelInterface::RoleName); |
169 | 27 | setSortLocaleAware(true); | 27 | setSortLocaleAware(true); |
170 | 28 | sort(0); | ||
171 | 29 | 28 | ||
172 | 30 | connect(this, &QAbstractListModel::rowsInserted, this, &AppDrawerProxyModel::countChanged); | 29 | connect(this, &QAbstractListModel::rowsInserted, this, &AppDrawerProxyModel::countChanged); |
173 | 31 | connect(this, &QAbstractListModel::rowsRemoved, this, &AppDrawerProxyModel::countChanged); | 30 | connect(this, &QAbstractListModel::rowsRemoved, this, &AppDrawerProxyModel::countChanged); |
174 | @@ -45,6 +44,8 @@ | |||
175 | 45 | setSortRole(m_sortBy == SortByAToZ ? AppDrawerModelInterface::RoleName : AppDrawerModelInterface::RoleUsage); | 44 | setSortRole(m_sortBy == SortByAToZ ? AppDrawerModelInterface::RoleName : AppDrawerModelInterface::RoleUsage); |
176 | 46 | connect(m_source, &QAbstractItemModel::rowsRemoved, this, &AppDrawerProxyModel::invalidate); | 45 | connect(m_source, &QAbstractItemModel::rowsRemoved, this, &AppDrawerProxyModel::invalidate); |
177 | 47 | connect(m_source, &QAbstractItemModel::rowsInserted, this, &AppDrawerProxyModel::invalidate); | 46 | connect(m_source, &QAbstractItemModel::rowsInserted, this, &AppDrawerProxyModel::invalidate); |
178 | 47 | connect(m_source, &QAbstractItemModel::modelReset, this, &AppDrawerProxyModel::invalidate); | ||
179 | 48 | sort(0); | ||
180 | 48 | Q_EMIT sourceChanged(); | 49 | Q_EMIT sourceChanged(); |
181 | 49 | } | 50 | } |
182 | 50 | } | 51 | } |
183 | @@ -59,7 +60,7 @@ | |||
184 | 59 | if (m_group != group) { | 60 | if (m_group != group) { |
185 | 60 | m_group = group; | 61 | m_group = group; |
186 | 61 | Q_EMIT groupChanged(); | 62 | Q_EMIT groupChanged(); |
188 | 62 | invalidateFilter(); | 63 | invalidate(); |
189 | 63 | } | 64 | } |
190 | 64 | } | 65 | } |
191 | 65 | 66 | ||
192 | @@ -73,7 +74,7 @@ | |||
193 | 73 | if (m_filterLetter != filterLetter) { | 74 | if (m_filterLetter != filterLetter) { |
194 | 74 | m_filterLetter = filterLetter; | 75 | m_filterLetter = filterLetter; |
195 | 75 | Q_EMIT filterLetterChanged(); | 76 | Q_EMIT filterLetterChanged(); |
197 | 76 | invalidateFilter(); | 77 | invalidate(); |
198 | 77 | } | 78 | } |
199 | 78 | } | 79 | } |
200 | 79 | 80 | ||
201 | @@ -87,7 +88,7 @@ | |||
202 | 87 | if (m_filterString != filterString) { | 88 | if (m_filterString != filterString) { |
203 | 88 | m_filterString = filterString; | 89 | m_filterString = filterString; |
204 | 89 | Q_EMIT filterStringChanged(); | 90 | Q_EMIT filterStringChanged(); |
206 | 90 | invalidateFilter(); | 91 | invalidate(); |
207 | 91 | } | 92 | } |
208 | 92 | } | 93 | } |
209 | 93 | 94 | ||
210 | @@ -113,10 +114,10 @@ | |||
211 | 113 | 114 | ||
212 | 114 | QVariant AppDrawerProxyModel::data(const QModelIndex &index, int role) const | 115 | QVariant AppDrawerProxyModel::data(const QModelIndex &index, int role) const |
213 | 115 | { | 116 | { |
215 | 116 | QModelIndex idx = mapToSource(index); | 117 | const QModelIndex idx = mapToSource(index); |
216 | 117 | if (role == Qt::UserRole) { | 118 | if (role == Qt::UserRole) { |
219 | 118 | QString name = m_source->data(idx, AppDrawerModelInterface::RoleName).toString(); | 119 | const QString name = m_source->data(idx, AppDrawerModelInterface::RoleName).toString(); |
220 | 119 | return name.length() > 0 ? QString(name.at(0)).toUpper() : QChar(); | 120 | return !name.isEmpty() ? name.at(0).toUpper() : QChar(); |
221 | 120 | } | 121 | } |
222 | 121 | return m_source->data(idx, role); | 122 | return m_source->data(idx, role); |
223 | 122 | } | 123 | } |
224 | @@ -135,30 +136,34 @@ | |||
225 | 135 | { | 136 | { |
226 | 136 | Q_UNUSED(source_parent) | 137 | Q_UNUSED(source_parent) |
227 | 137 | 138 | ||
228 | 139 | const QModelIndex idx{m_source->index(source_row, 0)}; | ||
229 | 140 | |||
230 | 138 | if (m_group == GroupByAToZ && source_row > 0) { | 141 | if (m_group == GroupByAToZ && source_row > 0) { |
236 | 139 | QString currentName = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString(); | 142 | const QString currentName = m_source->data(idx, AppDrawerModelInterface::RoleName).toString(); |
237 | 140 | QChar currentLetter = currentName.length() > 0 ? currentName.at(0) : QChar(); | 143 | const QChar currentLetter = !currentName.isEmpty() ? currentName.at(0).toLower() : QChar(); |
238 | 141 | QString previousName = m_source->data(m_source->index(source_row - 1,0 ), AppDrawerModelInterface::RoleName).toString(); | 144 | const QString previousName = m_source->data(m_source->index(source_row - 1, 0), AppDrawerModelInterface::RoleName).toString(); |
239 | 142 | QChar previousLetter = previousName.length() > 0 ? previousName.at(0) : QChar(); | 145 | const QChar previousLetter = !previousName.isEmpty() ? previousName.at(0).toLower() : QChar(); |
240 | 143 | if (currentLetter.toLower() == previousLetter.toLower()) { | 146 | if (currentLetter == previousLetter) { |
241 | 144 | return false; | 147 | return false; |
242 | 145 | } | 148 | } |
244 | 146 | } else if(m_group == GroupByAll && source_row > 0) { | 149 | } else if (m_group == GroupByAll && source_row > 0) { |
245 | 147 | return false; | 150 | return false; |
246 | 148 | } | 151 | } |
247 | 152 | |||
248 | 149 | if (!m_filterLetter.isEmpty()) { | 153 | if (!m_filterLetter.isEmpty()) { |
251 | 150 | QString currentName = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString(); | 154 | const QString currentName = m_source->data(idx, AppDrawerModelInterface::RoleName).toString(); |
252 | 151 | QString currentLetter = currentName.length() > 0 ? QString(currentName.at(0)) : QString(); | 155 | const QString currentLetter = !currentName.isEmpty() ? QString(currentName.at(0)) : QString(); |
253 | 152 | if (currentLetter.toLower() != m_filterLetter.toLower()) { | 156 | if (currentLetter.toLower() != m_filterLetter.toLower()) { |
254 | 153 | return false; | 157 | return false; |
255 | 154 | } | 158 | } |
256 | 155 | } | 159 | } |
257 | 156 | if (!m_filterString.isEmpty()) { | 160 | if (!m_filterString.isEmpty()) { |
260 | 157 | QStringList allWords = m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleKeywords).toStringList(); | 161 | const auto roles = {AppDrawerModelInterface::RoleAppId, AppDrawerModelInterface::RoleName, |
261 | 158 | allWords.prepend(m_source->data(m_source->index(source_row, 0), AppDrawerModelInterface::RoleName).toString()); | 162 | AppDrawerModelInterface::RoleDescription, AppDrawerModelInterface::RoleKeywords}; |
262 | 159 | bool found = false; | 163 | bool found = false; |
265 | 160 | Q_FOREACH (const QString ¤tWord, allWords) { | 164 | Q_FOREACH (const auto &role, roles) { |
266 | 161 | if (currentWord.startsWith(m_filterString, Qt::CaseInsensitive)) { | 165 | const QString data = m_source->data(idx, role).toString(); |
267 | 166 | if (data.contains(m_filterString, Qt::CaseInsensitive)) { | ||
268 | 162 | found = true; | 167 | found = true; |
269 | 163 | break; | 168 | break; |
270 | 164 | } | 169 | } |
271 | 165 | 170 | ||
272 | === modified file 'qml/Launcher/Drawer.qml' | |||
273 | --- qml/Launcher/Drawer.qml 2017-03-24 11:51:31 +0000 | |||
274 | +++ qml/Launcher/Drawer.qml 2017-04-06 13:50:59 +0000 | |||
275 | @@ -79,6 +79,7 @@ | |||
276 | 79 | source: appDrawerModel | 79 | source: appDrawerModel |
277 | 80 | filterString: searchField.displayText | 80 | filterString: searchField.displayText |
278 | 81 | sortBy: AppDrawerProxyModel.SortByAToZ | 81 | sortBy: AppDrawerProxyModel.SortByAToZ |
279 | 82 | dynamicSortFilter: false | ||
280 | 82 | } | 83 | } |
281 | 83 | 84 | ||
282 | 84 | Item { | 85 | Item { |
283 | 85 | 86 | ||
284 | === modified file 'tests/mocks/Unity/Launcher/MockLauncherItem.cpp' | |||
285 | --- tests/mocks/Unity/Launcher/MockLauncherItem.cpp 2017-04-06 13:50:59 +0000 | |||
286 | +++ tests/mocks/Unity/Launcher/MockLauncherItem.cpp 2017-04-06 13:50:59 +0000 | |||
287 | @@ -72,6 +72,19 @@ | |||
288 | 72 | return m_keywords; | 72 | return m_keywords; |
289 | 73 | } | 73 | } |
290 | 74 | 74 | ||
291 | 75 | QString MockLauncherItem::description() const | ||
292 | 76 | { | ||
293 | 77 | return m_description; | ||
294 | 78 | } | ||
295 | 79 | |||
296 | 80 | void MockLauncherItem::setDescription(const QString &description) | ||
297 | 81 | { | ||
298 | 82 | if (m_description != description) { | ||
299 | 83 | m_description = description; | ||
300 | 84 | Q_EMIT descriptionChanged(m_description); | ||
301 | 85 | } | ||
302 | 86 | } | ||
303 | 87 | |||
304 | 75 | uint MockLauncherItem::popularity() const | 88 | uint MockLauncherItem::popularity() const |
305 | 76 | { | 89 | { |
306 | 77 | return m_popularity; | 90 | return m_popularity; |
307 | 78 | 91 | ||
308 | === modified file 'tests/mocks/Unity/Launcher/MockLauncherItem.h' | |||
309 | --- tests/mocks/Unity/Launcher/MockLauncherItem.h 2017-04-06 13:50:59 +0000 | |||
310 | +++ tests/mocks/Unity/Launcher/MockLauncherItem.h 2017-04-06 13:50:59 +0000 | |||
311 | @@ -40,6 +40,7 @@ | |||
312 | 40 | QString name() const override; | 40 | QString name() const override; |
313 | 41 | QString icon() const override; | 41 | QString icon() const override; |
314 | 42 | QStringList keywords() const override; | 42 | QStringList keywords() const override; |
315 | 43 | QString description() const override; | ||
316 | 43 | uint popularity() const override; | 44 | uint popularity() const override; |
317 | 44 | 45 | ||
318 | 45 | bool pinned() const override; | 46 | bool pinned() const override; |
319 | @@ -56,6 +57,7 @@ | |||
320 | 56 | 57 | ||
321 | 57 | private: | 58 | private: |
322 | 58 | void setKeywords(const QStringList &keywords); | 59 | void setKeywords(const QStringList &keywords); |
323 | 60 | void setDescription(const QString &description); | ||
324 | 59 | void setPopularity(uint popularity); | 61 | void setPopularity(uint popularity); |
325 | 60 | void setPinned(bool pinned); | 62 | void setPinned(bool pinned); |
326 | 61 | void setRunning(bool running); | 63 | void setRunning(bool running); |
327 | @@ -72,6 +74,7 @@ | |||
328 | 72 | QString m_name; | 74 | QString m_name; |
329 | 73 | QString m_icon; | 75 | QString m_icon; |
330 | 74 | QStringList m_keywords; | 76 | QStringList m_keywords; |
331 | 77 | QString m_description; | ||
332 | 75 | uint m_popularity; | 78 | uint m_popularity; |
333 | 76 | bool m_pinned; | 79 | bool m_pinned; |
334 | 77 | bool m_running; | 80 | bool m_running; |
335 | 78 | 81 | ||
336 | === modified file 'tests/plugins/Unity/Launcher/appdrawermodeltest.cpp' | |||
337 | --- tests/plugins/Unity/Launcher/appdrawermodeltest.cpp 2017-04-06 13:50:59 +0000 | |||
338 | +++ tests/plugins/Unity/Launcher/appdrawermodeltest.cpp 2017-04-06 13:50:59 +0000 | |||
339 | @@ -24,16 +24,20 @@ | |||
340 | 24 | Q_OBJECT | 24 | Q_OBJECT |
341 | 25 | 25 | ||
342 | 26 | private: | 26 | private: |
344 | 27 | AppDrawerModel *appDrawerModel; | 27 | AppDrawerModel *appDrawerModel{nullptr}; |
345 | 28 | 28 | ||
346 | 29 | private Q_SLOTS: | 29 | private Q_SLOTS: |
347 | 30 | 30 | ||
348 | 31 | void initTestCase() { | 31 | void initTestCase() { |
349 | 32 | UalWrapper::s_list << QStringLiteral("app1") << QStringLiteral("app2"); | 32 | UalWrapper::s_list << QStringLiteral("app1") << QStringLiteral("app2"); |
351 | 33 | appDrawerModel = new AppDrawerModel(this); | 33 | appDrawerModel = new AppDrawerModel(); |
352 | 34 | QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2); | 34 | QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2); |
353 | 35 | } | 35 | } |
354 | 36 | 36 | ||
355 | 37 | void cleanupTestCase() { | ||
356 | 38 | appDrawerModel->deleteLater(); | ||
357 | 39 | } | ||
358 | 40 | |||
359 | 37 | void testUalAppAddedRemoved() { | 41 | void testUalAppAddedRemoved() { |
360 | 38 | QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2); | 42 | QCOMPARE(appDrawerModel->rowCount(QModelIndex()), 2); |
361 | 39 | 43 | ||
362 | 40 | 44 | ||
363 | === modified file 'tests/plugins/Unity/Launcher/ualwrapper.cpp' | |||
364 | --- tests/plugins/Unity/Launcher/ualwrapper.cpp 2017-04-06 13:50:59 +0000 | |||
365 | +++ tests/plugins/Unity/Launcher/ualwrapper.cpp 2017-04-06 13:50:59 +0000 | |||
366 | @@ -42,6 +42,7 @@ | |||
367 | 42 | info.name = "App_" + appId; | 42 | info.name = "App_" + appId; |
368 | 43 | info.icon = "/dummy/icon/path/" + appId + ".png"; | 43 | info.icon = "/dummy/icon/path/" + appId + ".png"; |
369 | 44 | info.keywords << QStringLiteral("keyword1") << QStringLiteral("keyword2"); | 44 | info.keywords << QStringLiteral("keyword1") << QStringLiteral("keyword2"); |
370 | 45 | info.description = "Dummy description"; | ||
371 | 45 | info.popularity = 1; | 46 | info.popularity = 1; |
372 | 46 | info.valid = true; | 47 | info.valid = true; |
373 | 47 | return info; | 48 | return info; |
374 | 48 | 49 | ||
375 | === modified file 'tests/plugins/Unity/Launcher/ualwrapper.h' | |||
376 | --- tests/plugins/Unity/Launcher/ualwrapper.h 2017-04-06 13:50:59 +0000 | |||
377 | +++ tests/plugins/Unity/Launcher/ualwrapper.h 2017-04-06 13:50:59 +0000 | |||
378 | @@ -28,6 +28,7 @@ | |||
379 | 28 | QString name; | 28 | QString name; |
380 | 29 | QString icon; | 29 | QString icon; |
381 | 30 | QStringList keywords; | 30 | QStringList keywords; |
382 | 31 | QString description; | ||
383 | 31 | uint popularity = 0; | 32 | uint popularity = 0; |
384 | 32 | }; | 33 | }; |
385 | 33 | 34 |
FAILED: Continuous integration, rev:2916 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3678/ /unity8- jenkins. ubuntu. com/job/ build/4879/ console /unity8- jenkins. ubuntu. com/job/ build-0- fetch/4907 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4718/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4718/ console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4718/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4718/ console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4718/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4718/ console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3678/ rebuild
https:/