diff --git a/saoriview.cpp b/saoriview.cpp index b7ed058..b0b755f 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -498,6 +498,7 @@ 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; @@ -513,6 +514,7 @@ connect(entry,&SaoriViewEntry::anchorClicked,this,&SaoriView::linkClicked); m_entries.insert(i,entry); qobject_cast(ui->scrollAreaWidgetContents->layout())->insertWidget(i,entry); + news ++; } // NOTE:ここから @@ -531,6 +533,7 @@ } if (s != m_sinceid) reload(); viewEntriesAdjustment(); + if (news && ui->actionNotification->isChecked()) emit newEntryRecived(m_viewname,m_account,news); } void SaoriView::linkClicked(const QUrl &url) diff --git a/saoriview.h b/saoriview.h index db41529..92b02cf 100644 --- a/saoriview.h +++ b/saoriview.h @@ -95,6 +95,7 @@ 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(); diff --git a/saoriwindow.cpp b/saoriwindow.cpp index 306b32a..a6de04f 100644 --- a/saoriwindow.cpp +++ b/saoriwindow.cpp @@ -145,6 +145,10 @@ auto sub = ui->mdiArea->addSubWindow(view); connect(view,&SaoriView::openMediaView,this,&SaoriWindow::openMediaView); connect(view,&SaoriView::openAccountView,this,&SaoriWindow::openView); + connect(view,&SaoriView::newEntryRecived,this,[=](const QString view,const QString account,int count){ + auto t = getTimelineTitle(view); + m_tray->showMessage(t.first + '@' + account,count == 1 ? tr("new entry.") : tr("new %1 entries.").arg(count)); + }); sub->setWindowTitle(title); sub->setWindowIcon(QIcon(getTimelineTitle(viewName.at(1)).second));