List Info

Thread: branches/kdevelop/3.4/languages/cpp/debugger




branches/kdevelop/3.4/languages/cpp/debu gger
user name
2006-12-21 00:49:21
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-develkdevelop.org


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


---
branches/kdevelop/3.4/languages/cpp/debugger/framestackwidge
t.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
framestackn";
             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&
quot;,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(th
readNo());
     }
 
 -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/framestackwidge
t.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;
 

_______________________________________________
KDevelop-devel mailing list
KDevelop-develbarney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
formatting; stack view colors (Was: branches/kdevelop/3.4/languages/cpp/debu gger)
user name
2006-12-21 05:58:07
On Thursday 21 December 2006 03:49, Andreas Pakulat wrote:
> 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.

> ---
branches/kdevelop/3.4/languages/cpp/debugger/framestackwidge
t.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:


I don't think this change corresponds to the change log?
Would it be possible to
not change formatting, because next time I save this file
the formatting
will be automatically fixed back and we'll have yet another
huge commit.

> -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);
>  }

I *do* want different colors. What's the right way to grab
"alternative listview color"
from QPalette or KDE style? 

- Volodya

_______________________________________________
KDevelop-devel mailing list
KDevelop-develbarney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
formatting; stack view colors (Was: branches/kdevelop/3.4/languages/cpp/debu gger)
user name
2006-12-21 11:29:50
On 21.12.06 08:58:07, Vladimir Prus wrote:
> On Thursday 21 December 2006 03:49, Andreas Pakulat
wrote:
> > 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.
> 
> > ---
branches/kdevelop/3.4/languages/cpp/debugger/framestackwidge
t.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:
> 
> 
> I don't think this change corresponds to the change
log? Would it be possible to
> not change formatting, because next time I save this
file the formatting
> will be automatically fixed back and we'll have yet
another huge commit.

I wonder where that came from. I did not reformat any of
that code and I
don't think kate does this on its own. At least not on lines
I don't
touch. 

Also I found that kate-modelines don't really work, so I
guess I have to
use vim for any tab-indented files in the future :(

> > -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);
> >  }
> 
> I *do* want different colors. What's the right way to
grab "alternative listview color"
> >from QPalette or KDE style? 

You should fetch it from the palette. So I think you should
revert my
change (which also fixes the formatting ;) and then change
the code to
use one of the color roles from the QPalette.

Andreas

-- 
You can do very well in speculation where land or anything
to do with dirt
is concerned.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develbarney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
formatting; stack view colors (Was: branches/kdevelop/3.4/languages/cpp/debu gger)
user name
2006-12-21 16:41:25
On Thursday 21 December 2006 14:29, Andreas Pakulat wrote:
> On 21.12.06 08:58:07, Vladimir Prus wrote:
> > On Thursday 21 December 2006 03:49, Andreas
Pakulat wrote:
> > > 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.
> > 
> > > ---
branches/kdevelop/3.4/languages/cpp/debugger/framestackwidge
t.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:
> > 
> > 
> > I don't think this change corresponds to the
change log? Would it be possible to
> > not change formatting, because next time I save
this file the formatting
> > will be automatically fixed back and we'll have
yet another huge commit.
> 
> I wonder where that came from. I did not reformat any
of that code and I
> don't think kate does this on its own. At least not on
lines I don't
> touch. 
> 
> Also I found that kate-modelines don't really work, so
I guess I have to
> use vim for any tab-indented files in the future :(
> 
> > > -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);
> > >  }
> > 
> > I *do* want different colors. What's the right way
to grab "alternative listview color"
> > >from QPalette or KDE style? 
> 
> You should fetch it from the palette. So I think you
should revert my
> change (which also fixes the formatting ;) and then
change the code to
> use one of the color roles from the QPalette.

Except that I don't think that Qt3's QPalette has such a
color role. Any ideas?

- Volodya

_______________________________________________
KDevelop-devel mailing list
KDevelop-develbarney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
formatting; stack view colors (Was: branches/kdevelop/3.4/languages/cpp/debu gger)
user name
2006-12-21 17:18:48
On 21.12.06 19:41:25, Vladimir Prus wrote:
> On Thursday 21 December 2006 14:29, Andreas Pakulat
wrote:
> > You should fetch it from the palette. So I think
you should revert my
> > change (which also fixes the formatting ;) and
then change the code to
> > use one of the color roles from the QPalette.
> 
> Except that I don't think that Qt3's QPalette has such
a color role. Any ideas?

What is the purpose of the different color? Just distinction
between the
stack-number on the left and the function name in the right
part? I
think you could use the light or dark color role then, but
Matthew
probably knows best.

Andreas

-- 
You'll wish that you had done some of the hard things when
they were easier
to do.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develbarney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
formatting; stack view colors (Was: branches/kdevelop/3.4/languages/cpp/debu gger)
user name
2006-12-21 17:53:29
Andreas Pakulat wrote:
> On 21.12.06 19:41:25, Vladimir Prus wrote:
>> On Thursday 21 December 2006 14:29, Andreas Pakulat
wrote:
>>> You should fetch it from the palette. So I
think you should revert my
>>> change (which also fixes the formatting ;) and
then change the code to
>>> use one of the color roles from the QPalette.
>> Except that I don't think that Qt3's QPalette has
such a color role. Any ideas?
> 
> What is the purpose of the different color? Just
distinction between the
> stack-number on the left and the function name in the
right part? I
> think you could use the light or dark color role then,
but Matthew
> probably knows best.

Actually, looking at what is going on currently, I think
'alternate list 
background' is the most appropriate.  Surely
there is a way to get 
this color (since, well, lists, use it). I'm not /sure/ what
it is, but 
guessing from klistview.cpp, it looks like it is 
KGlobalSettings::alternateBackgroundColor();?

-- 
Matthew
We interrupt this e-mail to bring you a lame signature
attempting to be 
witty.


_______________________________________________
KDevelop-devel mailing list
KDevelop-develbarney.cs.uni-potsdam.de
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel
[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )