Parses the contents of a Keyboard Translator (.keytab) file and returns the entries found in it. More...
#include "KeyboardTranslator.h"
Classes | |
struct | Token |
Public Member Functions | |
KeyboardTranslatorReader (QIODevice *source) | |
Constructs a new reader which parses the given source . More... | |
QString | description () const |
Returns the description text. More... | |
bool | hasNextEntry () |
Returns true if there is another entry in the source stream. More... | |
KeyboardTranslator::Entry | nextEntry () |
Returns the next entry found in the source stream. More... | |
bool | parseError () |
Returns true if an error occurred whilst parsing the input or false if no error occurred. More... | |
Static Public Member Functions | |
static KeyboardTranslator::Entry | createEntry (const QString &condition, const QString &result) |
Parses a condition and result string for a translator entry and produces a keyboard translator entry. More... | |
Private Member Functions | |
bool | decodeSequence (const QString &, int &keyCode, Qt::KeyboardModifiers &modifiers, Qt::KeyboardModifiers &modifierMask, KeyboardTranslator::States &state, KeyboardTranslator::States &stateFlags) |
void | readNext () |
QList< Token > | tokenize (const QString &) |
Static Private Member Functions | |
static bool | parseAsCommand (const QString &text, KeyboardTranslator::Command &command) |
static bool | parseAsKeyCode (const QString &item, int &keyCode) |
static bool | parseAsModifier (const QString &item, Qt::KeyboardModifier &modifier) |
static bool | parseAsStateFlag (const QString &item, KeyboardTranslator::State &state) |
Private Attributes | |
QString | _description |
bool | _hasNext |
KeyboardTranslator::Entry | _nextEntry |
QIODevice * | _source |
Parses the contents of a Keyboard Translator (.keytab) file and returns the entries found in it.
Usage example:
Definition at line 424 of file KeyboardTranslator.h.
KeyboardTranslatorReader::KeyboardTranslatorReader | ( | QIODevice * | source | ) |
Constructs a new reader which parses the given source
.
Definition at line 236 of file KeyboardTranslator.cpp.
References _description, readNext(), KeyboardTranslatorReader::Token::TitleKeyword, and tokenize().
|
static |
Parses a condition and result string for a translator entry and produces a keyboard translator entry.
The condition and result strings are in the same format as in
Definition at line 467 of file KeyboardTranslator.cpp.
References hasNextEntry(), nextEntry(), and parseAsCommand().
|
private |
Definition at line 330 of file KeyboardTranslator.cpp.
References KeyboardTranslator::NoState, parseAsKeyCode(), parseAsModifier(), and parseAsStateFlag().
Referenced by readNext().
QString KeyboardTranslatorReader::description | ( | ) | const |
Returns the description text.
TODO: More documentation
Definition at line 459 of file KeyboardTranslator.cpp.
References _description.
Referenced by KeyboardTranslatorManager::loadTranslator().
bool KeyboardTranslatorReader::hasNextEntry | ( | ) |
Returns true if there is another entry in the source stream.
Definition at line 463 of file KeyboardTranslator.cpp.
References _hasNext.
Referenced by createEntry(), and KeyboardTranslatorManager::loadTranslator().
KeyboardTranslator::Entry KeyboardTranslatorReader::nextEntry | ( | ) |
Returns the next entry found in the source stream.
Definition at line 497 of file KeyboardTranslator.cpp.
References _hasNext, _nextEntry, and readNext().
Referenced by createEntry(), and KeyboardTranslatorManager::loadTranslator().
|
staticprivate |
Definition at line 310 of file KeyboardTranslator.cpp.
References KeyboardTranslator::EraseCommand, KeyboardTranslator::ScrollLineDownCommand, KeyboardTranslator::ScrollLineUpCommand, KeyboardTranslator::ScrollLockCommand, KeyboardTranslator::ScrollPageDownCommand, and KeyboardTranslator::ScrollPageUpCommand.
Referenced by createEntry(), and readNext().
|
staticprivate |
Definition at line 436 of file KeyboardTranslator.cpp.
Referenced by decodeSequence().
|
staticprivate |
Definition at line 402 of file KeyboardTranslator.cpp.
Referenced by decodeSequence().
|
staticprivate |
Definition at line 419 of file KeyboardTranslator.cpp.
References KeyboardTranslator::AlternateScreenState, KeyboardTranslator::AnsiState, KeyboardTranslator::AnyModifierState, KeyboardTranslator::CursorKeysState, and KeyboardTranslator::NewLineState.
Referenced by decodeSequence().
bool KeyboardTranslatorReader::parseError | ( | ) |
Returns true if an error occurred whilst parsing the input or false if no error occurred.
Definition at line 508 of file KeyboardTranslator.cpp.
Referenced by KeyboardTranslatorManager::loadTranslator().
|
private |
Definition at line 253 of file KeyboardTranslator.cpp.
References _hasNext, _nextEntry, _source, KeyboardTranslatorReader::Token::Command, decodeSequence(), KeyboardTranslatorReader::Token::KeyKeyword, KeyboardTranslator::NoCommand, KeyboardTranslator::NoState, KeyboardTranslatorReader::Token::OutputText, parseAsCommand(), KeyboardTranslator::Entry::setCommand(), KeyboardTranslator::Entry::setKeyCode(), KeyboardTranslator::Entry::setModifierMask(), KeyboardTranslator::Entry::setModifiers(), KeyboardTranslator::Entry::setState(), KeyboardTranslator::Entry::setStateMask(), KeyboardTranslator::Entry::setText(), and tokenize().
Referenced by KeyboardTranslatorReader(), and nextEntry().
|
private |
Definition at line 512 of file KeyboardTranslator.cpp.
References KeyboardTranslatorReader::Token::Command, KeyboardTranslatorReader::Token::KeyKeyword, KeyboardTranslatorReader::Token::KeySequence, KeyboardTranslatorReader::Token::OutputText, KeyboardTranslatorReader::Token::TitleKeyword, and KeyboardTranslatorReader::Token::TitleText.
Referenced by KeyboardTranslatorReader(), and readNext().
|
private |
Definition at line 485 of file KeyboardTranslator.h.
Referenced by KeyboardTranslatorReader(), and description().
|
private |
Definition at line 487 of file KeyboardTranslator.h.
Referenced by hasNextEntry(), nextEntry(), and readNext().
|
private |
Definition at line 486 of file KeyboardTranslator.h.
Referenced by nextEntry(), and readNext().
|
private |
Definition at line 484 of file KeyboardTranslator.h.
Referenced by readNext().