mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
Ladybird+Browser: Update zoom text on menu after clicking zoom button
This commit is contained in:
parent
cc9885c0c6
commit
49df2e1e3a
6 changed files with 19 additions and 4 deletions
|
@ -614,6 +614,13 @@ void BrowserWindow::reset_zoom()
|
||||||
update_displayed_zoom_level();
|
update_displayed_zoom_level();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserWindow::update_zoom_menu()
|
||||||
|
{
|
||||||
|
VERIFY(m_zoom_menu);
|
||||||
|
auto zoom_level_text = MUST(String::formatted("&Zoom ({}%)", round_to<int>(m_current_tab->view().zoom_level() * 100)));
|
||||||
|
m_zoom_menu->setTitle(qstring_from_ak_string(zoom_level_text));
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserWindow::select_all()
|
void BrowserWindow::select_all()
|
||||||
{
|
{
|
||||||
if (!m_current_tab)
|
if (!m_current_tab)
|
||||||
|
@ -627,9 +634,8 @@ void BrowserWindow::select_all()
|
||||||
|
|
||||||
void BrowserWindow::update_displayed_zoom_level()
|
void BrowserWindow::update_displayed_zoom_level()
|
||||||
{
|
{
|
||||||
VERIFY(m_zoom_menu && m_current_tab);
|
VERIFY(m_current_tab);
|
||||||
auto zoom_level_text = MUST(String::formatted("&Zoom ({}%)", round_to<int>(m_current_tab->view().zoom_level() * 100)));
|
update_zoom_menu();
|
||||||
m_zoom_menu->setTitle(qstring_from_ak_string(zoom_level_text));
|
|
||||||
m_current_tab->update_reset_zoom_button();
|
m_current_tab->update_reset_zoom_button();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ public slots:
|
||||||
void zoom_in();
|
void zoom_in();
|
||||||
void zoom_out();
|
void zoom_out();
|
||||||
void reset_zoom();
|
void reset_zoom();
|
||||||
|
void update_zoom_menu();
|
||||||
void select_all();
|
void select_all();
|
||||||
void copy_selected_text();
|
void copy_selected_text();
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
|
||||||
QObject::connect(m_reset_zoom_button, &QAbstractButton::clicked, [this] {
|
QObject::connect(m_reset_zoom_button, &QAbstractButton::clicked, [this] {
|
||||||
view().reset_zoom();
|
view().reset_zoom();
|
||||||
update_reset_zoom_button();
|
update_reset_zoom_button();
|
||||||
|
m_window->update_zoom_menu();
|
||||||
});
|
});
|
||||||
|
|
||||||
view().on_activate_tab = [this] {
|
view().on_activate_tab = [this] {
|
||||||
|
|
|
@ -760,12 +760,17 @@ void BrowserWindow::event(Core::Event& event)
|
||||||
Window::event(event);
|
Window::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWindow::update_displayed_zoom_level()
|
void BrowserWindow::update_zoom_menu()
|
||||||
{
|
{
|
||||||
VERIFY(m_zoom_menu);
|
VERIFY(m_zoom_menu);
|
||||||
auto zoom_level_text = String::formatted("&Zoom ({}%)", round_to<int>(active_tab().view().zoom_level() * 100)).release_value_but_fixme_should_propagate_errors();
|
auto zoom_level_text = String::formatted("&Zoom ({}%)", round_to<int>(active_tab().view().zoom_level() * 100)).release_value_but_fixme_should_propagate_errors();
|
||||||
m_zoom_menu->set_name(zoom_level_text);
|
m_zoom_menu->set_name(zoom_level_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserWindow::update_displayed_zoom_level()
|
||||||
|
{
|
||||||
active_tab().update_reset_zoom_button();
|
active_tab().update_reset_zoom_button();
|
||||||
|
update_zoom_menu();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
void content_filters_changed();
|
void content_filters_changed();
|
||||||
void autoplay_allowlist_changed();
|
void autoplay_allowlist_changed();
|
||||||
void proxy_mappings_changed();
|
void proxy_mappings_changed();
|
||||||
|
void update_zoom_menu();
|
||||||
|
|
||||||
void broadcast_window_position(Gfx::IntPoint);
|
void broadcast_window_position(Gfx::IntPoint);
|
||||||
void broadcast_window_size(Gfx::IntSize);
|
void broadcast_window_size(Gfx::IntSize);
|
||||||
|
|
|
@ -207,6 +207,7 @@ Tab::Tab(BrowserWindow& window, WebView::UseJavaScriptBytecode use_javascript_by
|
||||||
m_reset_zoom_button->on_click = [&](auto) {
|
m_reset_zoom_button->on_click = [&](auto) {
|
||||||
view().reset_zoom();
|
view().reset_zoom();
|
||||||
update_reset_zoom_button();
|
update_reset_zoom_button();
|
||||||
|
window.update_zoom_menu();
|
||||||
};
|
};
|
||||||
m_reset_zoom_button->set_button_style(Gfx::ButtonStyle::Coolbar);
|
m_reset_zoom_button->set_button_style(Gfx::ButtonStyle::Coolbar);
|
||||||
m_reset_zoom_button->set_visible(false);
|
m_reset_zoom_button->set_visible(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue