| Summary: | When some sersors are missing, the wnole window is not updated | ||
|---|---|---|---|
| Product: | [Unmaintained] ksysguard | Reporter: | Aleksey Nogin <kde-bugs> |
| Component: | general | Assignee: | KSysGuard Developers <ksysguard-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | RedHat Enterprise Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Aleksey Nogin
2002-10-30 06:37:02 UTC
That's a feature rather than a bug. You want to know if there is a problem with a sensor. Maybe displaying the icon plus the other still functional sensors would help. Can this be made configurable (at least per-session)? SVN commit 610277 by johnflux:
* The tooltip for the signal plotter now indicates if the sensor had an error
* Fix a stupid bug in the ordering of the tootips
* When some sensors are missing, still update the whole window
BUG: 49913
M +40 -18 FancyPlotter.cc
M +4 -0 FancyPlotter.h
M +2 -1 SensorDisplay.cc
--- trunk/KDE/kdebase/workspace/ksysguard/gui/SensorDisplayLib/FancyPlotter.cc #610276:610277
@@ -39,6 +39,7 @@
: KSGRD::SensorDisplay( parent, title, workSheetSettings )
{
mBeams = 0;
+ mNumAccountedFor = 0;
mPlotter = new KSignalPlotter( this );
mPlotter->setVerticalLinesColor(KSGRD::Style->firstForegroundColor());
mPlotter->setHorizontalLinesColor(KSGRD::Style->secondForegroundColor());
@@ -257,19 +258,32 @@
void FancyPlotter::setTooltip()
{
QString tooltip;
+
+ QString description;
+ QString lastValue;
for ( uint i = 0; i < mBeams; ++i ) {
- if(sensors().at( mBeams -i - 1)->isLocalhost()) {
+ description = sensors().at(i)->description();
+ if(description.isEmpty()) {
+ description = sensors().at(i)->name();
+ }
+ if(sensors().at( i)->isOk()) {
+ lastValue = mPlotter->lastValue(i);
+ } else {
+ lastValue = i18n("Error");
+ }
+ if(sensors().at( i)->isLocalhost()) {
+
tooltip += QString( "%1%2%3 (%4)" ).arg( i != 0 ? "<br>" : "<qt>")
.arg("<font color=\"" + mPlotter->beamColors()[ i ].name() + "\">#</font>")
- .arg( sensors().at( mBeams - i - 1 )->description() )
- .arg( mPlotter->lastValue(i) );
+ .arg( description )
+ .arg( lastValue );
} else {
tooltip += QString( "%1%2%3:%4 (%5)" ).arg( i != 0 ? "<br>" : "<qt>" )
.arg("<font color=\"" + mPlotter->beamColors()[ i ].name() + "\">#</font>")
- .arg( sensors().at( mBeams - i - 1 )->hostName() )
- .arg( sensors().at( mBeams - i - 1 )->description() )
- .arg( mPlotter->lastValue(i) );
+ .arg( sensors().at( i )->hostName() )
+ .arg( description )
+ .arg( lastValue );
}
}
@@ -286,26 +300,34 @@
return mPlotter->sizeHint();
}
+void FancyPlotter::timerEvent( QTimerEvent*event ) //virtual
+{
+ if(!mSampleBuf.isEmpty()) {
+ while((uint)mSampleBuf.count() < mBeams)
+ mSampleBuf.append(0); //we might have invalid sensors missing so set their values to 0 at least
+ mPlotter->addSample( mSampleBuf );
+ }
+ mSampleBuf.clear();
+ SensorDisplay::timerEvent(event);
+}
void FancyPlotter::answerReceived( int id, const QStringList &answerlist )
{
QString answer;
if(!answerlist.isEmpty()) answer = answerlist[0];
if ( (uint)id < mBeams ) {
- if ( id != (int)mSampleBuf.count() ) {
- if ( id == 0 )
- sensorError( mBeams - 1, true );
- else
- sensorError( id - 1, true );
+
+ //Make sure that we put the answer in the correct place. It's index in the list should be equal to id
+
+ while(id < mSampleBuf.count())
+ mSampleBuf.append(0);
+
+ if(id == mSampleBuf.count()) {
+ mSampleBuf.append( answer.toDouble() );
+ } else {
+ mSampleBuf[id] = answer.toDouble();
}
- mSampleBuf.append( answer.toDouble() );
-
/* We received something, so the sensor is probably ok. */
sensorError( id, false );
-
- if ( id == (int)mBeams - 1 ) {
- mPlotter->addSample( mSampleBuf );
- mSampleBuf.clear();
- }
} else if ( id >= 100 ) {
KSGRD::SensorFloatInfo info( answer );
QString unit = info.unit();
--- trunk/KDE/kdebase/workspace/ksysguard/gui/SensorDisplayLib/FancyPlotter.h #610276:610277
@@ -80,12 +80,16 @@
void applySettings();
protected:
+ /** When we receive a timer event, draw the beams */
+ virtual void timerEvent( QTimerEvent* );
virtual bool eventFilter( QObject*, QEvent* );
virtual void resizeEvent( QResizeEvent* );
void setTooltip();
private:
uint mBeams;
+ /** Number of beams we've recieved an answer from since asking last */
+ uint mNumAccountedFor;
KSignalPlotter* mPlotter;
--- trunk/KDE/kdebase/workspace/ksysguard/gui/SensorDisplayLib/SensorDisplay.cc #610276:610277
@@ -403,7 +403,8 @@
void SensorDisplay::setSensorOk( bool ok )
{
if ( ok ) {
- delete mErrorIndicator;
+ if(mErrorIndicator)
+ delete mErrorIndicator;
mErrorIndicator = 0;
} else {
if ( mErrorIndicator )
|