Skip to content

Commit

Permalink
SystemMonitor: Unbreak the in-table progress bars showing disk usage
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Mar 2, 2020
1 parent e7f8c8a commit 2719d6d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Applications/SystemMonitor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,15 @@ NonnullRefPtr<GUI::Widget> build_file_systems_tab()
},
[](const JsonObject& object) {
return object.get("total_block_count").to_u32() * object.get("block_size").to_u32();
},
[](const JsonObject& object) {
auto total_blocks = object.get("total_block_count").to_u32();
if (total_blocks == 0)
return 0;
auto free_blocks = object.get("free_block_count").to_u32();
auto used_blocks = total_blocks - free_blocks;
int percentage = (int)((float)used_blocks / (float)total_blocks * 100.0f);
return percentage;
});
df_fields.empend(
"Used", Gfx::TextAlignment::CenterRight,
Expand All @@ -306,15 +315,6 @@ NonnullRefPtr<GUI::Widget> build_file_systems_tab()
auto free_blocks = object.get("free_block_count").to_u32();
auto used_blocks = total_blocks - free_blocks;
return used_blocks * object.get("block_size").to_u32();
},
[](const JsonObject& object) {
auto total_blocks = object.get("total_block_count").to_u32();
if (total_blocks == 0)
return 0;
auto free_blocks = object.get("free_block_count").to_u32();
auto used_blocks = total_blocks - free_blocks;
int percentage = (int)((float)used_blocks / (float)total_blocks * 100.0f);
return percentage;
});
df_fields.empend(
"Available", Gfx::TextAlignment::CenterRight,
Expand Down

0 comments on commit 2719d6d

Please sign in to comment.