mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
Ladybird: Show the web page title in the window titlebar :^)
This commit is contained in:
parent
8b7000e151
commit
f5d033b8ba
4 changed files with 13 additions and 1 deletions
|
@ -19,9 +19,18 @@ 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);
|
||||
}
|
||||
|
||||
void BrowserWindow::location_edit_return_pressed()
|
||||
{
|
||||
view().load(m_location_edit->text().toUtf8().data());
|
||||
}
|
||||
|
||||
void BrowserWindow::page_title_changed(QString title)
|
||||
{
|
||||
if (title.isEmpty())
|
||||
setWindowTitle("Ladybird");
|
||||
else
|
||||
setWindowTitle(QString("%1 - Ladybird").arg(title));
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void location_edit_return_pressed();
|
||||
void page_title_changed(QString);
|
||||
|
||||
private:
|
||||
QToolBar* m_toolbar { nullptr };
|
||||
|
|
|
@ -130,8 +130,9 @@ public:
|
|||
return m_preferred_color_scheme;
|
||||
}
|
||||
|
||||
virtual void page_did_change_title(String const&) override
|
||||
virtual void page_did_change_title(String const& title) override
|
||||
{
|
||||
emit m_view.title_changed(title.characters());
|
||||
}
|
||||
|
||||
virtual void page_did_set_document_in_top_level_browsing_context(Web::DOM::Document*) override
|
||||
|
|
|
@ -32,6 +32,7 @@ signals:
|
|||
void linkHovered(QString, int timeout = 0);
|
||||
void linkUnhovered();
|
||||
void loadStarted(QString);
|
||||
void title_changed(QString);
|
||||
|
||||
private:
|
||||
OwnPtr<HeadlessBrowserPageClient> m_page_client;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue