author | llornkcor <llornkcor> | 2002-03-27 04:29:54 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-27 04:29:54 (UTC) |
commit | 524ad1da733675debd5c248b54efc5d58e855485 (patch) (unidiff) | |
tree | 6adf94b989e4675b4ccdaa10e8538766106eea50 | |
parent | 78211642003f70797a5faa1767a5ab2f5f83606f (diff) | |
download | opie-524ad1da733675debd5c248b54efc5d58e855485.zip opie-524ad1da733675debd5c248b54efc5d58e855485.tar.gz opie-524ad1da733675debd5c248b54efc5d58e855485.tar.bz2 |
changed icon
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 232 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.h | 1 |
2 files changed, 149 insertions, 84 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index ae5cf0c..e6c4ff9 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -70,68 +70,126 @@ int seq = 0; | |||
70 | 70 | ||
71 | /* XPM */ | 71 | /* XPM */ |
72 | static char * vmemo_xpm[] = { | 72 | static char * vmemo_xpm[] = { |
73 | "14 14 47 1", | 73 | "16 16 102 2", |
74 | " c None", | 74 | " c None", |
75 | ". c #101010", | 75 | ". c #60636A", |
76 | "+ c #0D0D0D", | 76 | "+ c #6E6E72", |
77 | "@ c #0B0B0B", | 77 | "@ c #68696E", |
78 | "# c #393939", | 78 | "# c #4D525C", |
79 | "$ c #6C6C6C", | 79 | "$ c #6B6C70", |
80 | "% c #5D5D5D", | 80 | "% c #E3E3E8", |
81 | "& c #4E4E4E", | 81 | "& c #EEEEF2", |
82 | "* c #1C1C1C", | 82 | "* c #EAEAEF", |
83 | "= c #131313", | 83 | "= c #CACAD0", |
84 | "- c #7B7B7B", | 84 | "- c #474A51", |
85 | "; c #303030", | 85 | "; c #171819", |
86 | "> c #383838", | 86 | "> c #9B9B9F", |
87 | ", c #3F3F3F", | 87 | ", c #EBEBF0", |
88 | "' c #343434", | 88 | "' c #F4F4F7", |
89 | ") c #060606", | 89 | ") c #F1F1F5", |
90 | "! c #444444", | 90 | "! c #DEDEE4", |
91 | "~ c #646464", | 91 | "~ c #57575C", |
92 | "{ c #505050", | 92 | "{ c #010101", |
93 | "] c #717171", | 93 | "] c #A2A2A6", |
94 | "^ c #1B1B1B", | 94 | "^ c #747477", |
95 | "/ c #585858", | 95 | "/ c #B5B5B8", |
96 | "( c #4C4C4C", | 96 | "( c #AEAEB2", |
97 | "_ c #353535", | 97 | "_ c #69696D", |
98 | ": c #0E0E0E", | 98 | ": c #525256", |
99 | "< c #080808", | 99 | "< c #181C24", |
100 | "[ c #262626", | 100 | "[ c #97979B", |
101 | "} c #121212", | 101 | "} c #A7A7AC", |
102 | "| c #7F7F7F", | 102 | "| c #B0B0B4", |
103 | "1 c #464646", | 103 | "1 c #C8C8D1", |
104 | "2 c #0C0C0C", | 104 | "2 c #75757B", |
105 | "3 c #727272", | 105 | "3 c #46464A", |
106 | "4 c #292929", | 106 | "4 c #494A4F", |
107 | "5 c #656565", | 107 | "5 c #323234", |
108 | "6 c #565656", | 108 | "6 c #909095", |
109 | "7 c #434343", | 109 | "7 c #39393B", |
110 | "8 c #272727", | 110 | "8 c #757578", |
111 | "9 c #0F0F0F", | 111 | "9 c #87878E", |
112 | "0 c #3A3A3A", | 112 | "0 c #222224", |
113 | "a c #090909", | 113 | "a c #414144", |
114 | "b c #535353", | 114 | "b c #6A6A6E", |
115 | "c c #545454", | 115 | "c c #020C16", |
116 | "d c #494949", | 116 | "d c #6B6B6F", |
117 | "e c #7A7A7A", | 117 | "e c #68686D", |
118 | "f c #202020", | 118 | "f c #5B5B60", |
119 | "g c #3D3D3D", | 119 | "g c #8A8A8F", |
120 | "h c #1F1F1F", | 120 | "h c #6B6B6E", |
121 | " .+@ ", | 121 | "i c #ADADB2", |
122 | " #$%&* ", | 122 | "j c #828289", |
123 | " =-;>,')", | 123 | "k c #3E3E41", |
124 | " .$;!~,)", | 124 | "l c #CFCFD7", |
125 | " ;#{]!)", | 125 | "m c #4C4C50", |
126 | " ^~/(_)", | 126 | "n c #000000", |
127 | " ./:@<[)", | 127 | "o c #66666A", |
128 | " }. .|]1;;2 ", | 128 | "p c #505054", |
129 | " #-$;^/3&;;4@ ", | 129 | "q c #838388", |
130 | ".$;;#5:67;89 ", | 130 | "r c #A1A1A7", |
131 | ":%;0%&ab;8. ", | 131 | "s c #A9A9AE", |
132 | "@cd%e!fg49 ", | 132 | "t c #A8A8B0", |
133 | " h0,!_;2@ ", | 133 | "u c #5E5E63", |
134 | " ))))) "}; | 134 | "v c #3A3A3E", |
135 | "w c #BDBDC6", | ||
136 | "x c #59595E", | ||
137 | "y c #76767C", | ||
138 | "z c #373738", | ||
139 | "A c #717174", | ||
140 | "B c #727278", | ||
141 | "C c #1C1C1E", | ||
142 | "D c #3C3C3F", | ||
143 | "E c #ADADB6", | ||
144 | "F c #54555A", | ||
145 | "G c #8B8C94", | ||
146 | "H c #5A5A5F", | ||
147 | "I c #BBBBC3", | ||
148 | "J c #C4C4CB", | ||
149 | "K c #909098", | ||
150 | "L c #737379", | ||
151 | "M c #343437", | ||
152 | "N c #8F8F98", | ||
153 | "O c #000407", | ||
154 | "P c #2D3137", | ||
155 | "Q c #B0B1BC", | ||
156 | "R c #3B3C40", | ||
157 | "S c #6E6E74", | ||
158 | "T c #95959C", | ||
159 | "U c #74747A", | ||
160 | "V c #1D1D1E", | ||
161 | "W c #91929A", | ||
162 | "X c #42444A", | ||
163 | "Y c #22282E", | ||
164 | "Z c #B0B2BC", | ||
165 | "` c #898A90", | ||
166 | " . c #65656A", | ||
167 | ".. c #999AA2", | ||
168 | "+. c #52535A", | ||
169 | "@. c #151B21", | ||
170 | "#. c #515257", | ||
171 | "$. c #B5B5BE", | ||
172 | "%. c #616167", | ||
173 | "&. c #1A1D22", | ||
174 | "*. c #000713", | ||
175 | "=. c #1F1F21", | ||
176 | " ", | ||
177 | " . + @ # ", | ||
178 | " $ % & * = - ", | ||
179 | " ; > , ' ) ! ~ ", | ||
180 | " { ] ^ / ( _ : ", | ||
181 | " < [ } | 1 2 3 ", | ||
182 | " 4 5 6 7 8 9 0 a b c ", | ||
183 | " d e f g h i j 3 k l m n ", | ||
184 | " o p q r s t u v w n ", | ||
185 | " o x y z A B C D E n ", | ||
186 | " F G H I J K L M N O ", | ||
187 | " P Q R S T U V W X ", | ||
188 | " Y Z ` b ...+. ", | ||
189 | " @.#.$.%.&. ", | ||
190 | " *.B =. ", | ||
191 | " n n n n n n n n n "}; | ||
192 | |||
135 | 193 | ||
136 | VMemo::VMemo( QWidget *parent, const char *_name ) | 194 | VMemo::VMemo( QWidget *parent, const char *_name ) |
137 | : QWidget( parent, _name ) | 195 | : QWidget( parent, _name ) |
@@ -168,8 +226,7 @@ VMemo::~VMemo() | |||
168 | void VMemo::receive( const QCString &msg, const QByteArray &data ) | 226 | void VMemo::receive( const QCString &msg, const QByteArray &data ) |
169 | { | 227 | { |
170 | QDataStream stream( data, IO_ReadOnly ); | 228 | QDataStream stream( data, IO_ReadOnly ); |
171 | if (msg == "toggleRecord()") | 229 | if (msg == "toggleRecord()") { |
172 | { | ||
173 | if (recording) | 230 | if (recording) |
174 | mouseReleaseEvent(NULL); | 231 | mouseReleaseEvent(NULL); |
175 | else | 232 | else |
@@ -186,8 +243,7 @@ void VMemo::paintEvent( QPaintEvent* ) | |||
186 | void VMemo::mousePressEvent( QMouseEvent *me ) | 243 | void VMemo::mousePressEvent( QMouseEvent *me ) |
187 | { | 244 | { |
188 | // just to be safe | 245 | // just to be safe |
189 | if (recording) | 246 | if (recording) { |
190 | { | ||
191 | recording = FALSE; | 247 | recording = FALSE; |
192 | return; | 248 | return; |
193 | } | 249 | } |
@@ -199,11 +255,19 @@ void VMemo::mousePressEvent( QMouseEvent *me ) | |||
199 | // if (!systemZaurus && me != NULL) | 255 | // if (!systemZaurus && me != NULL) |
200 | // return; | 256 | // return; |
201 | 257 | ||
258 | // Config config( "Sound" ); | ||
259 | // config.setGroup( "System" ); | ||
260 | // useAlerts = config.readBoolEntry("Alert"); | ||
261 | |||
262 | // if(useAlerts) { | ||
263 | // if( QMessageBox::warning(this,"VMemo","Really Record?","Yes","No",0,0,1) ==1) | ||
264 | // return; | ||
265 | // } else { | ||
202 | QSound::play(Resource::findSound("vmemob")); | 266 | QSound::play(Resource::findSound("vmemob")); |
267 | // } | ||
203 | qDebug("Start recording"); | 268 | qDebug("Start recording"); |
204 | recording = TRUE; | 269 | recording = TRUE; |
205 | if (openDSP() == -1) | 270 | if (openDSP() == -1) { |
206 | { | ||
207 | QMessageBox::critical(0, "VMemo", "Could not open dsp device.", "Abort"); | 271 | QMessageBox::critical(0, "VMemo", "Could not open dsp device.", "Abort"); |
208 | recording = FALSE; | 272 | recording = FALSE; |
209 | return; | 273 | return; |
@@ -230,8 +294,7 @@ void VMemo::mousePressEvent( QMouseEvent *me ) | |||
230 | fileName.replace(QRegExp(":"),"."); | 294 | fileName.replace(QRegExp(":"),"."); |
231 | fileName.replace(QRegExp(","),""); | 295 | fileName.replace(QRegExp(","),""); |
232 | 296 | ||
233 | if(openWAV(fileName.latin1()) == -1) | 297 | if(openWAV(fileName.latin1()) == -1) { |
234 | { | ||
235 | QString err("Could not open the output file: "); | 298 | QString err("Could not open the output file: "); |
236 | err += fileName; | 299 | err += fileName; |
237 | 300 | ||
@@ -270,12 +333,12 @@ int VMemo::openDSP() | |||
270 | if (cfg.readNumEntry("SixteenBit", 1)==1) { | 333 | if (cfg.readNumEntry("SixteenBit", 1)==1) { |
271 | format = AFMT_S16_LE; | 334 | format = AFMT_S16_LE; |
272 | resolution = 16; | 335 | resolution = 16; |
273 | } | 336 | } else { |
274 | else { | ||
275 | format = AFMT_S8; | 337 | format = AFMT_S8; |
276 | resolution = 8; | 338 | resolution = 8; |
277 | } | 339 | } |
278 | 340 | ||
341 | |||
279 | if(systemZaurus) { | 342 | if(systemZaurus) { |
280 | dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1 | 343 | dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1 |
281 | channels=1; //zaurus has one input channel | 344 | channels=1; //zaurus has one input channel |
@@ -345,7 +408,6 @@ void VMemo::record(void) | |||
345 | 408 | ||
346 | if(systemZaurus) { | 409 | if(systemZaurus) { |
347 | signed short sound[512], monoBuffer[512]; | 410 | signed short sound[512], monoBuffer[512]; |
348 | |||
349 | if(format==AFMT_S16_LE) { | 411 | if(format==AFMT_S16_LE) { |
350 | while(recording) { | 412 | while(recording) { |
351 | result = read(dsp, sound, 512); // 8192 | 413 | result = read(dsp, sound, 512); // 8192 |
@@ -368,15 +430,14 @@ void VMemo::record(void) | |||
368 | printf("%d\r",length); | 430 | printf("%d\r",length); |
369 | fflush(stdout); | 431 | fflush(stdout); |
370 | } | 432 | } |
371 | } | 433 | } else { //AFMT_S8 |
372 | else { //AFMT_S8 // don't try this yet.. as player doesn't understand 8bit unsigned | 434 | // 8bit unsigned |
373 | while(recording) | 435 | unsigned short sound[512], monoBuffer[512]; |
374 | { | 436 | while(recording) { |
375 | result = read(dsp, sound, 512); // 8192 | 437 | result = read(dsp, sound, 512); // 8192 |
376 | qApp->processEvents(); | 438 | qApp->processEvents(); |
377 | int j=0; | 439 | int j=0; |
378 | if(systemZaurus) | 440 | if(systemZaurus) { |
379 | { | ||
380 | for (int i = 0; i < result; i++) { //since Z is mono do normally | 441 | for (int i = 0; i < result; i++) { //since Z is mono do normally |
381 | monoBuffer[i] = sound[i]; | 442 | monoBuffer[i] = sound[i]; |
382 | } | 443 | } |
@@ -396,14 +457,15 @@ void VMemo::record(void) | |||
396 | 457 | ||
397 | qApp->processEvents(); | 458 | qApp->processEvents(); |
398 | } | 459 | } |
460 | |||
461 | qApp->processEvents(); | ||
399 | } | 462 | } |
400 | 463 | ||
401 | } else { | 464 | } else { |
402 | 465 | ||
403 | char sound[512]; //char is 8 bit | 466 | signed short sound[512], monoBuffer[512]; |
404 | 467 | ||
405 | while(recording) | 468 | while(recording) { |
406 | { | ||
407 | result = read(dsp, sound, 512); // 8192 | 469 | result = read(dsp, sound, 512); // 8192 |
408 | qApp->processEvents(); | 470 | qApp->processEvents(); |
409 | 471 | ||
@@ -412,6 +474,8 @@ void VMemo::record(void) | |||
412 | 474 | ||
413 | qApp->processEvents(); | 475 | qApp->processEvents(); |
414 | } | 476 | } |
477 | printf("%d\r",length); | ||
478 | fflush(stdout); | ||
415 | // qDebug("file has length of %d lasting %d seconds", | 479 | // qDebug("file has length of %d lasting %d seconds", |
416 | // length, (( length / speed) / channels) / 2 ); | 480 | // length, (( length / speed) / channels) / 2 ); |
417 | // medialplayer states wrong length in secs | 481 | // medialplayer states wrong length in secs |
@@ -427,8 +491,8 @@ void VMemo::record(void) | |||
427 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) | 491 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) |
428 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); | 492 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); |
429 | ::close(dsp); | 493 | ::close(dsp); |
430 | if(systemZaurus) | 494 | // if(useAlerts) |
431 | QMessageBox::message("Vmemo"," Done recording"); | 495 | // QMessageBox::message("Vmemo"," Done recording"); |
432 | 496 | // else | |
433 | QSound::play(Resource::findSound("vmemoe")); | 497 | QSound::play(Resource::findSound("vmemoe")); |
434 | } | 498 | } |
diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h index d96cd94..f30476f 100644 --- a/core/applets/vmemo/vmemo.h +++ b/core/applets/vmemo/vmemo.h | |||
@@ -38,6 +38,7 @@ public slots: | |||
38 | void receive( const QCString &msg, const QByteArray &data ); | 38 | void receive( const QCString &msg, const QByteArray &data ); |
39 | 39 | ||
40 | private: | 40 | private: |
41 | bool useAlerts; | ||
41 | void paintEvent( QPaintEvent* ); | 42 | void paintEvent( QPaintEvent* ); |
42 | 43 | ||
43 | int openDSP(); | 44 | int openDSP(); |