Merge lp:~osomon/webbrowser-app/preview-hoveredUrl into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1453
Merged at revision: 1457
Proposed branch: lp:~osomon/webbrowser-app/preview-hoveredUrl
Merge into: lp:webbrowser-app
Diff against target: 250 lines (+210/-2)
4 files modified
debian/control (+1/-1)
src/app/webbrowser/Browser.qml (+13/-1)
src/app/webbrowser/HoveredUrlLabel.qml (+89/-0)
tests/unittests/qml/tst_HoveredUrlLabel.qml (+107/-0)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/preview-hoveredUrl
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing
Michael Terry test Approve
Review via email: mp+294021@code.launchpad.net

Commit message

Display the currently hovered hyperlink’s target URL in an overlay.

To post a comment you must log in.
1453. By Olivier Tilloy

Property anchor the HoveredUrlLabel to the tab container.

Revision history for this message
Michael Terry (mterry) wrote :

I don't want to review the code itself for this project since I'm not really involved. But I tested this, and it worked great. Thanks Olivier!

review: Approve (test)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1452
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/480/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/482
    FAILURE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/36/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/482
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/481
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/481
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/488
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/488/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/488
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/488/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/488
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/488/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/488
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/488/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/488
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/488/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/488
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/488/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/480/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1453
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/481/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/483
    FAILURE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/37/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/483
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/482
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/482
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/489
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/489/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/489
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/489/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/489
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/489/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/489
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/489/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/489
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/489/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/489
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/489/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/481/rebuild

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-04-28 14:39:20 +0000
3+++ debian/control 2016-05-06 15:43:33 +0000
4@@ -46,7 +46,7 @@
5 Depends: ${misc:Depends},
6 ${shlibs:Depends},
7 fonts-liberation,
8- liboxideqt-qmlplugin (>= 1.9),
9+ liboxideqt-qmlplugin (>= 1.12),
10 libqt5sql5-sqlite,
11 qml-module-qt-labs-folderlistmodel,
12 qml-module-qt-labs-settings,
13
14=== modified file 'src/app/webbrowser/Browser.qml'
15--- src/app/webbrowser/Browser.qml 2016-04-15 11:37:54 +0000
16+++ src/app/webbrowser/Browser.qml 2016-05-06 15:43:33 +0000
17@@ -19,7 +19,7 @@
18 import QtQuick 2.4
19 import QtQuick.Window 2.2
20 import Qt.labs.settings 1.0
21-import com.canonical.Oxide 1.8 as Oxide
22+import com.canonical.Oxide 1.12 as Oxide
23 import Ubuntu.Components 1.3
24 import Ubuntu.Components.Popups 1.3
25 import Unity.InputInfo 0.1
26@@ -351,6 +351,18 @@
27
28 asynchronous: true
29 }
30+
31+ HoveredUrlLabel {
32+ anchors {
33+ left: tabContainer.left
34+ leftMargin: units.dp(-1)
35+ bottom: tabContainer.bottom
36+ bottomMargin: units.dp(-1)
37+ }
38+ height: units.gu(3)
39+ collapsedWidth: Math.min(units.gu(40), tabContainer.width)
40+ webview: browser.currentWebview
41+ }
42 }
43
44 FocusScope {
45
46=== added file 'src/app/webbrowser/HoveredUrlLabel.qml'
47--- src/app/webbrowser/HoveredUrlLabel.qml 1970-01-01 00:00:00 +0000
48+++ src/app/webbrowser/HoveredUrlLabel.qml 2016-05-06 15:43:33 +0000
49@@ -0,0 +1,89 @@
50+/*
51+* Copyright 2016 Canonical Ltd.
52+*
53+* This file is part of webbrowser-app.
54+*
55+* webbrowser-app is free software; you can redistribute it and/or modify
56+* it under the terms of the GNU General Public License as published by
57+* the Free Software Foundation; version 3.
58+*
59+* webbrowser-app is distributed in the hope that it will be useful,
60+* but WITHOUT ANY WARRANTY; without even the implied warranty of
61+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62+* GNU General Public License for more details.
63+*
64+* You should have received a copy of the GNU General Public License
65+* along with this program. If not, see <http://www.gnu.org/licenses/>.
66+*/
67+
68+import QtQuick 2.4
69+import Ubuntu.Components 1.3
70+
71+Item {
72+ id: root
73+
74+ property var webview: null
75+ property real collapsedWidth: 0
76+
77+ states: [
78+ State {
79+ name: "hidden"
80+ },
81+ State {
82+ name: "collapsed"
83+ },
84+ State {
85+ name: "expanded"
86+ }
87+ ]
88+ state: "hidden"
89+ visible: state != "hidden"
90+
91+ width: (state == "expanded")
92+ ? Math.max(collapsedWidth, label.contentWidth + label.anchors.margins * 2)
93+ : collapsedWidth
94+ Behavior on width {
95+ UbuntuNumberAnimation {
96+ duration: UbuntuAnimation.SnapDuration
97+ }
98+ }
99+
100+ Rectangle {
101+ color: "#f6f6f6"
102+ border {
103+ width: units.dp(1)
104+ color: UbuntuColors.silk
105+ }
106+ anchors.fill: parent
107+ }
108+
109+ Timer {
110+ id: timer
111+ interval: 1000
112+ onTriggered: root.state = "expanded"
113+ }
114+
115+ Label {
116+ id: label
117+ anchors {
118+ verticalCenter: parent.verticalCenter
119+ margins: units.gu(1)
120+ left: parent.left
121+ right: (root.state == "expanded") ? undefined : parent.right
122+ }
123+ fontSize: "small"
124+ elide: (root.state == "expanded") ? Text.ElideNone : Text.ElideRight
125+ text: (root.webview && root.webview.visible) ? root.webview.hoveredUrl : ""
126+ onTextChanged: {
127+ if (text) {
128+ if (root.state == "hidden") {
129+ root.state = "collapsed"
130+ }
131+ timer.restart()
132+ } else {
133+ timer.stop()
134+ root.state = "hidden"
135+ }
136+ }
137+ }
138+}
139
140=== added file 'tests/unittests/qml/tst_HoveredUrlLabel.qml'
141--- tests/unittests/qml/tst_HoveredUrlLabel.qml 1970-01-01 00:00:00 +0000
142+++ tests/unittests/qml/tst_HoveredUrlLabel.qml 2016-05-06 15:43:33 +0000
143@@ -0,0 +1,107 @@
144+/*
145+ * Copyright 2016 Canonical Ltd.
146+ *
147+ * This file is part of webbrowser-app.
148+ *
149+ * webbrowser-app is free software; you can redistribute it and/or modify
150+ * it under the terms of the GNU General Public License as published by
151+ * the Free Software Foundation; version 3.
152+ *
153+ * webbrowser-app is distributed in the hope that it will be useful,
154+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
155+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
156+ * GNU General Public License for more details.
157+ *
158+ * You should have received a copy of the GNU General Public License
159+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
160+ */
161+
162+import QtQuick 2.4
163+import QtTest 1.0
164+import "../../../src/app/webbrowser"
165+
166+Item {
167+ width: 200
168+ height: 200
169+
170+ Item {
171+ id: webviewMock
172+ property url hoveredUrl
173+ }
174+
175+ Loader {
176+ id: loader
177+ active: false
178+ sourceComponent: HoveredUrlLabel {
179+ webview: webviewMock
180+ }
181+ }
182+
183+ SignalSpy {
184+ id: visibleSpy
185+ target: loader.item
186+ signalName: "visibleChanged"
187+ }
188+
189+ SignalSpy {
190+ id: stateSpy
191+ target: loader.item
192+ signalName: "stateChanged"
193+ }
194+
195+ TestCase {
196+ name: "HoveredUrlLabel"
197+ when: windowShown
198+
199+ readonly property var label: loader.item
200+
201+ function init() {
202+ visibleSpy.clear()
203+ stateSpy.clear()
204+ webviewMock.hoveredUrl = ""
205+ loader.active = true
206+ }
207+
208+ function cleanup() {
209+ loader.active = false
210+ }
211+
212+ function test_states() {
213+ compare(label.state, "hidden")
214+ compare(stateSpy.count, 0)
215+ verify(!label.visible)
216+ compare(visibleSpy.count, 0)
217+
218+ webviewMock.hoveredUrl = "http://example.org"
219+ compare(label.state, "collapsed")
220+ compare(stateSpy.count, 1)
221+ verify(label.visible)
222+ compare(visibleSpy.count, 1)
223+
224+ webviewMock.hoveredUrl = "http://example.com"
225+ compare(label.state, "collapsed")
226+ compare(stateSpy.count, 1)
227+ verify(label.visible)
228+ compare(visibleSpy.count, 1)
229+
230+ stateSpy.clear()
231+ stateSpy.wait(2000)
232+ compare(label.state, "expanded")
233+ compare(stateSpy.count, 1)
234+ verify(label.visible)
235+ compare(visibleSpy.count, 1)
236+
237+ webviewMock.hoveredUrl = "http://ubuntu.com"
238+ compare(label.state, "expanded")
239+ compare(stateSpy.count, 1)
240+ verify(label.visible)
241+ compare(visibleSpy.count, 1)
242+
243+ webviewMock.hoveredUrl = ""
244+ compare(label.state, "hidden")
245+ compare(stateSpy.count, 2)
246+ verify(!label.visible)
247+ compare(visibleSpy.count, 2)
248+ }
249+ }
250+}

Subscribers

People subscribed via source and target branches

to status/vote changes: