diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-04-21 15:12:09 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-04-21 17:24:42 +0200 |
commit | ded5ba1f8764e95e2c2b51e3e09200059a26c6c6 (patch) | |
tree | bffe0a79cefa010d8dcbcaee219db111fd18891f /Userland/Libraries/LibGUI/SettingsWindow.cpp | |
parent | 4d2e18fb07eba8130fccf1d0e7c8b62e76deae88 (diff) | |
download | serenity-ded5ba1f8764e95e2c2b51e3e09200059a26c6c6.zip |
LibGUI+Applications: Give SettingsWindow tabs a string ID
This gives us a convenient way to refer to them, which will be used in
the following commit.
Diffstat (limited to 'Userland/Libraries/LibGUI/SettingsWindow.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/SettingsWindow.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibGUI/SettingsWindow.cpp b/Userland/Libraries/LibGUI/SettingsWindow.cpp index 84d24bab39..2a416872a4 100644 --- a/Userland/Libraries/LibGUI/SettingsWindow.cpp +++ b/Userland/Libraries/LibGUI/SettingsWindow.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2020, Idan Horowitz <idan.horowitz@serenityos.org> * Copyright (c) 2021-2022, the SerenityOS developers. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org> - * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> + * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -41,9 +41,9 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(String title, Show window->m_reset_button = TRY(button_container->try_add<GUI::Button>("Defaults")); window->m_reset_button->set_fixed_width(75); window->m_reset_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) mutable { - for (auto& tab : window->m_tabs) { - tab.reset_default_values(); - tab.apply_settings(); + for (auto& [id, tab] : window->m_tabs) { + tab->reset_default_values(); + tab->apply_settings(); } }; } @@ -53,24 +53,24 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(String title, Show window->m_ok_button = TRY(button_container->try_add<GUI::Button>("OK")); window->m_ok_button->set_fixed_width(75); window->m_ok_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) mutable { - for (auto& tab : window->m_tabs) - tab.apply_settings(); + for (auto& [id, tab] : window->m_tabs) + tab->apply_settings(); GUI::Application::the()->quit(); }; window->m_cancel_button = TRY(button_container->try_add<GUI::Button>("Cancel")); window->m_cancel_button->set_fixed_width(75); window->m_cancel_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) mutable { - for (auto& tab : window->m_tabs) - tab.cancel_settings(); + for (auto& [id, tab] : window->m_tabs) + tab->cancel_settings(); GUI::Application::the()->quit(); }; window->m_apply_button = TRY(button_container->try_add<GUI::Button>("Apply")); window->m_apply_button->set_fixed_width(75); window->m_apply_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) mutable { - for (auto& tab : window->m_tabs) - tab.apply_settings(); + for (auto& [id, tab] : window->m_tabs) + tab->apply_settings(); }; return window; |