videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videothumbnailfetcher.h
changeset 20 b9e04db066d4
parent 15 cf5481c2bc0b
equal deleted inserted replaced
17:69946d1824c4 20:b9e04db066d4
    23 #include <qicon.h>
    23 #include <qicon.h>
    24 #include <qlist.h>
    24 #include <qlist.h>
    25 #include <qhash.h>
    25 #include <qhash.h>
    26 #include <qmap.h>
    26 #include <qmap.h>
    27 #include <qpixmap.h>
    27 #include <qpixmap.h>
       
    28 #include <mpxitemid.h>
    28 
    29 
    29 // FORWARD DECLARATIONS
    30 // FORWARD DECLARATIONS
    30 
    31 
    31 
    32 
    32 class ThumbnailFetchData
    33 class ThumbnailFetchData
    33 {
    34 {
    34     public:
    35     public:
    35         QString mFileName;
    36         QString mFileName;
    36         int mPriority;
    37         int mPriority;
    37         void *mInternal;
    38         void *mInternal;
       
    39         TMPXItemId mediaId;
    38 };
    40 };
    39 
    41 
    40 class VideoThumbnailFetcher : public QObject
    42 class VideoThumbnailFetcher : public QObject
    41 {
    43 {
    42     /**
    44     /**
    62      * been added, call continueFetching to start the fetch process which passes 
    64      * been added, call continueFetching to start the fetch process which passes 
    63      * the internal data to thumbnail manager. Signal thumbnailReady is emitted 
    65      * the internal data to thumbnail manager. Signal thumbnailReady is emitted 
    64      * when fetch is complete. 
    66      * when fetch is complete. 
    65      * 
    67      * 
    66      * @param fileName path to the media.
    68      * @param fileName path to the media.
    67      * @param internal data identifying the media.
    69      * @param mediaId mpx id for the media.
    68      * @param priority priority for the fetch.
    70      * @param priority priority for the fetch.
    69      * 
    71      * 
    70      */
    72      */
    71     void addFetch(const QString fileName, void *internal, int priority);
    73     void addFetch(const QString fileName, const TMPXItemId &mediaId, int priority);    
    72     
    74     
    73     /**
    75     /**
    74      * Empties fetch list. This does not cancel the possible ongoing fetch on
    76      * Empties fetch list. This does not cancel the possible ongoing fetch on
    75      * thumbnail manager side.
    77      * thumbnail manager side.
    76      * 
    78      * 
    95      * started without create thumbnail flag. If there's not any of those, 
    97      * started without create thumbnail flag. If there's not any of those, 
    96      * starts creating thumbnails for fetches that have no thumbnail yet. 
    98      * starts creating thumbnails for fetches that have no thumbnail yet. 
    97      * Signal allThumbnailsFetched is emitted if there's nothing to do.
    99      * Signal allThumbnailsFetched is emitted if there's nothing to do.
    98      * 
   100      * 
    99      */
   101      */
   100     void continueFetching();
   102     void continueFetching(bool cancelOngoingFetches);
   101     
   103     
   102     /**
   104     /**
   103      * Enables or disables the thumbnail creation for videos that do  
   105      * Enables or disables the thumbnail creation for videos that do  
   104      * not have thumbnail already in the database.
   106      * not have thumbnail already in the database.
   105      * 
   107      * 
   109     void enableThumbnailCreation(bool enable);
   111     void enableThumbnailCreation(bool enable);
   110     
   112     
   111 // Test helper methods
   113 // Test helper methods
   112 public:
   114 public:
   113     
   115     
   114     void emitThumbnailReady(QPixmap pixmap, void *internal, int error);
   116     void emitThumbnailReady(QPixmap pixmap, const TMPXItemId &mediaId, int error);
   115     
   117     
   116     void emitAllThumbnailsFetched();
   118     void emitAllThumbnailsFetched();
   117 
   119 
   118 signals:
   120 signals:
   119     
   121 
   120     /**
   122     /**
   121      * Signaled after signal from thumbnail manager has been processed and
   123      * Signaled after signal from thumbnail manager has been processed and
   122      * thumbnail fetch process is complete.
   124      * thumbnail fetch process is complete.
   123      *
   125      *
   124      * @param tnData thumbnail
   126      * @param tnData thumbnail
   125      * @param internal internal data to identify the request
   127      * @param mediaId mpx id for the media. 
   126      * @param error possible error code from thumbnail manager ( 0 == ok )
   128      * @param error possible error code from thumbnail manager ( 0 == ok )
   127      * 
   129      * 
   128      */
   130      */
   129     void thumbnailReady(QPixmap tnData, void *internal, int error);
   131     void thumbnailReady(QPixmap tnData, const TMPXItemId &mediaId, int error);
   130 
   132 
   131     /**
   133     /**
   132      * Signaled when all the fetches have been done.
   134      * Signaled when all the fetches have been done.
   133      * 
   135      * 
   134      */
   136      */
   137 public:
   139 public:
   138 
   140 
   139     struct TnRequest
   141     struct TnRequest
   140     {
   142     {
   141        QString name;
   143        QString name;
   142        void *id;
   144        TMPXItemId id;
   143        int priority;
   145        int priority;
   144        bool cancelled;
   146        bool cancelled;
   145 
   147 
   146        TnRequest(QString name, void *id, int priority, bool cancelled) {
   148        TnRequest(QString name, const TMPXItemId &id, int priority, bool cancelled) {
   147            this->name = name;
   149            this->name = name;
   148            this->id = id;
   150            this->id = id;
   149            this->priority = priority;
   151            this->priority = priority;
   150            this->cancelled = cancelled;
   152            this->cancelled = cancelled;
   151        }
   153        }
   152 
   154 
   153        TnRequest() {
   155        TnRequest() {
   154            name = QString("");
   156            name = QString("");
   155            id = 0;
       
   156            priority = -1;
   157            priority = -1;
   157            cancelled = false;
   158            cancelled = false;
   158        }
   159        }
   159     };
   160     };
   160 
   161