more/better humanreadable sizes
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Failing after 15m52s
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Failing after 6m51s
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Failing after 6m45s
ContinuousIntegration / linux (push) Successful in 4m30s
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Failing after 6m20s
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Failing after 6m16s
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Failing after 15m52s
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Failing after 6m51s
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Failing after 6m45s
ContinuousIntegration / linux (push) Successful in 4m30s
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Failing after 6m20s
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Failing after 6m16s
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
This commit is contained in:
parent
7e92e9808e
commit
4b9fd6db81
@ -70,7 +70,7 @@ static constexpr float lerp(float a, float b, float t) {
|
|||||||
// returns divider and places static suffix string into suffix_out
|
// returns divider and places static suffix string into suffix_out
|
||||||
static int64_t sizeToHumanReadable(int64_t file_size, const char*& suffix_out) {
|
static int64_t sizeToHumanReadable(int64_t file_size, const char*& suffix_out) {
|
||||||
static const char* suffix_arr[] {
|
static const char* suffix_arr[] {
|
||||||
"bytes",
|
"Bytes",
|
||||||
"KiB",
|
"KiB",
|
||||||
"MiB",
|
"MiB",
|
||||||
"GiB",
|
"GiB",
|
||||||
@ -1226,14 +1226,19 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) {
|
|||||||
ImGui::SeparatorText("single info");
|
ImGui::SeparatorText("single info");
|
||||||
const auto& si = o.get<ObjComp::F::SingleInfo>();
|
const auto& si = o.get<ObjComp::F::SingleInfo>();
|
||||||
ImGui::Text("file name: '%s'", si.file_name.c_str());
|
ImGui::Text("file name: '%s'", si.file_name.c_str());
|
||||||
ImGui::Text("file size: %lu Bytes", si.file_size);
|
|
||||||
|
const char* byte_suffix = "???";
|
||||||
|
int64_t byte_divider = sizeToHumanReadable(si.file_size, byte_suffix);
|
||||||
|
ImGui::Text("file size: %.2lf %s (%lu Bytes)", double(si.file_size)/byte_divider, byte_suffix, si.file_size);
|
||||||
if (o.all_of<ObjComp::F::SingleInfoLocal>()) {
|
if (o.all_of<ObjComp::F::SingleInfoLocal>()) {
|
||||||
ImGui::Text("local path: '%s'", o.get<ObjComp::F::SingleInfoLocal>().file_path.c_str());
|
ImGui::Text("local path: '%s'", o.get<ObjComp::F::SingleInfoLocal>().file_path.c_str());
|
||||||
}
|
}
|
||||||
} else if (o.all_of<ObjComp::F::CollectionInfo>()) {
|
} else if (o.all_of<ObjComp::F::CollectionInfo>()) {
|
||||||
ImGui::SeparatorText("collection info");
|
ImGui::SeparatorText("collection info");
|
||||||
const auto& ci = o.get<ObjComp::F::CollectionInfo>();
|
const auto& ci = o.get<ObjComp::F::CollectionInfo>();
|
||||||
ImGui::Text("total size: %lu Bytes", ci.total_size);
|
const char* byte_suffix = "???";
|
||||||
|
int64_t byte_divider = sizeToHumanReadable(ci.total_size, byte_suffix);
|
||||||
|
ImGui::Text("total size: %.2lf %s (%lu Bytes)", double(ci.total_size)/byte_divider, byte_suffix, ci.total_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fts != nullptr) {
|
if (fts != nullptr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user