mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-15 02:40:38 +00:00
SoundPlayer: Use AK::human_readable_size() for file sizes
This commit is contained in:
parent
ca3e0288e9
commit
32e5593ca9
Notes:
sideshowbarker
2024-07-17 07:19:27 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/32e5593ca9 Pull-request: https://github.com/SerenityOS/serenity/pull/20103 Reviewed-by: https://github.com/caoimhebyrne ✅
2 changed files with 1 additions and 15 deletions
|
@ -46,7 +46,7 @@ GUI::Variant PlaylistModel::data(const GUI::ModelIndex& index, GUI::ModelRole ro
|
|||
case 4:
|
||||
return m_playlist_items[index.row()].extended_info->album_artist.value_or("");
|
||||
case 5:
|
||||
return format_filesize(m_playlist_items[index.row()].extended_info->file_size_in_bytes.value_or(0));
|
||||
return human_readable_size(m_playlist_items[index.row()].extended_info->file_size_in_bytes.value_or(0));
|
||||
}
|
||||
}
|
||||
if (role == GUI::ModelRole::Sort)
|
||||
|
@ -57,18 +57,6 @@ GUI::Variant PlaylistModel::data(const GUI::ModelIndex& index, GUI::ModelRole ro
|
|||
return {};
|
||||
}
|
||||
|
||||
DeprecatedString PlaylistModel::format_filesize(u64 size_in_bytes)
|
||||
{
|
||||
if (size_in_bytes > GiB)
|
||||
return DeprecatedString::formatted("{:.2f} GiB", (double)size_in_bytes / GiB);
|
||||
else if (size_in_bytes > MiB)
|
||||
return DeprecatedString::formatted("{:.2f} MiB", (double)size_in_bytes / MiB);
|
||||
else if (size_in_bytes > KiB)
|
||||
return DeprecatedString::formatted("{:.2f} KiB", (double)size_in_bytes / KiB);
|
||||
else
|
||||
return DeprecatedString::formatted("{} B", size_in_bytes);
|
||||
}
|
||||
|
||||
ErrorOr<String> PlaylistModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
|
|
|
@ -29,8 +29,6 @@ public:
|
|||
|
||||
private:
|
||||
Vector<M3UEntry> m_playlist_items;
|
||||
|
||||
static DeprecatedString format_filesize(u64 size_in_bytes);
|
||||
};
|
||||
|
||||
class PlaylistTableView : public GUI::TableView {
|
||||
|
|
Loading…
Reference in a new issue