summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-01-10 21:57:56 (UTC)
committer llornkcor <llornkcor>2004-01-10 21:57:56 (UTC)
commit478b311227f9af1d114c9005f6c40030f587599c (patch) (unidiff)
tree8779b1bff9a7df01146ed2722f55a2fcb9f02615
parentd13059a60121951311b491cef32e3d26e9e950c7 (diff)
downloadopie-478b311227f9af1d114c9005f6c40030f587599c.zip
opie-478b311227f9af1d114c9005f6c40030f587599c.tar.gz
opie-478b311227f9af1d114c9005f6c40030f587599c.tar.bz2
fix for qvfb
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 7e2fdf0..f024f47 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -408,8 +408,7 @@ void ScreenshotControl::performGrab()
408 show(); 408 show();
409 qApp->processEvents(); 409 qApp->processEvents();
410 savePixmap(); 410 savePixmap();
411 } 411 } else {
412 else {
413 grabTimer->stop(); 412 grabTimer->stop();
414 413
415 struct sockaddr_in raddr; 414 struct sockaddr_in raddr;
@@ -423,24 +422,38 @@ void ScreenshotControl::performGrab()
423 raddr. sin_family = rhost_info-> h_addrtype; 422 raddr. sin_family = rhost_info-> h_addrtype;
424 raddr. sin_port = htons ( SCAP_port ); 423 raddr. sin_port = htons ( SCAP_port );
425 424
426 if (( sock = ::socket ( AF_INET, SOCK_STREAM, 0 )) >= 0 ) 425 if (( sock = ::socket ( AF_INET, SOCK_STREAM, 0 )) >= 0 ) {
427 {
428 if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) { 426 if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) {
427
429 QString header; 428 QString header;
430 429
431 QPixmap pix = ( snapshot.width() > snapshot.height() ) ? snapshot : snapshot.xForm( QWMatrix().rotate(90) ); 430 QPixmap pix;
431 QString displayEnv = getenv("QWS_DISPLAY");
432 qDebug(displayEnv);
433
434 QString SCAP_model="";
435#warning FIXME: model string should be filled with actual device model
436 if( snapshot.width() > 320)
437 SCAP_model ="Corgi";
438
439 if(displayEnv == "QVFb:0") {//set this if you plan on using this app in qvfb!!
440 pix = snapshot.xForm(QWMatrix().rotate(90));
441 } else
442 pix = ( snapshot.width() > snapshot.height() ) ? snapshot : snapshot.xForm( QWMatrix().rotate(90) );
443
432 QImage img = pix.convertToImage().convertDepth( 16 ); // could make that also depth independent, if hh.org/scap can handle it 444 QImage img = pix.convertToImage().convertDepth( 16 ); // could make that also depth independent, if hh.org/scap can handle it
433 445
434 header = "POST /scap/capture.cgi?%1+%2 HTTP/1.1\n" // 1: model / 2: user 446 header = "POST /scap/capture.cgi?%1+%2 HTTP/1.1\n" // 1: model / 2: user
435 "Content-length: %3\n" // 3: content length 447 "Content-length: %3\n" // 3: content length
436 "Content-Type: image/gif\n" 448 "Content-Type: image/png\n"
437 "Host: %4\n" // 4: scap host 449 "Host: %4\n" // 4: scap host
438 "\n"; 450 "\n";
439 451
440 header = header.arg( "" ).arg( ::getenv ( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname );
441 452
442 if ( !pix.isNull() ) 453 header = header.arg( SCAP_model).arg( ::getenv( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname );
443 { 454 qDebug(header);
455
456 if ( !pix.isNull() ) {
444 const char *ascii = header.latin1( ); 457 const char *ascii = header.latin1( );
445 uint ascii_len = ::strlen( ascii ); 458 uint ascii_len = ::strlen( ascii );
446 ::write ( sock, ascii, ascii_len ); 459 ::write ( sock, ascii, ascii_len );