|
From: <sv...@va...> - 2010-03-08 22:24:49
|
Author: cerion
Date: 2010-03-08 22:24:33 +0000 (Mon, 08 Mar 2010)
New Revision: 486
Log:
Added show-src-path functionality back in to memcheckview.
Modified:
branches/valkyrie_qt4port/toolview/memcheckview.cpp
branches/valkyrie_qt4port/toolview/memcheckview.h
branches/valkyrie_qt4port/toolview/vglogview.cpp
branches/valkyrie_qt4port/toolview/vglogview.h
Modified: branches/valkyrie_qt4port/toolview/memcheckview.cpp
===================================================================
--- branches/valkyrie_qt4port/toolview/memcheckview.cpp 2010-03-07 21:54:57 UTC (rev 485)
+++ branches/valkyrie_qt4port/toolview/memcheckview.cpp 2010-03-08 22:24:33 UTC (rev 486)
@@ -160,14 +160,11 @@
actMC_ShowSrcPaths = new QAction( this );
actMC_ShowSrcPaths->setObjectName( QString::fromUtf8( "actMC_ShowSrcPaths" ) );
- actMC_ShowSrcPaths->setCheckable( true );
QIcon icon_showsrcpaths;
icon_showsrcpaths.addPixmap( QPixmap( QString::fromUtf8( ":/vk_icons/icons/text_more.png" ) ),
QIcon::Normal, QIcon::Off );
- icon_showsrcpaths.addPixmap( QPixmap( QString::fromUtf8( ":/vk_icons/icons/text_less.png" ) ),
- QIcon::Normal, QIcon::On );
actMC_ShowSrcPaths->setIcon( icon_showsrcpaths );
- connect( actMC_ShowSrcPaths, SIGNAL( triggered( bool ) ), this, SLOT( showSrcPath( bool ) ) );
+ connect( actMC_ShowSrcPaths, SIGNAL( triggered() ), this, SLOT( showSrcPath() ) );
actFile_OpenLog = new QAction( this );
actFile_OpenLog->setObjectName( QString::fromUtf8( "actFile_OpenLog" ) );
@@ -260,7 +257,6 @@
actMC_OpenClose_item->setEnabled( false ); // can't enable before item clicked
actMC_OpenClose_all->setEnabled( !tree_empty ); // enable only if sthng in tree
actMC_ShowSrcPaths->setEnabled( !tree_empty ); // enable only if sthng in tree
- actMC_ShowSrcPaths->setChecked( false ); // - and default to 'show src'
actFile_SaveLog->setEnabled( !tree_empty );
}
}
@@ -288,14 +284,50 @@
/*!
Shows/Hides the file paths for all frames under current item.
*/
-void MemcheckView::showSrcPath( bool show_src )
+void MemcheckView::showSrcPath()
{
- cerr << "MemcheckView::showSrcPath(): " << show_src << endl;
- cerr << "TODO" << endl;
- //TODO
-
-
- actMC_ShowSrcPaths->setChecked( show_src );
+// cerr << "MemcheckView::showSrcPath()" << endl;
+
+ if ( treeView->topLevelItemCount() == 0 ) {
+ return;
+ }
+ VgOutputItem* vgItemTop = (VgOutputItem*)treeView->topLevelItem( 0 );
+
+ VgOutputItem* vgItem = (VgOutputItem*)treeView->currentItem();
+ if ( !vgItem ) {
+ vgItem = vgItemTop;
+ }
+
+ // if we're top dog, show full src path for all _open_ error items.
+ // Note: not supporting UNshow for all. Don't think worth the effort.
+ if ( vgItem == vgItemTop ) {
+ for ( int i=0; i<vgItem->childCount(); ++i ) {
+ VgOutputItem* child = (VgOutputItem*)vgItem->child( i );
+ if ( child->isExpanded() &&
+ child->elemType() == VgElement::ERROR ) {
+ ErrorItem* error = (ErrorItem*)vgItem->child( i );
+ error->showFullSrcPath( true );
+ }
+ }
+ return;
+ }
+
+ // else, we're not top level item...
+ // in case we're hanging out on a branch somewhere,
+ // crawl up the branch until we're a first-child item
+ vk_assert( vgItem->parent() != 0 );
+ vk_assert( vgItem != vgItemTop );
+ while ( vgItem->parent() != vgItemTop ) {
+ vgItem = vgItem->parent();
+ }
+
+ // if we're an _open_ ERROR-item, then show src path for this item only.
+ // Toggling of show full src paths suppored for this case.
+ if ( vgItem->isExpanded() &&
+ vgItem->elemType() == VgElement::ERROR ) {
+ ErrorItem* error = (ErrorItem*)vgItem;
+ error->showFullSrcPath( !error->isFullSrcPathShown() );
+ }
}
Modified: branches/valkyrie_qt4port/toolview/memcheckview.h
===================================================================
--- branches/valkyrie_qt4port/toolview/memcheckview.h 2010-03-07 21:54:57 UTC (rev 485)
+++ branches/valkyrie_qt4port/toolview/memcheckview.h 2010-03-08 22:24:33 UTC (rev 486)
@@ -68,7 +68,7 @@
void openLogFile();
void opencloseAllItems();
void opencloseOneItem();
- void showSrcPath( bool show_src );
+ void showSrcPath();
void launchEditor( QTreeWidgetItem* item );
void itemExpanded( QTreeWidgetItem* item );
void itemCollapsed( QTreeWidgetItem* item );
Modified: branches/valkyrie_qt4port/toolview/vglogview.cpp
===================================================================
--- branches/valkyrie_qt4port/toolview/vglogview.cpp 2010-03-07 21:54:57 UTC (rev 485)
+++ branches/valkyrie_qt4port/toolview/vglogview.cpp 2010-03-08 22:24:33 UTC (rev 486)
@@ -600,7 +600,8 @@
: VgOutputItem( parent, after, err )
{
err_tmplt = "%1 [%2]: %3";
-
+ fullSrcPathShown = false;
+
QString what = err.getFirstElem( "what" ).text();
QString kind = err.getFirstElem( "kind" ).text();
QString acnym = errorAcronym( kind );
@@ -692,8 +693,31 @@
return it.value();
}
+/*!
+ Shows src paths for all frames under this error
+*/
+void ErrorItem::showFullSrcPath( bool show )
+{
+ // (maybe) multiple stacks
+ for ( int i=0; i<childCount(); ++i ) {
+ StackItem* stack = (StackItem*)child( i );
+ if ( stack->elemType() == VgElement::STACK ) {
+ // multiple frames
+ for ( int i=0; i<stack->childCount(); ++i ) {
+ FrameItem* frame = (FrameItem*)stack->child( i );
+ if ( frame->elemType() == VgElement::FRAME ) {
+ QString text = ((VgFrame*)&frame->elem)->describe_IP( show );
+ frame->setText( text );
+ }
+ }
+ }
+ }
+ fullSrcPathShown = show;
+}
+
+
// ============================================================
/*!
StackItem
@@ -727,7 +751,6 @@
}
-
// ============================================================
/*!
FrameItem
Modified: branches/valkyrie_qt4port/toolview/vglogview.h
===================================================================
--- branches/valkyrie_qt4port/toolview/vglogview.h 2010-03-07 21:54:57 UTC (rev 485)
+++ branches/valkyrie_qt4port/toolview/vglogview.h 2010-03-08 22:24:33 UTC (rev 486)
@@ -152,14 +152,22 @@
bool isLeak() {
return (( VgError* )&elem )->isLeak();
}
-
+
+ void showFullSrcPath( bool show );
+ bool isFullSrcPathShown() {
+ return fullSrcPathShown;
+ }
+
// mapping of error::kind to 3-letter acronyms
typedef QMap<QString, QString> AcronymMap;
static AcronymMap acronymMap;
private:
QString errorAcronym( QString kind );
+
+private:
QString err_tmplt;
+ bool fullSrcPathShown;
};
|