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