# HG changeset patch
# User John W. Eaton
# Date 1363766854 14400
# Node ID ad898efeb05d9652e77b50c43a80c51ebe88d06e
# Parent 057a20aec814edeeb224924b20490e51f2a88624
imported patch history-timer
diff --git a/libgui/src/history-dockwidget.cc b/libgui/src/history-dockwidget.cc
--- a/libgui/src/history-dockwidget.cc
+++ b/libgui/src/history-dockwidget.cc
@@ -77,17 +77,6 @@
connect (_history_list_view, SIGNAL (doubleClicked (QModelIndex)),
this, SLOT (handle_double_click (QModelIndex)));
- _update_event_enabled = true;
- _update_history_model_timer.setInterval (500);
- _update_history_model_timer.setSingleShot (false);
-
- connect (&_update_history_model_timer,
- SIGNAL (timeout ()),
- this,
- SLOT (request_history_model_update ()));
-
- _update_history_model_timer.start ();
-
setFocusProxy (_filter_line_edit);
}
@@ -133,11 +122,7 @@
void
history_dock_widget::request_history_model_update ()
{
- if (_update_event_enabled)
- {
- _update_event_enabled = false; // no more update until this one is processed
- octave_link::post_event (this, &history_dock_widget::update_history_callback);
- }
+ octave_link::post_event (this, &history_dock_widget::update_history_callback);
}
void
@@ -185,8 +170,4 @@
_history_list_view->scrollToBottom ();
}
-
- // update is processed, re-enable further updates events triggered by timer
- _update_event_enabled = true;
-
}
diff --git a/libgui/src/history-dockwidget.h b/libgui/src/history-dockwidget.h
--- a/libgui/src/history-dockwidget.h
+++ b/libgui/src/history-dockwidget.h
@@ -27,7 +27,6 @@
#include
#include
#include
-#include
#include "octave-dock-widget.h"
class history_dock_widget : public octave_dock_widget
@@ -36,6 +35,8 @@
public:
history_dock_widget (QWidget *parent = 0);
+ void update_history_callback (void);
+
public slots:
void request_history_model_update ();
void reset_model ();
@@ -46,8 +47,6 @@
/** Emitted, whenever the user double-clicked a command in the history. */
void command_double_clicked (const QString& command);
-protected:
-
private slots:
void handle_double_click (QModelIndex modelIndex);
void handle_contextmenu_copy(bool flag);
@@ -62,11 +61,6 @@
/** Stores the current history_model. */
QStringListModel *_history_model;
-
- QTimer _update_history_model_timer;
-
- void update_history_callback (void);
- bool _update_event_enabled;
};
#endif // HISTORYDOCKWIDGET_H
diff --git a/libgui/src/main-window.cc b/libgui/src/main-window.cc
--- a/libgui/src/main-window.cc
+++ b/libgui/src/main-window.cc
@@ -306,6 +306,12 @@
}
void
+main_window::update_history (void)
+{
+ _history_dock_widget->update_history_callback ();
+}
+
+void
main_window::change_current_working_directory ()
{
QString directory =
@@ -1136,6 +1142,11 @@
SLOT (update_workspace ()));
connect (_octave_qt_event_listener,
+ SIGNAL (update_history_signal ()),
+ this,
+ SLOT (update_history ()));
+
+ connect (_octave_qt_event_listener,
SIGNAL (entered_debug_mode_signal ()),
this,
SLOT(handle_entered_debug_mode ()));
diff --git a/libgui/src/main-window.h b/libgui/src/main-window.h
--- a/libgui/src/main-window.h
+++ b/libgui/src/main-window.h
@@ -97,6 +97,7 @@
void reset_windows ();
void current_working_directory_has_changed (const QString& directory);
void update_workspace (void);
+ void update_history (void);
void change_current_working_directory ();
void set_current_working_directory (const QString& directory);
void current_working_directory_up ();
diff --git a/libgui/src/octave-adapter/octave-event-listener.h b/libgui/src/octave-adapter/octave-event-listener.h
--- a/libgui/src/octave-adapter/octave-event-listener.h
+++ b/libgui/src/octave-adapter/octave-event-listener.h
@@ -37,6 +37,9 @@
virtual void
update_workspace (void) = 0;
+ virtual void
+ update_history (void) = 0;
+
virtual void about_to_exit () = 0;
virtual void entered_debug_mode () = 0;
diff --git a/libgui/src/octave-adapter/octave-link.cc b/libgui/src/octave-adapter/octave-link.cc
--- a/libgui/src/octave-adapter/octave-link.cc
+++ b/libgui/src/octave-adapter/octave-link.cc
@@ -82,7 +82,10 @@
octave_link::do_generate_events (void)
{
if (event_listener)
- event_listener->update_workspace ();
+ {
+ event_listener->update_workspace ();
+ event_listener->update_history ();
+ }
std::string current_working_directory = octave_env::get_current_directory ();
diff --git a/libgui/src/octave-qt-event-listener.cc b/libgui/src/octave-qt-event-listener.cc
--- a/libgui/src/octave-qt-event-listener.cc
+++ b/libgui/src/octave-qt-event-listener.cc
@@ -46,6 +46,12 @@
}
void
+octave_qt_event_listener::update_history (void)
+{
+ emit update_history_signal ();
+}
+
+void
octave_qt_event_listener::about_to_exit ()
{
qApp->quit ();
diff --git a/libgui/src/octave-qt-event-listener.h b/libgui/src/octave-qt-event-listener.h
--- a/libgui/src/octave-qt-event-listener.h
+++ b/libgui/src/octave-qt-event-listener.h
@@ -36,6 +36,7 @@
void current_directory_has_changed (const std::string& directory);
void update_workspace (void);
+ void update_history (void);
void about_to_exit ();
void entered_debug_mode ();
@@ -44,6 +45,7 @@
signals:
void current_directory_has_changed_signal (const QString& directory);
void update_workspace_signal (void);
+ void update_history_signal (void);
void entered_debug_mode_signal ();
void quit_debug_mode_signal ();
};