Source Code (Use browser search to find items of interest.)
Class Index
khexedit'CGotoDialog (./kdeutils/khexedit/dialog.h:64)
class CGotoDialog : public KDialogBase
{
Q_OBJECT
public:
CGotoDialog( QWidget *parent, const char *name = 0, bool modal = false );
~CGotoDialog( void );
protected:
virtual void showEvent( QShowEvent *e );
private slots:
void slotOk( void );
signals:
void gotoOffset( uint offset, uint bit, bool fromCursor, bool forward );
private:
QComboBox *mComboBox;
QCheckBox *mCheckBackward;
QCheckBox *mCheckFromCursor;
QCheckBox *mCheckVisible;
};
khexedit'CGotoDialog::CGotoDialog() (./kdeutils/khexedit/dialog.cc:43)
CGotoDialog::CGotoDialog( QWidget *parent, const char *name, bool modal )
:KDialogBase( Plain, i18n("Goto Offset"), Ok|Cancel, Ok, parent, name,
modal )
{
QVBoxLayout *topLayout = new QVBoxLayout( plainPage(), 0, spacingHint() );
if( topLayout == 0 ) { return; }
QVBoxLayout *vbox = new QVBoxLayout();
if( vbox == 0 ) { return; }
topLayout->addLayout( vbox );
mComboBox = new QComboBox( true, plainPage() );
if( mComboBox == 0 ) { return; }
mComboBox->setMaxCount( 10 );
mComboBox->setInsertionPolicy( QComboBox::AtTop );
mComboBox->setMinimumWidth( fontMetrics().maxWidth()*17 );
QLabel *label = new QLabel( mComboBox, i18n("O&ffset"), plainPage() );
if( label == 0 ) { return; }
vbox->addWidget( label );
vbox->addWidget( mComboBox );
QButtonGroup *group = new QButtonGroup( i18n("Options"), plainPage() );
if( group == 0 ) { return; }
topLayout->addWidget( group, 10 );
QGridLayout *gbox = new QGridLayout( group, 4, 2, spacingHint() );
if( gbox == 0 ) { return; }
gbox->addRowSpacing( 0, fontMetrics().lineSpacing() );
mCheckFromCursor = new QCheckBox( i18n("&From cursor"), group );
gbox->addWidget( mCheckFromCursor, 1, 0 );
mCheckBackward = new QCheckBox( i18n("&Backwards"), group );
gbox->addWidget( mCheckBackward, 1, 1 );
mCheckVisible = new QCheckBox( i18n("&Stay visible"), group );
gbox->addWidget( mCheckVisible, 2, 0 );
gbox->setRowStretch( 3, 10 );
mCheckVisible->setChecked( true );
/*
int w1 = group->fontMetrics().width( group->title() ) +
group->fontMetrics().maxWidth()*2;
int w2 = group->sizeHint().width();
group->setMinimumWidth( QMAX( w1, w2 ) );
*/
}
khexedit'CGotoDialog::~CGotoDialog() (./kdeutils/khexedit/dialog.cc:92)
CGotoDialog::~CGotoDialog( void )
{
}
khexedit'CGotoDialog::showEvent() (./kdeutils/khexedit/dialog.cc:98)
void CGotoDialog::showEvent( QShowEvent *e )
{
KDialogBase::showEvent(e);
mComboBox->setFocus();
}
//
// Format of input string:
// 0x<HexNumber>|<DecimalNumber>s<Bit>
// s = :,. or space
//
khexedit'CGotoDialog::slotOk() (./kdeutils/khexedit/dialog.cc:111)
void CGotoDialog::slotOk( void )
{
uint offset;
bool success = stringToOffset( mComboBox->currentText(), offset );
if( success == false )
{
showEntryFailure( this, QString("") );
return;
}
if( mCheckVisible->isChecked() == false )
{
hide();
}
emit gotoOffset( offset, 7, mCheckFromCursor->isChecked(),
mCheckBackward->isChecked() == true ? false : true );
#if 0
const char *p = mComboBox->currentText();
if( strlen( p ) == 0 )
{
return;
}
//
// Skip any whitespaces in front of string
//
for( ; *p != 0 && isspace( *p ) ; p++ );
uint offset, bit;
int match;
if( strncmp( p, "0x", 2 ) == 0 || strncmp( p, "0X", 2 ) == 0 )
{
match = sscanf( p+2, "%x", &offset );
}
else
{
match = sscanf( p, "%u", &offset );
}
if( match == 0 )
{
return;
}
bit = 7;
p = strpbrk( p, ":,. " );
if( p != 0 )
{
match = sscanf( p+1, "%u", &bit );
if( match == 0 )
{
return;
}
if( bit > 7 ) { bit = 7; }
}
#endif
}