File indexing completed on 2024-05-12 16:35:05

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2007 Thomas Zander <zander@kde.org>
0003  * Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #ifndef VIDEOSHAPE_H
0022 #define VIDEOSHAPE_H
0023 
0024 #include <KoShape.h>
0025 #include <KoFrameShape.h>
0026 
0027 #include <QIcon>
0028 
0029 #include <QPixmap>
0030 
0031 #define VIDEOSHAPEID "VideoShape"
0032 
0033 class VideoCollection;
0034 class VideoEventAction;
0035 class VideoData;
0036 #ifdef SHOULD_BUILD_THUMBNAIL
0037 class VideoThumbnailer;
0038 #endif
0039 
0040 
0041 class VideoShape : public KoShape, public KoFrameShape
0042 {
0043 public:
0044     VideoShape();
0045     virtual ~VideoShape();
0046 
0047     // reimplemented
0048     void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
0049     // reimplemented
0050     void saveOdf(KoShapeSavingContext &context) const override;
0051     // reimplemented
0052     bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
0053 
0054     /**
0055      * Get the collection used in the shape.
0056      */
0057     VideoCollection *videoCollection() const;
0058     /**
0059      * Set the collection used in the shape.
0060      */
0061     void setVideoCollection(VideoCollection *collection);
0062 
0063     /**
0064      * return the video data used in this shape. Returns 0 if not set
0065      */
0066     VideoData *videoData() const;
0067 
0068 protected:
0069     bool loadOdfFrameElement(const KoXmlElement &element, KoShapeLoadingContext &context) override;
0070 
0071 private Q_SLOTS:
0072     void updateThumbnail();
0073 
0074 Q_SIGNALS:
0075     void createThumbnail(VideoData *videoData, const QSize &size);
0076 
0077 private:
0078     VideoCollection *m_videoCollection;
0079     VideoEventAction *m_videoEventAction;
0080 #ifdef SHOULD_BUILD_THUMBNAIL
0081     VideoThumbnailer *m_thumbnailer;
0082 #endif
0083     VideoData *m_oldVideoData;
0084     QIcon m_icon;
0085     QRectF m_playIconArea;
0086 };
0087 
0088 #endif