dtor first
[personal-kdebase.git] / workspace / ksysguard / gui / TimerSettings.cc
blob76c94101bc1d6b115e2ea0f804e5f5022ca43f56
1 /*
2 KSysGuard, the KDE System Guard
4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <kacceleratormanager.h>
23 #include <klocale.h>
25 #include <QCheckBox>
26 #include <QLabel>
27 #include <QLayout>
28 #include <QDoubleSpinBox>
29 #include <QWhatsThis>
31 #include "TimerSettings.h"
33 TimerSettings::TimerSettings( QWidget *parent, const char *name )
34 : KDialog( parent )
36 setObjectName( name );
37 setModal( true );
38 setCaption( i18n( "Timer Settings" ) );
39 setButtons( Ok | Cancel );
40 showButtonSeparator( true );
42 QFrame *page = new QFrame( this );
43 setMainWidget( page );
45 QGridLayout *layout = new QGridLayout( page );
46 layout->setSpacing( spacingHint() );
47 layout->setMargin( 0 );
49 mUseGlobalUpdate = new QCheckBox( i18n( "Use update interval of worksheet" ), page );
50 layout->addWidget( mUseGlobalUpdate, 0, 0, 1, 2 );
52 mLabel = new QLabel( i18n( "Update interval:" ), page );
53 layout->addWidget( mLabel, 1, 0 );
55 mInterval = new QDoubleSpinBox( page );
56 mInterval->setRange( 0.1, 10000 );
57 mInterval->setSingleStep( 1 );
58 mInterval->setValue( 2 );
59 mInterval->setSuffix( i18n( " sec" ) );
60 layout->addWidget( mInterval, 1, 1 );
61 mLabel->setBuddy( mInterval );
62 mInterval->setWhatsThis( i18n( "All displays of the sheet are updated at the rate specified here." ) );
64 connect( mUseGlobalUpdate, SIGNAL( toggled( bool ) ),
65 SLOT( globalUpdateChanged( bool ) ) );
67 mUseGlobalUpdate->setChecked( true );
69 KAcceleratorManager::manage( this );
72 TimerSettings::~TimerSettings()
76 void TimerSettings::setUseGlobalUpdate( bool value )
78 mUseGlobalUpdate->setChecked( value );
81 bool TimerSettings::useGlobalUpdate() const
83 return mUseGlobalUpdate->isChecked();
86 void TimerSettings::setInterval( double interval )
88 mInterval->setValue( interval );
91 double TimerSettings::interval() const
93 return mInterval->value();
96 void TimerSettings::globalUpdateChanged( bool value )
98 mInterval->setEnabled( !value );
99 mLabel->setEnabled( !value );
102 #include "TimerSettings.moc"