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 #ifndef KSG_WORKSHEET_H
23 #define KSG_WORKSHEET_H
28 #include <SensorDisplay.h>
29 #include "SharedSettings.h"
32 class QDragEnterEvent
;
37 class ProcessController
;
40 A WorkSheet contains the displays to visualize the sensor results. When
41 creating the WorkSheet you must specify the number of columns. Displays
42 can be added and removed on the fly. The grid layout will handle the
43 layout. The number of columns can not be changed. Displays are added by
44 dragging a sensor from the sensor browser over the WorkSheet.
46 class WorkSheet
: public QWidget
51 explicit WorkSheet( QWidget
* parent
);
52 WorkSheet( uint rows
, uint columns
, uint interval
, QWidget
* parent
);
55 bool load( const QString
&fileName
);
56 bool save( const QString
&fileName
);
57 bool exportWorkSheet( const QString
&fileName
);
63 void setFileName( const QString
&fileName
);
64 QString
fileName() const;
66 bool isLocked() const {return mSharedSettings
.locked
;}
68 QString
title() const;
69 QString
translatedTitle() const;
71 KSGRD::SensorDisplay
* addDisplay( const QString
&hostname
,
72 const QString
&monitor
,
73 const QString
&sensorType
,
74 const QString
&sensorDescr
,
75 uint rows
, uint columns
);
78 ProcessController
*getLocalProcessController() const { return mLocalProcessController
; }
81 void showPopupMenu( KSGRD::SensorDisplay
*display
);
82 void setTitle( const QString
&title
);
86 void titleChanged( QWidget
*sheet
);
90 virtual void changeEvent( QEvent
* event
);
91 virtual QSize
sizeHint() const;
92 void dragEnterEvent( QDragEnterEvent
* );
93 void dropEvent( QDropEvent
* );
94 bool event( QEvent
* );
95 void setUpdateInterval( unsigned int interval
);
96 int updateInterval() const;
99 void removeDisplay( KSGRD::SensorDisplay
*display
);
101 bool replaceDisplay( uint row
, uint column
, QDomElement
& element
);
103 void replaceDisplay( uint row
, uint column
,
104 KSGRD::SensorDisplay
* display
= 0 );
106 void collectHosts( QStringList
&list
);
108 void createGrid( uint rows
, uint columns
);
110 void resizeGrid( uint rows
, uint columns
);
112 KSGRD::SensorDisplay
* currentDisplay( uint
* row
= 0, uint
* column
= 0 );
116 QString
currentDisplayAsXML();
118 ProcessController
*mLocalProcessController
;
123 QGridLayout
* mGridLayout
;
126 QString mTranslatedTitle
;
128 SharedSettings mSharedSettings
;
133 This two dimensional array stores the pointers to the sensor displays
134 or if no sensor is present at a position a pointer to a dummy widget.
135 The size of the array corresponds to the size of the grid layout.
137 KSGRD::SensorDisplay
*** mDisplayList
;