diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2018-10-31 20:04:05 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2018-10-31 20:29:08 +0200 |
commit | 53bb6be3f8a50ee9e5c4d7e9155236152e7c4b7c (patch) | |
tree | 2a83aac8f756be10530d156f6603fe2d2323a93a /src/qt | |
parent | f1e2f2a85962c1664e4e55471061af0eaa798d40 (diff) |
Remove obj_c for macOS Dock icon setting
Qt `setWindowIcon()` does this work.
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoingui.cpp | 4 | ||||
-rw-r--r-- | src/qt/macdockiconhandler.h | 2 | ||||
-rw-r--r-- | src/qt/macdockiconhandler.mm | 35 |
3 files changed, 0 insertions, 41 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 311841017f..5d34b8c7b0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -92,12 +92,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty windowTitle += tr("Node"); } windowTitle += " " + networkStyle->getTitleAddText(); -#ifndef Q_OS_MAC QApplication::setWindowIcon(networkStyle->getTrayAndWindowIcon()); setWindowIcon(networkStyle->getTrayAndWindowIcon()); -#else - MacDockIconHandler::instance()->setIcon(networkStyle->getAppIcon()); -#endif setWindowTitle(windowTitle); rpcConsole = new RPCConsole(node, _platformStyle, 0); diff --git a/src/qt/macdockiconhandler.h b/src/qt/macdockiconhandler.h index 1c28593d4a..34095ce073 100644 --- a/src/qt/macdockiconhandler.h +++ b/src/qt/macdockiconhandler.h @@ -9,7 +9,6 @@ #include <QObject> QT_BEGIN_NAMESPACE -class QIcon; class QMenu; class QWidget; QT_END_NAMESPACE @@ -24,7 +23,6 @@ public: ~MacDockIconHandler(); QMenu *dockMenu(); - void setIcon(const QIcon &icon); void setMainWindow(QMainWindow *window); static MacDockIconHandler *instance(); static void cleanup(); 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(¬ificationBuffer, "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) |