#ifndef WEBVIEWTABBAR_H
#define WEBVIEWTABBAR_H

#include <QTabBar>
#include <QWebEngineView>

class WebViewTabBar : public QTabBar
{
    Q_OBJECT

public:
    WebViewTabBar(QWidget *parent = 0);
    ~WebViewTabBar();

    int addTab(QWebEngineProfile *profile, const QUrl &url);
    void setProfile(QWebEngineProfile *profile);

    QWebEngineView *currentView();

signals:
    void currentTabChanged(QWebEngineView *view);

private slots:
    void handleCurrentChanged(int index);
    void handleTabClose(int index);

    void updateTabText(QWebEngineView *view, const QString &text);

private:
    QVector<QWebEngineView*> m_views;
};

#endif // WEBVIEWTABBAR_H