kernel-explorer: devirtualize lv2_fs_object and print more information (#10487)

* Make lv2_fs_object an "abstract" structure with protected constructor.
* Improve kernel-explorer information for filesystem objects.
This commit is contained in:
Eladash 2021-06-24 16:47:14 +03:00 committed by GitHub
parent 3c614d95b8
commit 50be3bd2e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 23 deletions

View file

@ -813,7 +813,22 @@ void kernel_explorer::Update()
idm::select<lv2_fs_object>([&](u32 id, lv2_fs_object& fo)
{
add_leaf(find_node(root, additional_nodes::file_descriptors), qstr(fmt::format("FD %u: %s", id, fo.to_string())));
const std::string str = fmt::format("FD %u: %s", id, [&]() -> std::string
{
if (idm::check_unlocked<lv2_fs_object, lv2_file>(id))
{
return fmt::format("%s", static_cast<lv2_file&>(fo));
}
if (idm::check_unlocked<lv2_fs_object, lv2_dir>(id))
{
return fmt::format("%s", static_cast<lv2_dir&>(fo));
}
return "Unknown object!";
}());
add_leaf(find_node(root, additional_nodes::file_descriptors), qstr(str));
});
std::function<int(QTreeWidgetItem*)> final_touches;