From af24b6ae69e2f475114d53fb0a1f4bb2f9504ee6 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 12 Nov 2016 06:22:29 -0800 Subject: [PATCH] replaced segmented control with buttons to launch seperate page views --- assets/PostItem.qml | 3 - assets/ProfilePage.qml | 170 ++++++++++++++++++++++++++--------------- assets/StreamTab.qml | 6 +- translations/Goober.ts | 18 ++--- 4 files changed, 121 insertions(+), 76 deletions(-) diff --git a/assets/PostItem.qml b/assets/PostItem.qml index a2fb289..0cc6deb 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -267,7 +267,4 @@ Container { return "" } } - onCreationCompleted: { - console.log(" My Height is " + postitem.preferredHeight) - } } diff --git a/assets/ProfilePage.qml b/assets/ProfilePage.qml index 5bdf87c..b44e8e6 100644 --- a/assets/ProfilePage.qml +++ b/assets/ProfilePage.qml @@ -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" + } + ] } diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index fc5cae1..50a9fdc 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.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) { diff --git a/translations/Goober.ts b/translations/Goober.ts index 96866af..0842944 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -84,19 +84,19 @@ ProfilePage - + Following - + Followers - + Posts @@ -106,32 +106,32 @@ - + Unfollow - + Follow - + Unmute - + Mute - + Unblock - + Block