Mercurial > hg > octave-nkf
diff libgui/src/settings-dialog.ui @ 18759:086093fbdc1a gui-release
first implementation of a shortcut manager (bug #41217)
* file-editor.cc (set_shortcuts): use shortcut-manager to set some shortcuts
* main_window.cc (set_global_shortcuts): use shortcut-manager to set some
shortcuts;
(construct_file_menu): all actions as class variables;
(construct_edit_menu): all actions as class variables;
* main_window.h: actions as class variables
* module.mk: new files shortcut_manager.cc, shortcut_manager.h
* octave-gui.cc (octave_start_gui): initialize the shortcut_manager
* settings-dialog.cc (constructor): call shortcut-manager for shortcut table
(write_changed_settings): call shortcut-manager for writing shortcuts
* settings-dialog.ui: new tab with a tree widget for the shortcuts
* shortcut_manager.cc (constructor, destructor): new class;
(instance_ok): checks if instance is valid, creates a new one otherwise;
(do_init_data): initialize the list with all shortcut's data;
(init): internal function for initializing the data list;
(do_fill_treewidget): fills the tree widget in the settings dialog;
(do_write_shortcuts): writes shortcuts from settings dialog into file;
(do_set_shortcut): setting the shortcut for an action;
(handle_double_clicked): slot for double clicking into the tree widget;
(shortcut_dialog): dialog for entering a new shortcut;
(shortcut_dialog_finished): processing the dialog's result;
(shortcut_dialog_set_default): setting the shortcut to it's default;
(enter_shortcut::enter_shortcut): new class derived from QLineEdit;
(enter_shortcut::handle_direct_shortcut): switch between normal editing and
directly entering a shortcut;
(enter_shortcut::keyPressEvent): event handler filtering the shortcuts;
* shortcut_manager.h (init_data): static function calling do_init_data;
(write_shortcuts): static function calling do_write_shortcuts;
(fill_treewidget): static function calling do_fill_treewidget;
(set_shortcut): static function calling do_set_shortcut;
author | Torsten <ttl@justmail.de> |
---|---|
date | Tue, 01 Apr 2014 21:29:48 +0200 |
parents | 6e81b59d657c |
children | 7cb98e81ecd1 |
line wrap: on
line diff
--- a/libgui/src/settings-dialog.ui +++ b/libgui/src/settings-dialog.ui @@ -32,7 +32,7 @@ </size> </property> <property name="currentIndex"> - <number>3</number> + <number>6</number> </property> <widget class="QWidget" name="tab_general"> <property name="enabled"> @@ -1165,6 +1165,12 @@ <layout class="QVBoxLayout" name="verticalLayout_8"> <item> <layout class="QGridLayout" name="gridLayout_7"> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> <item row="1" column="2"> <layout class="QHBoxLayout" name="horizontalLayout_13"> <item> @@ -1255,11 +1261,11 @@ </item> </layout> </item> - <item row="2" column="2"> + <item row="2" column="2"> <layout class="QHBoxLayout" name="horizontalLayout_5"> <property name="topMargin"> <number>0</number> - </property> + </property> <item> <widget class="QSpinBox" name="terminal_history_buffer"> <property name="minimum"> @@ -1274,7 +1280,7 @@ <property name="value"> <number>1000</number> </property> - </widget> + </widget> </item> <item> <widget class="QLabel" name="label_20"> @@ -1327,12 +1333,6 @@ </property> </spacer> </item> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> </layout> </item> <item> @@ -1648,6 +1648,132 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_shortcuts"> + <attribute name="title"> + <string>Shortcuts</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_27"> + <item> + <widget class="QScrollArea" name="scrollArea_7"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_8"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>678</width> + <height>378</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_25"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_26"> + <property name="sizeConstraint"> + <enum>QLayout::SetDefaultConstraint</enum> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>Enter a new shortcut by double clicking on the related row.</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <property name="topMargin"> + <number>0</number> + </property> + <item> + <widget class="QTreeWidget" name="shortcuts_treewidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="sizeIncrement"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="baseSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="animated"> + <bool>false</bool> + </property> + <property name="allColumnsShowFocus"> + <bool>false</bool> + </property> + <property name="headerHidden"> + <bool>false</bool> + </property> + <property name="columnCount"> + <number>3</number> + </property> + <attribute name="headerCascadingSectionResizes"> + <bool>false</bool> + </attribute> + <attribute name="headerDefaultSectionSize"> + <number>120</number> + </attribute> + <attribute name="headerHighlightSections"> + <bool>false</bool> + </attribute> + <attribute name="headerMinimumSectionSize"> + <number>64</number> + </attribute> + <attribute name="headerStretchLastSection"> + <bool>true</bool> + </attribute> + <column> + <property name="text"> + <string>Action</string> + </property> + </column> + <column> + <property name="text"> + <string>Default Shortcut</string> + </property> + <property name="textAlignment"> + <set>AlignLeft|AlignVCenter</set> + </property> + </column> + <column> + <property name="text"> + <string>Actual Shortcut</string> + </property> + <property name="textAlignment"> + <set>AlignLeft|AlignVCenter</set> + </property> + </column> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> <widget class="QWidget" name="tab_network"> <attribute name="title"> <string>Network</string>