mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-12 04:29:16 +01:00
OP-791 FIXED issue where Flickable web view would need to be dragged to scroll content
Replaced Flickable component with ListView for the Authors list. Signed-off-by: Kevin Vertucio <kevinv033@gmail.com>
This commit is contained in:
parent
273d6cb1d2
commit
1e2e93b8c0
@ -64,7 +64,8 @@
|
|||||||
<file>images/tx-rx.svg</file>
|
<file>images/tx-rx.svg</file>
|
||||||
<file>qml/images/tab.png</file>
|
<file>qml/images/tab.png</file>
|
||||||
<file>qml/AboutDialog.qml</file>
|
<file>qml/AboutDialog.qml</file>
|
||||||
<file>qml/FlickableWebView.qml</file>
|
<file>qml/AuthorsModel.qml</file>
|
||||||
|
<file>qml/ScrollDecorator.qml</file>
|
||||||
<file>qml/TabWidget.qml</file>
|
<file>qml/TabWidget.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -41,8 +41,12 @@
|
|||||||
import QtQuick 1.1
|
import QtQuick 1.1
|
||||||
import QtWebKit 1.0
|
import QtWebKit 1.0
|
||||||
|
|
||||||
|
|
||||||
// This is a tabbed pane element. Add a nested Rectangle to add a tab.
|
// This is a tabbed pane element. Add a nested Rectangle to add a tab.
|
||||||
TabWidget {
|
TabWidget {
|
||||||
|
// Define AuthorsModel as type
|
||||||
|
property AuthorsModel authors: AuthorsModel {}
|
||||||
|
|
||||||
id: tabs
|
id: tabs
|
||||||
width: 640; height: 480
|
width: 640; height: 480
|
||||||
// This tab is for the GCS version information
|
// This tab is for the GCS version information
|
||||||
@ -75,36 +79,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This is a stub for the Plugins.
|
// This tab is for the authors/contributors/credits
|
||||||
// Rectangle {
|
|
||||||
// property string title: "Plugins"
|
|
||||||
// anchors.fill: parent
|
|
||||||
// color: "#e3e3e3"
|
|
||||||
//
|
|
||||||
// Rectangle {
|
|
||||||
// anchors.fill: parent; anchors.margins: 20
|
|
||||||
// color: "#7fff7f"
|
|
||||||
// Text {
|
|
||||||
// width: parent.width - 20
|
|
||||||
// anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
|
|
||||||
// font.pixelSize: 20
|
|
||||||
// wrapMode: Text.WordWrap
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// This tab is for the authors/contributors/credits
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property string title: "Authors"
|
property string title: "Authors"
|
||||||
anchors.fill: parent; color: "#e3e3e3"
|
anchors.fill: parent; color: "#e3e3e3"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent; anchors.margins: 20
|
anchors.fill: parent; anchors.margins: 20
|
||||||
color: "#e3e3e3"
|
color: "#e3e3e3"
|
||||||
FlickableWebView {
|
Text {
|
||||||
id: webView
|
id: description
|
||||||
z: 0
|
text: "<h4>These people have been key contributors to the OpenPilot project. Without the work of the people in this list, OpenPilot would not be what it is today.</h4><p>This list is sorted alphabetically by name</p>"
|
||||||
url: "../CREDITS.html"
|
width: 600
|
||||||
anchors { top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom }
|
wrapMode: Text.WordWrap
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
ListView {
|
||||||
}
|
id: authorsView
|
||||||
|
y: description.y + description.height + 20
|
||||||
|
width: parent.width; height: parent.height - description.height - 20
|
||||||
|
spacing: 3
|
||||||
|
model: authors
|
||||||
|
delegate: Text {
|
||||||
|
text: name
|
||||||
|
}
|
||||||
|
clip: true
|
||||||
|
}
|
||||||
|
ScrollDecorator {
|
||||||
|
flickableItem: authorsView
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
151
ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml
Normal file
151
ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
This list model was created for the AuthorsDialog.
|
||||||
|
*/
|
||||||
|
import QtQuick 1.1
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
|
||||||
|
ListElement{ name:"Connor Abbott" }
|
||||||
|
|
||||||
|
ListElement{ name:"David Ankers" }
|
||||||
|
|
||||||
|
ListElement{ name:"Sergiy Anikeyev" }
|
||||||
|
|
||||||
|
ListElement{ name:"Pedro Assuncao" }
|
||||||
|
|
||||||
|
ListElement{ name:"Fredrik Arvidsson" }
|
||||||
|
|
||||||
|
ListElement{ name:"Werner Backes" }
|
||||||
|
|
||||||
|
ListElement{ name:"Jose Barros" }
|
||||||
|
|
||||||
|
ListElement{ name:"Pete Boehl" }
|
||||||
|
|
||||||
|
ListElement{ name:"David Carlson" }
|
||||||
|
|
||||||
|
ListElement{ name:"James Cotton" }
|
||||||
|
|
||||||
|
ListElement{ name:"Steve Doll" }
|
||||||
|
|
||||||
|
ListElement{ name:"Piotr Esden-Tempski" }
|
||||||
|
|
||||||
|
ListElement{ name:"Richard Flay" }
|
||||||
|
|
||||||
|
ListElement{ name:"Peter Farnworth" }
|
||||||
|
|
||||||
|
ListElement{ name:"Ed Faulkner" }
|
||||||
|
|
||||||
|
ListElement{ name:"Darren Furniss" }
|
||||||
|
|
||||||
|
ListElement{ name:"Frederic Goddeeris" }
|
||||||
|
|
||||||
|
ListElement{ name:"Daniel Godin" }
|
||||||
|
|
||||||
|
ListElement{ name:"Bani Greyling" }
|
||||||
|
|
||||||
|
ListElement{ name:"Nuno Guedes" }
|
||||||
|
|
||||||
|
ListElement{ name:"Erik Gustavsson" }
|
||||||
|
|
||||||
|
ListElement{ name:"Peter Gunnarsson" }
|
||||||
|
|
||||||
|
ListElement{ name:"Dean Hall" }
|
||||||
|
|
||||||
|
ListElement{ name:"Joe Hlebasko" }
|
||||||
|
|
||||||
|
ListElement{ name:"Andy Honecker" }
|
||||||
|
|
||||||
|
ListElement{ name:"Ryan Hunt" }
|
||||||
|
|
||||||
|
ListElement{ name:"Mark James" }
|
||||||
|
|
||||||
|
ListElement{ name:"Sami Korhonen" }
|
||||||
|
|
||||||
|
ListElement{ name:"Thorsten Klose" }
|
||||||
|
|
||||||
|
ListElement{ name:"Hallvard Kristiansen" }
|
||||||
|
|
||||||
|
ListElement{ name:"Edouard Lafargue" }
|
||||||
|
|
||||||
|
ListElement{ name:"Mike Labranche" }
|
||||||
|
|
||||||
|
ListElement{ name:"Fredrik Larsson" }
|
||||||
|
|
||||||
|
ListElement{ name:"Pablo Lema" }
|
||||||
|
|
||||||
|
ListElement{ name:"David Llama" }
|
||||||
|
|
||||||
|
ListElement{ name:"Matt Lipski" }
|
||||||
|
|
||||||
|
ListElement{ name:"Les Newell" }
|
||||||
|
|
||||||
|
ListElement{ name:"Ken Northup" }
|
||||||
|
|
||||||
|
ListElement{ name:"Greg Matthews" }
|
||||||
|
|
||||||
|
ListElement{ name:"Guy McCaldin" }
|
||||||
|
|
||||||
|
ListElement{ name:"Gary Mortimer" }
|
||||||
|
|
||||||
|
ListElement{ name:"Alessio Morale" }
|
||||||
|
|
||||||
|
ListElement{ name:"Cathy Moss" }
|
||||||
|
|
||||||
|
ListElement{ name:"Angus Peart" }
|
||||||
|
|
||||||
|
ListElement{ name:"Dmytro Poplavskiy" }
|
||||||
|
|
||||||
|
ListElement{ name:"Eric Price" }
|
||||||
|
|
||||||
|
ListElement{ name:"Richard Querin" }
|
||||||
|
|
||||||
|
ListElement{ name:"Randy Ram" }
|
||||||
|
|
||||||
|
ListElement{ name:"Laurent Ribon" }
|
||||||
|
|
||||||
|
ListElement{ name:"Julien Rouviere" }
|
||||||
|
|
||||||
|
ListElement{ name:"Jackson Russell" }
|
||||||
|
|
||||||
|
ListElement{ name:"Zik Saleeba" }
|
||||||
|
|
||||||
|
ListElement{ name:"Professor Dale Schinstock" }
|
||||||
|
|
||||||
|
ListElement{ name:"Professor Kenn Sebesta" }
|
||||||
|
|
||||||
|
ListElement{ name:"Oleg Semyonov" }
|
||||||
|
|
||||||
|
ListElement{ name:"Stacey Sheldon" }
|
||||||
|
|
||||||
|
ListElement{ name:"Troy Schultz" }
|
||||||
|
|
||||||
|
ListElement{ name:"Dr. Erhard Siegl" }
|
||||||
|
|
||||||
|
ListElement{ name:"Mike Smith" }
|
||||||
|
|
||||||
|
ListElement{ name:"Alex Sowa" }
|
||||||
|
|
||||||
|
ListElement{ name:"Pete Stapley" }
|
||||||
|
|
||||||
|
ListElement{ name:"Rowan Taubitz" }
|
||||||
|
|
||||||
|
ListElement{ name:"Andrew Thoms" }
|
||||||
|
|
||||||
|
ListElement{ name:"Jasper van Loenen" }
|
||||||
|
|
||||||
|
ListElement{ name:"Vassilis Varveropoulos" }
|
||||||
|
|
||||||
|
ListElement{ name:"Kevin Vertucio" }
|
||||||
|
|
||||||
|
ListElement{ name:"Alex Vrubel" }
|
||||||
|
|
||||||
|
ListElement{ name:"Brian Webb" }
|
||||||
|
|
||||||
|
ListElement{ name:"Justin Welander" }
|
||||||
|
|
||||||
|
ListElement{ name:"Mat Wellington" }
|
||||||
|
|
||||||
|
ListElement{ name:"Kendal Wells" }
|
||||||
|
|
||||||
|
ListElement{ name:"Dmitriy Zaitsev" }
|
||||||
|
}
|
@ -1,196 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/
|
|
||||||
**
|
|
||||||
** This file is part of the QtDeclarative module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** This file may be used under the terms of the GNU Lesser General Public
|
|
||||||
** License version 2.1 as published by the Free Software Foundation and
|
|
||||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU Lesser
|
|
||||||
** General Public License version 2.1 requirements will be met:
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License version 3.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU General
|
|
||||||
** Public License version 3.0 requirements will be met:
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms and
|
|
||||||
** conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
import QtQuick 1.0
|
|
||||||
import QtWebKit 1.0
|
|
||||||
|
|
||||||
Flickable {
|
|
||||||
property alias title: webView.title
|
|
||||||
property alias icon: webView.icon
|
|
||||||
property alias progress: webView.progress
|
|
||||||
property alias url: webView.url
|
|
||||||
property alias back: webView.back
|
|
||||||
property alias stop: webView.stop
|
|
||||||
property alias reload: webView.reload
|
|
||||||
property alias forward: webView.forward
|
|
||||||
|
|
||||||
id: flickable
|
|
||||||
width: parent.width
|
|
||||||
contentWidth: Math.max(parent.width,webView.width)
|
|
||||||
contentHeight: Math.max(parent.height,webView.height)
|
|
||||||
// anchors.top: headerSpace.bottom
|
|
||||||
anchors.bottom: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
pressDelay: 200
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
onWidthChanged : {
|
|
||||||
// Expand (but not above 1:1) if otherwise would be smaller that available width.
|
|
||||||
if (width > webView.width*webView.contentsScale && webView.contentsScale < 1.0)
|
|
||||||
webView.contentsScale = width / webView.width * webView.contentsScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
WebView {
|
|
||||||
id: webView
|
|
||||||
transformOrigin: Item.TopLeft
|
|
||||||
|
|
||||||
function fixUrl(url)
|
|
||||||
{
|
|
||||||
if (url == "") return url
|
|
||||||
if (url[0] == "/") return "file://"+url
|
|
||||||
if (url.indexOf(":")<0) {
|
|
||||||
if (url.indexOf(".")<0 || url.indexOf(" ")>=0) {
|
|
||||||
// Fall back to a search engine; hard-code Wikipedia
|
|
||||||
return "http://en.wikipedia.org/w/index.php?search="+url
|
|
||||||
} else {
|
|
||||||
return "http://"+url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
|
|
||||||
url: fixUrl(webBrowser.urlString)
|
|
||||||
smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions
|
|
||||||
focus: true
|
|
||||||
|
|
||||||
onAlert: console.log(message)
|
|
||||||
|
|
||||||
function doZoom(zoom,centerX,centerY)
|
|
||||||
{
|
|
||||||
if (centerX) {
|
|
||||||
var sc = zoom*contentsScale;
|
|
||||||
scaleAnim.to = sc;
|
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onLeftPressed: webView.contentsScale -= 0.1
|
|
||||||
Keys.onRightPressed: webView.contentsScale += 0.1
|
|
||||||
|
|
||||||
preferredWidth: flickable.width
|
|
||||||
preferredHeight: flickable.height
|
|
||||||
contentsScale: 1
|
|
||||||
onContentsSizeChanged: {
|
|
||||||
// zoom out
|
|
||||||
contentsScale = Math.min(1,flickable.width / contentsSize.width)
|
|
||||||
}
|
|
||||||
onUrlChanged: {
|
|
||||||
// got to topleft
|
|
||||||
flickable.contentX = 0
|
|
||||||
flickable.contentY = 0
|
|
||||||
// if (url != null) { header.editUrl = url.toString(); }
|
|
||||||
}
|
|
||||||
onDoubleClick: {
|
|
||||||
if (!heuristicZoom(clickX,clickY,2.5)) {
|
|
||||||
var zf = flickable.width / contentsSize.width
|
|
||||||
if (zf >= contentsScale)
|
|
||||||
zf = 2.0*contentsScale // zoom in (else zooming out)
|
|
||||||
doZoom(zf,clickX*zf,clickY*zf)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
value: 0 // set before calling
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
id: finalY
|
|
||||||
target: flickable
|
|
||||||
property: "contentY"
|
|
||||||
value: 0 // set before calling
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: webView
|
|
||||||
property: "renderingEnabled"
|
|
||||||
value: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onZoomTo: doZoom(zoom,centerX,centerY)
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,40 @@
|
|||||||
|
import QtQuick 1.1
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: scrollDecorator
|
||||||
|
|
||||||
|
property Flickable flickableItem: null
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: scrollLoader
|
||||||
|
sourceComponent: scrollDecorator.flickableItem ? scrollBar : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onDestruction: scrollLoader.sourceComponent = undefined
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: scrollBar
|
||||||
|
Rectangle {
|
||||||
|
property Flickable flickable: scrollDecorator.flickableItem
|
||||||
|
|
||||||
|
parent: flickable
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
smooth: true
|
||||||
|
radius: 2
|
||||||
|
color: "gray"
|
||||||
|
border.color: "lightgray"
|
||||||
|
border.width: 1.0
|
||||||
|
opacity: flickable.moving ? 0.8 : 0.4
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation { duration: 500 }
|
||||||
|
}
|
||||||
|
|
||||||
|
width: 4
|
||||||
|
height: flickable.height * (flickable.height / flickable.contentHeight)
|
||||||
|
y: flickable.height * (flickable.contentY / flickable.contentHeight)
|
||||||
|
visible: flickable.height < flickable.contentHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user