typedef std::pair<KeyModifier, KeyModifier> ModifierPair;
-private:
///
struct Key {
/// Keysym
FuncRequest func;
};
+ ///
+ typedef std::vector<Key> Table;
+
+ Table::const_iterator begin() const { return table.begin(); }
+ Table::const_iterator end() const { return table.end(); }
+
+private:
/**
* Define an action for a key sequence.
* @param r internal recursion level
/// is the table empty ?
bool empty() const { return table.empty(); }
///
- typedef std::vector<Key> Table;
- ///
Table table;
};
#include "FuncRequest.h"
#include "gettext.h"
#include "GuiFontExample.h"
+#include "KeyMap.h"
+#include "LyXAction.h"
#include "PanelStack.h"
#include "paper.h"
#include "Session.h"
#include <QPushButton>
#include <QSpinBox>
#include <QString>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
#include <QValidator>
#include <QCloseEvent>
{
setupUi(this);
+ shortcutsTW->setColumnCount(3);
+ shortcutsTW->headerItem()->setText(0, qt_(""));
+ shortcutsTW->headerItem()->setText(1, qt_("Function"));
+ shortcutsTW->headerItem()->setText(2, qt_("Shortcut"));
+ shortcutsTW->setSortingEnabled(false);
+
connect(bindFilePB, SIGNAL(clicked()),
this, SLOT(select_bind()));
connect(bindFileED, SIGNAL(textChanged(const QString &)),
void PrefShortcuts::update(LyXRC const & rc)
{
bindFileED->setText(toqstr(external_path(rc.bind_file)));
+
+ KeyMap & km = theTopLevelKeymap();
+ KeyMap::Table::const_iterator it = km.begin();
+ KeyMap::Table::const_iterator it_end = km.end();
+ for (; it != it_end; ++it) {
+ QTreeWidgetItem * newItem = new QTreeWidgetItem(shortcutsTW);
+ string const action = lyxaction.getActionName(it->func.action);
+ if (action == "self-insert")
+ continue;
+ QString const lfun = toqstr(from_utf8(action) + " " + it->func.argument());
+ QString const shortcut = toqstr(it->code.print(it->mod.first, true));
+ newItem->setText(1, lfun);
+ newItem->setText(2, shortcut);
+ // FIXME: TreeItem can not be user-checkable?
+ newItem->setFlags(newItem->flags() | Qt::ItemIsEditable
+ | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
+ }
}
<property name="spacing" >
<number>6</number>
</property>
- <item row="1" column="2" >
- <widget class="QPushButton" name="bindFilePB" >
+ <item row="3" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QPushButton" name="editPB" >
<property name="text" >
- <string>B&rowse...</string>
+ <string>Edit</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="QLabel" name="shortcutsLBL" >
+ <property name="text" >
+ <string>Shortcuts:</string>
</property>
</widget>
</item>
- <item row="1" column="0" >
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="bindFileED" />
+ </item>
+ <item row="0" column="0" >
<widget class="QLabel" name="bindFileLA" >
<property name="text" >
<string>&Bind file:</string>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="bindFileED" />
- </item>
- <item row="5" column="1" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
+ <item row="0" column="2" >
+ <widget class="QPushButton" name="bindFilePB" >
+ <property name="text" >
+ <string>B&rowse...</string>
</property>
- </spacer>
+ </widget>
+ </item>
+ <item rowspan="2" row="2" column="0" colspan="2" >
+ <widget class="QTreeWidget" name="shortcutsTW" />
</item>
</layout>
</widget>