Back to index

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

#include <swarm.h>

Collaboration diagram for kSwarmSetup:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 kSwarmSetup (QWidget *parent=NULL, const char *name=NULL)

Protected Member Functions

void readSettings ()

Private Slots

void slotSpeed (int)
void slotLevels (int)
void slotOk ()
void slotHelp ()

Private Attributes

QWidget * preview
kSwarmSaversaver
int speed
int maxLevels

Detailed Description

Definition at line 40 of file swarm.h.


Constructor & Destructor Documentation

kSwarmSetup::kSwarmSetup ( QWidget *  parent = NULL,
const char *  name = NULL 
)

Definition at line 314 of file swarm.cpp.

       : KDialog( parent)
{
       setCaption(i18n( "Setup Swarm Screen Saver" ));
       setButtons(Ok|Cancel|Help);
              setDefaultButton(Ok);
       setModal(true);
       showButtonSeparator(true);
       readSettings();

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

       QHBoxLayout *top = new QHBoxLayout(main );
       QVBoxLayout *left = new QVBoxLayout;
       top->addLayout(left);

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

       QSlider *slider = new QSlider(Qt::Horizontal,main);
       slider->setMaximum(MAXSPEED);
       slider->setMinimum(MINSPEED);
       slider->setValue(speed);
       slider->setMinimumSize( 120, 20 );
    slider->setTickPosition(QSlider::TicksBelow);
    slider->setTickInterval(10);
       connect( slider, SIGNAL( valueChanged( int ) ),
               SLOT( slotSpeed( int ) ) );
       left->addWidget(slider);

       label = new QLabel( i18n("Number of bees:"), main );
       min_size(label);
       left->addWidget(label);

       slider = new QSlider(Qt::Horizontal,main);
       slider->setMaximum(MAXBATCH);
       slider->setMinimum(MINBATCH);
       slider->setValue(20);

       slider->setMinimumSize( 120, 20 );
    slider->setTickPosition(QSlider::TicksBelow);
    slider->setTickInterval(20);
       connect( slider, SIGNAL( valueChanged( int ) ),
               SLOT( slotLevels( int ) ) );
       left->addWidget(slider);
       left->addStretch();

       preview = new QWidget( main );
       preview->setFixedSize( 220, 170 );
       QPalette palette = preview->palette();
       palette.setColor(preview->backgroundRole(), Qt::black);
       preview->setPalette(palette);
       preview->setAutoFillBackground(true);

       preview->show();    // otherwise saver does not get correct size
       saver = new kSwarmSaver( preview->winId() );
       top->addWidget(preview);

       top->addStretch();
       connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
       connect(this,SIGNAL(helpClicked()),this,SLOT(slotHelp()));
}

Here is the call graph for this function:


Member Function Documentation

void kSwarmSetup::readSettings ( ) [protected]

Definition at line 380 of file swarm.cpp.

{
       KConfig *config = klock_config();
       KConfigGroup group = config->group( "Settings" );

       speed = group.readEntry( "Speed", speed );

       if ( speed > MAXSPEED )
              speed = MAXSPEED;
       else if ( speed < MINSPEED )
              speed = MINSPEED;

       maxLevels = group.readEntry( "MaxLevels", DEFBATCH );
       delete config;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 430 of file swarm.cpp.

{
       KMessageBox::information(this,
                          i18n("Swarm\n\nCopyright (c) 1991 by Patrick J. Naughton\n\nPorted to kscreensaver by Emanuel Pirker."),
                          i18n("About Swarm"));
}

Here is the caller graph for this function:

void kSwarmSetup::slotLevels ( int  num) [private, slot]

Definition at line 404 of file swarm.cpp.

{
       maxLevels = num;

       if ( saver )
              saver->setLevels( maxLevels );
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 412 of file swarm.cpp.

{
       KConfig *config = klock_config();
       KConfigGroup group = config->group( "Settings" );

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

       QString slevels;
       slevels.setNum( maxLevels );
       group.writeEntry( "MaxLevels", slevels );

       config->sync();
       delete config;
       accept();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 396 of file swarm.cpp.

{
       speed = num;

       if ( saver )
              saver->setSpeed( speed );
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

int kSwarmSetup::maxLevels [private]

Definition at line 61 of file swarm.h.

QWidget* kSwarmSetup::preview [private]

Definition at line 57 of file swarm.h.

Definition at line 58 of file swarm.h.

int kSwarmSetup::speed [private]

Definition at line 60 of file swarm.h.


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