MauiKit Terminal
KeyboardTranslator.cpp
175KeyboardTranslator *KeyboardTranslatorManager::loadTranslator(QIODevice *source, const QString &name)
216 *_writer << QLatin1String("key ") << entry.conditionToString() << QLatin1String(" : ") << result << QLatin1Char('\n');
298bool KeyboardTranslatorReader::parseAsCommand(const QString &text, KeyboardTranslator::Command &command)
389bool KeyboardTranslatorReader::parseAsModifier(const QString &item, Qt::KeyboardModifier &modifier)
406bool KeyboardTranslatorReader::parseAsStateFlag(const QString &item, KeyboardTranslator::State &flag)
458KeyboardTranslator::Entry KeyboardTranslatorReader::createEntry(const QString &condition, const QString &result)
533 Token sequenceToken = {Token::KeySequence, key.capturedTexts().value(1).remove(QLatin1Char(' '))};
574 return _keyCode == rhs._keyCode && _modifiers == rhs._modifiers && _modifierMask == rhs._modifierMask && _state == rhs._state
578bool KeyboardTranslator::Entry::matches(int keyCode, Qt::KeyboardModifiers modifiers, States testState) const
609QByteArray KeyboardTranslator::Entry::escapedText(bool expandWildCards, Qt::KeyboardModifiers modifiers) const
757QString KeyboardTranslator::Entry::resultToString(bool expandWildCards, Qt::KeyboardModifiers modifiers) const
842KeyboardTranslator::Entry KeyboardTranslator::findEntry(int keyCode, Qt::KeyboardModifiers modifiers, States state) const
Manages the keyboard translations available for use by terminal sessions, see KeyboardTranslator.
Definition KeyboardTranslator.h:432
KeyboardTranslatorManager()
Constructs a new KeyboardTranslatorManager and loads the list of available keyboard translations.
Definition KeyboardTranslator.cpp:56
const KeyboardTranslator * defaultTranslator()
Returns the default translator for Konsole.
Definition KeyboardTranslator.cpp:161
QList< QString > allTranslators()
Returns a list of the names of available keyboard translators.
Definition KeyboardTranslator.cpp:553
const KeyboardTranslator * findTranslator(const QString &name)
Returns the keyboard translator with the given name or 0 if no translator with that name exists.
Definition KeyboardTranslator.cpp:99
void addTranslator(KeyboardTranslator *translator)
Adds a new translator.
Definition KeyboardTranslator.cpp:851
bool deleteTranslator(const QString &name)
Deletes a translator.
Definition KeyboardTranslator.cpp:858
Parses the contents of a Keyboard Translator (.keytab) file and returns the entries found in it.
Definition KeyboardTranslator.h:347
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.
Definition KeyboardTranslator.cpp:458
KeyboardTranslatorReader(QIODevice *source)
Constructs a new reader which parses the given source.
Definition KeyboardTranslator.cpp:238
bool parseError()
Returns true if an error occurred whilst parsing the input or false if no error occurred.
Definition KeyboardTranslator.cpp:492
bool hasNextEntry() const
Returns true if there is another entry in the source stream.
Definition KeyboardTranslator.cpp:454
KeyboardTranslator::Entry nextEntry()
Returns the next entry found in the source stream.
Definition KeyboardTranslator.cpp:485
Writes a keyboard translation to disk.
Definition KeyboardTranslator.h:405
void writeHeader(const QString &description)
Writes the header for the keyboard translator.
Definition KeyboardTranslator.cpp:204
void writeEntry(const KeyboardTranslator::Entry &entry)
Writes a translator entry.
Definition KeyboardTranslator.cpp:208
KeyboardTranslatorWriter(QIODevice *destination)
Constructs a new writer which saves data into destination.
Definition KeyboardTranslator.cpp:193
Represents an association between a key sequence pressed by the user and the character sequence and c...
Definition KeyboardTranslator.h:124
Command command() const
Returns the commands associated with this entry.
Definition KeyboardTranslator.h:536
void setModifierMask(Qt::KeyboardModifiers modifiers)
See modifierMask() and modifiers()
Definition KeyboardTranslator.h:518
void setModifiers(Qt::KeyboardModifiers modifiers)
See modifiers()
Definition KeyboardTranslator.h:509
int keyCode() const
Returns the character code ( from the Qt::Key enum ) associated with this entry.
Definition KeyboardTranslator.h:500
QString resultToString(bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const
Returns this entry's result ( ie.
Definition KeyboardTranslator.cpp:757
QString conditionToString() const
Returns the key code and modifiers associated with this entry as a QKeySequence.
Definition KeyboardTranslator.cpp:780
void setKeyCode(int keyCode)
Sets the character code associated with this entry.
Definition KeyboardTranslator.h:504
void setCommand(Command command)
Sets the command associated with this entry.
Definition KeyboardTranslator.h:532
bool matches(int keyCode, Qt::KeyboardModifiers modifiers, States flags) const
Returns true if this entry matches the given key sequence, specified as a combination of keyCode ,...
Definition KeyboardTranslator.cpp:578
QByteArray escapedText(bool expandWildCards=false, Qt::KeyboardModifiers modifiers=Qt::NoModifier) const
Returns the character sequence associated with this entry, with any non-printable characters replaced...
Definition KeyboardTranslator.cpp:609
void setText(const QByteArray &text)
Sets the character sequence associated with this entry.
Definition KeyboardTranslator.h:541
A convertor which maps between key sequences pressed by the user and the character strings which shou...
Definition KeyboardTranslator.h:53
QString name() const
Returns the name of this keyboard translator.
Definition KeyboardTranslator.cpp:817
Entry findEntry(int keyCode, Qt::KeyboardModifiers modifiers, States state=NoState) const
Looks for an entry in this keyboard translator which matches the given key code, keyboard modifiers a...
Definition KeyboardTranslator.cpp:842
QString description() const
Returns the descriptive name of this keyboard translator.
Definition KeyboardTranslator.cpp:809
static const Qt::KeyboardModifier CTRL_MOD
The modifier code for the actual Ctrl key on this OS.
Definition KeyboardTranslator.h:306
void replaceEntry(const Entry &existing, const Entry &replacement)
Replaces an entry in the translator.
Definition KeyboardTranslator.cpp:832
void setName(const QString &name)
Sets the name of this keyboard translator.
Definition KeyboardTranslator.cpp:813
State
The meaning of a particular key sequence may depend upon the state which the terminal emulation is in...
Definition KeyboardTranslator.h:63
@ AlternateScreenState
Indicates that the alternate screen ( typically used by interactive programs such as screen or vim ) ...
Definition KeyboardTranslator.h:83
@ AnyModifierState
Indicates that any of the modifier keys is active.
Definition KeyboardTranslator.h:85
@ ApplicationKeypadState
Indicates that the numpad is in application mode.
Definition KeyboardTranslator.h:87
QList< Entry > entries() const
Returns a list of all entries in the translator.
Definition KeyboardTranslator.cpp:822
Command
This enum describes commands which are associated with particular key sequences.
Definition KeyboardTranslator.h:94
@ NoCommand
Indicates that no command is associated with this command sequence.
Definition KeyboardTranslator.h:96
@ EraseCommand
Echos the operating system specific erase character.
Definition KeyboardTranslator.h:114
@ ScrollPageDownCommand
Scroll the terminal display down one page.
Definition KeyboardTranslator.h:102
@ ScrollDownToBottomCommand
Scroll the terminal display down to the end of history.
Definition KeyboardTranslator.h:112
@ ScrollUpToTopCommand
Scroll the terminal display up to the start of history.
Definition KeyboardTranslator.h:110
@ ScrollLineDownCommand
Scroll the terminal display down one line.
Definition KeyboardTranslator.h:106
KeyboardTranslator(const QString &name)
Constructs a new keyboard translator with the given name.
Definition KeyboardTranslator.cpp:800
void setDescription(const QString &description)
Sets the descriptive name of this keyboard translator.
Definition KeyboardTranslator.cpp:805
void addEntry(const Entry &entry)
Adds an entry to this keyboard translator's table.
Definition KeyboardTranslator.cpp:827
void removeEntry(const Entry &entry)
Removes an entry from the table.
Definition KeyboardTranslator.cpp:838
QString name(GameStandardAction id)
QString path(const QString &relativePath)
KIOCORE_EXPORT QString dir(const QString &fileClass)
KIOCORE_EXPORT QStringList list(const QString &fileClass)
virtual bool open(OpenMode flags) override
void setData(const QByteArray &data)
QByteArray & insert(qsizetype i, QByteArrayView data)
QByteArray & remove(qsizetype pos, qsizetype len)
QByteArray & replace(QByteArrayView before, QByteArrayView after)
qsizetype size() const const
bool isLetterOrNumber(char32_t ucs4)
bool remove()
QString baseName() const const
virtual bool atEnd() const const
virtual void close()
bool isWritable() const const
QByteArray readLine(qint64 maxSize)
WriteOnly
int count() const const
QKeySequence fromString(const QString &str, SequenceFormat format)
bool isEmpty() const const
QString toString(SequenceFormat format) const const
T & first()
bool isEmpty() const const
QString & append(QChar ch)
void clear()
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
QString fromLatin1(QByteArrayView str)
QString fromUtf8(QByteArrayView str)
bool isEmpty() const const
qsizetype length() const const
QString & remove(QChar ch, Qt::CaseSensitivity cs)
QString simplified() const const
qsizetype size() const const
QByteArray toUtf8() const const
CaseInsensitive
Key_unknown
KeyboardModifier
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:55:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:55:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.