comparison libgui/src/m-editor/file-editor-tab.cc @ 19642:4b980842edba gui-release

clean up some signal-slot combinations in the editor * file-editor-tab.cc (contructor): remove connections of signals for command execution and for creating the context menu; (execute_command_in_terminal, create_context_menu): related slots removed * file-editor-tab.h: removed slots and signals that were emitted therein * file-editor.cc (add_file_editor_tab): connect edit area signals directly to the related slots without involving the editor tab
author Torsten <ttl@justmail.de>
date Thu, 22 Jan 2015 21:38:12 +0100
parents d258070914ef
children 8ef79bc61d8a
comparison
equal deleted inserted replaced
19641:18c213fa9b20 19642:4b980842edba
80 80
81 _file_name = directory; 81 _file_name = directory;
82 _file_system_watcher.setObjectName ("_qt_autotest_force_engine_poller"); 82 _file_system_watcher.setObjectName ("_qt_autotest_force_engine_poller");
83 83
84 _edit_area = new octave_qscintilla (this); 84 _edit_area = new octave_qscintilla (this);
85 // Connect signal for command execution to a slot of this tab which in turn 85
86 // emits a signal connected to the main window. 86 connect (_edit_area, SIGNAL (cursorPositionChanged (int, int)),
87 // Direct connection is not possible because tab's parent is null. 87 this, SLOT (handle_cursor_moved (int,int)));
88 connect (_edit_area, 88
89 SIGNAL (execute_command_in_terminal_signal (const QString&)),
90 this,
91 SLOT (execute_command_in_terminal (const QString&)));
92
93 connect (_edit_area,
94 SIGNAL (cursorPositionChanged (int, int)),
95 this,
96 SLOT (handle_cursor_moved (int,int)));
97
98 connect (_edit_area, SIGNAL (create_context_menu_signal (QMenu*)),
99 this, SLOT (create_context_menu (QMenu*)));
100 connect (_edit_area, SIGNAL (context_menu_edit_signal (const QString&)), 89 connect (_edit_area, SIGNAL (context_menu_edit_signal (const QString&)),
101 this, SLOT (handle_context_menu_edit (const QString&))); 90 this, SLOT (handle_context_menu_edit (const QString&)));
102 91
103 // create statusbar for row/col indicator and eol mode 92 // create statusbar for row/col indicator and eol mode
104 _status_bar = new QStatusBar (this); 93 _status_bar = new QStatusBar (this);
203 // closing this window 192 // closing this window
204 if (check_file_modified () == QMessageBox::Cancel) 193 if (check_file_modified () == QMessageBox::Cancel)
205 e->ignore (); 194 e->ignore ();
206 else 195 else
207 e->accept (); 196 e->accept ();
208 }
209
210 void
211 file_editor_tab::execute_command_in_terminal (const QString& command)
212 {
213 emit execute_command_in_terminal_signal (command); // connected to main window
214 } 197 }
215 198
216 void 199 void
217 file_editor_tab::handle_context_menu_edit (const QString& word_at_cursor) 200 file_editor_tab::handle_context_menu_edit (const QString& word_at_cursor)
218 { 201 {
2087 2070
2088 _row_indicator->setNum (line+1); 2071 _row_indicator->setNum (line+1);
2089 _col_indicator->setNum (col+1); 2072 _col_indicator->setNum (col+1);
2090 } 2073 }
2091 2074
2092 void
2093 file_editor_tab::create_context_menu (QMenu *menu)
2094 {
2095 emit create_context_menu_tab_signal (menu);
2096 }
2097
2098 QString 2075 QString
2099 file_editor_tab::get_function_name () 2076 file_editor_tab::get_function_name ()
2100 { 2077 {
2101 QRegExp rxfun1 ("^[\t ]*function[^=]+=([^\\(]+)\\([^\\)]*\\)[\t ]*$"); 2078 QRegExp rxfun1 ("^[\t ]*function[^=]+=([^\\(]+)\\([^\\)]*\\)[\t ]*$");
2102 QRegExp rxfun2 ("^[\t ]*function[\t ]+([^\\(]+)\\([^\\)]*\\)[\t ]*$"); 2079 QRegExp rxfun2 ("^[\t ]*function[\t ]+([^\\(]+)\\([^\\)]*\\)[\t ]*$");