on xenial help sign in
More renaming.
d828b92Pawel Stolowski
Shell.qml+3−3
@@ -502,14 +502,14 @@ FocusScope {
502 greeter.hide()
502 greeter.hide()
503 // Animate if moving between application and dash
503 // Animate if moving between application and dash
504 if (!stages.shown) {
504 if (!stages.shown) {
505− dash.setCurrentLens("home.lens", true, false)
505+ dash.setCurrentScope("home.scope", true, false)
506 } else {
506 } else {
507− dash.setCurrentLens("home.lens", false, false)
507+ dash.setCurrentScope("home.scope", false, false)
508 }
508 }
509 stages.hide();
509 stages.hide();
510 }
510 }
511 onDash: {
511 onDash: {
512− dash.setCurrentLens("applications.lens", true, false)
512+ dash.setCurrentScope("applications.scope", true, false)
513 stages.hide();
513 stages.hide();
514 }
514 }
515 onLauncherApplicationSelected:{
515 onLauncherApplicationSelected:{
plugins/Unity/scope.cpp+2−2
@@ -174,9 +174,9 @@ void Scope::fallbackActivate(const QString& uri)
174 QDesktopServices::openUrl(url);
174 QDesktopServices::openUrl(url);
175}
175}
176
176
177−void Scope::setUnityScope(const unity::dash::Scope::Ptr& lens)
177+void Scope::setUnityScope(const unity::dash::Scope::Ptr& scope)
178{
178{
179− m_unityScope = lens;
179+ m_unityScope = scope;
180
180
181 if (QString::fromStdString(m_unityScope->results()->swarm_name) == QString(":local")) {
181 if (QString::fromStdString(m_unityScope->results()->swarm_name) == QString(":local")) {
182 m_results->setModel(m_unityScope->results()->model());
182 m_results->setModel(m_unityScope->results()->model());
plugins/Unity/scope.h+1−1
@@ -61,7 +61,7 @@ public:
61 enum ViewType {
61 enum ViewType {
62 Hidden,
62 Hidden,
63 HomeView,
63 HomeView,
64− LensView
64+ ScopeView
65 };
65 };
66
66
67 /* getters */
67 /* getters */
plugins/Unity/scopes.cpp+2−4
@@ -33,7 +33,7 @@ Scopes::Scopes(QObject *parent)
33 , m_unityScopes(std::make_shared<unity::dash::GSettingsScopes>())
33 , m_unityScopes(std::make_shared<unity::dash::GSettingsScopes>())
34 , m_loaded(false)
34 , m_loaded(false)
35{
35{
36− m_roles[Scopes::RoleLens] = "scope";
36+ m_roles[Scopes::RoleScope] = "scope";
37 m_roles[Scopes::RoleId] = "id";
37 m_roles[Scopes::RoleId] = "id";
38 m_roles[Scopes::RoleVisible] = "visible";
38 m_roles[Scopes::RoleVisible] = "visible";
39
39
@@ -65,7 +65,7 @@ QVariant Scopes::data(const QModelIndex& index, int role) const
65
65
66 Scope* scope = m_scopes.at(index.row());
66 Scope* scope = m_scopes.at(index.row());
67
67
68− if (role == Scopes::RoleLens) {
68+ if (role == Scopes::RoleScope) {
69 return QVariant::fromValue(scope);
69 return QVariant::fromValue(scope);
70 } else if (role == Scopes::RoleId) {
70 } else if (role == Scopes::RoleId) {
71 return QVariant::fromValue(scope->id());
71 return QVariant::fromValue(scope->id());
@@ -111,7 +111,6 @@ void Scopes::onScopeAdded(const unity::dash::Scope::Ptr& scope, int position)
111
111
112void Scopes::onScopesLoaded()
112void Scopes::onScopesLoaded()
113{
113{
114− qWarning() << "Scopes Loaded!!!";
115}
114}
116
115
117void Scopes::onScopeRemoved(const unity::dash::Scope::Ptr& scope)
116void Scopes::onScopeRemoved(const unity::dash::Scope::Ptr& scope)
@@ -132,7 +131,6 @@ void Scopes::onScopePropertyChanged()
132
131
133void Scopes::addUnityScope(const unity::dash::Scope::Ptr& unity_scope)
132void Scopes::addUnityScope(const unity::dash::Scope::Ptr& unity_scope)
134{
133{
135− qDebug() << "Scope added:" << QString::fromStdString(unity_scope->id);
136 Scope* scope = new Scope(this);
134 Scope* scope = new Scope(this);
137 scope->setUnityScope(unity_scope);
135 scope->setUnityScope(unity_scope);
138 /* DOCME */
136 /* DOCME */
plugins/Unity/scopes.h+1−1
@@ -52,7 +52,7 @@ public:
52 ~Scopes() = default;
52 ~Scopes() = default;
53
53
54 enum Roles {
54 enum Roles {
55− RoleLens,
55+ RoleScope,
56 RoleId,
56 RoleId,
57 RoleVisible
57 RoleVisible
58 };
58 };
tests/autopilot/unity8/tests/helpers.py+1−1
@@ -71,7 +71,7 @@ class TestShellHelpers(object):
71 self.touch.drag(start_x, start_y, stop_x, stop_y)
71 self.touch.drag(start_x, start_y, stop_x, stop_y)
72
72
73 # Because the shell loads up lots of stuff, unlocking the greeter can
73 # Because the shell loads up lots of stuff, unlocking the greeter can
74− # be a bit stuttery while lenses are still consuming all resources.
74+ # be a bit stuttery while scopes are still consuming all resources.
75 # Give it another (max retries) chance
75 # Give it another (max retries) chance
76 try:
76 try:
77 self.assertThat(greeter.created, Eventually(Equals(False)))
77 self.assertThat(greeter.created, Eventually(Equals(False)))
tests/qmltests/Dash/qml/FakeLensView.qml → tests/qmltests/Dash/qml/FakeScopeView.qmlrenamed+11−11
@@ -18,8 +18,8 @@ import QtQuick 2.0
18import Unity 0.1
18import Unity 0.1
19
19
20FocusScope {
20FocusScope {
21− id: fakeLensView
21+ id: fakeScopeView
22− property Lens lens : null
22+ property Scope scope : null
23 property bool isCurrent : false
23 property bool isCurrent : false
24
24
25 property alias rect_color1 : rect1.color
25 property alias rect_color1 : rect1.color
@@ -33,18 +33,18 @@ FocusScope {
33 signal positionedAtBeginning
33 signal positionedAtBeginning
34
34
35 onEndReached: {
35 onEndReached: {
36− if (shell != undefined && shell.lens_status != undefined) {
36+ if (shell != undefined && shell.scope_status != undefined) {
37− shell.lens_status[lens.id].endReached++;
37+ shell.scope_status[scope.id].endReached++;
38 }
38 }
39 }
39 }
40 onMovementStarted: {
40 onMovementStarted: {
41− if (shell != undefined && shell.lens_status != undefined) {
41+ if (shell != undefined && shell.scope_status != undefined) {
42− shell.lens_status[lens.id].movementStarted++;
42+ shell.scope_status[scope.id].movementStarted++;
43 }
43 }
44 }
44 }
45 onPositionedAtBeginning: {
45 onPositionedAtBeginning: {
46− if (shell != undefined && shell.lens_status != undefined) {
46+ if (shell != undefined && shell.scope_status != undefined) {
47− shell.lens_status[lens.id].positionedAtBeginning++;
47+ shell.scope_status[scope.id].positionedAtBeginning++;
48 }
48 }
49 }
49 }
50
50
@@ -60,7 +60,7 @@ FocusScope {
60 anchors.fill: parent
60 anchors.fill: parent
61 verticalAlignment: Text.AlignVCenter
61 verticalAlignment: Text.AlignVCenter
62 horizontalAlignment: Text.AlignHCenter
62 horizontalAlignment: Text.AlignHCenter
63− text: lens ? lens.id : ""
63+ text: scope ? scope.id : ""
64 }
64 }
65 }
65 }
66
66
@@ -73,7 +73,7 @@ FocusScope {
73 anchors.fill: parent
73 anchors.fill: parent
74 verticalAlignment: Text.AlignVCenter
74 verticalAlignment: Text.AlignVCenter
75 horizontalAlignment: Text.AlignHCenter
75 horizontalAlignment: Text.AlignHCenter
76− text: lens ? lens.id : ""
76+ text: scope ? scope.id : ""
77 }
77 }
78 }
78 }
79
79
@@ -86,7 +86,7 @@ FocusScope {
86 anchors.fill: parent
86 anchors.fill: parent
87 verticalAlignment: Text.AlignVCenter
87 verticalAlignment: Text.AlignVCenter
88 horizontalAlignment: Text.AlignHCenter
88 horizontalAlignment: Text.AlignHCenter
89− text: lens ? lens.id : ""
89+ text: scope ? scope.id : ""
90 }
90 }
91 }
91 }
92 }
92 }
tests/qmltests/Dash/qml/fake_generic_lensView.qml+3−3
@@ -16,9 +16,9 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18
18
19−FakeLensView {
19+FakeScopeView {
20− id: fake_generic_lensView
20+ id: fake_generic_scopeView
21− objectName: "fake_generic_lensView"
21+ objectName: "fake_generic_scopeView"
22
22
23 rect_color1: "blue"
23 rect_color1: "blue"
24 rect_color2: "orange"
24 rect_color2: "orange"
tests/qmltests/Dash/qml/fake_lensView1.qml+3−3
@@ -16,9 +16,9 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18
18
19−FakeLensView {
19+FakeScopeView {
20− id: fake_lensView1
20+ id: fake_scopeView1
21− objectName: "fake_lensView1"
21+ objectName: "fake_scopeView1"
22
22
23 rect_color1: "red"
23 rect_color1: "red"
24 rect_color2: "green"
24 rect_color2: "green"
tests/qmltests/Dash/qml/fake_lensView2.qml+3−3
@@ -16,9 +16,9 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18
18
19−FakeLensView {
19+FakeScopeView {
20− id: fake_lensView2
20+ id: fake_scopeView2
21− objectName: "fake_lensView2"
21+ objectName: "fake_scopeView2"
22
22
23 rect_color1: "orange"
23 rect_color1: "orange"
24 rect_color2: "grey"
24 rect_color2: "grey"
tests/qmltests/Dash/qml/fake_lensView3.qml+3−3
@@ -16,9 +16,9 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18
18
19−FakeLensView {
19+FakeScopeView {
20− id: fake_lensView3
20+ id: fake_scopeView3
21− objectName: "fake_lensView3"
21+ objectName: "fake_scopeView3"
22
22
23 rect_color1: "yellow"
23 rect_color1: "yellow"
24 rect_color2: "cyan"
24 rect_color2: "cyan"
tests/qmltests/Dash/qml/fake_lensView4.qml+3−3
@@ -16,9 +16,9 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18
18
19−FakeLensView {
19+FakeScopeView {
20− id: fake_lensView4
20+ id: fake_scopeView4
21− objectName: "fake_lensView4"
21+ objectName: "fake_scopeView4"
22
22
23 rect_color1: "grey"
23 rect_color1: "grey"
24 rect_color2: "purple"
24 rect_color2: "purple"
tests/qmltests/Dash/tst_DashBar.qml+4−4
@@ -34,12 +34,12 @@ Item {
34 right: parent.right
34 right: parent.right
35 bottom: parent.bottom
35 bottom: parent.bottom
36 }
36 }
37− model: lenses
37+ model: scopes
38 onItemSelected: currentIndex = index
38 onItemSelected: currentIndex = index
39 }
39 }
40
40
41− Lenses {
41+ Scopes {
42− id: lenses
42+ id: scopes
43 }
43 }
44
44
45 SignalSpy {
45 SignalSpy {
@@ -50,7 +50,7 @@ Item {
50
50
51 UT.UnityTestCase {
51 UT.UnityTestCase {
52 name: "DashBar"
52 name: "DashBar"
53− when: lenses.loaded
53+ when: scopes.loaded
54
54
55 property alias model: dashBar.model
55 property alias model: dashBar.model
56 property alias currentIndex: dashBar.currentIndex
56 property alias currentIndex: dashBar.currentIndex
tests/qmltests/Dash/tst_DashContent.qml+67−67
@@ -28,55 +28,55 @@ Item {
28
28
29 property ListModel searchHistory: ListModel {}
29 property ListModel searchHistory: ListModel {}
30
30
31− property var lens_status: {
31+ property var scope_status: {
32− 'MockLens1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
32+ 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33− 'MockLens2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33+ 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34− 'MockLens3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
34+ 'MockScope3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
35− 'MockLens4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
35+ 'MockScope4': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
36− 'MockLens5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
36+ 'MockScope5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
37 }
37 }
38
38
39− Lenses {
39+ Scopes {
40− id: lensesModel
40+ id: scopesModel
41 }
41 }
42
42
43 DashContent {
43 DashContent {
44 id: dash_content
44 id: dash_content
45 anchors.fill: parent
45 anchors.fill: parent
46
46
47− model: lensesModel
47+ model: scopesModel
48− scopes : lensesModel
48+ scopes : scopesModel
49
49
50− lensDelegateMapping: { "MockLens3" : "../tests/qmltests/Dash/qml/fake_lensView3.qml",
50+ scopeDelegateMapping: { "MockScope3" : "../tests/qmltests/Dash/qml/fake_lensView3.qml",
51− "MockLens2" : "../tests/qmltests/Dash/qml/fake_lensView2.qml",
51+ "MockScope2" : "../tests/qmltests/Dash/qml/fake_lensView2.qml",
52− "MockLens1" : "../tests/qmltests/Dash/qml/fake_lensView1.qml",
52+ "MockScope1" : "../tests/qmltests/Dash/qml/fake_lensView1.qml",
53− "MockLens4" : "../tests/qmltests/Dash/qml/fake_lensView4.qml"
53+ "MockScope4" : "../tests/qmltests/Dash/qml/fake_lensView4.qml"
54 }
54 }
55
55
56− genericLens: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
56+ genericScope: "../tests/qmltests/Dash/qml/fake_generic_lensView.qml"
57 }
57 }
58
58
59− function clear_lens_status() {
59+ function clear_scope_status() {
60− lens_status["MockLens1"].movementStarted = 0;
60+ scope_status["MockScope1"].movementStarted = 0;
61− lens_status["MockLens1"].positionedAtBeginning = 0;
61+ scope_status["MockScope1"].positionedAtBeginning = 0;
62
62
63− lens_status["MockLens2"].movementStarted = 0;
63+ scope_status["MockScope2"].movementStarted = 0;
64− lens_status["MockLens2"].positionedAtBeginning = 0;
64+ scope_status["MockScope2"].positionedAtBeginning = 0;
65
65
66− lens_status["MockLens3"].movementStarted = 0;
66+ scope_status["MockScope3"].movementStarted = 0;
67− lens_status["MockLens3"].positionedAtBeginning = 0;
67+ scope_status["MockScope3"].positionedAtBeginning = 0;
68
68
69− lens_status["MockLens4"].movementStarted = 0;
69+ scope_status["MockScope4"].movementStarted = 0;
70− lens_status["MockLens4"].positionedAtBeginning = 0;
70+ scope_status["MockScope4"].positionedAtBeginning = 0;
71
71
72− lens_status["MockLens5"].movementStarted = 0;
72+ scope_status["MockScope5"].movementStarted = 0;
73− lens_status["MockLens5"].positionedAtBeginning = 0;
73+ scope_status["MockScope5"].positionedAtBeginning = 0;
74 }
74 }
75
75
76 SignalSpy {
76 SignalSpy {
77− id: lensLoaded_spy
77+ id: scopeLoaded_spy
78 target: dash_content
78 target: dash_content
79− signalName: "lensLoaded"
79+ signalName: "scopeLoaded"
80 }
80 }
81
81
82 SignalSpy {
82 SignalSpy {
@@ -96,77 +96,77 @@ Item {
96 when: windowShown
96 when: windowShown
97
97
98 function init() {
98 function init() {
99− lensLoaded_spy.clear();
99+ scopeLoaded_spy.clear();
100 movementStarted_spy.clear();
100 movementStarted_spy.clear();
101 contentEndReached_spy.clear()
101 contentEndReached_spy.clear()
102− clear_lens_status();
102+ clear_scope_status();
103
103
104− // clear, wait for dahs to empty and load lenses.
104+ // clear, wait for dahs to empty and load scopes.
105 var dashContentList = findChild(dash_content, "dashContentList");
105 var dashContentList = findChild(dash_content, "dashContentList");
106 verify(dashContentList != undefined)
106 verify(dashContentList != undefined)
107− lensesModel.clear();
107+ scopesModel.clear();
108 tryCompare(dashContentList, "count", 0);
108 tryCompare(dashContentList, "count", 0);
109− lensesModel.load();
109+ scopesModel.load();
110 }
110 }
111
111
112 function test_movement_started_signal() {
112 function test_movement_started_signal() {
113− dash_content.setCurrentLensAtIndex(3, true, false);
113+ dash_content.setCurrentScopeAtIndex(3, true, false);
114
114
115 var dashContentList = findChild(dash_content, "dashContentList");
115 var dashContentList = findChild(dash_content, "dashContentList");
116 verify(dashContentList != undefined)
116 verify(dashContentList != undefined)
117− tryCompare(lensLoaded_spy, "count", 5);
117+ tryCompare(scopeLoaded_spy, "count", 5);
118
118
119 dashContentList.movementStarted();
119 dashContentList.movementStarted();
120 compare(movementStarted_spy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
120 compare(movementStarted_spy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
121− compare(lens_status["MockLens1"].movementStarted, 1, "MockLens1 should have emitted movementStarted signal when content list did.");
121+ compare(scope_status["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
122− compare(lens_status["MockLens2"].movementStarted, 1, "MockLens2 should have emitted movementStarted signal when content list did.");
122+ compare(scope_status["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
123− compare(lens_status["MockLens3"].movementStarted, 1, "MockLens3 should have emitted movementStarted signal when content list did.");
123+ compare(scope_status["MockScope3"].movementStarted, 1, "MockScope3 should have emitted movementStarted signal when content list did.");
124− compare(lens_status["MockLens4"].movementStarted, 1, "MockLens4 should have emitted movementStarted signal when content list did.");
124+ compare(scope_status["MockScope4"].movementStarted, 1, "MockScope4 should have emitted movementStarted signal when content list did.");
125− compare(lens_status["MockLens5"].movementStarted, 1, "MockLens5 should have emitted movementStarted signal when content list did.");
125+ compare(scope_status["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
126 }
126 }
127
127
128 function test_positioned_at_beginning_signal() {
128 function test_positioned_at_beginning_signal() {
129− dash_content.setCurrentLensAtIndex(3, true, false);
129+ dash_content.setCurrentScopeAtIndex(3, true, false);
130
130
131− tryCompare(lensLoaded_spy, "count", 5);
131+ tryCompare(scopeLoaded_spy, "count", 5);
132
132
133 dash_content.positionedAtBeginning();
133 dash_content.positionedAtBeginning();
134− compare(lens_status["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");
134+ compare(scope_status["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
135− compare(lens_status["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");
135+ compare(scope_status["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
136− compare(lens_status["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");
136+ compare(scope_status["MockScope3"].positionedAtBeginning, 1, "MockScope3 should have emitted positionedAtBeginning signal when DashContent did.");
137− compare(lens_status["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");
137+ compare(scope_status["MockScope4"].positionedAtBeginning, 1, "MockScope4 should have emitted positionedAtBeginning signal when DashContent did.");
138− compare(lens_status["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
138+ compare(scope_status["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
139 }
139 }
140
140
141− function test_lens_loaded() {
141+ function test_scope_loaded() {
142− tryCompare(lensLoaded_spy, "count", 5);
142+ tryCompare(scopeLoaded_spy, "count", 5);
143 }
143 }
144
144
145 function test_content_end_reached() {
145 function test_content_end_reached() {
146 var dashContentList = findChild(dash_content, "dashContentList");
146 var dashContentList = findChild(dash_content, "dashContentList");
147 verify(dashContentList != undefined);
147 verify(dashContentList != undefined);
148− tryCompare(lensLoaded_spy, "count", 5);
148+ tryCompare(scopeLoaded_spy, "count", 5);
149
149
150− dash_content.setCurrentLensAtIndex(0, true, false);
150+ dash_content.setCurrentScopeAtIndex(0, true, false);
151 dashContentList.currentItem.item.endReached();
151 dashContentList.currentItem.item.endReached();
152
152
153 compare(contentEndReached_spy.count, 1);
153 compare(contentEndReached_spy.count, 1);
154 }
154 }
155
155
156− // This tests that setting the current lens index will end up at the correct index even if
156+ // This tests that setting the current scope index will end up at the correct index even if
157− // the lenses are loaded asynchrounsly.
157+ // the scopes are loaded asynchrounsly.
158− function test_set_current_lens_index_async() {
158+ function test_set_current_scope_index_async() {
159− verify(lensesModel.loaded == false);
159+ verify(scopesModel.loaded == false);
160
160
161 // next index is 1 if current is -1, otherwise it's current + 1
161 // next index is 1 if current is -1, otherwise it's current + 1
162 var next_index = ((dash_content.currentIndex == -1 ? 0 : dash_content.currentIndex) + 1) % 5
162 var next_index = ((dash_content.currentIndex == -1 ? 0 : dash_content.currentIndex) + 1) % 5
163
163
164− dash_content.setCurrentLensAtIndex(next_index, true, false);
164+ dash_content.setCurrentScopeAtIndex(next_index, true, false);
165 tryCompare(dash_content, "currentIndex", next_index);
165 tryCompare(dash_content, "currentIndex", next_index);
166− verify(lensesModel.loaded == true);
166+ verify(scopesModel.loaded == true);
167
167
168− // test greater than lens count.
168+ // test greater than scope count.
169− dash_content.setCurrentLensAtIndex(lensesModel.count, true, false);
169+ dash_content.setCurrentScopeAtIndex(scopesModel.count, true, false);
170 compare(dash_content.currentIndex, 4);
170 compare(dash_content.currentIndex, 4);
171 }
171 }
172
172
@@ -182,18 +182,18 @@ Item {
182 return "";
182 return "";
183 }
183 }
184
184
185− function test_lens_mapping_data() {
185+ function test_scope_mapping_data() {
186 return [
186 return [
187− {tag: "index0", index: 0, objectName: "fake_lensView1"},
187+ {tag: "index0", index: 0, objectName: "fake_scopeView1"},
188− {tag: "index1", index: 1, objectName: "fake_lensView2"},
188+ {tag: "index1", index: 1, objectName: "fake_scopeView2"},
189− {tag: "index2", index: 2, objectName: "fake_lensView3"},
189+ {tag: "index2", index: 2, objectName: "fake_scopeView3"},
190− {tag: "index3", index: 3, objectName: "fake_lensView4"},
190+ {tag: "index3", index: 3, objectName: "fake_scopeView4"},
191− {tag: "index4", index: 4, objectName: "fake_generic_lensView"}
191+ {tag: "index4", index: 4, objectName: "fake_generic_scopeView"}
192 ]
192 ]
193 }
193 }
194
194
195− function test_lens_mapping(data) {
195+ function test_scope_mapping(data) {
196− dash_content.setCurrentLensAtIndex(data.index, true, false);
196+ dash_content.setCurrentScopeAtIndex(data.index, true, false);
197 tryCompareFunction(get_current_item_object_name, data.objectName)
197 tryCompareFunction(get_current_item_object_name, data.objectName)
198 }
198 }
199
199
tests/qmltests/Dash/tst_GenericLensView.qml+8−8
@@ -26,27 +26,27 @@ Item {
26 width: units.gu(120)
26 width: units.gu(120)
27 height: units.gu(80)
27 height: units.gu(80)
28
28
29− Lenses {
29+ Scopes {
30 id: scopes
30 id: scopes
31 }
31 }
32
32
33− GenericLensView {
33+ GenericScopeView {
34− id: genericLensView
34+ id: genericScopeView
35 anchors.fill: parent
35 anchors.fill: parent
36
36
37 UT.UnityTestCase {
37 UT.UnityTestCase {
38− name: "GenericLensView"
38+ name: "GenericScopeView"
39 when: scopes.loaded
39 when: scopes.loaded
40
40
41 function init() {
41 function init() {
42− genericLensView.lens = scopes.get(0)
42+ genericScopeView.scope = scopes.get(0)
43 }
43 }
44
44
45 function test_isCurrent() {
45 function test_isCurrent() {
46− var pageHeader = findChild(genericLensView, "pageHeader");
46+ var pageHeader = findChild(genericScopeView, "pageHeader");
47− genericLensView.isCurrent = true
47+ genericScopeView.isCurrent = true
48 pageHeader.searchQuery = "test"
48 pageHeader.searchQuery = "test"
49− genericLensView.isCurrent = false
49+ genericScopeView.isCurrent = false
50 tryCompare(pageHeader, "searchQuery", "")
50 tryCompare(pageHeader, "searchQuery", "")
51 }
51 }
52 }
52 }
tests/qmltests/Dash/tst_LensView.qml+10−10
@@ -25,27 +25,27 @@ Item {
25 width: units.gu(120)
25 width: units.gu(120)
26 height: units.gu(80)
26 height: units.gu(80)
27
27
28− Lenses {
28+ Scopes {
29 id: scopes
29 id: scopes
30 }
30 }
31
31
32− LensView {
32+ ScopeView {
33− id: lensView
33+ id: scopeView
34 anchors.fill: parent
34 anchors.fill: parent
35
35
36 TestCase {
36 TestCase {
37− name: "LensView"
37+ name: "ScopeView"
38 when: scopes.loaded
38 when: scopes.loaded
39
39
40 function init() {
40 function init() {
41− lensView.lens = lenses.get(0)
41+ scopeView.scope = scopes.get(0)
42 }
42 }
43
43
44− function test_changeLens() {
44+ function test_changeScope() {
45− lensView.lens.searchQuery = "test"
45+ scopeView.scope.searchQuery = "test"
46− lensView.lens = lenses.get(1)
46+ scopeView.scope = scopes.get(1)
47− lensView.lens = lenses.get(0)
47+ scopeView.scope = scopes.get(0)
48− tryCompare(lensView.lens, "searchQuery", "")
48+ tryCompare(scopeView.scope, "searchQuery", "")
49 }
49 }
50 }
50 }
51 }
51 }
tests/qmltests/plugins/Unity/fake_lens.cpp+9−9
@@ -25,7 +25,7 @@ static DeeModel* create_results_model(unsigned category_count, unsigned result_c
25
25
26// TODO: Implement remaining pieces
26// TODO: Implement remaining pieces
27
27
28−Lens::Lens(QObject* parent)
28+Scope::Scope(QObject* parent)
29: QObject(parent),
29: QObject(parent),
30 m_visible(false),
30 m_visible(false),
31 m_categories(new Categories(this)),
31 m_categories(new Categories(this)),
@@ -38,7 +38,7 @@ Lens::Lens(QObject* parent)
38// m_categories->setGlobalResultModel(m_results);
38// m_categories->setGlobalResultModel(m_results);
39}
39}
40
40
41−Lens::Lens(QString const& id,
41+Scope::Scope(QString const& id,
42 QString const& name,
42 QString const& name,
43 bool visible,
43 bool visible,
44 QObject* parent)
44 QObject* parent)
@@ -56,37 +56,37 @@ Lens::Lens(QString const& id,
56// m_categories->setGlobalResultModel(m_results);
56// m_categories->setGlobalResultModel(m_results);
57}
57}
58
58
59−QString Lens::id() const {
59+QString Scope::id() const {
60 return m_id;
60 return m_id;
61}
61}
62
62
63−QString Lens::name() const {
63+QString Scope::name() const {
64 return m_name;
64 return m_name;
65}
65}
66
66
67−QString Lens::searchQuery() const {
67+QString Scope::searchQuery() const {
68 return m_searchQuery;
68 return m_searchQuery;
69}
69}
70
70
71−void Lens::setName(const QString &str) {
71+void Scope::setName(const QString &str) {
72 if (str != m_name) {
72 if (str != m_name) {
73 m_name = str;
73 m_name = str;
74 Q_EMIT nameChanged(m_name);
74 Q_EMIT nameChanged(m_name);
75 }
75 }
76}
76}
77
77
78−void Lens::setSearchQuery(const QString &str) {
78+void Scope::setSearchQuery(const QString &str) {
79 if (str != m_searchQuery) {
79 if (str != m_searchQuery) {
80 m_searchQuery = str;
80 m_searchQuery = str;
81 Q_EMIT searchQueryChanged(m_searchQuery);
81 Q_EMIT searchQueryChanged(m_searchQuery);
82 }
82 }
83}
83}
84
84
85−bool Lens::visible() const {
85+bool Scope::visible() const {
86 return m_visible;
86 return m_visible;
87}
87}
88
88
89−Categories* Lens::categories() const {
89+Categories* Scope::categories() const {
90 return m_categories;
90 return m_categories;
91}
91}
92
92
tests/qmltests/plugins/Unity/fake_lens.h+6−6
@@ -14,14 +14,14 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#ifndef FAKE_LENS_H
17+#ifndef FAKE_SCOPE_H
18−#define FAKE_LENS_H
18+#define FAKE_SCOPE_H
19
19
20// Qt
20// Qt
21#include <QObject>
21#include <QObject>
22#include "categories.h"
22#include "categories.h"
23
23
24−class Lens : public QObject
24+class Scope : public QObject
25{
25{
26 Q_OBJECT
26 Q_OBJECT
27 Q_PROPERTY(QString id READ id NOTIFY idChanged)
27 Q_PROPERTY(QString id READ id NOTIFY idChanged)
@@ -31,8 +31,8 @@ class Lens : public QObject
31 Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged)
31 Q_PROPERTY(Categories* categories READ categories NOTIFY categoriesChanged)
32
32
33public:
33public:
34− Lens(QObject* parent = 0);
34+ Scope(QObject* parent = 0);
35− Lens(QString const& id, QString const& name, bool visible, QObject* parent = 0);
35+ Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0);
36
36
37 QString id() const;
37 QString id() const;
38 QString name() const;
38 QString name() const;
@@ -60,4 +60,4 @@ private:
60 DeeListModel* m_results;
60 DeeListModel* m_results;
61};
61};
62
62
63−#endif // FAKE_LENS_H
63+#endif // FAKE_SCOPE_H
tests/qmltests/plugins/Unity/fake_lenses.cpp+37−37
@@ -24,14 +24,14 @@
24// Qt
24// Qt
25#include <QTimer>
25#include <QTimer>
26
26
27−Lenses::Lenses(QObject *parent)
27+Scopes::Scopes(QObject *parent)
28: QAbstractListModel(parent)
28: QAbstractListModel(parent)
29, m_loaded(false)
29, m_loaded(false)
30, timer(this)
30, timer(this)
31{
31{
32− m_roles[Lenses::RoleLens] = "lens";
32+ m_roles[Scopes::RoleScope] = "scope";
33− m_roles[Lenses::RoleId] = "id";
33+ m_roles[Scopes::RoleId] = "id";
34− m_roles[Lenses::RoleVisible] = "visible";
34+ m_roles[Scopes::RoleVisible] = "visible";
35
35
36 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
36 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
37 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
37 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
@@ -39,22 +39,22 @@ Lenses::Lenses(QObject *parent)
39
39
40 timer.setSingleShot(true);
40 timer.setSingleShot(true);
41 timer.setInterval(100);
41 timer.setInterval(100);
42− QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateLenses()));
42+ QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
43 load();
43 load();
44}
44}
45
45
46−Lenses::~Lenses()
46+Scopes::~Scopes()
47{
47{
48}
48}
49
49
50−void Lenses::updateLenses()
50+void Scopes::updateScopes()
51{
51{
52 clear();
52 clear();
53− addLens(new Lens("MockLens1", "People", true, this));
53+ addScope(new Scope("MockScope1", "People", true, this));
54− addLens(new Lens("MockLens2", "Music", false, this));
54+ addScope(new Scope("MockScope2", "Music", false, this));
55− addLens(new Lens("MockLens3", "Home", true, this));
55+ addScope(new Scope("MockScope3", "Home", true, this));
56− addLens(new Lens("MockLens4", "Applications", true, this));
56+ addScope(new Scope("MockScope4", "Applications", true, this));
57− addLens(new Lens("MockLens5", "Videos", true, this));
57+ addScope(new Scope("MockScope5", "Videos", true, this));
58
58
59 if (!m_loaded) {
59 if (!m_loaded) {
60 m_loaded = true;
60 m_loaded = true;
@@ -62,13 +62,13 @@ void Lenses::updateLenses()
62 }
62 }
63}
63}
64
64
65−void Lenses::clear()
65+void Scopes::clear()
66{
66{
67 timer.stop();
67 timer.stop();
68− if (m_lenses.size() > 0) {
68+ if (m_scopes.size() > 0) {
69− beginRemoveRows(QModelIndex(), 0, m_lenses.count()-1);
69+ beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
70− qDeleteAll(m_lenses);
70+ qDeleteAll(m_scopes);
71− m_lenses.clear();
71+ m_scopes.clear();
72 endRemoveRows();
72 endRemoveRows();
73 }
73 }
74
74
@@ -78,69 +78,69 @@ void Lenses::clear()
78 }
78 }
79}
79}
80
80
81−void Lenses::load()
81+void Scopes::load()
82{
82{
83 timer.start();
83 timer.start();
84}
84}
85
85
86−QHash<int, QByteArray> Lenses::roleNames() const
86+QHash<int, QByteArray> Scopes::roleNames() const
87{
87{
88 return m_roles;
88 return m_roles;
89}
89}
90
90
91−int Lenses::rowCount(const QModelIndex&) const
91+int Scopes::rowCount(const QModelIndex&) const
92{
92{
93− return m_lenses.count();
93+ return m_scopes.count();
94}
94}
95
95
96−QVariant Lenses::data(const QModelIndex& index, int role) const
96+QVariant Scopes::data(const QModelIndex& index, int role) const
97{
97{
98− if (!index.isValid() || index.row() >= m_lenses.size()) {
98+ if (!index.isValid() || index.row() >= m_scopes.size()) {
99 return QVariant();
99 return QVariant();
100 }
100 }
101
101
102− Lens* lens = m_lenses.at(index.row());
102+ Scope* scope = m_scopes.at(index.row());
103
103
104− if (role == Lenses::RoleLens) {
104+ if (role == Scopes::RoleScope) {
105− return QVariant::fromValue(lens);
105+ return QVariant::fromValue(scope);
106− } else if (role == Lenses::RoleId) {
106+ } else if (role == Scopes::RoleId) {
107− return QVariant::fromValue(lens->id());
107+ return QVariant::fromValue(scope->id());
108− } else if (role == Lenses::RoleVisible) {
108+ } else if (role == Scopes::RoleVisible) {
109− return QVariant::fromValue(lens->visible());
109+ return QVariant::fromValue(scope->visible());
110 } else {
110 } else {
111 return QVariant();
111 return QVariant();
112 }
112 }
113}
113}
114
114
115−QVariant Lenses::get(int row) const
115+QVariant Scopes::get(int row) const
116{
116{
117 return data(QAbstractListModel::index(row), 0);
117 return data(QAbstractListModel::index(row), 0);
118}
118}
119
119
120−QVariant Lenses::get(QString const&) const
120+QVariant Scopes::get(QString const&) const
121{
121{
122 return QVariant();
122 return QVariant();
123}
123}
124
124
125−QModelIndex Lenses::parent(const QModelIndex&) const
125+QModelIndex Scopes::parent(const QModelIndex&) const
126{
126{
127 return QModelIndex();
127 return QModelIndex();
128}
128}
129
129
130−bool Lenses::loaded() const
130+bool Scopes::loaded() const
131{
131{
132 return m_loaded;
132 return m_loaded;
133}
133}
134
134
135−int Lenses::count() const
135+int Scopes::count() const
136{
136{
137 return rowCount();
137 return rowCount();
138}
138}
139
139
140−void Lenses::addLens(Lens* lens)
140+void Scopes::addScope(Scope* scope)
141{
141{
142 int index = rowCount();
142 int index = rowCount();
143 beginInsertRows(QModelIndex(), index, index);
143 beginInsertRows(QModelIndex(), index, index);
144− m_lenses.append(lens);
144+ m_scopes.append(scope);
145 endInsertRows();
145 endInsertRows();
146}
146}
tests/qmltests/plugins/Unity/fake_lenses.h+12−12
@@ -16,8 +16,8 @@
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
17 */
18
18
19−#ifndef FAKE_LENSES_H
19+#ifndef FAKE_SCOPES_H
20−#define FAKE_LENSES_H
20+#define FAKE_SCOPES_H
21
21
22// Local
22// Local
23#include "fake_lens.h"
23#include "fake_lens.h"
@@ -27,7 +27,7 @@
27#include <QList>
27#include <QList>
28#include <QTimer>
28#include <QTimer>
29
29
30−class Lenses : public QAbstractListModel
30+class Scopes : public QAbstractListModel
31{
31{
32 Q_OBJECT
32 Q_OBJECT
33 Q_ENUMS(Roles)
33 Q_ENUMS(Roles)
@@ -35,11 +35,11 @@ class Lenses : public QAbstractListModel
35 Q_PROPERTY(int count READ count NOTIFY countChanged)
35 Q_PROPERTY(int count READ count NOTIFY countChanged)
36
36
37public:
37public:
38− explicit Lenses(QObject *parent = 0);
38+ explicit Scopes(QObject *parent = 0);
39− ~Lenses();
39+ ~Scopes();
40
40
41 enum Roles {
41 enum Roles {
42− RoleLens,
42+ RoleScope,
43 RoleId,
43 RoleId,
44 RoleVisible
44 RoleVisible
45 };
45 };
@@ -47,9 +47,9 @@ public:
47 Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
47 Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
48
48
49 Q_INVOKABLE QVariant get(int row) const;
49 Q_INVOKABLE QVariant get(int row) const;
50− Q_INVOKABLE QVariant get(const QString& lens_id) const;
50+ Q_INVOKABLE QVariant get(const QString& scope_id) const;
51
51
52− Q_INVOKABLE void addLens(Lens* lens);
52+ Q_INVOKABLE void addScope(Scope* scope);
53
53
54 Q_INVOKABLE void clear();
54 Q_INVOKABLE void clear();
55 Q_INVOKABLE void load();
55 Q_INVOKABLE void load();
@@ -62,18 +62,18 @@ public:
62 int count() const;
62 int count() const;
63
63
64Q_SIGNALS:
64Q_SIGNALS:
65− void activateLensRequested(const QString& lens_id);
65+ void activateScopeRequested(const QString& scope_id);
66 void loadedChanged(bool);
66 void loadedChanged(bool);
67 void countChanged();
67 void countChanged();
68
68
69private Q_SLOTS:
69private Q_SLOTS:
70− void updateLenses();
70+ void updateScopes();
71
71
72private:
72private:
73− QList<Lens*> m_lenses;
73+ QList<Scope*> m_scopes;
74 QHash<int, QByteArray> m_roles;
74 QHash<int, QByteArray> m_roles;
75 bool m_loaded;
75 bool m_loaded;
76 QTimer timer;
76 QTimer timer;
77};
77};
78
78
79−#endif // LENSES_H
79+#endif // SCOPES_H
tests/qmltests/plugins/Unity/fake_unity_plugin.cpp+2−2
@@ -37,8 +37,8 @@ void FakeUnityPlugin::registerTypes(const char *uri)
37
37
38 Q_ASSERT(uri == QLatin1String("Unity"));
38 Q_ASSERT(uri == QLatin1String("Unity"));
39
39
40− qmlRegisterType<Lenses>(uri, 0, 1, "Lenses");
40+ qmlRegisterType<Scopes>(uri, 0, 1, "Scopes");
41− qmlRegisterType<Lens>(uri, 0, 1, "Lens");
41+ qmlRegisterType<Scope>(uri, 0, 1, "Scope");
42 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
42 qmlRegisterType<Categories>(uri, 0, 1, "Categories");
43 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
43 qmlRegisterType<CategoryFilter>(uri, 0, 1, "CategoryFilter");
44 qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");
44 qmlRegisterType<LauncherModel>(uri, 0, 1, "LauncherModel");