diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2018-10-31 20:04:05 +0200 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2018-12-30 00:23:47 +0000 |
commit | 4d4bc37df983a8c8bb7a2d926521836e4ce8c913 (patch) | |
tree | 7b52f1eda77b3d4961a80a2980ff02ea5fc47d4d /src/qt | |
parent | d2ed162ce0c83782d6a66cfdbe1c6aedcb485697 (diff) |
Remove obj_c for macOS Dock icon setting
Qt `setWindowIcon()` does this work.
Github-Pull: #14597
Rebased-From: 53bb6be3f8a50ee9e5c4d7e9155236152e7c4b7c
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 ac7532e1fa..4a9cb58d1d 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -89,12 +89,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) |