[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdewebdev/quanta/components/debugger
From:       Linus McCabe <Linus () mccabe ! nu>
Date:       2005-08-24 21:08:31
Message-ID: 1124917711.675204.24942.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 452984 by linusmc:

Fixed crash when rightclicking on watch.
Enabled dumping for children



 M  +20 -1     debuggervariable.cpp  
 M  +2 -0      debuggervariable.h  
 M  +19 -16    variableslistview.cpp  
 M  +1 -1      variableslistview.h  


--- branches/KDE/3.5/kdewebdev/quanta/components/debugger/debuggervariable.cpp #452983:452984
@@ -71,12 +71,14 @@
     : m_item(NULL)
 {
   m_name = v->name();
-  m_valueList = v->values();
   m_size = m_valueList.count();
   m_value = v->value();
   m_type = v->type();
   m_isReference = v->isReference();
 
+  // We cant just assign m_valuelist to v->values(), it would make a shallow copy...
+  for(DebuggerVariable * v2 = v->values().first(); v2; v2 = v->values().next())
+    m_valueList.append(new DebuggerVariable(v2));
 }
 
 
@@ -217,3 +219,20 @@
     delete m_item;
 
 }
+
+DebuggerVariable* DebuggerVariable::findItem( QListViewItem * item, bool traverse )
+{
+  if(item == m_item)
+    return this;
+  
+  if(!traverse)
+    return NULL;
+  
+  for(DebuggerVariable * v = m_valueList.first(); v; v = m_valueList.next())
+  {
+    DebuggerVariable * v2 = v->findItem(item, true);
+    if(v2)
+      return v2;
+  }
+  return NULL;
+}
--- branches/KDE/3.5/kdewebdev/quanta/components/debugger/debuggervariable.h #452983:452984
@@ -54,6 +54,8 @@
     DebuggerVariable(const QString& name, const ValueList_t& values, int type);
     virtual ~DebuggerVariable();
 
+    DebuggerVariable* findItem(QListViewItem *item, bool traverse = false);
+    
     virtual void setName(const QString& name);
     virtual QString name() const;
 
--- branches/KDE/3.5/kdewebdev/quanta/components/debugger/variableslistview.cpp #452983:452984
@@ -75,19 +75,19 @@
 VariablesListView::~VariablesListView()
 {}
 
-DebuggerVariable* VariablesListView::selected()
+DebuggerVariable* VariablesListView::selected(bool traverse)
 {
   if(!selectedItem())
     return NULL;
 
-  DebuggerVariable* v;
+  DebuggerVariable* v, *found;
   for( v = m_variablesList.first(); v; v = m_variablesList.next())
   {
-    if(v->item() == selectedItem())
-    {
-      return v;
-    }
+    found = v->findItem(selectedItem(), traverse);
+    if(found)
+      return found;
   }
+  
   return NULL;
 }
 
@@ -242,10 +242,14 @@
   if(!selectedItem())
     return;
 
-  DebuggerVariable v(selected());
-  m_variablePopup->setItemEnabled(dumpValue, v.type() == DebuggerVariableTypes::String);
-  
-  m_variablePopup->exec(point);
+  m_variablePopup->setItemEnabled(removeWatch, selected());
+  if(quantaApp->debugger()->client()->supports(DebuggerClientCapabilities::VariableSetValue))
+    m_variablePopup->setItemEnabled(setValue, selected());
+
+  DebuggerVariable *v = selected(true);
+  m_variablePopup->setItemEnabled(dumpValue, v && v->type() == DebuggerVariableTypes::String);
+
+  m_variablePopup->popup(point);
 }
 
 void VariablesListView::slotVariableSetValue()
@@ -283,16 +287,15 @@
 
 void VariablesListView::slotVariableDump( )
 {
-  if(!selected())
+  DebuggerVariable *v = selected(true);
+  if(!v)
     return;
 
-  DebuggerVariable v(selected());
+  quantaApp->messageOutput()->showMessage(i18n("Contents of variable %1:\n>>>\n").arg(v->name()));
+  quantaApp->messageOutput()->showMessage(v->value());
+  quantaApp->messageOutput()->showMessage("<<<\n");
   
-  quantaApp->messageOutput()->showMessage(i18n("Contents of variable %1:\n>>>\n").arg(v.name()));
-  quantaApp->messageOutput()->showMessage(v.value());
-  quantaApp->messageOutput()->showMessage("\n<<<\n");
   
-  
 }
 
 #include "variableslistview.moc"
--- branches/KDE/3.5/kdewebdev/quanta/components/debugger/variableslistview.h #452983:452984
@@ -45,7 +45,7 @@
 
     void setVariables(const QPtrList<DebuggerVariable>& vars);
     void addVariable(DebuggerVariable* variable);
-    DebuggerVariable* selected();
+    DebuggerVariable* selected(bool traverse = false);
 
     void clear();
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic