harbour-deepfish/qml/pages/SettingsPage.qml

64 lines
1.7 KiB
QML

import QtQuick 2.6
import Sailfish.Silica 1.0
import io.thp.pyotherside 1.5
Dialog {
id: settingsPage
property string apikey
SilicaFlickable {
anchors.fill: parent
contentHeight: column.height
Column {
id: column
width: parent.width
bottomPadding: Theme.paddingLarge
DialogHeader {
acceptText: qsTr("Save")
title : qsTr("API token field")
}
TextField {
id: apiTextField
label: qsTr("API token field")
placeholderText: qsTr("Paste API token value")
leftItem: Icon {
source: "image://theme/icon-m-keys"
}
EnterKey.enabled: text.length > 0
}
LinkedLabel {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
plainText: qsTr("You can get a free API token key at ") + "https://www.deepl.com/pro#developer ."
}
Python {
id: python
Component.onCompleted: {
addImportPath(Qt.resolvedUrl('.'));
importModule('languagedownloader', function() {});
}
}
}
}
onDone: {
if (result == DialogResult.Accepted) {
apikey = apiTextField.text
console.log(apiTextField.text)
}
}
Component.onCompleted: {
python.call('languagedownloader.currentAPItoken', [], function(output){
console.log(output)
apiTextField.placeholderText = output
});
}
}