mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibGUI+Applications: Add --open-tab option to FooSettings applications
Similar to SystemMonitor's option of the same name, this allows you to launch the given application with the specific tab open.
This commit is contained in:
parent
ded5ba1f87
commit
5702f016f0
9 changed files with 67 additions and 0 deletions
|
@ -76,4 +76,18 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(String title, Show
|
|||
return window;
|
||||
}
|
||||
|
||||
Optional<NonnullRefPtr<SettingsWindow::Tab>> SettingsWindow::get_tab(StringView id) const
|
||||
{
|
||||
auto tab = m_tabs.find(id);
|
||||
if (tab == m_tabs.end())
|
||||
return {};
|
||||
return tab->value;
|
||||
}
|
||||
|
||||
void SettingsWindow::set_active_tab(StringView id)
|
||||
{
|
||||
if (auto tab = get_tab(id); tab.has_value())
|
||||
m_tab_widget->set_active_widget(tab.value());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue