Manages the keyboard translations available for use by terminal sessions, see KeyboardTranslator. More...
#include "KeyboardTranslator.h"
Public Member Functions | |
KeyboardTranslatorManager () | |
Constructs a new KeyboardTranslatorManager and loads the list of available keyboard translations. More... | |
~KeyboardTranslatorManager () | |
void | addTranslator (KeyboardTranslator *translator) |
Adds a new translator. More... | |
QList< QString > | allTranslators () |
Returns a list of the names of available keyboard translators. More... | |
const KeyboardTranslator * | defaultTranslator () |
Returns the default translator for Konsole. More... | |
bool | deleteTranslator (const QString &name) |
Deletes a translator. More... | |
const KeyboardTranslator * | findTranslator (const QString &name) |
Returns the keyboard translator with the given name or 0 if no translator with that name exists. More... | |
Static Public Member Functions | |
static KeyboardTranslatorManager * | instance () |
Returns the global KeyboardTranslatorManager instance. More... | |
Private Member Functions | |
QString | findTranslatorPath (const QString &name) |
void | findTranslators () |
KeyboardTranslator * | loadTranslator (const QString &name) |
KeyboardTranslator * | loadTranslator (QIODevice *device, const QString &name) |
bool | saveTranslator (const KeyboardTranslator *translator) |
Private Attributes | |
bool | _haveLoadedAll |
QHash< QString, KeyboardTranslator * > | _translators |
Static Private Attributes | |
static const char * | defaultTranslatorText = |
Manages the keyboard translations available for use by terminal sessions, see KeyboardTranslator.
Definition at line 518 of file KeyboardTranslator.h.
KeyboardTranslatorManager::KeyboardTranslatorManager | ( | ) |
Constructs a new KeyboardTranslatorManager and loads the list of available keyboard translations.
The keyboard translations themselves are not loaded until they are first requested via a call to findTranslator()
Definition at line 51 of file KeyboardTranslator.cpp.
KeyboardTranslatorManager::~KeyboardTranslatorManager | ( | ) |
Definition at line 55 of file KeyboardTranslator.cpp.
References _translators.
void KeyboardTranslatorManager::addTranslator | ( | KeyboardTranslator * | translator | ) |
Adds a new translator.
If a translator with the same name already exists, it will be replaced by the new translator.
TODO: More documentation.
Definition at line 867 of file KeyboardTranslator.cpp.
References _translators, KeyboardTranslator::name(), and saveTranslator().
QList< QString > KeyboardTranslatorManager::allTranslators | ( | ) |
Returns a list of the names of available keyboard translators.
The first time this is called, a search for available translators is started.
Definition at line 566 of file KeyboardTranslator.cpp.
References _haveLoadedAll, _translators, and findTranslators().
const KeyboardTranslator * KeyboardTranslatorManager::defaultTranslator | ( | ) |
Returns the default translator for Konsole.
Definition at line 155 of file KeyboardTranslator.cpp.
References defaultTranslatorText, loadTranslator(), and strlen().
Referenced by findTranslator().
bool KeyboardTranslatorManager::deleteTranslator | ( | const QString & | name | ) |
Deletes a translator.
Returns true on successful deletion or false otherwise.
TODO: More documentation
Definition at line 875 of file KeyboardTranslator.cpp.
References _translators, and findTranslatorPath().
const KeyboardTranslator * KeyboardTranslatorManager::findTranslator | ( | const QString & | name | ) |
Returns the keyboard translator with the given name or 0 if no translator with that name exists.
The first time that a translator with a particular name is requested, the on-disk .keyboard file is loaded and parsed.
Definition at line 90 of file KeyboardTranslator.cpp.
References _translators, defaultTranslator(), findTranslators(), and loadTranslator().
Referenced by Emulation::setKeyBindings().
|
private |
Definition at line 59 of file KeyboardTranslator.cpp.
Referenced by deleteTranslator(), and loadTranslator().
|
private |
Definition at line 63 of file KeyboardTranslator.cpp.
References _haveLoadedAll, and _translators.
Referenced by allTranslators(), and findTranslator().
|
static |
Returns the global KeyboardTranslatorManager instance.
Definition at line 893 of file KeyboardTranslator.cpp.
Referenced by Emulation::setKeyBindings().
|
private |
Definition at line 143 of file KeyboardTranslator.cpp.
References findTranslatorPath().
Referenced by defaultTranslator(), and findTranslator().
|
private |
Definition at line 166 of file KeyboardTranslator.cpp.
References KeyboardTranslator::addEntry(), KeyboardTranslatorReader::description(), KeyboardTranslatorReader::hasNextEntry(), KeyboardTranslatorReader::nextEntry(), KeyboardTranslatorReader::parseError(), and KeyboardTranslator::setDescription().
|
private |
Definition at line 112 of file KeyboardTranslator.cpp.
References KeyboardTranslator::description(), KeyboardTranslator::entries(), KeyboardTranslatorWriter::writeEntry(), and KeyboardTranslatorWriter::writeHeader().
Referenced by addTranslator().
|
private |
Definition at line 581 of file KeyboardTranslator.h.
Referenced by allTranslators(), and findTranslators().
|
private |
Definition at line 579 of file KeyboardTranslator.h.
Referenced by ~KeyboardTranslatorManager(), addTranslator(), allTranslators(), deleteTranslator(), findTranslator(), and findTranslators().
|
staticprivate |
Definition at line 569 of file KeyboardTranslator.h.
Referenced by defaultTranslator().