New Toot option added

This commit is contained in:
Dusko Angirevic 2017-06-08 00:53:54 +02:00
parent c157ba28ee
commit a24eb2d25c
8 changed files with 239 additions and 17 deletions

View file

@ -55,4 +55,5 @@ DISTFILES += \
qml/pages/Browser.qml \
qml/pages/Profile.qml \
qml/pages/components/ProfileHeader.qml \
qml/images/boosted.svg
qml/images/boosted.svg \
qml/pages/Conversation.qml

View file

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.1, 2017-06-07T14:47:24. -->
<!-- Written by QtCreator 4.0.1, 2017-06-07T20:23:18. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{25497605-1bff-4134-a878-76c1475dd8e3}</value>
<value type="QByteArray">{41ec03ca-9430-48f3-b421-990d428b2838}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
@ -61,12 +61,12 @@
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">MerSDK-SailfishOS-i486</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">MerSDK-SailfishOS-i486</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{f49c1b5a-d715-401a-9a10-0e5fe9e5b72a}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{fd18ca89-dfc9-4054-9c53-c67be7689951}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">2</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -138,7 +138,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -210,7 +210,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -396,7 +396,7 @@
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="MerRunConfiguration.QmlLiveBenchWorkspace">C:/Users/dysko/SF/harbour-tooter</value>
<value type="QString" key="MerRunConfiguration.QmlLiveBenchWorkspace">/Users/dysko/GIT/harbour-tooter</value>
<value type="bool" key="MerRunConfiguration.QmlLiveEnabled">false</value>
<value type="int" key="MerRunConfiguration.QmlLiveIpcPort">10234</value>
<value type="int" key="MerRunConfiguration.QmlLiveOptions">3</value>
@ -426,12 +426,12 @@
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">MerSDK-SailfishOS-armv7hl</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">MerSDK-SailfishOS-armv7hl</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{588087e2-ecc1-41aa-b652-86f16cba9351}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{f895389d-b51a-4d4f-8b03-5ec64bda6f66}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">2</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -503,7 +503,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -575,7 +575,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -761,7 +761,7 @@
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="MerRunConfiguration.QmlLiveBenchWorkspace">C:/Users/dysko/SF/harbour-tooter</value>
<value type="QString" key="MerRunConfiguration.QmlLiveBenchWorkspace">/Users/dysko/GIT/harbour-tooter</value>
<value type="bool" key="MerRunConfiguration.QmlLiveEnabled">false</value>
<value type="int" key="MerRunConfiguration.QmlLiveIpcPort">10234</value>
<value type="int" key="MerRunConfiguration.QmlLiveOptions">3</value>
@ -779,7 +779,7 @@
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</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.UseQmlDebuggerAuto">true</value>
</valuemap>

View file

@ -134,7 +134,7 @@ function parseToot (data){
}
if(data['account']){
item['account_id'] = data['account']['id'];
item['account_username'] = data['account']['username'];
item['account_username'] = data['account']['acct'];
item['account_display_name'] = data['account']['display_name'];
item['account_locked'] = data['account']['locked'];
item['account_avatar'] = data['account']['avatar'];

140
qml/pages/Conversation.qml Normal file
View file

@ -0,0 +1,140 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "../lib/API.js" as Logic
import "./components/"
Page {
id: conversationPage
property string type;
property alias title: header.title
property alias description: header.description
property alias avatar: header.image
property int toot_id
WorkerScript {
id: worker
source: "../lib/Worker.js"
onMessage: {
console.log(JSON.stringify(messageObject))
}
}
ProfileHeader {
id: header
}
DockedPanel {
id: panel
open: true
width: parent.width
height: toot.height + btnAddImages.height + Theme.paddingMedium + (warningContent.visible ? warningContent.height : 0)
dock: Dock.Bottom
TextField {
id: warningContent
visible: false
height: visible ? implicitHeight : 0;
anchors {
top: parent.top
topMargin: Theme.paddingMedium
left: parent.left
right: parent.right
}
autoScrollEnabled: true
labelVisible: false
placeholderText: qsTr("Content warning!")
horizontalAlignment: Text.AlignLeft
EnterKey.onClicked: {
//tweet()
}
}
TextArea {
id: toot
anchors {
top: warningContent.bottom
topMargin: Theme.paddingMedium
left: parent.left
right: parent.right
}
autoScrollEnabled: true
labelVisible: false
focus: true
text: description !== "" && (description.charAt(0) == '@' || description.charAt(0) == '#') ? description+' ' : ''
height: implicitHeight
horizontalAlignment: Text.AlignLeft
EnterKey.onClicked: {
//tweet()
}
}
IconButton {
id: btnAddImages
enabled: false
anchors {
verticalCenter: btnSend.verticalCenter
left: parent.left
leftMargin: Theme.paddingMedium
}
icon.source: "image://theme/icon-s-attach?" + (pressed
? Theme.highlightColor
: Theme.primaryColor)
onClicked: console.log("Delete!")
}
IconButton {
id: btnContentWarning
anchors {
verticalCenter: btnSend.verticalCenter
left: btnAddImages.right
}
icon.source: "image://theme/icon-s-high-importance?" + (pressed
? Theme.highlightColor
: (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor))
onClicked: warningContent.visible = !warningContent.visible
}
ComboBox {
id: privacy
anchors {
top: toot.bottom
left: btnContentWarning.right
right: btnSend.left
}
menu: ContextMenu {
MenuItem { text: qsTr("public") }
MenuItem { text: qsTr("unlisted") }
MenuItem { text: qsTr("followers only") }
MenuItem { text: qsTr("direct") }
}
}
IconButton {
id: btnSend
icon.source: "image://theme/icon-m-enter?" + (pressed
? Theme.highlightColor
: Theme.primaryColor)
anchors {
top: toot.bottom
right: parent.right
rightMargin: Theme.paddingLarge
}
onClicked: {
var visibility = [ "public", "unlisted", "private", "direct"];
var msg = {
'action' : 'statuses',
'method' : 'POST',
'params' : {
"status": toot.text,
"visibility": visibility[privacy.currentIndex]
},
'conf' : Logic.conf
};
if (toot_id > 0)
msg.params['in_reply_to_id'] = toot_id
if (warningContent.visible && warningContent.text.length > 0){
msg.params['sensitive'] = 1
msg.params['spoiler_text'] = warningContent.text
}
worker.sendMessage(msg);
console.log(JSON.stringify(msg));
}
}
}
}

View file

@ -134,6 +134,25 @@ Page {
Component.onCompleted: {
}
}
IconButton {
anchors {
right: (mainPage.isPortrait ? parent.right : infoPanel.left)
bottom: (mainPage.isPortrait ? infoPanel.top : parent.bottom)
margins: {
left: Theme.paddingLarge
bottom: Theme.paddingLarge
}
}
id: newTweet
width: Theme.iconSizeLarge
height: width
visible: !isPortrait ? true : !infoPanel.open
icon.source: "image://theme/icon-l-add"
onClicked: {
pageStack.push(Qt.resolvedUrl("Conversation.qml"), {title: qsTr("New Toot"), type: "new"})
}
}
function onLinkActivated(href){
if (href[0] === '#' || href[0] === '@' ) {

View file

@ -177,5 +177,13 @@ BackgroundItem {
font.pixelSize: Theme.fontSizeSmall
color: (pressed ? Theme.highlightColor : Theme.primaryColor)
}
onClicked: {
pageStack.push(Qt.resolvedUrl("../Conversation.qml"), {
toot_id: id,
title: account_display_name,
description: '@'+account_username,
avatar: account_avatar,
type: "reply"
})
}
}

View file

@ -27,6 +27,29 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Conversation</name>
<message>
<source>Content warning!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>public</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>unlisted</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>followers only</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>direct</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
@ -45,6 +68,10 @@
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>New Toot</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MyList</name>

View file

@ -27,6 +27,29 @@
<translation>Reading mode</translation>
</message>
</context>
<context>
<name>Conversation</name>
<message>
<source>Content warning!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>public</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>unlisted</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>followers only</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>direct</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
@ -45,6 +68,10 @@
<source>Search</source>
<translation>Search</translation>
</message>
<message>
<source>New Toot</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MyList</name>