# HG changeset patch # User Jacob Dawid # Date 1302762404 -7200 # Node ID 73af3d75ddcd6023dfa28446192a8c9c276393b8 # Parent 785516f65f0ae1ca8a47ddad965a68feb226033b Variables now get assorted by scope. diff -r 785516f65f0a -r 73af3d75ddcd gui//src/VariablesDockWidget.cpp --- a/gui//src/VariablesDockWidget.cpp Thu Apr 14 08:14:20 2011 +0200 +++ b/gui//src/VariablesDockWidget.cpp Thu Apr 14 08:26:44 2011 +0200 @@ -57,9 +57,35 @@ } void VariablesDockWidget::setVariablesList(QList symbolTable) { + + // Split the symbol table into its different scopes. + QList localSymbolTable; + QList globalSymbolTable; + QList persistentSymbolTable; + + foreach(SymbolRecord symbolRecord, symbolTable) { + if(symbolRecord.is_local()) { + localSymbolTable.append(symbolRecord); + } + + if(symbolRecord.is_global()) { + globalSymbolTable.append(symbolRecord); + } + + if(symbolRecord.is_persistent()) { + persistentSymbolTable.append(symbolRecord); + } + } + + updateScope(0, localSymbolTable); + updateScope(1, globalSymbolTable); + updateScope(2, persistentSymbolTable); +} + +void VariablesDockWidget::updateScope(int topLevelItemIndex, QList symbolTable) { // This method may be a little bit confusing; variablesList is a complete list of all // variables that are in the workspace currently. - QTreeWidgetItem *topLevelItem = m_variablesTreeWidget->topLevelItem(0); + QTreeWidgetItem *topLevelItem = m_variablesTreeWidget->topLevelItem(topLevelItemIndex); // First we check, if any variables that exist in the model tree have to be updated // or created. So we walk the variablesList check against the tree. diff -r 785516f65f0a -r 73af3d75ddcd gui//src/VariablesDockWidget.h --- a/gui//src/VariablesDockWidget.h Thu Apr 14 08:14:20 2011 +0200 +++ b/gui//src/VariablesDockWidget.h Thu Apr 14 08:26:44 2011 +0200 @@ -9,12 +9,12 @@ { public: VariablesDockWidget(QWidget *parent = 0); - void setVariablesList(QList variablesList); + void setVariablesList(QList symbolTable); private: void construct(); void updateTreeEntry(QTreeWidgetItem *treeItem, SymbolRecord symbolRecord); - + void updateScope(int topLevelItemIndex, QList symbolTable); QTreeWidget *m_variablesTreeWidget; };