#ifndef VIMAGERESOURCEMANAGER2_H #define VIMAGERESOURCEMANAGER2_H #include #include #include #include #include #include struct VBlockImageInfo2; class VImageResourceManager2 { public: VImageResourceManager2(); // Add an image to the resource with @p_name as the key. // If @p_name already exists in the resources, it will update it. void addImage(const QString &p_name, const QPixmap &p_image); // Whether the resources contains image with name @p_name. bool contains(const QString &p_name) const; // Update the block-image info for all blocks. // @p_maximumWidth: maximum width of the images plus the margin. // Return changed blocks' block number. QSet updateBlockInfos(const QVector &p_blocksInfo); const QVector *findImageInfoByBlock(int p_blockNumber) const; const QPixmap *findImage(const QString &p_name) const; void clear(); private: // All the images resources. QHash m_images; // Image info of all the blocks with image. // One block may contain multiple inline images or only one block image. // If there are multiple inline images, they are sorted by the start position. QHash> m_blocksInfo; }; #endif // VIMAGERESOURCEMANAGER2_H