From 3c014a868c830ab5781123efa16516d55a20fa90 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 18 Apr 2019 13:06:50 +0200 Subject: [PATCH] [keyboard] Make keyboard preview more robust - Replace #define with static const char - Handle FreeBSD as well (for testing purposes) --- src/modules/keyboard/keyboardwidget/keyboardglobal.cpp | 10 ++++++++-- src/modules/keyboard/keyboardwidget/keyboardglobal.h | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/keyboard/keyboardwidget/keyboardglobal.cpp b/src/modules/keyboard/keyboardwidget/keyboardglobal.cpp index 8b6cac4be..98fca85fe 100644 --- a/src/modules/keyboard/keyboardwidget/keyboardglobal.cpp +++ b/src/modules/keyboard/keyboardwidget/keyboardglobal.cpp @@ -24,18 +24,24 @@ #include "utils/Logger.h" +#ifdef Q_OS_FREEBSD +static const char XKB_FILE[] = "/usr/local/share/X11/xkb/rules/base.lst"; +#else +static const char XKB_FILE[] = "/usr/share/X11/xkb/rules/base.lst"; +#endif + //### //### Public methods //### QMap KeyboardGlobal::getKeyboardLayouts() { - return parseKeyboardLayouts(XKB_FILE); + return parseKeyboardLayouts( XKB_FILE ); } QMap KeyboardGlobal::getKeyboardModels() { - return parseKeyboardModels(XKB_FILE); + return parseKeyboardModels( XKB_FILE ); } diff --git a/src/modules/keyboard/keyboardwidget/keyboardglobal.h b/src/modules/keyboard/keyboardwidget/keyboardglobal.h index 01730ced4..a438ed53c 100644 --- a/src/modules/keyboard/keyboardwidget/keyboardglobal.h +++ b/src/modules/keyboard/keyboardwidget/keyboardglobal.h @@ -35,8 +35,6 @@ #include #include -#define XKB_FILE "/usr/share/X11/xkb/rules/base.lst" - class KeyboardGlobal { public: