/[projects]/infoscreen/pictureview.cpp
ViewVC logotype

Diff of /infoscreen/pictureview.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 527 by torben, Tue Jan 5 17:19:02 2010 UTC revision 528 by torben, Wed Jan 6 22:18:52 2010 UTC
# Line 1  Line 1 
1  #include "pictureview.h"  #include "pictureview.h"
2    
3  #include <QGraphicsView>  #include <QPainter>
4  #include <QGraphicsScene>  
5  #include <QDebug>  
6  #include <QUrl>  #include "httpwrapper.h"
 #include <QHttp>  
7    
8  PictureView::PictureView(QWidget* parent)  PictureView::PictureView(QWidget* parent)
9          : QWidget(parent)          : QWidget(parent)
10  {  {
     http.connect(&http, SIGNAL(requestFinished(int,bool)),this, SLOT(onLoad(int,bool)) );  
11  }  }
12    
13  void PictureView::paintEvent ( QPaintEvent* event)  void PictureView::paintEvent ( QPaintEvent* event)
# Line 27  void PictureView::loadFromUrl(QString so Line 25  void PictureView::loadFromUrl(QString so
25          image = it.value();          image = it.value();
26          this->repaint();          this->repaint();
27      } else {      } else {
28          requestedUrl = source;          QByteArray data = HttpWrapper::getSyncData(source);
   
         QUrl url(requestedUrl);  
         http.setHost(url.host() );  
         http.get(url.path(), 0);  
     }  
 }  
   
 void PictureView::onLoad(int id, bool ok)  
 {  
     Q_UNUSED(id);  
     Q_UNUSED(ok);  
     qint64 byteCount = http.bytesAvailable();  
   
     if (byteCount > 0) {  
   
         QByteArray data = http.readAll();    
29    
30          QPixmap pixmap;          QPixmap pixmap;
31          pixmap.loadFromData( data );          pixmap.loadFromData( data );
# Line 53  void PictureView::onLoad(int id, bool ok Line 35  void PictureView::onLoad(int id, bool ok
35          image = scaledImage;          image = scaledImage;
36          this->repaint();          this->repaint();
37    
38          map.insert(requestedUrl, scaledImage);          map.insert(source, scaledImage);
39    
40      }      }
41  }  }
42    

Legend:
Removed from v.527  
changed lines
  Added in v.528

  ViewVC Help
Powered by ViewVC 1.1.20