Skip to content

Adding Tide web interface#114

Merged
rdumusc merged 4 commits intoBlueBrain:masterfrom
ppodhajski:master
Jan 26, 2017
Merged

Adding Tide web interface#114
rdumusc merged 4 commits intoBlueBrain:masterfrom
ppodhajski:master

Conversation

@ppodhajski
Copy link
Copy Markdown
Contributor

Web interface using rest interface to control the application and display its state

BOOST_CHECK_EQUAL( controller.getMinSizeAspectRatioCorrect(),
QSize( 400, 300 ));

controller.resize( minSize, CENTER );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all those resize operations are not really expected to have an effect on the minSize. I would rather make some more checks in FULLSCREEN with sizeHints.

Comment thread tide/core/types.h Outdated
typedef boost::shared_ptr< Markers > MarkersPtr;
typedef boost::shared_ptr< MPIChannel > MPIChannelPtr;
typedef boost::shared_ptr< Options > OptionsPtr;
typedef boost::shared_ptr< MasterConfiguration > MasterConfigurationPtr;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused, remove

Comment thread tide/core/types.h Outdated
class DataProvider;
class DataSource;
class DisplayGroup;
class DisplayGroupController;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either forward-declare here OR #include "control/DisplayGroupController.h" in RestController.h, not both.

Comment thread tide/master/MasterApplication.cpp Outdated
_restInterface.get()->exposeStatistics( *(_logger.get()) );

_restInterface.get()->setController( *(_displayGroup.get()),
*(_config.get()) );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*(mySmartPtr.get()) can be just *mySmartPtr (3 occurences)

QSizeF ContentWindowController::getMinSizeAspectRatioCorrect() const
{
const qreal contentAspectRatio = _contentWindow.getContent()->
getAspectRatio();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: don't break at ->, break after = if it can't fit on one line

Comment thread tide/master/rest/RestWindows.cpp Outdated
void RestWindows::registerThumbnailUrl( ContentWindowPtr contentWindow )
{
QString url = "tide/windows/" + contentWindow.get()->getID().toString()
.replace(_regex,"")+"/thumbnail";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrite this line (no break in the middle, const, etc..)

Comment thread tide/master/rest/RestWindows.cpp Outdated
QString uri = contentWindow.get()->getContent().get()->getURI();
httpServer.get().handleGET(url.toStdString(), [uri] ()
{
QSize size(768,768);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number: it must be declared as a constant in the namespace{} at the beginnig of the file

Comment thread tide/master/rest/RestWindows.cpp Outdated
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, "PNG");
QString str = imageArray.toBase64();
return str.toStdString();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more compact:
return imageArray.toBase64().toStdString();

Comment thread tide/master/rest/RestController.cpp Outdated
if( obj.empty( ))
return false;

const auto windowSize = QSizeF( obj["w"].toString().toDouble(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QJsonValue can be directly converted to a double or an int, why make it a string first? Replace all occurences in this file

Comment thread tide/master/rest/RestController.cpp Outdated
if( obj.empty( ))
return false;

const auto windowPos = QPointF( obj["x"].toString().toDouble(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the windowPos declaration below the check for if( !window ), there is no need to evaluate it if there is no window (also in the previous function).

@ppodhajski ppodhajski force-pushed the master branch 11 times, most recently from 744ca2d to 7efe185 Compare January 24, 2017 12:58
Comment thread tide/master/resources/styles.css Outdated
}

button:active {
position:relative;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a visual effect when you click on a button

return closeButton;
}

function createFocusButton(tile) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to reorder in the same way as createCloseButton; if possible extract a common createButton() part, because they look very similar

Comment thread tide/master/resources/tide.js Outdated
curtain.css("width", wallWidth).css("height", wallHeight);
curtain.addClass("curtain");
if (type === "fs") {
curtain.css("z-index", 51);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use constants for the z_index

Comment thread tide/master/resources/tide.js Outdated
var scaleV = (viewportWidth - minimalHorizontalMargin ) / wallWidth;
var scaleH = (viewportHeight - minimalVerticalMargin ) / wallHeight;

zoomScale = (scaleV < scaleH) ? scaleV : scaleH;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this first value is never used

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless we have a vertical wall

Comment thread tide/master/resources/tide.js Outdated
var wallMargin = (window.innerWidth - (wallWidth * zoomScale)) / 2;

$("#wall").css({transform: 'scale(' + zoomScale + ')'}).css("margin-left", wallMargin).css
("margin-right", wallMargin).css("margin-top", 25).css("margin-bottom", minimalVerticalMargin);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split in multiple lines for readability

Comment thread tide/master/rest/RestController.h Outdated
bool _handleExitFullScreen();
bool _handleFocusWindows();
bool _handleMoveWindow( const std::string& string );
bool _handleMoveWindowToFront( const QString id );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm const in header

Comment thread tide/master/rest/RestController.h Outdated
bool _handleDeselectWindows();
bool _handleExitFullScreen();
bool _handleFocusWindows();
bool _handleMoveWindow( const std::string& string );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename all "string" variables to "json" or something similar

Comment thread tide/master/rest/RestController.h Outdated
bool _handleMoveWindowToFront( const QString id );
bool _handleMoveWindowToFullscreen( QString id );
bool _handleResizeWindow( const std::string& string );
bool _handleUnfocusWindow( const QString& string );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here rename string -> id

Comment thread tide/master/rest/RestWindows.cpp Outdated
QJsonArray arr;
for( const auto& contentWindow : windows )
{
if (contentWindow.get()->getContent().get()->getURI() == "Launcher")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contentWindow->getContent()->getURI()

Comment thread tide/master/rest/RestWindows.h Outdated
{
public:
/**
* Construct dynamic content used by REST interface.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamic content -> a JSON list of windows ?

@ppodhajski ppodhajski force-pushed the master branch 2 times, most recently from e6ba727 to 314f6ad Compare January 25, 2017 11:50
Comment thread tide/master/rest/RestController.cpp Outdated
window.get()->setSelected( false );
window.get()->setSelected( true );
else
window.get()->setSelected( false );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just: window->setSelected( !window->isSelected( ));

Comment thread tide/master/resources/tide.js Outdated
fullscreenButton.className = "windowControl";
fullscreenButton.style.visibility = tile.mode === 2 ? "hidden" : "visible";
var icon = fullscreenIcon.cloneNode(true);
function setIcon(type) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, but should be named createIcon(type)

@rdumusc rdumusc merged commit 4875225 into BlueBrain:master Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants