| |
---|
| | result += "\">"; |
---|
| | } |
---|
| | result += "<img(media:"; |
---|
| | result += json["preview_url"].toString(); |
---|
| | result += ") width=200>"; |
---|
| | result += ")>"; |
---|
| | if (json["type"].toString() == "image") { |
---|
| | result += "</a>"; |
---|
| | } |
---|
| | result += "</span>"; |
---|
| |
---|
| | result += s.right(s.count() - i); |
---|
| | } |
---|
| | result = result.right(result.count() - 3); |
---|
| | |
---|
| | return result; |
---|
| | } |
---|
| | |
---|
| | const QString SaoriView::notificationParser(const QJsonObject json) |
---|
| | { |
---|
| | QString result; |
---|
| | if (json.isEmpty()) return QString(); |
---|
| | result += "<div class=\"notification\">"; |
---|
| | QStringList type; |
---|
| | type << "mention" << "reblog" << "favourite" << "follow"; |
---|
| | result += "<div class=\"notification_type\">"; |
---|
| | switch (type.indexOf(json["type"].toString())) { |
---|
| | case 0: |
---|
| | result += "<img(mavatar::/icons/ionicons/chatbubbles.svg) />"; |
---|
| | result += tr("%1 mentioned your status.").arg(json["account"].toObject()["display_name"].toString()); |
---|
| | break; |
---|
| | case 1: |
---|
| | result += "<img(mavatar::/icons/ionicons/share.svg) />"; |
---|
| | result += tr("%1 boosted your status.").arg(json["account"].toObject()["display_name"].toString()); |
---|
| | break; |
---|
| | case 2: |
---|
| | result += "<img(mavatar::/icons/ionicons/heart.svg) />"; |
---|
| | result += tr("%1 favourited your status.").arg(json["account"].toObject()["display_name"].toString()); |
---|
| | break; |
---|
| | case 3: |
---|
| | result += "<img(mavatar::/icons/ionicons/person-add.svg) />"; |
---|
| | result += tr("%1 followed you.").arg(json["account"].toObject()["display_name"].toString()); |
---|
| | break; |
---|
| | default: |
---|
| | break; |
---|
| | } |
---|
| | result += "<hr /><div/>"; |
---|
| | result += "<div class=\"created_at\">"; |
---|
| | result += tr("created at :"); |
---|
| | QDateTime dt = QDateTime::fromString(json["created_at"].toString(),"yyyy-MM-ddTHH:mm:ss.zzzZ"); |
---|
| | dt.setTimeSpec(Qt::UTC); |
---|
| | result += dt.toLocalTime().toString(); |
---|
| | result += "</div>"; |
---|
| | |
---|
| | result += statusParser(json["status"].toObject()); |
---|
| | |
---|
| | result += "<div class=\"reblogger\">"; |
---|
| | result += "<br /><img(mavatar:"; |
---|
| | result += json["account"].toObject()["avatar"].toString(); |
---|
| | result += ") />"; |
---|
| | result += tr("%1").arg(json["account"].toObject()["display_name"].toString()); |
---|
| | result += "</div>"; |
---|
| | result += "</div>"; |
---|
| | return result; |
---|
| | } |
---|
| | |
---|
| | void SaoriView::recived(const QString timeline,const QByteArray data) |
---|
| |
---|
| | entry = new SaoriViewEntry(j.toObject()["id"].toString().toLongLong(),ui->scrollAreaWidgetContents); |
---|
| | connect(entry,&SaoriViewEntry::anchorClicked,this,&SaoriView::linkClicked); |
---|
| | m_entries.insert(i,entry); |
---|
| | qobject_cast<QBoxLayout*>(ui->scrollAreaWidgetContents->layout())->insertWidget(i,entry); |
---|
| | entry->setContent(statusParser(j.toObject())); |
---|
| | if (m_viewname == "notifications") entry->setContent(notificationParser(j.toObject())); |
---|
| | else entry->setContent(statusParser(j.toObject())); |
---|
| | } |
---|
| | } |
---|
| | if (m_entries.count()) { |
---|
| | if (m_entries.first()->id() > m_maxid) reload(); |
---|
| |
---|
| | |