Commit 01c95d35 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

dtkCreator & dtkComposer compilation fixes

parent 3c6de953
......@@ -12,6 +12,7 @@
##
### Code:
add_subdirectory(dtkCreator)
add_subdirectory(dtkDistributedServer)
add_subdirectory(dtkDistributedSlave)
add_subdirectory(dtkDistributedDashboard)
......
......@@ -27,9 +27,6 @@ set(${PROJECT_NAME}_HEADERS_MOC
dtkCreatorMainWindow.h
dtkCreatorMainWindow_p.h)
set(${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_HEADERS_MOC})
set(${PROJECT_NAME}_SOURCES
dtkCreatorMainWindow.cpp
main.cpp)
......@@ -51,30 +48,38 @@ if(NOT MSVC)
add_definitions(-Wno-write-strings)
endif(NOT MSVC)
qt4_wrap_cpp(${PROJECT_NAME}_SOURCES_MOC ${${PROJECT_NAME}_HEADERS_MOC})
qt4_add_RESOURCES(${PROJECT_NAME}_SOURCES_QRC ${${PROJECT_NAME}_RESOURCES})
qt5_add_RESOURCES(${PROJECT_NAME}_SOURCES_QRC ${${PROJECT_NAME}_RESOURCES})
add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32
${${PROJECT_NAME}_SOURCES_WRAP}
${${PROJECT_NAME}_SOURCES_MOC}
${${PROJECT_NAME}_SOURCES_QRC}
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
target_link_libraries(${PROJECT_NAME}
${QT_LIBRARIES}
dtkLog
dtkCore
dtkComposer
dtkDistributed
dtkNotification)
dtkDistributedSupport
dtkGuiSupport
dtkWidgets)
if(DTK_BUILD_SUPPORT_PLOT)
target_link_libraries(${PROJECT_NAME} dtkPlotSupport)
endif(DTK_BUILD_SUPPORT_PLOT)
if(APPLE)
target_link_libraries(${PROJECT_NAME}
"-framework Cocoa")
endif(APPLE)
qt5_use_modules(${PROJECT_NAME} Core)
qt5_use_modules(${PROJECT_NAME} Gui)
qt5_use_modules(${PROJECT_NAME} Widgets)
## #################################################################
## Source file layout in development environments like Visual Studio
## #################################################################
......
......@@ -20,13 +20,14 @@
#include "dtkCreatorMainWindow.h"
#include "dtkCreatorMainWindow_p.h"
#include <dtkDistributed/dtkDistributor.h>
#include <dtkDistributedSupport/dtkDistributor.h>
#include <dtkComposer/dtkComposer.h>
#include <dtkComposer/dtkComposerWidget.h>
#include <dtkComposer/dtkComposerCompass.h>
#include <dtkComposer/dtkComposerControls.h>
#include <dtkComposer/dtkComposerEvaluator.h>
#include <dtkComposer/dtkComposerFactoryView.h>
#include <dtkComposer/dtkComposerNodeFactoryView.h>
#include <dtkComposer/dtkComposerGraph.h>
#include <dtkComposer/dtkComposerGraphView.h>
#include <dtkComposer/dtkComposerScene.h>
......@@ -37,25 +38,25 @@
#include <dtkComposer/dtkComposerStackView.h>
#include <dtkComposer/dtkComposerView.h>
#include <dtkGui/dtkScreenMenu.h>
#include <dtkGui/dtkRecentFilesMenu.h>
#include <dtkGui/dtkSpacer.h>
#include <dtkGui/dtkSplitter.h>
#include <dtkGui/dtkViewManager.h>
#include <dtkGuiSupport/dtkScreenMenu.h>
#include <dtkGuiSupport/dtkRecentFilesMenu.h>
#include <dtkGuiSupport/dtkSpacer.h>
#include <dtkGuiSupport/dtkSplitter.h>
#include <dtkGuiSupport/dtkViewManager.h>
#include <dtkCore/dtkGlobal.h>
#include <dtkCore/dtkPluginManager.h>
#include <dtkCore/dtkCore.h>
#include <dtkCore/dtkCorePluginManager.h>
#if defined(DTK_BUILD_PLOT) && defined(DTK_HAVE_PLOT)
#include <dtkPlot/dtkPlotView.h>
#include <dtkPlot/dtkPlotViewSettings.h>
#if defined(DTK_BUILD_SUPPORT_PLOT)
#include <dtkPlotSupport/dtkPlotView.h>
#include <dtkPlotSupport/dtkPlotViewSettings.h>
#endif
#include <dtkLog/dtkLog.h>
#include <dtkLog/dtkLogView.h>
// #include <dtkLog/dtkLogView.h>
#include <dtkNotification/dtkNotification.h>
#include <dtkNotification/dtkNotificationDisplay.h>
#include <dtkGuiSupport/dtkNotification.h>
#include <dtkGuiSupport/dtkNotificationDisplay.h>
#include <QtCore>
#include <QtGui>
......@@ -127,7 +128,7 @@ dtkCreatorMainWindow::dtkCreatorMainWindow(QWidget *parent) : QMainWindow(parent
//
d->composer = new dtkComposer;
d->composer = new dtkComposerWidget;
d->composer->view()->setBackgroundBrush(QBrush(QPixmap(":dtkCreator/pixmaps/dtkComposerScene-bg.png")));
d->composer->view()->setCacheMode(QGraphicsView::CacheBackground);
......@@ -148,7 +149,7 @@ dtkCreatorMainWindow::dtkCreatorMainWindow(QWidget *parent) : QMainWindow(parent
d->stack = new dtkComposerStackView(this);
d->stack->setStack(d->composer->stack());
d->nodes = new dtkComposerFactoryView(this);
d->nodes = new dtkComposerNodeFactoryView(this);
d->nodes->setFactory(d->composer->factory());
d->graph = new dtkComposerGraphView(this);
......@@ -157,11 +158,11 @@ dtkCreatorMainWindow::dtkCreatorMainWindow(QWidget *parent) : QMainWindow(parent
d->graph->setVisible(false);
d->graph->setBackgroundBrush(QBrush(QPixmap(":dtkCreator/pixmaps/dtkComposerGraphView-bg.png")));
d->log_view = new dtkLogView(this);
d->log_view->setVisible(false);
// d->log_view = new dtkLogView(this);
// d->log_view->setVisible(false);
d->view_manager = new dtkViewManager;
#if defined(DTK_BUILD_PLOT) && defined(DTK_HAVE_PLOT)
#if defined(DTK_BUILD_SUPPORT_PLOT)
d->plot_view_settings = new dtkPlotViewSettings(d->view_manager);
d->view_manager->addWidget(d->plot_view_settings);
#endif
......@@ -410,7 +411,7 @@ dtkCreatorMainWindow::dtkCreatorMainWindow(QWidget *parent) : QMainWindow(parent
QHBoxLayout *b_layout = new QHBoxLayout;
b_layout->setContentsMargins(0, 0, 0, 0);
b_layout->setSpacing(0);
b_layout->addWidget(d->log_view);
// b_layout->addWidget(d->log_view);
QWidget *bottom = new QWidget(this);
bottom->setLayout(b_layout);
......@@ -430,7 +431,8 @@ dtkCreatorMainWindow::dtkCreatorMainWindow(QWidget *parent) : QMainWindow(parent
d->setCurrentFile("");
dtkNotify(QString("Discovered %1 plugins").arg(dtkPluginManager::instance()->plugins().count()), 5000);
//FIXME
// dtkNotify(QString("Discovered %1 plugins").arg(dtkPluginManager::instance()->plugins().count()), 5000);
}
dtkCreatorMainWindow::~dtkCreatorMainWindow(void)
......@@ -635,7 +637,7 @@ void dtkCreatorMainWindow::switchToCompo(void)
d->view_manager->setVisible(false);
d->graph->setVisible(false);
d->log_view->setVisible(false);
// d->log_view->setVisible(false);
d->inner->setSizes(QList<int>() << d->wl << 0 << this->size().width() - d->wl - d->wr << d->wr);
}
......@@ -663,7 +665,7 @@ void dtkCreatorMainWindow::switchToDstrb(void)
d->view_manager->setVisible(false);
d->graph->setVisible(false);
d->log_view->setVisible(false);
// d->log_view->setVisible(false);
d->inner->setSizes(QList<int>() << d->wl << 0 << this->size().width() - d->wl - d->wr << d->wr);
}
......@@ -691,7 +693,7 @@ void dtkCreatorMainWindow::switchToDebug(void)
d->view_manager->setVisible(false);
d->graph->setVisible(true);
d->log_view->setVisible(true);
// d->log_view->setVisible(true);
int w = this->size().width() - d->wl - d->wr;
......@@ -721,7 +723,7 @@ void dtkCreatorMainWindow::switchToView(void)
d->view_manager->setVisible(true);
d->graph->setVisible(false);
d->log_view->setVisible(false);
// d->log_view->setVisible(false);
}
void dtkCreatorMainWindow::showControls(void)
......
......@@ -22,7 +22,7 @@
#include <dtkComposer/dtkComposerWriter.h>
#include <QtGui>
#include <QtWidgets>
class dtkAbstractView;
class dtkCreatorMainWindowPrivate;
......
......@@ -17,15 +17,14 @@
*
*/
#ifndef DTKCREATORMAINWINDOW_P_H
#define DTKCREATORMAINWINDOW_P_H
#pragma once
#include <QtCore>
#include <QtGui>
#include <QtWidgets>
class dtkComposer;
class dtkComposerWidget;
class dtkComposerControls;
class dtkComposerFactoryView;
class dtkComposerNodeFactoryView;
class dtkComposerGraphView;
class dtkComposerSceneModel;
class dtkComposerSceneNodeEditor;
......@@ -38,7 +37,7 @@ class dtkRecentFilesMenu;
class dtkSplitter;
class dtkLogView;
/* class dtkLogView; */
class dtkViewManager;
class dtkPlotViewSettings;
......@@ -64,9 +63,9 @@ public slots:
void setModified(bool modified);
public:
dtkComposer *composer;
dtkComposerWidget *composer;
dtkComposerControls *controls;
dtkComposerFactoryView *nodes;
dtkComposerNodeFactoryView *nodes;
dtkComposerGraphView *graph;
dtkComposerSceneModel *model;
dtkComposerSceneNodeEditor *editor;
......@@ -80,8 +79,8 @@ public:
dtkViewManager *view_manager;
dtkPlotViewSettings *plot_view_settings;
public:
dtkLogView *log_view;
/* public: */
/* dtkLogView *log_view; */
public:
dtkSplitter *inner;
......@@ -120,5 +119,3 @@ public:
public:
dtkCreatorMainWindow *q;
};
#endif
......@@ -19,7 +19,7 @@
#include <dtkLog/dtkLog.h>
#include <dtkCore/dtkPluginManager.h>
#include <dtkCore/dtkCorePluginManager.h>
#include "dtkCreatorMainWindow.h"
......@@ -48,7 +48,7 @@ int main(int argc, char **argv)
dtkLogger::instance().attachFile(dtkLogPath(&application));
dtkPluginManager::instance()->initialize();
// dtkCorePluginManager::instance()->initialize();
dtkCreatorMainWindow mainwindow;
mainwindow.show();
......@@ -56,7 +56,7 @@ int main(int argc, char **argv)
int status = application.exec();
dtkPluginManager::instance()->uninitialize();
// dtkCorePluginManager::instance()->uninitialize();
return status;
}
......@@ -26,10 +26,12 @@ set(dtk_INCLUDE_DIRS
"@CMAKE_CURRENT_SOURCE_DIR@/src"
"@CMAKE_CURRENT_SOURCE_DIR@/src/dtk"
"@CMAKE_CURRENT_SOURCE_DIR@/src/dtkLog"
"@CMAKE_CURRENT_SOURCE_DIR@/src/dtkComposer"
"@CMAKE_CURRENT_SOURCE_DIR@/src/dtkCore"
"@CMAKE_CURRENT_SOURCE_DIR@/src/dtkDistributed"
"@CMAKE_CURRENT_SOURCE_DIR@/src/dtkMath"
"@CMAKE_CURRENT_SOURCE_DIR@/src/dtkTest"
"@CMAKE_CURRENT_SOURCE_DIR@/src/dtkWidgets"
"@CMAKE_CURRENT_BINARY_DIR@")
include("@CMAKE_BINARY_DIR@/dtkDepends.cmake")
......
......@@ -64,6 +64,7 @@ set(${PROJECT_NAME}_HEADERS
dtkComposerNodeNumberOperator.h
dtkComposerNodeProxy.h
dtkComposerNodeReal.h
dtkComposerNodeRemote.h
dtkComposerNodeString.h
dtkComposerNodeStringOperator.h
dtkComposerPath.h
......@@ -100,6 +101,7 @@ set(${PROJECT_NAME}_HEADERS
dtkComposerTransmitterReceiver.tpp
dtkComposerView.h
dtkComposerReader.h
dtkComposerWidget.h
dtkComposerWriter.h)
set(${PROJECT_NAME}_SOURCES
......@@ -145,6 +147,7 @@ set(${PROJECT_NAME}_SOURCES
dtkComposerNodeNumberOperator.cpp
dtkComposerNodeProxy.cpp
dtkComposerNodeReal.cpp
dtkComposerNodeRemote.cpp
dtkComposerNodeString.cpp
dtkComposerNodeStringOperator.cpp
dtkComposerPath.cpp
......@@ -172,6 +175,7 @@ set(${PROJECT_NAME}_SOURCES
dtkComposerTransmitterProxyLoop.cpp
dtkComposerView.cpp
dtkComposerReader.cpp
dtkComposerWidget.cpp
dtkComposerWriter.cpp)
set(${PROJECT_NAME}_QRC dtkComposer.qrc)
......
/* dtkComposer.cpp ---
*
*
* Author: Thibaud Kloczko
* Created: Tue Apr 9 12:49:06 2013 (+0200)
* Version:
* Last-Updated: Wed Apr 10 15:09:19 2013 (+0200)
* By: Thibaud Kloczko
* Update #: 37
*/
/* Change Log:
*
*
*/
#include "dtkComposer.h"
......@@ -17,14 +13,14 @@
namespace dtkComposer
{
namespace node
namespace node
{
namespace _private {
dtkComposerNodeFactory factory;
}
namespace _private {
dtkComposerNodeFactory factory;
}
dtkComposerNodeFactory& factory(void) {
return _private::factory;
}
dtkComposerNodeFactory& factory(void) {
return _private::factory;
}
}
}
......@@ -19,6 +19,6 @@ class dtkComposerNodeFactory;
namespace dtkComposer
{
namespace node {
dtkComposerNodeFactory& factory(void);
dtkComposerNodeFactory& factory(void);
}
}
......@@ -19,13 +19,16 @@
#pragma once
#include "dtkComposerExport.h"
#include <QtGui>
#include <QtWidgets>
class dtkComposerControlsPrivate;
class dtkComposerScene;
class dtkComposerControls : public QFrame
class DTKCOMPOSER_EXPORT dtkComposerControls : public QFrame
{
Q_OBJECT
......
/* dtkComposerGraphView.h ---
*
/* dtkComposerGraphView.h ---
*
* Author: Julien Wintz
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Thu Feb 9 14:42:13 2012 (+0100)
* Version: $Id$
* Last-Updated: Thu Apr 11 10:28:43 2013 (+0200)
* By: Thibaud Kloczko
* Update #: 23
*/
/* Commentary:
*
/* Commentary:
*
*/
/* Change log:
*
*
*/
#pragma once
#include <QtGui>
#include "dtkComposerExport.h"
#include <QtWidgets>
class dtkComposerGraphViewPrivate;
class dtkComposerGraphView : public QGraphicsView
class DTKCOMPOSER_EXPORT dtkComposerGraphView : public QGraphicsView
{
Q_OBJECT
......
......@@ -14,14 +14,15 @@
#pragma once
#include "dtkComposerExport.h"
#include <QtCore>
#include <QtGui>
#include <QtWidgets>
class dtkComposerNodeFactory;
class dtkComposerNodeFactoryViewPrivate;
class dtkComposerNodeFactoryView : public QWidget
class DTKCOMPOSER_EXPORT dtkComposerNodeFactoryView : public QWidget
{
Q_OBJECT
......
......@@ -15,19 +15,15 @@
#include "dtkComposerNodeRemote.h"
#include "dtkComposerTransmitterEmitter.h"
#include "dtkComposerTransmitterReceiver.h"
#include "dtkComposerTransmitterVariant.h"
// #include "dtkComposerTransmitterVariant.h"
#include <dtkDistributed/dtkDistributedController.h>
#include <dtkDistributed/dtkDistributedCommunicator.h>
#include <dtkDistributed/dtkDistributedCommunicatorTcp.h>
#include <dtkDistributed/dtkDistributedSlave.h>
#include <dtkDistributedSupport/dtkDistributedController.h>
#include <dtkDistributedSupport/dtkDistributedCommunicator.h>
#include <dtkDistributedSupport/dtkDistributedCommunicatorTcp.h>
#include <dtkDistributedSupport/dtkDistributedSlave.h>
#include <dtkCore/dtkAbstractDataFactory.h>
#include <dtkCore/dtkGlobal.h>
#include <dtkJson>
#include <dtkMath/dtkMath.h>
// #include <dtkCore/dtkAbstractDataFactory.h>
// #include <dtkCore/dtkCore.h>
#include <dtkLog/dtkLog.h>
......@@ -212,25 +208,27 @@ void dtkComposerNodeRemote::begin(void)
// then send transmitters data
QList<dtkComposerTransmitter*> receivers = this->dtkComposerNodeComposite::receivers();
int max = receivers.count();
dtkComposerTransmitterVariant *t = NULL;
for (int i = 2; i < max; ++i) {
t = reinterpret_cast<dtkComposerTransmitterVariant*>(receivers.at(i));
QByteArray array = t->dataToByteArray();
dtkDebug() << "sending transmitter" << i << "of size" << array.size();
msg = new dtkDistributedMessage(dtkDistributedMessage::DATA, d->jobid, 0, array.size(), "qvariant", array);
d->server->socket()->sendRequest(msg);
delete msg;
}
//FIXME dtkComposerTransmitterVariant
// dtkComposerTransmitterVariant *t = NULL;
// for (int i = 2; i < max; ++i) {
// t = reinterpret_cast<dtkComposerTransmitterVariant*>(receivers.at(i));
// QByteArray array = t->dataToByteArray();
// dtkDebug() << "sending transmitter" << i << "of size" << array.size();
// msg = new dtkDistributedMessage(dtkDistributedMessage::DATA, d->jobid, 0, array.size(), "qvariant", array);
// d->server->socket()->sendRequest(msg);
// delete msg;
// }
d->server->socket()->waitForBytesWritten();
} else if (d->communicator) {
// running on the slave, receive data and set transmitters
QList<dtkComposerTransmitter*> receivers = this->dtkComposerNodeComposite::receivers();
int max = receivers.count();
int size = d->communicator->size();
dtkComposerTransmitterVariant *t = NULL;
// dtkComposerTransmitterVariant *t = NULL;
for (int i = 2; i < max; ++i) {
t = reinterpret_cast<dtkComposerTransmitterVariant*>(receivers.at(i));
// t = reinterpret_cast<dtkComposerTransmitterVariant*>(receivers.at(i));
if (d->communicator->rank() == 0) {
d->communicator_emitter.setData(d->slave->communicator());
......@@ -246,10 +244,10 @@ void dtkComposerNodeRemote::begin(void)
dtkDebug() << "Ok, data received, parse" ;
}
dtkDistributedMessage *msg = d->slave->communicator()->socket()->parseRequest();
t->setTwinned(false);
t->clearData();
t->setDataFrom(msg->content());
t->setTwinned(true);
// t->setTwinned(false);
// t->clearData();
// t->setDataFrom(msg->content());
// t->setTwinned(true);
dtkDebug() << "send data to slaves";
for (int j=1; j< size; j++)
......@@ -261,10 +259,10 @@ void dtkComposerNodeRemote::begin(void)
dtkDebug() << "receive data from rank 0";
d->communicator->receive(array, 0, 0);
dtkDebug() << "data received, set";
t->setTwinned(false);
t->clearData();
t->setDataFrom(array);
t->setTwinned(true);
// t->setTwinned(false);
// t->clearData();
// t->setDataFrom(array);
// t->setTwinned(true);
}
}
} else {
......@@ -278,9 +276,9 @@ void dtkComposerNodeRemote::end(void)
dtkDebug() << "running node remote end statement on controller";
QList<dtkComposerTransmitter*> emitters = this->dtkComposerNodeComposite::emitters();
int max = this->emitters().count();
dtkComposerTransmitterVariant *t = NULL;
// dtkComposerTransmitterVariant *t = NULL;
for (int i = 1; i < max; ++i) {
t = reinterpret_cast<dtkComposerTransmitterVariant*>(emitters.at(i));
// t = reinterpret_cast<dtkComposerTransmitterVariant*>(emitters.at(i));
if (d->server->socket()->bytesAvailable()) {
dtkDebug() << "data already available, parse" ;
......@@ -292,10 +290,10 @@ void dtkComposerNodeRemote::end(void)
dtkDebug() << "Ok, data received, parse" ;
}
dtkDistributedMessage *msg = d->server->socket()->parseRequest();
t->setTwinned(false);
t->clearData();
t->setDataFrom(msg->content());
t->setTwinned(true);
// t->setTwinned(false);
// t->clearData();
// t->setDataFrom(msg->content());
// t->setTwinned(true);
delete msg;
}
......@@ -306,20 +304,20 @@ void dtkComposerNodeRemote::end(void)
int max = this->emitters().count();
int size = d->communicator->size();
Q_UNUSED(size);
dtkComposerTransmitterVariant *t = NULL;
// dtkComposerTransmitterVariant *t = NULL;
for (int i = 1; i < max; ++i) {
t = reinterpret_cast<dtkComposerTransmitterVariant*>(emitters.at(i));
// t = reinterpret_cast<dtkComposerTransmitterVariant*>(emitters.at(i));
// FIXME: use our own transmitter variant list (see control nodes)
if (d->communicator->rank() == 0) {
dtkDebug() << "end, send transmitter data (we are rank 0)";
QByteArray array = t->dataToByteArray();
if (!array.isEmpty()) {
dtkDistributedMessage *req = new dtkDistributedMessage(dtkDistributedMessage::DATA, d->jobid, dtkDistributedMessage::CONTROLLER_RUN_RANK, array.size(), "qvariant", array);
d->slave->communicator()->socket()->sendRequest(req);
delete req;
} else {
dtkError() << "serialization failed in transmitter";
}
// QByteArray array = t->dataToByteArray();
// if (!array.isEmpty()) {
// dtkDistributedMessage *req = new dtkDistributedMessage(dtkDistributedMessage::DATA, d->jobid, dtkDistributedMessage::CONTROLLER_RUN_RANK, array.size(), "qvariant", array);
// d->slave->communicator()->socket()->sendRequest(req);
// delete req;
// } else {
// dtkError() << "serialization failed in transmitter";
// }
} else {
//TODO rank >0
......@@ -422,7 +420,9 @@ void dtkComposerNodeRemoteSubmit::run(void)
job.insert("properties", QVariantMap());
job.insert("application", d->slaveName+" "+cluster.toString());
QByteArray job_data = dtkJson::serialize(job);