1
/* ----------------------------------------------------------------------
2
* Implementation of MemcheckOptionsPage memcheck_options_page.cpp
3
* Subclass of OptionsPage to hold memcheck-specific options | flags.
4
* ----------------------------------------------------------------------
5
* This file is part of Valkyrie, a front-end for Valgrind
6
* Copyright (C) 2000-2008, OpenWorks LLP <info@open-works.co.uk>
7
* This program is released under the terms of the GNU GPL v.2
8
* See the file COPYING for the full license details.
11
#include "memcheck_options_page.h"
13
#include "context_help.h"
14
#include "html_urls.h"
15
#include "memcheck_object.h"
16
#include "vk_messages.h"
21
MemcheckOptionsPage::MemcheckOptionsPage( QWidget* parent, VkObject* obj )
22
: OptionsPage( parent, obj, "memcheck_options_page" )
24
/* init the QIntDict list, resizing if necessary */
25
unsigned int numItems = 11;
26
m_itemList.resize( numItems );
28
/* top layout: margin = 10; spacing = 25 */
29
QVBoxLayout* vbox = new QVBoxLayout( this, 10, 25, "vbox" );
31
/* group1: memcheck options */
32
QGroupBox* group1 = new QGroupBox( " Memcheck Options ", this, "group1");
33
ContextHelp::add( group1, urlMemcheck::optsMC );
34
vbox->addWidget( group1, m_space );
36
m_itemList.insert( Memcheck::LEAK_CHECK, /* combobox */
37
optionWidget( Memcheck::LEAK_CHECK, group1, true ) );
38
m_itemList.insert( Memcheck::SHOW_REACH, /* checkbox */
39
optionWidget( Memcheck::SHOW_REACH, group1, false ) );
40
//m_itemList.insert( Memcheck::UNDEF_VAL, /* checkbox */
41
// optionWidget( Memcheck::UNDEF_VAL, group1, false ) );
42
m_itemList.insert( Memcheck::TRACK_ORI, /* checkbox */
43
optionWidget( Memcheck::TRACK_ORI, group1, false ) );
45
m_itemList.insert( Memcheck::PARTIAL, /* checkbox */
46
optionWidget( Memcheck::PARTIAL, group1, false ) );
47
m_itemList.insert( Memcheck::GCC_296, /* checkbox */
48
optionWidget( Memcheck::GCC_296, group1, false ) );
50
m_itemList.insert( Memcheck::LEAK_RES, /* combobox */
51
optionWidget( Memcheck::LEAK_RES, group1, true ) );
52
m_itemList.insert( Memcheck::FREELIST, /* ledit */
53
optionWidget( Memcheck::FREELIST, group1, true ) );
54
m_itemList.insert( Memcheck::ALIGNMENT, /* spinbox */
55
optionWidget( Memcheck::ALIGNMENT, group1, true ) );
57
/* grid layout for group1 */
60
QGridLayout* grid1 = new QGridLayout( group1, rows, cols, m_margin, m_space );
62
#if (QT_VERSION-0 >= 0x030200)
63
grid1->setRowSpacing( row++, m_topSpace ); /* blank top row */
64
#else // QT_VERSION < 3.2
65
grid1->addRowSpacing( row++, m_topSpace ); /* blank top row */
67
grid1->setColStretch( 1, 10 ); /* push widgets to the left */
69
grid1->addLayout( m_itemList[Memcheck::LEAK_CHECK]->hlayout(), row++, 0 );
70
grid1->addWidget( m_itemList[Memcheck::SHOW_REACH]->widget(), row++, 0 );
71
//grid1->addWidget( m_itemList[Memcheck::UNDEF_VAL]->widget(), row++, 0 );
73
grid1->addMultiCellWidget( sep(group1,"sep1"), row,row, 0,1 );
74
#if (QT_VERSION-0 >= 0x030200)
75
grid1->setRowSpacing( row++, m_topSpace ); /* add a bit more space here */
76
#else // QT_VERSION < 3.2
77
grid1->addRowSpacing( row++, m_topSpace ); /* add a bit more space here */
80
grid1->addWidget( m_itemList[Memcheck::TRACK_ORI]->widget(), row++, 0 );
81
grid1->addWidget( m_itemList[Memcheck::PARTIAL]->widget(), row++, 0 );
82
grid1->addWidget( m_itemList[Memcheck::GCC_296]->widget(), row++, 0 );
84
grid1->addMultiCellWidget( sep(group1,"sep2"), row,row, 0,1 );
86
#if (QT_VERSION-0 >= 0x030200)
87
grid1->setRowSpacing( row, m_topSpace ); /* add a bit more space here */
88
#else // QT_VERSION < 3.2
89
grid1->addRowSpacing( row, m_topSpace ); /* add a bit more space here */
92
grid1->addLayout( m_itemList[Memcheck::LEAK_RES]->hlayout(), row++, 0 );
93
grid1->addLayout( m_itemList[Memcheck::FREELIST]->hlayout(), row++, 0 );
94
grid1->addLayout( m_itemList[Memcheck::ALIGNMENT ]->hlayout(), row++, 0 );
96
vk_assert(row == rows);
98
vbox->addStretch( m_space );
100
/* finalise page ------------------------------------------------- */
101
vk_assert( m_itemList.count() <= numItems );
103
QIntDictIterator<OptionWidget> it( m_itemList );
104
for ( ; it.current(); ++it ) {
105
connect(it.current(), SIGNAL(valueChanged( bool, OptionWidget * )),
106
this, SLOT(updateEditList( bool, OptionWidget * )));
110
/* Disabled Widgets -------------------------------------------------
111
Valgrind presets and ignores some options when generating xml
112
output. (see docs/internals/xml_output.txt) */
113
m_itemList[Memcheck::LEAK_CHECK]->setEnabled( false );
117
/* called when user clicks "Apply" / "Ok" / "Reset" buttons. */
118
void MemcheckOptionsPage::applyOption( int optId )
120
vk_assert( optId >= 0 && optId < Memcheck::NUM_OPTS );
122
// QString argval = m_itemList[optId]->currValue();