Esempio 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( ));
    }
}
ContentWindowPtr makeDummyWindow()
{
    ContentPtr content( new DummyContent );
    content->setDimensions( CONTENT_SIZE );
    ContentWindowPtr window = boost::make_shared<ContentWindow>( content );
    window->setCoordinates( QRectF( 610, 220, 30, 40 ));

    const QRectF& coords = window->getCoordinates();
    BOOST_REQUIRE_EQUAL( coords.topLeft(), QPointF( 610, 220 ));
    BOOST_REQUIRE_EQUAL( coords.center(), QPointF( 625, 240 ));

    return window;
}
Esempio n. 3
0
void DisplayGroupController::_showFullscreen(ContentWindowPtr window,
                                             const bool oneToOne)
{
    exitFullscreen();

    window->backupModeAndZoom();

    const auto target = ContentWindowController::Coordinates::FULLSCREEN;
    ContentWindowController controller(*window, _group, target);
    controller.adjustSize(oneToOne ? SIZE_FULLSCREEN_1TO1 : SIZE_FULLSCREEN);

    window->setMode(ContentWindow::WindowMode::FULLSCREEN);
    _group.setFullscreenWindow(window);
}
Esempio n. 4
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( ));
    }
}
void WebbrowserCommandHandler::handle( const deflect::Command& command,
                                       const QString& senderUri )
{
    QString url = command.getArguments();
    if( url.isEmpty( ))
        url = _defaultURL;

    QPointF position;

    // Center the new content where the dock is
    // TODO: DISCL-230
    ContentWindowPtr parentWindow = _windowManager.getContentWindow(senderUri);
    if( parentWindow )
        position = parentWindow->getCoordinates().center();

    emit openWebBrowser( position, QSize(), url );
}
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();
}
void QmlWindowRenderer::update( ContentWindowPtr contentWindow )
{
    // Could be optimized by checking for changes before updating the context
    windowContext_->setContextProperty( "contentwindow", contentWindow.get( ));
    contentWindow_ = contentWindow;
}