Subversion Repositories harbour-w3w

Rev

Rev 5 | Blame | Compare with Previous | Last modification | View Log | RSS feed

[Idee für die API]

$Id$

1.
    TODO a.1) Emulatorerkennung einbauen -> über Buildkonfig ?
    NOTE a.2) Progressindikator einbauen, damit der Nutzer erkennt das was passiert
    b.2) SQL lite DB ?  V2
    b.3) convert 3wa to geo     V1.5
    b.4) integration mit maps -> anzeigen der aktuellen Position auf Karten in Puremaps V2
    c) CoverPage implementierung    V1
    d) Settings erweitern
    d.1) Sprache hinzufügen für die Konvertierung der 3wa Adressen und das Frontend -> aus den Systemeinstellungen ?    V2
    d.2) aktuell gewählte Sprache in den Settings muss im Menuitem gewählt werden
    e) warte Funkion einbauen, die eine Abfrage erst ermöglicht wenn (latitudeValid|longitudeValid)=true sind


3. mobile APP -> w3w API
4. mobile APP -> webservice -> w3w API

Notiz:
    - beide Wege sind entsprechend der w3w API Lizenz ungültig, wenn dabei ein API-key genutzt wird
    - Weg 1 wäre möglich, wenn sich jeder Nutzer einen eigenen API-Key anlegt
    - Weg 2 wiederspricht der Lizenz, da man eine API über eine API legt die aber die gleiche Funktion hat
    = bei w3w per Mail fragen, wie man dieses Problem lösen soll, evtl. gibt es hier einen gesonderten API key


[Vorgehen]
X 1. GPS Korrdinaten auslesen
X 2. auf klick w3w API requests absenden gegen API
X 3. Darstellung der aktuellen Koordinaten in dezimalgrad Angabe lon,lat und in w3w Angabe


[side notes]
    - Konfigurations Keys:
        key: "/apps/harbour-w3w/settings/w3wAPIkey"



### documentation
https://qt-project.org/doc/qt-5.1/qtdoc/qtquick-qtquicktest.html
https://github.com/amarchen/helloworld-pro-sailfish
https://pyotherside.readthedocs.io/en/latest/#call

#### pyotherside zur Applikation hinzufügen
 1. üblichen code schreiben
 2. zum rpm paket muss die yaml datei noch um die Anforderung von pyotherside ergänzt werden
    mit
        Requires: pyotherside-qml-plugin-python3-qt5

### examples


Notifications auslösen:
/* Notifications auf dem Hauptschirm
 * https://sailfishos.org/develop/docs/nemo-qml-plugin-notifications/qml-nemo-notifications-notification.html/

 *  1. Notification Objekt instanzieren und mit Daten füllen
 *   a) summary ist die Überschrift
 *   b) body ist der Inhalt
 *   c) onClicked ist die Aktion die ausgeführt wird
 *  2. notification.publish() (id der Instanz .publish() ist die Aktion
 */

Button {
     Notification {
         id: notification2

         summary: "Notification summary"
         body: "Notification body"
         icon: "/usr/share/example-app/icon-l-application"

         onClicked: console.log("Clicked")
     }


     text: "Application notification" + (notification2.replacesId ? " ID:" + notification2.replacesId : "")
     onClicked: notification2.publish()
 }

Button {
     Notification {
         id: notification
         category: "x-nemo.example"
         appName: "Example App"
         appIcon: "/usr/share/example-app/icon-l-application"
         summary: "Notification summary"
         body: "Notification body"
         previewSummary: "Notification preview summary"
         previewBody: "Notification preview body"
         itemCount: 5
         timestamp: "2013-02-20 18:21:00"
         remoteActions: [ {
             "name": "default",
             "displayName": "Do something",
             "icon": "icon-s-do-it",
             "service": "org.nemomobile.example",
             "path": "/example",
             "iface": "org.nemomobile.example",
             "method": "doSomething",
             "arguments": [ "argument", 1 ]
         },{
             "name": "ignore",
             "displayName": "Ignore the problem",
             "icon": "icon-s-ignore",
             "service": "org.nemomobile.example",
             "path": "/example",
             "iface": "org.nemomobile.example",
             "method": "ignore",
             "arguments": [ "argument", 1 ]
         } ]
         onClicked: console.log("Clicked")
         onClosed: console.log("Closed, reason: " + reason)
     }
     text: "Application notification" + (notification.replacesId ? " ID:" + notification.replacesId : "")
     onClicked: notification.publish()
 }
}





############## more examples

import QtQuick 2.0
import Sailfish.Silica 1.0

ApplicationWindow {

    // Chapter 1: Basic primitives
    Image {
        visible: false
        source: "jolla.png"
        Behavior on opacity { NumberAnimation {} }
        MouseArea {
            anchors.fill: parent
            onClicked: parent.opacity = parent.opacity == 0 ? 1.0 : 0.0
        }
    }

    // Chapter 2: Positioning
    Column { // or Row, Grid, Flow
        visible: false
        spacing: Theme.paddingLarge
        anchors.centerIn: parent
        Button {
            text: "Hello world!"
        }
        Button {
            text: "Hello world!"
        }
        Button {
            text: "Hello world!"
        }
    }

    // Chapter 3: Creating views

    // Sub-chapter 3.1: Content list
    initialPage: Page {
        SilicaListView {
            model: 200
            opacity: model.ready ? 1.0 : 0.0
            Behavior on opacity { FadeAnimation {} }
            width: parent.width
            clip: true
            anchors {
                top: parent.top
                bottom: panel.top
            }
            PullDownMenu {
                MenuItem {
                    text: "Settings"
                    onClicked: pageStack.push(settingsPage)
                }
                MenuItem {
                    text: panel.open ? "Close panel" : "Open panel"
                    onClicked: panel.open = !panel.open
                }
            }
            header: PageHeader { title: "App name" }
            delegate: ListItem {
                onClicked: pageStack.push(gridPage)
                menu: ContextMenu {
                    MenuItem { text: "Move to top" }
                    MenuItem {
                        text: "Delete"
                        onClicked: remorseAction("Deleting", function () { animateRemoval(listItem)})
                    }
                }

                Label {
                    text: "Item " + model.index
                    font.pixelSize: Theme.fontSizeLarge
                    anchors.verticalCenter: parent.verticalCenter
                    color: highlighted ? Theme.highlightColor : Theme.primaryColor
                    x: Theme.paddingLarge
                }
            }
            VerticalScrollDecorator {}
        }

        // Chapter 7: Adding panels
        DockedPanel {
            id: panel
            width: parent.width
            height: row.height + Theme.paddingLarge*2
            Row {
                id: row
                anchors.centerIn: parent
                IconButton {
                    icon.source: "image://theme/icon-m-previous"
                }
                IconButton {
                    property bool playing
                    icon.source: "image://theme/icon-l-" + (playing ? "pause" : "play")
                    onClicked: playing = !playing
                }
                IconButton {
                    icon.source: "image://theme/icon-m-next"
                }
            }
        }

        // Sub-chapter 3.2: Visual grid
        Component {
            id: gridPage
            Page {
                SilicaGridView {
                    anchors.fill: parent
                    cellWidth: parent.width/3
                    cellHeight: cellWidth
                    model: 200
                    delegate: Rectangle {
                        width: GridView.view.cellWidth
                        height: width
                        color: Theme.highlightColor
                        opacity: 0.2+0.8*Math.random()
                    }
                }
            }
        }

        // Sub-chapter 3.3: Full-screen carousel
        Component {
            id: slideShowPage
            Page {
                SlideshowView {
                    anchors.fill: parent
                    model: 200
                    delegate: Item {
                        width: parent.width
                        height: parent.height
                        Rectangle {
                            anchors {
                                fill: parent
                                margins: Theme.paddingLarge
                            }

                            color: Theme.rgba(Theme.highlightBackgroundColor, 0.3)

                            anchors.centerIn: parent
                            InfoLabel {
                                color: Theme.primaryColor
                                anchors.centerIn: parent
                                text: "View " + model.index
                            }
                        }
                    }
                }
            }
        }

        // Chapter 4: Handling busy state
        Column {
            anchors.verticalCenter: parent.verticalCenter
            width: parent.width
            spacing: Theme.paddingMedium
            BusyIndicator {
                id: busyIndicator
                running: !model.ready
                size: BusyIndicatorSize.Large
                anchors.horizontalCenter: parent.horizontalCenter
            }
            InfoLabel {
                text: "Loading"
                width: parent.width
                opacity: busyIndicator.opacity
                anchors.horizontalCenter: parent.horizontalCenter
            }
        }

        Timer {
            id: model
            property bool ready
            running: true
            interval: 3000
            onTriggered: ready = true
        }

        // Chapter 5: First time use hints
        TouchInteractionHint {
            id: hint
            Component.onCompleted: restart()
            interactionMode: TouchInteraction.Pull
            direction: TouchInteraction.Down
        }
        InteractionHintLabel {
            text: "Pull down to setup your account"
            opacity: hint.running ? 1.0 : 0.0
            Behavior on opacity { FadeAnimation {} }
            width: parent.width
            invert: true
        }
    }

    // Chapter 6: Creating settings forms
    Component {
        id: settingsPage
        Page {
            Column {
                width: parent.width
                PageHeader { title: "Settings" }
                SectionHeader { text: "General" }
                TextSwitch {
                    width: parent.width
                    text: "Switch A"
                    checked: true
                    description: "Describe item if not self-explanatory"
                }
                TextSwitch {
                    width: parent.width
                    text: "Switch B"
                    description: "Describe item if not self-explanatory"
                }
                SectionHeader { text: "Sub-section" }
                ComboBox {
                    label: "Mode"
                    menu: ContextMenu {
                        MenuItem { text: "All" }
                        MenuItem { text: "Option 1" }
                        MenuItem { text: "Option 2" }
                    }
                }
                TextField {
                    width: parent.width
                    label: "Name"
                    placeholderText: label
                    EnterKey.iconSource: "image://theme/icon-m-enter-next"
                    EnterKey.onClicked: nextField.focus = true
                }
            }
        }
    }
}