@@ -2218,6 +2218,7 @@ LINKS="$LINKS tests/avocado tests/data"
LINKS="$LINKS tests/qemu-iotests/check"
LINKS="$LINKS python"
LINKS="$LINKS contrib/plugins/Makefile "
+LINKS="$LINKS ui/icons "
for f in $LINKS ; do
if [ -e "$source_path/$f" ]; then
mkdir -p `dirname ./$f`
@@ -180,9 +180,9 @@
"navigation_with_keys": True,
}
-html_logo = os.path.join(qemu_docdir, "../ui/icons/qemu_128x128.png")
+html_logo = os.path.join(qemu_docdir, "../ui/icons/128x128/apps/qemu.png")
-html_favicon = os.path.join(qemu_docdir, "../ui/icons/qemu_32x32.png")
+html_favicon = os.path.join(qemu_docdir, "../ui/icons/32x32/apps/qemu.png")
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@@ -3,6 +3,8 @@
#define QEMU_FILE_TYPE_BIOS 0
#define QEMU_FILE_TYPE_KEYMAP 1
+#define QEMU_FILE_TYPE_ICON 2
+
/**
* qemu_find_file:
* @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS)
@@ -35,6 +35,7 @@ static char **extra_firmware_dirs;
/* Default built-in directories */
static char *default_data_dir;
+static char *default_icon_dir;
/* Whether we're known to be executing from a build tree */
static bool in_build_dir;
@@ -66,6 +67,12 @@ char *qemu_find_file(int type, const char *name)
default_install_dir = default_data_dir;
break;
+ case QEMU_FILE_TYPE_ICON:
+ rel_install_dir = "hicolor";
+ rel_build_dir = "ui/icons";
+ default_install_dir = default_icon_dir;
+ break;
+
default:
abort();
}
@@ -132,8 +139,11 @@ void qemu_add_default_firmwarepath(void)
/* Add default dirs relative to the executable path */
default_data_dir = get_relocated_path(CONFIG_QEMU_DATADIR);
+ default_icon_dir = get_relocated_path(CONFIG_QEMU_ICONDIR);
- trace_datadir_init(default_data_dir, in_build_dir);
+ trace_datadir_init(default_data_dir,
+ default_icon_dir,
+ in_build_dir);
}
void qemu_list_data_dirs(void)
@@ -6,7 +6,7 @@ balloon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
# datadir.c
datadir_load_file(const char *name, const char *path, int err) "name %s location %s errno %d"
-datadir_init(const char *defdatadir, bool inbuilddir) "default data dir %s in build dir %d"
+datadir_init(const char *defdatadir, const char *deficondir, bool inbuilddir) "default data dir %s icon dir %s in build dir %d"
# ioport.c
cpu_in(unsigned int addr, char size, unsigned int val) "addr 0x%x(%c) value %u"
@@ -45,6 +45,7 @@
#include "qemu/cutils.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"
+#include "qemu/datadir.h"
#include <Carbon/Carbon.h>
#include "hw/core/cpu.h"
@@ -1558,7 +1559,7 @@ - (BOOL)verifyQuit
- (IBAction) do_about_menu_item: (id) sender
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- char *icon_path_c = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/512x512/apps/qemu.png");
+ char *icon_path_c = qemu_find_file(QEMU_FILE_TYPE_ICON, "512x512/apps/qemu.png");
NSString *icon_path = [NSString stringWithUTF8String:icon_path_c];
g_free(icon_path_c);
NSImage *icon = [[NSImage alloc] initWithContentsOfFile:icon_path];
@@ -31,6 +31,7 @@
#define LOCALEDIR "po"
#include "qemu/osdep.h"
+#include "qemu/datadir.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-control.h"
#include "qapi/qapi-commands-machine.h"
@@ -2314,7 +2315,7 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
s->opts = opts;
theme = gtk_icon_theme_get_default();
- dir = get_relocated_path(CONFIG_QEMU_ICONDIR);
+ dir = qemu_find_file(QEMU_FILE_TYPE_ICON, NULL);
gtk_icon_theme_prepend_search_path(theme, dir);
g_free(dir);
g_set_prgname("qemu");
similarity index 100%
rename from ui/icons/qemu_128x128.png
rename to ui/icons/128x128/apps/qemu.png
similarity index 100%
rename from ui/icons/qemu_16x16.png
rename to ui/icons/16x16/apps/qemu.png
similarity index 100%
rename from ui/icons/qemu_24x24.png
rename to ui/icons/24x24/apps/qemu.png
similarity index 100%
rename from ui/icons/qemu_256x256.png
rename to ui/icons/256x256/apps/qemu.png
similarity index 100%
rename from ui/icons/qemu_32x32.bmp
rename to ui/icons/32x32/apps/qemu.bmp
similarity index 100%
rename from ui/icons/qemu_32x32.png
rename to ui/icons/32x32/apps/qemu.png
similarity index 100%
rename from ui/icons/qemu_48x48.png
rename to ui/icons/48x48/apps/qemu.png
similarity index 100%
rename from ui/icons/qemu_512x512.png
rename to ui/icons/512x512/apps/qemu.png
similarity index 100%
rename from ui/icons/qemu_64x64.png
rename to ui/icons/64x64/apps/qemu.png
@@ -1,13 +1,24 @@
-foreach s: [16, 24, 32, 48, 64, 128, 256, 512]
- s = '@0@x@0@'.format(s.to_string())
- install_data('qemu_@0@.png'.format(s),
- rename: 'qemu.png',
- install_dir: qemu_icondir / 'hicolor' / s / 'apps')
+
+png_icon_sizes = [
+ '16x16',
+ '24x24',
+ '32x32',
+ '48x48',
+ '64x64',
+ '128x128',
+ '256x256',
+ '512x512',
+]
+
+foreach icon_size: png_icon_sizes
+ install_data(
+ join_paths(icon_size, 'apps', 'qemu.png'),
+ install_dir: join_paths(qemu_icondir, 'hicolor', icon_size, 'apps')
+ )
endforeach
-install_data('qemu_32x32.bmp',
- rename: 'qemu.bmp',
+install_data('32x32/apps/qemu.bmp',
install_dir: qemu_icondir / 'hicolor' / '32x32' / 'apps')
-install_data('qemu.svg',
+install_data('scalable/apps/qemu.svg',
install_dir: qemu_icondir / 'hicolor' / 'scalable' / 'apps')
similarity index 100%
rename from ui/icons/qemu.svg
rename to ui/icons/scalable/apps/qemu.svg
@@ -26,6 +26,7 @@
#include "qemu/osdep.h"
#include "qemu/module.h"
#include "qemu/cutils.h"
+#include "qemu/datadir.h"
#include "ui/console.h"
#include "ui/input.h"
#include "ui/sdl2.h"
@@ -910,11 +911,11 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
}
#ifdef CONFIG_SDL_IMAGE
- dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");
+ dir = qemu_find_file(QEMU_FILE_TYPE_ICON, "128x128/apps/qemu.png");
icon = IMG_Load(dir);
#else
/* Load a 32x32x4 image. White pixels are transparent. */
- dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");
+ dir = qemu_find_file(QEMU_FILE_TYPE_ICON, "32x32/apps/qemu.bmp");
icon = SDL_LoadBMP(dir);
if (icon) {
uint32_t colorkey = SDL_MapRGB(icon->format, 255, 255, 255);
The SDL/GTK/Cocoa UIs currently fail to load icons when run from the build directory as get_resource returns a bogus path. To address this we first re-arrange the ui/icons sub-directory so that its layout reflects the contents that will be installed. Then we introduce QEMU_FILE_TYPE_ICON to qemu_find_file such that it can locate icons from the build dir. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- configure | 1 + docs/conf.py | 4 +-- include/qemu/datadir.h | 2 ++ softmmu/datadir.c | 12 +++++++- softmmu/trace-events | 2 +- ui/cocoa.m | 3 +- ui/gtk.c | 3 +- .../apps/qemu.png} | Bin .../{qemu_16x16.png => 16x16/apps/qemu.png} | Bin .../{qemu_24x24.png => 24x24/apps/qemu.png} | Bin .../apps/qemu.png} | Bin .../{qemu_32x32.bmp => 32x32/apps/qemu.bmp} | Bin .../{qemu_32x32.png => 32x32/apps/qemu.png} | Bin .../{qemu_48x48.png => 48x48/apps/qemu.png} | Bin .../apps/qemu.png} | Bin .../{qemu_64x64.png => 64x64/apps/qemu.png} | Bin ui/icons/meson.build | 27 ++++++++++++------ ui/icons/{ => scalable/apps}/qemu.svg | 0 ui/sdl2.c | 5 ++-- 19 files changed, 43 insertions(+), 16 deletions(-) rename ui/icons/{qemu_128x128.png => 128x128/apps/qemu.png} (100%) rename ui/icons/{qemu_16x16.png => 16x16/apps/qemu.png} (100%) rename ui/icons/{qemu_24x24.png => 24x24/apps/qemu.png} (100%) rename ui/icons/{qemu_256x256.png => 256x256/apps/qemu.png} (100%) rename ui/icons/{qemu_32x32.bmp => 32x32/apps/qemu.bmp} (100%) rename ui/icons/{qemu_32x32.png => 32x32/apps/qemu.png} (100%) rename ui/icons/{qemu_48x48.png => 48x48/apps/qemu.png} (100%) rename ui/icons/{qemu_512x512.png => 512x512/apps/qemu.png} (100%) rename ui/icons/{qemu_64x64.png => 64x64/apps/qemu.png} (100%) rename ui/icons/{ => scalable/apps}/qemu.svg (100%)