2 Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #ifndef KEYBINDINGEDITOR_H
21 #define KEYBINDINGEDITOR_H
24 #include <QtGui/QWidget>
26 class QTableWidgetItem
;
30 class KeyBindingEditor
;
36 class KeyboardTranslator
;
39 * A dialog which allows the user to edit a key bindings list
40 * which maps between key combinations input by the user and
41 * the character sequence sent to the terminal when those
42 * combinations are pressed.
44 * The dialog can be initialised with the settings of an
45 * existing key bindings list using the setup() method.
47 * The dialog creates a copy of the supplied keyboard translator
48 * to which any changes are applied. The modified translator
49 * can be retrieved using the translator() method.
51 class KeyBindingEditor
: public QWidget
56 /** Constructs a new key bindings editor with the specified parent. */
57 KeyBindingEditor(QWidget
* parent
= 0);
58 virtual ~KeyBindingEditor();
61 * Intialises the dialog with the bindings and other settings
62 * from the specified @p translator.
64 void setup(const KeyboardTranslator
* translator
);
67 * Returns the modified translator describing the changes to the bindings
68 * and other settings which the user made.
70 KeyboardTranslator
* translator() const;
73 * Returns the text of the editor's description field.
75 QString
description() const;
77 // reimplemented to handle test area input
78 virtual bool eventFilter( QObject
* watched
, QEvent
* event
);
82 * Sets the text of the editor's description field.
84 void setDescription(const QString
& description
);
87 void bindingTableItemChanged(QTableWidgetItem
* item
);
88 void removeSelectedEntry();
92 void setupKeyBindingTable(const KeyboardTranslator
* translator
);
94 Ui::KeyBindingEditor
* _ui
;
96 // translator to which modifications are made as the user makes
98 // this is initialized as a copy of the translator specified
99 // when setup() is called
100 KeyboardTranslator
* _translator
;
105 #endif //KEYBINDINGEDITOR_H