diff options
| author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-19 02:10:31 +0100 | 
|---|---|---|
| committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-19 02:10:31 +0100 | 
| commit | 49ee5ed6e80b8f06337f92d14e2cab1c1512c1e3 (patch) | |
| tree | e35d5472c2a3ed129f5a6a6826f9999b033cc548 /src/webengine | |
| parent | Configuration creates missing items based on defaults (diff) | |
| download | smolbote-49ee5ed6e80b8f06337f92d14e2cab1c1512c1e3.tar.xz | |
Refactoring MainWindow
- Added NavigationBar object that manages the navigation buttons
- Removed NavigationButton class that it obsoleted
Diffstat (limited to 'src/webengine')
| -rw-r--r-- | src/webengine/webview.cpp | 23 | ||||
| -rw-r--r-- | src/webengine/webview.h | 7 | 
2 files changed, 28 insertions, 2 deletions
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp index ea0ee26..c924144 100644 --- a/src/webengine/webview.cpp +++ b/src/webengine/webview.cpp @@ -26,7 +26,7 @@  #include <QPrinter>  #include <QPrinterInfo> -#include "mainwindow.h" +#include "src/mainwindow/mainwindow.h"  #include <QStatusBar>  // ssl errors @@ -38,6 +38,17 @@ WebView::WebView(MainWindow *parentMainWindow, QWidget *parent)      Q_CHECK_PTR(parentMainWindow);      m_parent = parentMainWindow; +    // load status and progress +    connect(this, &QWebEngineView::loadStarted, this, [this]() { +        m_loaded = false; +    }); +    connect(this, &QWebEngineView::loadFinished, this, [this]() { +        m_loaded = true; +    }); +    connect(this, &QWebEngineView::loadProgress, this, [this](int progress) { +        m_loadProgress = progress; +    }); +      m_pageMenu = new QMenu();      m_pageMenu->setMinimumWidth(240); @@ -137,6 +148,16 @@ void WebView::setPage(WebPage *page)      QWebEngineView::setPage(page);  } +bool WebView::isLoaded() const +{ +    return m_loaded; +} + +int WebView::loadProgress() const +{ +    return m_loadProgress; +} +  WebView *WebView::createWindow(QWebEnginePage::WebWindowType type)  {      WebView *view = new WebView(m_parent); diff --git a/src/webengine/webview.h b/src/webengine/webview.h index 18a1e02..78b85ce 100644 --- a/src/webengine/webview.h +++ b/src/webengine/webview.h @@ -24,12 +24,14 @@ public:      QMenu *pageMenu();      void setPage(WebPage *page); +    bool isLoaded() const; +    int loadProgress() const;  signals:      void newBookmark(const QString &title, const QUrl &url);  protected: -    WebView *createWindow(QWebEnginePage::WebWindowType type); +    WebView *createWindow(QWebEnginePage::WebWindowType type) override;  private slots:      void handleLinkHovered(const QString &url); @@ -38,6 +40,9 @@ private slots:  private:      MainWindow *m_parent = nullptr;      QMenu *m_pageMenu = nullptr; + +    bool m_loaded; +    int m_loadProgress;  };  #endif // WEBVIEW_H  | 
