2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2010-06-18 11:02:48 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 Denis Mingulov.
|
|
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-06-18 11:02:48 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-06-18 11:02:48 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-06-18 11:02:48 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-06-18 11:02:48 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-06-18 11:02:48 +02:00
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
#include <coreplugin/idocument.h>
|
2010-06-18 11:02:48 +02:00
|
|
|
|
2015-05-29 13:23:52 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QGraphicsItem;
|
|
|
|
|
class QMovie;
|
|
|
|
|
class QPixmap;
|
|
|
|
|
|
|
|
|
|
#ifndef QT_NO_SVG
|
|
|
|
|
class QGraphicsSvgItem;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2010-06-18 11:02:48 +02:00
|
|
|
namespace ImageViewer {
|
|
|
|
|
namespace Internal {
|
2011-09-16 15:00:41 +02:00
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
class ImageViewerFile : public Core::IDocument
|
2010-06-18 11:02:48 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2013-05-26 00:26:16 +02:00
|
|
|
|
2010-06-18 11:02:48 +02:00
|
|
|
public:
|
2015-05-29 13:23:52 +02:00
|
|
|
enum ImageType {
|
|
|
|
|
TypeInvalid,
|
|
|
|
|
TypeSvg,
|
|
|
|
|
TypeMovie,
|
|
|
|
|
TypePixmap
|
|
|
|
|
};
|
2010-06-18 11:02:48 +02:00
|
|
|
|
2015-05-29 13:23:52 +02:00
|
|
|
ImageViewerFile();
|
2015-06-04 15:54:10 +02:00
|
|
|
~ImageViewerFile() override;
|
2015-05-29 13:23:52 +02:00
|
|
|
|
2015-06-04 15:54:10 +02:00
|
|
|
OpenResult open(QString *errorString, const QString &fileName,
|
|
|
|
|
const QString &realFileName) override;
|
2010-06-18 11:02:48 +02:00
|
|
|
|
2015-06-04 15:54:10 +02:00
|
|
|
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
|
|
|
|
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
2010-06-18 11:02:48 +02:00
|
|
|
|
2015-05-29 13:23:52 +02:00
|
|
|
bool isPaused() const;
|
|
|
|
|
void setPaused(bool paused);
|
|
|
|
|
|
|
|
|
|
QGraphicsItem *createGraphicsItem() const;
|
|
|
|
|
ImageType type() const;
|
|
|
|
|
|
|
|
|
|
void updateVisibility();
|
|
|
|
|
|
|
|
|
|
signals:
|
2015-06-02 17:14:48 +02:00
|
|
|
void openFinished(bool success);
|
2015-05-29 13:23:52 +02:00
|
|
|
void imageSizeChanged(const QSize &size);
|
|
|
|
|
void isPausedChanged(bool paused);
|
|
|
|
|
|
2010-06-18 11:02:48 +02:00
|
|
|
private:
|
2015-05-29 13:23:52 +02:00
|
|
|
void cleanUp();
|
2015-06-04 15:21:02 +02:00
|
|
|
OpenResult openImpl(QString *errorString, const QString &fileName);
|
2015-05-29 13:23:52 +02:00
|
|
|
|
|
|
|
|
ImageType m_type = TypeInvalid;
|
|
|
|
|
#ifndef QT_NO_SVG
|
2018-11-11 12:24:06 +01:00
|
|
|
mutable QGraphicsSvgItem *m_tempSvgItem = nullptr;
|
2015-05-29 13:23:52 +02:00
|
|
|
#endif
|
2018-11-11 12:24:06 +01:00
|
|
|
QMovie *m_movie = nullptr;
|
|
|
|
|
QPixmap *m_pixmap = nullptr;
|
2015-05-29 13:23:52 +02:00
|
|
|
bool m_isPaused = false;
|
2010-06-18 11:02:48 +02:00
|
|
|
};
|
|
|
|
|
|
2011-09-16 15:00:41 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ImageViewer
|