Warning, file /office/calligra/libs/flake/KoImageData_p.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org> 0003 * Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net> 0004 * Copyright (C) 2008 C. Boemann <cbo@boemann.dk> 0005 * Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 */ 0022 0023 #ifndef KOIMAGEDATA_P_H 0024 #define KOIMAGEDATA_P_H 0025 0026 #include <QUrl> 0027 #include <QByteArray> 0028 #include <QImage> 0029 #include <QPixmap> 0030 #include <QTimer> 0031 #include <QDir> 0032 0033 #include "KoImageData.h" 0034 0035 class KoImageCollection; 0036 class QTemporaryFile; 0037 0038 class KoImageDataPrivate 0039 { 0040 public: 0041 explicit KoImageDataPrivate(KoImageData *q); 0042 virtual ~KoImageDataPrivate(); 0043 0044 /** 0045 * Save the image data to the param device. 0046 * The full file is saved. 0047 * @param device the device that is used to get the data from. 0048 * @return returns true if load was successful. 0049 */ 0050 bool saveData(QIODevice &device); 0051 0052 /// store the suffix based on the full filename. 0053 void setSuffix(const QString &fileName); 0054 0055 /// take the data from \a device and store it in the temporaryFile 0056 void copyToTemporary(QIODevice &device); 0057 0058 /// clean the image cache. 0059 void cleanupImageCache(); 0060 0061 void clear(); 0062 0063 static qint64 generateKey(const QByteArray &bytes); 0064 0065 enum DataStoreState { 0066 StateEmpty, ///< No image data, either as url or as QImage 0067 StateNotLoaded, ///< Image data is set as Url 0068 StateImageLoaded,///< Image data is loaded from Url, so both are present. 0069 StateImageOnly ///< Image data is stored in a QImage. There is no external storage. 0070 }; 0071 0072 KoImageCollection *collection; 0073 KoImageData::ErrorCode errorCode; 0074 QSizeF imageSize; 0075 qint64 key; 0076 QString suffix; // the suffix of the picture e.g. png TODO use a QByteArray ? 0077 QTimer cleanCacheTimer; 0078 0079 QAtomicInt refCount; 0080 0081 // Image data store. 0082 DataStoreState dataStoreState; 0083 QUrl imageLocation; 0084 QImage image; 0085 /// screen optimized cached version. 0086 QPixmap pixmap; 0087 0088 QTemporaryFile *temporaryFile; 0089 }; 0090 0091 #endif /* KOIMAGEDATA_P_H */