mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
ClipboardHistory: Show the size (in bytes) of each remembered clipping
This commit is contained in:
parent
b8d73e259c
commit
0b051a5e15
2 changed files with 7 additions and 0 deletions
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ClipboardHistoryModel.h"
|
#include "ClipboardHistoryModel.h"
|
||||||
|
#include <AK/NumberFormat.h>
|
||||||
|
|
||||||
NonnullRefPtr<ClipboardHistoryModel> ClipboardHistoryModel::create()
|
NonnullRefPtr<ClipboardHistoryModel> ClipboardHistoryModel::create()
|
||||||
{
|
{
|
||||||
|
@ -42,6 +43,8 @@ String ClipboardHistoryModel::column_name(int column) const
|
||||||
return "Data";
|
return "Data";
|
||||||
case Column::Type:
|
case Column::Type:
|
||||||
return "Type";
|
return "Type";
|
||||||
|
case Column::Size:
|
||||||
|
return "Size";
|
||||||
default:
|
default:
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
@ -59,6 +62,8 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
||||||
return "<...>";
|
return "<...>";
|
||||||
case Column::Type:
|
case Column::Type:
|
||||||
return data_and_type.mime_type;
|
return data_and_type.mime_type;
|
||||||
|
case Column::Size:
|
||||||
|
return AK::human_readable_size(data_and_type.data.size());
|
||||||
default:
|
default:
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
enum Column {
|
enum Column {
|
||||||
Data,
|
Data,
|
||||||
Type,
|
Type,
|
||||||
|
Size,
|
||||||
__Count
|
__Count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,3 +56,4 @@ private:
|
||||||
Vector<GUI::Clipboard::DataAndType> m_history_items;
|
Vector<GUI::Clipboard::DataAndType> m_history_items;
|
||||||
size_t m_history_limit { 20 };
|
size_t m_history_limit { 20 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue