I have made the following changes intended for : CE:Apps / heliumreborn Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.pub.meego.com//request/show/6629 Thank You, John Brooks [This message was auto-generated] --- Request # 6629: Messages from BOSS: State: review at 2012-09-04T07:44:16 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:special:branches:CE:Apps / heliumreborn -> CE:Apps / heliumreborn changes files: -------------- --- heliumreborn.changes +++ heliumreborn.changes @@ -0,0 +1,4 @@ +* Tue Sep 04 2012 John Brooks <[email protected]> - 1.1.3 +- Fixes NEMO#107: Pinch zoom support added (from Marko Gronbarj) +- Pinch-to-zoom improvements & bounceback (from Marko Gronbarj) + old: ---- 0001-Fix-NEMO-215-changed-title-to-Browser.patch 0001-New-implementation-for-Pinch-zoom.patch heliumreborn-1.1.2.tar.bz2 new: ---- heliumreborn-1.1.3.tar.bz2 spec files: ----------- --- heliumreborn.spec +++ heliumreborn.spec @@ -1,6 +1,6 @@ # # Do NOT Edit the Auto-generated Part! -# Generated by: spectacle version 0.24 +# Generated by: spectacle version 0.25 # Name: heliumreborn @@ -9,7 +9,7 @@ # << macros Summary: Helium Mobile browser ported to MeeGo Qt Quick Components -Version: 1.1.2 +Version: 1.1.3 Release: 1 Group: System/Libraries License: LGPL v2.1 @@ -19,8 +19,6 @@ Source2: portrait.png Source3: landscape.png Source100: heliumreborn.yaml -Patch0: 0001-Fix-NEMO-215-changed-title-to-Browser.patch -Patch1: 0001-New-implementation-for-Pinch-zoom.patch Requires: /usr/bin/update-desktop-database BuildRequires: pkgconfig(QtCore) >= 4.7.0 BuildRequires: pkgconfig(QtOpenGL) @@ -35,12 +33,8 @@ %prep -%setup -q -n %{name}-%{version} +%setup -q -n %{name} -# 0001-Fix-NEMO-215-changed-title-to-Browser.patch -%patch0 -p1 -# 0001-New-implementation-for-Pinch-zoom.patch -%patch1 -p1 # >> setup # << setup other changes: -------------- ++++++ heliumreborn-1.1.2.tar.bz2 -> heliumreborn-1.1.3.tar.bz2 --- main.cpp +++ main.cpp @@ -15,7 +15,7 @@ core = new Core(viewer->getView()); } - viewer->getView()->setWindowTitle("HeliumReborn"); + viewer->getView()->setWindowTitle("Browser"); viewer->setMainQmlFile("qrc:/qmls/qml/HeliumReborn/main.qml"); core->start(); --- qml/HeliumReborn/FlickableWebView.qml +++ qml/HeliumReborn/FlickableWebView.qml @@ -21,6 +21,7 @@ */ import Qt 4.7 +import QtQuick 1.1 import QtWebKit 1.0 Flickable { @@ -36,6 +37,7 @@ property alias forward: webView.forward property alias icon: webView.icon property bool loading: webView.progress != 1.0 + property bool zoomActive: false // Signals signal gotFocus @@ -58,6 +60,7 @@ webView.contentsScale = width / webView.width * webView.contentsScale; } + pressDelay: 200 // interactive: webView.focus // If the "webView" has focus, then it's flickable onFocusChanged: { if ( focus ) webView.focus = true; } // Force focus on "webView" when received @@ -65,128 +68,177 @@ onMovementStarted: webView.renderingEnabled = false; onMovementEnded: webView.renderingEnabled = true; + PinchArea { + id: pinchArea + anchors.fill: parent + property bool pinchDragged:false - WebView { - id: webView - objectName: "webView" - transformOrigin: Item.TopLeft - - // Set the URL for this WebView - function setUrl(urlString) { this.url = appcore.fixUrl(urlString); } -//function setUrl(urlString) { this.url = urlString; } - // Execute the Zooming - function doZoom(zoom,centerX,centerY) - { - if (centerX) { - var sc = zoom/contentsScale; - scaleAnim.to = zoom; - flickVX.from = flickable.contentX - flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width)) - finalX.value = flickVX.to - flickVY.from = flickable.contentY - flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height)) - finalY.value = flickVY.to - quickZoom.start() - } + onPinchStarted: { + webView.renderingEnabled=false + flickable.zoomActive=true } - //url:"http://www.connecting.nokia.com/" - url: { - appcore.fixUrl(appcore.currentUrl); - - } - Connections { - target: appcore - onCurrentUrlChanged: { webView.url = appcore.fixUrl(appcore.currentUrl); } - onShowingBrowserView: { webView.focus = true; } + onPinchUpdated: { + webView.doPinchZoom(pinch.scale/pinch.previousScale,pinch.center,pinch.previousCenter) } - smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions - focus: true + onPinchFinished: { - preferredWidth: flickable.width - preferredHeight: flickable.height - contentsScale: 1 - - // [Signal Handling] - Keys.onLeftPressed: { webView.contentsScale -= 0.1; } - Keys.onRightPressed: { webView.contentsScale += 0.1; } - onAlert: { console.log(message); } - onFocusChanged: { - if ( focus == true ) { flickable.gotFocus(); } - else { flickable.lostFocus(); } - } - onContentsSizeChanged: { webView.contentsScale = Math.min(1,flickable.width / contentsSize.width); } - onUrlChanged: { - // Reset Content to the TopLeft Corner - flickable.contentX = 0 - flickable.contentY = 0 - webView.focus = true; - if ( url != null ) { - flickable.urlChanged(url.toString()); + if(contentX<0 || contentY<0){ + var sc = webView.contentsScale + if(webView.contentsScale*webView.contentsSize.width<flickable.width){ + sc=flickable.width/(webView.contentsSize.width/webView.contentsScale) + } + var vx=Math.max(0,contentX)+(flickable.width/2) + var vy=Math.max(0,contentY)+(flickable.height/2) + // doZoom will reset zoomActive to false and renderingEnabled to true + webView.doZoom(sc,vx,vy); + }else{ + webView.renderingEnabled=true; + flickable.zoomActive=false; } + } - onDoubleClick: { - if (!heuristicZoom(clickX, clickY, 2.5)) { - var zf = flickable.width / contentsSize.width; - if (zf >= contentsScale) { - zf = 2.0 // zoom in (else zooming out) + + WebView { + id: webView + objectName: "webView" + transformOrigin: Item.TopLeft + + // Set the URL for this WebView + function setUrl(urlString) { this.url = appcore.fixUrl(urlString); } + //function setUrl(urlString) { this.url = urlString; } + // Execute the Zooming + function doZoom(zoom,centerX,centerY) + { + if (centerX) { + var sc = zoom/contentsScale; + scaleAnim.to = zoom; + flickVX.from = flickable.contentX + flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width)) + finalX.value = flickVX.to + flickVY.from = flickable.contentY + flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height)) + finalY.value = flickVY.to + quickZoom.start() } - doZoom(zf,clickX*zf,clickY*zf) } - } - onIconChanged: { flickable.iconChanged(); } - onLoadFinished: { if ( appcore ) { appcore.historyCurrentUrl(); } } - onLoadFailed: { webView.stop.trigger(); } - onZoomTo: { doZoom(zoom,centerX,centerY); } - // [/Signal Handling] - - SequentialAnimation { - id: quickZoom - - PropertyAction { - target: webView - property: "renderingEnabled" - value: false - } - ParallelAnimation { - NumberAnimation { - id: scaleAnim - target: webView; property: "contentsScale"; - // the to property is set before calling - easing.type: Easing.Linear; duration: 200; + // Calculates new contentX and contentY for flickable and contentsScale for webview + function doPinchZoom(zoom,center,centerPrev) + { + var sc=zoom*contentsScale + if(sc<=10 ){ + //calculate contentX and contentY so webview moves along with the pinch + flickable.contentX=(center.x*zoom)-(center.x-flickable.contentX)+(centerPrev.x-center.x) + flickable.contentY=(center.y*zoom)-(center.y-flickable.contentY)+(centerPrev.y-center.y) + contentsScale=sc + } + + } + + //url:"http://www.connecting.nokia.com/" + url: { + appcore.fixUrl(appcore.currentUrl); + + } + Connections { + target: appcore + onCurrentUrlChanged: { webView.url = appcore.fixUrl(appcore.currentUrl); } + onShowingBrowserView: { webView.focus = true; } + } + + smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions + focus: true + + preferredWidth: flickable.width + preferredHeight: flickable.height + contentsScale: 1 + + // [Signal Handling] + Keys.onLeftPressed: { webView.contentsScale -= 0.1; } + Keys.onRightPressed: { webView.contentsScale += 0.1; } + onAlert: { console.log(message); } + onFocusChanged: { + if ( focus == true ) { flickable.gotFocus(); } + else { flickable.lostFocus(); } + } + onContentsSizeChanged: { webView.contentsScale = Math.min(1,flickable.width / contentsSize.width); } + onUrlChanged: { + // Reset Content to the TopLeft Corner + flickable.contentX = 0 + flickable.contentY = 0 + webView.focus = true; + if ( url != null ) { + flickable.urlChanged(url.toString()); + } + } + onDoubleClick: { + if (!heuristicZoom(clickX, clickY, 2.5)) { + + var zf = flickable.width / contentsSize.width; + if (zf >= contentsScale) { + zf = 2.0 // zoom in (else zooming out) + } + doZoom(zf,clickX*zf,clickY*zf) } - NumberAnimation { - id: flickVX + } + onIconChanged: { flickable.iconChanged(); } + onLoadFinished: { if ( appcore ) { appcore.historyCurrentUrl(); } } + onLoadFailed: { webView.stop.trigger(); } + onZoomTo: { doZoom(zoom,centerX,centerY); } + // [/Signal Handling] + + SequentialAnimation { + id: quickZoom + + PropertyAction { + target: webView + property: "renderingEnabled" + value: false + } + ParallelAnimation { + NumberAnimation { + id: scaleAnim + target: webView; property: "contentsScale"; + // the to property is set before calling + easing.type: Easing.Linear; duration: 200; + } + NumberAnimation { + id: flickVX + target: flickable; property: "contentX"; + easing.type: Easing.Linear; duration: 200; + from: 0 // set before calling + to: 0 // set before calling + } + NumberAnimation { + id: flickVY + target: flickable; property: "contentY"; + easing.type: Easing.Linear; duration: 200; + from: 0 // set before calling + to: 0 // set before calling + } + } + // Have to set the contentXY, since the above 2 + // size changes may have started a correction if + // contentsScale < 1.0. + PropertyAction { + id: finalX target: flickable; property: "contentX"; - easing.type: Easing.Linear; duration: 200; - from: 0 // set before calling - to: 0 // set before calling + value: 0 // set before calling } - NumberAnimation { - id: flickVY + PropertyAction { + id: finalY target: flickable; property: "contentY"; - easing.type: Easing.Linear; duration: 200; - from: 0 // set before calling - to: 0 // set before calling - } - } - // Have to set the contentXY, since the above 2 - // size changes may have started a correction if - // contentsScale < 1.0. - PropertyAction { - id: finalX - target: flickable; property: "contentX"; - value: 0 // set before calling - } - PropertyAction { - id: finalY - target: flickable; property: "contentY"; - value: 0 // set before calling - } - PropertyAction { - target: webView; property: "renderingEnabled"; - value: true + value: 0 // set before calling + } + PropertyAction { + target: webView; property: "renderingEnabled"; + value: true + } + PropertyAction { + target: flickable; property: "zoomActive"; + value: false + } } } } --- qml/HeliumReborn/Header.qml +++ qml/HeliumReborn/Header.qml @@ -56,9 +56,10 @@ width: parent.width height: parent.height - x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width + //in case zoom is active don't move the header along panning + x: webView.zoomActive?0 : webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width ? -webView.contentX+webView.contentWidth-webView.width : 0 - y: webView.contentY < 0 ? -webView.contentY : progressOff* + y: webView.contentY < 0 ? webView.zoomActive ? 0: -webView.contentY : progressOff* (webView.contentY>height?-height:-webView.contentY) // Busy Loading Icon ++++++ heliumreborn.yaml --- heliumreborn.yaml +++ heliumreborn.yaml @@ -1,6 +1,6 @@ Name: heliumreborn Summary: Helium Mobile browser ported to MeeGo Qt Quick Components -Version: 1.1.2 +Version: 1.1.3 Release: 1 Group: System/Libraries License: LGPL v2.1 @@ -10,9 +10,6 @@ - heliumreborn.desktop - portrait.png - landscape.png -Patches: - - 0001-Fix-NEMO-215-changed-title-to-Browser.patch - - 0001-New-implementation-for-Pinch-zoom.patch Description: Helium Mobile browser ported to Qt Quick Components for Nemo Mobile. Configure: none Builder: qmake ++++++ deleted files: --- 0001-Fix-NEMO-215-changed-title-to-Browser.patch --- 0001-New-implementation-for-Pinch-zoom.patch
