2
KSysGuard, the KDE System Guard
4
Copyright (c) 1999 - 2002 Chris Schlaeger <cs@kde.org>
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of version 2 of the GNU General Public
8
License as published by the Free Software Foundation.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#include <kacceleratormanager.h>
22
#include <klineedit.h>
24
#include <knuminput.h>
26
#include <QtGui/QGroupBox>
27
#include <QtGui/QLabel>
28
#include <QtGui/QLayout>
29
#include <QtGui/QSpinBox>
32
#include "WorkSheetSettings.h"
34
WorkSheetSettings::WorkSheetSettings( QWidget* parent, bool locked )
37
setObjectName( "WorkSheetSettings" );
39
setCaption( i18n( "Worksheet Properties" ) );
40
setButtons( Ok | Cancel );
41
showButtonSeparator( true );
43
QWidget *page = new QWidget( this );
44
setMainWidget( page );
46
QVBoxLayout *topLayout = new QVBoxLayout( page );
47
topLayout->setMargin( 0 );
48
topLayout->setSpacing( spacingHint() );
50
QGroupBox *group = new QGroupBox( i18n( "Title" ), page );
52
QGridLayout *groupLayout = new QGridLayout;
53
group->setLayout( groupLayout );
54
groupLayout->setAlignment( Qt::AlignTop );
56
mSheetTitle = new KLineEdit( group );
57
groupLayout->addWidget( mSheetTitle, 0, 0 );
59
topLayout->addWidget( group );
61
group = new QGroupBox( i18n( "Properties" ), page );
63
groupLayout = new QGridLayout;
64
group->setLayout( groupLayout );
65
groupLayout->setAlignment( Qt::AlignTop );
70
label = new QLabel( i18n( "Rows:" ), group );
71
groupLayout->addWidget( label, ++row_num, 0 );
73
mRows = new KIntNumInput( 2, group );
74
mRows->setMaximum( 42 );
75
mRows->setMinimum( 1 );
76
groupLayout->addWidget( mRows, row_num, 1 );
77
label->setBuddy( mRows );
79
label = new QLabel( i18n( "Columns:" ), group );
80
groupLayout->addWidget( label, ++row_num, 0 );
82
mColumns = new KIntNumInput( 2, group );
83
mColumns->setMaximum( 42 );
84
mColumns->setMinimum( 1 );
85
groupLayout->addWidget( mColumns, 1, 1 );
86
label->setBuddy( mColumns );
87
mRows->setWhatsThis( i18n( "Enter the number of rows the sheet should have." ) );
88
mColumns->setWhatsThis( i18n( "Enter the number of columns the sheet should have." ) );
90
label = new QLabel( i18n( "Update interval:" ), group );
91
groupLayout->addWidget( label, ++row_num, 0 );
93
mInterval = new KIntNumInput( row_num, group );
94
mInterval->setMaximum( 300 );
95
mInterval->setMinimum( 1 );
96
mInterval->setSuffix( i18n( " sec" ) );
97
groupLayout->addWidget( mInterval, row_num, 1 );
98
label->setBuddy( mInterval );
100
topLayout->addWidget( group );
102
mInterval->setWhatsThis( i18n( "All displays of the sheet are updated at the rate specified here." ) );
103
mSheetTitle->setToolTip( i18n( "Enter the title of the worksheet here." ) );
105
KAcceleratorManager::manage( page );
107
mSheetTitle->setFocus();
109
resize( QSize( 250, 230 ).expandedTo( minimumSizeHint() ) );
112
WorkSheetSettings::~WorkSheetSettings()
116
void WorkSheetSettings::setRows( int rows )
118
mRows->setValue( rows );
121
int WorkSheetSettings::rows() const
123
return mRows->value();
126
void WorkSheetSettings::setColumns( int columns )
128
mColumns->setValue( columns );
131
int WorkSheetSettings::columns() const
133
return mColumns->value();
136
void WorkSheetSettings::setInterval( int interval )
138
mInterval->setValue( interval );
141
int WorkSheetSettings::interval() const
143
return mInterval->value();
146
void WorkSheetSettings::setSheetTitle( const QString &title )
148
mSheetTitle->setText( title );
151
QString WorkSheetSettings::sheetTitle() const
153
return mSheetTitle->text();
156
#include "WorkSheetSettings.moc"