Warning, /plasma-bigscreen/wikidata-voice-application/ui/+android/homepage.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.9
0002 import QtQuick.Controls 2.2
0003 import QtQuick.Layouts 1.4
0004 import org.kde.kirigami 2.12 as Kirigami
0005 import QtGraphicalEffects 1.0
0006 import Mycroft 1.0 as Mycroft
0007 
0008 Mycroft.Delegate {
0009     id: delegate
0010     skillBackgroundSource: Qt.resolvedUrl("books.png")
0011     leftPadding: 0
0012     rightPadding: 0
0013     bottomPadding: 0
0014     topPadding: 0
0015     
0016     ListModel {
0017         id: sampleModel
0018         ListElement {example: "How old is Clint Eastwood ?"}
0019         ListElement {example: "Where was Abraham Lincoln born ?"}
0020         ListElement {example: "What is the occupation of Linus Torvalds ?"}
0021         ListElement {example: "What is Albert Einstein date of birth ?"}
0022         ListElement {example: "What is Abraham Lincoln date of death ?"}
0023         ListElement {example: "Who is the spouse of Steve Jobs ?"}
0024     }
0025     
0026     Rectangle {
0027         id: headerBar
0028         anchors.top: parent.top
0029         anchors.left: parent.left
0030         anchors.right: parent.right
0031         height: Kirigami.Units.gridUnit * 2
0032         color: "#303030"
0033         layer.enabled: true
0034         layer.effect: DropShadow {
0035             transparentBorder: true
0036             horizontalOffset: 0
0037             verticalOffset: 2
0038         }
0039         
0040         RowLayout {
0041             width: parent.width
0042             height: parent.height
0043             anchors.verticalCenter: parent.verticalCenter
0044             
0045             ToolButton {
0046                 Kirigami.Theme.colorSet: Kirigami.Theme.Button
0047                 Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0048                 Layout.preferredHeight: Kirigami.Units.iconSizes.medium
0049                 Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
0050                 
0051                 contentItem: Image {
0052                     anchors.centerIn: parent
0053                     width: Kirigami.Units.iconSizes.smallMedium
0054                     height: Kirigami.Units.iconSizes.smallMedium
0055                     source: "back.png"
0056                 }
0057                 
0058                 onClicked: {
0059                    Mycroft.MycroftController.sendRequest("mycroft.gui.close", {})
0060                 }
0061             }
0062             
0063             Kirigami.Heading {
0064                 level: 2
0065                 text: "Wikidata"
0066                 Layout.fillWidth: true
0067                 horizontalAlignment: Text.AlignHCenter
0068             }
0069         }
0070     }
0071     
0072     Rectangle {
0073         anchors.top: headerBar.bottom
0074         anchors.left: parent.left
0075         anchors.right: parent.right
0076         anchors.bottom: parent.bottom
0077         color: Qt.rgba(0, 0, 0, 0.7)
0078         
0079         ColumnLayout {
0080             id: root
0081             anchors.fill: parent
0082             anchors.margins: Kirigami.Units.largeSpacing
0083             
0084             Kirigami.Heading {
0085                 level: 2
0086                 font.bold: true
0087                 text: "What can it do" 
0088             }
0089             
0090             Label {
0091                 Layout.fillWidth: true
0092                 wrapMode: Text.WordWrap
0093                 font.pixelSize: Kirigami.Theme.fontSize * 0.9
0094                 text: "Get current, historic facts & information about a person from Wikidata"
0095             }
0096             
0097             Item {
0098                 Layout.preferredHeight: Kirigami.Units.largeSpacing
0099             }
0100             
0101             Kirigami.Heading {
0102                 level: 2
0103                 font.bold: true
0104                 text: "Examples"
0105             }
0106                                     
0107             ListView {
0108                 id: skillExampleListView
0109                 Layout.fillWidth: true
0110                 Layout.fillHeight: true
0111                 focus: false
0112                 clip: true
0113                 model: sampleModel
0114                 spacing: Kirigami.Units.smallSpacing
0115                 delegate: Kirigami.AbstractListItem {
0116                     id: rootCard
0117                     
0118                     background: Kirigami.ShadowedRectangle {
0119                         color: rootCard.pressed ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0120                         radius: Kirigami.Units.smallSpacing
0121                     }
0122                     
0123                     contentItem: Label {
0124                             anchors.left: parent.left
0125                             anchors.right: parent.right
0126                             anchors.rightMargin: Kirigami.Units.largeSpacing
0127                             anchors.leftMargin: Kirigami.Units.largeSpacing
0128                             wrapMode: Text.WordWrap
0129                             verticalAlignment: Text.AlignVCenter
0130                             elide: Text.ElideRight
0131                             color: Kirigami.Theme.textColor
0132                             font.pixelSize: Kirigami.Theme.fontSize * 0.9
0133                             text: "Hey Mycroft, " + model.example
0134                     }
0135 
0136                     onClicked: {
0137                         Mycroft.MycroftController.sendText(model.example)
0138                     }
0139                 }
0140             }
0141         }
0142     }
0143 }