Added toot char counter
This commit is contained in:
parent
f3814a0cd5
commit
90ab1cd922
1 changed files with 31 additions and 3 deletions
|
@ -13,6 +13,7 @@ Page {
|
||||||
property string suggestedUser: ""
|
property string suggestedUser: ""
|
||||||
property ListModel suggestedModel;
|
property ListModel suggestedModel;
|
||||||
property string toot_id: ""
|
property string toot_id: ""
|
||||||
|
property int tootMaxChar: 500;
|
||||||
property ListModel mdl;
|
property ListModel mdl;
|
||||||
allowedOrientations: Orientation.All
|
allowedOrientations: Orientation.All
|
||||||
onSuggestedUserChanged: {
|
onSuggestedUserChanged: {
|
||||||
|
@ -129,8 +130,32 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: toot.height + (mediaModel.count ? uploadedImages.height : 0) + btnContentWarning.height + Theme.paddingMedium + (warningContent.visible ? warningContent.height : 0)
|
height: progressBar.height + toot.height + (mediaModel.count ? uploadedImages.height : 0) + btnContentWarning.height + Theme.paddingMedium + (warningContent.visible ? warningContent.height : 0)
|
||||||
dock: Dock.Bottom
|
dock: Dock.Bottom
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: progressBar.height
|
||||||
|
color: Theme.highlightBackgroundColor
|
||||||
|
opacity: 0.2
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: progressBar
|
||||||
|
width: toot.text.length ? panel.width*(toot.text.length/tootMaxChar) : 0;
|
||||||
|
|
||||||
|
height: Theme.itemSizeSmall * 0.05
|
||||||
|
color: Theme.highlightBackgroundColor
|
||||||
|
opacity: 0.7
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: warningContent
|
id: warningContent
|
||||||
visible: false
|
visible: false
|
||||||
|
@ -178,6 +203,7 @@ Page {
|
||||||
textOperations.selectWord()
|
textOperations.selectWord()
|
||||||
textOperations.select(textOperations.selectionStart ? textOperations.selectionStart-1 : 0, textOperations.selectionEnd)
|
textOperations.select(textOperations.selectionStart ? textOperations.selectionStart-1 : 0, textOperations.selectionEnd)
|
||||||
//console.log(textOperations.text.substr(textOperations.selectionStart, textOperations.selectionEnd))
|
//console.log(textOperations.text.substr(textOperations.selectionStart, textOperations.selectionEnd))
|
||||||
|
console.log(toot.text.length)
|
||||||
suggestedUser = ""
|
suggestedUser = ""
|
||||||
if (textOperations.selectedText.charAt(0) === "@") {
|
if (textOperations.selectedText.charAt(0) === "@") {
|
||||||
suggestedUser = textOperations.selectedText.trim().substring(1);
|
suggestedUser = textOperations.selectedText.trim().substring(1);
|
||||||
|
@ -327,7 +353,7 @@ Page {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: Theme.paddingLarge
|
rightMargin: Theme.paddingLarge
|
||||||
}
|
}
|
||||||
enabled: toot.text !== ""
|
enabled: toot.text !== "" && toot.text.length < tootMaxChar
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var visibility = [ "public", "unlisted", "private", "direct"];
|
var visibility = [ "public", "unlisted", "private", "direct"];
|
||||||
var media_ids = [];
|
var media_ids = [];
|
||||||
|
@ -398,7 +424,9 @@ Page {
|
||||||
console.log(JSON.stringify())
|
console.log(JSON.stringify())
|
||||||
|
|
||||||
worker.sendMessage({
|
worker.sendMessage({
|
||||||
'action' : 'statuses/'+mdl.get(0).status_id+'/context',
|
//'action' : 'statuses/'+mdl.get(0).status_id+'/context',
|
||||||
|
'action' : 'statuses/100950096657457234/context',
|
||||||
|
|
||||||
'method' : 'GET',
|
'method' : 'GET',
|
||||||
'model' : mdl,
|
'model' : mdl,
|
||||||
'params' : { },
|
'params' : { },
|
||||||
|
|
Loading…
Reference in a new issue