mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
List currently used shortcuts in the shortcuts panel of the preference dialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20991 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
13d7df639b
commit
404572d97d
10
src/KeyMap.h
10
src/KeyMap.h
@ -90,7 +90,6 @@ public:
|
|||||||
|
|
||||||
typedef std::pair<KeyModifier, KeyModifier> ModifierPair;
|
typedef std::pair<KeyModifier, KeyModifier> ModifierPair;
|
||||||
|
|
||||||
private:
|
|
||||||
///
|
///
|
||||||
struct Key {
|
struct Key {
|
||||||
/// Keysym
|
/// Keysym
|
||||||
@ -106,6 +105,13 @@ private:
|
|||||||
FuncRequest func;
|
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.
|
* Define an action for a key sequence.
|
||||||
* @param r internal recursion level
|
* @param r internal recursion level
|
||||||
@ -124,8 +130,6 @@ private:
|
|||||||
/// is the table empty ?
|
/// is the table empty ?
|
||||||
bool empty() const { return table.empty(); }
|
bool empty() const { return table.empty(); }
|
||||||
///
|
///
|
||||||
typedef std::vector<Key> Table;
|
|
||||||
///
|
|
||||||
Table table;
|
Table table;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "GuiFontExample.h"
|
#include "GuiFontExample.h"
|
||||||
|
#include "KeyMap.h"
|
||||||
|
#include "LyXAction.h"
|
||||||
#include "PanelStack.h"
|
#include "PanelStack.h"
|
||||||
#include "paper.h"
|
#include "paper.h"
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
@ -45,6 +47,8 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QTreeWidget>
|
||||||
|
#include <QTreeWidgetItem>
|
||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
|
||||||
@ -1682,6 +1686,12 @@ PrefShortcuts::PrefShortcuts(GuiPreferences * form, QWidget * parent)
|
|||||||
{
|
{
|
||||||
setupUi(this);
|
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()),
|
connect(bindFilePB, SIGNAL(clicked()),
|
||||||
this, SLOT(select_bind()));
|
this, SLOT(select_bind()));
|
||||||
connect(bindFileED, SIGNAL(textChanged(const QString &)),
|
connect(bindFileED, SIGNAL(textChanged(const QString &)),
|
||||||
@ -1698,6 +1708,23 @@ void PrefShortcuts::apply(LyXRC & rc) const
|
|||||||
void PrefShortcuts::update(LyXRC const & rc)
|
void PrefShortcuts::update(LyXRC const & rc)
|
||||||
{
|
{
|
||||||
bindFileED->setText(toqstr(external_path(rc.bind_file)));
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,14 +27,40 @@
|
|||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="2" >
|
<item row="3" column="2" >
|
||||||
<widget class="QPushButton" name="bindFilePB" >
|
<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" >
|
<property name="text" >
|
||||||
<string>B&rowse...</string>
|
<string>Edit</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" colspan="2" >
|
||||||
|
<widget class="QLabel" name="shortcutsLBL" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Shortcuts:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<widget class="QLineEdit" name="bindFileED" />
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" >
|
||||||
<widget class="QLabel" name="bindFileLA" >
|
<widget class="QLabel" name="bindFileLA" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>&Bind file:</string>
|
<string>&Bind file:</string>
|
||||||
@ -44,21 +70,15 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="0" column="2" >
|
||||||
<widget class="QLineEdit" name="bindFileED" />
|
<widget class="QPushButton" name="bindFilePB" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>B&rowse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1" >
|
<item rowspan="2" row="2" column="0" colspan="2" >
|
||||||
<spacer>
|
<widget class="QTreeWidget" name="shortcutsTW" />
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" >
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user