Skip to content

Commit

Permalink
Setup min/max sizes for whiteboard and webbrowser, adapt resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Dumusc committed Nov 7, 2018
1 parent 2abd670 commit 264b045
Show file tree
Hide file tree
Showing 29 changed files with 827 additions and 394 deletions.
2 changes: 1 addition & 1 deletion .gitsubprojects
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- mode: cmake -*-
git_subproject(Deflect https://github.com/BlueBrain/Deflect.git 4af58e7)
git_subproject(Deflect https://github.com/BlueBrain/Deflect.git 75c562f)
git_subproject(Rockets https://github.com/BlueBrain/Rockets.git 7877344)
git_subproject(VirtualKeyboard https://github.com/BlueBrain/QtFreeVirtualKeyboard.git d026536)
15 changes: 12 additions & 3 deletions apps/Webbrowser/qml/Webengine.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2016, EPFL/Blue Brain Project
// Raphael Dumusc <raphael.dumusc@epfl.ch>
import QtQuick 2.0
// Copyright (c) 2016-2018, EPFL/Blue Brain Project
// Raphael Dumusc <raphael.dumusc@epfl.ch>
import QtQuick 2.4
import QtQuick.Window 2.2
import QtWebEngine 1.1
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
Expand All @@ -14,6 +15,14 @@ Item {
width: 640
height: 480

onWindowChanged: {
// size constraints for the stream window
window.minimumWidth = 640
window.minimumHeight = 480
window.maximumWidth = 3840
window.maximumHeight = 2160
}

signal addressBarTextEntered(string url)

Item {
Expand Down
13 changes: 11 additions & 2 deletions apps/Whiteboard/qml/whiteboard.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2016, EPFL/Blue Brain Project
// Pawel Podhajski <pawel.podhajski@epfl.ch>
// Copyright (c) 2016-2018, EPFL/Blue Brain Project
// Pawel Podhajski <pawel.podhajski@epfl.ch>
// Raphael Dumusc <raphael.dumusc@epfl.ch>

import QtQuick 2.4
import QtQuick.Window 2.2
Expand All @@ -14,6 +15,14 @@ Item {
width: 1920
height: 1080

onWindowChanged: {
// size constraints for the stream window
window.minimumWidth = 640
window.minimumHeight = 480
window.maximumWidth = 3840
window.maximumHeight = 2160
}

property int headerHeight: 100
property int oldWidth: width
property int oldHeight: height
Expand Down
2 changes: 2 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog {#changelog}

# Release 1.5 (git master)

* [282](https://github.com/BlueBrain/Tide/pull/282):
Improve resizing of webbrowsers and whiteboards.
* [279](https://github.com/BlueBrain/Tide/pull/279):
Screens can be powered on/off from the web interface by clicking the screen
status icon.
Expand Down
27 changes: 19 additions & 8 deletions tests/cpp/core/ContentControllerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,20 @@ BOOST_AUTO_TEST_CASE(factory_method)

auto& dummyContent = dynamic_cast<DummyContent&>(window.getContent());

// Check DummyContent (used for unit testing other components)
auto controller = ContentController::create(window);
BOOST_CHECK(dynamic_cast<ContentController*>(controller.get()));
BOOST_CHECK(dynamic_cast<ZoomController*>(controller.get()));

dummyContent.zoomable = false;
controller = ContentController::create(window);
BOOST_CHECK(!dynamic_cast<ZoomController*>(controller.get()));

dummyContent.type = ContentType::pixel_stream;
BOOST_CHECK_THROW(ContentController::create(window), std::bad_cast);
Window streamWin(ContentFactory::getPixelStreamContent("xyz", QSize()));
BOOST_CHECK_NO_THROW(controller = ContentController::create(streamWin));
BOOST_CHECK(dynamic_cast<PixelStreamController*>(controller.get()));
BOOST_CHECK(!dynamic_cast<ZoomController*>(controller.get()));

#if TIDE_ENABLE_WEBBROWSER_SUPPORT
dummyContent.type = ContentType::webbrowser;
Expand All @@ -84,18 +90,23 @@ BOOST_AUTO_TEST_CASE(factory_method)
StreamType::WEBBROWSER));
BOOST_CHECK_NO_THROW(controller = ContentController::create(webWindow));
BOOST_CHECK(dynamic_cast<PixelStreamController*>(controller.get()));
#endif

#if TIDE_ENABLE_PDF_SUPPORT
dummyContent.type = ContentType::pdf;
controller = ContentController::create(window);
BOOST_CHECK(dynamic_cast<PDFController*>(controller.get()));
BOOST_CHECK(!dynamic_cast<ZoomController*>(controller.get()));
#endif

#if TIDE_ENABLE_MOVIE_SUPPORT
dummyContent.type = ContentType::movie;
controller = ContentController::create(window);
BOOST_CHECK(dynamic_cast<MovieController*>(controller.get()));
BOOST_CHECK(!dynamic_cast<ZoomController*>(controller.get()));
#endif

dummyContent.zoomable = true;

#if TIDE_ENABLE_PDF_SUPPORT
dummyContent.type = ContentType::pdf;
controller = ContentController::create(window);
BOOST_CHECK(dynamic_cast<ZoomController*>(controller.get()));
BOOST_CHECK(dynamic_cast<PDFController*>(controller.get()));
#endif

#if TIDE_USE_TIFF
Expand All @@ -106,7 +117,7 @@ BOOST_AUTO_TEST_CASE(factory_method)

dummyContent.type = ContentType::svg;
controller = ContentController::create(window);
BOOST_CHECK(dynamic_cast<ContentController*>(controller.get()));
BOOST_CHECK(dynamic_cast<ZoomController*>(controller.get()));

dummyContent.type = ContentType::image;
controller = ContentController::create(window);
Expand Down
26 changes: 26 additions & 0 deletions tests/cpp/core/PixelStreamControllerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,29 @@ BOOST_FIXTURE_TEST_CASE(pan_event, PixelStreamFixture)
BOOST_CHECK_EQUAL(eventPosition(), QPointF(0.5, 0.25));
BOOST_CHECK_EQUAL(eventDelta(), _normalize(delta));
}

BOOST_FIXTURE_TEST_CASE(resize_event, PixelStreamFixture)
{
window.setCoordinates(QRectF{QPointF(), QSizeF{100, 150}});
BOOST_CHECK_EQUAL(event.type, deflect::Event::EVT_VIEW_SIZE_CHANGED);
BOOST_CHECK_EQUAL(eventDelta(), QPointF(100, 150));

window.setCoordinates(QRectF{QPointF(), QSizeF{2000, 1500}});
BOOST_CHECK_EQUAL(eventDelta(), QPointF(2000, 1500));

deflect::SizeHints hints;
hints.minWidth = 200;
hints.minHeight = 200;
hints.maxWidth = 1000;
hints.maxHeight = 1000;
window.getContent().setSizeHints(hints);

window.setCoordinates(QRectF{QPointF(), QSizeF{500, 500}});
BOOST_CHECK_EQUAL(eventDelta(), QPointF(500, 500));

window.setCoordinates(QRectF{QPointF(), QSizeF{100, 150}});
BOOST_CHECK_EQUAL(eventDelta(), QPointF(200, 300));

window.setCoordinates(QRectF{QPointF(), QSizeF{2000, 1500}});
BOOST_CHECK_EQUAL(eventDelta(), QPointF(1000, 750));
}
19 changes: 17 additions & 2 deletions tests/cpp/core/PixelStreamWindowManagerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ BOOST_AUTO_TEST_CASE(testImplicitWindowCreation)
const auto& uri = CONTENT_URI;
// window will be positioned centered
const auto pos = QPointF(wallSize.width() * 0.5, wallSize.height() * 0.5);
const auto size = QSize(defaultPixelStreamWindowSize);

windowManager.handleStreamStart(uri);
BOOST_REQUIRE(windowManager.getWindows(uri).size() == 1);
Expand All @@ -254,7 +253,7 @@ BOOST_AUTO_TEST_CASE(testImplicitWindowCreation)

const auto& coords = window->getCoordinates();
BOOST_CHECK_EQUAL(coords.center(), pos);
BOOST_CHECK_EQUAL(coords.size(), size);
BOOST_CHECK_EQUAL(coords.size(), defaultPixelStreamWindowSize);

// Check that the window is resized to the first frame dimensions
windowManager.updateStreamWindows(createTestFrame(testFrameSize));
Expand Down Expand Up @@ -461,6 +460,22 @@ BOOST_FIXTURE_TEST_CASE(local_streams_open_without_validation_signal,
BOOST_CHECK(!windowManager.getWindows(whiteboardUri).at(0)->isHidden());
}

BOOST_FIXTURE_TEST_CASE(large_stream_is_sized_to_fit_displaygroup_when_opening,
SingleSurface)
{
windowManager.handleStreamStart(CONTENT_URI);
const auto frame = createTestFrame(2 * wallSize);
windowManager.updateStreamWindows(frame);

BOOST_REQUIRE(externalStreamOpened);

const auto window = windowManager.getWindows(CONTENT_URI)[0];

BOOST_CHECK_EQUAL(window->getContent().getDimensions(), 2 * wallSize);
BOOST_CHECK(
scene->getGroup(0).getCoordinates().contains(window->getCoordinates()));
}

BOOST_FIXTURE_TEST_CASE(
multi_channel_stream_shows_first_channel_on_single_surface, SingleSurface)
{
Expand Down
Loading

0 comments on commit 264b045

Please sign in to comment.