issue #38 fix + ui-improvements

This commit is contained in:
molan-git 2020-06-04 11:17:06 +02:00
parent eac5aac326
commit 75e4a71955
8 changed files with 234 additions and 237 deletions

View file

@ -74,11 +74,13 @@ Page {
} }
Item { Item {
id: tlSearch; id: tlSearch
property ListModel mdl: ListModel {}
property string search
width: parent.itemWidth width: parent.itemWidth
height: parent.itemHeight height: parent.itemHeight
property ListModel mdl: ListModel {}
property string search;
onSearchChanged: { onSearchChanged: {
console.log(search) console.log(search)
loader.sourceComponent = loading loader.sourceComponent = loading
@ -241,7 +243,7 @@ Page {
navigation.navigateTo('search') navigation.navigateTo('search')
} else { } else {
Qt.openUrlExternally(href); Qt.openUrlExternally(href)
} }
} }

View file

@ -1,8 +1,8 @@
import QtQuick 2.0 import QtQuick 2.0
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import QtGraphicalEffects 1.0
import "../lib/API.js" as Logic import "../lib/API.js" as Logic
import "./components/" import "./components/"
import QtGraphicalEffects 1.0
Page { Page {
@ -12,6 +12,9 @@ Page {
property string display_name: "" property string display_name: ""
property string username: "" property string username: ""
property string profileImage: "" property string profileImage: ""
property string profileBackground: ""
property string note: ""
property string url: ""
property int user_id property int user_id
property int statuses_count property int statuses_count
property int following_count property int following_count
@ -19,17 +22,14 @@ Page {
property int favourites_count property int favourites_count
property int reblogs_count property int reblogs_count
property int count_moments property int count_moments
property string profileBackground: ""
property string note: ""
property string url: ""
property bool locked: false property bool locked: false
property date created_at
property bool following: false property bool following: false
property bool requested: false property bool requested: false
property bool followed_by: false property bool followed_by: false
property bool blocking: false property bool blocking: false
property bool muting: false property bool muting: false
property bool domain_blocking: false property bool domain_blocking: false
property date created_at
WorkerScript { WorkerScript {
id: worker id: worker
@ -106,6 +106,7 @@ Page {
} }
} }
} }
// The effective value will be restricted by ApplicationWindow.allowedOrientations // The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
Component.onCompleted: { Component.onCompleted: {
@ -155,8 +156,7 @@ Page {
} }
} }
// ProfilePage ExpandingSection ExpandingSectionGroup { // ProfilePage ExpandingSection
ExpandingSectionGroup {
id: profileExpander id: profileExpander
anchors { anchors {
bottom: parent.bottom bottom: parent.bottom
@ -168,17 +168,16 @@ Page {
id: expandingSection1 id: expandingSection1
title: qsTr("About") title: qsTr("About")
content.sourceComponent: Column { content.sourceComponent: Column {
height: Math.min(txtContainer, parent.height*0.7) height: Math.min( txtContainer, parent.height * 0.7 )
spacing: Theme.paddingSmall spacing: Theme.paddingLarge
anchors.bottomMargin: Theme.paddingLarge
Rectangle { Item {
id: txtContainer id: txtContainer
width: parent.width width: parent.width
height: Math.min(txtNote.height, parent.height*0.5) height: Math.min( txtNote.height, parent.height * 0.55 )
color: "transparent" //color: "transparent"
visible: { visible: {
if ((note.text === "") || (note.text === "<p></p>") ) { if ((note.text === "") || ( note.text === "<p></p>" )) {
false false
} else { } else {
true true
@ -187,23 +186,21 @@ Page {
SilicaFlickable { SilicaFlickable {
id: txtFlickable id: txtFlickable
anchors.fill: parent
contentWidth: parent.width contentWidth: parent.width
contentHeight: txtNote.height contentHeight: txtNote.height
anchors.topMargin: Theme.paddingMedium anchors.fill: parent
anchors.bottomMargin: Theme.paddingMedium
clip: true clip: true
quickScroll: false
VerticalScrollDecorator {} VerticalScrollDecorator {}
Text { Label {
id: txtNote id: txtNote
text: note text: note
textFormat: Text.StyledText textFormat: Text.StyledText
wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.secondaryColor color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
linkColor: Theme.highlightColor linkColor: Theme.highlightColor
wrapMode: Text.Wrap
width: parent.width - ( 2 * Theme.horizontalPageMargin ) width: parent.width - ( 2 * Theme.horizontalPageMargin )
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
onLinkActivated: { onLinkActivated: {
@ -219,8 +216,13 @@ Page {
return check; return check;
})); }));
send(link) send(link)
/* Function still missing for user accounts */ } else if (test.length === 4 && test[3][0] === "@" ) {
// } else if (test.length === 4 && test[3][0] === "@" ) { pageStack.pop(pageStack.find(function(page) {
var check = page.isFirstPage === true;
if (check)
page.onLinkActivated(link)
return check;
}));
} else { } else {
Qt.openUrlExternally(link); Qt.openUrlExternally(link);
} }
@ -229,11 +231,14 @@ Page {
} }
} }
Item { // dummy item for spacing
height: Theme.paddingSmall
}
Row { Row {
id: statsRow id: statsRow
spacing: Theme.paddingLarge spacing: Theme.paddingLarge
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: Theme.paddingMedium
anchors.leftMargin: Theme.paddingLarge anchors.leftMargin: Theme.paddingLarge
anchors.rightMargin: Theme.paddingLarge anchors.rightMargin: Theme.paddingLarge
@ -274,15 +279,8 @@ Page {
} */ } */
} }
Label { Item { // dummy item for spacing
id: separatorLabel1 height: Theme.paddingSmall
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
anchors {
horizontalCenter: parent.horizontalCenter
}
} }
ButtonLayout { ButtonLayout {
@ -350,39 +348,23 @@ Page {
} }
} }
Separator {
id: btnSeparator
width: parent.width
height: Theme.paddingMedium
color: Theme.primaryColor
opacity: 0.0
horizontalAlignment: Qt.AlignHCenter
}
Button { Button {
id: btnBrowser id: btnBrowser
text: qsTr("Open in Browser") text: qsTr("Open in Browser")
preferredWidth: Theme.buttonWidthMedium preferredWidth: Theme.buttonWidthMedium
anchors { anchors.horizontalCenter: parent.horizontalCenter
horizontalCenter: parent.horizontalCenter
}
onClicked: { onClicked: {
Qt.openUrlExternally(url); Qt.openUrlExternally(url)
} }
} }
Label { Rectangle { // dummy item for spacing
id: separatorLabel2 height: Theme.paddingSmall
x: Theme.horizontalPageMargin width: parent.width
width: parent.width - ( 2 * Theme.horizontalPageMargin ) opacity: 0
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
anchors {
horizontalCenter: parent.horizontalCenter
}
} }
} }
} }
} }
} }

View file

@ -25,7 +25,7 @@ Page {
title: qsTr("Settings") title: qsTr("Settings")
} }
SectionHeader { text: "Options"} SectionHeader { text: qsTr("Options")}
IconTextSwitch { IconTextSwitch {
text: qsTr("Load Images in Toots") text: qsTr("Load Images in Toots")
@ -38,7 +38,7 @@ Page {
} }
} }
SectionHeader { text: "Account"} SectionHeader { text: qsTr("Account")}
Item { Item {
id: removeAccount id: removeAccount
@ -53,7 +53,7 @@ Page {
Icon { Icon {
id: icnRemoveAccount id: icnRemoveAccount
color: Theme.secondaryColor color: Theme.highlightColor
width: Theme.iconSizeMedium width: Theme.iconSizeMedium
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: Logic.conf['login'] ? "image://theme/icon-m-contact" : "image://theme/icon-m-add" source: Logic.conf['login'] ? "image://theme/icon-m-contact" : "image://theme/icon-m-add"
@ -96,7 +96,7 @@ Page {
text: Logic.conf['login'] ? qsTr("Deauthorize this app from using your account and remove account data from phone") : qsTr("Authorize this app to access your Mastodon account") text: Logic.conf['login'] ? qsTr("Deauthorize this app from using your account and remove account data from phone") : qsTr("Authorize this app to access your Mastodon account")
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap wrapMode: Text.Wrap
color: Theme.secondaryColor color: Theme.highlightColor
anchors { anchors {
left: parent.left left: parent.left
leftMargin: Theme.paddingLarge * 1.9 leftMargin: Theme.paddingLarge * 1.9
@ -107,24 +107,25 @@ Page {
} }
} }
/* SectionHeader { text: "Support"} SectionHeader {
text: qsTr("Translate")
}
IconTextSwitch { LinkedLabel {
text: qsTr("Translate") text: qsTr("Use <a href='https://www.transifex.com/dysko/tooter/'>Transifex</a> to help with app translation to your language.")
description: qsTr("Use Transifex to help with app translation to your language") textFormat: Text.StyledText
icon.source: "image://theme/icon-m-font-size" color: Theme.highlightColor
onCheckedChanged: { linkColor: Theme.primaryColor
busy = true; font.family: Theme.fontFamilyHeading
checked = false; font.pixelSize: Theme.fontSizeExtraSmall
Qt.openUrlExternally("https://www.transifex.com/dysko/tooter/"); wrapMode: Text.Wrap
timer2.start() anchors {
left: parent.left
leftMargin: Theme.horizontalPageMargin
right: parent.right
rightMargin: Theme.paddingLarge
} }
Timer { }
id: timer2
interval: 4700
onTriggered: parent.busy = false
}
} */
SectionHeader { SectionHeader {
text: qsTr("Credits") text: qsTr("Credits")

View file

@ -12,14 +12,14 @@ DockedPanel {
id: content id: content
color: Theme.highlightBackgroundColor color: Theme.highlightBackgroundColor
width: root.width width: root.width
height: infoLabel.height + 3*Theme.paddingMedium height: infoLabel.height + 2 * Theme.paddingMedium
Label { Label {
id: infoLabel id: infoLabel
text : "" text : ""
font.family: Theme.fontFamilyHeading font.family: Theme.fontFamilyHeading
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.highlightColor color: Theme.primaryColor
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
width: parent.width width: parent.width
anchors { anchors {

View file

@ -30,6 +30,8 @@ FullscreenContentPage {
id: videoFlickable id: videoFlickable
visible: false visible: false
anchors.fill: parent anchors.fill: parent
contentWidth: imageContainer.width
contentHeight: imageContainer.height
clip: true clip: true
Image { Image {
@ -113,43 +115,44 @@ FullscreenContentPage {
rightMargin: Theme.horizontalPageMargin + Theme.iconSizeMedium rightMargin: Theme.horizontalPageMargin + Theme.iconSizeMedium
bottomMargin: Theme.horizontalPageMargin bottomMargin: Theme.horizontalPageMargin
} }
MouseArea {
anchors.fill: parent
onClicked: function() {
if (video.playbackState === MediaPlayer.PlayingState)
video.pause()
else
video.play()
}
}
Rectangle {
visible: videoError.text != ""
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
color: Theme.highlightDimmerColor
height: videoError.height + 2*Theme.paddingMedium
width: parent.width
Label {
id: videoError
visible: false
text: video.errorString
font.pixelSize: Theme.fontSizeSmall
color: Theme.highlightColor
wrapMode: Text.Wrap
width: parent.width - 2*Theme.paddingMedium
height: contentHeight
anchors.centerIn: parent
}
}
} }
MouseArea {
anchors.fill: parent
onClicked: function() {
if (video.playbackState === MediaPlayer.PlayingState)
video.pause()
else
video.play()
}
}
Rectangle {
visible: videoError.text != ""
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
color: Theme.highlightDimmerColor
height: videoError.height + 2*Theme.paddingMedium
width: parent.width
Label {
id: videoError
visible: false
text: video.errorString
font.pixelSize: Theme.fontSizeSmall
color: Theme.highlightColor
wrapMode: Text.Wrap
width: parent.width - 2*Theme.paddingMedium
height: contentHeight
anchors.centerIn: parent
}
}
} }
} }
Flickable { Flickable {
id: imageFlickable id: imageFlickable
visible: false visible: false
@ -158,7 +161,7 @@ FullscreenContentPage {
clip: true clip: true
anchors.fill: parent anchors.fill: parent
onHeightChanged: if (imagePreview.status === Image.Ready) { onHeightChanged: if (imagePreview.status === Image.Ready) {
imagePreview.fitToScreen() imagePreview.fitToScreen();
} }
Item { Item {
@ -190,6 +193,15 @@ FullscreenContentPage {
} }
} }
NumberAnimation {
id: loadedAnimation
target: imagePreview
property: "opacity"
duration: 250
from: 0; to: 1
easing.type: Easing.InOutQuad
}
onScaleChanged: { onScaleChanged: {
if ((width * scale) > imageFlickable.width) { if ((width * scale) > imageFlickable.width) {
var xoff = (imageFlickable.width / 2 + imageFlickable.contentX) * scale / prevScale; var xoff = (imageFlickable.width / 2 + imageFlickable.contentX) * scale / prevScale;
@ -199,15 +211,7 @@ FullscreenContentPage {
var yoff = (imageFlickable.height / 2 + imageFlickable.contentY) * scale / prevScale; var yoff = (imageFlickable.height / 2 + imageFlickable.contentY) * scale / prevScale;
imageFlickable.contentY = yoff - imageFlickable.height / 2 imageFlickable.contentY = yoff - imageFlickable.height / 2
} }
} prevScale = scale
NumberAnimation {
id: loadedAnimation
target: imagePreview
property: "opacity"
duration: 250
from: 0; to: 1
easing.type: Easing.InOutQuad
} }
} }
} }
@ -245,47 +249,45 @@ FullscreenContentPage {
from: imagePreview.scale from: imagePreview.scale
} }
} }
}
Loader { Loader {
anchors.centerIn: parent anchors.centerIn: parent
sourceComponent: { sourceComponent: {
switch (imagePreview.status) { switch (imagePreview.status) {
case Image.Loading: case Image.Loading:
return loadingIndicator return loadingIndicator
case Image.Error: case Image.Error:
return failedLoading return failedLoading
default: default:
return undefined return undefined
}
}
Component {
id: loadingIndicator
Item {
width: mediaPage.width
height: childrenRect.height
ProgressCircle {
id: imageLoadingIndicator
progressValue: imagePreview.progress
progressColor: inAlternateCycle ? Theme.highlightColor : Theme.highlightDimmerColor
backgroundColor: inAlternateCycle ? Theme.highlightDimmerColor : Theme.highlightColor
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
Component {
id: failedLoading
Text {
text: qsTr("Error loading")
font.pixelSize: Theme.fontSizeSmall;
color: Theme.highlightColor
}
} }
} }
VerticalScrollDecorator { flickable: imageFlickable } Component {
id: loadingIndicator
Item {
width: mediaPage.width
height: childrenRect.height
ProgressCircle {
id: imageLoadingIndicator
progressValue: imagePreview.progress
progressColor: inAlternateCycle ? Theme.highlightColor : Theme.highlightDimmerColor
backgroundColor: inAlternateCycle ? Theme.highlightDimmerColor : Theme.highlightColor
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
}
Component {
id: failedLoading
Text {
text: qsTr("Error loading")
font.pixelSize: Theme.fontSizeSmall;
color: Theme.highlightColor
}
} }
IconButton { IconButton {
@ -314,5 +316,6 @@ FullscreenContentPage {
FileDownloader.downloadFile(mediaURL, filename[filename.length-1]); FileDownloader.downloadFile(mediaURL, filename[filename.length-1]);
} }
} }
VerticalScrollDecorator { flickable: imageFlickable }
} }

View file

@ -6,6 +6,7 @@ import "."
SilicaListView { SilicaListView {
id: myList id: myList
property string type property string type
property string title property string title
property string vwPlaceholderText: qsTr("Loading") property string vwPlaceholderText: qsTr("Loading")
@ -22,6 +23,7 @@ SilicaListView {
property variant conf property variant conf
property bool notifier: false property bool notifier: false
model: mdl model: mdl
signal notify (string what, int num) signal notify (string what, int num)
onNotify: { onNotify: {
console.log(what + " - " + num) console.log(what + " - " + num)
@ -109,6 +111,7 @@ SilicaListView {
loadData("append") loadData("append")
} }
} }
BusyIndicator { BusyIndicator {
size: BusyIndicatorSize.Small size: BusyIndicatorSize.Small
running: loadStarted; running: loadStarted;
@ -116,6 +119,7 @@ SilicaListView {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
} }
onContentYChanged: { onContentYChanged: {
if (Math.abs(contentY - scrollOffset) > Theme.itemSizeMedium) { if (Math.abs(contentY - scrollOffset) > Theme.itemSizeMedium) {
openDrawer(contentY - scrollOffset > 0 ? false : true ) openDrawer(contentY - scrollOffset > 0 ? false : true )
@ -139,7 +143,6 @@ SilicaListView {
if (messageObject.fireNotification && notifier){ if (messageObject.fireNotification && notifier){
Logic.notifier(messageObject.data) Logic.notifier(messageObject.data)
} }
} }
} }
@ -154,6 +157,7 @@ SilicaListView {
loadData("prepend") loadData("prepend")
} }
} }
function loadData(mode){ function loadData(mode){
var p = [] var p = []
if (params.length) if (params.length)

View file

@ -11,6 +11,7 @@ BackgroundItem {
//property string text: "0" //property string text: "0"
width: parent.width width: parent.width
height: lblText.paintedHeight + (lblText.text.length > 0 ? Theme.paddingLarge : 0 )+ lblName.paintedHeight + (type.length ? Theme.paddingLarge + iconRT.height : 0) + Theme.paddingLarge height: lblText.paintedHeight + (lblText.text.length > 0 ? Theme.paddingLarge : 0 )+ lblName.paintedHeight + (type.length ? Theme.paddingLarge + iconRT.height : 0) + Theme.paddingLarge
Image { Image {
id: iconRT id: iconRT
y: Theme.paddingLarge y: Theme.paddingLarge
@ -67,7 +68,6 @@ BackgroundItem {
}) })
} }
} }
} }
Label { Label {
@ -86,33 +86,33 @@ BackgroundItem {
Image { Image {
id: iconVerified id: iconVerified
visible: account_locked
y: Theme.paddingLarge 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 { anchors {
left: lblName.right left: lblName.right
leftMargin: Theme.paddingSmall leftMargin: Theme.paddingSmall
verticalCenter: lblName.verticalCenter verticalCenter: lblName.verticalCenter
} }
visible: account_locked
width: account_locked ? Theme.iconSizeExtraSmall*0.8 : 0
opacity: 0.8
height: width
source: "image://theme/icon-s-secure?" + (pressed
? Theme.highlightColor
: Theme.primaryColor)
} }
Label { Label {
id: lblScreenName id: lblScreenName
truncationMode: TruncationMode.Fade
text: '@'+account_username
font.pixelSize: Theme.fontSizeExtraSmall
color: (pressed ? Theme.secondaryHighlightColor : Theme.secondaryColor)
anchors { anchors {
left: iconVerified.right left: iconVerified.right
right: lblDate.left right: lblDate.left
leftMargin: Theme.paddingMedium leftMargin: Theme.paddingMedium
baseline: lblName.baseline baseline: lblName.baseline
} }
truncationMode: TruncationMode.Fade
text: '@'+account_username
font.pixelSize: Theme.fontSizeExtraSmall
color: (pressed ? Theme.secondaryHighlightColor : Theme.secondaryColor)
} }
Label { Label {
@ -122,9 +122,9 @@ BackgroundItem {
var elapsed = Format.formatDate(created_at, Formatter.DurationElapsedShort) var elapsed = Format.formatDate(created_at, Formatter.DurationElapsedShort)
return (elapsed ? elapsed : txt ) return (elapsed ? elapsed : txt )
} }
color: (pressed ? Theme.highlightColor : Theme.primaryColor)
text: Format.formatDate(created_at, new Date() - created_at < 60*60*1000 ? Formatter.DurationElapsedShort : Formatter.TimeValueTwentyFourHours) text: Format.formatDate(created_at, new Date() - created_at < 60*60*1000 ? Formatter.DurationElapsedShort : Formatter.TimeValueTwentyFourHours)
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
color: (pressed ? Theme.highlightColor : Theme.primaryColor)
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
anchors { anchors {
right: parent.right right: parent.right
@ -135,13 +135,6 @@ BackgroundItem {
Text { Text {
id: lblText id: lblText
anchors {
left: lblName.left
right: parent.right
top: lblScreenName.bottom
topMargin: Theme.paddingSmall
rightMargin: Theme.paddingLarge
}
height: content.length ? paintedHeight : 0 height: content.length ? paintedHeight : 0
onLinkActivated: { onLinkActivated: {
console.log(link) console.log(link)
@ -165,12 +158,20 @@ BackgroundItem {
} }
text: content text: content
textFormat: Text.RichText textFormat: Text.RichText
font.pixelSize: Theme.fontSizeSmall
color: (pressed ? Theme.highlightColor : Theme.primaryColor)
linkColor : Theme.highlightColor linkColor : Theme.highlightColor
wrapMode: Text.Wrap wrapMode: Text.Wrap
maximumLineCount: 6 maximumLineCount: 6
font.pixelSize: Theme.fontSizeSmall anchors {
color: (pressed ? Theme.highlightColor : Theme.primaryColor) left: lblName.left
right: parent.right
top: lblScreenName.bottom
topMargin: Theme.paddingSmall
rightMargin: Theme.paddingLarge
}
} }
onClicked: { onClicked: {
pageStack.push(Qt.resolvedUrl("../ConversationPage.qml"), { pageStack.push(Qt.resolvedUrl("../ConversationPage.qml"), {
headerTitle: "Conversation", headerTitle: "Conversation",

View file

@ -5,13 +5,16 @@ import "../../lib/API.js" as Logic
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: 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) 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)
Rectangle { Rectangle {
x: 0; x: 0
y: 0; y: 0
visible: status_visibility == 'direct' visible: status_visibility == 'direct'
width: parent.width width: parent.width
height: parent.height height: parent.height
@ -31,20 +34,20 @@ BackgroundItem {
Image { Image {
id: avatar id: avatar
visible: true
opacity: status === Image.Ready ? 1.0 : 0.0
Behavior on opacity { FadeAnimator {} }
asynchronous: true
smooth: true
source: account_avatar
width: Theme.iconSizeMedium
height: width
anchors { anchors {
top: miniStatus.visible ? miniStatus.bottom : parent.top top: miniStatus.visible ? miniStatus.bottom : parent.top
topMargin: miniStatus.visible ? Theme.paddingMedium : Theme.paddingLarge topMargin: miniStatus.visible ? Theme.paddingMedium : Theme.paddingLarge
left: parent.left left: parent.left
leftMargin: Theme.horizontalPageMargin leftMargin: Theme.horizontalPageMargin
} }
opacity: status === Image.Ready ? 1.0 : 0.0
Behavior on opacity { FadeAnimator {} }
asynchronous: true
width: Theme.iconSizeMedium
height: width
smooth: true
source: account_avatar
visible: true
onStatusChanged: { onStatusChanged: {
if (avatar.status === Image.Error) if (avatar.status === Image.Error)
source = "../../images/icon-m-profile.svg?" + (pressed source = "../../images/icon-m-profile.svg?" + (pressed
@ -63,20 +66,19 @@ BackgroundItem {
"profileBackground": model.account_header "profileBackground": model.account_header
}) })
} }
} }
Image { Image {
id: iconTR id: iconTR
visible: typeof status_reblogged !== "undefined" && status_reblogged
width: Theme.iconSizeExtraSmall
height: width
source: "image://theme/icon-s-retweet"
anchors { anchors {
top: avatar.bottom top: avatar.bottom
topMargin: Theme.paddingMedium topMargin: Theme.paddingMedium
left: avatar.left left: avatar.left
} }
visible: typeof status_reblogged !== "undefined" && status_reblogged
width: Theme.iconSizeExtraSmall
height: width
source: "image://theme/icon-s-retweet"
} }
Rectangle { Rectangle {
@ -90,15 +92,16 @@ BackgroundItem {
left: parent.left left: parent.left
leftMargin: -width/3 leftMargin: -width/3
} }
Image { Image {
asynchronous: true asynchronous: true
width: Theme.iconSizeSmall
height: width
smooth: true smooth: true
opacity: status === Image.Ready ? 1.0 : 0.0 opacity: status === Image.Ready ? 1.0 : 0.0
Behavior on opacity { FadeAnimator {} } Behavior on opacity { FadeAnimator {} }
source: typeof reblog_account_avatar !== "undefined" ? reblog_account_avatar : '' source: typeof reblog_account_avatar !== "undefined" ? reblog_account_avatar : ''
visible: typeof status_reblog !== "undefined" && status_reblog visible: typeof status_reblog !== "undefined" && status_reblog
width: Theme.iconSizeSmall
height: width
} }
} }
} }
@ -114,6 +117,13 @@ BackgroundItem {
Text { Text {
id: lblContent id: lblContent
text: content.replace(new RegExp("<a ", 'g'), '<a style="text-decoration: none; color:'+(pressed ? Theme.secondaryColor : Theme.highlightColor)+'" ')
textFormat: Text.RichText
font.pixelSize: Theme.fontSizeSmall
linkColor: Theme.highlightColor
wrapMode: Text.Wrap
color: (pressed ? Theme.highlightColor : (!highlight ? Theme.primaryColor : Theme.secondaryColor))
height: content.length ? (contentWarningLabel.paintedHeight > paintedHeight ? contentWarningLabel.paintedHeight : paintedHeight) : 0
anchors { anchors {
left: miniHeader.left left: miniHeader.left
leftMargin: Theme.paddingMedium leftMargin: Theme.paddingMedium
@ -123,7 +133,6 @@ BackgroundItem {
topMargin: Theme.paddingSmall topMargin: Theme.paddingSmall
bottomMargin: Theme.paddingLarge bottomMargin: Theme.paddingLarge
} }
height: content.length ? (contentWarningLabel.paintedHeight > paintedHeight ? contentWarningLabel.paintedHeight : paintedHeight) : 0
onLinkActivated: { onLinkActivated: {
var test = link.split("/") var test = link.split("/")
console.log(link) console.log(link)
@ -139,34 +148,32 @@ BackgroundItem {
})); }));
send(link) send(link)
} else if (test.length === 4 && test[3][0] === "@" ) { } else if (test.length === 4 && test[3][0] === "@" ) {
tlSearch.search = decodeURIComponent("@"+test[3].substring(1)+"@"+test[2]) pageStack.pop(pageStack.find(function(page) {
slideshow.positionViewAtIndex(4, ListView.SnapToItem) var check = page.isFirstPage === true;
navigation.navigateTo('search') if (check)
// Original component page.onLinkActivated(link)
/* pageStack.push(Qt.resolvedUrl("../Profile.qml"), { return check;
"name": "", }));
"username": test[3].substring(1)+"@"+test[2],
"profileImage": ""
}) */
} else { } else {
Qt.openUrlExternally(link); Qt.openUrlExternally(link);
} }
} }
text: content.replace(new RegExp("<a ", 'g'), '<a style="text-decoration: none; color:'+(pressed ? Theme.secondaryColor : Theme.highlightColor)+'" ')
linkColor: Theme.highlightColor
wrapMode: Text.Wrap
textFormat: Text.RichText
font.pixelSize: Theme.fontSizeSmall
color: (pressed ? Theme.highlightColor : (!highlight ? Theme.primaryColor : Theme.secondaryColor))
Rectangle { Rectangle {
anchors.fill: parent
radius: 2 radius: 2
color: Theme.highlightDimmerColor color: Theme.highlightDimmerColor
visible: status_spoiler_text.length > 0 visible: status_spoiler_text.length > 0
anchors.fill: parent
Label { Label {
id: contentWarningLabel id: contentWarningLabel
text: model.status_spoiler_text
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.highlightColor
truncationMode: TruncationMode.Fade
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
width: parent.width
anchors { anchors {
topMargin: Theme.paddingSmall topMargin: Theme.paddingSmall
left: parent.left left: parent.left
@ -176,16 +183,11 @@ BackgroundItem {
rightMargin: Theme.paddingMedium rightMargin: Theme.paddingMedium
bottomMargin: Theme.paddingSmall bottomMargin: Theme.paddingSmall
} }
width: parent.width
truncationMode: TruncationMode.Fade
color: Theme.highlightColor
wrapMode: Text.Wrap
text: model.status_spoiler_text
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: parent.visible = false; onClicked: parent.visible = false
} }
} }
@ -193,6 +195,8 @@ BackgroundItem {
MediaBlock { MediaBlock {
id: media id: media
model: typeof attachments !== "undefined" ? attachments : Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
height: Theme.iconSizeExtraLarge * 2
anchors { anchors {
left: lblContent.left left: lblContent.left
right: lblContent.right right: lblContent.right
@ -200,12 +204,11 @@ BackgroundItem {
topMargin: Theme.paddingSmall topMargin: Theme.paddingSmall
bottomMargin: Theme.paddingLarge bottomMargin: Theme.paddingLarge
} }
model: typeof attachments !== "undefined" ? attachments : Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
height: Theme.iconSizeExtraLarge * 2
} }
ContextMenu { ContextMenu {
id: mnu id: mnu
MenuItem { MenuItem {
enabled: model.type !== "follow" enabled: model.type !== "follow"
text: typeof model.reblogged !== "undefined" && model.reblogged ? qsTr("Unboost") : qsTr("Boost") text: typeof model.reblogged !== "undefined" && model.reblogged ? qsTr("Unboost") : qsTr("Boost")
@ -221,27 +224,28 @@ BackgroundItem {
model.reblogs_count = !status ? model.reblogs_count+1 : (model.reblogs_count > 0 ? model.reblogs_count-1 : model.reblogs_count); model.reblogs_count = !status ? model.reblogs_count+1 : (model.reblogs_count > 0 ? model.reblogs_count-1 : model.reblogs_count);
model.reblogged = !model.reblogged model.reblogged = !model.reblogged
} }
Image { Image {
id: icRT id: icRT
source: "image://theme/icon-s-retweet?" + (!model.reblogged ? Theme.highlightColor : Theme.primaryColor)
width: Theme.iconSizeExtraSmall
height: width
anchors { anchors {
leftMargin: Theme.horizontalPageMargin leftMargin: Theme.horizontalPageMargin
left: parent.left left: parent.left
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
width: Theme.iconSizeExtraSmall
height: width
source: "image://theme/icon-s-retweet?" + (!model.reblogged ? Theme.highlightColor : Theme.primaryColor)
} }
Label { Label {
text: reblogs_count
font.pixelSize: Theme.fontSizeExtraSmall
color: !model.reblogged ? Theme.highlightColor : Theme.primaryColor
anchors { anchors {
left: icRT.right left: icRT.right
leftMargin: Theme.paddingMedium leftMargin: Theme.paddingMedium
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
text: reblogs_count
font.pixelSize: Theme.fontSizeExtraSmall
color: !model.reblogged ? Theme.highlightColor : Theme.primaryColor
} }
} }
@ -274,14 +278,14 @@ BackgroundItem {
} }
Label { Label {
text: favourites_count
font.pixelSize: Theme.fontSizeExtraSmall
color: !model.favourited ? Theme.highlightColor : Theme.primaryColor
anchors { anchors {
left: icFA.right left: icFA.right
leftMargin: Theme.paddingMedium leftMargin: Theme.paddingMedium
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
text: favourites_count
font.pixelSize: Theme.fontSizeExtraSmall
color: !model.favourited ? Theme.highlightColor : Theme.primaryColor
} }
} }
} }