Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Daniel Nachbaur <daniel.nachbaur@epfl.ch>

cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(Deflect VERSION 0.10.1)
project(Deflect VERSION 0.10.2)
set(Deflect_VERSION_ABI 3)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake
Expand Down
44 changes: 17 additions & 27 deletions deflect/qt/QmlStreamerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,18 @@ void QmlStreamer::Impl::_render()
if( !_context->makeCurrent( _offscreenSurface ))
return;

// fixed sized rootItems won't signal sizes changes, finish their setup now
// Initialize the render control and our OpenGL resources. Do this as
// late as possible to use the proper size reported by the rootItem.
if( !_fbo )
{
_updateSizes( QSize( _rootItem->width(), _rootItem->height( )));

_renderControl->initialize( _context );

if( !_setupDeflectStream( ))
qWarning() << "Could not setup Deflect stream";
}

// Polish, synchronize and render the next frame (into our fbo). In this
// example everything happens on the same thread and therefore all three
// steps are performed in succession from here. In a threaded setup the
Expand Down Expand Up @@ -301,13 +309,6 @@ bool QmlStreamer::Impl::_setupRootItem()
return false;
}

connect( _rootItem, &QQuickItem::widthChanged, this,
[this]() { _updateSizes( QSize( _rootItem->width(),
_rootItem->height( ))); } );
connect( _rootItem, &QQuickItem::heightChanged, this,
[this]() { _updateSizes( QSize( _rootItem->width(),
_rootItem->height( ))); } );

connect( _quickWindow, &QQuickWindow::minimumWidthChanged,
[this]( int size_ ) { _sizeHints.minWidth = size_; } );
connect( _quickWindow, &QQuickWindow::minimumHeightChanged,
Expand All @@ -321,7 +322,7 @@ bool QmlStreamer::Impl::_setupRootItem()
connect( _quickWindow, &QQuickWindow::heightChanged,
[this]( int size_ ) { _sizeHints.preferredHeight = size_; } );

// The root item is ready. Associate it with the window.
// The root item is ready. Associate it with the window and get sizeHints.
_rootItem->setParentItem( _quickWindow->contentItem( ));

return true;
Expand All @@ -347,7 +348,8 @@ bool QmlStreamer::Impl::_setupDeflectStream()
if( !_stream->registerForEvents( ))
return false;

_stream->sendSizeHints( _sizeHints );
if( _sizeHints != SizeHints( ))
_stream->sendSizeHints( _sizeHints );

_streaming = true;
_eventHandler = new EventReceiver( *_stream );
Expand All @@ -367,28 +369,16 @@ bool QmlStreamer::Impl::_setupDeflectStream()

void QmlStreamer::Impl::_updateSizes( const QSize& size_ )
{
setWidth( size_.width( ));
setHeight( size_.height( ));
resize( size_ );
_quickWindow->blockSignals( true );
_quickWindow->resize( size_ );
_quickWindow->blockSignals( false );
// emulate QQuickView::ResizeMode:SizeRootObjectToView
if( _rootItem )
{
_rootItem->setWidth( size_.width( ));
_rootItem->setHeight( size_.height( ));
}
_quickWindow->blockSignals( true );
_quickWindow->setWidth( size_.width( ));
_quickWindow->setHeight( size_.height( ));
_quickWindow->blockSignals( false );

// Initialize the render control and our OpenGL resources. Do this as late
// as possible to use the proper size reported by the rootItem.
if( !_streaming )
{
_context->makeCurrent( _offscreenSurface );
_renderControl->initialize( _context );

if( !_setupDeflectStream( ))
qWarning() << "Could not setup Deflect stream";
}
}

void QmlStreamer::Impl::resizeEvent( QResizeEvent* e )
Expand Down
6 changes: 6 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Changelog {#Changelog}

## Deflect 0.10

### git master (0.10.2)
* [93](https://github.com/BlueBrain/Deflect/pull/93):
Minor fixes for the Qml stream API:
- Cleanup size handling, allow programmatic resizing of root Qml item
- Do not send a size hints event if none were set by the user

### 0.10.1 (01-04-2016)
* [79](https://github.com/BlueBrain/Deflect/pull/79):
DesktopStreamer: Grid-view like layout in apps listview
Expand Down