diff --git a/saoriview.cpp b/saoriview.cpp index b0b755f..187785d 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -104,11 +104,13 @@ } }); connect(saoriaccount,&SaoriAccount::accountInfomationChanged,this,[=](){ + setAvatar(saoriaccount->accountInfo("avatar").toString()); ui->tootWidget->setAccountLabel(QString("%1(@%2@%3)").arg( saoriaccount->accountInfo("display_name").toString(), saoriaccount->accountInfo("username").toString(), saoriaccount->instance()->instanceInfo("uri").toString())); }); + setAvatar(saoriaccount->accountInfo("avatar").toString()); ui->tootWidget->setAccountLabel(QString("%1(@%2@%3)").arg( saoriaccount->accountInfo("display_name").toString(), saoriaccount->accountInfo("username").toString(), @@ -549,6 +551,15 @@ } } +void SaoriView::setAvatar(const QString avatar) +{ + QImage a(SaoriApplication::saori()->cache()->fileCache(avatar)); + ui->labelAvatar->setPixmap(QPixmap::fromImage(a.scaled(style()->pixelMetric(QStyle::PM_ToolBarIconSize), + style()->pixelMetric(QStyle::PM_ToolBarIconSize), + Qt::KeepAspectRatio, + Qt::SmoothTransformation))); +} + void SaoriView::timerUpdate() { m_timecount ++; diff --git a/saoriview.h b/saoriview.h index 92b02cf..88e359a 100644 --- a/saoriview.h +++ b/saoriview.h @@ -83,6 +83,7 @@ public slots: void recived(const QString timeline,const QByteArray data,const QByteArray link); void linkClicked(const QUrl &url); + void setAvatar(const QString avatar); protected slots: void timerUpdate(); diff --git a/saoriview.ui b/saoriview.ui index 8d561c8..c7aea65 100644 --- a/saoriview.ui +++ b/saoriview.ui @@ -104,6 +104,13 @@ 0 + + + + + + + Qt::Horizontal