blob: e4cc432651d64020a9a9bc34ba19862fafef21db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright (C) 2016 Denis Mingulov.
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <coreplugin/idocument.h>
#include <QMovie>
QT_BEGIN_NAMESPACE
class QGraphicsItem;
class QPixmap;
#ifndef QT_NO_SVG
class QGraphicsSvgItem;
#endif
QT_END_NAMESPACE
namespace ImageViewer::Internal {
class ImageViewerFile : public Core::IDocument
{
Q_OBJECT
public:
enum ImageType {
TypeInvalid,
TypeSvg,
TypeMovie,
TypePixmap
};
ImageViewerFile();
~ImageViewerFile() override;
OpenResult open(QString *errorString, const Utils::FilePath &filePath,
const Utils::FilePath &realFilePath) override;
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
Utils::Result<> reload(ReloadFlag flag, ChangeType type) override;
QMovie *movie() const;
QGraphicsItem *createGraphicsItem() const;
ImageType type() const;
void updateVisibility();
signals:
void openFinished(bool success);
void imageSizeChanged(const QSize &size);
void movieStateChanged();
private:
void cleanUp();
OpenResult openImpl(QString *errorString, const Utils::FilePath &filePath);
ImageType m_type = TypeInvalid;
#ifndef QT_NO_SVG
mutable QGraphicsSvgItem *m_tempSvgItem = nullptr;
#endif
QMovie *m_movie = nullptr;
QPixmap *m_pixmap = nullptr;
};
} // ImageViewer::Internal
|