replace reposted items with the original post object and reference who did the repost resolves #40
This commit is contained in:
parent
bdc5e9ebf5
commit
f8fee791bc
4 changed files with 44 additions and 19 deletions
|
@ -36,14 +36,14 @@ Container {
|
||||||
opacity: (ListItemData.is_deleted) ? 0.5 : 1.0
|
opacity: (ListItemData.is_deleted) ? 0.5 : 1.0
|
||||||
visible: (ListItemData.is_deleted) ? false : true
|
visible: (ListItemData.is_deleted) ? false : true
|
||||||
|
|
||||||
Container {
|
Container { // post header
|
||||||
layout: DockLayout {}
|
layout: DockLayout {}
|
||||||
horizontalAlignment: HorizontalAlignment.Fill
|
horizontalAlignment: HorizontalAlignment.Fill
|
||||||
Container {
|
Container {
|
||||||
layout: StackLayout {
|
layout: StackLayout {
|
||||||
orientation: LayoutOrientation.LeftToRight
|
orientation: LayoutOrientation.LeftToRight
|
||||||
}
|
}
|
||||||
Container {
|
Container { // user avatar
|
||||||
background: (theme === VisualStyle.Bright) ? Color.create("#e9e9e9") : Color.create("#282828")
|
background: (theme === VisualStyle.Bright) ? Color.create("#e9e9e9") : Color.create("#282828")
|
||||||
ImageButton {
|
ImageButton {
|
||||||
id: avatar
|
id: avatar
|
||||||
|
@ -65,7 +65,7 @@ Container {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Container {
|
Container { // user name
|
||||||
leftMargin: ui.sdu(3.0)
|
leftMargin: ui.sdu(3.0)
|
||||||
Container {
|
Container {
|
||||||
Label {
|
Label {
|
||||||
|
@ -89,7 +89,7 @@ Container {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Container {
|
Container { // post counts
|
||||||
horizontalAlignment: HorizontalAlignment.Right
|
horizontalAlignment: HorizontalAlignment.Right
|
||||||
Container {
|
Container {
|
||||||
layout: StackLayout {
|
layout: StackLayout {
|
||||||
|
@ -145,7 +145,7 @@ Container {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Container {
|
Container { // post text
|
||||||
topMargin: ui.sdu(2.0)
|
topMargin: ui.sdu(2.0)
|
||||||
bottomMargin: ui.sdu(2.0)
|
bottomMargin: ui.sdu(2.0)
|
||||||
Label {
|
Label {
|
||||||
|
@ -155,7 +155,7 @@ Container {
|
||||||
navigation.focusPolicy: NavigationFocusPolicy.NotFocusable
|
navigation.focusPolicy: NavigationFocusPolicy.NotFocusable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Container {
|
Container { // post embeds
|
||||||
// TODO: add tab to open full image in a page
|
// TODO: add tab to open full image in a page
|
||||||
horizontalAlignment: HorizontalAlignment.Center
|
horizontalAlignment: HorizontalAlignment.Center
|
||||||
bottomMargin: ui.sdu(2.0)
|
bottomMargin: ui.sdu(2.0)
|
||||||
|
@ -223,7 +223,7 @@ Container {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Container {
|
Container { // post footer
|
||||||
layout: DockLayout {}
|
layout: DockLayout {}
|
||||||
horizontalAlignment: HorizontalAlignment.Fill
|
horizontalAlignment: HorizontalAlignment.Fill
|
||||||
Container {
|
Container {
|
||||||
|
@ -236,8 +236,15 @@ Container {
|
||||||
Container {
|
Container {
|
||||||
horizontalAlignment: HorizontalAlignment.Right
|
horizontalAlignment: HorizontalAlignment.Right
|
||||||
Label { // "Broadsword Hack"
|
Label { // "Broadsword Hack"
|
||||||
text: ListItemData.source.name
|
text: {
|
||||||
|
if (ListItemData.reposted_by) {
|
||||||
|
return "reposted by @" + ListItemData.reposted_by
|
||||||
|
} else {
|
||||||
|
return ListItemData.source.name
|
||||||
|
}
|
||||||
|
}
|
||||||
textStyle.fontSize: FontSize.XSmall
|
textStyle.fontSize: FontSize.XSmall
|
||||||
|
textStyle.fontStyle: FontStyle.Italic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
19
src/Pnut.cpp
19
src/Pnut.cpp
|
@ -214,7 +214,8 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
|
||||||
endpoint == "/users/me/bookmarks")
|
endpoint == "/users/me/bookmarks")
|
||||||
{
|
{
|
||||||
Pnut::RequestType rtype = rtype_map[id];
|
Pnut::RequestType rtype = rtype_map[id];
|
||||||
emit streamReceived(variant.toMap()["data"].toList(), rtype);
|
QVariantList streamlist = variant.toMap()["data"].toList();
|
||||||
|
emit streamReceived(parseStream(streamlist), rtype);
|
||||||
req_map.remove(id);
|
req_map.remove(id);
|
||||||
rtype_map.remove(id);
|
rtype_map.remove(id);
|
||||||
}
|
}
|
||||||
|
@ -546,3 +547,19 @@ void Pnut::onOpenBrowser(QUrl url)
|
||||||
qDebug() << url;
|
qDebug() << url;
|
||||||
emit openBrowser(url);
|
emit openBrowser(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantList Pnut::parseStream(QVariantList stream)
|
||||||
|
{
|
||||||
|
QVariantList pstream;
|
||||||
|
foreach (QVariant vitem, stream) {
|
||||||
|
QVariantMap item = vitem.toMap();
|
||||||
|
if (item.find("repost_of") != item.end())
|
||||||
|
{
|
||||||
|
QString username = item["user"].toMap()["username"].toString();
|
||||||
|
item = item["repost_of"].toMap();
|
||||||
|
item.insert("reposted_by", username);
|
||||||
|
}
|
||||||
|
pstream.append(item);
|
||||||
|
}
|
||||||
|
return pstream; // but not really
|
||||||
|
}
|
||||||
|
|
|
@ -131,6 +131,7 @@ private:
|
||||||
void postRequest(QUrl url, KQOAuthParameters parameters, int id, QByteArray data);
|
void postRequest(QUrl url, KQOAuthParameters parameters, int id, QByteArray data);
|
||||||
void putRequest(QUrl url, KQOAuthParameters parameters, int id);
|
void putRequest(QUrl url, KQOAuthParameters parameters, int id);
|
||||||
void deleteRequest(QUrl url, KQOAuthParameters parameters, int id);
|
void deleteRequest(QUrl url, KQOAuthParameters parameters, int id);
|
||||||
|
QVariantList parseStream(QVariantList stream);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PNUT_H_ */
|
#endif /* PNUT_H_ */
|
||||||
|
|
|
@ -43,52 +43,52 @@
|
||||||
<context>
|
<context>
|
||||||
<name>PostItem</name>
|
<name>PostItem</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="251"/>
|
<location filename="../assets/PostItem.qml" line="258"/>
|
||||||
<source>Reply</source>
|
<source>Reply</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="260"/>
|
<location filename="../assets/PostItem.qml" line="267"/>
|
||||||
<source>Reply All</source>
|
<source>Reply All</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="270"/>
|
<location filename="../assets/PostItem.qml" line="277"/>
|
||||||
<source>Delete Bookmark</source>
|
<source>Delete Bookmark</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="270"/>
|
<location filename="../assets/PostItem.qml" line="277"/>
|
||||||
<source>Add Bookmark</source>
|
<source>Add Bookmark</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="281"/>
|
<location filename="../assets/PostItem.qml" line="288"/>
|
||||||
<source>Delete Repost</source>
|
<source>Delete Repost</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="281"/>
|
<location filename="../assets/PostItem.qml" line="288"/>
|
||||||
<source>Repost</source>
|
<source>Repost</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="292"/>
|
<location filename="../assets/PostItem.qml" line="299"/>
|
||||||
<source>Quote</source>
|
<source>Quote</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="301"/>
|
<location filename="../assets/PostItem.qml" line="308"/>
|
||||||
<source>View Profile</source>
|
<source>View Profile</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="308"/>
|
<location filename="../assets/PostItem.qml" line="315"/>
|
||||||
<source>Copy text</source>
|
<source>Copy text</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../assets/PostItem.qml" line="338"/>
|
<location filename="../assets/PostItem.qml" line="345"/>
|
||||||
<source>Delete</source>
|
<source>Delete</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
Reference in a new issue