Source Code (Use browser search to find items of interest.)
Class Index
kghostview'ViewControl (./kdegraphics/kghostview/viewcontrol.h:9)
class ViewControl : public QDialog
{
Q_OBJECT
public:
ViewControl( QWidget *parent, const char *name );
QComboBox* magComboBox;
QComboBox* mediaComboBox;
QComboBox* orientComboBox;
QPushButton *apply;
/**
* Update the mag combo box.
**/
void updateMag (int mag);
/**
* Enable/disable the apply button.
**/
void applyEnable (bool enable);
protected:
int prevmag, prevmedia, prevorient;
public slots:
void slotApplyClicked();
void slotMagSelection (int i);
void slotMediaSelection (int i);
void slotOrientSelection (int i);
signals:
void applyChanges();
};
kghostview'ViewControl::ViewControl() (./kdegraphics/kghostview/viewcontrol.cpp:26)
ViewControl::ViewControl( QWidget *parent, const char *name )
: QDialog( parent, name )
{
setFocusPolicy(QWidget::StrongFocus);
QBoxLayout *topLayout = new QVBoxLayout( this, 10 );
QGroupBox* vcGroupBox;
vcGroupBox = new QGroupBox( this );
vcGroupBox->setFrameStyle( QFrame::NoFrame );
//vcGroupBox->setTitle( i18n("Force changes to ...") );
//vcGroupBox->setAlignment( 1 );
topLayout->addWidget( vcGroupBox, 10 );
QGridLayout *grid = new QGridLayout( vcGroupBox, 3, 2, 10 );
grid->setRowStretch(0,0);
grid->setRowStretch(1,10);
grid->setColStretch(0,0);
grid->setColStretch(1,10);
magComboBox = new QComboBox( FALSE, vcGroupBox );
magComboBox->setFixedHeight( magComboBox->sizeHint().height() );
//magComboBox->hide();
connect ( magComboBox, SIGNAL (activated (int)),
this, SLOT (slotMagSelection (int)) );
grid->addWidget( magComboBox, 0, 1 );
mediaComboBox = new QComboBox( FALSE, vcGroupBox );
mediaComboBox->setFixedHeight( magComboBox->sizeHint().height() );
connect ( mediaComboBox, SIGNAL (activated (int)),
this, SLOT (slotMediaSelection (int)) );
grid->addWidget( mediaComboBox, 1, 1 );
orientComboBox = new QComboBox( FALSE, vcGroupBox );
orientComboBox->insertItem(i18n("Portrait"));
orientComboBox->insertItem(i18n("Landscape"));
orientComboBox->insertItem(i18n("Seascape"));
orientComboBox->insertItem(i18n("Upside down"));
orientComboBox->setFixedHeight( magComboBox->sizeHint().height() );
connect ( orientComboBox, SIGNAL (activated (int)),
this, SLOT (slotOrientSelection (int)) );
grid->addWidget( orientComboBox, 2, 1 );
int labelWidth = 0;
QLabel* vcLabel;
vcLabel = new QLabel( magComboBox, i18n("&Magnification"), vcGroupBox );
vcLabel->setAlignment( AlignRight | AlignVCenter | ShowPrefix );
if ( vcLabel->sizeHint().width() > labelWidth )
labelWidth = vcLabel->sizeHint().width();
vcLabel->setMinimumWidth( labelWidth );
vcLabel->hide();
grid->addWidget( vcLabel, 0, 0 );
vcLabel = new QLabel( mediaComboBox, i18n("M&edia"), vcGroupBox );
vcLabel->setAlignment( AlignRight | AlignVCenter | ShowPrefix );
if ( vcLabel->sizeHint().width() > labelWidth )
labelWidth = vcLabel->sizeHint().width();
vcLabel->setMinimumWidth( labelWidth );
grid->addWidget( vcLabel, 1, 0 );
vcLabel = new QLabel( orientComboBox, i18n("&Orientation"), vcGroupBox );
vcLabel->setAlignment( AlignRight | AlignVCenter | ShowPrefix );
if ( vcLabel->sizeHint().width() > labelWidth )
labelWidth = vcLabel->sizeHint().width();
vcLabel->setMinimumWidth( labelWidth );
grid->addWidget( vcLabel, 2, 0 );
vcGroupBox->setMinimumHeight( 2*orientComboBox->sizeHint().height()+20 );
vcGroupBox->setMinimumWidth(
40 + labelWidth + orientComboBox->sizeHint().width() );
QFrame* tmpQFrame;
tmpQFrame = new QFrame( this );
tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
topLayout->addWidget( tmpQFrame );
// CREATE BUTTONS
KButtonBox *bbox = new KButtonBox( this );
bbox->addStretch( 10 );
apply = bbox->addButton( i18n("&Apply") );
connect( apply, SIGNAL(clicked()), SLOT(slotApplyClicked()) );
QPushButton *closebtn = bbox->addButton( i18n("&Close") );
connect( closebtn, SIGNAL(clicked()), SLOT(reject()) );
bbox->layout();
topLayout->addWidget( bbox );
topLayout->activate();
prevmag = prevmedia = prevorient = 0;
applyEnable (false);
}
void
kghostview'ViewControl::updateMag() (./kdegraphics/kghostview/viewcontrol.cpp:145)
ViewControl::updateMag (int mag)
{
magComboBox->setCurrentItem (mag);
prevmag = mag;
}
void
kghostview'ViewControl::applyEnable() (./kdegraphics/kghostview/viewcontrol.cpp:153)
ViewControl::applyEnable (bool enable)
{
apply->setEnabled (enable);
}
void
kghostview'ViewControl::slotApplyClicked() (./kdegraphics/kghostview/viewcontrol.cpp:159)
ViewControl::slotApplyClicked()
{
emit applyChanges();
applyEnable (false);
}
void
kghostview'ViewControl::slotMagSelection() (./kdegraphics/kghostview/viewcontrol.cpp:166)
ViewControl::slotMagSelection (int i)
{
if (i != prevmag)
{
applyEnable (true);
prevmag = i;
}
}
void
kghostview'ViewControl::slotMediaSelection() (./kdegraphics/kghostview/viewcontrol.cpp:176)
ViewControl::slotMediaSelection (int i)
{
if (i != prevmedia)
{
applyEnable (true);
prevmedia = i;
}
}
void
kghostview'ViewControl::slotOrientSelection() (./kdegraphics/kghostview/viewcontrol.cpp:186)
ViewControl::slotOrientSelection (int i)
{
if (i != prevorient)
{
applyEnable (true);
prevorient = i;
}
}