aboutsummaryrefslogtreecommitdiff
path: root/src/qt/macdockiconhandler.mm
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2018-10-31 20:04:05 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2018-10-31 20:29:08 +0200
commit53bb6be3f8a50ee9e5c4d7e9155236152e7c4b7c (patch)
tree2a83aac8f756be10530d156f6603fe2d2323a93a /src/qt/macdockiconhandler.mm
parentf1e2f2a85962c1664e4e55471061af0eaa798d40 (diff)
Remove obj_c for macOS Dock icon setting
Qt `setWindowIcon()` does this work.
Diffstat (limited to 'src/qt/macdockiconhandler.mm')
-rw-r--r--src/qt/macdockiconhandler.mm35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/qt/macdockiconhandler.mm b/src/qt/macdockiconhandler.mm
index b9ad191da7..7c174be617 100644
--- a/src/qt/macdockiconhandler.mm
+++ b/src/qt/macdockiconhandler.mm
@@ -4,9 +4,7 @@
#include "macdockiconhandler.h"
-#include <QImageWriter>
#include <QMenu>
-#include <QBuffer>
#include <QWidget>
#undef slots
@@ -71,39 +69,6 @@ QMenu *MacDockIconHandler::dockMenu()
return this->m_dockMenu;
}
-void MacDockIconHandler::setIcon(const QIcon &icon)
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSImage *image = nil;
- if (icon.isNull())
- image = [[NSImage imageNamed:@"NSApplicationIcon"] retain];
- else {
- // generate NSImage from QIcon and use this as dock icon.
- QSize size = icon.actualSize(QSize(128, 128));
- QPixmap pixmap = icon.pixmap(size);
-
- // Write image into a R/W buffer from raw pixmap, then save the image.
- QBuffer notificationBuffer;
- if (!pixmap.isNull() && notificationBuffer.open(QIODevice::ReadWrite)) {
- QImageWriter writer(&notificationBuffer, "PNG");
- if (writer.write(pixmap.toImage())) {
- NSData* macImgData = [NSData dataWithBytes:notificationBuffer.buffer().data()
- length:notificationBuffer.buffer().size()];
- image = [[NSImage alloc] initWithData:macImgData];
- }
- }
-
- if(!image) {
- // if testnet image could not be created, load std. app icon
- image = [[NSImage imageNamed:@"NSApplicationIcon"] retain];
- }
- }
-
- [NSApp setApplicationIconImage:image];
- [image release];
- [pool release];
-}
-
MacDockIconHandler *MacDockIconHandler::instance()
{
if (!s_instance)