replaced segmented control with buttons to launch seperate page views
This commit is contained in:
parent
7fcfaac2bc
commit
af24b6ae69
4 changed files with 121 additions and 76 deletions
|
@ -267,7 +267,4 @@ Container {
|
|||
return ""
|
||||
}
|
||||
}
|
||||
onCreationCompleted: {
|
||||
console.log(" My Height is " + postitem.preferredHeight)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,78 +173,119 @@ Page {
|
|||
}
|
||||
|
||||
}
|
||||
SegmentedControl {
|
||||
Option {
|
||||
id: opt_posts
|
||||
text: qsTr("Posts")
|
||||
}
|
||||
Option {
|
||||
id: opt_following
|
||||
text: qsTr("Following")
|
||||
}
|
||||
Option {
|
||||
id: opt_followers
|
||||
text: qsTr("Followers")
|
||||
}
|
||||
onSelectedOptionChanged: {
|
||||
if (selectedOption == opt_posts) {
|
||||
threadModel.clear()
|
||||
getPosts(user.id)
|
||||
} else if (selectedOption == opt_following) {
|
||||
threadModel.clear()
|
||||
// do something
|
||||
} else if (selectedOption == opt_followers) {
|
||||
threadModel.clear()
|
||||
// do something
|
||||
}
|
||||
}
|
||||
Divider {
|
||||
|
||||
}
|
||||
ListView {
|
||||
id: threadView
|
||||
//preferredHeight: threadModel.size()
|
||||
//preferredHeight: ( height of content row + content padding ) * count of entires in ListView
|
||||
dataModel: ArrayDataModel {
|
||||
id: threadModel
|
||||
Container {
|
||||
layout: StackLayout {
|
||||
orientation: LayoutOrientation.LeftToRight
|
||||
}
|
||||
listItemComponents: [
|
||||
ListItemComponent {
|
||||
id: root
|
||||
PostItem {
|
||||
id: postitem
|
||||
Container {
|
||||
leftPadding: ui.sdu(1)
|
||||
rightPadding: ui.sdu(.5)
|
||||
Button {
|
||||
text: qsTr("Posts")
|
||||
onClicked: {
|
||||
var page = postPage.createObject()
|
||||
pnut.userStreamReceived.connect(page.loadThread);
|
||||
pnut.getUserStream(user.id)
|
||||
//page.follow.connect(pnut.followUser)
|
||||
//page.unfollow.connect(pnut.unfollowUser)
|
||||
//page.block.connect(pnut.blockUser)
|
||||
//page.unblock.connect(pnut.unblockUser)
|
||||
//page.mute.connect(pnut.muteUser)
|
||||
//page.unmute.connect(pnut.unmuteUser)
|
||||
nav.push(page);
|
||||
}
|
||||
}
|
||||
]
|
||||
function sendReply(text, pid) {
|
||||
pnut.sendReply(text, pid);
|
||||
}
|
||||
function getUserName() {
|
||||
return _app.setting("username")
|
||||
}
|
||||
function viewProfile(userobj) {
|
||||
var page = profilePage.createObject();
|
||||
page.user = userobj
|
||||
page.follow.connect(follow)
|
||||
page.unfollow.connect(unfollow)
|
||||
page.block.connect(block)
|
||||
page.unblock.connect(unblock)
|
||||
page.mute.connect(mute)
|
||||
page.unmute.connect(unmute)
|
||||
nav.push(page);
|
||||
}
|
||||
function ccOnReply() {
|
||||
if (_app.setting("cc") === "true") {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
Container {
|
||||
leftPadding: ui.sdu(.5)
|
||||
rightPadding: ui.sdu(.5)
|
||||
Button {
|
||||
text: qsTr("Following")
|
||||
}
|
||||
}
|
||||
Container {
|
||||
leftPadding: ui.sdu(.5)
|
||||
rightPadding: ui.sdu(1)
|
||||
Button {
|
||||
text: qsTr("Followers")
|
||||
}
|
||||
}
|
||||
}
|
||||
// SegmentedControl {
|
||||
// Option {
|
||||
// id: opt_posts
|
||||
// text: qsTr("Posts")
|
||||
// }
|
||||
// Option {
|
||||
// id: opt_following
|
||||
// text: qsTr("Following")
|
||||
// }
|
||||
// Option {
|
||||
// id: opt_followers
|
||||
// text: qsTr("Followers")
|
||||
// }
|
||||
// onSelectedOptionChanged: {
|
||||
// if (selectedOption == opt_posts) {
|
||||
// threadModel.clear()
|
||||
// getPosts(user.id)
|
||||
// } else if (selectedOption == opt_following) {
|
||||
// threadModel.clear()
|
||||
// // do something
|
||||
// } else if (selectedOption == opt_followers) {
|
||||
// threadModel.clear()
|
||||
// // do something
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ListView {
|
||||
// id: threadView
|
||||
// //preferredHeight: threadModel.size()
|
||||
// //preferredHeight: ( height of content row + content padding ) * count of entires in ListView
|
||||
// dataModel: ArrayDataModel {
|
||||
// id: threadModel
|
||||
// }
|
||||
// listItemComponents: [
|
||||
// ListItemComponent {
|
||||
// id: root
|
||||
// PostItem {
|
||||
// id: postitem
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// function sendReply(text, pid) {
|
||||
// pnut.sendReply(text, pid);
|
||||
// }
|
||||
// function getUserName() {
|
||||
// return _app.setting("username")
|
||||
// }
|
||||
// function viewProfile(userobj) {
|
||||
// var page = profilePage.createObject();
|
||||
// page.user = userobj
|
||||
// page.follow.connect(follow)
|
||||
// page.unfollow.connect(unfollow)
|
||||
// page.block.connect(block)
|
||||
// page.unblock.connect(unblock)
|
||||
// page.mute.connect(mute)
|
||||
// page.unmute.connect(unmute)
|
||||
// nav.push(page);
|
||||
// }
|
||||
// function ccOnReply() {
|
||||
// if (_app.setting("cc") === "true") {
|
||||
// return true
|
||||
// } else {
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
function loadThread(data) {
|
||||
threadModel.append(data);
|
||||
}
|
||||
// function loadThread(data) {
|
||||
// threadModel.append(data);
|
||||
// }
|
||||
|
||||
actions: [
|
||||
ActionItem {
|
||||
|
@ -287,4 +328,11 @@ Page {
|
|||
enabled: (_app.setting("username") === user.username) ? false : true
|
||||
}
|
||||
]
|
||||
|
||||
attachedObjects: [
|
||||
ComponentDefinition {
|
||||
id: postPage
|
||||
source: "ThreadPage.qml"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -74,15 +74,15 @@ NavigationPane {
|
|||
function viewProfile(userobj) {
|
||||
var page = profilePage.createObject();
|
||||
page.user = userobj
|
||||
pnut.userStreamReceived.connect(page.loadThread)
|
||||
pnut.getUserStream(userobj.id)
|
||||
//pnut.userStreamReceived.connect(page.loadThread)
|
||||
//pnut.getUserStream(userobj.id)
|
||||
page.follow.connect(pnut.followUser)
|
||||
page.unfollow.connect(pnut.unfollowUser)
|
||||
page.block.connect(pnut.blockUser)
|
||||
page.unblock.connect(pnut.unblockUser)
|
||||
page.mute.connect(pnut.muteUser)
|
||||
page.unmute.connect(pnut.unmuteUser)
|
||||
page.getPosts.connect(pnut.getUserStream)
|
||||
//page.getPosts.connect(pnut.getUserStream)
|
||||
nav.push(page);
|
||||
}
|
||||
function sendReply(text, pid) {
|
||||
|
|
|
@ -84,19 +84,19 @@
|
|||
<name>ProfilePage</name>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="127"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="183"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="206"/>
|
||||
<source>Following</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="140"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="187"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="213"/>
|
||||
<source>Followers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="153"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="179"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="187"/>
|
||||
<source>Posts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -106,32 +106,32 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="251"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="292"/>
|
||||
<source>Unfollow</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="251"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="292"/>
|
||||
<source>Follow</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="264"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="305"/>
|
||||
<source>Unmute</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="264"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="305"/>
|
||||
<source>Mute</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="277"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="318"/>
|
||||
<source>Unblock</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/ProfilePage.qml" line="277"/>
|
||||
<location filename="../assets/ProfilePage.qml" line="318"/>
|
||||
<source>Block</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Reference in a new issue