branches/kdevelop/3.4/languages/cpp/debugger

Andreas Pakulat apaku at gmx.de
Thu Dec 21 00:49:21 UTC 2006


SVN commit 615311 by apaku:

Don't use hardcoded colors, this messes up KDE styling.

Volodya: If you think you really need 2 colors in the listview, lets discuss
this on the list and see what color role may fit the purpose.

BUG: 81278
CCMAIL: kdevelop-devel at kdevelop.org


 M  +29 -66    framestackwidget.cpp  
 M  +7 -16     framestackwidget.h  


--- branches/kdevelop/3.4/languages/cpp/debugger/framestackwidget.cpp #615310:615311
@@ -38,7 +38,7 @@
 {
 
 FramestackWidget::FramestackWidget(GDBController* controller,
-                                   QWidget *parent, 
+                                   QWidget *parent,
                                    const char *name, WFlags f)
         : QListView(parent, name, f),
           viewedThread_(0),
@@ -129,7 +129,7 @@
 {
     switch(e)
     {
-        case GDBController::program_state_changed: 
+        case GDBController::program_state_changed:
 
             kdDebug(9012) << "Clearning framestack\n";
             clear();
@@ -139,17 +139,17 @@
                                this, &FramestackWidget::handleThreadList));
 
             break;
-            
 
-         case GDBController::thread_or_frame_changed: 
 
+         case GDBController::thread_or_frame_changed:
+
              if (viewedThread_)
              {
                  // For non-threaded programs frame switch is no-op
                  // as far as framestack is concerned.
                  // FIXME: but need to highlight the current frame.
-                 
-                 if (ThreadStackItem* item 
+
+                 if (ThreadStackItem* item
                      = findThread(controller_->currentThread()))
                  {
                      viewedThread_ = item;
@@ -164,12 +164,12 @@
 
             break;
 
-        case GDBController::program_exited: 
-        case GDBController::debugger_exited: 
+        case GDBController::program_exited:
+        case GDBController::debugger_exited:
         {
             clear();
             break;
-        }        
+        }
         case GDBController::debugger_busy:
         case GDBController::debugger_ready:
         case GDBController::shared_library_loaded:
@@ -186,8 +186,8 @@
 
     controller_->addCommand(
         new GDBCommand(QString("-stack-info-depth %1").arg(max_frame+1),
-                       this, 
-                       &FramestackWidget::handleStackDepth));        
+                       this,
+                       &FramestackWidget::handleStackDepth));
 }
 
 void FramestackWidget::handleStackDepth(const GDBMI::ResultRecord& r)
@@ -202,7 +202,7 @@
     controller_->addCommandToFront(
         new GDBCommand(QString("-stack-list-frames %1 %2")
                        .arg(minFrame_).arg(maxFrame_),
-                       this, &FramestackWidget::parseGDBBacktraceList));    
+                       this, &FramestackWidget::parseGDBBacktraceList));
 }
 
 void FramestackWidget::getBacktraceForThread(int threadNo)
@@ -217,7 +217,7 @@
 
         viewedThread_ = findThread(threadNo);
     }
-    
+
     getBacktrace();
 
     if (viewedThread_)
@@ -231,11 +231,11 @@
 
 void FramestackWidget::handleThreadList(const GDBMI::ResultRecord& r)
 {
-    // Gdb reply is: 
+    // Gdb reply is:
     //  ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
     // which syntactically is a tuple, but one has to access it
     // by index anyway.
-    const GDBMI::TupleValue& ids = 
+    const GDBMI::TupleValue& ids =
         dynamic_cast<const GDBMI::TupleValue&>(r["thread-ids"]);
 
     if (ids.results.size() > 1)
@@ -244,14 +244,14 @@
         // Note that this sequence of command will be executed in strict
         // sequences, so no other view can add its command in between and
         // get state for a wrong thread.
-                        
+
         // Really threaded program.
         for(unsigned i = 0, e = ids.results.size(); i != e; ++i)
         {
             QString id = ids.results[i]->value->literal();
 
             controller_->addCommand(
-                new GDBCommand(QString("-thread-select %1").arg(id).ascii(), 
+                new GDBCommand(QString("-thread-select %1").arg(id).ascii(),
                                this, &FramestackWidget::handleThread));
         }
 
@@ -261,7 +261,7 @@
     }
 
     // Get backtrace for the current thread. We need to do this
-    // here, and not in event handler for program_state_changed, 
+    // here, and not in event handler for program_state_changed,
     // viewedThread_ is initialized by 'handleThread' before
     // backtrace handler is called.
     getBacktrace();
@@ -276,7 +276,7 @@
     QString func_column;
     QString args_column;
     QString source_column;
-    
+
     formatFrame(r["frame"], func_column, source_column);
 
     ThreadStackItem* thread = new ThreadStackItem(this, id_num);
@@ -298,7 +298,7 @@
     if (!r.hasField("stack"))
         return;
 
-    const GDBMI::Value& frames = r["stack"];    
+    const GDBMI::Value& frames = r["stack"];
 
     if (frames.empty())
         return;
@@ -306,7 +306,7 @@
     Q_ASSERT(dynamic_cast<const GDBMI::ListValue*>(&frames));
 
     // Remove "..." item, if there's one.
-    QListViewItem* last;    
+    QListViewItem* last;
     if (viewedThread_)
     {
         last = viewedThread_->firstChild();
@@ -314,7 +314,7 @@
             while(last->nextSibling())
                 last = last->nextSibling();
     }
-    else 
+    else
     {
         last = lastItem();
     }
@@ -325,7 +325,7 @@
     for(unsigned i = 0, e = frames.size(); i != e; ++i)
     {
         const GDBMI::Value& frame = frames[i];
-      
+
         // For now, just produce string simular to gdb
         // console output. In future we might have a table,
         // or something better.
@@ -341,7 +341,7 @@
         name_column = "#" + level_s;
 
         formatFrame(frame, func_column, source_column);
-        
+
         FrameStackItem* item;
         if (viewedThread_)
             item = new FrameStackItem(viewedThread_, level, name_column);
@@ -350,7 +350,7 @@
         lastLevel = level;
 
         item->setText(1, func_column);
-        item->setText(2, source_column);        
+        item->setText(2, source_column);
     }
     if (has_more_frames)
     {
@@ -452,25 +452,11 @@
     }
 }
 
-
-void FramestackWidget::drawContentsOffset( QPainter * p, int ox, int oy,
-                                           int cx, int cy, int cw, int ch )
-{
-    QListView::drawContentsOffset(p, ox, oy, cx, cy, cw, ch);
-
-    int s1_x = header()->sectionPos(1);
-    int s1_w = header()->sectionSize(1);
-
-    QRect section1(s1_x, contentsHeight(), s1_w, viewport()->height());
-
-    p->fillRect(section1, QColor("#e4f4fe"));
-}
-
 // **************************************************************************
 // **************************************************************************
 // **************************************************************************
 
-FrameStackItem::FrameStackItem(FramestackWidget *parent, 
+FrameStackItem::FrameStackItem(FramestackWidget *parent,
                                unsigned frameNo,
                                const QString &name)
         : QListViewItem(parent, parent->lastChild()),
@@ -482,7 +468,7 @@
 
 // **************************************************************************
 
-FrameStackItem::FrameStackItem(ThreadStackItem *parent, 
+FrameStackItem::FrameStackItem(ThreadStackItem *parent,
                                unsigned frameNo,
                                const QString &name)
         : QListViewItem(parent, parent->lastChild()),
@@ -512,7 +498,7 @@
 // **************************************************************************
 
 void FrameStackItem::setOpen(bool open)
-{    
+{
 #if 0
     if (open)
     {
@@ -569,7 +555,7 @@
 
         // Imagine you have 20 frames and you want to find one blocked on
         // mutex. You don't want a new source file to be opened for each
-        // thread you open to find if that's the one you want to debug.        
+        // thread you open to find if that's the one you want to debug.
         ((FramestackWidget*)listView())->getBacktraceForThread(threadNo());
     }
 
@@ -589,31 +575,8 @@
     QListViewItem::setOpen(open);
 }
 
-void FrameStackItem::paintCell(QPainter * p, const QColorGroup & cg, 
-                               int column, int width, int align )
-{
-    QColorGroup cg2(cg);
-    if (column % 2)
-    {
-        cg2.setColor(QColorGroup::Base, QColor("#e4f4fe"));
-    }
-    QListViewItem::paintCell(p, cg2, column, width, align);
 }
 
-void ThreadStackItem::paintCell(QPainter * p, const QColorGroup & cg, 
-                               int column, int width, int align )
-{
-    QColorGroup cg2(cg);
-    if (column % 2)
-    {
-        cg2.setColor(QColorGroup::Base, QColor("#e4f4fe"));
-    }
-    QListViewItem::paintCell(p, cg2, column, width, align);
-}
-
-
-}
-
 /***************************************************************************/
 /***************************************************************************/
 /***************************************************************************/
--- branches/kdevelop/3.4/languages/cpp/debugger/framestackwidget.h #615310:615311
@@ -33,15 +33,13 @@
 class ThreadStackItem : public QListViewItem
 {
 public:
-    ThreadStackItem(FramestackWidget *parent, 
+    ThreadStackItem(FramestackWidget *parent,
                     unsigned threadNo);
     virtual ~ThreadStackItem();
 
     void setOpen(bool open);
     QListViewItem *lastChild() const;
 
-    void paintCell(QPainter * p, const QColorGroup & cg, 
-                   int column, int width, int align );
 
     int threadNo()
     { return threadNo_; }
@@ -59,10 +57,10 @@
 class FrameStackItem : public QListViewItem
 {
 public:
-    FrameStackItem(FramestackWidget *parent, 
+    FrameStackItem(FramestackWidget *parent,
                    unsigned frameNo,
                    const QString &name);
-    FrameStackItem(ThreadStackItem *parent, 
+    FrameStackItem(ThreadStackItem *parent,
                    unsigned frameNo,
                    const QString &name);
     virtual ~FrameStackItem();
@@ -70,8 +68,6 @@
     void setOpen(bool open);
     QListViewItem *lastChild() const;
 
-    void paintCell(QPainter * p, const QColorGroup & cg, 
-                   int column, int width, int align );
 
     int frameNo()
     { return frameNo_; }
@@ -95,25 +91,20 @@
 
 public:
     FramestackWidget( GDBController* controller,
-                      QWidget *parent=0,                       
+                      QWidget *parent=0,
                       const char *name=0, WFlags f=0 );
     virtual ~FramestackWidget();
 
     QListViewItem *lastChild() const;
-   
+
     ThreadStackItem *findThread(int threadNo);
     FrameStackItem *findFrame(int frameNo, int threadNo);
 
     int viewedThread()
     { return viewedThread_ ? viewedThread_->threadNo() : -1; }
 
-protected:
 
-    void drawContentsOffset( QPainter * p, int ox, int oy,
-                             int cx, int cy, int cw, int ch );
 
-
-
 private:
     /** Given gdb's 'frame' information, compute decent
         textual representation for display.
@@ -124,7 +115,7 @@
                      QString& func_column,
                      QString& source_column);
 
-    /** Cause gdb to produce backtrace for the current thread. 
+    /** Cause gdb to produce backtrace for the current thread.
 
         GDB reply will be route to parseArg and parseGDBBacktraceList,
         and will show up under viewedThread_ (if there are threads), or
@@ -137,7 +128,7 @@
 
         Switches viewedThread_ to the specified thread, switches gdb thread,
         call getBacktrace(), and switches the current thread back.
-    */        
+    */
     void getBacktraceForThread(int threadNo);
     friend class ThreadStackItem;
 




More information about the KDevelop-devel mailing list