aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-04-17 17:23:53 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-04-17 17:23:53 +0200
commitc03fc45aca526f94e07b99672fb09825af86221c (patch)
tree302cd9f6cc8d7a8026aedfda326debf1ea48b6a4
parentRemove LoadingBar (diff)
downloadsmolbote-c03fc45aca526f94e07b99672fb09825af86221c.tar.xz
Hovering over links shows them in the status bar again
-rw-r--r--src/mainwindow/mainwindow.cpp3
-rw-r--r--src/mainwindow/mainwindow.h1
-rw-r--r--src/mainwindow/widgets/searchform.cpp3
-rw-r--r--src/mainwindow/window.cpp7
-rw-r--r--src/mainwindow/window.h2
-rw-r--r--src/webengine/webview.cpp7
-rw-r--r--src/webengine/webview.h3
7 files changed, 13 insertions, 13 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index 9b1db30..18e1b63 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -67,6 +67,7 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
disconnect(addressBarConnection);
disconnect(navigationBarConnection);
disconnect(searchBoxConnection);
+ disconnect(statusBarConnection);
auto *w = qobject_cast<Window *>(window);
if(w == nullptr) {
@@ -87,6 +88,7 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
navigationBarConnection = connect(w, &Window::currentViewChanged, navigationToolBar, &NavigationBar::connectWebView);
searchBox->setView(w->currentView());
searchBoxConnection = connect(w, &Window::currentViewChanged, searchBox, &SearchForm::setView);
+ statusBarConnection = connect(w, &Window::showStatusMessage, statusBar(), &QStatusBar::showMessage);
}
});
@@ -107,6 +109,7 @@ MainWindow::~MainWindow()
disconnect(addressBarConnection);
disconnect(navigationBarConnection);
disconnect(searchBoxConnection);
+ disconnect(statusBarConnection);
}
void MainWindow::createMenuBar()
diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h
index 581cd0c..ee7d332 100644
--- a/src/mainwindow/mainwindow.h
+++ b/src/mainwindow/mainwindow.h
@@ -57,6 +57,7 @@ private:
QMetaObject::Connection titleChangedConnection;
QMetaObject::Connection addressBarConnection, navigationBarConnection;
QMetaObject::Connection searchBoxConnection;
+ QMetaObject::Connection statusBarConnection;
};
#endif // SMOLBOTE_MAINWINDOW_H
diff --git a/src/mainwindow/widgets/searchform.cpp b/src/mainwindow/widgets/searchform.cpp
index 80e3848..79cc0cf 100644
--- a/src/mainwindow/widgets/searchform.cpp
+++ b/src/mainwindow/widgets/searchform.cpp
@@ -21,8 +21,6 @@ SearchForm::SearchForm(QWidget *parent)
ui->result_label->setVisible(false);
connect(ui->lineEdit, &QLineEdit::returnPressed, this, [this]() {
- Q_ASSERT_X(view != nullptr, "SearchForm::returnPressed::lambda", "No view set");
-
if(view) {
QWebEnginePage::FindFlags searchFlags;
searchFlags.setFlag(QWebEnginePage::FindCaseSensitively, ui->caseSensitivity_checkBox->isChecked());
@@ -41,7 +39,6 @@ SearchForm::~SearchForm()
void SearchForm::setView(QWebEngineView* view)
{
- qDebug("setting view: %s", view == nullptr ? "nullptr" : "valid");
this->view = view;
}
diff --git a/src/mainwindow/window.cpp b/src/mainwindow/window.cpp
index 67397fe..0c52076 100644
--- a/src/mainwindow/window.cpp
+++ b/src/mainwindow/window.cpp
@@ -31,9 +31,16 @@ Window::Window(QWidget *parent, Qt::WindowFlags flags)
Q_CHECK_PTR(view);
disconnect(titleConnection);
+ disconnect(linkHoveredConnection);
+
connect(view, &WebView::titleChanged, this, &Window::setWindowTitle);
setWindowTitle(view->title());
+ connect(view->page(), &WebPage::linkHovered, this, [this](const QString &url) {
+ if(!url.isEmpty())
+ emit showStatusMessage(url, 3000);
+ });
+
emit currentViewChanged(view);
}
});
diff --git a/src/mainwindow/window.h b/src/mainwindow/window.h
index 743d75f..ee9a11d 100644
--- a/src/mainwindow/window.h
+++ b/src/mainwindow/window.h
@@ -26,6 +26,7 @@ public:
signals:
void currentViewChanged(WebView *view);
+ void showStatusMessage(const QString &message, int timeout = 0);
public slots:
int addTab(WebView *view);
@@ -37,6 +38,7 @@ private:
TabWidget *tabWidget;
QMetaObject::Connection titleConnection;
+ QMetaObject::Connection linkHoveredConnection;
};
#endif // SMOLBOTE_WINDOW_H
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp
index 1e5d8d5..dadac1e 100644
--- a/src/webengine/webview.cpp
+++ b/src/webengine/webview.cpp
@@ -60,7 +60,6 @@ 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);
- connect(page, &QWebEnginePage::linkHovered, this, &WebView::handleLinkHovered);
QWebEngineView::setPage(page);
}
@@ -114,12 +113,6 @@ WebView *WebView::createWindow(QWebEnginePage::WebWindowType type)
return view;
}
-void WebView::handleLinkHovered(const QString &url)
-{
- // TODO: tooltip
- Q_UNUSED(url);
-}
-
void WebView::triggerViewAction(WebView::ViewAction action)
{
switch(action) {
diff --git a/src/webengine/webview.h b/src/webengine/webview.h
index ab86ec2..d59847b 100644
--- a/src/webengine/webview.h
+++ b/src/webengine/webview.h
@@ -52,9 +52,6 @@ signals:
protected:
WebView *createWindow(QWebEnginePage::WebWindowType type) override;
-private slots:
- void handleLinkHovered(const QString &url);
-
private:
Window *m_parentWindow = nullptr;
WebProfile *m_profile = nullptr;