aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow')
-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
5 files changed, 13 insertions, 3 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