mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
HackStudio: Update the tree view cursor on editor change and 'Save as'
The more important thing here is to update the tree view on 'Save As..', as we want to drop every connection from an old file. Updating the tree view on current editor change is just a cool small bonus. :^)
This commit is contained in:
parent
b92a6d6542
commit
a230524c46
2 changed files with 14 additions and 0 deletions
|
@ -690,6 +690,9 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
|
|||
m_open_files_vector.append(relative_file_path);
|
||||
|
||||
update_window_title();
|
||||
|
||||
m_project->model().invalidate();
|
||||
update_tree_view();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -887,6 +890,7 @@ void HackStudioWidget::set_current_editor_wrapper(RefPtr<EditorWrapper> editor_w
|
|||
{
|
||||
m_current_editor_wrapper = editor_wrapper;
|
||||
update_window_title();
|
||||
update_tree_view();
|
||||
}
|
||||
|
||||
void HackStudioWidget::configure_project_tree_view()
|
||||
|
@ -1257,6 +1261,15 @@ void HackStudioWidget::update_gml_preview()
|
|||
m_gml_preview_widget->load_gml(gml_content);
|
||||
}
|
||||
|
||||
void HackStudioWidget::update_tree_view()
|
||||
{
|
||||
auto index = m_project->model().index(m_current_editor_wrapper->filename(), GUI::FileSystemModel::Column::Name);
|
||||
if (index.is_valid()) {
|
||||
m_project_tree_view->expand_all_parents_of(index);
|
||||
m_project_tree_view->set_cursor(index, GUI::AbstractView::SelectionUpdate::Set);
|
||||
}
|
||||
}
|
||||
|
||||
void HackStudioWidget::update_window_title()
|
||||
{
|
||||
window()->set_title(String::formatted("{} - {} - Hack Studio", m_current_editor_wrapper->filename_label().text(), m_project->name()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue