summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-11-06 09:56:49 (UTC)
committer mickeyl <mickeyl>2003-11-06 09:56:49 (UTC)
commit56ad1eb7fb39ddc78026a0df096703fcf42f5a94 (patch) (unidiff)
tree25d1ba2c7c3bdef72592b8d2de3e2a54f3294c2e
parent2f974fea9a432e9dd7b7a8ad235a4e6bc2ef51fe (diff)
downloadopie-56ad1eb7fb39ddc78026a0df096703fcf42f5a94.zip
opie-56ad1eb7fb39ddc78026a0df096703fcf42f5a94.tar.gz
opie-56ad1eb7fb39ddc78026a0df096703fcf42f5a94.tar.bz2
merge core/applets/*
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp8
-rw-r--r--core/applets/vmemo/vmemo.cpp3
2 files changed, 4 insertions, 7 deletions
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp
index 5936b5d..64e0499 100644
--- a/core/applets/batteryapplet/batterystatus.cpp
+++ b/core/applets/batteryapplet/batterystatus.cpp
@@ -80,56 +80,56 @@ bool BatteryStatus::getProcApmStatusIpaq() {
80 }else if( (*line).startsWith(" Status") ){ 80 }else if( (*line).startsWith(" Status") ){
81 if (bat2 == true) { 81 if (bat2 == true) {
82 jackStatus = (*line).mid((*line).find('(')+1., (*line).find(')')-(*line).find('(')-1); 82 jackStatus = (*line).mid((*line).find('(')+1., (*line).find(')')-(*line).find('(')-1);
83 } else { 83 } else {
84 ipaqStatus = (*line).mid((*line).find('(')+1., (*line).find(')')-(*line).find('(')-1); 84 ipaqStatus = (*line).mid((*line).find('(')+1., (*line).find(')')-(*line).find('(')-1);
85 } 85 }
86 }else if( (*line).startsWith(" Chemistry") ) { 86 }else if( (*line).startsWith(" Chemistry") ) {
87 if (bat2 == true) { 87 if (bat2 == true) {
88 jackChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1); 88 jackChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1);
89 } else { 89 } else {
90 ipaqChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1); 90 ipaqChem = (*line).mid((*line).find('('), (*line).find(')')-(*line).find('(')+1);
91 } 91 }
92 } 92 }
93 } 93 }
94 } else { 94 } else {
95 QMessageBox::warning(this, tr("Failure"),tr("could not open file")); 95 QMessageBox::warning(this, tr("Failure"),tr("could not open file"));
96 } 96 }
97 97
98 procApmIpaq.close(); 98 procApmIpaq.close();
99 99
100 jackPercent = perc2.toInt(); 100 jackPercent = perc2.toInt();
101 ipaqPercent = perc1.toInt(); 101 ipaqPercent = perc1.toInt();
102 102
103 if (perc2.isEmpty()) { 103 if (perc2.isEmpty()) {
104 perc2 = "no data"; 104 perc2 = tr("no data");
105 } else { 105 } else {
106 perc2 += " %"; 106 perc2 += " %";
107 } 107 }
108 108
109 109
110 if (sec2 == "0" || sec2 == "" || sec2.isEmpty()) { 110 if (sec2 == "0" || sec2 == "" || sec2.isEmpty()) {
111 sec2 = "no data"; 111 sec2 = tr("no data");
112 } else { 112 } else {
113 sec2 += " min"; 113 sec2 += " min";
114 } 114 }
115 115
116 jackStatus == (" ( " + jackStatus + " )"); 116 jackStatus == (" ( " + jackStatus + " )");
117 117
118 return true; 118 return true;
119} 119}
120 120
121 121
122void BatteryStatus::updatePercent( int pc ) { 122void BatteryStatus::updatePercent( int pc ) {
123 percent = pc; 123 percent = pc;
124 repaint(FALSE); 124 repaint(FALSE);
125} 125}
126 126
127void BatteryStatus::drawSegment( QPainter *p, const QRect &r, const QColor &topgrad, const QColor &botgrad, const QColor &highlight, int hightlight_height ) { 127void BatteryStatus::drawSegment( QPainter *p, const QRect &r, const QColor &topgrad, const QColor &botgrad, const QColor &highlight, int hightlight_height ) {
128 int h1, h2, s1, s2, v1, v2, ng = r.height(), hy = ng*30/100, hh = hightlight_height; 128 int h1, h2, s1, s2, v1, v2, ng = r.height(), hy = ng*30/100, hh = hightlight_height;
129 topgrad.hsv( &h1, &s1, &v1 ); 129 topgrad.hsv( &h1, &s1, &v1 );
130 botgrad.hsv( &h2, &s2, &v2 ); 130 botgrad.hsv( &h2, &s2, &v2 );
131 for ( int j = 0; j < hy-2; j++ ) { 131 for ( int j = 0; j < hy-2; j++ ) {
132 p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1), 132 p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1),
133 v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) ); 133 v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) );
134 p->drawLine( r.x(), r.top()+hy-2-j, r.x()+r.width(), r.top()+hy-2-j ); 134 p->drawLine( r.x(), r.top()+hy-2-j, r.x()+r.width(), r.top()+hy-2-j );
135 } 135 }
@@ -206,50 +206,50 @@ void BatteryStatus::paintEvent( QPaintEvent * ) {
206 darkc = c.dark(200); 206 darkc = c.dark(200);
207 lightc = c.light(220); 207 lightc = c.light(220);
208 } else { 208 } else {
209 c = red; 209 c = red;
210 darkc = c.dark(280); 210 darkc = c.dark(280);
211 lightc = c.light(140); 211 lightc = c.light(140);
212 } 212 }
213 if ( percent < 0 ) 213 if ( percent < 0 )
214 return; 214 return;
215 215
216 int rightEnd1 = screenWidth - 47; 216 int rightEnd1 = screenWidth - 47;
217 int rightEnd2 = screenWidth - 35; 217 int rightEnd2 = screenWidth - 35;
218 int percent2 = ( percent / 100.0 ) * rightEnd1 ; 218 int percent2 = ( percent / 100.0 ) * rightEnd1 ;
219 p.setPen( black ); 219 p.setPen( black );
220 qDrawShadePanel( &p, 9, 30, rightEnd1 , 39, colorGroup(), TRUE, 1, NULL); 220 qDrawShadePanel( &p, 9, 30, rightEnd1 , 39, colorGroup(), TRUE, 1, NULL);
221 qDrawShadePanel( &p, rightEnd2, 37, 12, 24, colorGroup(), TRUE, 1, NULL); 221 qDrawShadePanel( &p, rightEnd2, 37, 12, 24, colorGroup(), TRUE, 1, NULL);
222 drawSegment( &p, QRect( 10, 30, percent2, 40 ), lightc, darkc, lightc.light(115), 6 ); 222 drawSegment( &p, QRect( 10, 30, percent2, 40 ), lightc, darkc, lightc.light(115), 6 );
223 drawSegment( &p, QRect( 11 + percent2, 30, rightEnd1 - percent2, 40 ), white.light(80), black, white.light(90), 6 ); 223 drawSegment( &p, QRect( 11 + percent2, 30, rightEnd1 - percent2, 40 ), white.light(80), black, white.light(90), 6 );
224 drawSegment( &p, QRect( rightEnd2, 37, 10, 25 ), white.light(80), black, white.light(90), 2 ); 224 drawSegment( &p, QRect( rightEnd2, 37, 10, 25 ), white.light(80), black, white.light(90), 2 );
225 p.setPen( black); 225 p.setPen( black);
226 226
227 227
228 if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) { 228 if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) {
229 229
230 p.drawText(15, 50, tr ("Ipaq " + ipaqChem)); 230 p.drawText(15, 50, tr ("Ipaq ") + ipaqChem);
231 231
232 QString jacketMsg; 232 QString jacketMsg;
233 if (bat2) { 233 if (bat2) {
234 p.setPen(black); 234 p.setPen(black);
235 p.drawText(10,220, tr("Percentage battery remaining: ") + perc2 + " " + jackStatus); 235 p.drawText(10,220, tr("Percentage battery remaining: ") + perc2 + " " + jackStatus);
236 p.drawText(10,240, tr("Battery time remaining: ") + sec2); 236 p.drawText(10,240, tr("Battery time remaining: ") + sec2);
237 jacketMsg = tr("Jacket " + jackChem); 237 jacketMsg = tr("Jacket ") + jackChem;
238 } else { 238 } else {
239 jackPercent = 0; 239 jackPercent = 0;
240 jacketMsg = tr("No jacket with battery inserted"); 240 jacketMsg = tr("No jacket with battery inserted");
241 } 241 }
242 242
243 int jackPerc = ( jackPercent / 100.0 ) * ( screenWidth - 47 ) ; 243 int jackPerc = ( jackPercent / 100.0 ) * ( screenWidth - 47 ) ;
244 244
245 qDrawShadePanel( &p, 9, 160, rightEnd1, 39, colorGroup(), TRUE, 1, NULL); 245 qDrawShadePanel( &p, 9, 160, rightEnd1, 39, colorGroup(), TRUE, 1, NULL);
246 qDrawShadePanel( &p, rightEnd2, 167, 12, 24, colorGroup(), TRUE, 1, NULL); 246 qDrawShadePanel( &p, rightEnd2, 167, 12, 24, colorGroup(), TRUE, 1, NULL);
247 drawSegment( &p, QRect( 10, 160, jackPerc, 40 ), lightc, darkc, lightc.light(115), 6 ); 247 drawSegment( &p, QRect( 10, 160, jackPerc, 40 ), lightc, darkc, lightc.light(115), 6 );
248 drawSegment( &p, QRect( 11 + jackPerc, 160, rightEnd1 - jackPerc, 40 ), white.light(80), black, white.light(90), 6 ); 248 drawSegment( &p, QRect( 11 + jackPerc, 160, rightEnd1 - jackPerc, 40 ), white.light(80), black, white.light(90), 6 );
249 drawSegment( &p, QRect( rightEnd2, 167, 10, 25 ), white.light(80), black, white.light(90), 2 ); 249 drawSegment( &p, QRect( rightEnd2, 167, 10, 25 ), white.light(80), black, white.light(90), 2 );
250 p.setPen( black ); 250 p.setPen( black );
251 p.drawText(15, 180, jacketMsg); 251 p.drawText(15, 180, jacketMsg);
252 } 252 }
253 253
254} 254}
255 255
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 83c148f..fe8ebfd 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -1,39 +1,36 @@
1/************************************************************************************ 1/************************************************************************************
2 ** 2 **
3 ** This file may be distributed and/or modified under the terms of the 3 ** This file may be distributed and/or modified under the terms of the
4 ** GNU General Public License version 2 as published by the Free Software 4 ** GNU General Public License version 2 as published by the Free Software
5 ** Foundation and appearing in the file LICENSE.GPL included in the 5 ** Foundation and appearing in the file LICENSE.GPL included in the
6 ** packaging of this file. 6 ** packaging of this file.
7 ** 7 **
8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 ** 10 **
11 ************************************************************************************/ 11 ************************************************************************************/
12// copyright 2002 Jeremy Cowgar <jc@cowgar.com> 12// copyright 2002 Jeremy Cowgar <jc@cowgar.com>
13/*
14 * $Id$
15*/
16// copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com> 13// copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com>
17 14
18extern "C" { 15extern "C" {
19#include "adpcm.h" 16#include "adpcm.h"
20} 17}
21 18
22#include <unistd.h> 19#include <unistd.h>
23#include <stdio.h> 20#include <stdio.h>
24#include <fcntl.h> 21#include <fcntl.h>
25#include <sys/ioctl.h> 22#include <sys/ioctl.h>
26#include <linux/soundcard.h> 23#include <linux/soundcard.h>
27 24
28#include <errno.h> 25#include <errno.h>
29 26
30typedef struct _waveheader { 27typedef struct _waveheader {
31 u_long main_chunk; /* 'RIFF' */ 28 u_long main_chunk; /* 'RIFF' */
32 u_long length; /* filelen */ 29 u_long length; /* filelen */
33 u_long chunk_type; /* 'WAVE' */ 30 u_long chunk_type; /* 'WAVE' */
34 u_long sub_chunk; /* 'fmt ' */ 31 u_long sub_chunk; /* 'fmt ' */
35 u_long sc_len; /* length of sub_chunk, =16 32 u_long sc_len; /* length of sub_chunk, =16
36 (chunckSize) format len */ 33 (chunckSize) format len */
37 u_short format; /* should be 1 for PCM-code (formatTag) */ 34 u_short format; /* should be 1 for PCM-code (formatTag) */
38 35
39 u_short modus; /* 1 Mono, 2 Stereo (channels) */ 36 u_short modus; /* 1 Mono, 2 Stereo (channels) */