new user profile labels
This commit is contained in:
parent
32f93b8e26
commit
ddf0d4d065
10 changed files with 57 additions and 228 deletions
|
@ -71,7 +71,6 @@ DISTFILES += qml/harbour-tooter.qml \
|
||||||
qml/cover/CoverPage.qml \
|
qml/cover/CoverPage.qml \
|
||||||
qml/pages/MainPage.qml \
|
qml/pages/MainPage.qml \
|
||||||
qml/pages/LoginPage.qml \
|
qml/pages/LoginPage.qml \
|
||||||
qml/pages/components/Toot.qml \
|
|
||||||
qml/pages/Browser.qml \
|
qml/pages/Browser.qml \
|
||||||
qml/lib/API.js \
|
qml/lib/API.js \
|
||||||
qml/images/icon-s-following \
|
qml/images/icon-s-following \
|
||||||
|
@ -93,7 +92,7 @@ SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
|
||||||
|
|
||||||
# to disable building translations every time, comment out the
|
# to disable building translations every time, comment out the
|
||||||
# following CONFIG line
|
# following CONFIG line
|
||||||
CONFIG += sailfishapp_i18n
|
# CONFIG += sailfishapp_i18n
|
||||||
|
|
||||||
TRANSLATIONS += translations/harbour-tooter.ts \
|
TRANSLATIONS += translations/harbour-tooter.ts \
|
||||||
translations/harbour-tooter-de.ts \
|
translations/harbour-tooter-de.ts \
|
||||||
|
|
|
@ -132,7 +132,6 @@ function parseAccounts(collection, prefix, data){
|
||||||
res[prefix + 'account_username'] = data["username"]
|
res[prefix + 'account_username'] = data["username"]
|
||||||
res[prefix + 'account_acct'] = data["acct"]
|
res[prefix + 'account_acct'] = data["acct"]
|
||||||
res[prefix + 'account_display_name'] = data["display_name"]
|
res[prefix + 'account_display_name'] = data["display_name"]
|
||||||
res[prefix + 'account_discoverable'] = data["discoverable"]
|
|
||||||
res[prefix + 'account_locked'] = data["locked"]
|
res[prefix + 'account_locked'] = data["locked"]
|
||||||
res[prefix + 'account_created_at'] = data["created_at"]
|
res[prefix + 'account_created_at'] = data["created_at"]
|
||||||
res[prefix + 'account_avatar'] = data["avatar"]
|
res[prefix + 'account_avatar'] = data["avatar"]
|
||||||
|
@ -152,7 +151,7 @@ function parseNotification(data){
|
||||||
switch (item['type']){
|
switch (item['type']){
|
||||||
case "mention":
|
case "mention":
|
||||||
if (!data.status) {
|
if (!data.status) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = parseToot(data.status)
|
item = parseToot(data.status)
|
||||||
|
@ -257,10 +256,10 @@ function parseToot (data){
|
||||||
item = parseAccounts(item, "", data["account"])
|
item = parseAccounts(item, "", data["account"])
|
||||||
}
|
}
|
||||||
item['content'] = data['content']
|
item['content'] = data['content']
|
||||||
.replaceAll('</span><span class="invisible">', '')
|
.replaceAll('</span><span class="invisible">', '')
|
||||||
.replaceAll('<span class="invisible">', '')
|
.replaceAll('<span class="invisible">', '')
|
||||||
.replaceAll('</span><span class="ellipsis">', '')
|
.replaceAll('</span><span class="ellipsis">', '')
|
||||||
.replaceAll('class=""', '');
|
.replaceAll('class=""', '');
|
||||||
item['attachments'] = [];
|
item['attachments'] = [];
|
||||||
|
|
||||||
|
|
||||||
|
@ -274,7 +273,7 @@ function parseToot (data){
|
||||||
id: attachments['id'],
|
id: attachments['id'],
|
||||||
type: attachments['type'],
|
type: attachments['type'],
|
||||||
url: attachments['remote_url'] && typeof attachments['remote_url'] == "string" ? attachments['remote_url'] : attachments['url'] ,
|
url: attachments['remote_url'] && typeof attachments['remote_url'] == "string" ? attachments['remote_url'] : attachments['url'] ,
|
||||||
preview_url: loadImages ? attachments['preview_url'] : ''
|
preview_url: loadImages ? attachments['preview_url'] : ''
|
||||||
}
|
}
|
||||||
item['attachments'].push(tmp)
|
item['attachments'].push(tmp)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,18 +8,18 @@ import "./components/"
|
||||||
Page {
|
Page {
|
||||||
id: conversationPage
|
id: conversationPage
|
||||||
|
|
||||||
property string headerTitle: ""
|
|
||||||
property string type
|
property string type
|
||||||
property alias title: header.title
|
property string description: ""
|
||||||
property alias description: header.description
|
property string headerTitle: ""
|
||||||
property alias avatar: header.image
|
|
||||||
property string suggestedUser: ""
|
property string suggestedUser: ""
|
||||||
property ListModel suggestedModel
|
property ListModel suggestedModel
|
||||||
property string toot_id: ""
|
property string toot_id: ""
|
||||||
property string toot_url: ""
|
property string toot_url: ""
|
||||||
property string toot_uri: ""
|
property string toot_uri: ""
|
||||||
property int tootMaxChar: 500;
|
property int tootMaxChar: 500;
|
||||||
property bool bot: false
|
property bool bot: false //otherwise ReferenceError ProfileHeader.qml
|
||||||
|
property bool followed_by: false //otherwise ReferenceError ProfileHeader.qml
|
||||||
|
property bool locked: false //otherwise ReferenceError ProfileHeader.qml
|
||||||
property ListModel mdl
|
property ListModel mdl
|
||||||
|
|
||||||
allowedOrientations: Orientation.All
|
allowedOrientations: Orientation.All
|
||||||
|
|
|
@ -179,6 +179,7 @@ Page {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
view2.type = "accounts/search"
|
view2.type = "accounts/search"
|
||||||
view2.params = []
|
view2.params = []
|
||||||
|
@ -256,7 +257,7 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLinkActivated(href){
|
function onLinkActivated(href) {
|
||||||
var test = href.split("/")
|
var test = href.split("/")
|
||||||
console.log(href)
|
console.log(href)
|
||||||
console.log(JSON.stringify(test))
|
console.log(JSON.stringify(test))
|
||||||
|
|
|
@ -31,7 +31,6 @@ Page {
|
||||||
text: qsTr("Load Images in Toots")
|
text: qsTr("Load Images in Toots")
|
||||||
description: qsTr("Disable this option if you want to preserve your data connection")
|
description: qsTr("Disable this option if you want to preserve your data connection")
|
||||||
icon.source: "image://theme/icon-m-image"
|
icon.source: "image://theme/icon-m-image"
|
||||||
enabled: true
|
|
||||||
checked: typeof Logic.conf['loadImages'] !== "undefined" && Logic.conf['loadImages']
|
checked: typeof Logic.conf['loadImages'] !== "undefined" && Logic.conf['loadImages']
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Logic.conf['loadImages'] = checked
|
Logic.conf['loadImages'] = checked
|
||||||
|
@ -97,11 +96,8 @@ Page {
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
color: Theme.highlightColor
|
color: Theme.highlightColor
|
||||||
anchors {
|
width: parent.width - Theme.paddingMedium
|
||||||
left: parent.left
|
anchors.left: parent.left
|
||||||
right: parent.right
|
|
||||||
rightMargin: Theme.paddingLarge + icnRemoveAccount
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,16 @@ BackgroundItem {
|
||||||
anchors.leftMargin: Theme.paddingLarge
|
anchors.leftMargin: Theme.paddingLarge
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
height: account_acct.height + display_name.height
|
height: account_acct.height + display_name.height
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: display_name
|
id: display_name
|
||||||
text: model.account_display_name+" "
|
text: if (model.account_display_name + " ") {
|
||||||
color: !pressed ? Theme.primaryColor : Theme.highlightColor
|
model.account_username.split("@")[0] + " "
|
||||||
|
} else model.account_display_name
|
||||||
|
color: !pressed ? Theme.primaryColor : Theme.highlightColor
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: account_acct
|
id: account_acct
|
||||||
text: "@"+model.account_acct
|
text: "@"+model.account_acct
|
||||||
|
@ -65,12 +69,13 @@ BackgroundItem {
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onClicked: openUser({
|
|
||||||
|
onClicked: openUser( {
|
||||||
"display_name": model.account_display_name,
|
"display_name": model.account_display_name,
|
||||||
"username": model.account_acct,
|
"username": model.account_acct,
|
||||||
"user_id": model.account_id,
|
"user_id": model.account_id,
|
||||||
"profileImage": model.account_avatar,
|
"profileImage": model.account_avatar,
|
||||||
"profileBackground": model.account_header
|
"profileBackground": model.account_header
|
||||||
})
|
} )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ SilicaListView {
|
||||||
text: qsTr("New Toot")
|
text: qsTr("New Toot")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pageStack.push(Qt.resolvedUrl("../ConversationPage.qml"), {
|
pageStack.push(Qt.resolvedUrl("../ConversationPage.qml"), {
|
||||||
//headerTitle: "New Toot",
|
headerTitle: qsTr("New Toot"),
|
||||||
type: "new"
|
type: "new"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,7 @@ SilicaListView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: VisualContainer {
|
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 }
|
||||||
|
|
|
@ -12,7 +12,7 @@ Item {
|
||||||
property string bg: ""
|
property string bg: ""
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: if (bot === true) {
|
height: if (bot === true || locked === true || followed_by === true) {
|
||||||
avatarImage.height + Theme.paddingLarge*2 + infoLbl.height + Theme.paddingLarge
|
avatarImage.height + Theme.paddingLarge*2 + infoLbl.height + Theme.paddingLarge
|
||||||
} else avatarImage.height + Theme.paddingLarge*2
|
} else avatarImage.height + Theme.paddingLarge*2
|
||||||
|
|
||||||
|
@ -122,9 +122,9 @@ Item {
|
||||||
rightMargin: Theme.paddingLarge
|
rightMargin: Theme.paddingLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rectangle {
|
Rectangle {
|
||||||
id: followingBg
|
id: followingBg
|
||||||
visible: (following ? true : false)
|
visible: (followed_by ? true : false)
|
||||||
radius: Theme.paddingSmall
|
radius: Theme.paddingSmall
|
||||||
color: Theme.secondaryHighlightColor
|
color: Theme.secondaryHighlightColor
|
||||||
width: followingLbl.width + 2*Theme.paddingLarge
|
width: followingLbl.width + 2*Theme.paddingLarge
|
||||||
|
@ -138,7 +138,26 @@ Item {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
} */
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: lockedBg
|
||||||
|
visible: (locked ? true : false)
|
||||||
|
radius: Theme.paddingSmall
|
||||||
|
color: Theme.secondaryHighlightColor
|
||||||
|
width: lockedImg.width + 2*Theme.paddingLarge
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
|
HighlightImage {
|
||||||
|
id: lockedImg
|
||||||
|
source: "image://theme/icon-s-secure?"
|
||||||
|
width: Theme.fontSizeExtraSmall
|
||||||
|
height: width
|
||||||
|
color: Theme.primaryColor
|
||||||
|
anchors.horizontalCenter: lockedBg.horizontalCenter
|
||||||
|
anchors.verticalCenter: lockedBg.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: botBg
|
id: botBg
|
||||||
|
|
|
@ -1,187 +0,0 @@
|
||||||
import QtQuick 2.0
|
|
||||||
import Sailfish.Silica 1.0
|
|
||||||
import QtGraphicalEffects 1.0
|
|
||||||
|
|
||||||
|
|
||||||
BackgroundItem {
|
|
||||||
id: delegate
|
|
||||||
|
|
||||||
signal send (string notice)
|
|
||||||
signal navigateTo(string link)
|
|
||||||
|
|
||||||
width: parent.width
|
|
||||||
height: lblText.paintedHeight + (lblText.text.length > 0 ? Theme.paddingLarge : 0 )+ lblName.paintedHeight + (type.length ? Theme.paddingLarge + iconRT.height : 0) + Theme.paddingLarge
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: iconRT
|
|
||||||
y: Theme.paddingLarge
|
|
||||||
anchors.right: avatar.right
|
|
||||||
visible: type.length
|
|
||||||
width: Theme.iconSizeExtraSmall
|
|
||||||
height: width
|
|
||||||
source: "../../images/boosted.svg"
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: lblRtByName
|
|
||||||
visible: type.length
|
|
||||||
anchors.left: lblName.left
|
|
||||||
anchors.bottom: iconRT.bottom
|
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
|
||||||
color: Theme.secondaryColor
|
|
||||||
text: {
|
|
||||||
var action;
|
|
||||||
switch(type){
|
|
||||||
case "reblog":
|
|
||||||
action = qsTr('boosted');
|
|
||||||
break;
|
|
||||||
case "favourite":
|
|
||||||
action = qsTr('favourited');
|
|
||||||
break;
|
|
||||||
case "follow":
|
|
||||||
action = qsTr('followed you');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
action = type;
|
|
||||||
}
|
|
||||||
return '@' + retweetScreenName + ' ' + action
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: avatar
|
|
||||||
x: Theme.horizontalPageMargin
|
|
||||||
y: Theme.paddingLarge + (type.length ? iconRT.height+Theme.paddingMedium : 0)
|
|
||||||
asynchronous: true
|
|
||||||
width: Theme.iconSizeMedium
|
|
||||||
height: width
|
|
||||||
smooth: true
|
|
||||||
source: account_avatar
|
|
||||||
visible: true
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
pageStack.push(Qt.resolvedUrl("../ProfilePage.qml"), {
|
|
||||||
"display_name": account_display_name,
|
|
||||||
"username": account_username,
|
|
||||||
"profileImage": account_avatar
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: lblName
|
|
||||||
text: account_display_name
|
|
||||||
font.weight: Font.Bold
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: (pressed ? Theme.highlightColor : Theme.primaryColor)
|
|
||||||
anchors {
|
|
||||||
top: avatar.top
|
|
||||||
topMargin: 0
|
|
||||||
left: avatar.right
|
|
||||||
leftMargin: Theme.paddingMedium
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: iconLocked
|
|
||||||
visible: account_locked
|
|
||||||
y: Theme.paddingLarge
|
|
||||||
opacity: 0.8
|
|
||||||
source: "image://theme/icon-s-secure?" + (pressed
|
|
||||||
? Theme.highlightColor
|
|
||||||
: Theme.primaryColor)
|
|
||||||
width: account_locked ? Theme.iconSizeExtraSmall*0.8 : 0
|
|
||||||
height: width
|
|
||||||
anchors {
|
|
||||||
left: lblName.right
|
|
||||||
leftMargin: Theme.paddingSmall
|
|
||||||
verticalCenter: lblName.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: lblScreenName
|
|
||||||
truncationMode: TruncationMode.Fade
|
|
||||||
text: '@'+account_username
|
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
|
||||||
color: (pressed ? Theme.secondaryHighlightColor : Theme.secondaryColor)
|
|
||||||
anchors {
|
|
||||||
left: iconLocked.right
|
|
||||||
right: lblDate.left
|
|
||||||
leftMargin: Theme.paddingMedium
|
|
||||||
baseline: lblName.baseline
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: lblDate
|
|
||||||
function timestamp() {
|
|
||||||
var txt = Format.formatDate(created_at, Formatter.Timepoint)
|
|
||||||
var elapsed = Format.formatDate(created_at, Formatter.DurationElapsedShort)
|
|
||||||
return (elapsed ? elapsed : txt )
|
|
||||||
}
|
|
||||||
text: Format.formatDate(created_at, new Date() - created_at < 60*60*1000 ? Formatter.DurationElapsedShort : Formatter.TimeValueTwentyFourHours)
|
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
|
||||||
color: (pressed ? Theme.highlightColor : Theme.primaryColor)
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
anchors {
|
|
||||||
right: parent.right
|
|
||||||
baseline: lblName.baseline
|
|
||||||
rightMargin: Theme.paddingLarge
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: lblText
|
|
||||||
height: content.length ? paintedHeight : 0
|
|
||||||
onLinkActivated: {
|
|
||||||
console.log(link)
|
|
||||||
if (link[0] === "@") {
|
|
||||||
pageStack.push(Qt.resolvedUrl("../Profile.qml"), {
|
|
||||||
"name": "",
|
|
||||||
"username": link.substring(1),
|
|
||||||
"profileImage": ""
|
|
||||||
})
|
|
||||||
} else if (link[0] === "#") {
|
|
||||||
pageStack.pop(pageStack.find(function(page) {
|
|
||||||
var check = page.isFirstPage === true;
|
|
||||||
if (check)
|
|
||||||
page.onLinkActivated(link)
|
|
||||||
return check;
|
|
||||||
}));
|
|
||||||
send(link)
|
|
||||||
} else {
|
|
||||||
Qt.openUrlExternally(link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
text: content
|
|
||||||
textFormat: Text.RichText
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: (pressed ? Theme.highlightColor : Theme.primaryColor)
|
|
||||||
linkColor : Theme.highlightColor
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
maximumLineCount: 6
|
|
||||||
anchors {
|
|
||||||
left: lblName.left
|
|
||||||
right: parent.right
|
|
||||||
top: lblScreenName.bottom
|
|
||||||
topMargin: Theme.paddingSmall
|
|
||||||
rightMargin: Theme.paddingLarge
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
pageStack.push(Qt.resolvedUrl("../ConversationPage.qml"), {
|
|
||||||
headerTitle: "Conversation",
|
|
||||||
toot_id: id,
|
|
||||||
toot_url: status_url,
|
|
||||||
//title: account_display_name,
|
|
||||||
description: '@'+account_acc,
|
|
||||||
avatar: account_avatar,
|
|
||||||
type: "reply"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -84,7 +84,7 @@ BackgroundItem {
|
||||||
"user_id": model.account_id,
|
"user_id": model.account_id,
|
||||||
"profileImage": model.account_avatar,
|
"profileImage": model.account_avatar,
|
||||||
"profileBackground": model.account_header
|
"profileBackground": model.account_header
|
||||||
})
|
} )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,17 +371,15 @@ BackgroundItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var m = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
var m = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
||||||
if (typeof mdl !== "undefined")
|
if (typeof mdl !== "undefined")
|
||||||
m.append(mdl.get(index))
|
m.append(mdl.get(index))
|
||||||
pageStack.push(Qt.resolvedUrl("../ConversationPage.qml"), {
|
pageStack.push(Qt.resolvedUrl("../ConversationPage.qml"), {
|
||||||
headerTitle: "Conversation",
|
headerTitle: qsTr("Conversation"),
|
||||||
toot_id: status_id,
|
"toot_id": status_id,
|
||||||
toot_url: status_url,
|
"toot_url": status_url,
|
||||||
toot_uri: status_uri,
|
"toot_uri": status_uri,
|
||||||
title: account_display_name,
|
"description": '@'+account_acct,
|
||||||
description: '@'+account_acct,
|
|
||||||
avatar: account_avatar,
|
|
||||||
mdl: m,
|
mdl: m,
|
||||||
type: "reply"
|
type: "reply"
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue