Back to index

kdeartwork  4.3.2
Public Member Functions | Private Slots | Private Member Functions | Private Attributes
KClockSetup Class Reference

#include <kclock.h>

Collaboration diagram for KClockSetup:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Private Slots

void slotOk ()
void slotHelp ()
void slotBgndColor (const QColor &)
void slotScaleColor (const QColor &)
void slotHourColor (const QColor &)
void slotMinColor (const QColor &)
void slotSecColor (const QColor &)
void slotSliderMoved (int)
void slotKeepCenteredChanged (int)

Private Member Functions

void readSettings ()

Private Attributes

KClockSaver_saver
QColor _bgndColor
QColor _scaleColor
QColor _hourColor
QColor _minColor
QColor _secColor
int _size
bool _keepCentered

Detailed Description

Definition at line 32 of file kclock.h.


Constructor & Destructor Documentation

KClockSetup::KClockSetup ( QWidget *  parent = 0)

Definition at line 74 of file kclock.cpp.

                                        :
       KDialog(parent),
       _saver(0)
{
       setCaption(i18n("Setup Clock Screen Saver"));
       setModal(true);
       setButtons(Ok|Cancel|Help);
       setDefaultButton(Ok);

       readSettings();

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

       QVBoxLayout *top = new QVBoxLayout(main);

       QHBoxLayout *hbox = new QHBoxLayout;
       top->addLayout(hbox);


       QGroupBox *colgroup = new QGroupBox(i18n("Colors"), main);
       QGridLayout *grid = new QGridLayout();

       QLabel *label;
       KColorButton *colorButton;

       label = new QLabel(i18n("&Hour-hand:"));
       colorButton = new KColorButton(_hourColor);
       colorButton->setFixedWidth(COLOR_BUTTON_WIDTH);
       label->setBuddy(colorButton);
       connect(colorButton, SIGNAL(changed(const QColor &)),
                     SLOT(slotHourColor(const QColor &)));
       grid->addWidget(label, 1, 1);
       grid->addWidget(colorButton, 1, 2);

       label = new QLabel(i18n("&Minute-hand:"));
       colorButton = new KColorButton(_minColor);
       colorButton->setFixedWidth(COLOR_BUTTON_WIDTH);
       label->setBuddy(colorButton);
       connect(colorButton, SIGNAL(changed(const QColor &)),
                     SLOT(slotMinColor(const QColor &)));
       grid->addWidget(label, 2, 1);
       grid->addWidget(colorButton, 2, 2);

       label = new QLabel(i18n("&Second-hand:"));
       colorButton = new KColorButton(_secColor);
       colorButton->setFixedWidth(COLOR_BUTTON_WIDTH);
       label->setBuddy(colorButton);
       connect(colorButton, SIGNAL(changed(const QColor &)),
                     SLOT(slotSecColor(const QColor &)));
       grid->addWidget(label, 3, 1);
       grid->addWidget(colorButton, 3, 2);

       label = new QLabel(i18n("Scal&e:"));
       colorButton = new KColorButton(_scaleColor);
       colorButton->setFixedWidth(COLOR_BUTTON_WIDTH);
       label->setBuddy(colorButton);
       connect(colorButton, SIGNAL(changed(const QColor &)),
                     SLOT(slotScaleColor(const QColor &)));
       grid->addWidget(label, 4, 1);
       grid->addWidget(colorButton, 4, 2);

       label = new QLabel(i18n("&Background:"));
       colorButton = new KColorButton(_bgndColor);
       colorButton->setFixedWidth(COLOR_BUTTON_WIDTH);
       label->setBuddy(colorButton);
       connect(colorButton, SIGNAL(changed(const QColor &)),
                     SLOT(slotBgndColor(const QColor &)));
       grid->addWidget(label, 5, 1);
       grid->addWidget(colorButton, 5, 2);

       hbox->addWidget(colgroup);
       colgroup->setLayout(grid);


       QWidget *_preview = new QWidget(main);
       _preview->setFixedSize(220, 165);
       _preview->show();
       _saver = new KClockSaver(_preview->winId());
       hbox->addWidget(_preview);

       label = new QLabel(i18n("Si&ze:"), main);
       top->addWidget(label);
       QSlider *qs = new QSlider(Qt::Horizontal);
       label->setBuddy(qs);
       qs->setRange(0, MAX_CLOCK_SIZE);
       qs->setSliderPosition(_size);
       qs->setTickInterval(1);
       qs->setTickPosition(QSlider::TicksBelow);
       connect(qs, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int)));
       top->addWidget(qs);

       KHBox *qsscale = new KHBox(main);
       label = new QLabel(i18n("Small"), qsscale);
       label->setAlignment(Qt::AlignLeading);
       label = new QLabel(i18n("Medium"), qsscale);
       label->setAlignment(Qt::AlignHCenter);
       label = new QLabel(i18n("Big"), qsscale);
       label->setAlignment(Qt::AlignTrailing);
       top->addWidget(qsscale);

       QCheckBox *keepCentered = new QCheckBox(i18n("&Keep clock centered"), main);
       keepCentered->setChecked(_keepCentered);
       connect(keepCentered, SIGNAL(stateChanged(int)), SLOT(slotKeepCenteredChanged(int)));
       top->addWidget(keepCentered);
       top->addStretch();

       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 187 of file kclock.cpp.

{
       delete _saver;
}

Member Function Documentation

void KClockSetup::readSettings ( ) [private]

Definition at line 193 of file kclock.cpp.

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

       _keepCentered = settings.readEntry("KeepCentered", DEFAULT_KEEP_CENTERED);
       _size = settings.readEntry("Size", DEFAULT_CLOCK_SIZE);
       if (_size > MAX_CLOCK_SIZE)
              _size = MAX_CLOCK_SIZE;

       KConfigGroup colors(KGlobal::config(), "Colors");
       QColor c = Qt::black;
       _bgndColor = colors.readEntry("Background", c);

       c = Qt::white;
       _scaleColor = colors.readEntry("Scale", c);
       _hourColor = colors.readEntry("HourHand", c);
       _minColor = colors.readEntry("MinuteHand", c);

       c = Qt::red;
       _secColor = colors.readEntry("SecondHand", c);

       if (_saver) {
              _saver->setBgndColor(_bgndColor);
              _saver->setScaleColor(_scaleColor);
              _saver->setHourColor(_hourColor);
              _saver->setMinColor(_minColor);
              _saver->setSecColor(_secColor);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KClockSetup::slotBgndColor ( const QColor &  color) [private, slot]

Definition at line 253 of file kclock.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 242 of file kclock.cpp.

{
       KMessageBox::about(this, "<qt>" + i18n(
                     "Clock Screen Saver<br>"
                     "Version 2.0<br>"
                     "<nobr>Melchior FRANZ (c) 2003, 2006, 2007</nobr>") +
                     "<br><a href=\"mailto:mfranz@kde.org\">mfranz@kde.org</a>"
                     "</qt>", QString(), KMessageBox::AllowLink);
}

Here is the caller graph for this function:

void KClockSetup::slotHourColor ( const QColor &  color) [private, slot]

Definition at line 269 of file kclock.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void KClockSetup::slotKeepCenteredChanged ( int  c) [private, slot]

Definition at line 300 of file kclock.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void KClockSetup::slotMinColor ( const QColor &  color) [private, slot]

Definition at line 277 of file kclock.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 224 of file kclock.cpp.

{
       KConfigGroup settings(KGlobal::config(), "Settings");
       settings.writeEntry("Size", _size);
       settings.writeEntry("KeepCentered", _keepCentered);
       settings.sync();

       KConfigGroup colors(KGlobal::config(), "Colors");
       colors.writeEntry("Background", _bgndColor);
       colors.writeEntry("Scale", _scaleColor);
       colors.writeEntry("HourHand", _hourColor);
       colors.writeEntry("MinuteHand", _minColor);
       colors.writeEntry("SecondHand", _secColor);
       colors.sync();
       accept();
}

Here is the caller graph for this function:

void KClockSetup::slotScaleColor ( const QColor &  color) [private, slot]

Definition at line 261 of file kclock.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void KClockSetup::slotSecColor ( const QColor &  color) [private, slot]

Definition at line 285 of file kclock.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void KClockSetup::slotSliderMoved ( int  v) [private, slot]

Definition at line 293 of file kclock.cpp.

{
       if (_saver)
              _saver->resizeClock(_size = v);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

QColor KClockSetup::_bgndColor [private]

Definition at line 54 of file kclock.h.

QColor KClockSetup::_hourColor [private]

Definition at line 56 of file kclock.h.

Definition at line 61 of file kclock.h.

QColor KClockSetup::_minColor [private]

Definition at line 57 of file kclock.h.

Definition at line 52 of file kclock.h.

QColor KClockSetup::_scaleColor [private]

Definition at line 55 of file kclock.h.

QColor KClockSetup::_secColor [private]

Definition at line 58 of file kclock.h.

int KClockSetup::_size [private]

Definition at line 60 of file kclock.h.


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