Warning, /plasma-bigscreen/wikidata-voice-application/ui/+mediacenter/homepage-new.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 skillExampleListView.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 visible: false
0063 }
0064
0065 onClicked: {
0066 delegateWiki.parent.backRequested()
0067 }
0068 }
0069
0070 Kirigami.Heading {
0071 id: headingLabel
0072 level: 2
0073 text: "Wikidata"
0074 Layout.fillWidth: true
0075 horizontalAlignment: Text.AlignHCenter
0076 }
0077 }
0078 }
0079
0080 Rectangle {
0081 anchors.top: headerBar.bottom
0082 anchors.left: parent.left
0083 anchors.right: parent.right
0084 anchors.bottom: parent.bottom
0085 color: Qt.rgba(0, 0, 0, 0.7)
0086
0087 ColumnLayout {
0088 id: root
0089 anchors.fill: parent
0090 anchors.margins: Kirigami.Units.largeSpacing
0091
0092 Kirigami.Heading {
0093 level: 2
0094 font.bold: true
0095 text: "What can it do"
0096 }
0097
0098 Label {
0099 Layout.fillWidth: true
0100 wrapMode: Text.WordWrap
0101 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.9
0102 text: "Get current, historic facts & information about a person from Wikidata"
0103 }
0104
0105 Item {
0106 Layout.preferredHeight: Kirigami.Units.largeSpacing
0107 }
0108
0109 Kirigami.Heading {
0110 level: 2
0111 font.bold: true
0112 text: "Examples"
0113 }
0114
0115 ListView {
0116 id: skillExampleListView
0117 Layout.fillWidth: true
0118 Layout.fillHeight: true
0119 keyNavigationEnabled: true
0120 focus: true
0121 highlightFollowsCurrentItem: true
0122 snapMode: ListView.SnapToItem
0123 clip: true
0124 model: sampleModel
0125 spacing: Kirigami.Units.smallSpacing
0126 delegate: Kirigami.AbstractListItem {
0127 id: rootCard
0128
0129 background: Kirigami.ShadowedRectangle {
0130 color: rootCard.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0131 radius: Kirigami.Units.smallSpacing
0132 }
0133
0134 contentItem: Label {
0135 anchors.left: parent.left
0136 anchors.right: parent.right
0137 anchors.rightMargin: Kirigami.Units.largeSpacing
0138 anchors.leftMargin: Kirigami.Units.largeSpacing
0139 wrapMode: Text.WordWrap
0140 verticalAlignment: Text.AlignVCenter
0141 elide: Text.ElideRight
0142 color: Kirigami.Theme.textColor
0143 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.9
0144 text: "Hey Mycroft, " + model.example
0145 }
0146
0147 onClicked: {
0148 Mycroft.MycroftController.sendText(model.example)
0149 }
0150
0151 Keys.onReturnPressed: {
0152 clicked()
0153 }
0154 }
0155 }
0156 }
0157 }
0158 }