ui: Set window title to 'XQEMU (Revision: <id>)'

This commit is contained in:
Lucas Eriksson 2018-06-27 20:16:49 +02:00 committed by Matt
parent dd3fa1004e
commit 50c0e6a45d
2 changed files with 12 additions and 5 deletions

View File

@ -442,7 +442,7 @@ qemu-version.h: FORCE
pkgvers="$(PKGVERSION)"; \
else \
if test -d .git; then \
pkgvers=$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\
pkgvers=$$(git rev-parse --short HEAD 2>/dev/null | tr -d '\n');\
if ! git diff-index --quiet HEAD &>/dev/null; then \
pkgvers="$${pkgvers}-dirty"; \
fi; \

View File

@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu-version.h"
#include "ui/console.h"
#include "ui/input.h"
#include "ui/sdl2.h"
@ -135,6 +136,8 @@ static void sdl_update_caption(struct sdl2_console *scon)
char win_title[1024];
char icon_title[1024];
const char *status = "";
const char *project_name = "XQEMU";
const char *hash_indicator = "Revision";
if (!runstate_is_running()) {
status = " [Stopped]";
@ -149,12 +152,16 @@ static void sdl_update_caption(struct sdl2_console *scon)
}
if (qemu_name) {
snprintf(win_title, sizeof(win_title), "QEMU (%s-%d)%s", qemu_name,
snprintf(win_title, sizeof(win_title), "%s (%s: %s) (%s-%d)%s",
project_name, hash_indicator, QEMU_PKGVERSION, qemu_name,
scon->idx, status);
snprintf(icon_title, sizeof(icon_title), "QEMU (%s)", qemu_name);
snprintf(icon_title, sizeof(icon_title), "%s (%s: %s) (%s)",
project_name, hash_indicator, QEMU_PKGVERSION, qemu_name);
} else {
snprintf(win_title, sizeof(win_title), "QEMU%s", status);
snprintf(icon_title, sizeof(icon_title), "QEMU");
snprintf(win_title, sizeof(win_title), "%s (%s: %s)%s",
project_name, hash_indicator, QEMU_PKGVERSION, status);
snprintf(icon_title, sizeof(icon_title), "%s (%s: %s)",
project_name, hash_indicator, QEMU_PKGVERSION);
}
if (scon->real_window) {