]> Creatis software - cpPlugins.git/blobdiff - appli/PipelineEditor/main.cxx
...
[cpPlugins.git] / appli / PipelineEditor / main.cxx
index 2013a69e742fc50e73f700bbf75df83a2c22081e..a6754204f0fdd61e484e51220eab8ad99547288c 100644 (file)
@@ -1,81 +1,7 @@
-#include "PipelineEditor.h"
-#include <cstdlib>
-#include <QApplication>
+#include <cpBaseQtApplication/MainHelper.h>
+#include <appli/PipelineEditor/PipelineEditorMainWindow.h>
 
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  QApplication a( argc, argv );
-  PipelineEditor w( argc, argv, NULL );
-  w.show( );
-
-  return( a.exec( ) );
-}
-
-// -------------------------------------------------------------------------
-#ifdef _WIN32
-
-#include <memory>
-#include <vector>
-#include <windows.h>
-#include <shellapi.h>
-
-/**
- */
-class Win32CommandLineConverter
-{
-private:
-  std::unique_ptr< char*[ ] > argv_;
-  std::vector< std::unique_ptr< char[ ] > > storage_;
-
-public:
-  Win32CommandLineConverter( )
-    {
-      LPWSTR cmd_line = GetCommandLineW( );
-      int argc;
-      LPWSTR* w_argv = CommandLineToArgvW( cmd_line, &argc );
-      argv_ = std::unique_ptr< char*[ ] >( new char*[ argc ] );
-      storage_.reserve( argc );
-      for( int i = 0; i < argc; ++i )
-      {
-        storage_.push_back( ConvertWArg( w_argv[ i ] ) );
-        argv_[ i ] = storage_.back( ).get( );
-
-      } // rof
-      LocalFree( w_argv );
-    }
-  int argc( ) const
-    {
-      return( static_cast< int >(storage_.size( ) ) );
-    }
-  char** argv( ) const
-    {
-      return( argv_.get( ) );
-    }
-  static std::unique_ptr< char[ ] > ConvertWArg( LPWSTR w_arg )
-    {
-      int size = WideCharToMultiByte(
-        CP_UTF8, 0, w_arg, -1, nullptr, 0, nullptr, nullptr
-        );
-      std::unique_ptr< char[ ] > ret( new char[ size ] );
-      WideCharToMultiByte(
-        CP_UTF8, 0, w_arg, -1, ret.get( ), size, nullptr, nullptr
-        );
-      return( ret );
-    }
-};
-
-int CALLBACK WinMain(
-  HINSTANCE hInstance,
-  HINSTANCE hPrevInstance,
-  LPSTR lpCmdLine,
-  int nCmdShow
-  )
-{
-  Win32CommandLineConverter cmd_line;
-  return( main( cmd_line.argc( ), cmd_line.argv( ) ) );
-}
-
-#endif
+cpBaseQtApplication_Main( PipelineEditorMainWindow );
+cpBaseQtApplication_MainComplement;
 
 // eof - $RCSfile$