1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:07:45 +00:00

html: Set the window title based on the HTML document's title

If the loaded document has a <title>, we now show that in the app's
window title bar! :^)
This commit is contained in:
Andreas Kling 2019-09-29 16:26:28 +02:00
parent b94c7665a9
commit 8d822ff82b

View file

@ -41,6 +41,9 @@ int main(int argc, char** argv)
auto window = GWindow::construct(); auto window = GWindow::construct();
auto widget = HtmlView::construct(); auto widget = HtmlView::construct();
widget->set_document(document); widget->set_document(document);
if (!widget->document()->title().is_null())
window->set_title(String::format("%s - HTML", widget->document()->title().characters()));
else
window->set_title("HTML"); window->set_title("HTML");
window->set_main_widget(widget); window->set_main_widget(widget);
window->show(); window->show();