diff --git a/saoriview.cpp b/saoriview.cpp index e70ccd8..18eed01 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -266,10 +266,12 @@ htmlSpan("acct","@" + json["acct"].toString()) ) + htmlDiv("user_info", - tr(" following: ") + - QString::number(json["following_count"].toInt()) + - tr(" followers: ") + - QString::number(json["followers_count"].toInt()) + htmlAnc("accounts:" + json["id"].toString() + ":following", + tr(" following: ") + + QString::number(json["following_count"].toInt())) + + htmlAnc("accounts:" + json["id"].toString() + ":followers", + tr(" followers: ") + + QString::number(json["followers_count"].toInt())) ) ); return result; @@ -365,6 +367,11 @@ return result; } +const QString SaoriView::followerParser(const QJsonObject json) +{ + return accountParser(json); +} + const QString SaoriView::htmlDiv(const QString divclass, const QString text) { return QString("
\n%2\n
\n").arg(divclass,text); @@ -437,7 +444,11 @@ m_entries.insert(i,entry); qobject_cast(ui->scrollAreaWidgetContents->layout())->insertWidget(i,entry); if (m_viewname == "notifications") entry->setContent(notificationParser(j.toObject())); - else { + else if ((m_viewname.split(':')[0] == "accounts") && (m_viewname.split(':')[2] == "followers")) { + entry->setContent(followerParser(j.toObject())); + } else if ((m_viewname.split(':')[0] == "accounts") && (m_viewname.split(':')[2] == "following")) { + entry->setContent(followerParser(j.toObject())); + } else { bool cw = !j.toObject()["spoiler_text"].toString().isEmpty(); if (!j.toObject()["reblog"].isNull()) cw = !j.toObject()["reblog"].toObject()["spoiler_text"].toString().isEmpty(); diff --git a/saoriview.h b/saoriview.h index 7492b09..dbd8f58 100644 --- a/saoriview.h +++ b/saoriview.h @@ -66,6 +66,7 @@ const QString mediaParser(const QJsonObject json,bool sensitive = false); const QString contentParser(const QString content); const QString notificationParser(const QJsonObject json); + const QString followerParser(const QJsonObject json); static const QString htmlDiv(const QString divclass,const QString text); static const QString htmlSpan(const QString spanclass,const QString text); diff --git a/saoriwindow.cpp b/saoriwindow.cpp index a7832d1..7fda72c 100644 --- a/saoriwindow.cpp +++ b/saoriwindow.cpp @@ -92,11 +92,17 @@ for(int i = 1;i < t.count();i ++) { if ((i == 2) && (t[0] == "accounts")) { QStringList tl; - tl << "statuses"; + tl << "statuses" << "following" << "followers"; switch (tl.indexOf(t[2])) { case 0: tlText += ":" + tr("statuses"); break; + case 1: + tlText += ":" + tr("following"); + break; + case 2: + tlText += ":" + tr("followers"); + break; default: tlText += ":" + t[i]; break;