mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 21:15:14 +00:00
DisplayProperties: Highlight current resolution at startup
This commit is contained in:
parent
86c6fec890
commit
1c9742a4a5
Notes:
sideshowbarker
2024-07-19 10:48:44 +09:00
Author: https://github.com/asliturk Commit: https://github.com/SerenityOS/serenity/commit/1c9742a4a58
1 changed files with 9 additions and 2 deletions
|
@ -24,10 +24,10 @@
|
|||
DisplayPropertiesWidget::DisplayPropertiesWidget()
|
||||
: m_wm_config(CConfigFile::get_for_app("WindowManager"))
|
||||
{
|
||||
create_root_widget();
|
||||
create_frame();
|
||||
create_resolution_list();
|
||||
create_wallpaper_list();
|
||||
create_root_widget();
|
||||
create_frame();
|
||||
}
|
||||
|
||||
void DisplayPropertiesWidget::create_resolution_list()
|
||||
|
@ -126,6 +126,13 @@ void DisplayPropertiesWidget::create_frame()
|
|||
auto resolution_list = GListView::construct(settings_content);
|
||||
resolution_list->set_background_color(Color::White);
|
||||
resolution_list->set_model(*ItemListModel<Size>::create(m_resolutions));
|
||||
|
||||
auto resolution_model = resolution_list->model();
|
||||
auto find_first_index = m_resolutions.find_first_index(m_selected_resolution);
|
||||
auto resolution_index_in_model = resolution_model->index(find_first_index, resolution_list->model_column());
|
||||
if (resolution_model->is_valid(resolution_index_in_model))
|
||||
resolution_list->selection().set(resolution_index_in_model);
|
||||
|
||||
resolution_list->horizontal_scrollbar().set_visible(false);
|
||||
resolution_list->on_selection = [this](auto& index) {
|
||||
m_selected_resolution = m_resolutions.at(index.row());
|
||||
|
|
Loading…
Add table
Reference in a new issue