-#include "PipelineEditor.h"
-#include "ui_PipelineEditor.h"
-
-#include <cstdlib>
-
-#include <QFileInfo>
-#include <QMessageBox>
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
-#include <cpPlugins/Image.h>
-#include <cpPipelineEditor/Editor.h>
-
-#include <vtkImageData.h>
-#include <vtkPolyData.h>
-#include <vtkRenderWindowInteractor.h>
+#include "PipelineEditor.h"
+#include <QStandardPaths>
// -------------------------------------------------------------------------
PipelineEditor::
-PipelineEditor( int argc, char* argv[], QApplication* app, QWidget* parent )
- : Superclass( argc, argv, app, parent ),
- m_UI( new Ui::PipelineEditor )
+PipelineEditor( QWidget* parent )
+ : QMainWindow( parent ),
+ Ui::PipelineEditor( )
{
- // Load environment configuration
- char* p = std::getenv( cpPlugins_PATHS );
- std::string sp = "";
- if( p != NULL )
- sp = std::string( p ) + std::string( cpPlugins_SEPARATOR );
- QFileInfo info( argv[ 0 ] );
- if( info.exists( ) )
- sp += info.canonicalPath( ).toStdString( );
- setenv( cpPlugins_PATHS, sp.c_str( ), 0 );
-
- // Basic configuration
- this->m_UI->setupUi( this );
- this->_Configure(
- this->m_UI->LoadedPlugins,
- this->m_UI->Viewer,
- this->m_UI->Canvas->editor( )
- );
-
- // Connect actions to slots
- this->connect(
- this->m_UI->ActionBackgroundMPR, SIGNAL( triggered( ) ),
- this, SLOT( _ActionBackgroundMPR( ) )
- );
- this->connect(
- this->m_UI->ActionBackground3D, SIGNAL( triggered( ) ),
- this, SLOT( _ActionBackground3D( ) )
- );
- this->connect(
- this->m_UI->ButtonLoadPluginsFile, SIGNAL( clicked( ) ),
- this, SLOT( _InteractiveLoadPlugins( ) )
- );
- this->connect(
- this->m_UI->ButtonLoadPluginsPath, SIGNAL( clicked( ) ),
- this, SLOT( _InteractiveLoadPluginsFromPath( ) )
- );
- this->connect(
- this->m_UI->ActionOpenWorkspace, SIGNAL( triggered( ) ),
- this, SLOT( _InteractiveLoadWorkspace( ) )
- );
- this->connect(
- this->m_UI->ActionSaveWorkspace, SIGNAL( triggered( ) ),
- this, SLOT( _InteractiveSaveWorkspace( ) )
- );
- this->connect(
- this->m_UI->Canvas->editor( ),
- SIGNAL( execFilter( const std::string& ) ),
- this,
- SLOT( _ExecFilter( const std::string& ) )
- );
- this->connect(
- this->m_UI->Canvas->editor( ),
- SIGNAL( showFilterOutput( const std::string&, const std::string& ) ),
- this,
- SLOT( _ShowFilterOutput( const std::string&, const std::string& ) )
- );
- this->connect(
- this->m_UI->Canvas->editor( ),
- SIGNAL( hideFilterOutput( const std::string&, const std::string& ) ),
- this,
- SLOT( _HideFilterOutput( const std::string&, const std::string& ) )
- );
- this->connect(
- this->m_UI->Canvas->editor( ),
- SIGNAL( visualPropertiesFilterOutput( const std::string&, const std::string& ) ),
- this,
- SLOT( _PropertiesFilterOutput( const std::string&, const std::string& ) )
- );
+ this->setupUi( this );
}
// -------------------------------------------------------------------------
PipelineEditor::
~PipelineEditor( )
{
- delete this->m_UI;
-}
-
-// -------------------------------------------------------------------------
-void PipelineEditor::
-_ActionBackgroundMPR( )
-{
- this->_BackgroundProperties( 4 );
}
// -------------------------------------------------------------------------
-void PipelineEditor::
-_ActionBackground3D( )
-{
- this->_BackgroundProperties( 3 );
-}
-
-// -------------------------------------------------------------------------
-void PipelineEditor::
-_ShowFilterOutput(
- const std::string& filter_name, const std::string& output_name
- )
-{
- this->_ExecFilter( filter_name );
- this->_ShowData( filter_name, output_name );
-}
+#include <QApplication>
+#include <QCommandLineOption>
+#include <QCommandLineParser>
-// -------------------------------------------------------------------------
-void PipelineEditor::
-_HideFilterOutput(
- const std::string& filter_name, const std::string& output_name
- )
-{
- this->_HideData( filter_name, output_name );
-}
-
-// -------------------------------------------------------------------------
-void PipelineEditor::
-_PropertiesFilterOutput(
- const std::string& filter_name, const std::string& output_name
- )
+int main( int argc, char* argv[] )
{
- this->_DataProperties( filter_name, output_name );
+ // TODO: Q_INIT_RESOURCE(application);
+
+ QApplication app( argc, argv );
+ QCoreApplication::setOrganizationName( "Creatis-PUJ" );
+ QCoreApplication::setApplicationName( "cpPlugins_PipelineEditor" );
+ QCoreApplication::setApplicationVersion( "1.0.0" );
+
+ QCommandLineParser parser;
+ parser.setApplicationDescription( QCoreApplication::applicationName( ) );
+ parser.addHelpOption( );
+ parser.addVersionOption( );
+ parser.addPositionalArgument( "file", "The file to open." );
+ parser.process( app );
+
+ PipelineEditor win;
+ /* TODO
+ if( !parser.positionalArguments( ).isEmpty( ) )
+ win.loadFile( parser.positionalArguments( ).first( ) );
+ */
+ win.show( );
+ return( app.exec( ) );
}
// eof - $RCSfile$