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
7 changes: 7 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ Changelog {#changelog}

# Release 1.3 (git master)

* [114](https://github.com/BlueBrain/Tide/pull/114):
Tide can be now controlled via a web browser. The web interface provides the
following features:
- moving, resizing and closing windows
- focusing and making content fullscreen
This offers an alternative to the Master window, especially useful when the
application runs in headless mode.
* [115](https://github.com/BlueBrain/Tide/pull/115):
Improved command line parameters of all applications.

Expand Down
69 changes: 69 additions & 0 deletions tests/cpp/core/ContentWindowControllerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ BOOST_AUTO_TEST_CASE( testSizeLimitsBigContent )
BOOST_CHECK_EQUAL( controller.getMinSize(), QSize( 300, 300 ));
BOOST_CHECK_EQUAL( controller.getMaxSize(),
BIG_CONTENT_SIZE * Content::getMaxScale( ));
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 400, 300 ));

const QSizeF normalMaxSize = controller.getMaxSize();
window->getContent()->setZoomRect( QRectF( QPointF( 0.3, 0.1 ),
Expand All @@ -211,6 +213,8 @@ BOOST_AUTO_TEST_CASE( testSizeLimitsSmallContent )

// Test controller and zoom limits
BOOST_CHECK_EQUAL( controller.getMinSize(), QSize( 300, 300 ));
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 400, 300 ));
BOOST_CHECK_EQUAL( controller.getMaxSize(),
SMALL_CONTENT_SIZE * Content::getMaxScale( ));

Expand All @@ -220,6 +224,71 @@ BOOST_AUTO_TEST_CASE( testSizeLimitsSmallContent )
BOOST_CHECK_EQUAL( controller.getMaxSize(), 0.25 * normalMaxSize );
}

BOOST_AUTO_TEST_CASE( testAspectRatioMinSize )
{
ContentWindowPtr window = makeDummyWindow();
DisplayGroupPtr displayGroup( new DisplayGroup( wallSize ));
ContentWindowController controller( *window, *displayGroup );

// Make a content and validate MinSize keeps aspect ratio
ContentPtr content = window->getContent();
content->setDimensions( QSize( 400, 800 ));
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 300, 600 ));

content->setDimensions( QSize( 800, 1600) );
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 300 , 600 ));

content->setDimensions( QSize( 2000, 1500) );
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 400 , 300 ));

window->setMode( ContentWindow::FULLSCREEN );
content->setDimensions( QSize( 800, 1600) );
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 500 , 1000 ));

window->setMode( ContentWindow::STANDARD );
content->setDimensions( QSize( 800, 1600) );
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 300, 600 ));

window->setMode( ContentWindow::FULLSCREEN );
content->setDimensions( QSize( 2500, 1250) );
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 1000, 500 ));

window->setMode( ContentWindow::FOCUSED );
content->setDimensions( QSize( 2500, 1250 ));
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 600, 300 ));

window->setMode( ContentWindow::STANDARD );
const QSize maxSize( CONTENT_SIZE * 2);
const QSize minSize( CONTENT_SIZE / 2);
deflect::SizeHints hints;
hints.maxWidth = maxSize.width();
hints.maxHeight = maxSize.height();
hints.minWidth = minSize.width();
hints.minHeight = minSize.height();

content->setSizeHints( hints );
content->setDimensions( CONTENT_SIZE );

controller.resize( maxSize, CENTER );
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 400, 300 ));

window->setMode( ContentWindow::FULLSCREEN );
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 1000, 750 ));

window->setMode( ContentWindow::FOCUSED );
BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 400, 300 ));
}

BOOST_AUTO_TEST_CASE( testSizeHints )
{
ContentWindowPtr window = makeDummyWindow();
Expand Down
8 changes: 8 additions & 0 deletions tide/master/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,31 @@ set(TIDEMASTER_INCLUDE_NAME tide/master)

if(TIDE_ENABLE_REST_INTERFACE)
list(APPEND TIDEMASTER_PUBLIC_HEADERS
rest/HtmlContent.h
rest/JsonOptions.h
rest/jsonschema.h
rest/JsonSize.h
rest/RestCommand.h
rest/RestConfiguration.h
rest/RestController.h
rest/RestInterface.h
rest/RestLogger.h
rest/RestServer.h
rest/RestWindows.h
rest/StaticContent.h
)
list(APPEND TIDEMASTER_SOURCES
rest/HtmlContent.cpp
rest/JsonOptions.cpp
rest/jsonschema.cpp
rest/JsonSize.cpp
rest/RestCommand.cpp
rest/RestConfiguration.cpp
rest/RestController.cpp
rest/RestInterface.cpp
rest/RestLogger.cpp
rest/RestServer.cpp
rest/RestWindows.cpp
rest/StaticContent.cpp
)
# Servus PUBLIC because servus::Serializable is a base class of public headers
Expand Down
10 changes: 9 additions & 1 deletion tide/master/MasterApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,12 @@ void MasterApplication::_initRestInterface()
loader.load( uri );
});

connect( _restInterface.get(), &RestInterface::close, [this]( QString uuid )
{
auto window = _displayGroup->getContentWindow( uuid );
_displayGroup->removeContentWindow( window );
});

connect( _restInterface.get(), &RestInterface::load,
this, &MasterApplication::load );

Expand Down Expand Up @@ -457,7 +463,9 @@ void MasterApplication::_initRestInterface()
connect( _displayGroup.get(), &DisplayGroup::contentWindowMovedToFront,
_logger.get(), &LoggingUtility::contentWindowMovedToFront );

_restInterface.get()->exposeStatistics( *(_logger.get()) );
_restInterface.get()->exposeStatistics( *_logger );

_restInterface.get()->setupHtmlInterface( *_displayGroup, *_config );
}
#endif

Expand Down
12 changes: 12 additions & 0 deletions tide/master/control/ContentWindowController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,18 @@ QSizeF ContentWindowController::getMinSize() const
return std::max( minContentSize, minSize );
}

QSizeF ContentWindowController::getMinSizeAspectRatioCorrect() const
{
const qreal contentAspectRatio =
_contentWindow.getContent()-> getAspectRatio();
const auto min = getMinSize();
const auto max = getMaxSize();
const auto aspectRatioCorrectSize = QSizeF( contentAspectRatio, 1.0 );
if( min > max )
return aspectRatioCorrectSize.scaled( max, Qt::KeepAspectRatio );
return aspectRatioCorrectSize.scaled( min, Qt::KeepAspectRatioByExpanding );
}

QSizeF ContentWindowController::getMaxSize() const
{
const QRectF& zoomRect = _contentWindow.getContent()->getZoomRect();
Expand Down
3 changes: 3 additions & 0 deletions tide/master/control/ContentWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class ContentWindowController : public QObject
/** Constrain the given size between getMinSize() and getMaxSize(). */
void constrainSize( QSizeF& windowSize ) const;

/** @return the minimum size of the window respecting its aspect ratio. */
QSizeF getMinSizeAspectRatioCorrect() const;

private:
/**
* Resize the window around a given center point.
Expand Down
10 changes: 10 additions & 0 deletions tide/master/resources/img/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions tide/master/resources/img/exit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions tide/master/resources/img/focus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions tide/master/resources/img/maximize.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions tide/master/resources/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>Tide web interface</title>
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/sweetalert.min.js"></script>
<script src="js/tide.js"></script>
<script src="js/underscore-min.js"></script>
<script src="js/tideVars.js"></script>
<link rel="stylesheet" href="css/sweetalert.min.css">
<link rel="stylesheet" href="css/jquery-ui.css">
<link rel="stylesheet" href="css/styles.css">
<meta charset="utf-8"/>
</head>
<body>
<div id="wallWrapper">
<div id="buttonContainer" >
<button id="refreshButton" onclick="updateWall()">REFRESH</button>
<button id="closeAllButton">CLOSE ALL</button>
<button id="exitFullscreenButton" >EXIT FULLSCREEN</button>
<button id="autoRefreshButton" onclick="autoRefresh()">AUTO-REFRESH</button>
</div>
<div id="wall">
<div id="wallOutline"></div>
</div>
</div>
</body>
</html>
4 changes: 4 additions & 0 deletions tide/master/resources/jquery-3.1.1.min.js

Large diffs are not rendered by default.

Loading