mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:27:35 +00:00
Ladybird: Add Favicon to the window
This commit is contained in:
parent
47d7f1efec
commit
95e3e06a1e
4 changed files with 14 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <QIcon>
|
||||
#include <QLineEdit>
|
||||
#include <QMainWindow>
|
||||
#include <QToolBar>
|
||||
|
@ -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 };
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include <LibWebSocket/ConnectionInfo.h>
|
||||
#include <LibWebSocket/Message.h>
|
||||
#include <LibWebSocket/WebSocket.h>
|
||||
#include <QIcon>
|
||||
#include <QMouseEvent>
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue