]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Fri, 10 Mar 2017 15:21:30 +0000 (10:21 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Fri, 10 Mar 2017 15:21:30 +0000 (10:21 -0500)
applis/PipelineEditor/PipelineEditor.ui
libs/cpPipelineEditor/Block.cxx [new file with mode: 0644]
libs/cpPipelineEditor/Block.h [new file with mode: 0644]
libs/cpPipelineEditor/Canvas.cxx
libs/cpPipelineEditor/Canvas.h
libs/cpPipelineEditor/Editor.cxx [new file with mode: 0644]
libs/cpPipelineEditor/Editor.h [new file with mode: 0644]
libs/cpPipelineEditor/Editor.ui [new file with mode: 0644]
libs/cpPipelineEditor/Panel.cxx [new file with mode: 0644]
libs/cpPipelineEditor/Panel.h [new file with mode: 0644]

index 3709dba5134929bf99487d1802b1b99dac1bf5fb..ed03661447974a225ee90e756095c1b2dc342e19 100644 (file)
   <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>
diff --git a/libs/cpPipelineEditor/Block.cxx b/libs/cpPipelineEditor/Block.cxx
new file mode 100644 (file)
index 0000000..d750c9c
--- /dev/null
@@ -0,0 +1,43 @@
+#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$
diff --git a/libs/cpPipelineEditor/Block.h b/libs/cpPipelineEditor/Block.h
new file mode 100644 (file)
index 0000000..a5fb8d0
--- /dev/null
@@ -0,0 +1,39 @@
+#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$
index 7ee861fbed54f098b26d90d50691292533f49d0a..2a8023a53ea28ded764922e40364078498d7b545 100644 (file)
@@ -9,6 +9,10 @@ cpPipelineEditor::Canvas::
 Canvas( QWidget* parent )
   : Superclass( parent )
 {
+  this->m_Scene = new QGraphicsScene( this );
+  this->setScene( this->m_Scene );
+  this->setRenderHint( QPainter::Antialiasing );
+  this->setAcceptDrops( true );
 }
 
 // -------------------------------------------------------------------------
index ec6c5f71cd8fe2b9d03dc62e2493047d6d9bcae9..2cd7201e1b0a6eda83a7197e2e3b56060ca903d4 100644 (file)
@@ -8,12 +8,14 @@
 #include <cpPipelineEditor_Export.h>
 #include <QGraphicsView>
 
+class QGraphicsScene;
+
 namespace cpPipelineEditor
 {
   /**
    */
   class Canvas
-    : QGraphicsView
+    : public QGraphicsView
   {
     Q_OBJECT;
 
@@ -24,6 +26,9 @@ namespace cpPipelineEditor
   public:
     Canvas( QWidget* parent = NULL );
     virtual ~Canvas( );
+
+  protected:
+    QGraphicsScene* m_Scene;
   };
 
 } // ecapseman
diff --git a/libs/cpPipelineEditor/Editor.cxx b/libs/cpPipelineEditor/Editor.cxx
new file mode 100644 (file)
index 0000000..e613246
--- /dev/null
@@ -0,0 +1,24 @@
+// -------------------------------------------------------------------------
+// @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$
diff --git a/libs/cpPipelineEditor/Editor.h b/libs/cpPipelineEditor/Editor.h
new file mode 100644 (file)
index 0000000..c2fd718
--- /dev/null
@@ -0,0 +1,38 @@
+// -------------------------------------------------------------------------
+// @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$
diff --git a/libs/cpPipelineEditor/Editor.ui b/libs/cpPipelineEditor/Editor.ui
new file mode 100644 (file)
index 0000000..c4ae96b
--- /dev/null
@@ -0,0 +1,50 @@
+<?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>
diff --git a/libs/cpPipelineEditor/Panel.cxx b/libs/cpPipelineEditor/Panel.cxx
new file mode 100644 (file)
index 0000000..e86f061
--- /dev/null
@@ -0,0 +1,69 @@
+// -------------------------------------------------------------------------
+// @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$
diff --git a/libs/cpPipelineEditor/Panel.h b/libs/cpPipelineEditor/Panel.h
new file mode 100644 (file)
index 0000000..f69187c
--- /dev/null
@@ -0,0 +1,37 @@
+// -------------------------------------------------------------------------
+// @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$