Mercurial > octave-nkf
diff libgui/src/main-window.cc @ 18155:14acb08d75fa gui-release
gui: optionally set focus to console when a command is run from another widget
* settings-dialog.ui: new checkbox for focus switching to console
* settings-dialog.cc (constructor): read new setting and init check box,
(write_changed_settings): write state from check box into settings file
* main-window.cc (focus_console_after_command): new functions checking
settings file for new settings,
(execute_command_in_terminal): focus console if desired,
(run_file_in_terminal): focus console if desired
* main-window.h: new function focus_console_after_command
author | Torsten <ttl@justmail.de> |
---|---|
date | Fri, 20 Dec 2013 16:13:20 +0100 |
parents | a829f40933a8 |
children | c26f44818eed |
line wrap: on
line diff
--- a/libgui/src/main-window.cc Thu Dec 19 17:32:38 2013 -0800 +++ b/libgui/src/main-window.cc Fri Dec 20 16:13:20 2013 +0100 @@ -241,17 +241,27 @@ octave_link::post_event (this, &main_window::clear_history_callback); } +bool +main_window::focus_console_after_command () +{ + QSettings *settings = resource_manager::get_settings (); + return settings->value ("terminal/focus_after_command",false).toBool (); +} + void main_window::execute_command_in_terminal (const QString& command) { queue_command (command); - focus_command_window (); + if (focus_console_after_command ()) + focus_command_window (); } void main_window::run_file_in_terminal (const QFileInfo& info) { octave_link::post_event (this, &main_window::run_file_callback, info); + if (focus_console_after_command ()) + focus_command_window (); } void