Added Dutch language and Conversation view

This commit is contained in:
Dusko Angirevic 2017-06-15 16:03:20 +02:00
parent e39f60f1f4
commit d73da448a8
9 changed files with 297 additions and 23 deletions

View file

@ -45,6 +45,7 @@ CONFIG += sailfishapp_i18n
# modify the localized app name in the the .desktop file. # modify the localized app name in the the .desktop file.
TRANSLATIONS += \ TRANSLATIONS += \
translations/harbour-tooter-fr.ts \ translations/harbour-tooter-fr.ts \
translations/harbour-tooter-nl.ts \
translations/harbour-tooter-oc.ts translations/harbour-tooter-oc.ts
DISTFILES += \ DISTFILES += \

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.1, 2017-06-13T16:51:37. --> <!-- Written by QtCreator 4.0.1, 2017-06-15T15:42:07. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@ -779,7 +779,7 @@
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value> <value type="bool" key="RunConfiguration.UseMultiProcess">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap> </valuemap>

View file

@ -39,12 +39,40 @@ WorkerScript.onMessage = function(msg) {
if(msg.action === "accounts/search") { if(msg.action === "accounts/search") {
item = parseAccounts(data[i]); item = parseAccounts(data[i]);
items.push(item) items.push(item)
} else if(msg.action === "notifications") { } else if(msg.action === "notifications") {
console.log("Is notification... parsing...") // notification
//console.log("Is notification... parsing...")
item = parseNotification(data[i]); item = parseNotification(data[i]);
items.push(item) items.push(item)
} else if(msg.action.indexOf("statuses") >-1 && msg.action.indexOf("context") >-1 && i === "ancestors") {
// status ancestors toots - conversation
console.log("ancestors")
for (var j = 0; j < data[i].length; j ++) {
item = parseToot(data[i][j]);
item['id'] = item['status_id']
items.push(item)
console.log(JSON.stringify(data[i][j]))
}
addDataToModel (msg.model, "prepend", items);
items = [];
//console.log(JSON.stringify(i))
} else if(msg.action.indexOf("statuses") >-1 && msg.action.indexOf("context") >-1 && i === "descendants") {
// status ancestors toots - conversation
console.log("descendants")
for (var j = 0; j < data[i].length; j ++) {
item = parseToot(data[i][j]);
item['id'] = item['status_id']
items.push(item)
console.log(JSON.stringify(data[i][j]))
}
addDataToModel (msg.model, "append", items);
items = [];
} else if (data[i].hasOwnProperty("content")){ } else if (data[i].hasOwnProperty("content")){
console.log("Is toot... parsing...") //console.log("Is toot... parsing...")
item = parseToot(data[i]); item = parseToot(data[i]);
item['id'] = item['status_id'] item['id'] = item['status_id']
items.push(item) items.push(item)
@ -53,7 +81,7 @@ WorkerScript.onMessage = function(msg) {
} }
} }
} }
if(msg.model) if(msg.model && items.length)
addDataToModel(msg.model, msg.mode, items) addDataToModel(msg.model, msg.mode, items)
if(msg.action === "notifications") if(msg.action === "notifications")
orderNotifications(items) orderNotifications(items)
@ -155,6 +183,7 @@ function collect() {
function parseToot (data){ function parseToot (data){
//console.log(JSON.stringify(data)) //console.log(JSON.stringify(data))
var item = {}; var item = {};
item['highlight'] = false
item['status_id'] = data["id"] item['status_id'] = data["id"]
item['status_uri'] = data["uri"] item['status_uri'] = data["uri"]
item['status_in_reply_to_id'] = data["in_reply_to_id"] item['status_in_reply_to_id'] = data["in_reply_to_id"]

View file

@ -10,6 +10,7 @@ Page {
property alias description: header.description property alias description: header.description
property alias avatar: header.image property alias avatar: header.image
property int toot_id property int toot_id
property ListModel mdl;
WorkerScript { WorkerScript {
id: worker id: worker
@ -21,6 +22,34 @@ Page {
ProfileHeader { ProfileHeader {
id: header id: header
visible: false
}
SilicaListView {
id: conversationList
header: PageHeader {
title: qsTr("Conversation")
}
clip: true;
anchors {
top: parent.top
bottom: panel.top
left: parent.left
right: parent.right
}
model: mdl
delegate: VisualContainer {}
onCountChanged: {
for (var i = 0; i < mdl.count; i++){
if (mdl.get(i).status_id === toot_id) {
console.log(mdl.get(i).status_id)
positionViewAtIndex(i, ListView.Center )
}
}
//last_id_MN
}
} }
DockedPanel { DockedPanel {
@ -57,7 +86,7 @@ Page {
} }
autoScrollEnabled: true autoScrollEnabled: true
labelVisible: false labelVisible: false
focus: true // focus: true
text: description !== "" && (description.charAt(0) == '@' || description.charAt(0) == '#') ? description+' ' : '' text: description !== "" && (description.charAt(0) == '@' || description.charAt(0) == '#') ? description+' ' : ''
height: implicitHeight height: implicitHeight
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
@ -73,8 +102,8 @@ Page {
leftMargin: Theme.paddingMedium leftMargin: Theme.paddingMedium
} }
icon.source: "image://theme/icon-s-high-importance?" + (pressed icon.source: "image://theme/icon-s-high-importance?" + (pressed
? Theme.highlightColor ? Theme.highlightColor
: (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor)) : (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor))
onClicked: warningContent.visible = !warningContent.visible onClicked: warningContent.visible = !warningContent.visible
} }
ComboBox { ComboBox {
@ -95,8 +124,8 @@ Page {
IconButton { IconButton {
id: btnSend id: btnSend
icon.source: "image://theme/icon-m-enter?" + (pressed icon.source: "image://theme/icon-m-enter?" + (pressed
? Theme.highlightColor ? Theme.highlightColor
: Theme.primaryColor) : Theme.primaryColor)
anchors { anchors {
top: toot.bottom top: toot.bottom
right: parent.right right: parent.right
@ -123,7 +152,6 @@ Page {
} }
worker.sendMessage(msg); worker.sendMessage(msg);
console.log(JSON.stringify(msg));
warningContent.text = "" warningContent.text = ""
toot.text = "" toot.text = ""
} }
@ -131,5 +159,12 @@ Page {
} }
Component.onCompleted: { Component.onCompleted: {
toot.cursorPosition = toot.text.length toot.cursorPosition = toot.text.length
worker.sendMessage({
'action' : 'statuses/'+mdl.get(0).status_id+'/context',
'method' : 'GET',
'model' : mdl,
'params' : { },
'conf' : Logic.conf
});
} }
} }

View file

@ -112,18 +112,21 @@ BackgroundItem {
linkColor : Theme.highlightColor linkColor : Theme.highlightColor
wrapMode: Text.Wrap wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: (pressed ? Theme.highlightColor : Theme.primaryColor) color: (pressed ? Theme.highlightColor : (highlight ? Theme.primaryColor : Theme.secondaryColor))
} }
onClicked: { onClicked: {
var m = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
m.append(mdl.get(index))
pageStack.push(Qt.resolvedUrl("../Conversation.qml"), { pageStack.push(Qt.resolvedUrl("../Conversation.qml"), {
toot_id: id, toot_id: status_id,
title: account_display_name, title: account_display_name,
description: '@'+account_acct, description: '@'+account_acct,
avatar: account_avatar, avatar: account_avatar,
mdl: m,
type: "reply" type: "reply"
}) })
} }

View file

@ -48,25 +48,29 @@
</context> </context>
<context> <context>
<name>Conversation</name> <name>Conversation</name>
<message>
<source>Conversation</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Content warning!</source> <source>Content warning!</source>
<translation>Contenu sensible !</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>public</source> <source>public</source>
<translation>public</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>unlisted</source> <source>unlisted</source>
<translation>non-listé</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>followers only</source> <source>followers only</source>
<translation>abonnés uniquement</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>direct</source> <source>direct</source>
<translation>direct</translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context> <context>

View file

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="nl">
<context>
<name></name>
<message id="Logout">
<source></source>
<translation>Uitloggen</translation>
</message>
<message id="Login">
<source></source>
<translation>Inloggen</translation>
</message>
</context>
<context>
<name>API</name>
<message>
<source>favourited</source>
<translation>favoriet gemaakt</translation>
</message>
<message>
<source>followed you</source>
<translation>volgde jou</translation>
</message>
<message>
<source>boosted</source>
<translation>boostte</translation>
</message>
<message>
<source>said</source>
<translation>zei</translation>
</message>
</context>
<context>
<name>Browser</name>
<message>
<source>Open in Browser</source>
<translation>Openen in browser</translation>
</message>
<message>
<source>Web mode</source>
<translation>Webmodus</translation>
</message>
<message>
<source>Reading mode</source>
<translation>Leesmodus</translation>
</message>
</context>
<context>
<name>Conversation</name>
<message>
<source>Conversation</source>
<translation>Gesprek</translation>
</message>
<message>
<source>Content warning!</source>
<translation>Gevoelige inhoud!</translation>
</message>
<message>
<source>public</source>
<translation>openbaar</translation>
</message>
<message>
<source>unlisted</source>
<translation>niet op lijst</translation>
</message>
<message>
<source>followers only</source>
<translation>alleen volgers</translation>
</message>
<message>
<source>direct</source>
<translation>direct</translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>Tooter</source>
<translation>Tooter</translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
<source>Home</source>
<translation>Thuis</translation>
</message>
<message>
<source>Timeline</source>
<translation>Tijdlijn</translation>
</message>
<message>
<source>Notifications</source>
<translation>Meldingen</translation>
</message>
<message>
<source>Search</source>
<translation>Zoeken</translation>
</message>
<message>
<source>New Toot</source>
<translation>Nieuw</translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>
<source>boosted</source>
<translation>heeft geboost</translation>
</message>
<message>
<source>favourited</source>
<translation>favoriet gemaakt</translation>
</message>
<message>
<source>followed you</source>
<translation>volgde jou</translation>
</message>
</context>
<context>
<name>MyList</name>
<message>
<source>Load more</source>
<translation>Meer laden</translation>
</message>
</context>
<context>
<name>Profile</name>
<message>
<source>Unfollow</source>
<translation>Ontvolgen</translation>
</message>
<message>
<source>Follow request sent!</source>
<translation>Volgverzoek verstuurd!</translation>
</message>
<message>
<source>Following</source>
<translation>Volgend</translation>
</message>
<message>
<source>Mute</source>
<translation>Dempen</translation>
</message>
<message>
<source>Unmute</source>
<translation>Ontdempen</translation>
</message>
<message>
<source>Unblock</source>
<translation>Deblokkeren</translation>
</message>
<message>
<source>Block</source>
<translation>Blokkeren</translation>
</message>
<message>
<source>Statuses</source>
<translation>Statussen</translation>
</message>
<message>
<source>Favourites</source>
<translation>Favorieten</translation>
</message>
<message>
<source>Follow</source>
<translation>Volgen</translation>
</message>
<message>
<source>Summary</source>
<translation>Samenvatting</translation>
</message>
<message>
<source>Followers</source>
<translation>Volgers</translation>
</message>
</context>
<context>
<name>Toot</name>
<message>
<source>boosted</source>
<translation>boostte</translation>
</message>
<message>
<source>favourited</source>
<translation>maakte favoriet</translation>
</message>
<message>
<source>followed you</source>
<translation>volgde jou</translation>
</message>
</context>
</TS>

View file

@ -48,25 +48,29 @@
</context> </context>
<context> <context>
<name>Conversation</name> <name>Conversation</name>
<message>
<source>Conversation</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Content warning!</source> <source>Content warning!</source>
<translation>Contengut sensible !</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>public</source> <source>public</source>
<translation>public</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>unlisted</source> <source>unlisted</source>
<translation>pas listat</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>followers only</source> <source>followers only</source>
<translation>seguidors solament</translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<source>direct</source> <source>direct</source>
<translation>messatge privat</translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context> <context>

View file

@ -48,6 +48,10 @@
</context> </context>
<context> <context>
<name>Conversation</name> <name>Conversation</name>
<message>
<source>Conversation</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Content warning!</source> <source>Content warning!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>