Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 649ac012 authored by Robert Knight's avatar Robert Knight

Copy the built-in key bindings into a new keytab file, install it and make it...

Copy the built-in key bindings into a new keytab file, install it and make it the default key bindings.  The built-in one is still there at the moment.  Reorganise the profile edit dialog, put the Scrolling page before the Keyboard Setup page since I expect it to be used more frequently.  Add widgets for a not-yet-implemented test area to the key bindings editor.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=676102
parent bf48ede5
install( FILES
default.keytab
linux.keytab
vt420pc.keytab
solaris.keytab
README.KeyTab
README.default.Keytab
DESTINATION
${DATA_INSTALL_DIR}/konsole )
# [README.default.Keytab] Buildin Keyboard Table
# --------------------------------------------------------------
#
# This file is used to create the buildin keyboard table.
# It is included for reference purpose with the *.keytab
# files that are loaded dynamically.
#
# Modifying it does not have any effect (unless you
# derive the default.keytab.h and recompile konsole).
#
# To customize your keyboard, copy this file to something
# ending with .keytab and change it to meet you needs.
......@@ -16,7 +7,7 @@
#
# --------------------------------------------------------------
keyboard "XTerm (XFree 4.x.x)"
keyboard "Default (XFree 4)"
# --------------------------------------------------------------
#
......
......@@ -8,7 +8,7 @@
<!-- <Action name="remote-connection" /> !-->
<Separator/>
<ActionList name="favorite-profiles"/>
<Separator group="session-operations" />
<Separator/>
<DefineGroup name="session-operations"/>
<Action name="exit" />
</Menu>
......
......@@ -61,8 +61,17 @@ EditProfileDialog::EditProfileDialog(QWidget* parent)
_ui = new Ui::EditProfileDialog();
_ui->setupUi(mainWidget());
_pageInvalidated.resize( _ui->tabWidget->count() );
// there are various setupXYZPage() methods to load the items
// for each page and update their states to match the profile
// being edited.
//
// these are only called when needed ( ie. when the user clicks
// the tab to move to that page ).
//
// the _pageNeedsUpdate vector keeps track of the pages that have
// not been updated since the last profile change and will need
// to be refreshed when the user switches to them
_pageNeedsUpdate.resize( _ui->tabWidget->count() );
connect( _ui->tabWidget , SIGNAL(currentChanged(int)) , this ,
SLOT(ensurePageLoaded(int)) );
......@@ -113,16 +122,13 @@ void EditProfileDialog::setProfile(const QString& key)
// update caption
setCaption( i18n("Edit Profile \"%1\"",info->name()) );
// setup each page of the dialog
_pageInvalidated.fill(true);
// mark each page of the dialog as out of date
// and force an update of the currently visible page
//
// the other pages will be updated as necessary
_pageNeedsUpdate.fill(true);
ensurePageLoaded( _ui->tabWidget->currentIndex() );
// setupGeneralPage(info);
// setupAppearancePage(info);
// setupKeyboardPage(info);
// setupScrollingPage(info);
// setupAdvancedPage(info);
if ( _tempProfile )
{
delete _tempProfile;
......@@ -133,10 +139,10 @@ void EditProfileDialog::ensurePageLoaded(int page)
{
const Profile* info = SessionManager::instance()->profile(_profileKey);
Q_ASSERT( _pageInvalidated.count() > page );
Q_ASSERT( _pageNeedsUpdate.count() > page );
Q_ASSERT( info );
if ( _pageInvalidated[page] )
if ( _pageNeedsUpdate[page] )
{
QWidget* pageWidget = _ui->tabWidget->widget(page);
......@@ -153,7 +159,7 @@ void EditProfileDialog::ensurePageLoaded(int page)
else
Q_ASSERT(false);
_pageInvalidated[page] = false;
_pageNeedsUpdate[page] = false;
}
}
void EditProfileDialog::setupGeneralPage(const Profile* info)
......
......@@ -191,7 +191,11 @@ private:
Profile* _tempProfile;
QString _profileKey;
QVector<bool> _pageInvalidated;
// keeps track of pages which need to be updated to match the current
// profile. all elements in this vector are set to true when the
// profile is changed and individual elements are set to false
// after an update by a call to ensurePageLoaded()
QVector<bool> _pageNeedsUpdate;
QHash<int,QVariant> _previewedProperties;
};
......
......@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>456</width>
<height>516</height>
<width>521</width>
<height>596</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -492,88 +492,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="keyboardTab" >
<attribute name="title" >
<string>Keyboard Setup</string>
</attribute>
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="keyBindingsGroup" >
<property name="title" >
<string>Key Bindings</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item rowspan="5" row="0" column="0" >
<widget class="QListView" name="keyBindingList" >
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="newKeyBindingsButton" >
<property name="toolTip" >
<string>Create a new key bindings list based upon the selected bindings</string>
</property>
<property name="text" >
<string>New...</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="editKeyBindingsButton" >
<property name="toolTip" >
<string>Edit the selected key bindings list</string>
</property>
<property name="text" >
<string>Edit...</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="removeKeyBindingsButton" >
<property name="toolTip" >
<string>Delete the selected key bindings list</string>
</property>
<property name="text" >
<string>Remove</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="selectKeyBindingsButton" >
<property name="toolTip" >
<string>Use the selected key bindings list in this profile</string>
</property>
<property name="text" >
<string>Select</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>71</width>
<height>101</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="scrollingTab" >
<attribute name="title" >
<string>Scrolling</string>
......@@ -744,6 +662,98 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="keyboardTab" >
<attribute name="title" >
<string>Keyboard Setup</string>
</attribute>
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="keyBindingsGroup" >
<property name="title" >
<string>Key Bindings</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QLabel" name="label_15" >
<property name="text" >
<string>Key bindings control how combinations of key presses in the terminal window are converted into the stream of characters which is sent to the current terminal program.</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item rowspan="5" row="1" column="0" >
<widget class="QListView" name="keyBindingList" >
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="newKeyBindingsButton" >
<property name="toolTip" >
<string>Create a new key bindings list based upon the selected bindings</string>
</property>
<property name="text" >
<string>New...</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="editKeyBindingsButton" >
<property name="toolTip" >
<string>Edit the selected key bindings list</string>
</property>
<property name="text" >
<string>Edit...</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="removeKeyBindingsButton" >
<property name="toolTip" >
<string>Delete the selected key bindings list</string>
</property>
<property name="text" >
<string>Remove</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QPushButton" name="selectKeyBindingsButton" >
<property name="toolTip" >
<string>Use the selected key bindings list in this profile</string>
</property>
<property name="text" >
<string>Select</string>
</property>
</widget>
</item>
<item row="5" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>71</width>
<height>101</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="advancedTab" >
<attribute name="title" >
<string>Advanced</string>
......
......@@ -48,6 +48,10 @@ KeyBindingEditor::KeyBindingEditor(QWidget* parent)
_ui->keyBindingTable->setHorizontalHeaderLabels(labels);
_ui->keyBindingTable->horizontalHeader()->setStretchLastSection(true);
_ui->keyBindingTable->verticalHeader()->hide();
// test area
connect( _ui->testAreaInputEdit , SIGNAL(textChanged(const QString&)) , this ,
SLOT(updateTestAreaOutput(const QString&)) );
}
KeyBindingEditor::~KeyBindingEditor()
......@@ -55,6 +59,13 @@ KeyBindingEditor::~KeyBindingEditor()
delete _ui;
}
void KeyBindingEditor::updateTestAreaOutput(const QString& input)
{
// TODO : Run 'input' text through the keyboard translator
}
void KeyBindingEditor::setDescription(const QString& newDescription)
{
if ( description() != newDescription )
......
......@@ -34,9 +34,10 @@ namespace Konsole
class KeyboardTranslator;
/**
* A dialog which allows the user to edit a key bindings list,
* which maps between key combinations and text produced
* in the shell when those combinations are pressed.
* A dialog which allows the user to edit a key bindings list
* which maps between key combinations input by the user and
* the character sequence sent to the terminal when those
* combinations are pressed.
*
* The dialog can be initialised with the settings of an
* existing key bindings list using the setup() method.
......@@ -72,12 +73,23 @@ public:
QString description() const;
public slots:
/**
* Sets the text of the editor's description field.
*/
void setDescription(const QString& description);
private slots:
void updateTestAreaOutput(const QString& input);
private:
void setupKeyBindingTable(const KeyboardTranslator* translator);
Ui::KeyBindingEditor* _ui;
// translator to which modifications are made as the user makes
// changes in the UI.
// this is initialized as a copy of the translator specified
// when setup() is called
KeyboardTranslator* _translator;
};
......
......@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>302</width>
<height>395</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -40,7 +40,63 @@
</layout>
</item>
<item>
<widget class="QTableWidget" name="keyBindingTable" />
<widget class="QTableWidget" name="keyBindingTable" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Test Area</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Input:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="testAreaInputEdit" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Output:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="testAreaOutputEdit" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
......
......@@ -93,9 +93,9 @@ KeyTrans::KeyTrans(const QString& path)
,m_numb(0)
,m_fileRead(false)
{
if (m_path=="[buildin]")
if (m_path=="[builtin]")
{
m_id = "default";
m_id = "builtin";
}
else
{
......@@ -408,7 +408,7 @@ void KeyTrans::readConfig(bool headerOnly)
QIODevice* buf(0);
QByteArray* txt = 0;
if (m_path=="[buildin]")
if (m_path=="[builtin]")
{
txt = new QByteArray(
#include "default.keytab.h"
......@@ -785,7 +785,7 @@ void KeyTrans::loadAll()
syms = new KeyTransSymbols;
//defaultKeyTrans()->addKeyTrans();
KeyTrans* sc = new KeyTrans("[buildin]");
KeyTrans* sc = new KeyTrans("[builtin]");
sc->addKeyTrans();
QStringList lst = KGlobal::dirs()->findAllResources("data", "konsole/*.keytab");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment