~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy-backports

« back to all changes in this revision

Viewing changes to ksysguard/gui/WorkSheetSettings.cc

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-09-05 20:45:14 UTC
  • Revision ID: james.westby@ubuntu.com-20070905204514-632hhspl0nvrc84i
Tags: upstream-3.93.0
ImportĀ upstreamĀ versionĀ 3.93.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    KSysGuard, the KDE System Guard
 
3
 
 
4
    Copyright (c) 1999 - 2002 Chris Schlaeger <cs@kde.org>
 
5
 
 
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.
 
9
 
 
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.
 
14
 
 
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.
 
18
 
 
19
*/
 
20
 
 
21
#include <kacceleratormanager.h>
 
22
#include <klineedit.h>
 
23
#include <klocale.h>
 
24
#include <knuminput.h>
 
25
 
 
26
#include <QtGui/QGroupBox>
 
27
#include <QtGui/QLabel>
 
28
#include <QtGui/QLayout>
 
29
#include <QtGui/QSpinBox>
 
30
 
 
31
 
 
32
#include "WorkSheetSettings.h"
 
33
 
 
34
WorkSheetSettings::WorkSheetSettings( QWidget* parent, bool locked )
 
35
  : KDialog( parent )
 
36
{
 
37
  setObjectName( "WorkSheetSettings" );
 
38
  setModal( true );
 
39
  setCaption( i18n( "Worksheet Properties" ) );
 
40
  setButtons( Ok | Cancel );
 
41
  showButtonSeparator( true );
 
42
 
 
43
  QWidget *page = new QWidget( this );
 
44
  setMainWidget( page );
 
45
 
 
46
  QVBoxLayout *topLayout = new QVBoxLayout( page );
 
47
  topLayout->setMargin( 0 );
 
48
  topLayout->setSpacing( spacingHint() );
 
49
 
 
50
  QGroupBox *group = new QGroupBox( i18n( "Title" ), page );
 
51
 
 
52
  QGridLayout *groupLayout = new QGridLayout;
 
53
  group->setLayout( groupLayout );
 
54
  groupLayout->setAlignment( Qt::AlignTop );
 
55
 
 
56
  mSheetTitle = new KLineEdit( group );
 
57
  groupLayout->addWidget( mSheetTitle, 0, 0 );
 
58
 
 
59
  topLayout->addWidget( group );
 
60
 
 
61
  group = new QGroupBox( i18n( "Properties" ), page );
 
62
 
 
63
  groupLayout = new QGridLayout;
 
64
  group->setLayout( groupLayout );
 
65
  groupLayout->setAlignment( Qt::AlignTop );
 
66
 
 
67
  int row_num = -1;
 
68
  QLabel *label;
 
69
  if ( !locked ) {
 
70
    label = new QLabel( i18n( "Rows:" ), group );
 
71
    groupLayout->addWidget( label, ++row_num, 0 );
 
72
 
 
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 );
 
78
 
 
79
    label = new QLabel( i18n( "Columns:" ), group );
 
80
    groupLayout->addWidget( label, ++row_num, 0 );
 
81
 
 
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." ) );
 
89
  }
 
90
  label = new QLabel( i18n( "Update interval:" ), group );
 
91
  groupLayout->addWidget( label, ++row_num, 0 );
 
92
 
 
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 );
 
99
 
 
100
  topLayout->addWidget( group );
 
101
 
 
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." ) );
 
104
 
 
105
  KAcceleratorManager::manage( page );
 
106
 
 
107
  mSheetTitle->setFocus();
 
108
 
 
109
  resize( QSize( 250, 230 ).expandedTo( minimumSizeHint() ) );
 
110
}
 
111
 
 
112
WorkSheetSettings::~WorkSheetSettings()
 
113
{
 
114
}
 
115
 
 
116
void WorkSheetSettings::setRows( int rows )
 
117
{
 
118
  mRows->setValue( rows );
 
119
}
 
120
 
 
121
int WorkSheetSettings::rows() const
 
122
{
 
123
  return mRows->value();
 
124
}
 
125
 
 
126
void WorkSheetSettings::setColumns( int columns )
 
127
{
 
128
  mColumns->setValue( columns );
 
129
}
 
130
 
 
131
int WorkSheetSettings::columns() const
 
132
{
 
133
  return mColumns->value();
 
134
}
 
135
 
 
136
void WorkSheetSettings::setInterval( int interval )
 
137
{
 
138
  mInterval->setValue( interval );
 
139
}
 
140
 
 
141
int WorkSheetSettings::interval() const
 
142
{
 
143
  return mInterval->value();
 
144
}
 
145
 
 
146
void WorkSheetSettings::setSheetTitle( const QString &title )
 
147
{
 
148
  mSheetTitle->setText( title );
 
149
}
 
150
 
 
151
QString WorkSheetSettings::sheetTitle() const
 
152
{
 
153
  return mSheetTitle->text();
 
154
}
 
155
 
 
156
#include "WorkSheetSettings.moc"