gui: Added special hotkey config rules for comma and semicolon
This commit is contained in:
parent
618d28d392
commit
a48f183ee1
|
@ -55,6 +55,8 @@ static const struct
|
|||
{ Qt::Key_Help, "Help" },
|
||||
{ Qt::Key_Enter, "KP_Enter" },
|
||||
{ Qt::Key_Clear, "Clear" },
|
||||
{ Qt::Key_Comma, "Comma" },
|
||||
{ Qt::Key_Semicolon, "Semicolon" },
|
||||
|
||||
{ Qt::Key_Back, "WWWBack" },
|
||||
{ Qt::Key_Forward, "WWWForward" },
|
||||
|
@ -211,23 +213,22 @@ QString KeySequence::keyToString(int key)
|
|||
// treat key pad like normal keys (FIXME: we should have another lookup table for keypad keys instead)
|
||||
key &= ~Qt::KeypadModifier;
|
||||
|
||||
// a special key?
|
||||
int i = 0;
|
||||
while (keyname[i].name) {
|
||||
if (key == keyname[i].key)
|
||||
return QString::fromUtf8(keyname[i].name);
|
||||
i++;
|
||||
}
|
||||
|
||||
// a printable 7 bit character?
|
||||
if (key < 0x80 && key != Qt::Key_Space)
|
||||
if (key < 0x80)
|
||||
return QChar(key & 0x7f).toLower();
|
||||
|
||||
// a function key?
|
||||
if (key >= Qt::Key_F1 && key <= Qt::Key_F35)
|
||||
return QString::fromUtf8("F%1").arg(key - Qt::Key_F1 + 1);
|
||||
|
||||
// a special key?
|
||||
int i=0;
|
||||
while (keyname[i].name)
|
||||
{
|
||||
if (key == keyname[i].key)
|
||||
return QString::fromUtf8(keyname[i].name);
|
||||
i++;
|
||||
}
|
||||
|
||||
// representable in ucs2?
|
||||
if (key < 0x10000)
|
||||
return QString("\\u%1").arg(QChar(key).toLower().unicode(), 4, 16, QChar('0'));
|
||||
|
|
|
@ -300,7 +300,7 @@ TEST(HotkeyToTexStreamTests, KeysCommaSingleAction)
|
|||
}
|
||||
};
|
||||
ASSERT_EQ(hotkeyToStringViaTextStream(createHotkey(hotkey)),
|
||||
"\tkeystroke(a+,+b) = keyDown(z,*)\n");
|
||||
"\tkeystroke(a+Comma+b) = keyDown(z,*)\n");
|
||||
}
|
||||
|
||||
TEST(HotkeyToTexStreamTests, KeysMultipleAction)
|
||||
|
|
|
@ -133,9 +133,9 @@ TEST(KeySequenceTests, ToString)
|
|||
ASSERT_EQ(keySequenceToString({{Qt::Key_A, 0}, {Qt::Key_B, 0}}),
|
||||
"a+b");
|
||||
ASSERT_EQ(keySequenceToString({{Qt::Key_A, 0}, {Qt::Key_Comma, 0}, {Qt::Key_B, 0}}),
|
||||
"a+,+b");
|
||||
"a+Comma+b");
|
||||
ASSERT_EQ(keySequenceToString({{Qt::Key_A, 0}, {Qt::Key_Semicolon, 0}, {Qt::Key_B, 0}}),
|
||||
"a+;+b");
|
||||
"a+Semicolon+b");
|
||||
ASSERT_EQ(keySequenceToString({{Qt::Key_A, 0}, {Qt::Key_Shift, Qt::ShiftModifier},
|
||||
{Qt::Key_0, Qt::ShiftModifier}}),
|
||||
"a+Shift+0");
|
||||
|
|
Loading…
Reference in New Issue