author | llornkcor <llornkcor> | 2002-10-31 12:52:41 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-31 12:52:41 (UTC) |
commit | f6ca21ad98c7af99c0ae4c04afe3c2126317d6de (patch) (unidiff) | |
tree | 5b171991ec2f4b8e607ba751fb1b5a3432dba76d | |
parent | 4287f9892d5fd18ace4e1fbd55d4731b7e2b1429 (diff) | |
download | opie-f6ca21ad98c7af99c0ae4c04afe3c2126317d6de.zip opie-f6ca21ad98c7af99c0ae4c04afe3c2126317d6de.tar.gz opie-f6ca21ad98c7af99c0ae4c04afe3c2126317d6de.tar.bz2 |
parent is now this, not 0
-rw-r--r-- | core/applets/screenshotapplet/screenshot.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp index 4ebdb7a..98f2c9e 100644 --- a/core/applets/screenshotapplet/screenshot.cpp +++ b/core/applets/screenshotapplet/screenshot.cpp | |||
@@ -156,151 +156,151 @@ void ScreenshotControl::slotGrab() { | |||
156 | fileDlg->raise(); | 156 | fileDlg->raise(); |
157 | QString fileName,list; | 157 | QString fileName,list; |
158 | if( fileDlg->result() == 1 ) { | 158 | if( fileDlg->result() == 1 ) { |
159 | fileName = fileDlg->LineEdit1->text(); | 159 | fileName = fileDlg->LineEdit1->text(); |
160 | 160 | ||
161 | if(fileName.find("/",0,TRUE)==-1) | 161 | if(fileName.find("/",0,TRUE)==-1) |
162 | FileNamePath = QDir::homeDirPath()+"/Documents/image/png/"+fileName; | 162 | FileNamePath = QDir::homeDirPath()+"/Documents/image/png/"+fileName; |
163 | // qDebug(fileName); | 163 | // qDebug(fileName); |
164 | 164 | ||
165 | } | 165 | } |
166 | delete fileDlg; | 166 | delete fileDlg; |
167 | } | 167 | } |
168 | if ( delaySpin->value() ) { | 168 | if ( delaySpin->value() ) { |
169 | grabTimer->start( delaySpin->value() * 1000, true ); | 169 | grabTimer->start( delaySpin->value() * 1000, true ); |
170 | } else { | 170 | } else { |
171 | show(); | 171 | show(); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | void ScreenshotControl::slotScap() { | 175 | void ScreenshotControl::slotScap() { |
176 | buttonPushed=2; | 176 | buttonPushed=2; |
177 | hide(); | 177 | hide(); |
178 | if ( delaySpin->value() ) { | 178 | if ( delaySpin->value() ) { |
179 | grabTimer->start( delaySpin->value() * 1000, true ); | 179 | grabTimer->start( delaySpin->value() * 1000, true ); |
180 | } else { | 180 | } else { |
181 | show(); | 181 | show(); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | void ScreenshotControl::grabTimerDone() { | 186 | void ScreenshotControl::grabTimerDone() { |
187 | performGrab(); | 187 | performGrab(); |
188 | } | 188 | } |
189 | 189 | ||
190 | void ScreenshotControl::savePixmap() { | 190 | void ScreenshotControl::savePixmap() { |
191 | DocLnk lnk; | 191 | DocLnk lnk; |
192 | QString fileName; | 192 | QString fileName; |
193 | 193 | ||
194 | if( setFileName) { | 194 | if( setFileName) { |
195 | fileName=FileNamePath; | 195 | fileName=FileNamePath; |
196 | //not sure why this is needed here, but it forgets fileName | 196 | //not sure why this is needed here, but it forgets fileName |
197 | // if this is below the braces | 197 | // if this is below the braces |
198 | 198 | ||
199 | if(fileName.right(3)!="png") | 199 | if(fileName.right(3)!="png") |
200 | fileName=fileName+".png"; | 200 | fileName=fileName+".png"; |
201 | lnk.setFile(fileName); //sets File property | 201 | lnk.setFile(fileName); //sets File property |
202 | qDebug("saving file "+fileName); | 202 | qDebug("saving file "+fileName); |
203 | snapshot.save( fileName,"PNG"); | 203 | snapshot.save( fileName,"PNG"); |
204 | QFileInfo fi( fileName); | 204 | QFileInfo fi( fileName); |
205 | lnk.setName( fi.fileName()); //sets file name | 205 | lnk.setName( fi.fileName()); //sets file name |
206 | 206 | ||
207 | if(!lnk.writeLink()) | 207 | if(!lnk.writeLink()) |
208 | qDebug("Writing doclink did not work"); | 208 | qDebug("Writing doclink did not work"); |
209 | } else { | 209 | } else { |
210 | 210 | ||
211 | fileName = "sc_"+TimeString::dateString( QDateTime::currentDateTime(),false,true); | 211 | fileName = "sc_"+TimeString::dateString( QDateTime::currentDateTime(),false,true); |
212 | fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),""); | 212 | fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),""); |
213 | QString dirName = QDir::homeDirPath()+"/Documents/image/png/"; | 213 | QString dirName = QDir::homeDirPath()+"/Documents/image/png/"; |
214 | 214 | ||
215 | if( !QDir( dirName).exists() ) { | 215 | if( !QDir( dirName).exists() ) { |
216 | qDebug("making dir "+dirName); | 216 | qDebug("making dir "+dirName); |
217 | QString msg = "mkdir -p "+dirName; | 217 | QString msg = "mkdir -p "+dirName; |
218 | system(msg.latin1()); | 218 | system(msg.latin1()); |
219 | } | 219 | } |
220 | fileName=dirName+fileName; | 220 | fileName=dirName+fileName; |
221 | if(fileName.right(3)!="png") | 221 | if(fileName.right(3)!="png") |
222 | fileName=fileName+".png"; | 222 | fileName=fileName+".png"; |
223 | lnk.setFile(fileName); //sets File property | 223 | lnk.setFile(fileName); //sets File property |
224 | qDebug("saving file "+fileName); | 224 | qDebug("saving file "+fileName); |
225 | snapshot.save( fileName,"PNG"); | 225 | snapshot.save( fileName,"PNG"); |
226 | QFileInfo fi( fileName); | 226 | QFileInfo fi( fileName); |
227 | lnk.setName( fi.fileName()); //sets file name | 227 | lnk.setName( fi.fileName()); //sets file name |
228 | 228 | ||
229 | if(!lnk.writeLink()) | 229 | if(!lnk.writeLink()) |
230 | qDebug("Writing doclink did not work"); | 230 | qDebug("Writing doclink did not work"); |
231 | 231 | ||
232 | } | 232 | } |
233 | 233 | ||
234 | QPEApplication::beep(); | 234 | QPEApplication::beep(); |
235 | } | 235 | } |
236 | 236 | ||
237 | void ScreenshotControl::performGrab() { | 237 | void ScreenshotControl::performGrab() { |
238 | 238 | ||
239 | if(buttonPushed ==1) { | 239 | if(buttonPushed ==1) { |
240 | qDebug("grabbing screen"); | 240 | qDebug("grabbing screen"); |
241 | grabTimer->stop(); | 241 | grabTimer->stop(); |
242 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(),0,0,QApplication::desktop()->width(),QApplication::desktop()->height() ); | 242 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(),0,0,QApplication::desktop()->width(),QApplication::desktop()->height() ); |
243 | show(); | 243 | show(); |
244 | qApp->processEvents(); | 244 | qApp->processEvents(); |
245 | savePixmap(); | 245 | savePixmap(); |
246 | } else { | 246 | } else { |
247 | qDebug("scap"); | 247 | qDebug("scap"); |
248 | grabTimer->stop(); | 248 | grabTimer->stop(); |
249 | // do scap here | 249 | // do scap here |
250 | QString cmd; | 250 | QString cmd; |
251 | cmd="cat /dev/fd0 > /tmp/cap"; | 251 | cmd="cat /dev/fd0 > /tmp/cap"; |
252 | system(cmd.latin1()); | 252 | system(cmd.latin1()); |
253 | // qDebug("echo \"POST /scap/capture.cgi http1.1\" | 253 | // qDebug("echo \"POST /scap/capture.cgi http1.1\" |
254 | // echo \"Content-length: 153600\" | 254 | // echo \"Content-length: 153600\" |
255 | // echo \"Content-Type: image/gif\" | 255 | // echo \"Content-Type: image/gif\" |
256 | // echo \"HOST: www.handhelds.org\" | 256 | // echo \"HOST: www.handhelds.org\" |
257 | // echo \"\" | 257 | // echo \"\" |
258 | // cat /tmp/cap | nc h1.handhelds.org 80"); | 258 | // cat /tmp/cap | nc h1.handhelds.org 80"); |
259 | cmd="nc h1.handhelds.org 1011 </tmp/cap"; | 259 | cmd="nc h1.handhelds.org 1011 </tmp/cap"; |
260 | qDebug("running command "+cmd); | 260 | qDebug("running command "+cmd); |
261 | 261 | ||
262 | system(cmd.latin1()); | 262 | system(cmd.latin1()); |
263 | show(); | 263 | show(); |
264 | } | 264 | } |
265 | 265 | ||
266 | } | 266 | } |
267 | 267 | ||
268 | void ScreenshotControl::setTime(int newTime) { | 268 | void ScreenshotControl::setTime(int newTime) { |
269 | delaySpin->setValue(newTime); | 269 | delaySpin->setValue(newTime); |
270 | } | 270 | } |
271 | 271 | ||
272 | void ScreenshotControl::nameScreenshot(bool b) { | 272 | void ScreenshotControl::nameScreenshot(bool b) { |
273 | 273 | ||
274 | 274 | ||
275 | } | 275 | } |
276 | 276 | ||
277 | //=========================================================================== | 277 | //=========================================================================== |
278 | 278 | ||
279 | ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name ) | 279 | ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name ) |
280 | : QWidget( parent, name ) { | 280 | : QWidget( parent, name ) { |
281 | // qDebug("beginning applet"); | 281 | // qDebug("beginning applet"); |
282 | setFixedHeight( 18 ); | 282 | setFixedHeight( 18 ); |
283 | setFixedWidth( 14 ); | 283 | setFixedWidth( 14 ); |
284 | vc = new ScreenshotControl; | 284 | vc = new ScreenshotControl(this,"ScreenshotApplet");; |
285 | // qDebug("new screenshotapplet"); | 285 | // qDebug("new screenshotapplet"); |
286 | } | 286 | } |
287 | 287 | ||
288 | ScreenshotApplet::~ScreenshotApplet() { | 288 | ScreenshotApplet::~ScreenshotApplet() { |
289 | } | 289 | } |
290 | 290 | ||
291 | void ScreenshotApplet::mousePressEvent( QMouseEvent *) { | 291 | void ScreenshotApplet::mousePressEvent( QMouseEvent *) { |
292 | // if(!vc) | 292 | // if(!vc) |
293 | vc = new ScreenshotControl; | 293 | vc = new ScreenshotControl; |
294 | QPoint curPos = mapToGlobal( rect().topLeft() ); | 294 | QPoint curPos = mapToGlobal( rect().topLeft() ); |
295 | vc->move( curPos.x()-(vc->sizeHint().width()-width())/2, curPos.y() - 100 ); | 295 | vc->move( curPos.x()-(vc->sizeHint().width()-width())/2, curPos.y() - 100 ); |
296 | vc->show(); | 296 | vc->show(); |
297 | 297 | ||
298 | } | 298 | } |
299 | 299 | ||
300 | void ScreenshotApplet::paintEvent( QPaintEvent* ) { | 300 | void ScreenshotApplet::paintEvent( QPaintEvent* ) { |
301 | QPainter p(this); | 301 | QPainter p(this); |
302 | qDebug("paint pixmap"); | 302 | qDebug("paint pixmap"); |
303 | p.drawPixmap( 0, 1, ( const char** ) snapshot_xpm ); | 303 | p.drawPixmap( 0, 1, ( const char** ) snapshot_xpm ); |
304 | 304 | ||
305 | } | 305 | } |
306 | 306 | ||