mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
ClipboardHistory: Show bitmap width/height/bpp for bitmap clippings
This commit is contained in:
parent
0b051a5e15
commit
2e446b662b
1 changed files with 13 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "ClipboardHistoryModel.h"
|
#include "ClipboardHistoryModel.h"
|
||||||
#include <AK/NumberFormat.h>
|
#include <AK/NumberFormat.h>
|
||||||
|
#include <AK/StringBuilder.h>
|
||||||
|
|
||||||
NonnullRefPtr<ClipboardHistoryModel> ClipboardHistoryModel::create()
|
NonnullRefPtr<ClipboardHistoryModel> ClipboardHistoryModel::create()
|
||||||
{
|
{
|
||||||
|
@ -59,6 +60,18 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
||||||
case Column::Data:
|
case Column::Data:
|
||||||
if (data_and_type.mime_type.starts_with("text/"))
|
if (data_and_type.mime_type.starts_with("text/"))
|
||||||
return String::copy(data_and_type.data);
|
return String::copy(data_and_type.data);
|
||||||
|
if (data_and_type.mime_type == "image/x-serenityos") {
|
||||||
|
StringBuilder builder;
|
||||||
|
builder.append("[");
|
||||||
|
builder.append(data_and_type.metadata.get("width").value_or("?"));
|
||||||
|
builder.append('x');
|
||||||
|
builder.append(data_and_type.metadata.get("height").value_or("?"));
|
||||||
|
builder.append('x');
|
||||||
|
builder.append(data_and_type.metadata.get("bpp").value_or("?"));
|
||||||
|
builder.append(" bitmap");
|
||||||
|
builder.append("]");
|
||||||
|
return builder.to_string();
|
||||||
|
}
|
||||||
return "<...>";
|
return "<...>";
|
||||||
case Column::Type:
|
case Column::Type:
|
||||||
return data_and_type.mime_type;
|
return data_and_type.mime_type;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue