diff --git a/saoristyle.css b/saoristyle.css index f655389..f99b89b 100644 --- a/saoristyle.css +++ b/saoristyle.css @@ -41,3 +41,10 @@ float:left; } +div.notification_type { + font-size:large; +} + +div.notification_type img { + float:left; +} diff --git a/saoriview.cpp b/saoriview.cpp index 44a9e4b..7bdcd5d 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -194,7 +194,7 @@ } result += ""; + QStringList type; + type << "mention" << "reblog" << "favourite" << "follow"; + result += "
"; + switch (type.indexOf(json["type"].toString())) { + case 0: + result += ""; + result += tr("%1 mentioned your status.").arg(json["account"].toObject()["display_name"].toString()); + break; + case 1: + result += ""; + result += tr("%1 boosted your status.").arg(json["account"].toObject()["display_name"].toString()); + break; + case 2: + result += ""; + result += tr("%1 favourited your status.").arg(json["account"].toObject()["display_name"].toString()); + break; + case 3: + result += ""; + result += tr("%1 followed you.").arg(json["account"].toObject()["display_name"].toString()); + break; + default: + break; + } + result += "
"; + result += "
"; + 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 += "
"; + + result += statusParser(json["status"].toObject()); + + result += "
"; + result += "
(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()) { diff --git a/saoriviewentry.cpp b/saoriviewentry.cpp index 58d0d4f..64265d4 100644 --- a/saoriviewentry.cpp +++ b/saoriviewentry.cpp @@ -57,10 +57,17 @@ } for (auto i:imgs) { int p = i.indexOf(':'); - m_urlmap[i] = SaoriApplication::saori()->cache()->fileCache(QUrl(i.mid(p + 1))); - QImage img(m_urlmap[i]); + QString imageurl; + if (i.mid(p + 1,2) != ":/") { + imageurl = SaoriApplication::saori()->cache()->fileCache(QUrl(i.mid(p + 1))); + } else { + imageurl = i.mid(p + 1); + } + m_urlmap[i] = imageurl; + //qDebug() << imageurl; + QImage img(imageurl); imageResizer(i.left(p),img); - document()->addResource(QTextDocument::ImageResource,QUrl("img:" + m_urlmap[i]),QVariant(img)); + document()->addResource(QTextDocument::ImageResource,QUrl("img:" + imageurl),QVariant(img)); } setText(designedText()); // QTextBrowserのサイズを確定させるトリック。 @@ -124,8 +131,12 @@ { m_urlmap[url.toString()] = SaoriApplication::saori()->cache()->fileCache(url); setContent(m_original); - for (auto i:m_urlmap) { - if (i.indexOf(":/")) return; + for (auto i = m_urlmap.begin();i != m_urlmap.end();i ++) { + if (i.value().left(2) == ":/") { + if (i.key().left(2) != ":/") { + return; + } + } } disconnect(SaoriApplication::saori()->cache(),&SaoriCache::downloaded,this,&SaoriViewEntry::downloaded); }