Back to index

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

KRotation screen saver setup dialog. More...

#include <rotation.h>

Collaboration diagram for KRotationSetup:
Collaboration graph
[legend]

List of all members.

Public Slots

void okButtonClickedSlot (void)
 slot for the OK Button: save settings and exit
void aboutButtonClickedSlot (void)
 slot for the About Button: show the About dialog
void randomTracesToggled (bool state)
void xTraceToggled (bool state)
void yTraceToggled (bool state)
void zTraceToggled (bool state)
void lengthEnteredSlot (const QString &s)
void LzEnteredSlot (const QString &s)
void thetaEnteredSlot (const QString &s)

Public Member Functions

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

Private Attributes

KRotationSaverm_saver
 the screen saver widget which is displayed in the preview area

Detailed Description

KRotation screen saver setup dialog.

This class handles the KRotation screen saver setup dialog.

Definition at line 351 of file rotation.h.


Constructor & Destructor Documentation

KRotationSetup::KRotationSetup ( QWidget *  parent = NULL)

Definition at line 725 of file rotation.cpp.

   : QDialog(parent)
{
   setupUi(this);

   // the dialog should block, no other control center input should be possible
   // until the dialog is closed
   setModal(true);

   m_lengthEdit->setValidator(
      new QDoubleValidator(
         KRotationSaver::sm_traceLengthSecondsLimitLower,
         KRotationSaver::sm_traceLengthSecondsLimitUpper,
         3, m_lengthEdit));
   m_LzEdit->setValidator(
      new QDoubleValidator(
         KRotationSaver::sm_LzLimitLower,
         KRotationSaver::sm_LzLimitUpper,
         3, m_LzEdit));
   m_thetaEdit->setValidator(
      new QDoubleValidator(
         KRotationSaver::sm_initEulerThetaLimitLower,
         KRotationSaver::sm_initEulerThetaLimitUpper,
         3, m_thetaEdit));

   // set tool tips of editable fields
   m_lengthEdit->setToolTip(
      ki18n("Length of traces in seconds of visibility.\nValid values from %1 to %2.")
      .subs(KRotationSaver::sm_traceLengthSecondsLimitLower, 0, 'f', 2)
      .subs(KRotationSaver::sm_traceLengthSecondsLimitUpper, 0, 'f', 2)
      .toString());
   m_LzEdit->setToolTip(
      ki18n("Angular momentum in z direction in arbitrary units.\nValid values from %1 to %2.")
      .subs(KRotationSaver::sm_LzLimitLower, 0, 'f', 2)
      .subs(KRotationSaver::sm_LzLimitUpper, 0, 'f', 2)
      .toString());
   m_thetaEdit->setToolTip(
      ki18n("Gravitational constant in arbitrary units.\nValid values from %1 to %2.")
      .subs(KRotationSaver::sm_initEulerThetaLimitLower, 0, 'f', 2)
      .subs(KRotationSaver::sm_initEulerThetaLimitUpper, 0, 'f', 2)
      .toString());

   // setting the background of m_preview widget is not necessary, it's content
   // is overlayed with the embedded GL widget anyway
   m_preview->show();    // otherwise saver does not get correct size initially

   // create screen saver and give it the WinID of the preview area in which it
   // will be embedded
   m_saver = new KRotationSaver(m_preview->winId());

   // read settings from saver and update GUI elements with these values, saver
   // has read settings in its constructor

   // set editable fields with stored values as defaults
   m_xTrace->setChecked(m_saver->traceFlag(0));
   m_yTrace->setChecked(m_saver->traceFlag(1));
   m_zTrace->setChecked(m_saver->traceFlag(2));
   m_randTraces->setChecked(m_saver->randomTraces());
   QString text;
   text.setNum(m_saver->traceLengthSeconds());
   m_lengthEdit->setText(text);
   text.setNum(m_saver->Lz());
   m_LzEdit->setText(text);
   text.setNum(m_saver->initEulerTheta());
   m_thetaEdit->setText(text);

   // if the preview area is resized it emits the resized() event which is
   // caught by m_saver.  The embedded GLArea is resized to fit into the preview
   // area.
   connect(m_preview,   SIGNAL(resized(QResizeEvent*)),
           m_saver,     SLOT(resizeGlArea(QResizeEvent*)));

   connect(m_okButton,    SIGNAL(clicked()),            this, SLOT(okButtonClickedSlot()));
   connect(m_aboutButton, SIGNAL(clicked()),            this, SLOT(aboutButtonClickedSlot()));

   connect(m_xTrace,      SIGNAL(toggled(bool)),        this, SLOT(xTraceToggled(bool)));
   connect(m_randTraces,  SIGNAL(toggled(bool)),        this, SLOT(randomTracesToggled(bool)));
   connect(m_yTrace,      SIGNAL(toggled(bool)),        this, SLOT(yTraceToggled(bool)));
   connect(m_zTrace,      SIGNAL(toggled(bool)),        this, SLOT(zTraceToggled(bool)));
   connect(m_lengthEdit,  SIGNAL(textChanged(QString)), this, SLOT(lengthEnteredSlot(QString)));
   connect(m_LzEdit,      SIGNAL(textChanged(QString)), this, SLOT(LzEnteredSlot(QString)));
   connect(m_thetaEdit,   SIGNAL(textChanged(QString)), this, SLOT(thetaEnteredSlot(QString)));
}

Here is the call graph for this function:

Definition at line 809 of file rotation.cpp.

{
   delete m_saver;
}

Member Function Documentation

slot for the About Button: show the About dialog

Definition at line 829 of file rotation.cpp.

{
   KMessageBox::about(this, i18n("\
<h3>KRotation Screen Saver for KDE</h3>\
<p>Simulation of a force free rotating asymmetric body</p>\
<p>Copyright (c) Georg&nbsp;Drenkhahn 2004</p>\
<p><tt>Georg.Drenkhahn@gmx.net</tt></p>"));
}

Here is the caller graph for this function:

void KRotationSetup::lengthEnteredSlot ( const QString &  s) [slot]

Definition at line 861 of file rotation.cpp.

{
   m_saver->setTraceLengthSeconds(s.toDouble());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KRotationSetup::LzEnteredSlot ( const QString &  s) [slot]

Definition at line 865 of file rotation.cpp.

{
   m_saver->setLz(s.toDouble());
   m_saver->initData();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KRotationSetup::okButtonClickedSlot ( void  ) [slot]

slot for the OK Button: save settings and exit

Definition at line 815 of file rotation.cpp.

{
   KConfigGroup config(KGlobal::config(), "Settings");
   config.writeEntry("x trace",       m_saver->traceFlag(0));
   config.writeEntry("y trace",       m_saver->traceFlag(1));
   config.writeEntry("z trace",       m_saver->traceFlag(2));
   config.writeEntry("random traces", m_saver->randomTraces());
   config.writeEntry("length",        m_saver->traceLengthSeconds());
   config.writeEntry("Lz",            m_saver->Lz());
   config.writeEntry("theta",         m_saver->initEulerTheta());
   config.sync();
   accept();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KRotationSetup::randomTracesToggled ( bool  state) [slot]

Definition at line 850 of file rotation.cpp.

{
   m_saver->setRandomTraces(state);
   if (!state)
   {
      // restore settings from gui if random traces are turned off
      m_saver->setTraceFlag(0, m_xTrace->isChecked());
      m_saver->setTraceFlag(1, m_yTrace->isChecked());
      m_saver->setTraceFlag(2, m_zTrace->isChecked());
   }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KRotationSetup::thetaEnteredSlot ( const QString &  s) [slot]

Definition at line 870 of file rotation.cpp.

{
   m_saver->setInitEulerTheta(s.toDouble());
   m_saver->initData();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KRotationSetup::xTraceToggled ( bool  state) [slot]

Definition at line 838 of file rotation.cpp.

{
   m_saver->setTraceFlag(0, state);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KRotationSetup::yTraceToggled ( bool  state) [slot]

Definition at line 842 of file rotation.cpp.

{
   m_saver->setTraceFlag(1, state);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void KRotationSetup::zTraceToggled ( bool  state) [slot]

Definition at line 846 of file rotation.cpp.

{
   m_saver->setTraceFlag(2, state);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

the screen saver widget which is displayed in the preview area

Definition at line 374 of file rotation.h.


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