-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index e327098..7021fae 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -135,193 +135,193 @@ static char * vmemo_xpm[] = { | |||
135 | "t c #A8A8B0", | 135 | "t c #A8A8B0", |
136 | "u c #5E5E63", | 136 | "u c #5E5E63", |
137 | "v c #3A3A3E", | 137 | "v c #3A3A3E", |
138 | "w c #BDBDC6", | 138 | "w c #BDBDC6", |
139 | "x c #59595E", | 139 | "x c #59595E", |
140 | "y c #76767C", | 140 | "y c #76767C", |
141 | "z c #373738", | 141 | "z c #373738", |
142 | "A c #717174", | 142 | "A c #717174", |
143 | "B c #727278", | 143 | "B c #727278", |
144 | "C c #1C1C1E", | 144 | "C c #1C1C1E", |
145 | "D c #3C3C3F", | 145 | "D c #3C3C3F", |
146 | "E c #ADADB6", | 146 | "E c #ADADB6", |
147 | "F c #54555A", | 147 | "F c #54555A", |
148 | "G c #8B8C94", | 148 | "G c #8B8C94", |
149 | "H c #5A5A5F", | 149 | "H c #5A5A5F", |
150 | "I c #BBBBC3", | 150 | "I c #BBBBC3", |
151 | "J c #C4C4CB", | 151 | "J c #C4C4CB", |
152 | "K c #909098", | 152 | "K c #909098", |
153 | "L c #737379", | 153 | "L c #737379", |
154 | "M c #343437", | 154 | "M c #343437", |
155 | "N c #8F8F98", | 155 | "N c #8F8F98", |
156 | "O c #000407", | 156 | "O c #000407", |
157 | "P c #2D3137", | 157 | "P c #2D3137", |
158 | "Q c #B0B1BC", | 158 | "Q c #B0B1BC", |
159 | "R c #3B3C40", | 159 | "R c #3B3C40", |
160 | "S c #6E6E74", | 160 | "S c #6E6E74", |
161 | "T c #95959C", | 161 | "T c #95959C", |
162 | "U c #74747A", | 162 | "U c #74747A", |
163 | "V c #1D1D1E", | 163 | "V c #1D1D1E", |
164 | "W c #91929A", | 164 | "W c #91929A", |
165 | "X c #42444A", | 165 | "X c #42444A", |
166 | "Y c #22282E", | 166 | "Y c #22282E", |
167 | "Z c #B0B2BC", | 167 | "Z c #B0B2BC", |
168 | "` c #898A90", | 168 | "` c #898A90", |
169 | " . c #65656A", | 169 | " . c #65656A", |
170 | ".. c #999AA2", | 170 | ".. c #999AA2", |
171 | "+. c #52535A", | 171 | "+. c #52535A", |
172 | "@. c #151B21", | 172 | "@. c #151B21", |
173 | "#. c #515257", | 173 | "#. c #515257", |
174 | "$. c #B5B5BE", | 174 | "$. c #B5B5BE", |
175 | "%. c #616167", | 175 | "%. c #616167", |
176 | "&. c #1A1D22", | 176 | "&. c #1A1D22", |
177 | "*. c #000713", | 177 | "*. c #000713", |
178 | "=. c #1F1F21", | 178 | "=. c #1F1F21", |
179 | " ", | 179 | " ", |
180 | " . + @ # ", | 180 | " . + @ # ", |
181 | " $ % & * = - ", | 181 | " $ % & * = - ", |
182 | " ; > , ' ) ! ~ ", | 182 | " ; > , ' ) ! ~ ", |
183 | " { ] ^ / ( _ : ", | 183 | " { ] ^ / ( _ : ", |
184 | " < [ } | 1 2 3 ", | 184 | " < [ } | 1 2 3 ", |
185 | " 4 5 6 7 8 9 0 a b c ", | 185 | " 4 5 6 7 8 9 0 a b c ", |
186 | " d e f g h i j 3 k l m n ", | 186 | " d e f g h i j 3 k l m n ", |
187 | " o p q r s t u v w n ", | 187 | " o p q r s t u v w n ", |
188 | " o x y z A B C D E n ", | 188 | " o x y z A B C D E n ", |
189 | " F G H I J K L M N O ", | 189 | " F G H I J K L M N O ", |
190 | " P Q R S T U V W X ", | 190 | " P Q R S T U V W X ", |
191 | " Y Z ` b ...+. ", | 191 | " Y Z ` b ...+. ", |
192 | " @.#.$.%.&. ", | 192 | " @.#.$.%.&. ", |
193 | " *.B =. ", | 193 | " *.B =. ", |
194 | " n n n n n n n n n "}; | 194 | " n n n n n n n n n "}; |
195 | 195 | ||
196 | 196 | ||
197 | VMemo::VMemo( QWidget *parent, const char *_name ) | 197 | VMemo::VMemo( QWidget *parent, const char *_name ) |
198 | : QWidget( parent, _name ) | 198 | : QWidget( parent, _name ) |
199 | { | 199 | { |
200 | setFixedHeight( 18 ); | 200 | setFixedHeight( 18 ); |
201 | setFixedWidth( 14 ); | 201 | setFixedWidth( 14 ); |
202 | 202 | ||
203 | recording = FALSE; | 203 | recording = FALSE; |
204 | 204 | ||
205 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 205 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
206 | if (uname(&name) != -1) { | 206 | if (uname(&name) != -1) { |
207 | QString release=name.release; | 207 | QString release=name.release; |
208 | Config vmCfg("Vmemo"); | 208 | Config vmCfg("Vmemo"); |
209 | vmCfg.setGroup("Defaults"); | 209 | vmCfg.setGroup("Defaults"); |
210 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); | 210 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); |
211 | 211 | ||
212 | qDebug("toggleKey %d", toggleKey); | 212 | qDebug("toggleKey %d", toggleKey); |
213 | 213 | ||
214 | if(release.find("embedix",0,TRUE) !=-1) | 214 | if(release.find("embedix",0,TRUE) !=-1) |
215 | systemZaurus=TRUE; | 215 | systemZaurus=TRUE; |
216 | else | 216 | else |
217 | systemZaurus=FALSE; | 217 | systemZaurus=FALSE; |
218 | 218 | ||
219 | myChannel = new QCopChannel( "QPE/VMemo", this ); | 219 | myChannel = new QCopChannel( "QPE/VMemo", this ); |
220 | connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), | 220 | connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), |
221 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 221 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
222 | 222 | ||
223 | if( toggleKey != -1 ) { | 223 | if( toggleKey != -1 ) { |
224 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); | 224 | QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); |
225 | // e << 4096; // Key_Escape | 225 | // e << 4096; // Key_Escape |
226 | // e << Key_F5; //4148 | 226 | // e << Key_F5; //4148 |
227 | e << toggleKey; | 227 | e << toggleKey; |
228 | e << QString("QPE/VMemo"); | 228 | e << QString("QPE/VMemo"); |
229 | e << QString("toggleRecord()"); | 229 | e << QString("toggleRecord()"); |
230 | } | 230 | } |
231 | if( vmCfg.readNumEntry("hideIcon",0) == 1) | 231 | if( vmCfg.readNumEntry("hideIcon",0) == 1 || toggleKey > 0) |
232 | hide(); | 232 | hide(); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | VMemo::~VMemo() | 236 | VMemo::~VMemo() |
237 | { | 237 | { |
238 | } | 238 | } |
239 | 239 | ||
240 | void VMemo::receive( const QCString &msg, const QByteArray &data ) | 240 | void VMemo::receive( const QCString &msg, const QByteArray &data ) |
241 | { | 241 | { |
242 | QDataStream stream( data, IO_ReadOnly ); | 242 | QDataStream stream( data, IO_ReadOnly ); |
243 | if (msg == "toggleRecord()") { | 243 | if (msg == "toggleRecord()") { |
244 | if (recording) { | 244 | if (recording) { |
245 | fromToggle = TRUE; | 245 | fromToggle = TRUE; |
246 | stopRecording(); | 246 | stopRecording(); |
247 | } else { | 247 | } else { |
248 | fromToggle = TRUE; | 248 | fromToggle = TRUE; |
249 | startRecording(); | 249 | startRecording(); |
250 | } | 250 | } |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | void VMemo::paintEvent( QPaintEvent* ) | 254 | void VMemo::paintEvent( QPaintEvent* ) |
255 | { | 255 | { |
256 | QPainter p(this); | 256 | QPainter p(this); |
257 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); | 257 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); |
258 | } | 258 | } |
259 | 259 | ||
260 | void VMemo::mousePressEvent( QMouseEvent * ) | 260 | void VMemo::mousePressEvent( QMouseEvent * ) |
261 | { | 261 | { |
262 | startRecording(); | 262 | startRecording(); |
263 | } | 263 | } |
264 | 264 | ||
265 | void VMemo::mouseReleaseEvent( QMouseEvent * ) | 265 | void VMemo::mouseReleaseEvent( QMouseEvent * ) |
266 | { | 266 | { |
267 | stopRecording(); | 267 | stopRecording(); |
268 | } | 268 | } |
269 | 269 | ||
270 | bool VMemo::startRecording() { | 270 | bool VMemo::startRecording() { |
271 | 271 | ||
272 | if ( recording) | 272 | if ( recording) |
273 | return FALSE;; | 273 | return FALSE;; |
274 | 274 | ||
275 | Config config( "Vmemo" ); | 275 | Config config( "Vmemo" ); |
276 | config.setGroup( "System" ); | 276 | config.setGroup( "System" ); |
277 | 277 | ||
278 | useAlerts = config.readBoolEntry("Alert"); | 278 | useAlerts = config.readBoolEntry("Alert"); |
279 | if(useAlerts) { | 279 | if(useAlerts) { |
280 | 280 | ||
281 | msgLabel = new QLabel( 0, "alertLabel" ); | 281 | msgLabel = new QLabel( 0, "alertLabel" ); |
282 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); | 282 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); |
283 | msgLabel->show(); | 283 | msgLabel->show(); |
284 | } | 284 | } |
285 | 285 | ||
286 | // if(useAlerts) | 286 | // if(useAlerts) |
287 | // QMessageBox::message("VMemo","Really Record?");//) ==1) | 287 | // QMessageBox::message("VMemo","Really Record?");//) ==1) |
288 | // return; | 288 | // return; |
289 | // } else { | 289 | // } else { |
290 | if (!systemZaurus ) | 290 | if (!systemZaurus ) |
291 | QSound::play(Resource::findSound("vmemob")); | 291 | QSound::play(Resource::findSound("vmemob")); |
292 | // } | 292 | // } |
293 | qDebug("Start recording"); | 293 | qDebug("Start recording"); |
294 | recording = TRUE; | 294 | recording = TRUE; |
295 | if (openDSP() == -1) { | 295 | if (openDSP() == -1) { |
296 | QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); | 296 | QMessageBox::critical(0, "vmemo", "Could not open dsp device.\n"+errorMsg, "Abort"); |
297 | recording = FALSE; | 297 | recording = FALSE; |
298 | return FALSE; | 298 | return FALSE; |
299 | } | 299 | } |
300 | 300 | ||
301 | config.setGroup("Defaults"); | 301 | config.setGroup("Defaults"); |
302 | 302 | ||
303 | QDateTime dt = QDateTime::currentDateTime(); | 303 | QDateTime dt = QDateTime::currentDateTime(); |
304 | 304 | ||
305 | QString fName; | 305 | QString fName; |
306 | config.setGroup( "System" ); | 306 | config.setGroup( "System" ); |
307 | fName = QPEApplication::documentDir() ; | 307 | fName = QPEApplication::documentDir() ; |
308 | fileName = config.readEntry("RecLocation", fName); | 308 | fileName = config.readEntry("RecLocation", fName); |
309 | 309 | ||
310 | int s; | 310 | int s; |
311 | s=fileName.find(':'); | 311 | s=fileName.find(':'); |
312 | if(s) | 312 | if(s) |
313 | fileName=fileName.right(fileName.length()-s-2); | 313 | fileName=fileName.right(fileName.length()-s-2); |
314 | qDebug("filename will be "+fileName); | 314 | qDebug("filename will be "+fileName); |
315 | if( fileName.left(1).find('/') == -1) | 315 | if( fileName.left(1).find('/') == -1) |
316 | fileName="/"+fileName; | 316 | fileName="/"+fileName; |
317 | if( fileName.right(1).find('/') == -1) | 317 | if( fileName.right(1).find('/') == -1) |
318 | fileName+="/"; | 318 | fileName+="/"; |
319 | fName = "vm_"+ dt.toString()+ ".wav"; | 319 | fName = "vm_"+ dt.toString()+ ".wav"; |
320 | 320 | ||
321 | fileName+=fName; | 321 | fileName+=fName; |
322 | qDebug("filename is "+fileName); | 322 | qDebug("filename is "+fileName); |
323 | // No spaces in the filename | 323 | // No spaces in the filename |
324 | fileName.replace(QRegExp("'"),""); | 324 | fileName.replace(QRegExp("'"),""); |
325 | fileName.replace(QRegExp(" "),"_"); | 325 | fileName.replace(QRegExp(" "),"_"); |
326 | fileName.replace(QRegExp(":"),"."); | 326 | fileName.replace(QRegExp(":"),"."); |
327 | fileName.replace(QRegExp(","),""); | 327 | fileName.replace(QRegExp(","),""); |