ganeswidgets/tsrc/fute/HgWidgetTest/src/hgwidgettestdatamodel.cpp
changeset 5 4fa04caf0f43
parent 2 49c70dcc3f17
child 6 1cdcc61142d2
child 8 15f034b8a3b5
equal deleted inserted replaced
3:c863538fcbb6 5:4fa04caf0f43
    99         if (fileInfo.isFile()){
    99         if (fileInfo.isFile()){
   100             QString s = fileInfo.filePath();
   100             QString s = fileInfo.filePath();
   101             if (s.indexOf(QString(".jpg"),0,Qt::CaseInsensitive)>0){
   101             if (s.indexOf(QString(".jpg"),0,Qt::CaseInsensitive)>0){
   102                 mFiles.append(s);
   102                 mFiles.append(s);
   103                 mImages.append(QImage());
   103                 mImages.append(QImage());
       
   104                 mPixmaps.append(QPixmap());
   104                 mVisibility.append(true);
   105                 mVisibility.append(true);
   105             }
   106             }
   106         }
   107         }
   107     }
   108     }
   108 
   109 
   267                         }
   268                         }
   268                     }
   269                     }
   269                     break;
   270                     break;
   270                     case ImageTypeHbIcon:
   271                     case ImageTypeHbIcon:
   271                     {
   272                     {
   272                         returnValue = mHbIcon;
   273                     QPixmap pixmap = mPixmaps.at(row);
       
   274                     if (!pixmap.isNull()) {
       
   275                         QIcon qicon(mPixmaps.at(row));
       
   276                         if (!qicon.isNull()){
       
   277                             returnValue = HbIcon(qicon);
       
   278                         }else {
       
   279                             returnValue = mHbIcon;
       
   280                         }
       
   281                     }
   273                     }
   282                     }
   274                     break;
   283                     break;
   275                     case ImageTypeQIcon:
   284                     case ImageTypeQIcon:
   276                     {
   285                     {
   277                         returnValue = mQIcon;
   286                         returnValue = mQIcon;
   507     mThumbnailRequestPending = false;
   516     mThumbnailRequestPending = false;
   508 
   517 
   509     delete mBufferManager;
   518     delete mBufferManager;
   510     mBufferManager = 0;
   519     mBufferManager = 0;
   511     mBufferManager = new BufferManager(this, buffer, treshhold, 0, mFiles.count());
   520     mBufferManager = new BufferManager(this, buffer, treshhold, 0, mFiles.count());
   512     if (mImageType == ImageTypeQPixmap)
   521     if (mImageType == ImageTypeQPixmap || mImageType == ImageTypeHbIcon)
   513     {
   522     {
   514         for (int i = 0; i<mPixmaps.count();i++) {
   523         for (int i = 0; i<mPixmaps.count();i++) {
   515             mPixmaps.replace(i, QPixmap());
   524             mPixmaps.replace(i, QPixmap());
   516         }        
   525         }        
   517 
   526 
   587 
   596 
   588 void HgWidgetTestDataModel::thumbnailReady( QPixmap pixmap, void* data, int /*id*/, int error )
   597 void HgWidgetTestDataModel::thumbnailReady( QPixmap pixmap, void* data, int /*id*/, int error )
   589 {
   598 {
   590     if (!error && !pixmap.isNull() ){
   599     if (!error && !pixmap.isNull() ){
   591 //        int idx = reinterpret_cast<int>(data);
   600 //        int idx = reinterpret_cast<int>(data);
   592         if (mImageType == ImageTypeQPixmap)
   601         if (mImageType == ImageTypeQPixmap || mImageType == ImageTypeHbIcon)
   593         {
   602         {
   594             mPixmaps.replace(mThumbnailRequestIndex, pixmap);
   603             mPixmaps.replace(mThumbnailRequestIndex, pixmap);
   595         }
   604         }
   596         else {
   605         else {
   597             mImages.replace(mThumbnailRequestIndex,pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied));//.convertToFormat(QImage::Format_RGB16));            
   606             mImages.replace(mThumbnailRequestIndex,pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied));//.convertToFormat(QImage::Format_RGB16));