通知対応。
1 parent 22df38c commit 7fff827efb6d9e5606bf8e60f1dc99336d351905
@TAM (Teppei Tamra) TAM (Teppei Tamra) authored on 29 May 2018
Showing 3 changed files
View
3
■■
saoriview.cpp
if (timeline != m_viewname) return;
qlonglong s = m_sinceid;
getIdsFromHeader(link);
QJsonArray json = QJsonDocument::fromJson(data).array();
int news = 0;
for (auto j:json) {
int i = 0;
SaoriViewEntry *entry = nullptr;
for(;m_entries.count() > i;i ++) {
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);
news ++;
}
 
// NOTE:ここから
if (m_viewname == "notifications") entry->setContent(notificationParser(j.toObject()));
// NOTE:ここまでを上ifに含めると取得済みエントリを再描画しなくなる。
}
if (s != m_sinceid) reload();
viewEntriesAdjustment();
if (news && ui->actionNotification->isChecked()) emit newEntryRecived(m_viewname,m_account,news);
}
 
void SaoriView::linkClicked(const QUrl &url)
{
View
1
■■■■
saoriview.h
 
signals:
void openMediaView(const QUrl);
void openAccountView(const QStringList view);
void newEntryRecived(const QString view,const QString account,int count);
 
private slots:
void on_actionReload_triggered();
void on_actionNewest_triggered();
View
saoriwindow.cpp