Mercurial > hg > octave-lyh
diff gui/src/OctaveLink.cpp @ 13518:bace956a3724
Put history model part into OctaveLink.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Tue, 19 Jul 2011 15:53:43 +0200 |
parents | 86adc9c4ec4b |
children | 35ecb6063c7b |
line wrap: on
line diff
--- a/gui/src/OctaveLink.cpp +++ b/gui/src/OctaveLink.cpp @@ -32,6 +32,7 @@ { m_symbolTableSemaphore = new QSemaphore (1); m_historySemaphore = new QSemaphore (1); + m_historyModel = new QStringListModel (this); } OctaveLink::~OctaveLink () @@ -118,26 +119,6 @@ emit symbolTableChanged (); } - -void -OctaveLink::fetchHistory () -{ - int currentLen = command_history::length (); - if (currentLen != m_previousHistoryLength) - { - m_historySemaphore->acquire (); - for (int i = m_previousHistoryLength; i < currentLen; i++) - { - QString entry = QString(command_history::get_entry (i).c_str()); - if (!entry.startsWith ("#")) - m_historyBuffer.append (entry); - } - m_historySemaphore->release (); - m_previousHistoryLength = currentLen; - emit historyChanged (); - } -} - QList < SymbolRecord > OctaveLink::currentSymbolTable () { QList < SymbolRecord > m_symbolTableCopy; @@ -151,18 +132,36 @@ return m_symbolTableCopy; } -QStringList -OctaveLink::currentHistory () + +void +OctaveLink::updateHistoryModel () { - m_historySemaphore->acquire (); - QStringList historyBuffer = m_historyBuffer; - m_historySemaphore->release (); - return historyBuffer; + // TODO: Use the following code to update the history model. + /* + int currentLen = command_history::length (); + if (currentLen != m_previousHistoryLength) + { + m_historySemaphore->acquire (); + for (int i = m_previousHistoryLength; i < currentLen; i++) + { + QString entry = QString(command_history::get_entry (i).c_str()); + if (!entry.startsWith ("#")) + m_historyBuffer.append (entry); + } + m_historySemaphore->release (); + m_previousHistoryLength = currentLen; + } + */ +} + +QStringListModel * +OctaveLink::historyModel () +{ + return m_historyModel; } void OctaveLink::processOctaveServerData () { fetchSymbolTable (); - fetchHistory (); }