changeset 13520:17bb8974577b

Repaired history list.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Tue, 19 Jul 2011 23:06:57 +0200
parents 35ecb6063c7b
children 16b33b7ef1b3
files gui/src/OctaveLink.cpp gui/src/OctaveLink.h
diffstat 2 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/gui/src/OctaveLink.cpp
+++ b/gui/src/OctaveLink.cpp
@@ -23,10 +23,9 @@
 // Born July 13, 2007.
 
 #include "OctaveLink.h"
+#include <QDebug>
 
-OctaveLink
-  OctaveLink::m_singleton;
-
+OctaveLink OctaveLink::m_singleton;
 
 OctaveLink::OctaveLink ():QObject ()
 {
@@ -136,7 +135,7 @@
 OctaveLink::updateHistoryModel ()
 {
   // Determine the client's (our) history length and the one of the server.
-  int clientHistoryLength = m_history.length ();
+  int clientHistoryLength = m_historyModel->rowCount ();
   int serverHistoryLength = command_history::length ();
 
   // If were behind the server, iterate through all new entries and add them to our history.
@@ -144,12 +143,10 @@
     {
       for (int i = clientHistoryLength; i < serverHistoryLength; i++)
         {
-          m_history.insert (0, QString (command_history::get_entry (i).c_str ()));
+          m_historyModel->insertRow (0);
+          m_historyModel->setData (m_historyModel->index (0), QString (command_history::get_entry (i).c_str ()));
         }
     }
-
-  // Update the model by setting the new history.
-  m_historyModel->setStringList (m_history);
 }
 
 QStringListModel *
--- a/gui/src/OctaveLink.h
+++ b/gui/src/OctaveLink.h
@@ -138,7 +138,6 @@
 
   /** History related member variables. */
   QStringListModel *m_historyModel;
-  QStringList m_history;
 
   static OctaveLink m_singleton;
 };