mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:07:36 +00:00
Use new format functions in remaining DevTools. (#3755)
* AK: Add formatter for JsonValue. * Inspector: Use new format functions. * Profiler: Use new format functions. * UserspaceEmulator: Use new format functions.
This commit is contained in:
parent
626bb1be9c
commit
d94f674bbb
11 changed files with 45 additions and 37 deletions
|
@ -110,9 +110,9 @@ GUI::Variant RemoteObjectGraphModel::data(const GUI::ModelIndex& index, GUI::Mod
|
|||
return m_layout_icon;
|
||||
return m_object_icon;
|
||||
}
|
||||
if (role == GUI::ModelRole::Display) {
|
||||
return String::format("%s{%p}", remote_object->class_name.characters(), remote_object->address);
|
||||
}
|
||||
if (role == GUI::ModelRole::Display)
|
||||
return String::formatted("{}({:p})", remote_object->class_name, remote_object->address);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -77,9 +77,9 @@ GUI::Variant RemoteObjectPropertyModel::data(const GUI::ModelIndex& index, GUI::
|
|||
case Column::Value: {
|
||||
auto data = path->resolve(m_object.json);
|
||||
if (data.is_array())
|
||||
return String::format("<Array with %d element%s", data.as_array().size(), data.as_array().size() == 1 ? ">" : "s>");
|
||||
return String::formatted("<Array with {} element{}", data.as_array().size(), data.as_array().size() == 1 ? ">" : "s>");
|
||||
if (data.is_object())
|
||||
return String::format("<Object with %d entr%s", data.as_object().size(), data.as_object().size() == 1 ? "y>" : "ies>");
|
||||
return String::formatted("<Object with {} entr{}", data.as_object().size(), data.as_object().size() == 1 ? "y>" : "ies>");
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ GUI::ModelIndex RemoteObjectPropertyModel::parent_index(const GUI::ModelIndex& i
|
|||
return create_index(index_in_parent, 0, cpath);
|
||||
}
|
||||
|
||||
dbg() << "No cached path found for path " << path.to_string();
|
||||
dbgln("No cached path found for path {}", path.to_string());
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ void RemoteProcess::update()
|
|||
|
||||
m_socket->on_ready_to_read = [this] {
|
||||
if (m_socket->eof()) {
|
||||
dbg() << "Disconnected from PID " << m_pid;
|
||||
dbgln("Disconnected from PID {}", m_pid);
|
||||
m_socket->close();
|
||||
return;
|
||||
}
|
||||
|
@ -166,13 +166,13 @@ void RemoteProcess::update()
|
|||
}
|
||||
|
||||
ASSERT(data.size() == length);
|
||||
dbg() << "Got data size " << length << " and read that many bytes";
|
||||
dbgln("Got data size {} and read that many bytes", length);
|
||||
|
||||
auto json_value = JsonValue::from_string(data);
|
||||
ASSERT(json_value.has_value());
|
||||
ASSERT(json_value.value().is_object());
|
||||
|
||||
dbg() << "Got JSON response " << json_value.value().to_string();
|
||||
dbgln("Got JSON response {}", json_value.value());
|
||||
|
||||
auto& response = json_value.value().as_object();
|
||||
|
||||
|
@ -193,7 +193,7 @@ void RemoteProcess::update()
|
|||
|
||||
auto success = m_socket->connect(Core::SocketAddress::local(String::format("/tmp/rpc/%d", m_pid)));
|
||||
if (!success) {
|
||||
fprintf(stderr, "Couldn't connect to PID %d\n", m_pid);
|
||||
warnln("Couldn't connect to PID {}", m_pid);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ using namespace Inspector;
|
|||
|
||||
[[noreturn]] static void print_usage_and_exit()
|
||||
{
|
||||
printf("usage: Inspector <pid>\n");
|
||||
outln("usage: Inspector <pid>");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ int main(int argc, char** argv)
|
|||
|
||||
remote_process.on_update = [&] {
|
||||
if (!remote_process.process_name().is_null())
|
||||
window->set_title(String::format("%s (%d) - Inspector", remote_process.process_name().characters(), remote_process.pid()));
|
||||
window->set_title(String::formatted("{} ({}) - Inspector", remote_process.process_name(), remote_process.pid()));
|
||||
};
|
||||
|
||||
auto& tree_view = splitter.add<GUI::TreeView>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue