/** * @brief Slot called when a quest file of has been renamed. * * The corresponding tab is closed if any. * * @param old_path Old path of the file. * @param new_path New path after renaming. */ void EditorTabs::file_renamed(const QString& old_path, const QString& new_path) { Q_UNUSED(new_path); if (get_editor() == nullptr) { return; } Quest& quest = get_editor()->get_quest(); ResourceType resource_type; QString language_id; QString path = old_path; if (quest.is_potential_resource_element(path, resource_type, language_id) && resource_type == ResourceType::LANGUAGE) { int index = find_editor(quest.get_strings_path(language_id)); if (index != -1) { remove_editor(index); } path = quest.get_dialogs_path(language_id); } int index = find_editor(path); if (index != -1) { remove_editor(index); } }
/** * @brief Slot called when a quest file of has been deleted. * * The corresponding tab is closed if any. * * @param path Path of the deleted file. */ void EditorTabs::file_deleted(const QString& path) { int index = find_editor(path); if (index != -1) { remove_editor(index); } }
/** * @brief Slot called when the user attempts to close a tab. * @param index Index of the tab to close. */ void EditorTabs::close_file_requested(int index) { Editor* editor = get_editor(index); if (editor != nullptr && editor->confirm_close()) { remove_editor(index); } }
void EditorManager::react_edition_session_end( const core::EditionSession& edition_session ) { remove_editor( edition_session ); }
void EditorManager::remove_editor( const core::EditionSession& edition_session ) { remove_editor( edition_session.id() ); }