comparison libgui/src/main-window.cc @ 16431:5982d469f79b

use signal for setting, appending to, and clearing history widget * history-dockwidget.h, history-dockwidget.cc (history_dock_widget::request_history_model_update, history_dock_widget::reset_model, history_dock_widget::update_history_callback): Delete. (history_dock_widget::set_history, history_dock_widget::append_history, history_dock_widget::clear_history): New functions. * main-window.h, main-window.cc (main_window::update_history): Delete. (main_window::construct): Delete connection from _octave_qt_event_listener::update_history_signal to main_window::update_history. Connect _octave_qt_link::set_history_signal to _history_dock_widget::set_history. Connect _octave_qt_link::append_history_signal to _history_dock_widget::append_history. Connect _octave_qt_link::clear_history_signal to _history_dock_widget::clear_history. (main_window::clear_history_callback): Call Fhistory instead of command_history::clear and _history_dock_widget->reset_model. * octave-main-thread.cc (octave_main_thread::run): Don't call octave_link::update_history. * octave-qt-event-listener.h, octave-qt-event-listener.cc (octave_qt_event_listener::update_history): Delete. (octave_qt_event_listener::update_history_signal): Delete. * octave-qt-link.h, octave-qt-link.cc (octave_qt_link::do_update_history): Delete. (octave_qt_link::do_set_history,octave_qt_link::do_append_history, octave_qt_link::do_clear_history): New functions. (octave_qt_link::do_post_input_event): Don't call do_update_history. (set_history_signal, append_history_signal, clear_history_signal): New signals. * octave-event-listener.h (octave_event_listener::update_history): Delete. * input.cc (octave_base_reader::octave_gets): Call command_history::add. * oct-hist.cc (do_history): New option, -c. Call octave_link history functions as needed. (initialize_history): Call octave_link::set_history. (octave_history_write_timestamp): Call octave_link::append_history. (Fedit_history): Document -c. * octave-link.h (octave_link::update_history, octave_link::do_update_history): Delete. (octave_link::set_history, octave_link::append_history, octave_link::clear_history, octave_link::do_set_history, octave_link::do_append_history, octave_link::do_clear_history, octave_link::do_pre_input_event, octave_link::do_post_input_event): New functions.
author John W. Eaton <jwe@octave.org>
date Thu, 04 Apr 2013 13:20:43 -0400
parents 203976ae18d1
children fe4cd846c3e7
comparison
equal deleted inserted replaced
16430:1766d8655006 16431:5982d469f79b
154 { 154 {
155 octave_link::post_event (this, &main_window::clear_workspace_callback); 155 octave_link::post_event (this, &main_window::clear_workspace_callback);
156 } 156 }
157 157
158 void 158 void
159 main_window::handle_clear_history_request() 159 main_window::handle_clear_history_request (void)
160 { 160 {
161 octave_link::post_event (this, &main_window::clear_history_callback); 161 octave_link::post_event (this, &main_window::clear_history_callback);
162 } 162 }
163 163
164 void 164 void
284 284
285 void 285 void
286 main_window::update_workspace (void) 286 main_window::update_workspace (void)
287 { 287 {
288 _workspace_view->model_changed (); 288 _workspace_view->model_changed ();
289 }
290
291 void
292 main_window::update_history (void)
293 {
294 _history_dock_widget->update_history_callback ();
295 } 289 }
296 290
297 void 291 void
298 main_window::change_current_working_directory () 292 main_window::change_current_working_directory ()
299 { 293 {
1143 SIGNAL (update_workspace_signal ()), 1137 SIGNAL (update_workspace_signal ()),
1144 this, 1138 this,
1145 SLOT (update_workspace ())); 1139 SLOT (update_workspace ()));
1146 1140
1147 connect (_octave_qt_event_listener, 1141 connect (_octave_qt_event_listener,
1148 SIGNAL (update_history_signal ()),
1149 this,
1150 SLOT (update_history ()));
1151
1152 connect (_octave_qt_event_listener,
1153 SIGNAL (entered_debug_mode_signal ()), 1142 SIGNAL (entered_debug_mode_signal ()),
1154 this, 1143 this,
1155 SLOT(handle_entered_debug_mode ())); 1144 SLOT(handle_entered_debug_mode ()));
1156 1145
1157 connect (_octave_qt_event_listener, 1146 connect (_octave_qt_event_listener,
1162 // FIXME -- is it possible to eliminate the event_listenter? 1151 // FIXME -- is it possible to eliminate the event_listenter?
1163 1152
1164 _octave_qt_link = new octave_qt_link (); 1153 _octave_qt_link = new octave_qt_link ();
1165 1154
1166 connect (_octave_qt_link, 1155 connect (_octave_qt_link,
1156 SIGNAL (set_history_signal (const QStringList&)),
1157 _history_dock_widget, SLOT (set_history (const QStringList&)));
1158
1159 connect (_octave_qt_link,
1160 SIGNAL (append_history_signal (const QString&)),
1161 _history_dock_widget, SLOT (append_history (const QString&)));
1162
1163 connect (_octave_qt_link,
1164 SIGNAL (clear_history_signal (void)),
1165 _history_dock_widget, SLOT (clear_history (void)));
1166
1167 connect (_octave_qt_link,
1167 SIGNAL (update_dbstop_marker_signal (bool, const QString&, int)), 1168 SIGNAL (update_dbstop_marker_signal (bool, const QString&, int)),
1168 _file_editor, 1169 _file_editor,
1169 SLOT (handle_update_dbstop_marker_request (bool, const QString&, int))); 1170 SLOT (handle_update_dbstop_marker_request (bool, const QString&, int)));
1170 1171
1171 connect (_octave_qt_link, 1172 connect (_octave_qt_link,
1207 } 1208 }
1208 1209
1209 void 1210 void
1210 main_window::clear_history_callback (void) 1211 main_window::clear_history_callback (void)
1211 { 1212 {
1212 command_history::clear (); 1213 Fhistory (ovl ("-c"));
1213
1214 _history_dock_widget->reset_model ();
1215 } 1214 }
1216 1215
1217 void 1216 void
1218 main_window::change_directory_callback (const std::string& directory) 1217 main_window::change_directory_callback (const std::string& directory)
1219 { 1218 {