Back to index

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

#include <lorenz.h>

Collaboration diagram for KLorenzSetup:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Protected Member Functions

void readSettings ()

Private Slots

void slotSpeed (int num)
void slotEpoch (int num)
void slotCRate (int num)
void slotZRot (int num)
void slotYRot (int num)
void slotXRot (int num)
void slotOk ()
void slotHelp ()
void slotDefault ()

Private Attributes

QWidget * preview
QSlider * sps
QSlider * eps
QSlider * zrs
QSlider * yrs
QSlider * xrs
QSlider * crs
KLorenzSaversaver
int speed
int epoch
int zrot
int yrot
int xrot
int crate

Detailed Description

Definition at line 55 of file lorenz.h.


Constructor & Destructor Documentation

KLorenzSetup::KLorenzSetup ( QWidget *  parent = 0)

Definition at line 81 of file lorenz.cpp.

    : KDialog( parent)
{
       setCaption(i18n( "Setup Lorenz Attractor" ));
       setButtons(Ok|Cancel|Default|Help);
       setDefaultButton(Ok);
    setModal(true);
       readSettings();

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

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

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

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

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

    eps = new QSlider(Qt::Horizontal, main);
    eps->setMinimum(MINEPOCH);
    eps->setMaximum(MAXEPOCH);
    eps->setPageStep(100);
    eps->setValue(epoch);
    eps->setMinimumSize( 120, 20 );
    eps->setTickPosition(QSlider::TicksBelow);
    eps->setTickInterval(3000);
    connect( eps, SIGNAL( valueChanged( int ) ), SLOT( slotEpoch( int ) ) );
    tl1->addWidget(eps);

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

    crs = new QSlider(Qt::Horizontal, main);
    crs->setMinimum(MINCOLOR);
    crs->setMaximum(MAXCOLOR);
    crs->setPageStep(5);
    crs->setValue(crate);
    crs->setMinimumSize( 120, 20 );
    crs->setTickPosition(QSlider::TicksBelow);
    crs->setTickInterval(10);
    connect( crs, SIGNAL( valueChanged( int ) ), SLOT( slotCRate( int ) ) );
    tl1->addWidget(crs);

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

    zrs = new QSlider(Qt::Horizontal, main);
    zrs->setMinimum(MINZROT);
    zrs->setMaximum(MAXZROT);
    zrs->setPageStep(18);
    zrs->setValue(zrot);
    zrs->setMinimumSize( 120, 20 );
    zrs->setTickPosition(QSlider::TicksBelow);
    zrs->setTickInterval(36);
    connect( zrs, SIGNAL( valueChanged( int ) ), SLOT( slotZRot( int ) ) );
    tl1->addWidget(zrs);

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

    yrs = new QSlider(Qt::Horizontal, main);
    yrs->setMinimum(MINYROT);
    yrs->setMaximum(MAXYROT);
    yrs->setPageStep(18);
    yrs->setValue(yrot);
    yrs->setMinimumSize( 120, 20 );
    yrs->setTickPosition(QSlider::TicksBelow);
    yrs->setTickInterval(36);
    connect( yrs, SIGNAL( valueChanged( int ) ), SLOT( slotYRot( int ) ) );
    tl1->addWidget(yrs);

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

    xrs = new QSlider(Qt::Horizontal, main);
    xrs->setMinimum(MINXROT);
    xrs->setMaximum(MAXXROT);
    xrs->setPageStep(18);
    xrs->setValue(xrot);
    xrs->setMinimumSize( 120, 20 );
    xrs->setTickPosition(QSlider::TicksBelow);
    xrs->setTickInterval(36);
    connect( xrs, SIGNAL( valueChanged( int ) ), SLOT( slotXRot( int ) ) );
    tl1->addWidget(xrs);

    preview = new QWidget( main );
    preview->setFixedSize( 220, 165 );
    {
        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 KLorenzSaver( preview->winId() );
    tl->addWidget(preview);
    connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
    connect(this,SIGNAL(helpClicked()),this,SLOT(slotHelp()));
    connect(this,SIGNAL(defaultClicked()),this,SLOT(slotDefault()));
}

Here is the call graph for this function:

Definition at line 199 of file lorenz.cpp.

{
    delete saver;
}

Member Function Documentation

void KLorenzSetup::readSettings ( ) [protected]

Definition at line 205 of file lorenz.cpp.

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

    speed = config.readEntry( "Speed", DEFSPEED );
    epoch = config.readEntry( "Epoch", DEFEPOCH );
    crate = config.readEntry( "Color Rate", DEFCOLOR );
    zrot = config.readEntry( "ZRot", DEFZROT );
    yrot = config.readEntry( "YRot", DEFZROT );
    xrot = config.readEntry( "XRot", DEFZROT );
}

Here is the caller graph for this function:

void KLorenzSetup::slotCRate ( int  num) [private, slot]

Definition at line 230 of file lorenz.cpp.

{
    crate = num;
    if (saver) saver->setCRate(crate);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KLorenzSetup::slotDefault ( ) [private, slot]

Definition at line 288 of file lorenz.cpp.

{
    speed = DEFSPEED;
    epoch = DEFEPOCH;
    crate = DEFCOLOR;
    zrot = DEFZROT;
    yrot = DEFYROT;
    xrot = DEFXROT;
    if (saver) {
        saver->setSpeed(speed);
        saver->setEpoch(epoch);
        saver->setCRate(crate);
        saver->setZRot(zrot);
        saver->setYRot(yrot);
        saver->setXRot(xrot);
        saver->updateMatrix();
        saver->newEpoch();
    }
    sps->setValue(speed);
    eps->setValue(epoch);
    crs->setValue(crate);
    zrs->setValue(zrot);
    yrs->setValue(yrot);
    xrs->setValue(xrot);

/*  // User can cancel, or save defaults?

    KSharedConfig::Ptr config = KGlobal::config();
    config.setGroup( "Settings" );

    config.writeEntry( "Speed", speed );
    config.writeEntry( "Epoch", epoch );
    config.writeEntry( "Color Rate", crate );
    config.writeEntry( "ZRot", zrot );
    config.writeEntry( "YRot", yrot );
    config.writeEntry( "XRot", xrot );

    config.sync();
*/
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KLorenzSetup::slotEpoch ( int  num) [private, slot]

Definition at line 224 of file lorenz.cpp.

{
    epoch = num;
    if (saver) saver->setEpoch(epoch);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 266 of file lorenz.cpp.

{
    KMessageBox::about(this,i18n("Lorenz Attractor screen saver for KDE\n\nCopyright (c) 2000 Nicolas Brodu"));
}

Here is the caller graph for this function:

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

Definition at line 272 of file lorenz.cpp.

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

    config.writeEntry( "Speed", speed );
    config.writeEntry( "Epoch", epoch );
    config.writeEntry( "Color Rate", crate );
    config.writeEntry( "ZRot", zrot );
    config.writeEntry( "YRot", yrot );
    config.writeEntry( "XRot", xrot );

    config.sync();

    accept();
}

Here is the caller graph for this function:

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

Definition at line 218 of file lorenz.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 KLorenzSetup::slotXRot ( int  num) [private, slot]

Definition at line 256 of file lorenz.cpp.

{
    xrot = num;
    if (saver) {
        saver->setXRot(xrot);
        saver->updateMatrix();
        saver->newEpoch();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KLorenzSetup::slotYRot ( int  num) [private, slot]

Definition at line 246 of file lorenz.cpp.

{
    yrot = num;
    if (saver) {
        saver->setYRot(yrot);
        saver->updateMatrix();
        saver->newEpoch();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KLorenzSetup::slotZRot ( int  num) [private, slot]

Definition at line 236 of file lorenz.cpp.

{
    zrot = num;
    if (saver) {
        saver->setZRot(zrot);
        saver->updateMatrix();
        saver->newEpoch();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

int KLorenzSetup::crate [private]

Definition at line 81 of file lorenz.h.

QSlider * KLorenzSetup::crs [private]

Definition at line 79 of file lorenz.h.

int KLorenzSetup::epoch [private]

Definition at line 81 of file lorenz.h.

QSlider * KLorenzSetup::eps [private]

Definition at line 79 of file lorenz.h.

QWidget* KLorenzSetup::preview [private]

Definition at line 78 of file lorenz.h.

Definition at line 80 of file lorenz.h.

int KLorenzSetup::speed [private]

Definition at line 81 of file lorenz.h.

QSlider* KLorenzSetup::sps [private]

Definition at line 79 of file lorenz.h.

int KLorenzSetup::xrot [private]

Definition at line 81 of file lorenz.h.

QSlider * KLorenzSetup::xrs [private]

Definition at line 79 of file lorenz.h.

int KLorenzSetup::yrot [private]

Definition at line 81 of file lorenz.h.

QSlider * KLorenzSetup::yrs [private]

Definition at line 79 of file lorenz.h.

int KLorenzSetup::zrot [private]

Definition at line 81 of file lorenz.h.

QSlider * KLorenzSetup::zrs [private]

Definition at line 79 of file lorenz.h.


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