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

List:       kde-commits
Subject:    KDE/kdevelop/languages/cpp/debugger
From:       Vladimir Prus <ghost () cs ! msu ! su>
Date:       2008-04-19 10:55:59
Message-ID: 1208602559.216978.10795.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 798756 by vprus:

Report breakpoint errors from GDB.  Never insert breakpoints after the special item.


 M  +14 -10    breakpointcontroller.cpp  
 M  +5 -1      breakpointcontroller.h  
 M  +27 -0     breakpointwidget.h  
 M  +11 -0     util/treeitem.cpp  
 M  +2 -0      util/treeitem.h  


--- trunk/KDE/kdevelop/languages/cpp/debugger/breakpointcontroller.cpp #798755:798756
@@ -386,7 +386,9 @@
     {
         errors_.insert(location_column);
         dirty_.remove(location_column);
-        reportChange();
+        reportChange();        
+        emit static_cast<Breakpoints*>(parentItem)
+            ->error(this, r["msg"].literal(), location_column);
     }
     else
     {
@@ -420,6 +422,8 @@
         errors_.insert(condition_column);
         dirty_.remove(condition_column);
         reportChange();
+        emit static_cast<Breakpoints*>(parentItem)
+            ->error(this, r["msg"].literal(), condition_column);
     }
     else
     {
@@ -438,6 +442,8 @@
         errors_.insert(location_column);
         dirty_.remove(location_column);
         reportChange();
+        emit static_cast<Breakpoints*>(parentItem)
+            ->error(this, r["msg"].literal(), location_column);
     }
     else
     {
@@ -489,7 +495,7 @@
 {
     NewBreakpoint* n = new NewBreakpoint(model(), this, controller_,
                                          NewBreakpoint::code_breakpoint);
-    appendChild(n);
+    insertChild(childItems.size()-1, n);
     return n;
 }
 
@@ -497,7 +503,7 @@
 {
     NewBreakpoint* n = new NewBreakpoint(model(), this, controller_,
                                          NewBreakpoint::write_breakpoint);
-    appendChild(n);
+    insertChild(childItems.size()-1, n);
     return n;
 }
 
@@ -505,7 +511,8 @@
 {
     NewBreakpoint* n = new NewBreakpoint(model(), this, controller_,
                                          NewBreakpoint::read_breakpoint);
-    appendChild(n);
+    insertChild(childItems.size()-1, n);
+
     return n;
 }
 
@@ -653,11 +660,6 @@
     // a base class that does this connect.
     connect(parent,     SIGNAL(event(event_t)),
             this,       SLOT(slotEvent(event_t)));
-
-    /* Note that the connection is queued. */
-    connect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
-            this, SLOT(slotDataChanged(const QModelIndex&, const QModelIndex&)),
-            Qt::QueuedConnection);
 }
 
 void BreakpointController::slotPartAdded(KParts::Part* part)
@@ -754,7 +756,9 @@
 {
     clearExecutionPoint();
     kDebug(9012) << "gotoExecutionPoint";
-    KDevelop::IDocument* document = KDevelop::ICore::self()->documentController()->openDocument(url, \
KTextEditor::Cursor(lineNum, 0)); +    KDevelop::IDocument* document = KDevelop::ICore::self()
+        ->documentController()
+        ->openDocument(url, KTextEditor::Cursor(lineNum, 0));
 
     if( !document )
         return;
--- trunk/KDE/kdevelop/languages/cpp/debugger/breakpointcontroller.h #798755:798756
@@ -134,8 +134,12 @@
 
     NewBreakpoint *breakpointById(int id);
 
-    void createHelperBreakpoint();                                     
+    void createHelperBreakpoint();
 
+Q_SIGNALS:
+    void error(NewBreakpoint *b, const QString& message, int column);
+    friend class NewBreakpoint;                                                        
+
 public slots:
     void save();
     void load();
--- trunk/KDE/kdevelop/languages/cpp/debugger/breakpointwidget.h #798755:798756
@@ -20,6 +20,7 @@
 
 #include <klocale.h>
 #include <KIcon>
+#include <KPassivePopup>
 
 #include "kdebug.h"
 
@@ -196,6 +197,11 @@
 
             connect(controller, SIGNAL(breakpointHit(int)),
                     this, SLOT(slotBreakpointHit(int)));
+
+            connect(controller->breakpoints()->breakpointsItem(),
+                    SIGNAL(error(NewBreakpoint *, const QString&, int)),
+                    this,
+                    SLOT(breakpointError(NewBreakpoint *, const QString&, int)));
             
             setupPopupMenu();
         }
@@ -429,6 +435,27 @@
                     controller_->breakpoints()->itemForIndex(index)));            
         }
 
+        void breakpointError(NewBreakpoint *b, const QString& msg, int column)
+        {
+            // FIXME: we probably should prevent this error notification during 
+            // initial setting of breakpoint, to avoid a cloud of popups.
+            if (!table_->isVisible())
+                return;
+
+            QModelIndex index = controller_->breakpoints()
+                ->indexForItem(b, column);
+            QPoint p = table_->visualRect(index).topLeft();
+            p = table_->mapToGlobal(p);
+            
+            KPassivePopup *pop = new KPassivePopup(table_);
+            pop->setPopupStyle(KPassivePopup::Boxed);
+            pop->setAutoDelete(true);
+            // FIXME: the the icon, too.
+            pop->setView("", msg);            
+            pop->setTimeout(-1);
+            pop->show(p);
+        }
+
     private:
         QTableView* table_;
         BreakpointDetails* details_;
--- trunk/KDE/kdevelop/languages/cpp/debugger/util/treeitem.cpp #798755:798756
@@ -58,6 +58,17 @@
         model_->endInsertRows();
 }
 
+void TreeItem::insertChild(int position, TreeItem *child, bool initial)
+{
+    QModelIndex index = model_->indexForItem(this, 0);
+
+    if (!initial)
+        model_->beginInsertRows(index, position, position);
+    childItems.insert(position, child);
+    if (!initial)
+        model_->endInsertRows();    
+}
+
 void TreeItem::reportChange()
 {
     QModelIndex index = model_->indexForItem(this, 0);
--- trunk/KDE/kdevelop/languages/cpp/debugger/util/treeitem.h #798755:798756
@@ -44,6 +44,8 @@
         Clears the "hasMore" flag.  */
     void appendChild(TreeItem *child, bool initial = false);
 
+    void insertChild(int position, TreeItem *child, bool initial = false);
+
     void removeChild(int index);
 
     void removeSelf();


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

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