diff --git a/assets/.assets.index b/assets/.assets.index
index a81bcd8..5953d57 100644
--- a/assets/.assets.index
+++ b/assets/.assets.index
@@ -1,13 +1,16 @@
1
-13
+16
icons/globe.png
icons/ic_add.png
+icons/ic_add_bookmarks.png
+icons/ic_favorite.png
icons/ic_reload.png
icons/ic_reply.png
icons/ic_reply_all.png
icons/ic_to_bottom.png
icons/ic_to_top.png
icons/laughing_man.png
+icons/messages.png
main.qml
moment.js
NewPostSheet.qml
diff --git a/assets/PostItem.qml b/assets/PostItem.qml
index bb132cb..389e9dd 100644
--- a/assets/PostItem.qml
+++ b/assets/PostItem.qml
@@ -24,45 +24,89 @@ import "moment.js" as Moment
Container {
id: postitem
- leftPadding: 20.0
- rightPadding: 20.0
- topPadding: 10.0
- bottomPadding: 10.0
+ leftPadding: ui.sdu(3.0)
+ rightPadding: ui.sdu(3.0)
+ topPadding: ui.sdu(2.0)
+ bottomPadding: ui.sdu(2.0)
property string lorem: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse non enim tellus. Donec vestibulum enim urna, eget faucibus diam commodo a. Donec eget hendrerit metus. Pellentesque vehicula nisi nec vehicula ullamcorper. Aliquam a elit eget mi fringilla porta fermentum eget eros. Phasellus vestibulum nulla sed elit congue adipiscing. Cras imperdiet urna ac ipsum volutpat lobortis. Maecenas vehicula tortor at viverra convallis. Curabitur nibh massa, tristique id felis ut, venenatis faucibus dui. Donec fringilla, mi nec tincidunt dignissim, neque nunc semper mi, quis rutrum diam turpis sit amet erat. Cras a sodales nisi. Nunc sit amet diam sed lectus molestie cursus convallis et erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vitae varius leo. Mauris eu leo a nunc bibendum rutrum euismod et ipsum. "
+ property variant theme : Application.themeSupport.theme.colorTheme.style
+
Container {
- layout: StackLayout {
- orientation: LayoutOrientation.LeftToRight
- }
+ layout: DockLayout {}
+ horizontalAlignment: HorizontalAlignment.Fill
Container {
- WebImageView {
- id: avatar
- url: ListItemData.user.content.avatar_image.link
- maxWidth: 100.0
- maxHeight: avatar.maxWidth
- //imageSource: "asset:///laughing_man.png"
+ layout: StackLayout {
+ orientation: LayoutOrientation.LeftToRight
}
- }
- Container {
- leftMargin: 20.0
Container {
- Label {
- id: name
- text: ListItemData.user.name
- textStyle.fontWeight: FontWeight.Bold
+ WebImageView {
+ id: avatar
+ url: ListItemData.user.content.avatar_image.link
+ maxWidth: 100.0
+ maxHeight: avatar.maxWidth
+ //imageSource: "asset:///icons/laughing_man.png"
}
}
Container {
- Label {
- id: username
- text: ListItemData.user.username
+ leftMargin: ui.sdu(3.0)
+ Container {
+ Label {
+ id: name
+ text: ListItemData.user.name
+ textStyle.fontWeight: FontWeight.Bold
+ }
+ }
+ Container {
+ Label {
+ id: username
+ text: ListItemData.user.username
+ }
+ }
+ }
+ }
+ Container {
+ horizontalAlignment: HorizontalAlignment.Right
+ Container {
+ layout: StackLayout {
+ orientation: LayoutOrientation.RightToLeft
+ }
+ horizontalAlignment: HorizontalAlignment.Fill
+ topMargin: ui.sdu(1.0)
+ Container {
+ ImageView {
+ visible: (ListItemData.counts.threads > 0 || ListItemData.counts.replies > 0 || ListItemData.id !== ListItemData.thread_id)
+ imageSource: "asset:///icons/messages.png"
+ filterColor: (theme == VisualStyle.Bright) ? Color.Black : false
+ maxWidth: ui.du(6)
+ maxHeight: ui.du(6)
+ accessibility.name: "thread"
+ }
+ }
+ Container {
+ verticalAlignment: VerticalAlignment.Bottom
+ Label {
+ text: (ListItemData.counts.bookmarks > 0) ? ListItemData.counts.bookmarks : ""
+ textStyle.fontSize: FontSize.XXSmall
+ }
+ }
+ Container {
+ ImageView {
+ visible: (ListItemData.counts.bookmarks > 0)
+ imageSource: "asset:///icons/ic_favorite.png"
+ filterColor: (theme == VisualStyle.Bright) ? Color.Black : false
+ maxWidth: ui.du(6)
+ maxHeight: ui.du(6)
+ accessibility.name: "favorite"
+ }
+
}
}
}
}
Container {
- topMargin: 20.0
- bottomMargin: 20.0
+ topMargin: ui.sdu(2.0)
+ bottomMargin: ui.sdu(2.0)
Label {
text: ListItemData.content.text
multiline: true
@@ -73,20 +117,22 @@ Container {
horizontalAlignment: HorizontalAlignment.Fill
Container {
horizontalAlignment: HorizontalAlignment.Left
- Label {
+ Label { // "Sep 23, 2016 7:17 AM"
text: Moment.moment(ListItemData.created_at).format("lll")
textStyle.fontSize: FontSize.XSmall
}
}
Container {
horizontalAlignment: HorizontalAlignment.Right
- Label {
+ Label { // "Broadsword Hack"
text: ListItemData.source.name
textStyle.fontSize: FontSize.XSmall
}
}
}
- Divider {}
+ Divider {
+ accessibility.name: "divider"
+ }
contextActions: [
ActionSet {
title: ListItemData.user.username
@@ -100,7 +146,7 @@ Container {
imageSource: "asset:///icons/ic_reply.png"
}
ActionItem {
- title: "Reply All"
+ title: qsTr("Reply All")
onTriggered: {
replySheet.text = "@" + ListItemData.user.username + " " + parseMentions(ListItemData.content.entities.mentions);
console.log(JSON.stringify(ListItemData.content.entities.mentions))
@@ -120,11 +166,10 @@ Container {
}
]
function parseMentions(mentions) {
- console.log("blarp")
var mtext = ""
for(var i = 0; i < mentions.length; i++) {
var mu = mentions[i].text
- if (mu !== "thrrgilag") {
+ if (mu !== postitem.ListItem.view.getUserName()) {
mtext += "@" + mu + " "
}
}
diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml
index 845ba01..8581c7c 100644
--- a/assets/StreamTab.qml
+++ b/assets/StreamTab.qml
@@ -43,6 +43,9 @@ NavigationPane {
function sendReply(text, pid) {
pnut.sendReply(text, pid);
}
+ function getUserName() {
+ return _app.setting("username")
+ }
}
}
actions: [
@@ -96,10 +99,6 @@ NavigationPane {
actionBarAutoHideBehavior: ActionBarAutoHideBehavior.HideOnScroll
}
attachedObjects: [
- ComponentDefinition {
- id: itemPageDefinition
- source: "ItemPage.qml"
- },
NewPostSheet {
id: newPostSheet
onSendPost: {
@@ -153,6 +152,7 @@ NavigationPane {
break;
}
if (_app.setting("access_token") && _app.setting("access_token").length > 0) {
+ pnut.getUserInfo();
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
timer.start();
} else {
diff --git a/assets/icons/ic_add_bookmarks.png b/assets/icons/ic_add_bookmarks.png
new file mode 100644
index 0000000..acab136
Binary files /dev/null and b/assets/icons/ic_add_bookmarks.png differ
diff --git a/assets/icons/ic_favorite.png b/assets/icons/ic_favorite.png
new file mode 100644
index 0000000..a5f09c0
Binary files /dev/null and b/assets/icons/ic_favorite.png differ
diff --git a/assets/icons/messages.png b/assets/icons/messages.png
new file mode 100644
index 0000000..d55e5c6
Binary files /dev/null and b/assets/icons/messages.png differ
diff --git a/buildnum b/buildnum
index bf0d87a..19c7bdb 100644
--- a/buildnum
+++ b/buildnum
@@ -1 +1 @@
-4
\ No newline at end of file
+16
\ No newline at end of file
diff --git a/config.pri b/config.pri
index 7ab23e9..b6d8440 100644
--- a/config.pri
+++ b/config.pri
@@ -71,12 +71,15 @@ config_pri_assets {
$$quote($$BASEDIR/assets/StreamTab.qml) \
$$quote($$BASEDIR/assets/icons/globe.png) \
$$quote($$BASEDIR/assets/icons/ic_add.png) \
+ $$quote($$BASEDIR/assets/icons/ic_add_bookmarks.png) \
+ $$quote($$BASEDIR/assets/icons/ic_favorite.png) \
$$quote($$BASEDIR/assets/icons/ic_reload.png) \
$$quote($$BASEDIR/assets/icons/ic_reply.png) \
$$quote($$BASEDIR/assets/icons/ic_reply_all.png) \
$$quote($$BASEDIR/assets/icons/ic_to_bottom.png) \
$$quote($$BASEDIR/assets/icons/ic_to_top.png) \
$$quote($$BASEDIR/assets/icons/laughing_man.png) \
+ $$quote($$BASEDIR/assets/icons/messages.png) \
$$quote($$BASEDIR/assets/main.qml) \
$$quote($$BASEDIR/assets/moment.js)
}
diff --git a/src/Pnut.cpp b/src/Pnut.cpp
index e559c3a..995e35c 100644
--- a/src/Pnut.cpp
+++ b/src/Pnut.cpp
@@ -116,6 +116,7 @@ void Pnut::onAuthorizationReceived(QString token, QString verifier)
case KQOAuthManager::NoError:
qDebug() << "- authorization received -";
m_appSettings->setValue("access_token", token);
+ getUserInfo();
emit authorizationReceived();
break;
default:
@@ -142,13 +143,16 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
{
case Pnut::OK:
{
-// qDebug() << ":: OK";
if (endpoint.startsWith("/posts/streams/"))
{
Pnut::RequestType rtype = rtype_map[id];
emit streamReceived(variant.toMap()["data"].toList(), rtype);
req_map.remove(id);
rtype_map.remove(id);
+ } else if (endpoint == ":me")
+ {
+ QVariantMap userinfo(variant.toMap()["data"].toMap());
+ m_appSettings->setValue("username", userinfo.value("username").toString());
}
break;
}
@@ -217,3 +221,19 @@ void Pnut::sendReply(QString text, int pid)
req_map[++req_id] = "/posts";
postRequest(url, parameters, req_id, post);
}
+
+void Pnut::getUser(QString uid)
+{
+ QUrl url(PNUT_API_ROOT + "/users/" + uid);
+ KQOAuthParameters parameters;
+ req_map[++req_id] = "/users/" + uid;
+ getRequest(url, parameters, req_id);
+}
+
+void Pnut::getUserInfo()
+{
+ QUrl url(PNUT_API_ROOT + "/users/me");
+ KQOAuthParameters parameters;
+ req_map[++req_id] = ":me";
+ getRequest(url, parameters, req_id);
+}
diff --git a/src/Pnut.h b/src/Pnut.h
index a3078a2..b0efc2f 100644
--- a/src/Pnut.h
+++ b/src/Pnut.h
@@ -69,6 +69,8 @@ public:
Q_INVOKABLE void getStream(QString endpoint, Pnut::RequestType rtype);
Q_INVOKABLE void sendPost(QString text);
Q_INVOKABLE void sendReply(QString text, int pid);
+ Q_INVOKABLE void getUser(QString uid);
+ Q_INVOKABLE void getUserInfo();
public slots:
void onAuthorizedRequestReady(QByteArray data, int id);
diff --git a/translations/Goober.ts b/translations/Goober.ts
index cad0b3a..b552002 100644
--- a/translations/Goober.ts
+++ b/translations/Goober.ts
@@ -22,35 +22,40 @@
PostItem
-
+
+
+
+
+
+
StreamTab
-
+
-
+
-
+
-
+
-
+