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
|
||||
visible: (ListItemData.is_deleted) ? false : true
|
||||
|
||||
Container {
|
||||
Container { // post header
|
||||
layout: DockLayout {}
|
||||
horizontalAlignment: HorizontalAlignment.Fill
|
||||
Container {
|
||||
layout: StackLayout {
|
||||
orientation: LayoutOrientation.LeftToRight
|
||||
}
|
||||
Container {
|
||||
Container { // user avatar
|
||||
background: (theme === VisualStyle.Bright) ? Color.create("#e9e9e9") : Color.create("#282828")
|
||||
ImageButton {
|
||||
id: avatar
|
||||
|
@ -65,7 +65,7 @@ Container {
|
|||
]
|
||||
}
|
||||
}
|
||||
Container {
|
||||
Container { // user name
|
||||
leftMargin: ui.sdu(3.0)
|
||||
Container {
|
||||
Label {
|
||||
|
@ -89,7 +89,7 @@ Container {
|
|||
}
|
||||
}
|
||||
}
|
||||
Container {
|
||||
Container { // post counts
|
||||
horizontalAlignment: HorizontalAlignment.Right
|
||||
Container {
|
||||
layout: StackLayout {
|
||||
|
@ -145,7 +145,7 @@ Container {
|
|||
}
|
||||
}
|
||||
}
|
||||
Container {
|
||||
Container { // post text
|
||||
topMargin: ui.sdu(2.0)
|
||||
bottomMargin: ui.sdu(2.0)
|
||||
Label {
|
||||
|
@ -155,7 +155,7 @@ Container {
|
|||
navigation.focusPolicy: NavigationFocusPolicy.NotFocusable
|
||||
}
|
||||
}
|
||||
Container {
|
||||
Container { // post embeds
|
||||
// TODO: add tab to open full image in a page
|
||||
horizontalAlignment: HorizontalAlignment.Center
|
||||
bottomMargin: ui.sdu(2.0)
|
||||
|
@ -223,7 +223,7 @@ Container {
|
|||
]
|
||||
}
|
||||
}
|
||||
Container {
|
||||
Container { // post footer
|
||||
layout: DockLayout {}
|
||||
horizontalAlignment: HorizontalAlignment.Fill
|
||||
Container {
|
||||
|
@ -236,8 +236,15 @@ Container {
|
|||
Container {
|
||||
horizontalAlignment: HorizontalAlignment.Right
|
||||
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.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")
|
||||
{
|
||||
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);
|
||||
rtype_map.remove(id);
|
||||
}
|
||||
|
@ -546,3 +547,19 @@ void Pnut::onOpenBrowser(QUrl url)
|
|||
qDebug() << 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 putRequest(QUrl url, KQOAuthParameters parameters, int id);
|
||||
void deleteRequest(QUrl url, KQOAuthParameters parameters, int id);
|
||||
QVariantList parseStream(QVariantList stream);
|
||||
};
|
||||
|
||||
#endif /* PNUT_H_ */
|
||||
|
|
|
@ -43,52 +43,52 @@
|
|||
<context>
|
||||
<name>PostItem</name>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="251"/>
|
||||
<location filename="../assets/PostItem.qml" line="258"/>
|
||||
<source>Reply</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="260"/>
|
||||
<location filename="../assets/PostItem.qml" line="267"/>
|
||||
<source>Reply All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="270"/>
|
||||
<location filename="../assets/PostItem.qml" line="277"/>
|
||||
<source>Delete Bookmark</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="270"/>
|
||||
<location filename="../assets/PostItem.qml" line="277"/>
|
||||
<source>Add Bookmark</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="281"/>
|
||||
<location filename="../assets/PostItem.qml" line="288"/>
|
||||
<source>Delete Repost</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="281"/>
|
||||
<location filename="../assets/PostItem.qml" line="288"/>
|
||||
<source>Repost</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="292"/>
|
||||
<location filename="../assets/PostItem.qml" line="299"/>
|
||||
<source>Quote</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="301"/>
|
||||
<location filename="../assets/PostItem.qml" line="308"/>
|
||||
<source>View Profile</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="308"/>
|
||||
<location filename="../assets/PostItem.qml" line="315"/>
|
||||
<source>Copy text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../assets/PostItem.qml" line="338"/>
|
||||
<location filename="../assets/PostItem.qml" line="345"/>
|
||||
<source>Delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Reference in a new issue