videocollection/videocollectionwrapper/inc/videolistdatamodel.h
changeset 52 e3cecb93e76a
parent 20 b9e04db066d4
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
    84      * at the given index. If there is, item id is returned.
    84      * at the given index. If there is, item id is returned.
    85      * 
    85      * 
    86      * @param index index of the item to be opened
    86      * @param index index of the item to be opened
    87      * @return TMPXItemId item id  or TMPXItemId::Invalid() if no valid item.
    87      * @return TMPXItemId item id  or TMPXItemId::Invalid() if no valid item.
    88      */ 
    88      */ 
    89 	TMPXItemId mediaIdAtIndex(int index) const;
    89 	const TMPXItemId& mediaIdAtIndex(const int &index) const;
    90 
    90 
    91 	/**
    91 	/**
    92 	 * returns model index of id provided
    92 	 * returns model index of id provided
    93 	 * 
    93 	 * 
    94 	 * @param id of the item
    94 	 * @param id of the item
    95 	 * @return modelIndex
    95 	 * @return modelIndex
    96 	 */
    96 	 */
    97 	QModelIndex indexOfId(TMPXItemId id);
    97 	QModelIndex indexOfId(const TMPXItemId &id);
    98 	
    98 	
    99     /**
    99     /**
   100      * Method calls video list data to check if there are valid media object 
   100      * Method calls video list data to check if there are valid media object 
   101      * for the given media id. If there is, file path for is returned.
   101      * for the given media id. If there is, file path for is returned.
   102      * 
   102      * 
   103      * @param mediaId id of the item to be opened
   103      * @param mediaId id of the item to be opened
   104      * @return QString file path of the media at index, empty string if not valid item.
   104      * @return QString file path of the media at index, empty string if not valid item.
   105      */ 
   105      */ 
   106 	QString mediaFilePathForId(TMPXItemId mediaId) const;
   106 	QString mediaFilePathForId(const TMPXItemId &mediaId) const;
   107     
   107     
   108 	/**
   108 	/**
   109      * Called by the client when removal of videos are requested.
   109      * Called by the client when removal of videos are requested.
   110      * Sets video status to be removed to videolistdata and
   110      * Sets video status to be removed to videolistdata and
   111      * eventually calls collection to handle the actual removing.
   111      * eventually calls collection to handle the actual removing.
   129      * Set album in use.
   129      * Set album in use.
   130      * 
   130      * 
   131      * @param albumId, Album to set in use.
   131      * @param albumId, Album to set in use.
   132      * @return None.
   132      * @return None.
   133      */
   133      */
   134     void setAlbumInUse(TMPXItemId albumId);
   134     void setAlbumInUse(const TMPXItemId &albumId);
   135     
   135     
   136     /**
   136     /**
   137      * returns album id currently in use
   137      * returns album id currently in use
   138      * 
   138      * 
   139      * @return TMPXItemId
   139      * @return TMPXItemId
   140      */
   140      */
   141     TMPXItemId albumInUse();
   141     const TMPXItemId& albumInUse() const;
   142     
   142     
   143     /**
   143     /**
   144      * removes provided items from provided album id and calls
   144      * removes provided items from provided album id and calls
   145      * collectionclient to update mds as well.
   145      * collectionclient to update mds as well.
   146      * 
   146      * 
   147      * @param albumId album from where to remove
   147      * @param albumId album from where to remove
   148      * @param items items to remove
   148      * @param items items to remove
   149      * 
   149      * 
   150      * @return count of items removed or -1 if failed 
   150      * @return count of items removed or -1 if failed 
   151      */
   151      */
   152     int removeItemsFromAlbum(TMPXItemId &albumId, const QList<TMPXItemId> &items);    
   152     int removeItemsFromAlbum(const TMPXItemId &albumId, const QList<TMPXItemId> &items);    
   153     
   153     
   154 public: // from QAbstractItemModel
   154 public: // from QAbstractItemModel
   155     
   155     
   156     /**
   156     /**
   157      * Returns video item count to the proxy cache
   157      * Returns video item count to the proxy cache
   212     * -signal indicating that video details data fetching started ok
   212     * -signal indicating that video details data fetching started ok
   213     * 
   213     * 
   214     * @param id of the video item
   214     * @param id of the video item
   215     */
   215     */
   216     void shortDetailsReady(TMPXItemId id);
   216     void shortDetailsReady(TMPXItemId id);
   217     
   217    
   218     /**
   218     /**
   219      * Signals that the model is ready, ie. loaded all data from
   219      * Signals that the model is ready, ie. loaded all data from
   220      * myvideocollection.
   220      * myvideocollection.
   221      */
   221      */
   222     void modelReady();
   222     void modelReady();
       
   223     
       
   224     /**
       
   225      * Signals that all albums have been loaded from myvideoscollection.
       
   226      */
       
   227     void albumListReady();
   223 
   228 
   224     /**
   229     /**
   225      * Signal to be emitted when something has happened in the 
   230      * Signal to be emitted when something has happened in the 
   226      * model's data container
   231      * model's data container
   227      */
   232      */
   229     
   234     
   230     /**
   235     /**
   231      * Signals that album content has been updated.
   236      * Signals that album content has been updated.
   232      */
   237      */
   233     void albumChanged();
   238     void albumChanged();
   234 
       
   235     /**
       
   236      * Signals that item data has changed.
       
   237      */
       
   238     void itemModified(const TMPXItemId &itemId);
       
   239     
   239     
   240 private slots:
   240 private slots:
   241     
   241     
   242     /**
   242     /**
   243      * signaled by the deleteworker in case some delete startup fails
   243      * signaled by the deleteworker in case some delete startup fails
   244      * 
   244      * 
   245      * @param ids list of ids whose deletion fails 
   245      * @param ids list of ids whose deletion fails 
   246      */
   246      */
   247     void deleteStartingFailsSlot(QList<TMPXItemId> ids);
   247     void deleteStartingFailsSlot(QList<TMPXItemId>& ids);
   248     
   248     
   249 private:
   249 private:
   250       
   250       
   251     /**
   251     /**
   252      * Method connects signals emitted from or throught this object
   252      * Method connects signals used for delete worker
   253      */
   253      */
   254     int connectSignals();
   254     void connectSignals();
   255     
   255     
   256     /**
   256     /**
   257      * method disconnects signals
   257      * method disconnects signals
   258      */
   258      */
   259     void disconnectSignals();
   259     void disconnectSignals();
   267      * 
   267      * 
   268      * @param index, index of the item data is requested
   268      * @param index, index of the item data is requested
   269      * 
   269      * 
   270      * @return QString detail string
   270      * @return QString detail string
   271      */
   271      */
   272     QString prepareDetailRow(int index) const; 
   272     QString prepareDetailRow(int &index) const; 
   273 
   273 
   274       /**
   274       /**
   275      * Formats a detail row string for the video item
   275      * Formats a detail row string for the video item
   276      * at the given index. 
   276      * at the given index. 
   277      * 
   277      * 
   281      * @param index, index of the item data is requested
   281      * @param index, index of the item data is requested
   282      * @param duration, duration of the video
   282      * @param duration, duration of the video
   283      *
   283      *
   284      * @return QString detail string
   284      * @return QString detail string
   285      */
   285      */
   286     QString doDetailRow(int index) const;
   286     QString doDetailRow(int &index) const;
   287 
   287 
   288     /**
   288     /**
   289      * Generates a video count string for category or album at given index.
   289      * Generates a video count string for category or album at given index.
   290      * 
   290      * 
   291      * In case item is not found in the provided index, empty
   291      * In case item is not found in the provided index, empty
   294      * @param index, index of the item data is requested
   294      * @param index, index of the item data is requested
   295      * @param index, item id of the item data is requested  
   295      * @param index, item id of the item data is requested  
   296      * 
   296      * 
   297      * @return QString video count string
   297      * @return QString video count string
   298      */
   298      */
   299     QString prepareVideoCountString(int index) const;
   299     QString prepareVideoCountString(int &index) const;
   300     
   300     
   301     /**
   301     /**
   302      * Generates a video size string from video item at given index
   302      * Generates a video size string from video item at given index
   303      * 
   303      * 
   304      * In case item is not found in the provided index, empty
   304      * In case item is not found in the provided index, empty
   306      * 
   306      * 
   307      * @param index, index of the item data is requested
   307      * @param index, index of the item data is requested
   308      * 
   308      * 
   309      * @return QString size string
   309      * @return QString size string
   310      */
   310      */
   311     QString prepareSizeString(int index) const;
   311     QString prepareSizeString(int &index) const;
   312     
   312     
   313     /**
   313     /**
   314      * Called when there are status changes in some async operation
   314      * Called when there are status changes in some async operation
   315      * 
   315      * 
   316      * @param statusCode status of operation
   316      * @param statusCode status of operation