diff --git a/saoriaccount.cpp b/saoriaccount.cpp index 642ead7..c03437e 100644 --- a/saoriaccount.cpp +++ b/saoriaccount.cpp @@ -118,8 +118,8 @@ auto *reply = manager->get(request); connect(manager,&QNetworkAccessManager::finished,[=](){ if (reply->NoError == QNetworkReply::NoError) { - auto view = SaoriView::findView(timeline,m_name); - if (view != nullptr) view->recived(reply->readAll()); + QByteArray data = reply->readAll(); + emit apiData(timeline,data); } manager->deleteLater(); }); diff --git a/saoriaccount.h b/saoriaccount.h index 0fde318..76ff714 100644 --- a/saoriaccount.h +++ b/saoriaccount.h @@ -68,6 +68,7 @@ signals: void accessTokenChanged(QString); void accountInfomationChanged(); + void apiData(const QString timeline,const QByteArray data); public slots: }; diff --git a/saoriview.cpp b/saoriview.cpp index 3132d50..d3d97e9 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -29,6 +29,7 @@ #include #include #include +#include QList SaoriView::m_viewList; @@ -40,6 +41,11 @@ m_viewname = view; m_account = account; m_viewList.append(this); + + auto saoriaccount = SaoriApplication::saori()->findAccount(m_account); + if (saoriaccount) { + connect(saoriaccount,&SaoriAccount::apiData,this,&SaoriView::recived); + } } SaoriView::~SaoriView() @@ -56,7 +62,9 @@ return nullptr; } -void SaoriView::recived(QString result) +void SaoriView::recived(const QString timeline,const QByteArray data) { - qDebug() << result; + if (timeline == m_viewname) { + qDebug() << QString::fromUtf8(data); + } } diff --git a/saoriview.h b/saoriview.h index 0d7f589..e91bd58 100644 --- a/saoriview.h +++ b/saoriview.h @@ -49,7 +49,7 @@ static QList m_viewList; public slots: - void recived(QString result); + void recived(const QString timeline,const QByteArray data); private: Ui::SaoriView *ui; diff --git a/saoriwindow.cpp b/saoriwindow.cpp index 0efc0bd..cb3e30e 100644 --- a/saoriwindow.cpp +++ b/saoriwindow.cpp @@ -134,8 +134,6 @@ auto account = SaoriApplication::findAccount(item->text(1)); if (account) { openView(QStringList() << item->text(1) << item->text(2)); - qDebug() << item->text(2); - account->getTimelineData(item->text(2)); } }