Mercurial > hg > octave-nkf
diff libgui/src/m-editor/file-editor.cc @ 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 | ebd063b7b1c6 |
children | a827fc5fe59d |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -28,6 +28,8 @@ #include "file-editor.h" #include "resource-manager.h" +#include "shortcut-manager.h" + #include <QVBoxLayout> #include <QApplication> #include <QFile> @@ -1552,6 +1554,10 @@ { if (set) { + + shortcut_manager::set_shortcut (_save_action, "editor_file:save"); + shortcut_manager::set_shortcut (_save_as_action, "editor_file:save_as"); + _comment_selection_action->setShortcut (Qt::ControlModifier + Qt::Key_R); _uncomment_selection_action->setShortcut (Qt::SHIFT + Qt::ControlModifier @@ -1586,12 +1592,11 @@ _context_run_action->setShortcut (Qt::Key_F9); _context_edit_action->setShortcut (Qt::ControlModifier + Qt::Key_E); - _save_action->setShortcut (QKeySequence::Save); - _save_as_action->setShortcut (QKeySequence::SaveAs); _close_action->setShortcut (QKeySequence::Close); _redo_action->setShortcut (QKeySequence::Redo); _undo_action->setShortcut (QKeySequence::Undo); + } else {