diff --git a/saoristyle.css b/saoristyle.css index bf7c5d4..2daa4c0 100644 --- a/saoristyle.css +++ b/saoristyle.css @@ -37,7 +37,7 @@ color:gray; } -img.avatar { +div.account img { float:left; } diff --git a/saoriview.cpp b/saoriview.cpp index 39d8b27..76a0199 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -163,23 +163,20 @@ { QString result; if (json.isEmpty()) return QString(); - result += "
"; - result += "
"; - result += "
"; - result += ""; - result += json["display_name"].toString(); - result += " @"; - result += json["acct"].toString(); - result += ""; - result += "
"; - result += tr(" following: "); - result += QString::number(json["following_count"].toInt()); - result += tr(" followers: "); - result += QString::number(json["followers_count"].toInt()); - result += "
"; - result += "
"; + result = htmlDiv("account", + htmlSpan("avatar", + htmlHr() + + htmlImg("avatar",json["avatar"].toString())) + + htmlSpan("display_name", + json["display_name"].toString()) + + " " + + htmlSpan("acct","@" + json["acct"].toString()) + + htmlDiv("user_info", + tr(" following: ") + + QString::number(json["following_count"].toInt()) + + tr(" following: ") + + QString::number(json["followers_count"].toInt())) + ); return result; } @@ -281,6 +278,31 @@ return result; } +const QString SaoriView::htmlDiv(const QString divclass, const QString text) +{ + return QString("
\n%2\n
\n").arg(divclass,text); +} + +const QString SaoriView::htmlSpan(const QString spanclass, const QString text) +{ + return QString("%2").arg(spanclass,text); +} + +const QString SaoriView::htmlImg(const QString type, const QString url) +{ + return QString("").arg(type,url); +} + +const QString SaoriView::htmlAnc(const QString link, const QString text) +{ + return QString("%2").arg(link,text); +} + +const QString SaoriView::htmlHr() +{ + return QString("
"); +} + void SaoriView::recived(const QString timeline,const QByteArray data) { if (timeline != m_viewname) return; diff --git a/saoriview.h b/saoriview.h index 3af74ce..60540f0 100644 --- a/saoriview.h +++ b/saoriview.h @@ -63,6 +63,13 @@ const QString contentParser(const QString content); const QString notificationParser(const QJsonObject json); + static const QString htmlDiv(const QString divclass,const QString text); + static const QString htmlSpan(const QString spanclass,const QString text); + static const QString htmlImg(const QString type,const QString url); + static const QString htmlAnc(const QString link,const QString text); + static const QString htmlHr(); + + public slots: void recived(const QString timeline,const QByteArray data); void linkClicked(const QUrl &url);