mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:47:35 +00:00
DisplayProperties: Highlight current resolution at startup
This commit is contained in:
parent
86c6fec890
commit
1c9742a4a5
1 changed files with 9 additions and 2 deletions
|
@ -24,10 +24,10 @@
|
||||||
DisplayPropertiesWidget::DisplayPropertiesWidget()
|
DisplayPropertiesWidget::DisplayPropertiesWidget()
|
||||||
: m_wm_config(CConfigFile::get_for_app("WindowManager"))
|
: m_wm_config(CConfigFile::get_for_app("WindowManager"))
|
||||||
{
|
{
|
||||||
create_root_widget();
|
|
||||||
create_frame();
|
|
||||||
create_resolution_list();
|
create_resolution_list();
|
||||||
create_wallpaper_list();
|
create_wallpaper_list();
|
||||||
|
create_root_widget();
|
||||||
|
create_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayPropertiesWidget::create_resolution_list()
|
void DisplayPropertiesWidget::create_resolution_list()
|
||||||
|
@ -126,6 +126,13 @@ void DisplayPropertiesWidget::create_frame()
|
||||||
auto resolution_list = GListView::construct(settings_content);
|
auto resolution_list = GListView::construct(settings_content);
|
||||||
resolution_list->set_background_color(Color::White);
|
resolution_list->set_background_color(Color::White);
|
||||||
resolution_list->set_model(*ItemListModel<Size>::create(m_resolutions));
|
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->horizontal_scrollbar().set_visible(false);
|
||||||
resolution_list->on_selection = [this](auto& index) {
|
resolution_list->on_selection = [this](auto& index) {
|
||||||
m_selected_resolution = m_resolutions.at(index.row());
|
m_selected_resolution = m_resolutions.at(index.row());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue