diff --git a/ground/openpilotgcs/src/plugins/coreplugin/core.qrc b/ground/openpilotgcs/src/plugins/coreplugin/core.qrc index 85ca549e6..268eb4808 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/core.qrc +++ b/ground/openpilotgcs/src/plugins/coreplugin/core.qrc @@ -64,7 +64,8 @@ images/tx-rx.svg qml/images/tab.png qml/AboutDialog.qml - qml/FlickableWebView.qml + qml/AuthorsModel.qml + qml/ScrollDecorator.qml qml/TabWidget.qml diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml index e9190b082..1f2706079 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml +++ b/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml @@ -39,72 +39,74 @@ ****************************************************************************/ import QtQuick 1.1 - import QtWebKit 1.0 + // This is a tabbed pane element. Add a nested Rectangle to add a tab. TabWidget { - id: tabs - width: 640; height: 480 - // This tab is for the GCS version information - Rectangle { - property string title: "OpenPilot GCS" - anchors.fill: parent - color: "#e3e3e3" - - Rectangle { - anchors.fill: parent; anchors.margins: 20 - color: "#e3e3e3" - Image { - source: "../images/openpilot_logo_128.png" - x: 0; y: 0; z: 100 - fillMode: Image.PreserveAspectFit - } - Flickable { - anchors.fill: parent - anchors.centerIn: parent - Text { - id: versionLabel - x: 156; y: 0 - width: 430; height: 379 - horizontalAlignment: Qt.AlignLeft - font.pixelSize: 12 - wrapMode: Text.WordWrap - // @var version exposed in authorsdialog.cpp - text: version - } - } + // Define AuthorsModel as type + property AuthorsModel authors: AuthorsModel {} + + id: tabs + width: 640; height: 480 + // This tab is for the GCS version information + Rectangle { + property string title: "OpenPilot GCS" + anchors.fill: parent + color: "#e3e3e3" + + Rectangle { + anchors.fill: parent; anchors.margins: 20 + color: "#e3e3e3" + Image { + source: "../images/openpilot_logo_128.png" + x: 0; y: 0; z: 100 + fillMode: Image.PreserveAspectFit + } + Flickable { + anchors.fill: parent + anchors.centerIn: parent + Text { + id: versionLabel + x: 156; y: 0 + width: 430; height: 379 + horizontalAlignment: Qt.AlignLeft + font.pixelSize: 12 + wrapMode: Text.WordWrap + // @var version exposed in authorsdialog.cpp + text: version + } } } - // This is a stub for the Plugins. - // 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 + } + + // This tab is for the authors/contributors/credits + Rectangle { + property string title: "Authors" + anchors.fill: parent; color: "#e3e3e3" Rectangle { - property string title: "Authors" - anchors.fill: parent; color: "#e3e3e3" - Rectangle { - anchors.fill: parent; anchors.margins: 20 - color: "#e3e3e3" - FlickableWebView { - id: webView - z: 0 - url: "../CREDITS.html" - anchors { top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom } - } - } - } - } + anchors.fill: parent; anchors.margins: 20 + color: "#e3e3e3" + Text { + id: description + text: "

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.

This list is sorted alphabetically by name

" + width: 600 + 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 + } + } + } +} diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml new file mode 100644 index 000000000..b55ee86e9 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml @@ -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" } +} \ No newline at end of file diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/FlickableWebView.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/FlickableWebView.qml deleted file mode 100644 index 3043ce88a..000000000 --- a/ground/openpilotgcs/src/plugins/coreplugin/qml/FlickableWebView.qml +++ /dev/null @@ -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) - } -} diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml new file mode 100644 index 000000000..24c79c927 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml @@ -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 + } + } +}