File indexing completed on 2025-02-23 04:34:22
0001 /** 0002 * \file pixmapprovider.h 0003 * Image provider to get pixmaps by ID. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 21 Jun 2014 0008 * 0009 * Copyright (C) 2014-2018 Urs Fleisch 0010 * 0011 * This file is part of Kid3. 0012 * 0013 * Kid3 is free software; you can redistribute it and/or modify 0014 * it under the terms of the GNU General Public License as published by 0015 * the Free Software Foundation; either version 2 of the License, or 0016 * (at your option) any later version. 0017 * 0018 * Kid3 is distributed in the hope that it will be useful, 0019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 * GNU General Public License for more details. 0022 * 0023 * You should have received a copy of the GNU General Public License 0024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0025 */ 0026 0027 #pragma once 0028 0029 #include <QPixmap> 0030 #include "imagedataprovider.h" 0031 0032 class CoreTaggedFileIconProvider; 0033 0034 /** 0035 * Image provider to get pixmaps by ID. 0036 * 0037 * The following source IDs are supported (starting with "image://kid3/"): 0038 * - "fileicon/" followed by "null", "notag", "v1", "v2", "v1v2", or "modified", 0039 * - "data" followed by a changing string to force loading of the image set with 0040 * CoreTaggedFileIconProvider::setImageData(). 0041 */ 0042 class KID3_GUI_EXPORT PixmapProvider : public ImageDataProvider { 0043 public: 0044 /** 0045 * Constructor. 0046 * @param iconProvider icon provider to use 0047 */ 0048 explicit PixmapProvider(CoreTaggedFileIconProvider* iconProvider); 0049 0050 /** 0051 * Destructor. 0052 */ 0053 ~PixmapProvider() = default; 0054 0055 /** 0056 * Request a pixmap. 0057 * @param id ID of pixmap to get, "image://kid3/fileicon/..." or 0058 * "image://kid3/data..." 0059 * @param size the original size of the image is returned here 0060 * @param requestedSize the size requested via the Image.sourceSize property 0061 * @return pixmap for ID. 0062 */ 0063 QPixmap getPixmap(const QString& id, QSize* size, const QSize& requestedSize); 0064 0065 private: 0066 CoreTaggedFileIconProvider* m_fileIconProvider; 0067 QPixmap m_dataPixmap; 0068 uint m_pixmapHash; 0069 };