ClipboardHistory: Show the size (in bytes) of each remembered clipping

This commit is contained in:
Andreas Kling 2020-09-05 17:02:25 +02:00
parent b8d73e259c
commit 0b051a5e15
Notes: sideshowbarker 2024-07-19 02:54:21 +09:00
2 changed files with 7 additions and 0 deletions

View file

@ -25,6 +25,7 @@
*/
#include "ClipboardHistoryModel.h"
#include <AK/NumberFormat.h>
NonnullRefPtr<ClipboardHistoryModel> ClipboardHistoryModel::create()
{
@ -42,6 +43,8 @@ String ClipboardHistoryModel::column_name(int column) const
return "Data";
case Column::Type:
return "Type";
case Column::Size:
return "Size";
default:
ASSERT_NOT_REACHED();
}
@ -59,6 +62,8 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
return "<...>";
case Column::Type:
return data_and_type.mime_type;
case Column::Size:
return AK::human_readable_size(data_and_type.data.size());
default:
ASSERT_NOT_REACHED();
}

View file

@ -37,6 +37,7 @@ public:
enum Column {
Data,
Type,
Size,
__Count
};
@ -55,3 +56,4 @@ private:
Vector<GUI::Clipboard::DataAndType> m_history_items;
size_t m_history_limit { 20 };
};