Beispiel #1
0
VideoShape::VideoShape()
    : KoFrameShape(KoXmlNS::draw, "plugin")
    , m_videoCollection(0)
    , m_videoEventAction(new VideoEventAction(this))
#ifdef SHOULD_BUILD_THUMBNAIL
    , m_thumbnailer(new VideoThumbnailer())
#endif
    , m_oldVideoData(0)
    , m_icon(koIcon("video-x-generic"))
{
    setKeepAspectRatio(true);
    addEventAction(m_videoEventAction);
}
Beispiel #2
0
	InputContext::InputContext( const json & j )
	{
		_name = j.get( "context", json::nullRef ).asString();
		_priority = j.get( "priority", json::nullRef ).asInt();

		auto inputList = j.get( "input_list", json::nullRef );
		if( inputList.isNull() )
		{
			TRACE_WARNING( "Input Context action list is not found." );
			return;
		}

		for( uint i = 0; i < inputList.size(); ++i )
		{
			addEventAction( EventAction::FromJson( inputList[ i ] ) );
		}
	}
Beispiel #3
0
bool VideoShape::loadOdfFrameElement(const KoXmlElement &element, KoShapeLoadingContext &context)
{
    /* the loading of the attributes might set the event actions which removes the m_videoEventAction
     * when there are other eventactions for the shape. Therefore we need to add it again. It is no
     * problem to add it again as internally a set is used and so it is not problematic when it is 
     * already set. */
    addEventAction(m_videoEventAction);

    if (m_videoCollection) {
        const QString href = element.attribute("href");
        // this can happen in case it is a presentation:placeholder
        if (!href.isEmpty()) {
            QUrl url = QUrl::fromUserInput(href);
            VideoData *data=0;

            if(href.startsWith("../")) {
                // file is outside store
                QUrl url = context.odfLoadingContext().store()->urlOfStore();
                QString path = url.path();
                if (!path.endsWith(QLatin1Char('/'))) {
                    path.append(QLatin1Char('/'));
                }
                path.append(href.mid(3));
                url.setPath(path);
                data = m_videoCollection->createExternalVideoData(url, false);
            } else if(!url.isRelative()) {
                // file is outside store and absolute
                data = m_videoCollection->createExternalVideoData(QUrl::fromUserInput(href), false);
            } else {
                // file is inside store
                KoStore *store = context.odfLoadingContext().store();
                data = m_videoCollection->createVideoData(href, store);
            }
            setUserData(data);
        }
    }

    return true;
}