[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/ksysguard/gui/SensorDisplayLib
From:       John Tapsell <john.tapsell () kdemail ! net>
Date:       2009-10-23 8:46:27
Message-ID: 1256287587.989852.18579.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1039283 by johnflux:

Store all the samples when we are invisible


 M  +7 -3      SignalPlotter.cc  


--- trunk/KDE/kdebase/workspace/ksysguard/gui/SensorDisplayLib/SignalPlotter.cc \
#1039282:1039283 @@ -40,8 +40,9 @@
 
 
 #define VERTICAL_LINE_OFFSET 1
+//Never store less 1000 samples if not visible.  This is kinda arbituary
+#define NUM_SAMPLES_WHEN_INVISIBLE ((uint)1000)
 
-
 #ifdef SVG_SUPPORT
 QHash<QString, Plasma::Svg *> KSignalPlotter::sSvgRenderer ;
 #endif
@@ -59,7 +60,7 @@
 KSignalPlotterPrivate::KSignalPlotterPrivate(KSignalPlotter * q_ptr) : q(q_ptr)
 {
     mPrecision = 0;
-    mMaxSamples = 4; //Never keep less than 4 samples. An arbitrary number
+    mMaxSamples = NUM_SAMPLES_WHEN_INVISIBLE;
     mMinValue = mMaxValue = 0.0;
     mUserMinValue = mUserMaxValue = 0.0;
     mNiceMinValue = mNiceMaxValue = 0.0;
@@ -549,7 +550,10 @@
      *     1) no wasted space and
      *     2) no loss of precision when drawing the first data point.
      */
-    mMaxSamples = uint(q->width() / mHorizontalScale + 4);
+    if(q->isVisible())
+        mMaxSamples = uint(q->width() / mHorizontalScale + 4);
+    else //If it's not visible, we can't rely on sensible values for width.  Store \
some minimum number of data points +        mMaxSamples = qMin(q->width() / \
mHorizontalScale + 4, NUM_SAMPLES_WHEN_INVISIBLE);  }
 
 void KSignalPlotter::paintEvent( QPaintEvent* event)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic