Warning, /education/marble/examples/qml/cloud-sync/cloudsync.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2013 Dennis Nienhüser <nienhueser@kde.org>
0004 
0005 import QtQuick 1.0
0006 import org.kde.marble 0.20
0007 
0008 Rectangle {
0009     id: screen
0010     width: 1024; height: 768
0011 
0012     MarbleWidget {
0013         id: map
0014         anchors.top: parent.top
0015         anchors.right: parent.right
0016         anchors.bottom: parent.bottom
0017         anchors.left: routeView.right
0018 
0019         mapThemeId: "earth/openstreetmap/openstreetmap.dgml"
0020         activeFloatItems: [ "compass", "scalebar", "progress" ]
0021     }
0022 
0023     CloudSync {
0024         id: cloudSync
0025         map: map
0026     }
0027 
0028     Column {
0029         id: credentialsColumn
0030         anchors.top: parent.top
0031         anchors.left: parent.left
0032         anchors.margins: 10
0033         width: routeView.width
0034         spacing: 10
0035 
0036         InputField {
0037             label: "Server:"
0038             text: "myowncloudserver.com"
0039             onAccepted: cloudSync.owncloudServer = text
0040         }
0041 
0042         InputField {
0043             label: "User:"
0044             text: "myuser"
0045             onAccepted: cloudSync.owncloudUsername = text
0046         }
0047 
0048         InputField {
0049             label: "Password:"
0050             text: "mypassword"
0051             onAccepted: cloudSync.owncloudPassword = text
0052             echoMode: TextInput.Password
0053         }
0054     }
0055 
0056     ListView {
0057         id: routeView
0058         anchors.top: credentialsColumn.bottom
0059         anchors.topMargin: 5
0060         anchors.left: parent.left
0061         anchors.bottom: parent.bottom
0062         width: 400
0063         clip: true
0064 
0065         model: cloudSync.routeModel
0066         delegate: routeViewDelegate
0067         spacing: 5
0068     }
0069 
0070     Component {
0071         id: routeViewDelegate
0072         
0073         Rectangle {
0074             width: routeView.width
0075             height: Math.max( previewImage.height, nameText.height+buttonRow.height )
0076             
0077             Image {
0078                 id: previewImage
0079                 source: previewUrl
0080                 width: 128; height: 128
0081                 anchors.left: parent.left
0082             }
0083             
0084             Text {
0085                 id: nameText
0086                 text: name
0087                 anchors.left: previewImage.right
0088                 anchors.leftMargin: 5
0089                 anchors.right: parent.right
0090                 wrapMode: Text.WrapAtWordBoundaryOrAnywhere
0091             }
0092 
0093             Row {
0094                 id: buttonRow
0095                 anchors.top: nameText.bottom
0096                 anchors.left: nameText.left
0097                 anchors.leftMargin: 5
0098                 spacing: 5
0099 
0100                 Button {
0101                     id: downloadArea
0102                     visible: !isCached && isOnCloud
0103 
0104                     label: "Download"
0105                     color: "green"
0106 
0107                     onClicked: {
0108                         cloudSync.downloadRoute( identifier )
0109                     }
0110                 }
0111 
0112                 Button {
0113                     id: deleteFromCloudArea
0114                     visible: !isCached
0115 
0116                     label: "Delete from cloud"
0117                     color: "red"
0118 
0119                     onClicked: {
0120                         cloudSync.deleteRouteFromCloud( identifier )
0121                     }
0122                 }
0123 
0124                 Button {
0125                     id: openArea
0126                     visible: isCached
0127 
0128                     label: "Open"
0129                     color: "blue"
0130 
0131                     onClicked: {
0132                         cloudSync.openRoute( identifier )
0133                     }
0134                 }
0135 
0136                 Button {
0137                     id: removeFromCacheArea
0138                     visible: isCached
0139 
0140                     label: "Remove from device"
0141                     color: "yellow"
0142 
0143                     onClicked: {
0144                         cloudSync.removeRouteFromDevice( identifier )
0145                     }
0146                 }
0147 
0148                 Button {
0149                     id: uploadArea
0150                     visible: isCached && !isOnCloud
0151 
0152                     label: "Upload"
0153                     color: "grey"
0154 
0155                     onClicked: {
0156                         cloudSync.uploadRoute( identifier )
0157                     }
0158                 }
0159             }
0160         }
0161     }
0162 }