mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
DisplaySettings: Migrate to Core::Directory::for_each_entry()
This commit is contained in:
parent
fb445fc523
commit
28a4adba3d
Notes:
sideshowbarker
2024-07-17 01:12:07 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/28a4adba3d Pull-request: https://github.com/SerenityOS/serenity/pull/17894 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/supercomputer7
|
@ -6,10 +6,9 @@
|
|||
*/
|
||||
|
||||
#include "ThemesSettingsWidget.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <Applications/DisplaySettings/ThemesSettingsGML.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Directory.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/CheckBox.h>
|
||||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
|
@ -73,11 +72,11 @@ ErrorOr<void> ThemesSettingsWidget::setup_interface()
|
|||
auto mouse_settings_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-mouse.png"sv));
|
||||
|
||||
m_color_scheme_names.clear();
|
||||
Core::DirIterator iterator("/res/color-schemes", Core::DirIterator::SkipParentAndBaseDir);
|
||||
while (iterator.has_next()) {
|
||||
auto path = iterator.next_path();
|
||||
TRY(m_color_scheme_names.try_append(TRY(String::from_deprecated_string(path.replace(".ini"sv, ""sv, ReplaceMode::FirstOnly)))));
|
||||
}
|
||||
TRY(Core::Directory::for_each_entry("/res/color-schemes"sv, Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto&) -> ErrorOr<IterationDecision> {
|
||||
LexicalPath path { entry.name };
|
||||
TRY(m_color_scheme_names.try_append(TRY(String::from_utf8(path.title()))));
|
||||
return IterationDecision::Continue;
|
||||
}));
|
||||
quick_sort(m_color_scheme_names);
|
||||
auto& color_scheme_combo = *find_descendant_of_type_named<GUI::ComboBox>("color_scheme_combo");
|
||||
color_scheme_combo.set_only_allow_values_from_model(true);
|
||||
|
|
Loading…
Reference in a new issue