|
From: <sv...@va...> - 2008-06-11 20:40:41
|
Author: cerion
Date: 2008-06-11 21:40:46 +0100 (Wed, 11 Jun 2008)
New Revision: 434
Log:
Fix open/close items buttons
- open current item: only worked once item had been opened once already
- open all items: didn't open leak errors (stopped at suppressions)
- open all items: remained 'pushed' even if all items were closed
Modified:
trunk/valkyrie/tool_views/memcheck_view.cpp
trunk/valkyrie/tool_views/memcheck_view.h
trunk/valkyrie/tool_views/vglogview.cpp
Modified: trunk/valkyrie/tool_views/memcheck_view.cpp
===================================================================
--- trunk/valkyrie/tool_views/memcheck_view.cpp 2008-06-10 01:44:12 UTC (rev 433)
+++ trunk/valkyrie/tool_views/memcheck_view.cpp 2008-06-11 20:40:46 UTC (rev 434)
@@ -189,9 +189,8 @@
openAllButton = new QToolButton( mcToolBar, "tb_open_all" );
openAllButton->setIconSet( QPixmap( open_all_items_xpm ) );
openAllButton->setAutoRaise( true );
- openAllButton->setToggleButton( true );
- connect( openAllButton, SIGNAL( toggled(bool) ),
- this, SLOT( openAllItems(bool) ) );
+ connect( openAllButton, SIGNAL( clicked() ),
+ this, SLOT( openAllItems() ) );
QToolTip::add( openAllButton,
"Open / Close all errors" );
ContextHelp::add( openAllButton, urlValkyrie::openAllButton );
@@ -370,7 +369,7 @@
/* opens all error items plus their children.
ignores the status, preamble, et al. items. */
-void MemcheckView::openAllItems( bool open )
+void MemcheckView::openAllItems()
{
if (!lView->firstChild()) /* listview populated at all? */
return;
@@ -383,11 +382,31 @@
op_item = op_item->nextSibling();
}
+ /* is any top-level item open? */
+ bool anItemIsOpen = false;
+ VgOutputItem* op_item2 = op_item;
+ while ( op_item2 ) {
+ /* skip suppressions */
+ if ( ((VgOutputItem*)op_item2)->elemType() == VgElement::SUPPCOUNTS ) {
+ op_item2 = op_item2->nextSibling();
+ continue;
+ }
+ if ( op_item2->isOpen() ) {
+ anItemIsOpen = true;
+ break;
+ }
+ op_item2 = op_item2->nextSibling();
+ }
+
+ /* iterate over all items, opening as we go */
QListViewItemIterator it( op_item );
while ( it.current() ) {
- if ( ((VgOutputItem*)it.current())->elemType() == VgElement::SUPPCOUNTS )
- break; /* stop when we hit suppressions */
- it.current()->setOpen( open );
+ /* skip suppressions */
+ if ( ((VgOutputItem*)it.current())->elemType() == VgElement::SUPPCOUNTS ) {
+ ++it;
+ continue;
+ }
+ it.current()->setOpen( !anItemIsOpen );
++it;
}
}
@@ -455,15 +474,7 @@
openOneButton->setEnabled( false );
} else {
/* if item openable and within an error: enable openOneButton */
- bool isOpenable = (lv_item->firstChild() != 0);
- bool withinError = false;
- VgOutputItem* curr_item = (VgOutputItem*)lv_item;
- for (; curr_item; curr_item = curr_item->parent() ) {
- if ( curr_item->elemType() == VgElement::ERROR ) {
- withinError = true;
- break;
- }
- }
- openOneButton->setEnabled( isOpenable && withinError );
+ bool isOpenable = lv_item->isExpandable();
+ openOneButton->setEnabled( isOpenable );
}
}
Modified: trunk/valkyrie/tool_views/memcheck_view.h
===================================================================
--- trunk/valkyrie/tool_views/memcheck_view.h 2008-06-10 01:44:12 UTC (rev 433)
+++ trunk/valkyrie/tool_views/memcheck_view.h 2008-06-11 20:40:46 UTC (rev 434)
@@ -50,7 +50,7 @@
void showSuppEditor();
void itemSelected();
- void openAllItems(bool);
+ void openAllItems();
void openOneItem();
void showSrcPath();
void launchEditor( QListViewItem* );
Modified: trunk/valkyrie/tool_views/vglogview.cpp
===================================================================
--- trunk/valkyrie/tool_views/vglogview.cpp 2008-06-10 01:44:12 UTC (rev 433)
+++ trunk/valkyrie/tool_views/vglogview.cpp 2008-06-11 20:40:46 UTC (rev 434)
@@ -366,6 +366,7 @@
}
}
VgOutputItem::setOpen( open );
+ setExpandable( true );
}
@@ -383,9 +384,10 @@
{
if ( open && childCount() == 0 ) {
VgOutputItem* item = new VgOutputItem( this, elem );
- item->setText( elem.text() );
+ item->setText( elem.text() );
}
VgOutputItem::setOpen( open );
+ setExpandable( true );
}
@@ -397,6 +399,7 @@
: VgOutputItem( parent, after, args )
{
setText( "args" );
+ setExpandable( true );
}
void ArgsItem::setOpen( bool open )
|