GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
KeyboardTranslatorManager Class Reference

Manages the keyboard translations available for use by terminal sessions, see KeyboardTranslator. More...

#include "KeyboardTranslator.h"

Collaboration diagram for KeyboardTranslatorManager:

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 KeyboardTranslatordefaultTranslator ()
 Returns the default translator for Konsole. More...
 
bool deleteTranslator (const QString &name)
 Deletes a translator. More...
 
const KeyboardTranslatorfindTranslator (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 KeyboardTranslatorManagerinstance ()
 Returns the global KeyboardTranslatorManager instance. More...
 

Private Member Functions

QString findTranslatorPath (const QString &name)
 
void findTranslators ()
 
KeyboardTranslatorloadTranslator (const QString &name)
 
KeyboardTranslatorloadTranslator (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 =
 

Detailed Description

Manages the keyboard translations available for use by terminal sessions, see KeyboardTranslator.

Definition at line 518 of file KeyboardTranslator.h.

Constructor & Destructor Documentation

◆ KeyboardTranslatorManager()

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::~KeyboardTranslatorManager ( )

Definition at line 55 of file KeyboardTranslator.cpp.

References _translators.

Member Function Documentation

◆ addTranslator()

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().

◆ allTranslators()

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().

◆ defaultTranslator()

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().

◆ deleteTranslator()

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().

◆ findTranslator()

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().

◆ findTranslatorPath()

QString KeyboardTranslatorManager::findTranslatorPath ( const QString &  name)
private

Definition at line 59 of file KeyboardTranslator.cpp.

Referenced by deleteTranslator(), and loadTranslator().

◆ findTranslators()

void KeyboardTranslatorManager::findTranslators ( )
private

Definition at line 63 of file KeyboardTranslator.cpp.

References _haveLoadedAll, and _translators.

Referenced by allTranslators(), and findTranslator().

◆ instance()

KeyboardTranslatorManager * KeyboardTranslatorManager::instance ( void  )
static

Returns the global KeyboardTranslatorManager instance.

Definition at line 893 of file KeyboardTranslator.cpp.

Referenced by Emulation::setKeyBindings().

◆ loadTranslator() [1/2]

KeyboardTranslator * KeyboardTranslatorManager::loadTranslator ( const QString &  name)
private

Definition at line 143 of file KeyboardTranslator.cpp.

References findTranslatorPath().

Referenced by defaultTranslator(), and findTranslator().

◆ loadTranslator() [2/2]

◆ saveTranslator()

bool KeyboardTranslatorManager::saveTranslator ( const KeyboardTranslator translator)
private

Member Data Documentation

◆ _haveLoadedAll

bool KeyboardTranslatorManager::_haveLoadedAll
private

Definition at line 581 of file KeyboardTranslator.h.

Referenced by allTranslators(), and findTranslators().

◆ _translators

QHash<QString,KeyboardTranslator*> KeyboardTranslatorManager::_translators
private

◆ defaultTranslatorText

const char * KeyboardTranslatorManager::defaultTranslatorText =
staticprivate

Definition at line 569 of file KeyboardTranslator.h.

Referenced by defaultTranslator().


The documentation for this class was generated from the following files: