add more spacing
[personal-kdebase.git] / apps / konsole / src / KeyBindingEditor.h
blob392fd17aed79b7119bd38ddf88bb7d62452c95ab
1 /*
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
17 02110-1301 USA.
20 #ifndef KEYBINDINGEDITOR_H
21 #define KEYBINDINGEDITOR_H
23 // Qt
24 #include <QtGui/QWidget>
26 class QTableWidgetItem;
28 namespace Ui
30 class KeyBindingEditor;
33 namespace Konsole
36 class KeyboardTranslator;
38 /**
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
53 Q_OBJECT
55 public:
56 /** Constructs a new key bindings editor with the specified parent. */
57 KeyBindingEditor(QWidget* parent = 0);
58 virtual ~KeyBindingEditor();
60 /**
61 * Intialises the dialog with the bindings and other settings
62 * from the specified @p translator.
64 void setup(const KeyboardTranslator* translator);
66 /**
67 * Returns the modified translator describing the changes to the bindings
68 * and other settings which the user made.
70 KeyboardTranslator* translator() const;
72 /**
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 );
80 public slots:
81 /**
82 * Sets the text of the editor's description field.
84 void setDescription(const QString& description);
86 private slots:
87 void bindingTableItemChanged(QTableWidgetItem* item);
88 void removeSelectedEntry();
89 void addNewEntry();
91 private:
92 void setupKeyBindingTable(const KeyboardTranslator* translator);
94 Ui::KeyBindingEditor* _ui;
96 // translator to which modifications are made as the user makes
97 // changes in the UI.
98 // this is initialized as a copy of the translator specified
99 // when setup() is called
100 KeyboardTranslator* _translator;
105 #endif //KEYBINDINGEDITOR_H