From 7fcfaac2bce470cf331ebe89d760d0e22964e063 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Fri, 11 Nov 2016 16:10:08 -0800 Subject: [PATCH] add segmented control --- assets/PostItem.qml | 18 +++++++++------ assets/ProfilePage.qml | 30 ++++++++++++++++++++++++- assets/StreamTab.qml | 1 + translations/Goober.ts | 51 ++++++++++++++++++++++-------------------- 4 files changed, 68 insertions(+), 32 deletions(-) diff --git a/assets/PostItem.qml b/assets/PostItem.qml index 1440892..a2fb289 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -64,13 +64,14 @@ Container { Container { Label { id: username - text: "" + ListItemData.user.username + "" - activeTextHandler: ActiveTextHandler { - onTriggered: { - postitem.ListItem.view.viewProfile(ListItemData.user) - } - } - textFormat: TextFormat.Html + text: ListItemData.user.username +// text: "" + ListItemData.user.username + "" +// 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) + } } diff --git a/assets/ProfilePage.qml b/assets/ProfilePage.qml index 29b6383..5bdf87c 100644 --- a/assets/ProfilePage.qml +++ b/assets/ProfilePage.qml @@ -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 } } ] diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index 16c2798..fc5cae1 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -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) { diff --git a/translations/Goober.ts b/translations/Goober.ts index cf1ff4e..96866af 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -30,52 +30,52 @@ PostItem - + <i>{{POST DELETED}}</i> - + Reply - + Reply All - + Add Bookmark - + Delete Bookmark - + Repost - + Delete Repost - + Quote - + View Profile - + Delete @@ -83,52 +83,55 @@ ProfilePage - + + Following - + + Followers - + + Posts - + Bookmarks - + Unfollow - + Follow - + Unmute - + Mute - + Unblock - + Block @@ -172,22 +175,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload