diff --git a/Ladybird/BrowserWindow.cpp b/Ladybird/BrowserWindow.cpp index dc23677be0..d0eb5bcbed 100644 --- a/Ladybird/BrowserWindow.cpp +++ b/Ladybird/BrowserWindow.cpp @@ -19,6 +19,7 @@ BrowserWindow::BrowserWindow() QObject::connect(m_view, &WebView::loadStarted, m_location_edit, &QLineEdit::setText); QObject::connect(m_location_edit, &QLineEdit::returnPressed, this, &BrowserWindow::location_edit_return_pressed); QObject::connect(m_view, &WebView::title_changed, this, &BrowserWindow::page_title_changed); + QObject::connect(m_view, &WebView::favicon_changed, this, &BrowserWindow::page_favicon_changed); } void BrowserWindow::location_edit_return_pressed() @@ -33,3 +34,8 @@ void BrowserWindow::page_title_changed(QString title) else setWindowTitle(QString("%1 - Ladybird").arg(title)); } + +void BrowserWindow::page_favicon_changed(QIcon icon) +{ + setWindowIcon(icon); +} diff --git a/Ladybird/BrowserWindow.h b/Ladybird/BrowserWindow.h index 09e28a641d..419716d971 100644 --- a/Ladybird/BrowserWindow.h +++ b/Ladybird/BrowserWindow.h @@ -1,3 +1,4 @@ +#include #include #include #include @@ -16,6 +17,7 @@ public: public slots: void location_edit_return_pressed(); void page_title_changed(QString); + void page_favicon_changed(QIcon); private: QToolBar* m_toolbar { nullptr }; diff --git a/Ladybird/WebView.cpp b/Ladybird/WebView.cpp index 11d72a7184..f68f2e1b85 100644 --- a/Ladybird/WebView.cpp +++ b/Ladybird/WebView.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -210,8 +211,11 @@ public: m_view.viewport()->update(); } - virtual void page_did_change_favicon(Gfx::Bitmap const&) override + virtual void page_did_change_favicon(Gfx::Bitmap const& bitmap) override { + ByteBuffer bytebuffer = bitmap.serialize_to_byte_buffer(); + QPixmap icon = QPixmap::fromImage(QImage(bytebuffer.bytes().data(), bitmap.width(), bitmap.height(), QImage::Format_ARGB32)); + emit m_view.favicon_changed(QIcon(icon)); } virtual void page_did_layout() override diff --git a/Ladybird/WebView.h b/Ladybird/WebView.h index 50dd6b1d55..466dccd1ab 100644 --- a/Ladybird/WebView.h +++ b/Ladybird/WebView.h @@ -34,6 +34,7 @@ signals: void linkUnhovered(); void loadStarted(QString); void title_changed(QString); + void favicon_changed(QIcon); private: Gfx::IntPoint to_content(Gfx::IntPoint) const;