mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 16:21:29 +00:00
Ladybird/Qt: Display a tool tip on the tab mute button
This commit is contained in:
parent
45b03bf75d
commit
0da5d5a0d0
Notes:
sideshowbarker
2024-07-17 09:49:33 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/0da5d5a0d0 Pull-request: https://github.com/SerenityOS/serenity/pull/23773
|
@ -657,6 +657,7 @@ void BrowserWindow::tab_audio_play_state_changed(int index, Web::HTML::AudioPlay
|
|||
|
||||
case Web::HTML::AudioPlayState::Playing:
|
||||
auto* button = new QPushButton(icon_for_page_mute_state(), {});
|
||||
button->setToolTip(tool_tip_for_page_mute_state());
|
||||
button->setFlat(true);
|
||||
button->resize({ 20, 20 });
|
||||
|
||||
|
@ -670,6 +671,7 @@ void BrowserWindow::tab_audio_play_state_changed(int index, Web::HTML::AudioPlay
|
|||
case Web::HTML::AudioPlayState::Playing:
|
||||
auto* button = m_tabs_container->tabBar()->tabButton(index, QTabBar::LeftSide);
|
||||
verify_cast<QPushButton>(button)->setIcon(icon_for_page_mute_state());
|
||||
button->setToolTip(tool_tip_for_page_mute_state());
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -691,6 +693,18 @@ QIcon BrowserWindow::icon_for_page_mute_state() const
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
QString BrowserWindow::tool_tip_for_page_mute_state() const
|
||||
{
|
||||
switch (view().page_mute_state()) {
|
||||
case Web::HTML::MuteState::Muted:
|
||||
return "Unmute tab";
|
||||
case Web::HTML::MuteState::Unmuted:
|
||||
return "Mute tab";
|
||||
}
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void BrowserWindow::open_next_tab()
|
||||
{
|
||||
if (m_tabs_container->count() <= 1)
|
||||
|
|
|
@ -129,6 +129,7 @@ private:
|
|||
}
|
||||
|
||||
QIcon icon_for_page_mute_state() const;
|
||||
QString tool_tip_for_page_mute_state() const;
|
||||
|
||||
QScreen* m_current_screen;
|
||||
double m_device_pixel_ratio { 0 };
|
||||
|
|
Loading…
Reference in a new issue