On 13 December 2013 20:18, Stefan Weil <s...@weilnetz.de> wrote:
> PS. Does anybody know how to add the QEMU mascot as a Cocoa application
> icon for all QEMU applications?

I have some code which programmatically sets the icon for QEMU
from a file when it runs:

+    const char *iconfile = "qemu-icon.bmp";
+    const char *icondir = os_find_datadir(gArgv[0]);
+    if (!icondir) {
+        icondir = CONFIG_QEMU_DATADIR;
+    }
+    NSString *iconstring = [NSString stringWithFormat:@"%s/%s",
icondir, iconfile];
+    NSImage *icon = [[NSImage alloc] initWithContentsOfFile:iconstring];
+    if (icon) {
+        [NSApp setApplicationIconImage:icon];
+    }

(goes in ui/cocoa.m just before we set up the menus).
However the qemu-icon.bmp looks awful in the MacOS
dock: it has a white background, not transparent, and the resolution
is probably wrong too.

I suspect the best approach is going to be to create and ship a
TIFF file with the relevant set of icons for various resolutions in it,
as per the documentation on 'tiffutil' in this page:
https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html#//apple_ref/doc/uid/TP40012302-CH7-SW13

but that's beyond my artistic and/or image mangling abilities
I think. If somebody else feels like doing that I can clean
up the code patch for posting, but there's not much point
otherwise.

(I don't think it's possible to make the QEMU executable
have an icon in the Finder, unless we turn it from a plain
command line executable into an "app bundle". And if
we did that you wouldn't be able to run it easily from the
terminal with command line arguments, which in practice
you absolutely have to be able to do for it to be at all useful.)

thanks
-- PMM

Reply via email to