diff --git a/src/lib/tabwidget/tabmodel.cpp b/src/lib/tabwidget/tabmodel.cpp index 409e3a4b5..a2725ca2f 100644 --- a/src/lib/tabwidget/tabmodel.cpp +++ b/src/lib/tabwidget/tabmodel.cpp @@ -131,6 +131,9 @@ QVariant TabModel::data(const QModelIndex &index, int role) const case AudioMutedRole: return t->isMuted(); + case BackgroundActivityRole: + return t->backgroundActivity(); + default: return QVariant(); } @@ -255,6 +258,7 @@ void TabModel::tabInserted(int index) connect(tab, &WebTab::loadingChanged, this, std::bind(emitDataChanged, tab, LoadingRole)); connect(tab, &WebTab::playingChanged, this, std::bind(emitDataChanged, tab, AudioPlayingRole)); connect(tab, &WebTab::mutedChanged, this, std::bind(emitDataChanged, tab, AudioMutedRole)); + connect(tab, &WebTab::backgroundActivityChanged, this, std::bind(emitDataChanged, tab, BackgroundActivityRole)); } void TabModel::tabRemoved(int index) diff --git a/src/lib/tabwidget/tabmodel.h b/src/lib/tabwidget/tabmodel.h index 4f37066be..f03dc6088 100644 --- a/src/lib/tabwidget/tabmodel.h +++ b/src/lib/tabwidget/tabmodel.h @@ -59,7 +59,8 @@ public: CurrentTabRole = Qt::UserRole + 6, LoadingRole = Qt::UserRole + 7, AudioPlayingRole = Qt::UserRole + 8, - AudioMutedRole = Qt::UserRole + 9 + AudioMutedRole = Qt::UserRole + 9, + BackgroundActivityRole = Qt::UserRole + 10 }; explicit TabModel(BrowserWindow *window, QObject *parent = nullptr); diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 32841bd62..691d7af50 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -182,6 +182,7 @@ WebTab::WebTab(QWidget *parent) connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleWasChanged); connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleChanged); connect(m_webView, &TabbedWebView::iconChanged, this, &WebTab::iconChanged); + connect(m_webView, &TabbedWebView::backgroundActivityChanged, this, &WebTab::backgroundActivityChanged); connect(m_webView, &TabbedWebView::loadStarted, this, std::bind(&WebTab::loadingChanged, this, true)); connect(m_webView, &TabbedWebView::loadFinished, this, std::bind(&WebTab::loadingChanged, this, false)); @@ -440,6 +441,11 @@ void WebTab::toggleMuted() setMuted(!muted); } +bool WebTab::backgroundActivity() const +{ + return m_webView->backgroundActivity(); +} + LocationBar* WebTab::locationBar() const { return m_locationBar; diff --git a/src/lib/webtab/webtab.h b/src/lib/webtab/webtab.h index ef5cc839f..c53d17527 100644 --- a/src/lib/webtab/webtab.h +++ b/src/lib/webtab/webtab.h @@ -108,6 +108,8 @@ public: void setMuted(bool muted); void toggleMuted(); + bool backgroundActivity() const; + int tabIndex() const; bool isCurrentTab() const; @@ -144,6 +146,7 @@ signals: void loadingChanged(bool loading); void mutedChanged(bool muted); void playingChanged(bool playing); + void backgroundActivityChanged(bool activity); void parentTabChanged(WebTab *tab); void childTabAdded(WebTab *tab, int index); void childTabRemoved(WebTab *tab, int index);