Commit f3e2beef authored by WINTZ Julien's avatar WINTZ Julien

Sketching up.

parent 9746f094
......@@ -73,6 +73,7 @@ find_package(VTK REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5Xml REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
......
......@@ -41,7 +41,7 @@ protected:
dtkVisualizationViewerSidePaneItem::dtkVisualizationViewerSidePaneItem(fa::icon icon, QWidget *parent) : QLabel(parent)
{
this->setAlignment(Qt::AlignHCenter);
this->setPixmap(dtkVisualizationFontAwesome::instance()->icon(icon).pixmap(25, 25));
this->setPixmap(dtkVisualizationFontAwesome::instance()->icon(icon).pixmap(50, 25));
}
dtkVisualizationViewerSidePaneItem::~dtkVisualizationViewerSidePaneItem(void)
......@@ -78,13 +78,13 @@ public:
dtkVisualizationViewerSidePane::dtkVisualizationViewerSidePane(QWidget *parent) : QFrame(parent)
{
dtkVisualizationFontAwesome::instance()->initFontAwesome();
dtkVisualizationFontAwesome::instance()->setDefaultOption("color", QColor("#e8e8e8"));
dtkVisualizationFontAwesome::instance()->setDefaultOption("color", QColor("#c8c8c8"));
d = new dtkVisualizationViewerSidePanePrivate;
dtkVisualizationViewerSidePaneItem *item_1 = new dtkVisualizationViewerSidePaneItem(fa::thlarge, this);
dtkVisualizationViewerSidePaneItem *item_2 = new dtkVisualizationViewerSidePaneItem(fa::cog, this);
dtkVisualizationViewerSidePaneItem *item_3 = new dtkVisualizationViewerSidePaneItem(fa::toggleleft, this);
dtkVisualizationViewerSidePaneItem *item_3 = new dtkVisualizationViewerSidePaneItem(fa::toggleon, this);
connect(item_1, &dtkVisualizationViewerSidePaneItem::clicked, [=] () {
emit currentIndex(0);
......
......@@ -14,6 +14,10 @@
#include "dtkVisualizationView.h"
#include <dtkVisualizationWidgets/dtkVisualizationHUD>
#include <dtkVisualizationWidgets/dtkVisualizationHUDItem>
#include <dtkVisualizationWidgets/dtkVisualizationOverlay>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
......@@ -41,9 +45,14 @@ public:
protected:
void mousePressEvent(QMouseEvent *event);
void resizeEvent(QResizeEvent *event);
public:
dtkVisualizationView *q;
public:
dtkVisualizationHUD *hud;
dtkVisualizationOverlay *overlay;
};
dtkVisualizationViewPrivate::dtkVisualizationViewPrivate(QWidget *parent) : QVTKOpenGLWidget(parent)
......@@ -60,6 +69,9 @@ dtkVisualizationViewPrivate::dtkVisualizationViewPrivate(QWidget *parent) : QVTK
this->setEnableHiDPI(true);
this->setObjectName(QString("View %1").arg(count++));
this->hud = new dtkVisualizationHUD(this);
this->overlay = new dtkVisualizationOverlay(this);
}
dtkVisualizationViewPrivate::~dtkVisualizationViewPrivate(void)
......@@ -79,6 +91,15 @@ void dtkVisualizationViewPrivate::mousePressEvent(QMouseEvent *event)
QVTKOpenGLWidget::mousePressEvent(event);
}
void dtkVisualizationViewPrivate::resizeEvent(QResizeEvent *event)
{
QVTKOpenGLWidget::resizeEvent(event);
this->hud->resize(event->size());
this->overlay->setFixedHeight(event->size().height());
}
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationView
// ///////////////////////////////////////////////////////////////////
......@@ -91,6 +112,9 @@ dtkVisualizationView::dtkVisualizationView(QWidget *parent) : dtkVisualizationWi
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(d);
connect(d->hud->addItem(fa::sliders), SIGNAL(clicked()), d->overlay, SLOT(toggle()));
connect(d->hud->addItem(fa::compass), SIGNAL(clicked()), this, SLOT(switchView()));
}
dtkVisualizationView::~dtkVisualizationView(void)
......@@ -108,6 +132,11 @@ void dtkVisualizationView::update(void)
d->GetInteractor()->Render();
}
void dtkVisualizationView::switchView(void)
{
qDebug() << Q_FUNC_INFO;
}
// ///////////////////////////////////////////////////////////////////
#include "dtkVisualizationView.moc"
......
......@@ -34,6 +34,9 @@ public:
public slots:
void update(void);
public slots:
void switchView(void);
private:
class dtkVisualizationViewPrivate *d;
};
......
......@@ -19,6 +19,8 @@ project(dtkVisualizationWidgets)
## #################################################################
set(${PROJECT_NAME}_HEADERS
dtkVisualizationClutEditor
dtkVisualizationClutEditor.h
dtkVisualizationController
dtkVisualizationController.h
dtkVisualizationLayout
......@@ -39,6 +41,7 @@ set(${PROJECT_NAME}_HEADERS
dtkVisualizationWidget.h)
set(${PROJECT_NAME}_SOURCES
dtkVisualizationClutEditor.cpp
dtkVisualizationController.cpp
dtkVisualizationLayout.cpp
dtkVisualizationLayoutItem.cpp
......@@ -59,6 +62,7 @@ add_library(${PROJECT_NAME} SHARED
qt5_use_modules(${PROJECT_NAME} Core)
qt5_use_modules(${PROJECT_NAME} Widgets)
qt5_use_modules(${PROJECT_NAME} Xml)
target_link_libraries(${PROJECT_NAME} dtkVisualizationFonts)
......
#include "dtkVisualizationClutEditor.h"
\ No newline at end of file
This diff is collapsed.
// Version: $Id: 80be09c7cc19c2fc912fa461752bfbc2a211d0d6 $
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include <QtCore>
#include <QtGui>
#include <QtWidgets>
// /////////////////////////////////////////////////////////////////
// dtkVisualizationClutEditorVertex
// /////////////////////////////////////////////////////////////////
class dtkVisualizationClutEditorVertex : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
dtkVisualizationClutEditorVertex(int x, int y, QColor color = Qt::yellow, QGraphicsItem *parent = 0);
dtkVisualizationClutEditorVertex(QPointF point, QColor color = Qt::yellow, QGraphicsItem *parent = 0);
~dtkVisualizationClutEditorVertex(void);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
QRectF boundingRect(void) const;
QPoint position(void) const;
QColor color(void) const;
void setColor(const QColor& color);
signals:
void moved(const QPointF& position);
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
private:
QColor fgColor;
QColor bgColor;
};
// /////////////////////////////////////////////////////////////////
// dtkVisualizationClutEditorScene
// /////////////////////////////////////////////////////////////////
class dtkVisualizationClutEditorScenePrivate;
class dtkVisualizationClutEditorScene : public QGraphicsScene
{
Q_OBJECT
public:
dtkVisualizationClutEditorScene(QObject *parent = 0);
~dtkVisualizationClutEditorScene(void);
void addItem(QGraphicsItem *item);
signals:
void moved(const QPointF& position);
void removed(void);
protected:
void keyPressEvent(QKeyEvent *event);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
private:
dtkVisualizationClutEditorScenePrivate *d;
};
// /////////////////////////////////////////////////////////////////
// dtkVisualizationClutEditorView
// /////////////////////////////////////////////////////////////////
class dtkVisualizationClutEditorViewPrivate;
class dtkVisualizationClutEditorView : public QGraphicsView
{
public:
dtkVisualizationClutEditorView(QWidget *parent = 0);
~dtkVisualizationClutEditorView(void);
private:
dtkVisualizationClutEditorViewPrivate *d;
};
// /////////////////////////////////////////////////////////////////
// dtkVisualizationClutEditor
// /////////////////////////////////////////////////////////////////
class dtkVisualizationClutEditor : public QWidget
{
Q_OBJECT
public:
enum ColorSpace {
HSV,
RGB
};
public:
typedef QList<int> Histogram;
public:
dtkVisualizationClutEditor(QWidget *parent = 0);
~dtkVisualizationClutEditor(void);
void *colorTransferFunction(void);
void *opacityTransferFunction(void);
void setRange(double min, double max);
void setHistogram(const Histogram& histogram);
signals:
void updated(void);
public slots:
void importClut(void);
void exportClut(void);
void toggle(bool);
public:
QSize sizeHint(void) const;
protected slots:
void onApply(void);
void onColorAuto(void);
void onColorChoose(void);
void onSelectionChanged(void);
void onVertexMoved(const QPointF& point);
protected:
void resizeEvent(QResizeEvent *event);
private:
class dtkVisualizationClutEditorPrivate *d;
};
//
// dtkVisualizationClutEditor.h ends here
#include "dtkVisualizationHUD"
\ No newline at end of file
#include "dtkVisualizationHUD.h"
\ No newline at end of file
#include "dtkVisualizationViewHUDItem.h"
\ No newline at end of file
#include "dtkVisualizationHUDItem.h"
\ No newline at end of file
......@@ -31,7 +31,14 @@ dtkVisualizationHUDItem::dtkVisualizationHUDItem(fa::icon icon, QWidget *parent)
dtkVisualizationFontAwesome::instance()->setDefaultOption("color", QColor(200, 200, 200));
d->label = new QLabel(this);
d->label->setPixmap(dtkVisualizationFontAwesome::instance()->icon(icon).pixmap(25, 25));
d->label->setPixmap(dtkVisualizationFontAwesome::instance()->icon(icon).pixmap(16, 16));
QHBoxLayout *layout = new QHBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
layout->addWidget(d->label);
this->setLayout(layout);
}
dtkVisualizationHUDItem::~dtkVisualizationHUDItem(void)
......@@ -49,5 +56,15 @@ void dtkVisualizationHUDItem::mousePressEvent(QMouseEvent *event)
emit clicked();
}
void dtkVisualizationHUDItem::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setPen(QColor("#242525"));
painter.setBrush(QColor("#242525"));
painter.drawRoundedRect(event->rect(), event->rect().size().width()/2, event->rect().size().height()/2);
QFrame::paintEvent(event);
}
//
// dtkVisualizationHUDItem.cpp ends here
......@@ -35,6 +35,7 @@ public:
protected:
void mousePressEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *event);
private:
class dtkVisualizationHUDItemPrivate *d;
......
......@@ -95,8 +95,8 @@ void dtkVisualizationOverlay::paintEvent(QPaintEvent *event)
rect.setWidth(d->width);
QPainter painter(this);
painter.fillRect(rect, QColor(238, 238, 238, 192));
painter.setPen(QColor(245, 245, 245, 192));
painter.fillRect(rect, QColor("#cc242525"));
painter.setPen(QColor("#242525"));
painter.drawLine(rect.topRight(), rect.bottomRight());
QWidget::paintEvent(event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment