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

View file

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

View file

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

View file

@ -30,52 +30,52 @@
<context>
<name>PostItem</name>
<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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="168"/>
<location filename="../assets/PostItem.qml" line="169"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="177"/>
<location filename="../assets/PostItem.qml" line="178"/>
<source>Reply All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="187"/>
<location filename="../assets/PostItem.qml" line="188"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="187"/>
<location filename="../assets/PostItem.qml" line="188"/>
<source>Delete Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="198"/>
<location filename="../assets/PostItem.qml" line="199"/>
<source>Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="198"/>
<location filename="../assets/PostItem.qml" line="199"/>
<source>Delete Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="209"/>
<location filename="../assets/PostItem.qml" line="210"/>
<source>Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="218"/>
<location filename="../assets/PostItem.qml" line="219"/>
<source>View Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="236"/>
<location filename="../assets/PostItem.qml" line="237"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
@ -83,52 +83,55 @@
<context>
<name>ProfilePage</name>
<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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="163"/>
<location filename="../assets/ProfilePage.qml" line="166"/>
<source>Bookmarks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="219"/>
<location filename="../assets/ProfilePage.qml" line="251"/>
<source>Unfollow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="219"/>
<location filename="../assets/ProfilePage.qml" line="251"/>
<source>Follow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="232"/>
<location filename="../assets/ProfilePage.qml" line="264"/>
<source>Unmute</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="232"/>
<location filename="../assets/ProfilePage.qml" line="264"/>
<source>Mute</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="245"/>
<location filename="../assets/ProfilePage.qml" line="277"/>
<source>Unblock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/ProfilePage.qml" line="245"/>
<location filename="../assets/ProfilePage.qml" line="277"/>
<source>Block</source>
<translation type="unfinished"></translation>
</message>
@ -172,22 +175,22 @@
<context>
<name>StreamTab</name>
<message>
<location filename="../assets/StreamTab.qml" line="139"/>
<location filename="../assets/StreamTab.qml" line="140"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="153"/>
<location filename="../assets/StreamTab.qml" line="154"/>
<source>To Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="181"/>
<location filename="../assets/StreamTab.qml" line="182"/>
<source>To Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="168"/>
<location filename="../assets/StreamTab.qml" line="169"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>