add segmented control

This commit is contained in:
Morgan McMillian 2016-11-11 16:10:08 -08:00
parent eee1fe6eda
commit 7fcfaac2bc
4 changed files with 68 additions and 32 deletions

View file

@ -64,13 +64,14 @@ Container {
Container { Container {
Label { Label {
id: username id: username
text: "<a href=\"#profile\">" + ListItemData.user.username + "</a>" text: ListItemData.user.username
activeTextHandler: ActiveTextHandler { // text: "<a href=\"#profile\">" + ListItemData.user.username + "</a>"
onTriggered: { // activeTextHandler: ActiveTextHandler {
postitem.ListItem.view.viewProfile(ListItemData.user) // onTriggered: {
} // postitem.ListItem.view.viewProfile(ListItemData.user)
} // }
textFormat: TextFormat.Html // }
// textFormat: TextFormat.Html
} }
} }
} }
@ -266,4 +267,7 @@ Container {
return "" return ""
} }
} }
onCreationCompleted: {
console.log(" My Height is " + postitem.preferredHeight)
}
} }

View file

@ -32,6 +32,7 @@ Page {
signal unblock(string uid) signal unblock(string uid)
signal mute(string uid) signal mute(string uid)
signal unmute(string uid) signal unmute(string uid)
signal getPosts(string uid)
ScrollView { ScrollView {
Container { Container {
@ -172,10 +173,36 @@ Page {
} }
} }
Divider { 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 { ListView {
id: threadView id: threadView
//preferredHeight: threadModel.size()
//preferredHeight: ( height of content row + content padding ) * count of entires in ListView
dataModel: ArrayDataModel { dataModel: ArrayDataModel {
id: threadModel id: threadModel
} }
@ -183,6 +210,7 @@ Page {
ListItemComponent { ListItemComponent {
id: root id: root
PostItem { PostItem {
id: postitem
} }
} }
] ]

View file

@ -82,6 +82,7 @@ NavigationPane {
page.unblock.connect(pnut.unblockUser) page.unblock.connect(pnut.unblockUser)
page.mute.connect(pnut.muteUser) page.mute.connect(pnut.muteUser)
page.unmute.connect(pnut.unmuteUser) page.unmute.connect(pnut.unmuteUser)
page.getPosts.connect(pnut.getUserStream)
nav.push(page); nav.push(page);
} }
function sendReply(text, pid) { function sendReply(text, pid) {

View file

@ -30,52 +30,52 @@
<context> <context>
<name>PostItem</name> <name>PostItem</name>
<message> <message>
<location filename="../assets/PostItem.qml" line="138"/> <location filename="../assets/PostItem.qml" line="139"/>
<source>&lt;i&gt;{{POST DELETED}}&lt;/i&gt;</source> <source>&lt;i&gt;{{POST DELETED}}&lt;/i&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="168"/> <location filename="../assets/PostItem.qml" line="169"/>
<source>Reply</source> <source>Reply</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="177"/> <location filename="../assets/PostItem.qml" line="178"/>
<source>Reply All</source> <source>Reply All</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="187"/> <location filename="../assets/PostItem.qml" line="188"/>
<source>Add Bookmark</source> <source>Add Bookmark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="187"/> <location filename="../assets/PostItem.qml" line="188"/>
<source>Delete Bookmark</source> <source>Delete Bookmark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="198"/> <location filename="../assets/PostItem.qml" line="199"/>
<source>Repost</source> <source>Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="198"/> <location filename="../assets/PostItem.qml" line="199"/>
<source>Delete Repost</source> <source>Delete Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="209"/> <location filename="../assets/PostItem.qml" line="210"/>
<source>Quote</source> <source>Quote</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="218"/> <location filename="../assets/PostItem.qml" line="219"/>
<source>View Profile</source> <source>View Profile</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="236"/> <location filename="../assets/PostItem.qml" line="237"/>
<source>Delete</source> <source>Delete</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -83,52 +83,55 @@
<context> <context>
<name>ProfilePage</name> <name>ProfilePage</name>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="124"/> <location filename="../assets/ProfilePage.qml" line="127"/>
<location filename="../assets/ProfilePage.qml" line="183"/>
<source>Following</source> <source>Following</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="137"/> <location filename="../assets/ProfilePage.qml" line="140"/>
<location filename="../assets/ProfilePage.qml" line="187"/>
<source>Followers</source> <source>Followers</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="150"/> <location filename="../assets/ProfilePage.qml" line="153"/>
<location filename="../assets/ProfilePage.qml" line="179"/>
<source>Posts</source> <source>Posts</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="163"/> <location filename="../assets/ProfilePage.qml" line="166"/>
<source>Bookmarks</source> <source>Bookmarks</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="219"/> <location filename="../assets/ProfilePage.qml" line="251"/>
<source>Unfollow</source> <source>Unfollow</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="219"/> <location filename="../assets/ProfilePage.qml" line="251"/>
<source>Follow</source> <source>Follow</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="232"/> <location filename="../assets/ProfilePage.qml" line="264"/>
<source>Unmute</source> <source>Unmute</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="232"/> <location filename="../assets/ProfilePage.qml" line="264"/>
<source>Mute</source> <source>Mute</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="245"/> <location filename="../assets/ProfilePage.qml" line="277"/>
<source>Unblock</source> <source>Unblock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/ProfilePage.qml" line="245"/> <location filename="../assets/ProfilePage.qml" line="277"/>
<source>Block</source> <source>Block</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -172,22 +175,22 @@
<context> <context>
<name>StreamTab</name> <name>StreamTab</name>
<message> <message>
<location filename="../assets/StreamTab.qml" line="139"/> <location filename="../assets/StreamTab.qml" line="140"/>
<source>New Post</source> <source>New Post</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="153"/> <location filename="../assets/StreamTab.qml" line="154"/>
<source>To Top</source> <source>To Top</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="181"/> <location filename="../assets/StreamTab.qml" line="182"/>
<source>To Bottom</source> <source>To Bottom</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="168"/> <location filename="../assets/StreamTab.qml" line="169"/>
<source>Reload</source> <source>Reload</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>