add bookmarks tab

This commit is contained in:
Morgan McMillian 2016-10-30 15:52:29 -07:00
parent 5a4a48f46a
commit fe1c24700a
9 changed files with 62 additions and 19 deletions

View file

@ -1,7 +1,7 @@
APP_NAME = Goober
CONFIG += qt warn_on cascades10
LIBS += -lbbdata
LIBS += -lbbdata -lbbsystem
QT += network
include(config.pri)

View file

@ -1,9 +1,10 @@
1
40
41
AppCover.qml
icons/at.png
icons/bell-slash.png
icons/bell.png
icons/bookmark.png
icons/comments.png
icons/default_cover.png
icons/globe.png

View file

@ -30,6 +30,7 @@ NavigationPane {
property int unread: -1
property bool refreshpull: false
property bool active
property bool at_end: false
signal openLogin()
signal closeLogin()
@ -109,13 +110,13 @@ NavigationPane {
ListScrollStateHandler {
onAtEndChanged: {
if (atEnd) {
console.log("I'm at the end!!!")
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
if (!at_end && pnut.beforeId != 0) {
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
}
}
}
onAtBeginningChanged: {
if (atBeginning) {
console.log("I'm at the top!!!")
unread = 0
nav.parent.unreadContentCount = unread
}
@ -213,15 +214,18 @@ NavigationPane {
onStreamReceived: {
stream.forEach(function(post) {
if (post.is_deleted) {
console.log("got a deleted post")
}
})
// stream.forEach(function(post) {
// if (post.is_deleted) {
// console.log("got a deleted post")
// }
// })
switch (rtype) {
case Pnut.STREAM_OLDER:
//streamView.scrollToPosition(ScrollPosition.End, ScrollAnimation.None);
if (stream.length < 50) {
at_end = true
}
postModel.append(stream);
break;
case Pnut.STREAM_NEWER:
@ -316,6 +320,9 @@ NavigationPane {
case "Mentions":
endpoint = "/users/me/mentions"
break;
case "Bookmarks":
endpoint = "/users/me/bookmarks"
break;
case "Global":
default:
endpoint = "/posts/streams/global"

BIN
assets/icons/bookmark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View file

@ -98,6 +98,28 @@ TabbedPane {
}
}
Tab {
id: bookmarksStream
title: qsTr("Bookmarks")
objectName: "BookmarksTab"
delegate: Delegate {
StreamTab {
title: qsTr("Bookmarks")
stream_type: "Bookmarks"
onOpenLogin: {
loginSheet.open()
}
onCloseLogin: {
loginSheet.close()
}
}
}
imageSource: "asset:///icons/bookmark.png"
onUnreadContentCountChanged: {
_activeFrame.setGlobalUnread(unreadContentCount)
}
}
Tab {
id: globalStream
title: qsTr("Global")

View file

@ -1 +1 @@
217
228

View file

@ -78,6 +78,7 @@ config_pri_assets {
$$quote($$BASEDIR/assets/icons/at.png) \
$$quote($$BASEDIR/assets/icons/bell-slash.png) \
$$quote($$BASEDIR/assets/icons/bell.png) \
$$quote($$BASEDIR/assets/icons/bookmark.png) \
$$quote($$BASEDIR/assets/icons/comments.png) \
$$quote($$BASEDIR/assets/icons/default_cover.png) \
$$quote($$BASEDIR/assets/icons/globe.png) \

View file

@ -180,6 +180,9 @@ void Pnut::onRequestReady(QByteArray data)
qDebug() << "- NetworkError -";
getUserInfo();
break;
default:
qDebug() << "- other? -";
qDebug() << oauthManager->lastError();
}
}
@ -189,7 +192,7 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
qDebug() << "- onAuthorizedRequestReady";
qDebug() << "- id: " << id;
qDebug() << "- endpoint: " << endpoint;
qDebug() << data;
// qDebug() << data;
QVariant variant;
bb::data::JsonDataAccess jda;
@ -201,7 +204,9 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
{
case Pnut::OK:
{
if (endpoint.startsWith("/posts/streams/") || endpoint == "/users/me/mentions")
if (endpoint.startsWith("/posts/streams/") ||
endpoint == "/users/me/mentions" ||
endpoint == "/users/me/bookmarks")
{
Pnut::RequestType rtype = rtype_map[id];
emit streamReceived(variant.toMap()["data"].toList(), rtype);
@ -275,7 +280,8 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
QString gpid = endpoint.replace(":deletepost:","");
getPost(gpid);
}
else {
else
{
qDebug() << "GOT SOMETHING NEW!";
qDebug() << endpoint;
}
@ -285,7 +291,7 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
{
if (endpoint == "/posts")
{
qDebug() << "Success!";
qDebug() << "Create post success!";
req_map.remove(id);
}
else

View file

@ -162,22 +162,22 @@
<context>
<name>StreamTab</name>
<message>
<location filename="../assets/StreamTab.qml" line="129"/>
<location filename="../assets/StreamTab.qml" line="132"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="143"/>
<location filename="../assets/StreamTab.qml" line="146"/>
<source>To Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="171"/>
<location filename="../assets/StreamTab.qml" line="174"/>
<source>To Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="158"/>
<location filename="../assets/StreamTab.qml" line="161"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>
@ -204,6 +204,12 @@
<message>
<location filename="../assets/main.qml" line="103"/>
<location filename="../assets/main.qml" line="107"/>
<source>Bookmarks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/main.qml" line="125"/>
<location filename="../assets/main.qml" line="129"/>
<source>Global</source>
<translation type="unfinished"></translation>
</message>