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