- Fix for issue #10
- Hashtag search added
- Coversation with sections
This commit is contained in:
Dusko Angirevic 2017-06-22 14:49:39 +02:00
parent affa006211
commit b241a857a5
13 changed files with 71 additions and 38 deletions

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
*.user *.user
harbour-tooter.pro.user
harbour-tooter.pro.user

View file

@ -44,6 +44,7 @@ CONFIG += sailfishapp_i18n
# following TRANSLATIONS line. And also do not forget to # following TRANSLATIONS line. And also do not forget to
# 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-es.ts \
translations/harbour-tooter-fr.ts \ translations/harbour-tooter-fr.ts \
translations/harbour-tooter-nl.ts \ translations/harbour-tooter-nl.ts \
translations/harbour-tooter-oc.ts translations/harbour-tooter-oc.ts

View file

@ -75,6 +75,8 @@ WorkerScript.onMessage = function(msg) {
for (var j = 0; j < data[i].length; j ++) { for (var j = 0; j < data[i].length; j ++) {
item = parseToot(data[i][j]); item = parseToot(data[i][j]);
item['id'] = item['status_id'] item['id'] = item['status_id']
if (typeof item['attachments'] === "undefined")
item['attachments'] = [];
items.push(item) items.push(item)
console.log(JSON.stringify(data[i][j])) console.log(JSON.stringify(data[i][j]))
} }

View file

@ -68,7 +68,7 @@ Page {
if ( xhr.status === 200 ) { if ( xhr.status === 200 ) {
console.log(xhr.responseText) console.log(xhr.responseText)
var response = JSON.parse(xhr.responseText); var response = JSON.parse(xhr.responseText);
if (response.date_published) //if (response.date_published)
//articleDate = new Date(response.date_published.replace(/^(\w+) (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/,"$1, $2 $3 $5 $4 GMT")); //articleDate = new Date(response.date_published.replace(/^(\w+) (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/,"$1, $2 $3 $5 $4 GMT"));
if (response.title) if (response.title)
articleTitle = response.title; articleTitle = response.title;

View file

@ -37,6 +37,13 @@ Page {
right: parent.right right: parent.right
} }
model: mdl model: mdl
section {
property: 'section'
delegate: SectionHeader {
height: Theme.itemSizeExtraSmall
text: Format.formatDate(section, Formatter.DateMedium)
}
}
delegate: VisualContainer {} delegate: VisualContainer {}
onCountChanged: { onCountChanged: {
for (var i = 0; i < mdl.count; i++){ for (var i = 0; i < mdl.count; i++){
@ -55,6 +62,12 @@ Page {
DockedPanel { DockedPanel {
id: panel id: panel
open: true open: true
onExpandedChanged: {
if (!expanded) {
show()
}
}
width: parent.width width: parent.width
height: toot.height + btnContentWarning.height + Theme.paddingMedium + (warningContent.visible ? warningContent.height : 0) height: toot.height + btnContentWarning.height + Theme.paddingMedium + (warningContent.visible ? warningContent.height : 0)
dock: Dock.Bottom dock: Dock.Bottom

View file

@ -87,11 +87,21 @@ Page {
onOpenDrawer: infoPanel.open = setDrawer onOpenDrawer: infoPanel.open = setDrawer
} }
MyList{ MyList{
property string search;
id: tlSearch; id: tlSearch;
property string search;
onSearchChanged: {
mdl = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
if (search[0] === "#") {
tlSearch.type = "timelines/tag/"+search.substring(1)
loadData("append")
}
}
onTypeChanged: {
console.log("type changed")
}
title: qsTr("Search") title: qsTr("Search")
type: "search" type: ""
mdl: Logic.modelTLsearch mdl: ListModel {}
width: parent.width width: parent.width
height: parent.height height: parent.height
onOpenDrawer: infoPanel.open = setDrawer onOpenDrawer: infoPanel.open = setDrawer
@ -108,8 +118,8 @@ Page {
} }
} }
ViewPlaceholder { ViewPlaceholder {
enabled: Logic.modelTLsearch.count === 0 enabled: tlSearch.mdl === 0
text: "Not implemented" text: "Only #hastag search works"
} }
} }
@ -164,7 +174,7 @@ Page {
console.log(JSON.stringify(test)) console.log(JSON.stringify(test))
console.log(JSON.stringify(test.length)) console.log(JSON.stringify(test.length))
if (test.length === 5 && (test[3] === "tags" || test[3] === "tag") ) { if (test.length === 5 && (test[3] === "tags" || test[3] === "tag") ) {
tlSearch.search = "#"+test[4] tlSearch.search = "#"+decodeURIComponent(test[4])
slideshow.positionViewAtIndex(3, ListView.SnapToItem) slideshow.positionViewAtIndex(3, ListView.SnapToItem)
navigation.navigateTo('search') navigation.navigateTo('search')

View file

@ -17,8 +17,10 @@ Item {
} }
//console.log(JSON.stringify(model.get(0))) //console.log(JSON.stringify(model.get(0)))
} }
var count = 0
switch(model.count){ if (model && model.count)
count = model.count
switch(count){
case 1: case 1:
placeholder1.width = holder.width placeholder1.width = holder.width
placeholder1.height = placeholder1.width*hRatio placeholder1.height = placeholder1.width*hRatio

View file

@ -1,4 +1,4 @@
import QtQuick 2.0 import QtQuick 2.2
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import "../../lib/API.js" as Logic import "../../lib/API.js" as Logic
import "." import "."
@ -25,6 +25,7 @@ SilicaListView {
} }
signal openDrawer (bool setDrawer) signal openDrawer (bool setDrawer)
onOpenDrawer: { onOpenDrawer: {
//console.log("Open drawer: " + setDrawer) //console.log("Open drawer: " + setDrawer)
@ -92,7 +93,8 @@ SilicaListView {
} }
} }
delegate: VisualContainer {} //Toot {} delegate: VisualContainer {
} //Toot {}
add: Transition { add: Transition {
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 800 } NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 800 }
@ -160,14 +162,7 @@ SilicaListView {
} }
Component.onCompleted: { Component.onCompleted: {
var msg = { loadData("prepend")
'action' : type,
'params' : [ ],
'model' : model,
'mode' : "append",
'conf' : Logic.conf
};
worker.sendMessage(msg);
} }
Timer { Timer {
@ -193,6 +188,7 @@ SilicaListView {
'mode' : mode, 'mode' : mode,
'conf' : Logic.conf 'conf' : Logic.conf
}; };
worker.sendMessage(msg); if (type !== "")
worker.sendMessage(msg);
} }
} }

View file

@ -41,7 +41,7 @@ Item {
} }
Column { Column {
anchors { anchors {
left: icon.left left: icon.right
leftMargin: Theme.paddingLarge leftMargin: Theme.paddingLarge
right: parent.right right: parent.right
rightMargin: Theme.paddingLarge rightMargin: Theme.paddingLarge

View file

@ -1,12 +1,13 @@
import QtQuick 2.0 import QtQuick 2.2
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
BackgroundItem { BackgroundItem {
id: delegate id: delegate
signal send (string notice) signal send (string notice)
signal navigateTo(string link) signal navigateTo(string link)
width: parent.width width: parent.width
height: miniHeader.height + (attachments && attachments.count ? media.height + Theme.paddingLarge + Theme.paddingMedium: Theme.paddingLarge) + lblContent.height + Theme.paddingLarge + (ministatus.visible ? ministatus.height : 0) height: mnu.height + miniHeader.height + (typeof attachments !== "undefined" && attachments.count ? media.height + Theme.paddingLarge + Theme.paddingMedium: Theme.paddingLarge) + lblContent.height + Theme.paddingLarge + (ministatus.visible ? ministatus.height : 0)
MiniStatus { MiniStatus {
id: ministatus id: ministatus
anchors { anchors {
@ -108,25 +109,14 @@ BackgroundItem {
"profileImage": "" "profileImage": ""
}) })
} else { } else {
pageStack.push(Qt.resolvedUrl("Browser.qml"), {"href" : href}) pageStack.push(Qt.resolvedUrl("../Browser.qml"), {"href" : link})
} }
/*if (link[0] === "@") {
pageStack.push(Qt.resolvedUrl("../Profile.qml"), {
"name": "",
"username": link.substring(1),
"profileImage": ""
})
} else if (link[0] === "#") {
} else {
pageStack.push(Qt.resolvedUrl("../Browser.qml"), {"href" : link})
}*/
} }
text: content.replace(new RegExp("<a ", 'g'), '<a style="text-decoration: none; color:'+Theme.highlightColor+'" ') text: content.replace(new RegExp("<a ", 'g'), '<a style="text-decoration: none; color:'+(pressed ? Theme.secondaryColor : Theme.highlightColor)+'" ')
textFormat: Text.RichText textFormat: Text.RichText
linkColor : Theme.highlightColor linkColor : Theme.highlightColor
wrapMode: Text.Wrap wrapMode: Text.Wrap
@ -145,6 +135,16 @@ BackgroundItem {
model: typeof attachments !== "undefined" ? attachments : [] model: typeof attachments !== "undefined" ? attachments : []
height: 100 height: 100
} }
ContextMenu {
id: mnu
MenuItem {
text: "Toggle bold font"
}
MenuItem {
text: "Remove"
onClicked: model.remove(model.index)
}
}
@ -163,5 +163,9 @@ BackgroundItem {
} }
onPressAndHold: { onPressAndHold: {
console.log(lblContent.text) console.log(lblContent.text)
mnu.show(delegate)
}
onDoubleClicked: {
console.log("double click")
} }
} }

View file

@ -16,3 +16,6 @@
- Toot rendering reverted to the HTML - Toot rendering reverted to the HTML
- Translations added: FR, NL, OC, ES - Translations added: FR, NL, OC, ES
* Tue Jun 20 2017 Dusko Angirevic <dysko@me.com> 0.1.6-1
- Hashtag search added
- Coversation with sections

View file

@ -13,7 +13,7 @@ Name: harbour-tooter
%{!?qtc_make:%define qtc_make make} %{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir} %{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Tooter Summary: Tooter
Version: 0.1.5 Version: 0.1.6
Release: 1 Release: 1
Group: Qt/Qt Group: Qt/Qt
License: LICENSE License: LICENSE

View file

@ -1,6 +1,6 @@
Name: harbour-tooter Name: harbour-tooter
Summary: Tooter Summary: Tooter
Version: 0.1.5 Version: 0.1.6
Release: Release:
# The contents of the Group field should be one of the groups listed here: # The contents of the Group field should be one of the groups listed here:
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS # http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS