Back to index

kdeartwork  4.3.2
Public Member Functions | Protected Member Functions | Private Slots | Private Attributes
kPolygonSetup Class Reference

#include <polygon.h>

Collaboration diagram for kPolygonSetup:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 kPolygonSetup (QWidget *parent=0)
 ~kPolygonSetup ()

Protected Member Functions

void readSettings ()

Private Slots

void slotLength (int)
void slotVertices (int)
void slotSpeed (int)
void slotOk ()
void slotHelp ()

Private Attributes

QWidget * preview
kPolygonSaversaver
int length
int vertices
int speed

Detailed Description

Definition at line 53 of file polygon.h.


Constructor & Destructor Documentation

kPolygonSetup::kPolygonSetup ( QWidget *  parent = 0)

Definition at line 64 of file polygon.cpp.

       : KDialog( parent)
         , saver( 0 ), length( 10 ), vertices( 3 ),
         speed( 50 )
{
       setCaption(i18n( "Setup Polygon Screen Saver" ));
       setButtons(Ok|Cancel|Help);
       setDefaultButton(Ok);
       setModal(true);
       readSettings();

       QWidget *main = new QWidget(this);
       setMainWidget(main);
       setButtonText( Help, i18n( "A&bout" ) );

       QHBoxLayout *tl = new QHBoxLayout(main);
        tl->setSpacing(spacingHint());
       QVBoxLayout *tl1 = new QVBoxLayout;
       tl->addLayout(tl1);

       QLabel *label = new QLabel( i18n("Length:"), main );
       tl1->addWidget(label);

        QSlider *sb = new QSlider(Qt::Horizontal, main);
        sb->setMinimum(1);
        sb->setMaximum(MAXLENGTH);
        sb->setPageStep(10);
        sb->setValue(length);
        sb->setMinimumSize( 90, 20 );
        sb->setTickPosition(QSlider::TicksBelow);
        sb->setTickInterval(10);
        connect( sb, SIGNAL( valueChanged( int ) ), SLOT( slotLength( int ) ) );
        tl1->addWidget(sb);

       label = new QLabel( i18n("Vertices:"), main );
       tl1->addWidget(label);

        sb = new QSlider(Qt::Horizontal, main);
        sb->setMinimum(3);
        sb->setMaximum(MAXVERTICES);
        sb->setPageStep(2);
        sb->setValue(vertices);
        sb->setMinimumSize( 90, 20 );
        sb->setTickPosition(QSlider::TicksBelow);
        sb->setTickInterval(2);
        connect( sb, SIGNAL( valueChanged( int ) ), SLOT( slotVertices( int ) ) );
        tl1->addWidget(sb);

       label = new QLabel( i18n("Speed:"), main );
       tl1->addWidget(label);

        sb = new QSlider(Qt::Horizontal, main);
        sb->setMinimum(0);
        sb->setMaximum(100);
        sb->setPageStep(10);
        sb->setValue(speed);
        sb->setMinimumSize( 90, 20 );
        sb->setTickPosition(QSlider::TicksBelow);
        sb->setTickInterval(10);
        connect( sb, SIGNAL( valueChanged( int ) ), SLOT( slotSpeed( int ) ) );
        tl1->addWidget(sb);
        tl1->addStretch();

       preview = new QWidget( main );
       preview->setFixedSize( 220, 170 );
        {
            QPalette palette;
            palette.setColor( preview->backgroundRole(), Qt::black );
            preview->setPalette( palette );
           preview->setAutoFillBackground(true);
        }
       preview->show();    // otherwise saver does not get correct size
       saver = new kPolygonSaver( preview->winId() );
       tl->addWidget(preview);
        connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
       connect(this,SIGNAL(helpClicked()),this,SLOT(slotHelp()));
       setMinimumSize( sizeHint() );
}

Here is the call graph for this function:

Definition at line 143 of file polygon.cpp.

{
    delete saver;
}

Member Function Documentation

void kPolygonSetup::readSettings ( ) [protected]

Definition at line 149 of file polygon.cpp.

{
    KConfigGroup config(KGlobal::config(), "Settings");

    length = config.readEntry( "Length", length );
    if ( length > MAXLENGTH )
        length = MAXLENGTH;
    else if ( length < 1 )
        length = 1;

    vertices = config.readEntry( "Vertices", vertices );
    if ( vertices > MAXVERTICES )
        vertices = MAXVERTICES;
    else if ( vertices < 3 )
        vertices = 3;

    speed = config.readEntry( "Speed", speed );
    if ( speed > 100 )
        speed = 100;
    else if ( speed < 50 )
        speed = 50;
}

Here is the caller graph for this function:

void kPolygonSetup::slotHelp ( ) [private, slot]

Definition at line 215 of file polygon.cpp.

{
       KMessageBox::information(this,
                          i18n("Polygon Version 2.2.0\n\n"\
                                          "Written by Martin R. Jones 1996\n"\
                                          "mjones@kde.org"));
}

Here is the caller graph for this function:

void kPolygonSetup::slotLength ( int  len) [private, slot]

Definition at line 172 of file polygon.cpp.

{
       length = len;
       if ( saver )
              saver->setPolygon( length, vertices );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void kPolygonSetup::slotOk ( ) [private, slot]

Definition at line 194 of file polygon.cpp.

{
    KConfigGroup config(KGlobal::config(), "Settings");

    QString slength;
    slength.setNum( length );
    config.writeEntry( "Length", slength );

    QString svertices;
    svertices.setNum( vertices );
    config.writeEntry( "Vertices", svertices );

    QString sspeed;
    sspeed.setNum( speed );
    config.writeEntry( "Speed", sspeed );

    config.sync();

    accept();
}

Here is the caller graph for this function:

void kPolygonSetup::slotSpeed ( int  num) [private, slot]

Definition at line 186 of file polygon.cpp.

{
       speed = num;
       if ( saver )
              saver->setSpeed( speed );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void kPolygonSetup::slotVertices ( int  num) [private, slot]

Definition at line 179 of file polygon.cpp.

{
       vertices = num;
       if ( saver )
              saver->setPolygon( length, vertices );
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

int kPolygonSetup::length [private]

Definition at line 74 of file polygon.h.

QWidget* kPolygonSetup::preview [private]

Definition at line 71 of file polygon.h.

Definition at line 72 of file polygon.h.

int kPolygonSetup::speed [private]

Definition at line 76 of file polygon.h.

int kPolygonSetup::vertices [private]

Definition at line 75 of file polygon.h.


The documentation for this class was generated from the following files: