mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
ClipboardHistory: Show the size (in bytes) of each remembered clipping
This commit is contained in:
parent
b8d73e259c
commit
0b051a5e15
Notes:
sideshowbarker
2024-07-19 02:54:21 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0b051a5e150
2 changed files with 7 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue