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 the GNU General Public
8 License version 2 or at your option version 3 as published by
9 the Free Software Foundation.
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 <klineedit.h>
25 #include <knuminput.h>
27 #include <QtGui/QGroupBox>
28 #include <QtGui/QLabel>
29 #include <QtGui/QLayout>
30 #include <QtGui/QSpinBox>
33 #include "WorkSheetSettings.h"
35 WorkSheetSettings::WorkSheetSettings( QWidget
* parent
, bool locked
)
38 setObjectName( "WorkSheetSettings" );
40 setCaption( i18n( "Tab Properties" ) );
41 setButtons( Ok
| Cancel
);
42 showButtonSeparator( true );
44 QWidget
*page
= new QWidget( this );
45 setMainWidget( page
);
47 QVBoxLayout
*topLayout
= new QVBoxLayout( page
);
48 topLayout
->setMargin( 0 );
49 topLayout
->setSpacing( spacingHint() );
51 QGroupBox
*group
= new QGroupBox( i18n( "Title" ), page
);
53 QGridLayout
*groupLayout
= new QGridLayout
;
54 group
->setLayout( groupLayout
);
55 groupLayout
->setAlignment( Qt::AlignTop
);
57 mSheetTitle
= new KLineEdit( group
);
58 groupLayout
->addWidget( mSheetTitle
, 0, 0 );
60 topLayout
->addWidget( group
);
62 group
= new QGroupBox( i18n( "Properties" ), page
);
64 groupLayout
= new QGridLayout
;
65 group
->setLayout( groupLayout
);
66 groupLayout
->setAlignment( Qt::AlignTop
);
71 label
= new QLabel( i18n( "Rows:" ), group
);
72 groupLayout
->addWidget( label
, ++row_num
, 0 );
74 mRows
= new KIntNumInput( 3, group
);
75 mRows
->setMaximum( 42 );
76 mRows
->setMinimum( 1 );
77 groupLayout
->addWidget( mRows
, row_num
, 1 );
78 label
->setBuddy( mRows
);
80 label
= new QLabel( i18n( "Columns:" ), group
);
81 groupLayout
->addWidget( label
, ++row_num
, 0 );
83 mColumns
= new KIntNumInput( 1, group
);
84 mColumns
->setMaximum( 42 );
85 mColumns
->setMinimum( 1 );
86 groupLayout
->addWidget( mColumns
, 1, 1 );
87 label
->setBuddy( mColumns
);
88 mRows
->setWhatsThis( i18n( "Enter the number of rows the sheet should have." ) );
89 mColumns
->setWhatsThis( i18n( "Enter the number of columns the sheet should have." ) );
91 label
= new QLabel( i18n( "Update interval:" ), group
);
92 groupLayout
->addWidget( label
, ++row_num
, 0 );
94 mInterval
= new KDoubleNumInput( 0.01, 1000.0, 2.0, group
, 0.5, 2 );
95 mInterval
->setSuffix( i18n( " sec" ) );
96 groupLayout
->addWidget( mInterval
, row_num
, 1 );
97 label
->setBuddy( mInterval
);
99 topLayout
->addWidget( group
);
101 mInterval
->setWhatsThis( i18n( "All displays of the sheet are updated at the rate specified here." ) );
102 mSheetTitle
->setToolTip( i18n( "Enter the title of the worksheet here." ) );
104 KAcceleratorManager::manage( page
);
106 mSheetTitle
->setFocus();
108 // resize( QSize( 250, 230 ).expandedTo( minimumSizeHint() ) );
111 WorkSheetSettings::~WorkSheetSettings()
115 void WorkSheetSettings::setRows( int rows
)
117 mRows
->setValue( rows
);
120 int WorkSheetSettings::rows() const
122 return mRows
->value();
125 void WorkSheetSettings::setColumns( int columns
)
127 mColumns
->setValue( columns
);
130 int WorkSheetSettings::columns() const
132 return mColumns
->value();
135 void WorkSheetSettings::setInterval( float interval
)
137 mInterval
->setValue( interval
);
140 float WorkSheetSettings::interval() const
142 return mInterval
->value();
145 void WorkSheetSettings::setSheetTitle( const QString
&title
)
147 mSheetTitle
->setText( title
);
150 QString
WorkSheetSettings::sheetTitle() const
152 return mSheetTitle
->text();
155 #include "WorkSheetSettings.moc"