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 .gitsubprojects
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- mode: cmake -*-
git_subproject(ZeroEQ https://github.com/HBPVIS/ZeroEQ.git 6a2d44e)
git_subproject(Deflect https://github.com/BlueBrain/Deflect.git de281e9)
git_subproject(TUIO https://github.com/BlueBrain/TUIO.git 514aa1a)
git_subproject(TUIO https://github.com/BlueBrain/TUIO.git 52afa43)
git_subproject(VirtualKeyboard https://github.com/BlueBrain/QtFreeVirtualKeyboard.git d026536)
2 changes: 1 addition & 1 deletion apps/Launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main(int argc, char** argv)
{
launcher.reset(new Launcher(argc, argv));
}
catch (const std::runtime_error& exception)
catch (const std::exception& exception)
{
print_log(LOG_ERROR, LOG_GENERAL, "failed to start: %s",
exception.what());
Expand Down
2 changes: 1 addition & 1 deletion apps/TideMaster/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int main(int argc, char* argv[])
app.reset(new MasterApplication(argc, argv, config, mainChannel,
localChannel));
}
catch (const std::runtime_error& e)
catch (const std::exception& e)
{
print_log(LOG_FATAL, LOG_GENERAL,
"Could not initialize application. %s", e.what());
Expand Down
2 changes: 1 addition & 1 deletion apps/TideWall/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int main(int argc, char* argv[])
app.reset(new WallApplication(argc, argv, config, mainChannel,
localChannel));
}
catch (const std::runtime_error& e)
catch (const std::exception& e)
{
print_log(LOG_FATAL, LOG_GENERAL,
"Could not initialize application. %s", e.what());
Expand Down
26 changes: 26 additions & 0 deletions apps/Webbrowser/Webbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ const std::string deflectHost("localhost");
const QString deflectQmlFile("qrc:/qml/qml/Webengine.qml");
const QString webengineviewItemName("webengineview");
const QString searchUrl("https://www.google.com/search?q=%1");

int _getLogLevel(const int jsLevel)
{
switch (jsLevel)
{
case 0:
return LOG_INFO;
case 1:
return LOG_WARN;
case 2:
return LOG_ERROR;
default:
throw std::invalid_argument("unknown log level");
}
}
}

Webbrowser::Webbrowser(int& argc, char* argv[])
Expand Down Expand Up @@ -90,6 +105,9 @@ Webbrowser::Webbrowser(int& argc, char* argv[])

connect(_webengine, SIGNAL(urlChanged()), this, SLOT(_sendData()));
connect(_webengine, SIGNAL(titleChanged()), this, SLOT(_sendData()));

connect(_webengine, SIGNAL(jsMessage(int, QString, int, QString)), this,
SLOT(_logJsMessage(int, QString, int, QString)));
}

Webbrowser::~Webbrowser()
Expand Down Expand Up @@ -158,3 +176,11 @@ void Webbrowser::_sendData()
if (!_qmlStreamer->sendData(data))
QGuiApplication::quit();
}

void Webbrowser::_logJsMessage(const int level, const QString message,
const int lineNumber, const QString sourceID)
{
const auto line = QString::number(lineNumber);
const auto msg = QString("%1 @ l.%2 in %3").arg(message, line, sourceID);
put_log(_getLogLevel(level), LOG_JS, msg.toLocal8Bit().constData());
}
2 changes: 2 additions & 0 deletions apps/Webbrowser/Webbrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Webbrowser : public QGuiApplication
private slots:
void _processAddressBarInput(QString url);
void _sendData();
void _logJsMessage(int level, QString message, int lineNumber,
QString sourceID);

private:
std::unique_ptr<deflect::qt::QmlStreamer> _qmlStreamer;
Expand Down
5 changes: 2 additions & 3 deletions apps/Webbrowser/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ int main(int argc, char** argv)
{
webbrowser.reset(new Webbrowser(argc, argv));
}
catch (const std::runtime_error& exception)
catch (const std::exception& e)
{
print_log(LOG_ERROR, LOG_GENERAL, "failed to start: %s",
exception.what());
print_log(LOG_ERROR, LOG_GENERAL, "failed to start: %s", e.what());
return EXIT_FAILURE;
}
return webbrowser->exec();
Expand Down
4 changes: 4 additions & 0 deletions apps/Webbrowser/qml/Webengine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ Item {
settings.localContentCanAccessRemoteUrls: true
settings.pluginsEnabled: true

// Pass javascript messages by signal to Tide's custom C++ log handler
signal jsMessage(int level, string message, int line, string source)
onJavaScriptConsoleMessage: jsMessage(level, message, lineNumber, sourceID)

Connections {
target: deflectgestures
onSwipeLeft: webengine.goBack()
Expand Down
5 changes: 2 additions & 3 deletions apps/Whiteboard/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ int main(int argc, char** argv)
{
whiteboard.reset(new Whiteboard(argc, argv));
}
catch (const std::runtime_error& exception)
catch (const std::exception& e)
{
print_log(LOG_FATAL, LOG_GENERAL, "failed to start: %s",
exception.what());
print_log(LOG_FATAL, LOG_GENERAL, "failed to start: %s", e.what());
return EXIT_FAILURE;
}
return whiteboard->exec();
Expand Down
23 changes: 13 additions & 10 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ Changelog {#changelog}

# Release 1.4 (git master)

* [203](https://github.com/BlueBrain/Tide/pull/203):
Webbrowser: added option to enable remote debugging (from MasterWindow UI).
* [202](https://github.com/BlueBrain/Tide/pull/202):
Fixed incorrect count of open windows reported at tide/stats HTTP endpoint.
* [201](https://github.com/BlueBrain/Tide/pull/201):
The interface unlocks when the screens are turned off.
* [200](https://github.com/BlueBrain/Tide/pull/200):
Xml configuration simplification:
- replaced screenWidth/Height with displayWidht/Height, which refers
to physical screen size.
- introducing displaysPerScreenX/Y used to determine the total screen size.
- removing bezelsPerScreenX/Y, which became redundant.
- renaming keys:
- numTilesWidth -> numScreensX, numTilesHeight -> numScreensY.
- mullionWidth -> bezelWidth, mullionHeight -> bezelHeight.
Fix in web interface related to bezel and configuration.
- Replaced screenWidth/Height with displayWidth/Height, which refers
to the resolution of an invidual physical display.
- Introduced displaysPerScreenX/Y, used to determine the resolution of a
logical screen (n * displaySize + (n-1) * bezelSize).
- Renamed some keys:
- numTilesWidth/Height -> numScreensX/Y.
- mullionWidth/Height -> bezelWidth/Height.
- Removed bezelsPerScreenX/Y which became redundant.
Fixes in web interface related to bezel and configuration.
* [195](https://github.com/BlueBrain/Tide/pull/195):
New features in html interface:
- Dragged window can be snapped to a bezel.
Expand All @@ -34,8 +37,8 @@ Changelog {#changelog}
* [169](https://github.com/BlueBrain/Tide/issues/169):
Performance improvement for PixelStreams with small tile size (64x64).
* [167](https://github.com/BlueBrain/Tide/pull/167):
Tide can be locked now. It prevents unwanted streams from opening and
freezes HTML interface.
Tide can be locked to prevent unwanted streams from opening or actions from
the HTML interface, e.g. during a presentation.
* [162](https://github.com/BlueBrain/Tide/issues/162):
Movies and pixel streams can be rendered at 60 fps (up from 30 fps).
* [161](https://github.com/BlueBrain/Tide/issues/161):
Expand Down
4 changes: 2 additions & 2 deletions tide/core/CountdownStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class CountdownStatus : public QObject
Q_OBJECT
Q_DISABLE_COPY(CountdownStatus)

Q_PROPERTY(bool active READ isActive)
Q_PROPERTY(uint duration READ getDuration)
Q_PROPERTY(bool active READ isActive CONSTANT)
Q_PROPERTY(uint duration READ getDuration CONSTANT)

public:
/** Default constructor for use on wall processes. */
Expand Down
14 changes: 14 additions & 0 deletions tide/core/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ extern "C" {
}
#endif

#ifdef NDEBUG
#define LOG_THRESHOLD LOG_INFO
#else
#define LOG_THRESHOLD LOG_DEBUG
#endif

namespace
{
const size_t MAX_LOG_LENGTH = 1024;
Expand All @@ -75,6 +81,9 @@ std::string logger_id = "";
void put_log(const int level, const std::string& facility, const char* format,
...)
{
if (level < LOG_THRESHOLD)
return;

char log_string[MAX_LOG_LENGTH];
va_list ap;
va_start(ap, format);
Expand Down Expand Up @@ -195,3 +204,8 @@ void tiffMessageLoggerErr(const char* module, const char* fmt, va_list ap)
vsnprintf(log_string, MAX_LOG_LENGTH, fmt, ap);
put_log(LOG_ERROR, LOG_TIFF, "%s: '%s'", module, log_string);
}

void tuioMessageLogger(const int level, const std::string& message)
{
put_log(level, LOG_TUIO, message.c_str());
}
22 changes: 10 additions & 12 deletions tide/core/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,18 @@
#define LOG_ERROR 4
#define LOG_FATAL 5

#define LOG_POWER "POWER"
#define LOG_AV "AV"
#define LOG_CONTENT "CONTENT"
#define LOG_GENERAL "GENERAL"
#define LOG_JS "JS"
#define LOG_MPI "MPI"
#define LOG_PDF "PDF"
#define LOG_POWER "POWER"
#define LOG_QT "QT"
#define LOG_REST "REST"
#define LOG_STREAM "STREAM"
#define LOG_QT "QT"
#define LOG_AV "AV"
#define LOG_TIFF "TIFF"
#define LOG_MPI "MPI"
#define LOG_CONTENT "CONTENT"
#define LOG_GENERAL "GENERAL"

#ifdef NDEBUG
#define LOG_THRESHOLD LOG_INFO
#else
#define LOG_THRESHOLD LOG_DEBUG
#endif
#define LOG_TUIO "TUIO"

extern std::string logger_id;
extern void put_log(const int level, const std::string& facility,
Expand All @@ -82,6 +78,8 @@ extern void tiffMessageLoggerWarn(const char* module, const char* fmt,
extern void tiffMessageLoggerErr(const char* module, const char* fmt,
va_list ap);

extern void tuioMessageLogger(int level, const std::string& message);

#ifdef _WIN32
#define print_log(l, facility, fmt, ...) \
put_log(l, facility, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__)
Expand Down
2 changes: 1 addition & 1 deletion tide/master/MasterApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ void MasterApplication::_initRestInterface()
#if TIDE_USE_QT5WEBKITWIDGETS || TIDE_USE_QT5WEBENGINE
if (uri.isEmpty())
uri = _config->getWebBrowserDefaultURL();
_pixelStreamerLauncher->openWebBrowser(QPointF(), QSize(), uri);
_pixelStreamerLauncher->openWebBrowser(QPointF(), QSize(), uri, 0);
#else
print_log(LOG_INFO, LOG_GENERAL,
"Can't browse url '%s', Tide was compiled without"
Expand Down
10 changes: 10 additions & 0 deletions tide/master/MultitouchListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,18 @@

#include "MultitouchListener.h"

#include "log.h"

#include <TUIO/TuioLog.h>

#include <stdexcept>

struct TuioLogInit
{
TuioLogInit() { TUIO::setLogHandler(tuioMessageLogger); }
};
static TuioLogInit instance;

MultitouchListener::MultitouchListener()
: TUIO::TuioListener()
{
Expand Down
59 changes: 40 additions & 19 deletions tide/master/localstreamer/PixelStreamerLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ QString _getWebbrowserCommand(const QString& args)
return QString("%1/%2 %3").arg(appDir, app, args);
}

QString _getWebbrowserCommand(const WebbrowserContent& webbrowser)
{
CommandLineOptions options;
options.setStreamId(webbrowser.getURI());
options.setUrl(webbrowser.getUrl());
options.setWidth(webbrowser.width());
options.setHeight(webbrowser.height());
#ifdef TIDE_USE_QT5WEBKITWIDGETS
options.setPixelStreamerType(PS_WEBKIT);
#endif
return _getWebbrowserCommand(options.getCommandLine());
}

QStringList _getWebbrowserEnv(const ushort debugPort)
{
// The env variable must always be present otherwise it is not reset.
auto env = QString{"QTWEBENGINE_REMOTE_DEBUGGING="};
if (debugPort)
env.append(QString::number((uint)debugPort));
return QStringList{env};
}

QString _getWhiteboardCommand(const QString& args)
{
const auto appDir = QCoreApplication::applicationDirPath();
Expand All @@ -104,7 +126,8 @@ PixelStreamerLauncher::PixelStreamerLauncher(PixelStreamWindowManager& manager,
}

void PixelStreamerLauncher::openWebBrowser(QPointF pos, QSize size,
const QString url)
const QString url,
const ushort debugPort)
{
if (pos.isNull())
pos = _getDefaultWindowPosition();
Expand All @@ -117,23 +140,15 @@ void PixelStreamerLauncher::openWebBrowser(QPointF pos, QSize size,
auto content = _windowManager.getWindow(uri)->getContent();
auto& webbrowser = dynamic_cast<WebbrowserContent&>(*content);
webbrowser.setUrl(url);
launch(webbrowser);
launch(webbrowser, debugPort);
}

void PixelStreamerLauncher::launch(const WebbrowserContent& webbrowser)
void PixelStreamerLauncher::launch(const WebbrowserContent& webbrowser,
const ushort debugPort)
{
CommandLineOptions options;
options.setStreamId(webbrowser.getURI());
options.setUrl(webbrowser.getUrl());
options.setWidth(webbrowser.width());
options.setHeight(webbrowser.height());
#ifdef TIDE_USE_QT5WEBKITWIDGETS
options.setPixelStreamerType(PS_WEBKIT);
#endif
const auto command = _getWebbrowserCommand(options.getCommandLine());

_processes.insert(webbrowser.getURI());
emit start(command, QDir::currentPath(), {});
const auto cmd = _getWebbrowserCommand(webbrowser);
const auto env = _getWebbrowserEnv(debugPort);
_startProcess(webbrowser.getURI(), cmd, env);
}

void PixelStreamerLauncher::openLauncher()
Expand Down Expand Up @@ -165,8 +180,7 @@ void PixelStreamerLauncher::openLauncher()
if (!_config.getLauncherDisplay().isEmpty())
env.append(QString("DISPLAY=%1").arg(_config.getLauncherDisplay()));

_processes.insert(uri);
emit start(command, QDir::currentPath(), env);
_startProcess(uri, command, env);
}

void PixelStreamerLauncher::openWhiteboard()
Expand All @@ -183,8 +197,7 @@ void PixelStreamerLauncher::openWhiteboard()
options.setConfiguration(_config.getFilename());
const auto command = _getWhiteboardCommand(options.getCommandLine());

_processes.insert(uri);
emit start(command, QDir::currentPath(), {});
_startProcess(uri, command, {});
}

void PixelStreamerLauncher::_dereferenceLocalStreamer(const QString uri)
Expand All @@ -196,3 +209,11 @@ QPointF PixelStreamerLauncher::_getDefaultWindowPosition() const
{
return {0.5 * _config.getTotalWidth(), 0.35 * _config.getTotalHeight()};
}

void PixelStreamerLauncher::_startProcess(const QString& uri,
const QString& command,
const QStringList& env)
{
_processes.insert(uri);
emit start(command, QDir::currentPath(), env);
}
Loading