1 // vim: set tabstop=4 shiftwidth=4 expandtab:
2 /*
3 Gwenview: an image viewer
4 Copyright 2013 Aurélien Gâteau <agateau@kde.org>
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
19 
20 */
21 #ifndef DOCUMENT_P_H
22 #define DOCUMENT_P_H
23 
24 // STL
25 #include <memory>
26 
27 // Local
28 #include <document/documentjob.h>
29 #include <imagemetainfomodel.h>
30 
31 // KF
32 
33 // Qt
34 #include <QImage>
35 #include <QPointer>
36 #include <QQueue>
37 #include <QUndoStack>
38 #include <QUrl>
39 
40 namespace Exiv2
41 {
42 class Image;
43 }
44 
45 namespace Gwenview
46 {
47 using DocumentJobQueue = QQueue<DocumentJob *>;
48 struct DocumentPrivate {
49     Document *q;
50     AbstractDocumentImpl *mImpl;
51     QUrl mUrl;
52     bool mKeepRawData;
53     QPointer<DocumentJob> mCurrentJob;
54     DocumentJobQueue mJobQueue;
55 
56     /**
57      * @defgroup imagedata should be reset in reload()
58      * @{
59      */
60     QSize mSize;
61     QImage mImage;
62     QMap<int, QImage> mDownSampledImageMap;
63     std::unique_ptr<Exiv2::Image> mExiv2Image;
64     MimeTypeUtils::Kind mKind;
65     QByteArray mFormat;
66     ImageMetaInfoModel mImageMetaInfoModel;
67     QUndoStack mUndoStack;
68     QString mErrorString;
69     Cms::Profile::Ptr mCmsProfile;
70     /** @} */
71 
72     void scheduleImageLoading(int invertedZoom);
73     void scheduleImageDownSampling(int invertedZoom);
74     void downSampleImage(int invertedZoom);
75 };
76 
77 class DownSamplingJob : public DocumentJob
78 {
79     Q_OBJECT
80 public:
DownSamplingJob(int invertedZoom)81     DownSamplingJob(int invertedZoom)
82         : mInvertedZoom(invertedZoom)
83     {
84     }
85 
86     void doStart() override;
87 
88     int mInvertedZoom;
89 };
90 
91 } // namespace
92 
93 #endif /* DOCUMENT_P_H */
94