2
This source file is part of Konsole, a terminal emulator.
4
Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
#ifndef KEYBOARDTRANSLATOR_MANAGER_H
23
#define KEYBOARDTRANSLATOR_MANAGER_H
26
#include <QtCore/QHash>
27
#include <QtCore/QStringList>
30
#include "konsole_export.h"
31
#include "KeyboardTranslator.h"
38
* Manages the keyboard translations available for use by terminal sessions,
39
* see KeyboardTranslator.
41
class KeyboardTranslatorManager
45
* Constructs a new KeyboardTranslatorManager and loads the list of
46
* available keyboard translations.
48
* The keyboard translations themselves are not loaded until they are
49
* first requested via a call to findTranslator()
51
KeyboardTranslatorManager();
52
~KeyboardTranslatorManager();
55
* Adds a new translator. If a translator with the same name
56
* already exists, it will be replaced by the new translator.
58
* TODO: More documentation.
60
void addTranslator(KeyboardTranslator* translator);
63
* Deletes a translator. Returns true on successful deletion or false otherwise.
65
* TODO: More documentation
67
bool deleteTranslator(const QString& name);
69
/** Returns the default translator for Konsole. */
70
const KeyboardTranslator* defaultTranslator();
73
* Returns the keyboard translator with the given name or 0 if no translator
74
* with that name exists.
76
* The first time that a translator with a particular name is requested,
77
* the on-disk .keytab file is loaded and parsed.
79
const KeyboardTranslator* findTranslator(const QString& name);
81
* Returns a list of the names of available keyboard translators.
83
* The first time this is called, a search for available
84
* translators is started.
86
QStringList allTranslators();
88
/** Returns the global KeyboardTranslatorManager instance. */
89
static KeyboardTranslatorManager* instance();
92
void findTranslators(); // locate all available translators
94
// loads the translator with the given name
95
KeyboardTranslator* loadTranslator(const QString& name);
96
KeyboardTranslator* loadTranslator(QIODevice* device, const QString& name);
98
bool saveTranslator(const KeyboardTranslator* translator);
99
QString findTranslatorPath(const QString& name);
103
const KeyboardTranslator* _fallbackTranslator;
104
QHash<QString, KeyboardTranslator*> _translators;
108
#endif // KEYBOARDTRANSLATOR_MANAGER_H