mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Ladybird: Show hovered link URLs in the status bar :^)
This commit is contained in:
parent
9b8fe16e3d
commit
88d256c109
Notes:
sideshowbarker
2024-07-17 02:50:23 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/88d256c109 Pull-request: https://github.com/SerenityOS/serenity/pull/16583 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/linusg
3 changed files with 12 additions and 2 deletions
|
@ -182,15 +182,17 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void page_did_hover_link(AK::URL const&) override
|
||||
virtual void page_did_hover_link(AK::URL const& url) override
|
||||
{
|
||||
emit m_view.linkHovered(url.to_string().characters());
|
||||
}
|
||||
|
||||
virtual void page_did_unhover_link() override
|
||||
{
|
||||
emit m_view.linkUnhovered();
|
||||
}
|
||||
|
||||
virtual void page_did_invalidate(Gfx::IntRect const& rect) override
|
||||
virtual void page_did_invalidate(Gfx::IntRect const&) override
|
||||
{
|
||||
m_view.viewport()->update();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,10 @@ public:
|
|||
virtual void mousePressEvent(QMouseEvent*) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent*) override;
|
||||
|
||||
signals:
|
||||
void linkHovered(QString, int timeout = 0);
|
||||
void linkUnhovered();
|
||||
|
||||
private:
|
||||
OwnPtr<HeadlessBrowserPageClient> m_page_client;
|
||||
};
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <LibMain/Main.h>
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
#include <QStatusBar>
|
||||
#include <QWidget>
|
||||
|
||||
extern void initialize_web_engine();
|
||||
|
@ -36,6 +37,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
WebView view;
|
||||
window.setCentralWidget(&view);
|
||||
|
||||
QObject::connect(&view, &WebView::linkHovered, window.statusBar(), &QStatusBar::showMessage);
|
||||
QObject::connect(&view, &WebView::linkUnhovered, window.statusBar(), &QStatusBar::clearMessage);
|
||||
|
||||
auto qt_event_loop_driver = Core::Timer::create_repeating(50, [&] {
|
||||
app.processEvents();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue