diff --git a/saoristyle.css b/saoristyle.css
index 86beba8..ad68d12 100644
--- a/saoristyle.css
+++ b/saoristyle.css
@@ -7,11 +7,19 @@
text-align:right;
}
+div.content {
+ float:none;
+}
+
div.reblogger {
font-size:small;
text-align:right;
}
+span.media_preview {
+ float:left;
+}
+
span.display_name {
font-size:large;
}
diff --git a/saoriview.cpp b/saoriview.cpp
index af453c2..f9236f1 100644
--- a/saoriview.cpp
+++ b/saoriview.cpp
@@ -80,13 +80,14 @@
result += "
";
}
if (rebloged) {
- result += "
";
result += tr("boosted by: %1").arg(json["account"].toObject()["display_name"].toString());
} else {
result += accountParser(json["account"].toObject());
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();
@@ -96,6 +97,11 @@
result += "
";
result += json["content"].toString();
result += "
";
+ result += "
";
+ for (auto j:json["media_attachments"].toArray()) {
+ result += mediaParser(j.toObject());
+ }
+ result += "
";
}
result += "
";
return result;
@@ -125,6 +131,16 @@
return result;
}
+const QString SaoriView::mediaParser(const QJsonObject json)
+{
+ QString result;
+ result += "
";
+ result += "";
+ return result;
+}
+
void SaoriView::recived(const QString timeline,const QByteArray data)
{
if (timeline != m_viewname) return;
diff --git a/saoriview.h b/saoriview.h
index d7c5887..e33bfc4 100644
--- a/saoriview.h
+++ b/saoriview.h
@@ -56,6 +56,7 @@
protected:
const QString statusParser(const QJsonObject json);
const QString accountParser(const QJsonObject json);
+ const QString mediaParser(const QJsonObject json);
const QString notificationParser(const QJsonObject json);
public slots:
diff --git a/saoriviewentry.cpp b/saoriviewentry.cpp
index 141378d..b51bb90 100644
--- a/saoriviewentry.cpp
+++ b/saoriviewentry.cpp
@@ -31,12 +31,17 @@
#include
SaoriViewEntry::SaoriViewEntry(QWidget *parent) :
- QLabel(parent)
+ QTextBrowser(parent)
{
- setWordWrap(true);
+ setReadOnly(true);
+ setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
- setSizePolicy(QSizePolicy::Expanding,QSizePolicy::MinimumExpanding);
- setTextFormat(Qt::RichText);
+ setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
+ setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
+ setMinimumHeight(100);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ //setTextFormat(Qt::RichText);
connect(SaoriApplication::saori()->cache(),&SaoriCache::downloaded,this,&SaoriViewEntry::downloaded);
}
@@ -52,7 +57,16 @@
m_urlmap[i] = SaoriApplication::saori()->cache()->fileCache(QUrl(i));
}
setText(designedText());
- qDebug() << text();
+ update();
+ document()->adjustSize();
+ setFixedHeight(document()->size().height());
+}
+
+void SaoriViewEntry::resizeEvent(QResizeEvent *e)
+{
+ document()->adjustSize();
+ setFixedHeight(document()->size().height() + 10);
+ QTextBrowser::resizeEvent(e);
}
const QString SaoriViewEntry::designedText()
diff --git a/saoriviewentry.h b/saoriviewentry.h
index 4d6c718..52bdd8c 100644
--- a/saoriviewentry.h
+++ b/saoriviewentry.h
@@ -27,11 +27,11 @@
#ifndef SAORIVIEWENTRY_H
#define SAORIVIEWENTRY_H
-#include
+#include
#include
#include
-class SaoriViewEntry : public QLabel
+class SaoriViewEntry : public QTextBrowser
{
Q_OBJECT
@@ -40,6 +40,7 @@
void setContent(const QString content);
protected:
+ virtual void resizeEvent(QResizeEvent *e);
const QString designedText();
const QString imageReplacer();