Exemplo n.º 1
0
void MasterApplication::_deleteTempContentFile( ContentWindowPtr window )
{
    const bool isFile = contentTypeIsFile( window->getContent()->getType( ));
    const auto& filename = window->getContent()->getURI();
    if( isFile && filename.startsWith( QDir::tempPath() + "/" ))
    {
        QDir().remove( filename );
        put_flog( LOG_INFO, "Deleted temporary file: %s",
                  filename.toLocal8Bit().constData( ));
    }
}
Exemplo n.º 2
0
void PDF::preRenderUpdate( ContentWindowPtr window, const QRect& /*wallArea*/ )
{
    if( window->isResizing( ))
        return;

    PDFContent& content = static_cast<PDFContent&>( *window->getContent( ));

    const bool pageHasChanged = (pageNumber_ != content.getPage( ));
    setPage( content.getPage( ));

    const QSize& windowSize = window->getCoordinates().size().toSize();
    if( pageHasChanged || texture_.getSize() != windowSize ||
        textureRect_ != window->getZoomRect( ) )
    {
        updateTexture( windowSize, window->getZoomRect( ));
    }
}
QmlWindowRenderer::QmlWindowRenderer( QDeclarativeEngine& engine,
                                      QDeclarativeItem& parentItem,
                                      ContentWindowPtr contentWindow )
    : contentWindow_( contentWindow )
    , windowContext_( new QDeclarativeContext( engine.rootContext( )))
    , windowItem_( 0 )
    , wallContent_( WallContent::create( *(contentWindow->getContent( ))))
{
    windowContext_->setContextProperty( "contentwindow", contentWindow_.get( ));

    windowItem_ = createQmlItem( QML_WINDOW_URL );
    windowItem_->setParentItem( &parentItem );

    ContentItem* contentItem =
       windowItem_->findChild<ContentItem*>( CONTENT_ITEM_OBJECT_NAME );
    contentItem->setWallContent( wallContent_.get( ));

    ContentItem* zoomContextItem =
      windowItem_->findChild<ContentItem*>( ZOOM_CONTEXT_ITEM_OBJECT_NAME );
    zoomContextItem->setWallContent( wallContent_.get( ));

    if( contentWindow_->getContent()->getType() == CONTENT_TYPE_PIXEL_STREAM )
        setupPixelStreamItem();
}