summaryrefslogtreecommitdiff
path: root/MenuApplets
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-05 17:05:22 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-05 17:05:22 +0200
commit2e446b662be96ea98a98ac139ffdd64afa76e547 (patch)
tree97c97b253f49acbddffbe328597f030a4fb05bc5 /MenuApplets
parent0b051a5e150838a8c9b498749666736da7a8f521 (diff)
downloadserenity-2e446b662be96ea98a98ac139ffdd64afa76e547.zip
ClipboardHistory: Show bitmap width/height/bpp for bitmap clippings
Diffstat (limited to 'MenuApplets')
-rw-r--r--MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp b/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp
index bb3a84f22f..ce4e0eb3b1 100644
--- a/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp
+++ b/MenuApplets/ClipboardHistory/ClipboardHistoryModel.cpp
@@ -26,6 +26,7 @@
#include "ClipboardHistoryModel.h"
#include <AK/NumberFormat.h>
+#include <AK/StringBuilder.h>
NonnullRefPtr<ClipboardHistoryModel> ClipboardHistoryModel::create()
{
@@ -59,6 +60,18 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
case Column::Data:
if (data_and_type.mime_type.starts_with("text/"))
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 "<...>";
case Column::Type:
return data_and_type.mime_type;