Back to index

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

#include <lines.h>

Collaboration diagram for kLinesSetup:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 kLinesSetup (QWidget *parent=NULL)
 ~kLinesSetup ()

Protected Member Functions

void readSettings ()

Private Slots

void slotLength (int)
void slotSpeed (int)
void slotColstart (const QColor &)
void slotColmid (const QColor &)
void slotColend (const QColor &)
void slotOk ()
void slotHelp ()

Private Attributes

KColorButton * colorPush0
KColorButton * colorPush1
KColorButton * colorPush2
QWidget * preview
kLinesSaversaver
int length
int speed
QColor colstart
QColor colmid
QColor colend

Detailed Description

Definition at line 69 of file lines.h.


Constructor & Destructor Documentation

kLinesSetup::kLinesSetup ( QWidget *  parent = NULL)

Definition at line 126 of file lines.cpp.

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

       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("Length:"), main);
       tl1->addWidget(label);

       QSlider *sb= new QSlider(Qt::Horizontal, main);
        sb->setMinimum(1);
        sb->setMaximum(MAXLENGTH + 1);
        sb->setPageStep(16);
        sb->setValue(length);
       sb->setMinimumSize(120, 20);
       sb->setTickPosition(QSlider::TicksBelow);
       sb->setTickInterval(32);
       connect(sb, SIGNAL(valueChanged(int)), SLOT(slotLength(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(120, 20);
       sb->setTickPosition(QSlider::TicksBelow);
       sb->setTickInterval(10);
       connect( sb, SIGNAL( valueChanged( int ) ), SLOT( slotSpeed( int ) ) );
       tl1->addWidget(sb);

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

       colorPush0=new KColorButton(colstart, main);
       connect(colorPush0, SIGNAL(changed(const QColor &)),
              SLOT(slotColstart(const QColor &)));
       tl1->addWidget(colorPush0);

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

       colorPush1=new KColorButton(colmid, main);
       connect(colorPush1, SIGNAL(changed(const QColor &)),
              SLOT(slotColmid(const QColor &)));
       tl1->addWidget(colorPush1);

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

       colorPush2=new KColorButton(colend, main);
       connect(colorPush2, SIGNAL(changed(const QColor &)),
              SLOT(slotColend(const QColor &)));
       tl1->addWidget(colorPush2);
       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 kLinesSaver(preview->winId());
       tl->addWidget(preview);
       connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
       connect(this,SIGNAL(helpClicked()),this,SLOT(slotHelp()));
}

Here is the call graph for this function:

Definition at line 214 of file lines.cpp.

{
    delete saver;
}

Member Function Documentation

void kLinesSetup::readSettings ( ) [protected]

Definition at line 220 of file lines.cpp.

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

    QString str;

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

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

    str=config.readEntry("StartColor");
    if(!str.isNull()) colstart.setNamedColor(str);
    else colstart=Qt::white;
    str=config.readEntry("MidColor");
    if(!str.isNull()) colmid.setNamedColor(str);
    else colmid=Qt::blue;
    str=config.readEntry("EndColor");
    if(!str.isNull()) colend.setNamedColor(str);
    else colend=Qt::black;
}

Here is the caller graph for this function:

void kLinesSetup::slotColend ( const QColor &  col) [private, slot]

Definition at line 264 of file lines.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void kLinesSetup::slotColmid ( const QColor &  col) [private, slot]

Definition at line 259 of file lines.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void kLinesSetup::slotColstart ( const QColor &  col) [private, slot]

Definition at line 254 of file lines.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 269 of file lines.cpp.

                          {
       KMessageBox::about(this,
              i18n("Lines Version 2.2.0\n\n"
                               "Written by Dirk Staneker 1997\n"
                               "dirk.stanerker@student.uni-tuebingen.de"));
}

Here is the caller graph for this function:

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

Definition at line 244 of file lines.cpp.

                                   {
       length=len;
       if(saver) saver->setLines(length);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 277 of file lines.cpp.

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

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

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

    QString colName0, colName1, colName2;
    colName0.sprintf("#%02x%02x%02x", colstart.red(),
                   colstart.green(), colstart.blue() );
    config.writeEntry( "StartColor", colName0 );

    colName1.sprintf("#%02x%02x%02x", colmid.red(),
                   colmid.green(), colmid.blue() );
    config.writeEntry( "MidColor", colName1 );

    colName2.sprintf("#%02x%02x%02x", colend.red(),
                   colend.green(), colend.blue() );
    config.writeEntry( "EndColor", colName2 );

    config.sync();
    accept();
}

Here is the caller graph for this function:

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

Definition at line 249 of file lines.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

QColor kLinesSetup::colend [private]

Definition at line 92 of file lines.h.

QColor kLinesSetup::colmid [private]

Definition at line 92 of file lines.h.

KColorButton* kLinesSetup::colorPush0 [private]

Definition at line 88 of file lines.h.

KColorButton * kLinesSetup::colorPush1 [private]

Definition at line 88 of file lines.h.

KColorButton * kLinesSetup::colorPush2 [private]

Definition at line 88 of file lines.h.

QColor kLinesSetup::colstart [private]

Definition at line 92 of file lines.h.

int kLinesSetup::length [private]

Definition at line 91 of file lines.h.

QWidget* kLinesSetup::preview [private]

Definition at line 89 of file lines.h.

Definition at line 90 of file lines.h.

int kLinesSetup::speed [private]

Definition at line 91 of file lines.h.


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