Proper UTF-8 labels
Commit amended by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
parent
f6812a5c88
commit
1c7bfdaeb4
1 changed files with 117 additions and 118 deletions
|
|
@ -26,122 +26,122 @@ DeviceView::DeviceView(QWidget *parent) :
|
|||
size = width();
|
||||
}
|
||||
|
||||
typedef struct
|
||||
struct led_label
|
||||
{
|
||||
std::string led_name;
|
||||
std::string led_label;
|
||||
} led_label_lookup_type;
|
||||
QString label_text;
|
||||
QString label_utf8;
|
||||
};
|
||||
|
||||
static const led_label_lookup_type led_label_lookup[] =
|
||||
static const std::map<std::string, led_label> led_label_lookup =
|
||||
{
|
||||
{ "Key: A", "A" },
|
||||
{ "Key: B", "B" },
|
||||
{ "Key: C", "C" },
|
||||
{ "Key: D", "D" },
|
||||
{ "Key: E", "E" },
|
||||
{ "Key: F", "F" },
|
||||
{ "Key: G", "G" },
|
||||
{ "Key: H", "H" },
|
||||
{ "Key: I", "I" },
|
||||
{ "Key: J", "J" },
|
||||
{ "Key: K", "K" },
|
||||
{ "Key: L", "L" },
|
||||
{ "Key: M", "M" },
|
||||
{ "Key: N", "N" },
|
||||
{ "Key: O", "O" },
|
||||
{ "Key: P", "P" },
|
||||
{ "Key: Q", "Q" },
|
||||
{ "Key: R", "R" },
|
||||
{ "Key: S", "S" },
|
||||
{ "Key: T", "T" },
|
||||
{ "Key: U", "U" },
|
||||
{ "Key: V", "V" },
|
||||
{ "Key: W", "W" },
|
||||
{ "Key: X", "X" },
|
||||
{ "Key: Y", "Y" },
|
||||
{ "Key: Z", "Z" },
|
||||
{ "Key: 0", "0" },
|
||||
{ "Key: 1", "1" },
|
||||
{ "Key: 2", "2" },
|
||||
{ "Key: 3", "3" },
|
||||
{ "Key: 4", "4" },
|
||||
{ "Key: 5", "5" },
|
||||
{ "Key: 6", "6" },
|
||||
{ "Key: 7", "7" },
|
||||
{ "Key: 8", "8" },
|
||||
{ "Key: 9", "9" },
|
||||
{ "Key: F1", "F1" },
|
||||
{ "Key: F2", "F2" },
|
||||
{ "Key: F3", "F3" },
|
||||
{ "Key: F4", "F4" },
|
||||
{ "Key: F5", "F5" },
|
||||
{ "Key: F6", "F6" },
|
||||
{ "Key: F7", "F7" },
|
||||
{ "Key: F8", "F8" },
|
||||
{ "Key: F9", "F9" },
|
||||
{ "Key: F10", "F10" },
|
||||
{ "Key: F11", "F11" },
|
||||
{ "Key: F12", "F12" },
|
||||
{ "Key: `", "`" },
|
||||
{ "Key: -", "-" },
|
||||
{ "Key: =", "=" },
|
||||
{ "Key: [", "[" },
|
||||
{ "Key: ]", "]" },
|
||||
{ "Key: \\ (ANSI)", "\\" },
|
||||
{ "Key: \\ (ISO)", "\\" },
|
||||
{ "Key: ;", ";" },
|
||||
{ "Key: '", "'" },
|
||||
{ "Key: ,", "," },
|
||||
{ "Key: .", "." },
|
||||
{ "Key: /", "/" },
|
||||
{ "Key: Escape", "Esc" },
|
||||
{ "Key: Print Screen", "Prt" },
|
||||
{ "Key: Scroll Lock", "Scr" },
|
||||
{ "Key: Pause/Break", "Brk" },
|
||||
{ "Key: Backspace", "Bks" },
|
||||
{ "Key: Insert", "Ins" },
|
||||
{ "Key: Home", "Hom" },
|
||||
{ "Key: Page Up", "PUp" },
|
||||
{ "Key: Tab", "Tab" },
|
||||
{ "Key: Delete", "Del" },
|
||||
{ "Key: End", "End" },
|
||||
{ "Key: Page Down", "PDn" },
|
||||
{ "Key: Caps Lock", "Cap" },
|
||||
{ "Key: Enter", "Ent" },
|
||||
{ "Key: Enter (ISO)", "Ent" },
|
||||
{ "Key: Left Shift", "Sft" },
|
||||
{ "Key: Right Shift", "Sft" },
|
||||
{ "Key: Up Arrow", "Up" },
|
||||
{ "Key: Left Control", "Ctl" },
|
||||
{ "Key: Left Windows", "Win" },
|
||||
{ "Key: Left Fn", "Fn" },
|
||||
{ "Key: Left Alt", "Alt" },
|
||||
{ "Key: Space", "Spc" },
|
||||
{ "Key: Right Alt", "Alt" },
|
||||
{ "Key: Right Fn", "Fn" },
|
||||
{ "Key: Right Windows", "Win" },
|
||||
{ "Key: Menu", "Mnu" },
|
||||
{ "Key: Right Control", "Ctl" },
|
||||
{ "Key: Left Arrow", "Lft" },
|
||||
{ "Key: Down Arrow", "Dn" },
|
||||
{ "Key: Right Arrow", "Rgt" },
|
||||
{ "Key: Num Lock", "Num" },
|
||||
{ "Key: Number Pad /", "/" },
|
||||
{ "Key: Number Pad *", "*" },
|
||||
{ "Key: Number Pad -", "-" },
|
||||
{ "Key: Number Pad +", "+" },
|
||||
{ "Key: Number Pad .", "." },
|
||||
{ "Key: Number Pad Enter", "Ent" },
|
||||
{ "Key: Number Pad 0", "0" },
|
||||
{ "Key: Number Pad 1", "1" },
|
||||
{ "Key: Number Pad 2", "2" },
|
||||
{ "Key: Number Pad 3", "3" },
|
||||
{ "Key: Number Pad 4", "4" },
|
||||
{ "Key: Number Pad 5", "5" },
|
||||
{ "Key: Number Pad 6", "6" },
|
||||
{ "Key: Number Pad 7", "7" },
|
||||
{ "Key: Number Pad 8", "8" },
|
||||
{ "Key: Number Pad 9", "9" },
|
||||
{ "Key: A", { "A" , "A", }},
|
||||
{ "Key: B", { "B" , "B", }},
|
||||
{ "Key: C", { "C" , "C", }},
|
||||
{ "Key: D", { "D" , "D", }},
|
||||
{ "Key: E", { "E" , "E", }},
|
||||
{ "Key: F", { "F" , "F", }},
|
||||
{ "Key: G", { "G" , "G", }},
|
||||
{ "Key: H", { "H" , "H", }},
|
||||
{ "Key: I", { "I" , "I", }},
|
||||
{ "Key: J", { "J" , "J", }},
|
||||
{ "Key: K", { "K" , "K", }},
|
||||
{ "Key: L", { "L" , "L", }},
|
||||
{ "Key: M", { "M" , "M", }},
|
||||
{ "Key: N", { "N" , "N", }},
|
||||
{ "Key: O", { "O" , "O", }},
|
||||
{ "Key: P", { "P" , "P", }},
|
||||
{ "Key: Q", { "Q" , "Q", }},
|
||||
{ "Key: R", { "R" , "R", }},
|
||||
{ "Key: S", { "S" , "S", }},
|
||||
{ "Key: T", { "T" , "T", }},
|
||||
{ "Key: U", { "U" , "U", }},
|
||||
{ "Key: V", { "V" , "V", }},
|
||||
{ "Key: W", { "W" , "W", }},
|
||||
{ "Key: X", { "X" , "X", }},
|
||||
{ "Key: Y", { "Y" , "Y", }},
|
||||
{ "Key: Z", { "Z" , "Z", }},
|
||||
{ "Key: 0", { "0" , "0", }},
|
||||
{ "Key: 1", { "1" , "1", }},
|
||||
{ "Key: 2", { "2" , "2", }},
|
||||
{ "Key: 3", { "3" , "3", }},
|
||||
{ "Key: 4", { "4" , "4", }},
|
||||
{ "Key: 5", { "5" , "5", }},
|
||||
{ "Key: 6", { "6" , "6", }},
|
||||
{ "Key: 7", { "7" , "7", }},
|
||||
{ "Key: 8", { "8" , "8", }},
|
||||
{ "Key: 9", { "9" , "9", }},
|
||||
{ "Key: F1", { "F1" , "F1", }},
|
||||
{ "Key: F2", { "F2" , "F2", }},
|
||||
{ "Key: F3", { "F3" , "F3", }},
|
||||
{ "Key: F4", { "F4" , "F4", }},
|
||||
{ "Key: F5", { "F5" , "F5", }},
|
||||
{ "Key: F6", { "F6" , "F6", }},
|
||||
{ "Key: F7", { "F7" , "F7", }},
|
||||
{ "Key: F8", { "F8" , "F8", }},
|
||||
{ "Key: F9", { "F9" , "F9", }},
|
||||
{ "Key: F10", { "F10" , "F10", }},
|
||||
{ "Key: F11", { "F11" , "F11", }},
|
||||
{ "Key: F12", { "F12" , "F12", }},
|
||||
{ "Key: `", { "`" , "`", }},
|
||||
{ "Key: -", { "-" , "-", }},
|
||||
{ "Key: =", { "=" , "=", }},
|
||||
{ "Key: [", { "[" , "[", }},
|
||||
{ "Key: ]", { "]" , "]", }},
|
||||
{ "Key: \\ (ANSI)", { "\\" , "\\", }},
|
||||
{ "Key: \\ (ISO)", { "\\" , "\\", }},
|
||||
{ "Key: ;", { ";" , ";", }},
|
||||
{ "Key: '", { "'" , "'", }},
|
||||
{ "Key: ,", { "," , ",", }},
|
||||
{ "Key: .", { "." , ".", }},
|
||||
{ "Key: /", { "/" , "/", }},
|
||||
{ "Key: Escape", { "Esc" , "Esc", }},
|
||||
{ "Key: Print Screen", { "Prt" , "Prt", }},
|
||||
{ "Key: Scroll Lock", { "Scr" , "Scr", }},
|
||||
{ "Key: Pause/Break", { "Brk" , "Brk", }},
|
||||
{ "Key: Backspace", { "Bks" , "\xE2\x8C\xAB" }}, // ⌫
|
||||
{ "Key: Insert", { "Ins" , "Ins", }},
|
||||
{ "Key: Home", { "Hom" , "Hom", }},
|
||||
{ "Key: Page Up", { "PUp" , "PUp", }},
|
||||
{ "Key: Tab", { "Tab" , "\xE2\x86\xb9" }}, // ⭾ ↹ ⇄ ⇥
|
||||
{ "Key: Delete", { "Del" , "Del", }},
|
||||
{ "Key: End", { "End" , "End", }},
|
||||
{ "Key: Page Down", { "PDn" , "PDn", }},
|
||||
{ "Key: Caps Lock", { "Cap" , "Cap", }},
|
||||
{ "Key: Enter", { "Ent" , "\xE2\x86\xB5" }}, // ↵ ⏎
|
||||
{ "Key: Enter (ISO)", { "Ent" , "\xE2\x86\xB5" }}, // ↵ ⏎
|
||||
{ "Key: Left Shift", { "Sft" , "\xE2\x87\xA7" }}, // ⇧
|
||||
{ "Key: Right Shift", { "Sft" , "\xE2\x87\xA7" }}, // ⇧
|
||||
{ "Key: Up Arrow", { "Up" , "\xF0\x9F\xA1\xB9" }}, // ↑ 🡹
|
||||
{ "Key: Left Control", { "Ctl" , "Ctl", }},
|
||||
{ "Key: Left Windows", { "Win" , "\xe2\x9d\x96" }}, // ❖
|
||||
{ "Key: Left Fn", { "Fn" , "Fn", }},
|
||||
{ "Key: Left Alt", { "Alt" , "Alt", }},
|
||||
{ "Key: Space", { "Spc" , "Spc", }},
|
||||
{ "Key: Right Alt", { "Alt" , "Alt", }},
|
||||
{ "Key: Right Fn", { "Fn" , "Fn", }},
|
||||
{ "Key: Right Windows", { "Win" , "\xe2\x9d\x96" }}, // ❖
|
||||
{ "Key: Menu", { "Mnu" , "\xE2\x98\xB0" }}, // ▤ ☰ 𝌆 🗏
|
||||
{ "Key: Right Control", { "Ctl" , "Ctl", }},
|
||||
{ "Key: Left Arrow", { "Lft" , "\xF0\x9F\xA1\xB8" }}, // ↑ 🡹
|
||||
{ "Key: Down Arrow", { "Dn" , "\xF0\x9F\xA1\xBB" }}, // ↑ 🡹
|
||||
{ "Key: Right Arrow", { "Rgt" , "\xF0\x9F\xA1\xBA" }}, // ↑ 🡹
|
||||
{ "Key: Num Lock", { "Num" , "Num", }},
|
||||
{ "Key: Number Pad /", { "/" , "/", }},
|
||||
{ "Key: Number Pad *", { "*" , "*", }},
|
||||
{ "Key: Number Pad -", { "-" , "-", }},
|
||||
{ "Key: Number Pad +", { "+" , "+", }},
|
||||
{ "Key: Number Pad .", { "." , ".", }},
|
||||
{ "Key: Number Pad Enter", { "Ent" , "\xE2\x86\xB5" }}, // ↵ ⏎
|
||||
{ "Key: Number Pad 0", { "0" , "0", }},
|
||||
{ "Key: Number Pad 1", { "1" , "1", }},
|
||||
{ "Key: Number Pad 2", { "2" , "2", }},
|
||||
{ "Key: Number Pad 3", { "3" , "3", }},
|
||||
{ "Key: Number Pad 4", { "4" , "4", }},
|
||||
{ "Key: Number Pad 5", { "5" , "5", }},
|
||||
{ "Key: Number Pad 6", { "6" , "6", }},
|
||||
{ "Key: Number Pad 7", { "7" , "7", }},
|
||||
{ "Key: Number Pad 8", { "8" , "8", }},
|
||||
{ "Key: Number Pad 9", { "9" , "9", }},
|
||||
};
|
||||
|
||||
void DeviceView::setController(RGBController * controller_ptr)
|
||||
|
|
@ -254,12 +254,11 @@ void DeviceView::setController(RGBController * controller_ptr)
|
|||
\*-----------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < controller->leds.size(); led_idx++)
|
||||
{
|
||||
for(std::size_t led_label_lookup_idx = 0; led_label_lookup_idx < (sizeof(led_label_lookup) / sizeof(led_label_lookup_type)); led_label_lookup_idx++)
|
||||
std::map<std::string, led_label>::const_iterator it = led_label_lookup.find(controller->leds[led_idx].name);
|
||||
|
||||
if(it != led_label_lookup.end())
|
||||
{
|
||||
if(controller->leds[led_idx].name == led_label_lookup[led_label_lookup_idx].led_name)
|
||||
{
|
||||
led_labels[led_idx] = QString::fromStdString(led_label_lookup[led_label_lookup_idx].led_label);
|
||||
}
|
||||
led_labels[led_idx] = it->second.label_utf8;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue