-#include "PipelineEditor.h"
-#include "ui_PipelineEditor.h"
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
-#include <cpPipelineEditor/Editor.h>
-#include <QMessageBox>
+#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( )
{
- // 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->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->setupUi( this );
}
// -------------------------------------------------------------------------
PipelineEditor::
~PipelineEditor( )
{
- delete this->m_UI;
}
// -------------------------------------------------------------------------
-void PipelineEditor::
-_ShowFilterOutput(
- const std::string& filter_name, const std::string& output_name
- )
-{
- typedef cpPlugins::DataObject _TDataObject;
-
- // Update filter, if needed
- this->_ExecFilter( filter_name );
+#include <QApplication>
+#include <QCommandLineOption>
+#include <QCommandLineParser>
- // Get output
- auto filter = this->m_Workspace.GetFilter( filter_name );
- if( filter != NULL )
- {
- auto output = filter->GetOutputData( output_name );
- if( output != NULL )
- {
- std::string data_name = output_name + "@" + filter_name;
- auto idata = output->GetVTK< vtkImageData >( );
- auto mdata = output->GetVTK< vtkPolyData >( );
- if( idata != NULL )
- {
- if( this->m_UI->Viewer->AddData( idata, data_name, "" ) )
- {
- if( this->m_UI->Viewer->GetNumberOfData( ) > 1 )
- this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 );
- else
- this->m_UI->Viewer->SetMainImage( data_name );
- this->_Block( );
- this->m_UI->Viewer->ShowData( data_name );
- this->_UnBlock( );
-
- } // fi
- }
- else if( mdata != NULL )
- {
- if( this->m_UI->Viewer->AddData( mdata, data_name ) )
- {
- this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 );
- this->_Block( );
- this->m_UI->Viewer->ShowData( data_name );
- this->_UnBlock( );
-
- } // fi
- }
- else
- QMessageBox::critical(
- this,
- QMessageBox::tr( "Error showing data" ),
- QMessageBox::tr( "No known VTK conversion!" )
- );
-
- } // fi
-
- } // fi
+int main( int argc, char* argv[] )
+{
+ // 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$