add bookmarks tab
This commit is contained in:
parent
5a4a48f46a
commit
fe1c24700a
9 changed files with 62 additions and 19 deletions
|
@ -1,7 +1,7 @@
|
||||||
APP_NAME = Goober
|
APP_NAME = Goober
|
||||||
|
|
||||||
CONFIG += qt warn_on cascades10
|
CONFIG += qt warn_on cascades10
|
||||||
LIBS += -lbbdata
|
LIBS += -lbbdata -lbbsystem
|
||||||
QT += network
|
QT += network
|
||||||
|
|
||||||
include(config.pri)
|
include(config.pri)
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
1
|
1
|
||||||
40
|
41
|
||||||
AppCover.qml
|
AppCover.qml
|
||||||
icons/at.png
|
icons/at.png
|
||||||
icons/bell-slash.png
|
icons/bell-slash.png
|
||||||
icons/bell.png
|
icons/bell.png
|
||||||
|
icons/bookmark.png
|
||||||
icons/comments.png
|
icons/comments.png
|
||||||
icons/default_cover.png
|
icons/default_cover.png
|
||||||
icons/globe.png
|
icons/globe.png
|
||||||
|
|
|
@ -30,6 +30,7 @@ NavigationPane {
|
||||||
property int unread: -1
|
property int unread: -1
|
||||||
property bool refreshpull: false
|
property bool refreshpull: false
|
||||||
property bool active
|
property bool active
|
||||||
|
property bool at_end: false
|
||||||
|
|
||||||
signal openLogin()
|
signal openLogin()
|
||||||
signal closeLogin()
|
signal closeLogin()
|
||||||
|
@ -109,13 +110,13 @@ NavigationPane {
|
||||||
ListScrollStateHandler {
|
ListScrollStateHandler {
|
||||||
onAtEndChanged: {
|
onAtEndChanged: {
|
||||||
if (atEnd) {
|
if (atEnd) {
|
||||||
console.log("I'm at the end!!!")
|
if (!at_end && pnut.beforeId != 0) {
|
||||||
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
|
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onAtBeginningChanged: {
|
onAtBeginningChanged: {
|
||||||
if (atBeginning) {
|
if (atBeginning) {
|
||||||
console.log("I'm at the top!!!")
|
|
||||||
unread = 0
|
unread = 0
|
||||||
nav.parent.unreadContentCount = unread
|
nav.parent.unreadContentCount = unread
|
||||||
}
|
}
|
||||||
|
@ -213,15 +214,18 @@ NavigationPane {
|
||||||
|
|
||||||
onStreamReceived: {
|
onStreamReceived: {
|
||||||
|
|
||||||
stream.forEach(function(post) {
|
// stream.forEach(function(post) {
|
||||||
if (post.is_deleted) {
|
// if (post.is_deleted) {
|
||||||
console.log("got a deleted post")
|
// console.log("got a deleted post")
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
|
||||||
switch (rtype) {
|
switch (rtype) {
|
||||||
case Pnut.STREAM_OLDER:
|
case Pnut.STREAM_OLDER:
|
||||||
//streamView.scrollToPosition(ScrollPosition.End, ScrollAnimation.None);
|
//streamView.scrollToPosition(ScrollPosition.End, ScrollAnimation.None);
|
||||||
|
if (stream.length < 50) {
|
||||||
|
at_end = true
|
||||||
|
}
|
||||||
postModel.append(stream);
|
postModel.append(stream);
|
||||||
break;
|
break;
|
||||||
case Pnut.STREAM_NEWER:
|
case Pnut.STREAM_NEWER:
|
||||||
|
@ -316,6 +320,9 @@ NavigationPane {
|
||||||
case "Mentions":
|
case "Mentions":
|
||||||
endpoint = "/users/me/mentions"
|
endpoint = "/users/me/mentions"
|
||||||
break;
|
break;
|
||||||
|
case "Bookmarks":
|
||||||
|
endpoint = "/users/me/bookmarks"
|
||||||
|
break;
|
||||||
case "Global":
|
case "Global":
|
||||||
default:
|
default:
|
||||||
endpoint = "/posts/streams/global"
|
endpoint = "/posts/streams/global"
|
||||||
|
|
BIN
assets/icons/bookmark.png
Normal file
BIN
assets/icons/bookmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
|
@ -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 {
|
Tab {
|
||||||
id: globalStream
|
id: globalStream
|
||||||
title: qsTr("Global")
|
title: qsTr("Global")
|
||||||
|
|
2
buildnum
2
buildnum
|
@ -1 +1 @@
|
||||||
217
|
228
|
|
@ -78,6 +78,7 @@ config_pri_assets {
|
||||||
$$quote($$BASEDIR/assets/icons/at.png) \
|
$$quote($$BASEDIR/assets/icons/at.png) \
|
||||||
$$quote($$BASEDIR/assets/icons/bell-slash.png) \
|
$$quote($$BASEDIR/assets/icons/bell-slash.png) \
|
||||||
$$quote($$BASEDIR/assets/icons/bell.png) \
|
$$quote($$BASEDIR/assets/icons/bell.png) \
|
||||||
|
$$quote($$BASEDIR/assets/icons/bookmark.png) \
|
||||||
$$quote($$BASEDIR/assets/icons/comments.png) \
|
$$quote($$BASEDIR/assets/icons/comments.png) \
|
||||||
$$quote($$BASEDIR/assets/icons/default_cover.png) \
|
$$quote($$BASEDIR/assets/icons/default_cover.png) \
|
||||||
$$quote($$BASEDIR/assets/icons/globe.png) \
|
$$quote($$BASEDIR/assets/icons/globe.png) \
|
||||||
|
|
14
src/Pnut.cpp
14
src/Pnut.cpp
|
@ -180,6 +180,9 @@ void Pnut::onRequestReady(QByteArray data)
|
||||||
qDebug() << "- NetworkError -";
|
qDebug() << "- NetworkError -";
|
||||||
getUserInfo();
|
getUserInfo();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
qDebug() << "- other? -";
|
||||||
|
qDebug() << oauthManager->lastError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +192,7 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
|
||||||
qDebug() << "- onAuthorizedRequestReady";
|
qDebug() << "- onAuthorizedRequestReady";
|
||||||
qDebug() << "- id: " << id;
|
qDebug() << "- id: " << id;
|
||||||
qDebug() << "- endpoint: " << endpoint;
|
qDebug() << "- endpoint: " << endpoint;
|
||||||
qDebug() << data;
|
// qDebug() << data;
|
||||||
|
|
||||||
QVariant variant;
|
QVariant variant;
|
||||||
bb::data::JsonDataAccess jda;
|
bb::data::JsonDataAccess jda;
|
||||||
|
@ -201,7 +204,9 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
|
||||||
{
|
{
|
||||||
case Pnut::OK:
|
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];
|
Pnut::RequestType rtype = rtype_map[id];
|
||||||
emit streamReceived(variant.toMap()["data"].toList(), rtype);
|
emit streamReceived(variant.toMap()["data"].toList(), rtype);
|
||||||
|
@ -275,7 +280,8 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
|
||||||
QString gpid = endpoint.replace(":deletepost:","");
|
QString gpid = endpoint.replace(":deletepost:","");
|
||||||
getPost(gpid);
|
getPost(gpid);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
qDebug() << "GOT SOMETHING NEW!";
|
qDebug() << "GOT SOMETHING NEW!";
|
||||||
qDebug() << endpoint;
|
qDebug() << endpoint;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +291,7 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
|
||||||
{
|
{
|
||||||
if (endpoint == "/posts")
|
if (endpoint == "/posts")
|
||||||
{
|
{
|
||||||
qDebug() << "Success!";
|
qDebug() << "Create post success!";
|
||||||
req_map.remove(id);
|
req_map.remove(id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -162,22 +162,22 @@
|
||||||
<context>
|
<context>
|
||||||
<name>StreamTab</name>
|
<name>StreamTab</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/StreamTab.qml" line="129"/>
|
<location filename="../assets/StreamTab.qml" line="132"/>
|
||||||
<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="143"/>
|
<location filename="../assets/StreamTab.qml" line="146"/>
|
||||||
<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="171"/>
|
<location filename="../assets/StreamTab.qml" line="174"/>
|
||||||
<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="158"/>
|
<location filename="../assets/StreamTab.qml" line="161"/>
|
||||||
<source>Reload</source>
|
<source>Reload</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -204,6 +204,12 @@
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/main.qml" line="103"/>
|
<location filename="../assets/main.qml" line="103"/>
|
||||||
<location filename="../assets/main.qml" line="107"/>
|
<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>
|
<source>Global</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
Reference in a new issue