Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 111012 | Differences between
and this patch

Collapse All | Expand All

(-)kcpufreq/kcpufreq/kcpufreq.cpp (-13 / +13 lines)
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
(-)kcpufreq/kcpufreq/kcpufreq.h (-7 / +3 lines)
Lines 32-43 Link Here
32
#define FREQ_CUR "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
32
#define FREQ_CUR "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
33
#define FREQ_MAX "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
33
#define FREQ_MAX "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
34
34
35
#define PIXMAP_NA "cpufreq_na"
35
int min( int, int);
36
#define PIXMAP_25 "cpufreq_25"
36
int max( int, int);
37
#define PIXMAP_50 "cpufreq_50"
38
#define PIXMAP_75 "cpufreq_75"
39
#define PIXMAP_100 "cpufreq_100"
40
41
37
42
class Kcpufreq : public KPanelApplet
38
class Kcpufreq : public KPanelApplet
43
{
39
{
Lines 131-137 Link Here
131
  myview *mainView;
127
  myview *mainView;
132
  
128
  
133
  // stores the five different pixmaps indicating the CPU frequency
129
  // stores the five different pixmaps indicating the CPU frequency
134
  QPixmap pixmaps[5];
130
  //QPixmap pixmaps[5];
135
131
136
  // used to detect changes in the frequency.
132
  // used to detect changes in the frequency.
137
  unsigned long previous_freq_cur, previous_freq_max;
133
  unsigned long previous_freq_cur, previous_freq_max;
(-)kcpufreq/kcpufreq/myview.ui (-42 / +44 lines)
Lines 6-35 Link Here
6
    </property>
6
    </property>
7
    <property name="geometry">
7
    <property name="geometry">
8
        <rect>
8
        <rect>
9
            <x>1</x>
9
            <x>0</x>
10
            <y>0</y>
10
            <y>0</y>
11
            <width>122</width>
11
            <width>124</width>
12
            <height>48</height>
12
            <height>18</height>
13
        </rect>
13
        </rect>
14
    </property>
14
    </property>
15
    <property name="sizePolicy">
15
    <property name="sizePolicy">
16
        <sizepolicy>
16
        <sizepolicy>
17
            <hsizetype>5</hsizetype>
17
            <hsizetype>3</hsizetype>
18
            <vsizetype>5</vsizetype>
18
            <vsizetype>3</vsizetype>
19
            <horstretch>0</horstretch>
19
            <horstretch>1</horstretch>
20
            <verstretch>0</verstretch>
20
            <verstretch>1</verstretch>
21
        </sizepolicy>
21
        </sizepolicy>
22
    </property>
22
    </property>
23
    <property name="minimumSize">
23
    <property name="minimumSize">
24
        <size>
24
        <size>
25
            <width>40</width>
25
            <width>32</width>
26
            <height>0</height>
26
            <height>18</height>
27
        </size>
27
        </size>
28
    </property>
28
    </property>
29
    <property name="maximumSize">
29
    <property name="maximumSize">
30
        <size>
30
        <size>
31
            <width>122</width>
31
            <width>32767</width>
32
            <height>48</height>
32
            <height>32767</height>
33
        </size>
34
    </property>
35
    <property name="sizeIncrement">
36
        <size>
37
            <width>1</width>
38
            <height>1</height>
39
        </size>
40
    </property>
41
    <property name="baseSize">
42
        <size>
43
            <width>32</width>
44
            <height>18</height>
33
        </size>
45
        </size>
34
    </property>
46
    </property>
35
    <property name="caption">
47
    <property name="caption">
Lines 37-89 Link Here
37
    </property>
49
    </property>
38
    <widget class="QLabel">
50
    <widget class="QLabel">
39
        <property name="name">
51
        <property name="name">
40
            <cstring>freqIcon</cstring>
41
        </property>
42
        <property name="geometry">
43
            <rect>
44
                <x>0</x>
45
                <y>0</y>
46
                <width>24</width>
47
                <height>24</height>
48
            </rect>
49
        </property>
50
        <property name="pixmap">
51
            <pixmap>image0</pixmap>
52
        </property>
53
        <property name="scaledContents">
54
            <bool>true</bool>
55
        </property>
56
    </widget>
57
    <widget class="QLabel">
58
        <property name="name">
59
            <cstring>freqLabel</cstring>
52
            <cstring>freqLabel</cstring>
60
        </property>
53
        </property>
61
        <property name="geometry">
54
        <property name="geometry">
62
            <rect>
55
            <rect>
63
                <x>26</x>
56
                <x>0</x>
64
                <y>0</y>
57
                <y>0</y>
65
                <width>50</width>
58
                <width>50</width>
66
                <height>24</height>
59
                <height>18</height>
67
            </rect>
60
            </rect>
68
        </property>
61
        </property>
69
        <property name="maximumSize">
62
        <property name="sizePolicy">
63
            <sizepolicy>
64
                <hsizetype>3</hsizetype>
65
                <vsizetype>3</vsizetype>
66
                <horstretch>1</horstretch>
67
                <verstretch>1</verstretch>
68
            </sizepolicy>
69
        </property>
70
        <property name="minimumSize">
70
            <size>
71
            <size>
71
                <width>96</width>
72
                <width>32</width>
72
                <height>48</height>
73
                <height>18</height>
73
            </size>
74
            </size>
74
        </property>
75
        </property>
75
        <property name="text">
76
        <property name="text">
76
            <string>0 MHz</string>
77
            <string>2000MHz</string>
78
        </property>
79
        <property name="scaledContents">
80
            <bool>true</bool>
77
        </property>
81
        </property>
78
        <property name="alignment">
82
        <property name="alignment">
79
            <set>AlignVCenter</set>
83
            <set>AlignVCenter</set>
80
        </property>
84
        </property>
85
        <property name="indent">
86
            <number>0</number>
87
        </property>
81
    </widget>
88
    </widget>
82
</widget>
89
</widget>
83
<images>
90
<layoutdefaults spacing="5" margin="5"/>
84
    <image name="image0">
85
        <data format="PNG" length="986">89504e470d0a1a0a0000000d4948445200000018000000180806000000e0773df8000003a1494441544889bd95b16f1c4514c67f7b37216fb02ded120bee3ace72c16151248114f00744584a24d2ba704145c51f40055668a8901c216869a990a0a301894848c8058a5c44e22211380b3bdc06cecc736eeca19899bd5b0b84681869351aedccf7bef7bdefcdc0ff388a7ff9df495fb1f3ee4e2784509cfb4c08c19cc32bfe113484d0cd9b8090c0f3dc3947a80b2c0106f80d70455104a09b3765a0b3afbefc2ccccf09a0fc9775b9da5f13230f37ae6ccc00733e25c4087bf71f2008139d60b14c748220a84630f5f3591014a55c2e79f5952157af5dbd0d6c254c9f0304e074f1d0b81e834f60066aad23a8c6353e1e9cf848a2a6468c003c93f02069c6bd3b12ac29412ac62632c747303189b99f33cfaa385c9cbdc37a4bc42aaf8306bb3c606d7b7f3566604a9c11aa6ad84a1f12739f40b038ef52f239d642506301c54a0f567ac0fe0706c04a8554039072ae7566ecc1a96b316eb4cf19f9546f03b61c822d91e53e4d91d7b6f7d7617f478c2c7ff1f9e60d94264806cfb5c8cc6b5fb7335145802b6f8fbeab8fea29700c9ce522ff09bcaf5e9f13233772da2df005ed9b751e3eba0f03f5517d027c0adc07c63940a2c345f58a4e95c974d22e6c669ae599295c006620365a95e8a227c021f018d00e736e07c00f622416d2cf65fa5b70405d7b9ee7c38fc0cfc02f8b8d0630cb856d0a3d6bcb51fbba5560255ab99129f6d3ef4995226710801042b8d8f2fd6cc1b28b41137863d9f6e85e7ef9f22463a6462b0328a34ffae860b79d7e02cb1dbb086a8d8d8298b8df1ab87747aec3e898b79e67e3cd074b9d66b3f4a01a20a6425551af73ab2e349935760e6e1a5962c10d5823202555f522c0c7b1d1ca01acf411e9010e75da583483391c5622782555d4de4ab3475d7491933ed5ca001501e8c646dbda5b87bd1d60e9fbafb76ee65b330fe7e7e0120f52dab2059e33d9d8deff16f61db1d14eb38b26c06de059859bcdc9058f6579d4a70bd0c53ec8b512234894ef18b843745263d3c7c31786b35b6fdc9a9522ecbcf74eb25ed33c58038ea4f14270c1a280a4f5707dd8191f8c0feb69fd0878d4701cbe343cd97c7dd36d5c7bed12f0512a5b377d01e88a910243478c148aa2533d4dff027046f4d413e057e2d3f9477e32bb00bb1fee9a5ebf578e7e1a85bbdfdcbd347e38eecbb278c05465352b574a53ad564ca693a7f104550df561ada3839177b53b39383870ead50147c014e60f7741fb51ef123bf2a9b40608bdd55e21a5142817d46b47a71a140d3ad5bc3f5f2c67c00c087f0107460d494d8c11f40000000049454e44ae426082</data>
86
    </image>
87
</images>
88
<layoutdefaults spacing="6" margin="11"/>
89
</UI>
91
</UI>

Return to bug 111012