<property name="windowTitle">
<string>MainWindow</string>
</property>
- <widget class="QWidget" name="centralwidget"/>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="cpPipelineEditor::Editor" name="Editor" native="true"/>
+ </item>
+ </layout>
+ </widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
- <height>25</height>
+ <height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
</property>
</action>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>cpPipelineEditor::Editor</class>
+ <extends>QWidget</extends>
+ <header location="global">cpPipelineEditor/Editor.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections>
<connection>
--- /dev/null
+#include <cpPipelineEditor/Block.h>
+#include <QPainter>
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::Block::
+Block( QGraphicsItem* parent, QGraphicsScene* scene )
+ : Superclass( parent, scene )
+{
+ this->m_SelectedColor = Qt::darkYellow;
+ this->m_NotSelectedColor = Qt::darkGreen;
+}
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::Block::
+~Block( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::Block::
+paint(
+ QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget
+ )
+{
+ Q_UNUSED( option );
+ Q_UNUSED( widget );
+
+ if( this->isSelected( ) )
+ {
+ painter->setPen( QPen( this->m_SelectedColor ) );
+ painter->setBrush( this->m_SelectedColor );
+ }
+ else
+ {
+ painter->setPen( QPen( this->m_NotSelectedColor ) );
+ painter->setBrush( this->m_NotSelectedColor );
+
+ } // fi
+ painter->drawPath( this->path( ) );
+
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __cpPipelineEditor__Block__h__
+#define __cpPipelineEditor__Block__h__
+
+#include <cpPipelineEditor_Export.h>
+#include <QGraphicsPathItem>
+
+namespace cpPipelineEditor
+{
+ /**
+ */
+ class cpPipelineEditor_EXPORT Block
+ : public QGraphicsPathItem
+ {
+ public:
+ typedef Block Self;
+ typedef QGraphicsPathItem Superclass;
+
+ public:
+ Block(
+ QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL
+ );
+ virtual ~Block( );
+
+ virtual void paint(
+ QPainter* painter,
+ const QStyleOptionGraphicsItem* option,
+ QWidget* widget
+ ) override;
+
+ private:
+ QColor m_SelectedColor;
+ QColor m_NotSelectedColor;
+ };
+
+} // ecapseman
+
+#endif // __cpPipelineEditor__Block__h__
+
+// eof - $RCSfile$
Canvas( QWidget* parent )
: Superclass( parent )
{
+ this->m_Scene = new QGraphicsScene( this );
+ this->setScene( this->m_Scene );
+ this->setRenderHint( QPainter::Antialiasing );
+ this->setAcceptDrops( true );
}
// -------------------------------------------------------------------------
#include <cpPipelineEditor_Export.h>
#include <QGraphicsView>
+class QGraphicsScene;
+
namespace cpPipelineEditor
{
/**
*/
class Canvas
- : QGraphicsView
+ : public QGraphicsView
{
Q_OBJECT;
public:
Canvas( QWidget* parent = NULL );
virtual ~Canvas( );
+
+ protected:
+ QGraphicsScene* m_Scene;
};
} // ecapseman
--- /dev/null
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#include <cpPipelineEditor/Editor.h>
+#include <cpPipelineEditor/ui_Editor.h>
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::Editor::
+Editor( QWidget* parent )
+ : Superclass( parent ),
+ m_UI( new Ui::Editor )
+{
+ this->m_UI->setupUi( this );
+}
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::Editor::
+~Editor( )
+{
+ delete this->m_UI;
+}
+
+// eof - $RCSfile$
--- /dev/null
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __cpPipelineEditor__Editor__h__
+#define __cpPipelineEditor__Editor__h__
+
+#include <cpPipelineEditor_Export.h>
+#include <QWidget>
+
+namespace Ui { class Editor; }
+
+namespace cpPipelineEditor
+{
+ /**
+ */
+ class Editor
+ : public QWidget
+ {
+ Q_OBJECT;
+
+ public:
+ typedef Editor Self;
+ typedef QWidget Superclass;
+
+ public:
+ Editor( QWidget* parent = NULL );
+ virtual ~Editor( );
+
+ private:
+ Ui::Editor* m_UI;
+ };
+
+} // ecapseman
+
+#endif // __cpPipelineEditor__Editor__h__
+
+// eof - $RCSfile$
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Editor</class>
+ <widget class="QWidget" name="Editor">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="cpPipelineEditor::Panel" name="Panel" native="true"/>
+ <widget class="cpPipelineEditor::Canvas" name="Canvas" native="true"/>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>cpPipelineEditor::Canvas</class>
+ <extends>QWidget</extends>
+ <header location="global">cpPipelineEditor/Canvas.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>cpPipelineEditor::Panel</class>
+ <extends>QWidget</extends>
+ <header location="global">cpPipelineEditor/Panel.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#include <cpPipelineEditor/Panel.h>
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::Panel::
+Panel( QWidget* parent )
+ : Superclass( parent )
+{
+ this->setDragEnabled( true );
+ this->setDragDropMode( QAbstractItemView::DragOnly );
+ this->setAlternatingRowColors( true );
+
+ this->_update( );
+}
+
+// -------------------------------------------------------------------------
+cpPipelineEditor::Panel::
+~Panel( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::Panel::
+_clear( )
+{
+ this->clear( );
+ this->setColumnCount( 1 );
+ QString header_txt = "Loaded plugins";
+ if( QTreeWidgetItem* header = this->headerItem( ) )
+ header->setText( 0, header_txt );
+ else
+ this->setHeaderLabel( header_txt );
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::Panel::
+_update( )
+{
+ this->_clear( );
+
+ QTreeWidgetItem* n = NULL;
+ QTreeWidgetItem* filters = new QTreeWidgetItem( n, QStringList( "Filters" ) );
+ QTreeWidgetItem* functors = new QTreeWidgetItem( n, QStringList( "Functors" ) );
+ QTreeWidgetItem* widgets = new QTreeWidgetItem( n, QStringList( "Widgets" ) );
+
+ this->addTopLevelItem( filters );
+ this->addTopLevelItem( functors );
+ this->addTopLevelItem( widgets );
+
+ // Add filters
+ QTreeWidgetItem* test_filter =
+ new QTreeWidgetItem( filters, QStringList( "myFilter" ) );
+
+ // Add functors
+ QTreeWidgetItem* test_functor =
+ new QTreeWidgetItem( functors, QStringList( "myFunctor" ) );
+
+ // Add widgets
+ QTreeWidgetItem* test_widget =
+ new QTreeWidgetItem( widgets, QStringList( "myWidget" ) );
+
+ // Finish
+ this->expandAll( );
+}
+
+// eof - $RCSfile$
--- /dev/null
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __cpPipelineEditor__Panel__h__
+#define __cpPipelineEditor__Panel__h__
+
+#include <cpPipelineEditor_Export.h>
+#include <QTreeWidget>
+
+namespace cpPipelineEditor
+{
+ /**
+ */
+ class Panel
+ : public QTreeWidget
+ {
+ Q_OBJECT;
+
+ public:
+ typedef Panel Self;
+ typedef QTreeWidget Superclass;
+
+ public:
+ Panel( QWidget* parent = NULL );
+ virtual ~Panel( );
+
+ protected:
+ void _clear( );
+ void _update( );
+ };
+
+} // ecapseman
+
+#endif // __cpPipelineEditor__Panel__h__
+
+// eof - $RCSfile$