author | harlekin <harlekin> | 2004-06-20 12:32:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-06-20 12:32:59 (UTC) |
commit | 3d49080501c6619f9bb323be9935d28f4458530f (patch) (unidiff) | |
tree | 277baf812e3377554ea1369f54b6b5ac7814d118 | |
parent | 63dd6d0c5919bd905f9c39eb1641d18c5372cdda (diff) | |
download | opie-3d49080501c6619f9bb323be9935d28f4458530f.zip opie-3d49080501c6619f9bb323be9935d28f4458530f.tar.gz opie-3d49080501c6619f9bb323be9935d28f4458530f.tar.bz2 |
BUGFIX: 0001321 - The batteryapplet shows a real popup frame now
-rw-r--r-- | core/applets/batteryapplet/batterystatus.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp index 655fdc4..5a24b94 100644 --- a/core/applets/batteryapplet/batterystatus.cpp +++ b/core/applets/batteryapplet/batterystatus.cpp | |||
@@ -1,256 +1,257 @@ | |||
1 | 1 | ||
2 | #include "batterystatus.h" | 2 | #include "batterystatus.h" |
3 | 3 | ||
4 | /* OPIE */ | 4 | /* OPIE */ |
5 | #include <opie2/odevice.h> | 5 | #include <opie2/odevice.h> |
6 | #include <qpe/power.h> | 6 | #include <qpe/power.h> |
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qdrawutil.h> | 10 | #include <qdrawutil.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qtextstream.h> | 12 | #include <qtextstream.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | 14 | ||
15 | using namespace Opie::Core; | 15 | using namespace Opie::Core; |
16 | 16 | ||
17 | BatteryStatus::BatteryStatus( const PowerStatus *p, QWidget *parent, WFlags f ) | 17 | BatteryStatus::BatteryStatus( const PowerStatus *p, QWidget *parent, WFlags f ) |
18 | : QFrame( parent, 0, f), ps(p), bat2(false) { | 18 | : QFrame( parent, 0, f), ps(p), bat2(false) { |
19 | 19 | ||
20 | jackPercent = 0; | 20 | jackPercent = 0; |
21 | 21 | ||
22 | if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) { | 22 | if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) { |
23 | getProcApmStatusIpaq(); | 23 | getProcApmStatusIpaq(); |
24 | } | 24 | } |
25 | percent = ps->batteryPercentRemaining(); | 25 | percent = ps->batteryPercentRemaining(); |
26 | } | 26 | } |
27 | 27 | ||
28 | BatteryStatus::~BatteryStatus() {} | 28 | BatteryStatus::~BatteryStatus() {} |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * Make use of the advanced apm interface of the ipaq | 31 | * Make use of the advanced apm interface of the ipaq |
32 | */ | 32 | */ |
33 | bool BatteryStatus::getProcApmStatusIpaq() { | 33 | bool BatteryStatus::getProcApmStatusIpaq() { |
34 | 34 | ||
35 | bat2 = false; | 35 | bat2 = false; |
36 | 36 | ||
37 | QFile procApmIpaq("/proc/hal/battery"); | 37 | QFile procApmIpaq("/proc/hal/battery"); |
38 | 38 | ||
39 | if (procApmIpaq.open(IO_ReadOnly) ) { | 39 | if (procApmIpaq.open(IO_ReadOnly) ) { |
40 | QStringList list; | 40 | QStringList list; |
41 | // since it is /proc we _must_ use QTextStream | 41 | // since it is /proc we _must_ use QTextStream |
42 | QTextStream stream ( &procApmIpaq); | 42 | QTextStream stream ( &procApmIpaq); |
43 | QString streamIn; | 43 | QString streamIn; |
44 | streamIn = stream.read(); | 44 | streamIn = stream.read(); |
45 | list = QStringList::split("\n", streamIn); | 45 | list = QStringList::split("\n", streamIn); |
46 | 46 | ||
47 | for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) { | 47 | for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) { |
48 | // not nice, need a rewrite later | 48 | // not nice, need a rewrite later |
49 | if( (*line).startsWith(" Percentage") ) { | 49 | if( (*line).startsWith(" Percentage") ) { |
50 | if (bat2 == true) { | 50 | if (bat2 == true) { |
51 | perc2 = (*line).mid(((*line).find('(')) +1,(*line).find(')')-(*line).find('(')-2); | 51 | perc2 = (*line).mid(((*line).find('(')) +1,(*line).find(')')-(*line).find('(')-2); |
52 | } else { | 52 | } else { |
53 | perc1 = (*line).mid(((*line).find('('))+1,(*line).find(')')-(*line).find('(')-2); | 53 | perc1 = (*line).mid(((*line).find('('))+1,(*line).find(')')-(*line).find('(')-2); |
54 | } | 54 | } |
55 | } else if( (*line).startsWith(" Life") ) { | 55 | } else if( (*line).startsWith(" Life") ) { |
56 | if (bat2 == true) { | 56 | if (bat2 == true) { |
57 | sec2 = (*line).mid(((*line).find(':')+2), 5 ); | 57 | sec2 = (*line).mid(((*line).find(':')+2), 5 ); |
58 | } else { | 58 | } else { |
59 | sec1 = (*line).mid(((*line).find(':')+2), 5 ); | 59 | sec1 = (*line).mid(((*line).find(':')+2), 5 ); |
60 | } | 60 | } |
61 | } else if( (*line).startsWith("Battery #1") ) { | 61 | } else if( (*line).startsWith("Battery #1") ) { |
62 | bat2 = true; | 62 | bat2 = true; |
63 | } else if( (*line).startsWith(" Status") ) { | 63 | } else if( (*line).startsWith(" Status") ) { |
64 | if (bat2 == true) { | 64 | if (bat2 == true) { |
65 | jackStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1); | 65 | jackStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1); |
66 | } else { | 66 | } else { |
67 | ipaqStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1); | 67 | ipaqStatus = (*line).mid((*line).find('(')+1, (*line).find(')')-(*line).find('(')-1); |
68 | } | 68 | } |
69 | } else if( (*line).startsWith(" Chemistry") ) { | 69 | } else if( (*line).startsWith(" Chemistry") ) { |
70 | if (bat2 == true) { | 70 | if (bat2 == true) { |
71 | jackChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1); | 71 | jackChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1); |
72 | } else { | 72 | } else { |
73 | ipaqChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1); | 73 | ipaqChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | } | 76 | } |
77 | } else { | 77 | } else { |
78 | QMessageBox::warning(this, tr("Failure"),tr("could not open file")); | 78 | QMessageBox::warning(this, tr("Failure"),tr("could not open file")); |
79 | } | 79 | } |
80 | 80 | ||
81 | procApmIpaq.close(); | 81 | procApmIpaq.close(); |
82 | jackPercent = perc2.toInt(); | 82 | jackPercent = perc2.toInt(); |
83 | ipaqPercent = perc1.toInt(); | 83 | ipaqPercent = perc1.toInt(); |
84 | 84 | ||
85 | if (perc2.isEmpty()) { | 85 | if (perc2.isEmpty()) { |
86 | perc2 = tr("no data"); | 86 | perc2 = tr("no data"); |
87 | } else { | 87 | } else { |
88 | perc2 += " %"; | 88 | perc2 += " %"; |
89 | } | 89 | } |
90 | 90 | ||
91 | if (sec2 == "0" || sec2 == "" || sec2.isEmpty()) { | 91 | if (sec2 == "0" || sec2 == "" || sec2.isEmpty()) { |
92 | sec2 = tr("no data"); | 92 | sec2 = tr("no data"); |
93 | } else { | 93 | } else { |
94 | sec2 += " min"; | 94 | sec2 += " min"; |
95 | } | 95 | } |
96 | 96 | ||
97 | jackStatus == (" ( " + jackStatus + " )"); | 97 | jackStatus == (" ( " + jackStatus + " )"); |
98 | return true; | 98 | return true; |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | void BatteryStatus::updatePercent( int pc ) { | 102 | void BatteryStatus::updatePercent( int pc ) { |
103 | percent = pc; | 103 | percent = pc; |
104 | repaint(FALSE); | 104 | repaint(FALSE); |
105 | } | 105 | } |
106 | 106 | ||
107 | void BatteryStatus::drawSegment( QPainter *p, const QRect &r, const QColor &topgrad, const QColor &botgrad, const QColor &highlight, int hightlight_height ) { | 107 | void BatteryStatus::drawSegment( QPainter *p, const QRect &r, const QColor &topgrad, const QColor &botgrad, const QColor &highlight, int hightlight_height ) { |
108 | int h1, h2, s1, s2, v1, v2, ng = r.height(), hy = ng*30/100, hh = hightlight_height; | 108 | int h1, h2, s1, s2, v1, v2, ng = r.height(), hy = ng*30/100, hh = hightlight_height; |
109 | topgrad.hsv( &h1, &s1, &v1 ); | 109 | topgrad.hsv( &h1, &s1, &v1 ); |
110 | botgrad.hsv( &h2, &s2, &v2 ); | 110 | botgrad.hsv( &h2, &s2, &v2 ); |
111 | for ( int j = 0; j < hy-2; j++ ) { | 111 | for ( int j = 0; j < hy-2; j++ ) { |
112 | p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1), | 112 | p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1), |
113 | v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) ); | 113 | v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) ); |
114 | p->drawLine( r.x(), r.top()+hy-2-j, r.x()+r.width(), r.top()+hy-2-j ); | 114 | p->drawLine( r.x(), r.top()+hy-2-j, r.x()+r.width(), r.top()+hy-2-j ); |
115 | } | 115 | } |
116 | for ( int j = 0; j < hh; j++ ) { | 116 | for ( int j = 0; j < hh; j++ ) { |
117 | p->setPen( highlight ); | 117 | p->setPen( highlight ); |
118 | p->drawLine( r.x(), r.top()+hy-2+j, r.x()+r.width(), r.top()+hy-2+j ); | 118 | p->drawLine( r.x(), r.top()+hy-2+j, r.x()+r.width(), r.top()+hy-2+j ); |
119 | } | 119 | } |
120 | for ( int j = 0; j < ng-hy-hh; j++ ) { | 120 | for ( int j = 0; j < ng-hy-hh; j++ ) { |
121 | p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1), | 121 | p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1), |
122 | v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) ); | 122 | v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) ); |
123 | p->drawLine( r.x(), r.top()+hy+hh-2+j, r.x()+r.width(), r.top()+hy+hh-2+j ); | 123 | p->drawLine( r.x(), r.top()+hy+hh-2+j, r.x()+r.width(), r.top()+hy+hh-2+j ); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | QString BatteryStatus::statusText() const { | 127 | QString BatteryStatus::statusText() const { |
128 | QString text; | 128 | QString text; |
129 | 129 | ||
130 | if ( ps->batteryStatus() == PowerStatus::Charging ) { | 130 | if ( ps->batteryStatus() == PowerStatus::Charging ) { |
131 | if (bat2) { | 131 | if (bat2) { |
132 | text = tr("Charging both devices"); | 132 | text = tr("Charging both devices"); |
133 | } else { | 133 | } else { |
134 | text = tr("Charging"); | 134 | text = tr("Charging"); |
135 | } | 135 | } |
136 | } else if ( ps->batteryPercentAccurate() ) { | 136 | } else if ( ps->batteryPercentAccurate() ) { |
137 | text.sprintf( tr("Percentage battery remaining") + ": %i%%", percent ); | 137 | text.sprintf( tr("Percentage battery remaining") + ": %i%%", percent ); |
138 | } else { | 138 | } else { |
139 | text = tr("Battery status: "); | 139 | text = tr("Battery status: "); |
140 | switch ( ps->batteryStatus() ) { | 140 | switch ( ps->batteryStatus() ) { |
141 | case PowerStatus::High: | 141 | case PowerStatus::High: |
142 | text += tr("Good"); | 142 | text += tr("Good"); |
143 | break; | 143 | break; |
144 | case PowerStatus::Low: | 144 | case PowerStatus::Low: |
145 | text += tr("Low"); | 145 | text += tr("Low"); |
146 | break; | 146 | break; |
147 | case PowerStatus::VeryLow: | 147 | case PowerStatus::VeryLow: |
148 | text += tr("Very Low"); | 148 | text += tr("Very Low"); |
149 | break; | 149 | break; |
150 | case PowerStatus::Critical: | 150 | case PowerStatus::Critical: |
151 | text += tr("Critical"); | 151 | text += tr("Critical"); |
152 | break; | 152 | break; |
153 | default: // NotPresent, etc. | 153 | default: // NotPresent, etc. |
154 | text += tr("Unknown"); | 154 | text += tr("Unknown"); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | if ( ps->acStatus() == PowerStatus::Backup ) | 158 | if ( ps->acStatus() == PowerStatus::Backup ) |
159 | text += "\n" + tr("On backup power"); | 159 | text += "\n" + tr("On backup power"); |
160 | else if ( ps->acStatus() == PowerStatus::Online ) | 160 | else if ( ps->acStatus() == PowerStatus::Online ) |
161 | text += "\n" + tr("Power on-line"); | 161 | text += "\n" + tr("Power on-line"); |
162 | else if ( ps->acStatus() == PowerStatus::Offline ) | 162 | else if ( ps->acStatus() == PowerStatus::Offline ) |
163 | text += "\n" + tr("External power disconnected"); | 163 | text += "\n" + tr("External power disconnected"); |
164 | 164 | ||
165 | if ( ps->batteryTimeRemaining() >= 0 ) { | 165 | if ( ps->batteryTimeRemaining() >= 0 ) { |
166 | text += "\n" + QString().sprintf( tr("Battery time remaining") + ": %im %02is", | 166 | text += "\n" + QString().sprintf( tr("Battery time remaining") + ": %im %02is", |
167 | ps->batteryTimeRemaining() / 60, ps->batteryTimeRemaining() % 60 ); | 167 | ps->batteryTimeRemaining() / 60, ps->batteryTimeRemaining() % 60 ); |
168 | } | 168 | } |
169 | return text; | 169 | return text; |
170 | } | 170 | } |
171 | 171 | ||
172 | QString BatteryStatus::statusTextIpaq() const { | 172 | QString BatteryStatus::statusTextIpaq() const { |
173 | QString text; | 173 | QString text; |
174 | text += tr("Percentage battery remaining: ") + perc2 + " " + jackStatus; | 174 | text += tr("Percentage battery remaining: ") + perc2 + " " + jackStatus; |
175 | text += "\n" + tr("Battery time remaining: ") + sec2; | 175 | text += "\n" + tr("Battery time remaining: ") + sec2; |
176 | return text; | 176 | return text; |
177 | } | 177 | } |
178 | 178 | ||
179 | void BatteryStatus::paintEvent( QPaintEvent * ) { | 179 | void BatteryStatus::paintEvent( QPaintEvent * ev ) { |
180 | 180 | ||
181 | QPainter p( this ); | 181 | QPainter p( this ); |
182 | 182 | ||
183 | QString text = statusText(); | 183 | QString text = statusText(); |
184 | p.drawText( 10, 50, width() - 20, 40 , AlignVCenter, text ); | 184 | p.drawText( 10, 50, width() - 20, 40 , AlignVCenter, text ); |
185 | 185 | ||
186 | QColor c; | 186 | QColor c; |
187 | QColor darkc; | 187 | QColor darkc; |
188 | QColor lightc; | 188 | QColor lightc; |
189 | if ( ps->acStatus() == PowerStatus::Offline ) { | 189 | if ( ps->acStatus() == PowerStatus::Offline ) { |
190 | c = blue.light(120); | 190 | c = blue.light(120); |
191 | darkc = c.dark(280); | 191 | darkc = c.dark(280); |
192 | lightc = c.light(145); | 192 | lightc = c.light(145); |
193 | } else if ( ps->acStatus() == PowerStatus::Online ) { | 193 | } else if ( ps->acStatus() == PowerStatus::Online ) { |
194 | c = green.dark(130); | 194 | c = green.dark(130); |
195 | darkc = c.dark(200); | 195 | darkc = c.dark(200); |
196 | lightc = c.light(220); | 196 | lightc = c.light(220); |
197 | } else { | 197 | } else { |
198 | c = red; | 198 | c = red; |
199 | darkc = c.dark(280); | 199 | darkc = c.dark(280); |
200 | lightc = c.light(140); | 200 | lightc = c.light(140); |
201 | } | 201 | } |
202 | if ( percent < 0 ) | 202 | if ( percent < 0 ) |
203 | return; | 203 | return; |
204 | 204 | ||
205 | int rightEnd1 = width() - 47; | 205 | int rightEnd1 = width() - 47; |
206 | int rightEnd2 = width() - 35; | 206 | int rightEnd2 = width() - 35; |
207 | int percent2 = (percent * rightEnd1) / 100; | 207 | int percent2 = (percent * rightEnd1) / 100; |
208 | p.setPen( black ); | 208 | p.setPen( black ); |
209 | qDrawShadePanel( &p, 9, 10, rightEnd1 , 39, colorGroup(), TRUE, 1, NULL); | 209 | qDrawShadePanel( &p, 9, 10, rightEnd1 , 39, colorGroup(), TRUE, 1, NULL); |
210 | qDrawShadePanel( &p, rightEnd2, 17, 12, 24, colorGroup(), TRUE, 1, NULL); | 210 | qDrawShadePanel( &p, rightEnd2, 17, 12, 24, colorGroup(), TRUE, 1, NULL); |
211 | drawSegment( &p, QRect( 10, 10, percent2, 40 ), lightc, darkc, lightc.light(115), 6 ); | 211 | drawSegment( &p, QRect( 10, 10, percent2, 40 ), lightc, darkc, lightc.light(115), 6 ); |
212 | drawSegment( &p, QRect( 11 + percent2, 10, rightEnd1 - percent2, 40 ), white.light(80), black, white.light(90), 6 ); | 212 | drawSegment( &p, QRect( 11 + percent2, 10, rightEnd1 - percent2, 40 ), white.light(80), black, white.light(90), 6 ); |
213 | drawSegment( &p, QRect( rightEnd2, 17, 10, 25 ), white.light(80), black, white.light(90), 2 ); | 213 | drawSegment( &p, QRect( rightEnd2, 17, 10, 25 ), white.light(80), black, white.light(90), 2 ); |
214 | p.setPen( black); | 214 | p.setPen( black); |
215 | 215 | ||
216 | if ( ODevice::inst ( )-> series ( ) == Model_iPAQ && bat2 ) { | 216 | if ( ODevice::inst ( )-> series ( ) == Model_iPAQ && bat2 ) { |
217 | 217 | ||
218 | p.drawText( 15, 30, tr ("Ipaq ") + ipaqChem ); | 218 | p.drawText( 15, 30, tr ("Ipaq ") + ipaqChem ); |
219 | 219 | ||
220 | QString jacketMsg; | 220 | QString jacketMsg; |
221 | if (bat2) { | 221 | if (bat2) { |
222 | p.setPen(black); | 222 | p.setPen(black); |
223 | QString text = statusTextIpaq(); | 223 | QString text = statusTextIpaq(); |
224 | p.drawText( 10, 150, text ); | 224 | p.drawText( 10, 150, text ); |
225 | jacketMsg = tr("Jacket ") + jackChem; | 225 | jacketMsg = tr("Jacket ") + jackChem; |
226 | } else { | 226 | } else { |
227 | jackPercent = 0; | 227 | jackPercent = 0; |
228 | jacketMsg = tr("No jacket with battery inserted"); | 228 | jacketMsg = tr("No jacket with battery inserted"); |
229 | } | 229 | } |
230 | 230 | ||
231 | int jackPerc = ( jackPercent * ( width() - 47 ) ) / 100; | 231 | int jackPerc = ( jackPercent * ( width() - 47 ) ) / 100; |
232 | 232 | ||
233 | qDrawShadePanel( &p, 9, 90, rightEnd1, 39, colorGroup(), TRUE, 1, NULL); | 233 | qDrawShadePanel( &p, 9, 90, rightEnd1, 39, colorGroup(), TRUE, 1, NULL); |
234 | qDrawShadePanel( &p, rightEnd2, 97, 12, 24, colorGroup(), TRUE, 1, NULL); | 234 | qDrawShadePanel( &p, rightEnd2, 97, 12, 24, colorGroup(), TRUE, 1, NULL); |
235 | drawSegment( &p, QRect( 10, 90, jackPerc, 40 ), lightc, darkc, lightc.light(115), 6 ); | 235 | drawSegment( &p, QRect( 10, 90, jackPerc, 40 ), lightc, darkc, lightc.light(115), 6 ); |
236 | drawSegment( &p, QRect( 11 + jackPerc, 90, rightEnd1 - jackPerc, 40 ), white.light(80), black, white.light(90), 6 ); | 236 | drawSegment( &p, QRect( 11 + jackPerc, 90, rightEnd1 - jackPerc, 40 ), white.light(80), black, white.light(90), 6 ); |
237 | drawSegment( &p, QRect( rightEnd2, 97, 10, 25 ), white.light(80), black, white.light(90), 2 ); | 237 | drawSegment( &p, QRect( rightEnd2, 97, 10, 25 ), white.light(80), black, white.light(90), 2 ); |
238 | p.setPen( black ); | 238 | p.setPen( black ); |
239 | p.drawText(15, 100, width() - 20, 20 , AlignVCenter, jacketMsg); | 239 | p.drawText(15, 100, width() - 20, 20 , AlignVCenter, jacketMsg); |
240 | } | 240 | } |
241 | QFrame::paintEvent(ev); | ||
241 | } | 242 | } |
242 | 243 | ||
243 | QSize BatteryStatus::sizeHint() const { | 244 | QSize BatteryStatus::sizeHint() const { |
244 | QString text = statusText(); | 245 | QString text = statusText(); |
245 | QString text2 = statusTextIpaq(); | 246 | QString text2 = statusTextIpaq(); |
246 | QFontMetrics fm = fontMetrics(); | 247 | QFontMetrics fm = fontMetrics(); |
247 | QRect r=fm.boundingRect( 10, 0, width(), height(), AlignVCenter, text ); | 248 | QRect r=fm.boundingRect( 10, 0, width(), height(), AlignVCenter, text ); |
248 | QRect r2=fm.boundingRect( 10, 0, width(), height(), AlignVCenter, text2 ); | 249 | QRect r2=fm.boundingRect( 10, 0, width(), height(), AlignVCenter, text2 ); |
249 | 250 | ||
250 | if ( bat2 ) { | 251 | if ( bat2 ) { |
251 | return QSize( QMAX( QMIN( 200, qApp->desktop()->width() ), | 252 | return QSize( QMAX( QMIN( 200, qApp->desktop()->width() ), |
252 | r.width() ), 2 * 10 + 80 + r.height() + r2.height() ); | 253 | r.width() ), 2 * 10 + 80 + r.height() + r2.height() ); |
253 | } | 254 | } |
254 | return QSize( QMAX( QMIN( 200, qApp->desktop()->width() ), | 255 | return QSize( QMAX( QMIN( 200, qApp->desktop()->width() ), |
255 | r.width() ), 2 * 10 + 40 + r.height() ); | 256 | r.width() ), 2 * 10 + 40 + r.height() ); |
256 | } | 257 | } |