77 lines
2.1 KiB
QML
77 lines
2.1 KiB
QML
import QtQuick 2.6
|
|
import Sailfish.Silica 1.0
|
|
import io.thp.pyotherside 1.5
|
|
|
|
Page {
|
|
id: page
|
|
|
|
PageHeader {
|
|
id: titleHeader
|
|
title: "Translation History"
|
|
}
|
|
|
|
SilicaFlickable {
|
|
id: view
|
|
anchors.fill: parent
|
|
|
|
ViewPlaceholder {
|
|
enabled: view.count == 0
|
|
text: qsTr("No translations saved yet")
|
|
hintText : qsTr("Add past translations to history by pressing the save button after a translation")
|
|
}
|
|
|
|
ListModel {
|
|
id: entriesModel
|
|
Component.onCompleted: {
|
|
var results
|
|
python.call('languagedownloader.language_downloader.getFromHistory', [], function(output){
|
|
results = output
|
|
for (var i = 0; i < results.length; i++) {
|
|
entriesModel.append({
|
|
"targetText": results[i][0],
|
|
"sourceText": results[i][1],
|
|
"sourceLang_name": results[i][2],
|
|
"targetLang_name": results[i][3]
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
ListView {
|
|
anchors.fill: parent
|
|
model: entriesModel
|
|
spacing: 40
|
|
|
|
delegate: Column {
|
|
Label {
|
|
id: sourceTextLabel
|
|
text: sourceText
|
|
font.italic : true
|
|
truncationMode: TruncationMode.Fade
|
|
}
|
|
Label {
|
|
id: targetTextLabel
|
|
text: targetText
|
|
color: palette.highlightColor
|
|
truncationMode: TruncationMode.Fade
|
|
}
|
|
Label {
|
|
id: lang_nameLabel
|
|
text: sourceLang_name + qsTr(" to ") + targetLang_name
|
|
}
|
|
}
|
|
}
|
|
|
|
Python {
|
|
id: python
|
|
Component.onCompleted: {
|
|
addImportPath(Qt.resolvedUrl('.'));
|
|
|
|
importModule('languagedownloader', function() {});
|
|
}
|
|
}
|
|
}
|
|
}
|