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

Diff of /infoscreen/pictureview.cpp

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

revision 528 by torben, Wed Jan 6 22:18:52 2010 UTC revision 641 by torben, Thu Apr 8 05:50:48 2010 UTC
# Line 1  Line 1 
1  #include "pictureview.h"  #include "pictureview.h"
2    
3  #include <QPainter>  #include <QPainter>
4    #include <QDebug>
5    
6  #include "httpwrapper.h"  #include "httpwrapper.h"
7    
# Line 10  PictureView::PictureView(QWidget* parent Line 10  PictureView::PictureView(QWidget* parent
10  {  {
11  }  }
12    
13    
14    // TODO: if the picture doesn't fill the screen, fill the canvas with black before drawing the picture and
15    // place the image mid-screen
16  void PictureView::paintEvent ( QPaintEvent* event)  void PictureView::paintEvent ( QPaintEvent* event)
17  {      {    
18      Q_UNUSED(event);      Q_UNUSED(event);
# Line 25  void PictureView::loadFromUrl(QString so Line 28  void PictureView::loadFromUrl(QString so
28          image = it.value();          image = it.value();
29          this->repaint();          this->repaint();
30      } else {      } else {
31          QByteArray data = HttpWrapper::getSyncData(source);          qDebug() << "Loading file " << source;
32    
33          QPixmap pixmap;          QPixmap pixmap;
34          pixmap.loadFromData( data );          if (source.at(0) == '/') { //local file
35                pixmap = QPixmap(source);
36            } else {
37                QByteArray data = HttpWrapper::getSyncData(source);
38                pixmap.loadFromData( data );
39            }
40    
41          QPixmap scaledImage = pixmap.scaledToHeight(size().height(), Qt::SmoothTransformation );          QPixmap scaledImage = pixmap.scaledToHeight(size().height(), Qt::SmoothTransformation );
42    

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

  ViewVC Help
Powered by ViewVC 1.1.20