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

« back to all changes in this revision

Viewing changes to ksysguard/gui/SensorDisplayLib/MultiMeter.cc

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-10-11 14:04:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071011140448-v0eb7lxbb24zagca
Tags: 3.94.0-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
  mLowerLimit = mUpperLimit = 0;
41
41
  mLowerLimitActive = mUpperLimitActive = false;
42
42
 
 
43
  mIsFloat = false;
 
44
 
43
45
  mNormalDigitColor = KSGRD::Style->firstForegroundColor();
44
46
  mAlarmDigitColor = KSGRD::Style->alarmColor();
45
47
 
46
48
  mLcd = new QLCDNumber( this );
 
49
  mLcd->setFrameStyle( QFrame::NoFrame );
47
50
  mLcd->setSegmentStyle( QLCDNumber::Filled );
48
51
  setDigitColor( KSGRD::Style->firstForegroundColor() );
49
52
  mLcd->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
65
68
  if (sensorType != "integer" && sensorType != "float")
66
69
    return (false);
67
70
 
 
71
  mIsFloat = (sensorType == "float");
 
72
  mLcd->setSmallDecimalPoint( mIsFloat );
 
73
 
68
74
  registerSensor(new KSGRD::SensorProperties(hostName, sensorName, sensorType, title));
69
75
 
70
76
  /* To differentiate between answers from value requests and info
91
97
  else
92
98
  {
93
99
    double val = answer.toDouble();
94
 
    int digits = (int) log10(val) + 1;
 
100
 
 
101
    int digits = 1;
 
102
    if (qAbs(val) >= 1) {
 
103
      digits = (int) log10(qAbs(val)) + 1;
 
104
    }
 
105
    if (mIsFloat) {
 
106
      //Show two digits after the decimal point
 
107
      digits += 3;
 
108
    }
 
109
    if (val < 0) {
 
110
      //Add a digit for the negative sign
 
111
      digits += 1;
 
112
    }
95
113
 
96
114
    if (mSharedSettings->isApplet)
97
115
      mLcd->setNumDigits(qMin(4,digits));
98
116
    else
99
 
      mLcd->setNumDigits(qMin(5,digits));
 
117
      mLcd->setNumDigits(qMin(15,digits));
100
118
 
101
119
    mLcd->display(val);
102
120
    if (mLowerLimitActive && val < mLowerLimit)