1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

TabModel: Add BackgroundActivityRole

This commit is contained in:
David Rosca 2018-02-10 21:37:21 +01:00
parent cd4f94574a
commit 315218db9d
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
4 changed files with 15 additions and 1 deletions

View File

@ -131,6 +131,9 @@ QVariant TabModel::data(const QModelIndex &index, int role) const
case AudioMutedRole: case AudioMutedRole:
return t->isMuted(); return t->isMuted();
case BackgroundActivityRole:
return t->backgroundActivity();
default: default:
return QVariant(); return QVariant();
} }
@ -255,6 +258,7 @@ void TabModel::tabInserted(int index)
connect(tab, &WebTab::loadingChanged, this, std::bind(emitDataChanged, tab, LoadingRole)); connect(tab, &WebTab::loadingChanged, this, std::bind(emitDataChanged, tab, LoadingRole));
connect(tab, &WebTab::playingChanged, this, std::bind(emitDataChanged, tab, AudioPlayingRole)); connect(tab, &WebTab::playingChanged, this, std::bind(emitDataChanged, tab, AudioPlayingRole));
connect(tab, &WebTab::mutedChanged, this, std::bind(emitDataChanged, tab, AudioMutedRole)); 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) void TabModel::tabRemoved(int index)

View File

@ -59,7 +59,8 @@ public:
CurrentTabRole = Qt::UserRole + 6, CurrentTabRole = Qt::UserRole + 6,
LoadingRole = Qt::UserRole + 7, LoadingRole = Qt::UserRole + 7,
AudioPlayingRole = Qt::UserRole + 8, AudioPlayingRole = Qt::UserRole + 8,
AudioMutedRole = Qt::UserRole + 9 AudioMutedRole = Qt::UserRole + 9,
BackgroundActivityRole = Qt::UserRole + 10
}; };
explicit TabModel(BrowserWindow *window, QObject *parent = nullptr); explicit TabModel(BrowserWindow *window, QObject *parent = nullptr);

View File

@ -182,6 +182,7 @@ WebTab::WebTab(QWidget *parent)
connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleWasChanged); connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleWasChanged);
connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleChanged); connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleChanged);
connect(m_webView, &TabbedWebView::iconChanged, this, &WebTab::iconChanged); 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::loadStarted, this, std::bind(&WebTab::loadingChanged, this, true));
connect(m_webView, &TabbedWebView::loadFinished, this, std::bind(&WebTab::loadingChanged, this, false)); connect(m_webView, &TabbedWebView::loadFinished, this, std::bind(&WebTab::loadingChanged, this, false));
@ -440,6 +441,11 @@ void WebTab::toggleMuted()
setMuted(!muted); setMuted(!muted);
} }
bool WebTab::backgroundActivity() const
{
return m_webView->backgroundActivity();
}
LocationBar* WebTab::locationBar() const LocationBar* WebTab::locationBar() const
{ {
return m_locationBar; return m_locationBar;

View File

@ -108,6 +108,8 @@ public:
void setMuted(bool muted); void setMuted(bool muted);
void toggleMuted(); void toggleMuted();
bool backgroundActivity() const;
int tabIndex() const; int tabIndex() const;
bool isCurrentTab() const; bool isCurrentTab() const;
@ -144,6 +146,7 @@ signals:
void loadingChanged(bool loading); void loadingChanged(bool loading);
void mutedChanged(bool muted); void mutedChanged(bool muted);
void playingChanged(bool playing); void playingChanged(bool playing);
void backgroundActivityChanged(bool activity);
void parentTabChanged(WebTab *tab); void parentTabChanged(WebTab *tab);
void childTabAdded(WebTab *tab, int index); void childTabAdded(WebTab *tab, int index);
void childTabRemoved(WebTab *tab, int index); void childTabRemoved(WebTab *tab, int index);