~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to ksysguard/gui/TimerSettings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    KSysGuard, the KDE System Guard
 
3
   
 
4
    Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
 
5
    
 
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.
 
10
 
 
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.
 
15
 
 
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.
 
19
 
 
20
*/
 
21
 
 
22
#include <kacceleratormanager.h>
 
23
#include <klocale.h>
 
24
 
 
25
#include <QCheckBox>
 
26
#include <QLabel>
 
27
#include <QLayout>
 
28
#include <QDoubleSpinBox>
 
29
#include <QWhatsThis>
 
30
 
 
31
#include "TimerSettings.h"
 
32
 
 
33
TimerSettings::TimerSettings( QWidget *parent, const char *name )
 
34
  : KDialog( parent )
 
35
{
 
36
  setObjectName( name );
 
37
  setModal( true );
 
38
  setCaption( i18n( "Timer Settings" ) );
 
39
  setButtons( Ok | Cancel );
 
40
 
 
41
  QFrame *page = new QFrame( this );
 
42
  setMainWidget( page );
 
43
 
 
44
  QGridLayout *layout = new QGridLayout( page );
 
45
  layout->setSpacing( spacingHint() );
 
46
  layout->setMargin( 0 );
 
47
 
 
48
  mUseGlobalUpdate = new QCheckBox( i18n( "Use update interval of worksheet" ), page );
 
49
  layout->addWidget( mUseGlobalUpdate, 0, 0, 1, 2 );
 
50
 
 
51
  mLabel = new QLabel( i18n( "Update interval:" ), page );
 
52
  layout->addWidget( mLabel, 1, 0 );
 
53
 
 
54
  mInterval = new QDoubleSpinBox( page );
 
55
  mInterval->setRange( 0.1, 10000 );
 
56
  mInterval->setSingleStep( 1 );
 
57
  mInterval->setValue( 2 );
 
58
  mInterval->setSuffix( i18n( " sec" ) );
 
59
  layout->addWidget( mInterval, 1, 1 );
 
60
  mLabel->setBuddy( mInterval );
 
61
  mInterval->setWhatsThis( i18n( "All displays of the sheet are updated at the rate specified here." ) );
 
62
 
 
63
  connect( mUseGlobalUpdate, SIGNAL( toggled( bool ) ),
 
64
           SLOT( globalUpdateChanged( bool ) ) );
 
65
 
 
66
  mUseGlobalUpdate->setChecked( true );
 
67
 
 
68
  KAcceleratorManager::manage( this );
 
69
}
 
70
 
 
71
TimerSettings::~TimerSettings()
 
72
{
 
73
}
 
74
 
 
75
void TimerSettings::setUseGlobalUpdate( bool value )
 
76
{
 
77
  mUseGlobalUpdate->setChecked( value );
 
78
}
 
79
 
 
80
bool TimerSettings::useGlobalUpdate() const
 
81
{
 
82
  return mUseGlobalUpdate->isChecked();
 
83
}
 
84
 
 
85
void TimerSettings::setInterval( double interval )
 
86
{
 
87
  mInterval->setValue( interval );
 
88
}
 
89
 
 
90
double TimerSettings::interval() const
 
91
{
 
92
  return mInterval->value();
 
93
}
 
94
 
 
95
void TimerSettings::globalUpdateChanged( bool value )
 
96
{
 
97
  mInterval->setEnabled( !value );
 
98
  mLabel->setEnabled( !value );
 
99
}
 
100
 
 
101
#include "TimerSettings.moc"