aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainwindow/widgets/navigationbar.cpp2
-rw-r--r--src/webengine/webview.cpp26
-rw-r--r--src/webengine/webview.h14
3 files changed, 7 insertions, 35 deletions
diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp
index 98a7932..98fe0fa 100644
--- a/src/mainwindow/widgets/navigationbar.cpp
+++ b/src/mainwindow/widgets/navigationbar.cpp
@@ -102,7 +102,7 @@ void NavigationBar::connectWebView(WebView *view)
}
loadStartedConnection = connect(view, &QWebEngineView::loadStarted, this, &NavigationBar::update_loadStarted);
- loadFinishedConnection = connect(view, &WebView::loaded, this, &NavigationBar::update_loadFinished);
+ loadFinishedConnection = connect(view, &QWebEngineView::loadFinished, this, &NavigationBar::update_loadFinished);
stopReloadAction->setEnabled(true);
homeAction->setEnabled(true);
}
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp
index 3c4e19e..b9dfaa7 100644
--- a/src/webengine/webview.cpp
+++ b/src/webengine/webview.cpp
@@ -32,13 +32,6 @@ WebView::WebView(WebProfile *profile, QWidget *parent)
connect(this, &QWebEngineView::loadFinished, this, [this]() {
m_loaded = true;
});
- connect(this, &QWebEngineView::loadProgress, this, [this](int progress) {
- m_loadProgress = progress;
- if(m_loadProgress == 100) {
- m_loaded = true;
- emit loaded();
- }
- });
m_pageMenu = new PageMenu(this);
m_toolsMenu = new PageToolsMenu(this);
@@ -49,30 +42,11 @@ WebView::~WebView()
delete m_pageMenu;
}
-QMenu *WebView::pageMenu()
-{
- Q_CHECK_PTR(m_pageMenu);
- return m_pageMenu;
-}
-
-void WebView::setPage(QWebEnginePage *page)
-{
- Q_CHECK_PTR(page);
- // make sure the page gets cleaned up if we replace it by taking ownership
- page->setParent(this);
- QWebEngineView::setPage(page);
-}
-
bool WebView::isLoaded() const
{
return m_loaded;
}
-int WebView::loadProgress() const
-{
- return m_loadProgress;
-}
-
void WebView::search(const QString &term)
{
const QString searchUrl = m_profile->search().arg(QString(QUrl::toPercentEncoding(term)));
diff --git a/src/webengine/webview.h b/src/webengine/webview.h
index 2a99fdd..78ea80d 100644
--- a/src/webengine/webview.h
+++ b/src/webengine/webview.h
@@ -27,7 +27,11 @@ public:
explicit WebView(WebProfile *profile = nullptr, QWidget *parent = nullptr);
~WebView() override;
- QMenu *pageMenu();
+ QMenu *pageMenu()
+ {
+ Q_CHECK_PTR(m_pageMenu);
+ return m_pageMenu;
+ }
QMenu *toolsMenu()
{
Q_CHECK_PTR(m_toolsMenu);
@@ -37,9 +41,8 @@ public:
WebProfile *profile() {
return m_profile;
}
- void setPage(QWebEnginePage *page);
+
bool isLoaded() const;
- int loadProgress() const;
void triggerViewAction(ViewAction action);
@@ -47,10 +50,6 @@ public slots:
void search(const QString &term);
signals:
- // loadStarted is always emitted, be it page load or in-page request,
- // but loadFinished is only emitted when it's a page load
- // so emit loaded when a load is emitted (progress == 100)
- void loaded();
void newBookmark(const QString &title, const QUrl &url);
protected:
@@ -64,7 +63,6 @@ private:
QMenu *m_toolsMenu = nullptr;
bool m_loaded;
- int m_loadProgress;
};
#endif // SMOLBOTE_WEBVIEW_H