Lines 59-72
Link Here
|
59 |
// Get the current application configuration handle |
59 |
// Get the current application configuration handle |
60 |
ksConfig = config(); |
60 |
ksConfig = config(); |
61 |
|
61 |
|
62 |
// initialise pixmaps |
|
|
63 |
pixmaps[0]=KGlobal::iconLoader()->loadIcon(PIXMAP_NA,KIcon::Panel); |
64 |
pixmaps[1]=KGlobal::iconLoader()->loadIcon(PIXMAP_25,KIcon::Panel); |
65 |
pixmaps[2]=KGlobal::iconLoader()->loadIcon(PIXMAP_50,KIcon::Panel); |
66 |
pixmaps[3]=KGlobal::iconLoader()->loadIcon(PIXMAP_75,KIcon::Panel); |
67 |
pixmaps[4]=KGlobal::iconLoader()->loadIcon(PIXMAP_100,KIcon::Panel); |
68 |
|
69 |
|
70 |
mainView = new myview(this); |
62 |
mainView = new myview(this); |
71 |
mainView->show(); |
63 |
mainView->show(); |
72 |
|
64 |
|
Lines 97-111
Link Here
|
97 |
} |
89 |
} |
98 |
*/ |
90 |
*/ |
99 |
|
91 |
|
|
|
92 |
int min(int a, int b) |
93 |
{ |
94 |
return (a > b)?b:a; |
95 |
} |
96 |
|
97 |
int max(int a, int b) |
98 |
{ |
99 |
return (a > b)?a:b; |
100 |
} |
100 |
|
101 |
|
101 |
int Kcpufreq::widthForHeight( int height ) const |
102 |
int Kcpufreq::widthForHeight( int height ) const |
102 |
{ |
103 |
{ |
103 |
return 26 + (height * 2); |
104 |
return min(max(height * 3,mainView->minimumWidth()),mainView->maximumWidth()); |
104 |
} |
105 |
} |
105 |
|
106 |
|
106 |
int Kcpufreq::heightForWidth( int width ) const |
107 |
int Kcpufreq::heightForWidth( int width ) const |
107 |
{ |
108 |
{ |
108 |
return (width-26) / 2; |
109 |
return min(max(width / 3,mainView->minimumHeight() * 1),mainView->maximumHeight() * 1); |
109 |
} |
110 |
} |
110 |
|
111 |
|
111 |
/** |
112 |
/** |
Lines 166-180
Link Here
|
166 |
freq_max != this->previous_freq_max) { |
167 |
freq_max != this->previous_freq_max) { |
167 |
QString qs; |
168 |
QString qs; |
168 |
if(freq_cur >= 1000000) { |
169 |
if(freq_cur >= 1000000) { |
169 |
qs = QString::number((double)freq_cur / 1000000,'f',2) + " GHz"; |
170 |
qs = QString::number((double)freq_cur / 1000000,'f',2) + "GHz"; |
170 |
} else if(freq_cur > 0) { |
171 |
} else if(freq_cur > 0) { |
171 |
qs = QString::number(freq_cur / 1000) + " MHz"; |
172 |
qs = QString::number(freq_cur / 1000) + "MHz"; |
172 |
} else { |
173 |
} else { |
173 |
qs = "n/a"; |
174 |
qs = "n/a"; |
174 |
} |
175 |
} |
175 |
|
176 |
|
176 |
mainView->freqLabel->setText(qs); |
177 |
mainView->freqLabel->setText(qs); |
177 |
mainView->freqIcon->setPixmap(pixmaps[ratio/25]); |
|
|
178 |
mainView->update(); |
178 |
mainView->update(); |
179 |
|
179 |
|
180 |
// save new frequency so that we can detect changes |
180 |
// save new frequency so that we can detect changes |