0024479: Ray Tracing mode does not work in Qt IE sample
authordbp <dbp@opencascade.com>
Wed, 22 Jan 2014 15:07:53 +0000 (19:07 +0400)
committerbugmaster <bugmaster@opencascade.com>
Wed, 22 Jan 2014 15:09:00 +0000 (19:09 +0400)
Implementation of  Ray Tracing mode in standard Qt sample
Fix compile warnings in Qt samples.
Fix tabs in Common-string.ts.
Update Code style.

0024415: Update QT samples
Code which was based on QT3 was removed. Some bugs and warnings has been also fixed.
Porting from QT4 to QT5 sample files.

23 files changed:
samples/qt/Common/res/raytracing.png [new file with mode: 0644]
samples/qt/Common/src/ApplicationCommon.cxx
samples/qt/Common/src/ApplicationCommon.h
samples/qt/Common/src/Common-icon.ts
samples/qt/Common/src/Common-string.ts
samples/qt/Common/src/DocumentCommon.cxx
samples/qt/Common/src/DocumentCommon.h
samples/qt/Common/src/MDIWindow.cxx
samples/qt/Common/src/MDIWindow.h
samples/qt/Common/src/View.cxx
samples/qt/Common/src/View.h
samples/qt/IESample/IESample-vc10.sln
samples/qt/IESample/IESample-vc9.sln
samples/qt/IESample/IESample.pro
samples/qt/IESample/env.bat
samples/qt/IESample/generation-vc-projects.bat
samples/qt/Interface/src/Application.cxx
samples/qt/Interface/src/Translate.cxx
samples/qt/Tutorial/Tutorial-vc10.sln
samples/qt/Tutorial/Tutorial.pro
samples/qt/Tutorial/env.bat
samples/qt/Tutorial/generation-vc-projects.bat
samples/qt/Tutorial/src/ApplicationTut.cxx

diff --git a/samples/qt/Common/res/raytracing.png b/samples/qt/Common/res/raytracing.png
new file mode 100644 (file)
index 0000000..211e697
Binary files /dev/null and b/samples/qt/Common/res/raytracing.png differ
index 5751c69..c30912e 100755 (executable)
@@ -7,7 +7,8 @@
 #include <QVBoxLayout>
 #include <QMenuBar>
 #include <QStatusBar>
-#include <QWorkspace>
+#include <QMdiArea>
+#include <QMdiSubWindow>
 #include <QMessageBox>
 #include <QApplication>
 #include <QSignalMapper>
@@ -17,8 +18,8 @@
 
 #include <stdlib.h>
 
-static ApplicationCommonWindow* stApp;
-static QWorkspace* stWs;
+static ApplicationCommonWindow* stApp = 0;
+static QMdiArea* stWs = 0;
 
 ApplicationCommonWindow::ApplicationCommonWindow()
     : QMainWindow( 0 ),
@@ -38,7 +39,7 @@ myStdToolBar( 0 )
   layout->setMargin( 0 );
 
   vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
-  stWs = new QWorkspace( vb );
+  stWs = new QMdiArea( vb );
   layout->addWidget( stWs );
   setCentralWidget( vb );
        
@@ -122,7 +123,7 @@ void ApplicationCommonWindow::createStandardOperations()
   QMenu* aPrefMenu = new QMenu( QObject::tr("MNU_PREFERENCES") );
   aPrefMenu->addAction( filePrefUseVBOAction );
   
-  // popuplate a menu with all actions
+  // populate a menu with all actions
   myFilePopup = new QMenu( this );
   myFilePopup = menuBar()->addMenu( QObject::tr("MNU_FILE") );
   myFilePopup->addAction( fileNewAction );
@@ -198,43 +199,9 @@ void ApplicationCommonWindow::createCasCadeOperations()
   a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_DEL") ), QObject::tr("MNU_TOOL_DEL"), this );
   a->setToolTip( QObject::tr("TBR_TOOL_DEL") );
   a->setStatusTip( QObject::tr("TBR_TOOL_DEL") );
-  connect( a, SIGNAL( activated() ) , this, SLOT( onToolAction() ) );
+  connect( a, SIGNAL( triggered() ) , this, SLOT( onToolAction() ) );
   myToolActions.insert( ToolDeleteId, a );
 
-#ifdef HAVE_OPENCL
-
-  // populate a tool bar with some actions
-  myRaytraceBar = addToolBar( tr( "Ray-trace options" ) );
-
-  a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_SHADOWS") ), QObject::tr("MNU_TOOL_SHADOWS"), this );
-  a->setToolTip( QObject::tr("TBR_TOOL_SHADOWS") );
-  a->setStatusTip( QObject::tr("TBR_TOOL_SHADOWS") );
-  a->setCheckable( true );
-  a->setChecked( true );
-  connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
-  myRaytraceActions.insert( ToolShadowsId, a );
-  myRaytraceBar->addAction( a );
-
-  a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_REFLECTIONS") ), QObject::tr("MNU_TOOL_REFLECTIONS"), this );
-  a->setToolTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
-  a->setStatusTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
-  a->setCheckable( true );
-  a->setChecked( true );
-  connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
-  myRaytraceActions.insert( ToolReflectionsId, a );
-  myRaytraceBar->addAction( a );
-
-  a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_ANTIALIASING") ), QObject::tr("MNU_TOOL_ANTIALIASING"), this );
-  a->setToolTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
-  a->setStatusTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
-  a->setCheckable( true );
-  a->setChecked( false );
-  connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
-  myRaytraceActions.insert( ToolAntialiasingId, a );
-  myRaytraceBar->addAction( a );
-
-#endif
-
   QSignalMapper* sm = new QSignalMapper( this );
   connect( sm, SIGNAL( mapped( int ) ), this, SLOT( onSetMaterial( int ) ) );
 
@@ -326,22 +293,12 @@ void ApplicationCommonWindow::windowsMenuAboutToShow()
 
   QString dir = getResourceDir() + QString( "/" );
 
-  a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D_GL" ), this );
-  a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D_GL" ) );
-  a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D_GL" ) );
+  a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D" ), this );
+  a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D" ) );
+  a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D" ) );
   connect( a, SIGNAL( triggered() ), this, SLOT( onCreateNewView() ) );
   myWindowPopup->addAction( a );
 
-#ifdef HAVE_OPENCL
-
-  a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D_RT" ), this );
-  a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D_RT" ) );
-  a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D_RT" ) );
-  connect( a, SIGNAL( activated() ), this, SLOT( onCreateNewViewRT() ) );
-  myWindowPopup->addAction( a );
-
-#endif
-
   a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_CASCADE" ) ), QObject::tr( "MNU_WINDOW_CASCADE" ), this );
   a->setToolTip( QObject::tr( "TBR_WINDOW_CASCADE" ) );
   a->setStatusTip( QObject::tr( "TBR_WINDOW_CASCADE" ) );
@@ -355,16 +312,15 @@ void ApplicationCommonWindow::windowsMenuAboutToShow()
   myWindowPopup->addAction( a );
 
   myWindowPopup->addSeparator();
-  QWidgetList windows = stWs->windowList();
-  for ( uint i = 0; i < windows.count(); ++i )
+  QList<QMdiSubWindow *> windows = stWs->subWindowList();
+  for (int i = 0; i < windows.count(); ++i)
   {
-               
-         QAction* aAction = new QAction( windows.at(i)->windowTitle(), this );
+       QAction* aAction = new QAction( windows.at(i)->windowTitle(), this );
     aAction->setCheckable( true );
     aAction->setData( i );
     myWindowPopup->addAction( aAction );
     connect( aAction, SIGNAL( toggled( bool ) ), this, SLOT( windowsMenuActivated( bool ) ) );
-    aAction->setChecked( stWs->activeWindow() == windows.at(i) );
+    aAction->setChecked( stWs->activeSubWindow() == windows.at(i) );
   }
 }
 
@@ -373,12 +329,12 @@ void ApplicationCommonWindow::windowsMenuActivated( bool checked )
   QAction* aSender = qobject_cast<QAction*>( sender() );
   if ( !aSender )
        return;
-  QWidget* w = stWs->windowList().at( aSender->data().toInt() );
+  QWidget * w = stWs->subWindowList().at( aSender->data().toInt() );
   if ( w && checked )
     w->setFocus();
 }
 
-QWorkspace * ApplicationCommonWindow::getWorkspace()
+QMdiArea * ApplicationCommonWindow::getWorkspace()
 {
   return stWs;
 }
@@ -390,7 +346,7 @@ ApplicationCommonWindow* ApplicationCommonWindow::getApplication()
 
 void ApplicationCommonWindow::updateFileActions()
 {
-  if ( stWs->windowList().isEmpty() )
+  if ( myDocuments.isEmpty() )
   {
     if ( !myIsDocuments )
     {
@@ -447,67 +403,49 @@ int& ApplicationCommonWindow::getNbDocument()
 
 DocumentCommon* ApplicationCommonWindow::onNewDoc()
 {
-    updateFileActions();
-    DocumentCommon* aDoc = createNewDocument();
-    aDoc->onCreateNewView();
-    onSelectionChanged();
-    connect( aDoc, SIGNAL( sendCloseDocument( DocumentCommon* ) ),
-             this, SLOT( onCloseDocument( DocumentCommon* ) ) );
-    connect( stWs, SIGNAL( windowActivated( QWidget* ) ),
-             this, SLOT( onWindowActivated( QWidget* ) ) );
-    connect( aDoc, SIGNAL( selectionChanged() ),
-             this, SLOT( onSelectionChanged() ) );
-    myDocuments.append( aDoc );
-    myStdActions.at( FileCloseId )->setEnabled( myDocuments.count() > 0 );
-    return aDoc;
-}
-
-DocumentCommon* ApplicationCommonWindow::onNewDocRT()
-{
-    updateFileActions();
-    DocumentCommon* aDoc = createNewDocument();
-    aDoc->onCreateNewView(true);
-    onSelectionChanged();
-    connect( aDoc, SIGNAL( sendCloseDocument( DocumentCommon* ) ),
-             this, SLOT( onCloseDocument( DocumentCommon* ) ) );
-    connect( stWs, SIGNAL( windowActivated( QWidget* ) ),
-             this, SLOT( onWindowActivated( QWidget* ) ) );
-    connect( aDoc, SIGNAL( selectionChanged() ),
-             this, SLOT( onSelectionChanged() ) );
-    myDocuments.append( aDoc );
-    myStdActions.at( FileCloseId )->setEnabled( myDocuments.count() > 0 );
-    return aDoc;
+  updateFileActions();
+  
+  DocumentCommon* aDoc = createNewDocument();
+  aDoc->onCreateNewView();
+  onSelectionChanged();
+  
+  connect (aDoc, SIGNAL (sendCloseDocument (DocumentCommon*) ),
+           this, SLOT (onCloseDocument (DocumentCommon*)));
+  connect (stWs, SIGNAL (windowActivated (QWidget*)),
+           this, SLOT (onWindowActivated (QWidget*)));
+  connect (aDoc, SIGNAL (selectionChanged()),
+           this, SLOT (onSelectionChanged()));
+  
+  myDocuments.append (aDoc);
+  myStdActions.at (FileCloseId)->setEnabled (myDocuments.count() > 0);
+  
+  return aDoc;
 }
 
 void ApplicationCommonWindow::onCloseWindow()
 {
-    MDIWindow* m = (MDIWindow*)stWs->activeWindow();
-    if ( m )
-    {
-        DocumentCommon* doc = m->getDocument();
-        onCloseDocument( doc );
-    }
+    stWs->activeSubWindow()->close();
 }
 
 void ApplicationCommonWindow::onUseVBO()
 {
-    MDIWindow* w = ( MDIWindow* ) stWs->activeWindow();
+  MDIWindow* aWindow = qobject_cast<MDIWindow*> (stWs->activeSubWindow()->widget());
     
-    if ( NULL == w )
-      return;
+  if (NULL == aWindow)
+    return;
 
-    Handle(AIS_InteractiveContext) aContextAIS = w->getDocument()->getContext();
+  Handle(AIS_InteractiveContext) aContextAIS = aWindow->getDocument()->getContext();
 
-    if (aContextAIS.IsNull())
-      return;
+  if (aContextAIS.IsNull())
+    return;
 
-    Handle(OpenGl_GraphicDriver) aDriver =
-      Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver());
+  Handle(OpenGl_GraphicDriver) aDriver =
+    Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver());
 
-    if (!aDriver.IsNull())
-    {
-      aDriver->ChangeOptions().vboDisable = Standard_True;
-    }
+  if (!aDriver.IsNull())
+  {
+    aDriver->ChangeOptions().vboDisable = Standard_True;
+  }
 }
 
 void ApplicationCommonWindow::onCloseDocument(DocumentCommon* theDoc)
@@ -549,20 +487,10 @@ void ApplicationCommonWindow::onAbout()
 
 void ApplicationCommonWindow::onCreateNewView()
 {
-  MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeWindow() );
-  window->getDocument()->onCreateNewView( false );
+  MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeSubWindow()->widget() );
+  window->getDocument()->onCreateNewView();
 }
 
-#ifdef HAVE_OPENCL
-
-void ApplicationCommonWindow::onCreateNewViewRT()
-{
-  MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeWindow() );
-  window->getDocument()->onCreateNewView( true );
-}
-
-#endif
-
 void ApplicationCommonWindow::onWindowActivated ( QWidget * w )
 {
   if (w == NULL)
@@ -573,21 +501,13 @@ void ApplicationCommonWindow::onWindowActivated ( QWidget * w )
   MDIWindow* window = qobject_cast< MDIWindow* >(w);
 
   window->onWindowActivated();
-
-#ifdef HAVE_OPENCL
-
-  myRaytraceActions.at( ToolShadowsId )->setChecked (window->ShadowsEnabled());
-  myRaytraceActions.at( ToolReflectionsId )->setChecked (window->ReflectionsEnabled());
-  myRaytraceActions.at( ToolAntialiasingId )->setChecked (window->AntialiasingEnabled());
-
-#endif
 }
 
 void ApplicationCommonWindow::onToolAction()
 {
     QAction* sentBy = (QAction*) sender();
-    QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
-    DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
+    QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
+    DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
 
     if( sentBy == myToolActions.at( ToolWireframeId ) )
         doc->onWireframe();
@@ -608,87 +528,60 @@ void ApplicationCommonWindow::onToolAction()
         doc->onDelete();
 }
 
-#ifdef HAVE_OPENCL
-
-void ApplicationCommonWindow::onRaytraceAction()
-{
-  QAction* sentBy = (QAction*) sender();
-  
-  DocumentCommon* doc = qobject_cast< MDIWindow* >(
-    ApplicationCommonWindow::getWorkspace()->activeWindow())->getDocument();
-
-  if( sentBy == myRaytraceActions.at( ToolShadowsId ) )
-  {
-    bool flag = myRaytraceActions.at( ToolShadowsId )->isChecked(); 
-    doc->onShadows( flag );
-  }
-
-  if( sentBy == myRaytraceActions.at( ToolReflectionsId ) )
-  {
-    bool flag = myRaytraceActions.at( ToolReflectionsId )->isChecked();
-    doc->onReflections( flag );
-  }
-
-  if( sentBy == myRaytraceActions.at( ToolAntialiasingId ) )
-  {
-    bool flag = myRaytraceActions.at( ToolAntialiasingId )->isChecked();
-    doc->onAntialiasing( flag );
-  }
-}
-
-#endif
-
 void ApplicationCommonWindow::onSelectionChanged()
 {
-  QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
+  QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
        DocumentCommon* doc;
 
-       if( !qobject_cast<MDIWindow*>( ws->activeWindow() ) )
+  if( !qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() ) )
          return;
-    doc = ((MDIWindow*)ws->activeWindow())->getDocument();
-    Handle(AIS_InteractiveContext) context = doc->getContext();
+  
+  doc = ( qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() ) )->getDocument();
+  Handle(AIS_InteractiveContext) context = doc->getContext();
 
-    bool OneOrMoreInShading = false;
-    bool OneOrMoreInWireframe = false;
-    int numSel = context->NbSelected();
-    if ( numSel )
-    {
-        for ( context->InitCurrent(); context->MoreCurrent(); context->NextCurrent() )
-        {
-            if ( context->IsDisplayed( context->Current(), 1 ) )
-                OneOrMoreInShading = true;
-            if ( context->IsDisplayed( context->Current(), 0 ) )
-                OneOrMoreInWireframe = true;
-        }
-        myToolActions.at( ToolWireframeId )->setEnabled( OneOrMoreInShading );
-        myToolActions.at( ToolShadingId )->setEnabled( OneOrMoreInWireframe );
-        myToolActions.at( ToolColorId )->setEnabled( true );
-        myToolActions.at( ToolMaterialId )->setEnabled( true );
-        myToolActions.at( ToolTransparencyId )->setEnabled( OneOrMoreInShading );
-        myToolActions.at( ToolDeleteId )->setEnabled( true );
-    }
-    else
+  bool OneOrMoreInShading = false;
+  bool OneOrMoreInWireframe = false;
+  int numSel = context->NbSelected();
+  if ( numSel )
+  {
+    for ( context->InitCurrent(); context->MoreCurrent(); context->NextCurrent() )
     {
-        myToolActions.at( ToolWireframeId )->setEnabled( false );
-        myToolActions.at( ToolShadingId )->setEnabled( false );
-        myToolActions.at( ToolColorId )->setEnabled( false );
-        myToolActions.at( ToolMaterialId )->setEnabled( false );
-        myToolActions.at( ToolTransparencyId )->setEnabled( false );
-        myToolActions.at( ToolDeleteId )->setEnabled( false );
+      if ( context->IsDisplayed( context->Current(), 1 ) )
+        OneOrMoreInShading = true;
+      if ( context->IsDisplayed( context->Current(), 0 ) )
+        OneOrMoreInWireframe = true;
     }
+    myToolActions.at( ToolWireframeId )->setEnabled( OneOrMoreInShading );
+    myToolActions.at( ToolShadingId )->setEnabled( OneOrMoreInWireframe );
+    myToolActions.at( ToolColorId )->setEnabled( true );
+    myToolActions.at( ToolMaterialId )->setEnabled( true );
+    myToolActions.at( ToolTransparencyId )->setEnabled( OneOrMoreInShading );
+    myToolActions.at( ToolDeleteId )->setEnabled( true );
+  }
+  else
+  {
+    myToolActions.at( ToolWireframeId )->setEnabled( false );
+    myToolActions.at( ToolShadingId )->setEnabled( false );
+    myToolActions.at( ToolColorId )->setEnabled( false );
+    myToolActions.at( ToolMaterialId )->setEnabled( false );
+    myToolActions.at( ToolTransparencyId )->setEnabled( false );
+    myToolActions.at( ToolDeleteId )->setEnabled( false );
+  }
 }
 
 void ApplicationCommonWindow::onSetMaterial( int theMaterial )
 {
-    QWorkspace* ws = getWorkspace();
-    DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
+    QMdiArea* ws = getWorkspace();
+    DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
     doc->onMaterial( theMaterial );
 }
 
 QString ApplicationCommonWindow::getResourceDir()
 {
-    static QString resDir( ::getenv( "CSF_ResourcesDefaults" ) );    
-    return resDir;
+  static QString aResourceDir =
+    QString::fromUtf8 (qgetenv ("CSF_ResourcesDefaults").constData());
+  
+  return aResourceDir;
 }
 
 void ApplicationCommonWindow::resizeEvent( QResizeEvent* e )
index 787f458..cdc8802 100755 (executable)
@@ -7,7 +7,7 @@
 #include <QAction>
 #include <QToolBar>
 #include <QMenu>
-#include <QWorkspace>
+#include <QMdiArea>
 #include <QList>
 
 
@@ -18,12 +18,11 @@ class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
 public:
        enum { FileNewId, FilePrefUseVBOId, FileCloseId, FilePreferencesId, FileQuitId, ViewToolId, ViewStatusId, HelpAboutId };
   enum { ToolWireframeId, ToolShadingId, ToolColorId, ToolMaterialId, ToolTransparencyId, ToolDeleteId };
-  enum { ToolShadowsId, ToolReflectionsId, ToolAntialiasingId };
 
   ApplicationCommonWindow();
   ~ApplicationCommonWindow();
 
-       static QWorkspace*              getWorkspace();
+       static QMdiArea*              getWorkspace();
        static ApplicationCommonWindow* getApplication();
        static QString                  getResourceDir();
 
@@ -38,7 +37,6 @@ protected:
 public slots:
        
   DocumentCommon*                 onNewDoc();
-  DocumentCommon*                 onNewDocRT();
   void                            onCloseWindow();
   void                            onUseVBO();
        virtual void                    onCloseDocument( DocumentCommon* theDoc );
@@ -47,13 +45,7 @@ public slots:
   void                            onViewToolBar();
        void                            onViewStatusBar();
   void                            onToolAction();
-#ifdef HAVE_OPENCL
-  void                            onRaytraceAction();
-#endif
        void                            onCreateNewView();
-#ifdef HAVE_OPENCL
-  void                            onCreateNewViewRT();
-#endif
   void                            onWindowActivated ( QWidget * w );
        void                            windowsMenuAboutToShow();
   void                            windowsMenuActivated( bool checked/*int id*/ );
@@ -77,16 +69,17 @@ private:
 
        QList<QAction*>                 myStdActions;
   QList<QAction*>                 myToolActions;
-  QList<QAction*>                 myRaytraceActions;
   QList<QAction*>                 myMaterialActions;
-  QList<DocumentCommon*>          myDocuments;
+  //QList<DocumentCommon*>          myDocuments;
 
        QToolBar*                       myStdToolBar;
        QToolBar*                       myCasCadeBar;
-  QToolBar*                       myRaytraceBar;
        QMenu*                          myFilePopup;
        QMenu*                          myWindowPopup;
   QAction*                        myFileSeparator;
+
+protected:
+  QList<DocumentCommon*>          myDocuments;
 };
 
 #endif
index a5be1b3..23469bc 100755 (executable)
         <translation>new.png</translation>
     </message>
     <message>
-        <source>ICON_NEW_GL</source>
-        <translation>newGL.png</translation>
-    </message>
-    <message>
-        <source>ICON_NEW_RT</source>
-        <translation>newRT.png</translation>
-    </message>
-    <message>
         <source>ICON_VIEW_RIGHT</source>
         <translation>view_right.png</translation>
     </message>
         <translation>lamp.png</translation>
     </message>
     <message>
+        <source>ICON_TOOL_RAYTRACING</source>
+        <translation>raytracing.png</translation>
+    </message>
+    <message>
         <source>ICON_TOOL_SHADOWS</source>
         <translation>shadows.png</translation>
     </message>
     <message>
+        <source>ICON_TOOL_RAYTRACING</source>
+        <translation>shadows.png</translation>
+    </message>
+    <message>
         <source>ICON_TOOL_REFLECTIONS</source>
         <translation>reflections.png</translation>
     </message>
index cd87a19..b44f44e 100755 (executable)
         <translation>&amp;Shadows</translation>
     </message>
     <message>
+        <source>MNU_TOOL_RAYTRACING</source>
+        <translation>&amp;Ray-tracing</translation>
+    </message>
+    <message>
         <source>MNU_TOOL_REFLECTIONS</source>
         <translation>&amp;Reflections</translation>
     </message>
     <message>
         <source>MNU_TOOL_ANTIALIASING</source>
-        <translation>&amp;Antialiasing</translation>
+        <translation>&amp;Anti-aliasing</translation>
     </message>
     <message>
         <source>BTN_BRASS</source>
         <translation>Material</translation>
     </message>
     <message>
+        <source>TBR_TOOL_RAYTRACING</source>
+        <translation>Enable Ray-tracing</translation>
+    </message>
+    <message>
+        <source>TBR_TOOL_SHADOWS</source>
+        <translation>Enable Shadows</translation>
+    </message>
+    <message>
+        <source>TBR_TOOL_REFLECTIONS</source>
+        <translation>Enable Reflections</translation>
+    </message>
+    <message>
+        <source>TBR_TOOL_ANTIALIASING</source>
+        <translation>Enable Anti-aliasing</translation>
+    </message>
+    <message>
         <source>TBR_TOOL_BAR</source>
         <translation>Toolbar</translation>
     </message>
         <translation>New 3D View</translation>
     </message>
     <message>
-        <source>TBR_WINDOW_NEW3D_GL</source>
-        <translation>New GL 3D View</translation>
-    </message>
-    <message>
-        <source>MNU_WINDOW_NEW3D_GL</source>
-        <translation>New GL 3D View</translation>
-    </message>
-    <message>
-        <source>TBR_WINDOW_NEW3D_RT</source>
-        <translation>&amp;New RT 3D View</translation>
-    </message>
-    <message>
-        <source>MNU_WINDOW_NEW3D_RT</source>
-        <translation>&amp;New RT 3D View</translation>
+        <source>MNU_WINDOW_NEW3D</source>
+        <translation>New 3D View</translation>
     </message>
     <message>
         <source>MNU_STATUS_BAR</source>
index 9b8f02c..64d428c 100755 (executable)
@@ -16,7 +16,7 @@
 #include <OpenGl_GraphicDriver.hxx>
 #include <TCollection_AsciiString.hxx>
 
-Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString aDisplay,
+Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString /*aDisplay*/,
                                                     const Standard_ExtString aName,
                                                     const Standard_CString aDomain,
                                                     const Standard_Real ViewSize,
@@ -46,14 +46,14 @@ myApp( app ),
 myIndex( theIndex ),
 myNbViews( 0 )
 {
-  TCollection_ExtendedString a3DName("Visu3D");
-  myViewer = Viewer( getenv("DISPLAY"), a3DName.ToExtString(), "", 1000.0,
-                              V3d_XposYnegZpos, Standard_True, Standard_True );
+  TCollection_ExtendedString a3DName ("Visu3D");
+  myViewer = Viewer (qgetenv ("DISPLAY").constData(),
+    a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, Standard_True, Standard_True);
 
        myViewer->SetDefaultLights();
        myViewer->SetLightOn();
 
-       myContext =new AIS_InteractiveContext(myViewer);
+       myContext = new AIS_InteractiveContext (myViewer);
 }
 
 DocumentCommon::~DocumentCommon()
@@ -65,22 +65,22 @@ ApplicationCommonWindow* DocumentCommon::getApplication()
        return myApp;
 }
 
-MDIWindow* DocumentCommon::createNewMDIWindow( bool theRT )
+MDIWindow* DocumentCommon::createNewMDIWindow()
 {
-  QWorkspace* ws = myApp->getWorkspace();
-  return new MDIWindow( this, ws, 0, theRT );
+  QMdiArea* ws = myApp->getWorkspace();
+  return new MDIWindow (this, ws, 0);
 }
 
-void DocumentCommon::onCreateNewView( bool theRT ) 
+void DocumentCommon::onCreateNewView()
 {
-       QWorkspace* ws = myApp->getWorkspace();
-  MDIWindow* w = createNewMDIWindow( theRT );
+  QMdiArea* ws = myApp->getWorkspace();
+  MDIWindow* w = createNewMDIWindow();
        
-       if( !w )
+       if (!w)
          return;
 
-       ws->addWindow( w );
-       myViews.append(w);
+  ws->addSubWindow (w);
+  myViews.append (w);
 
   connect( w,    SIGNAL( selectionChanged() ),
            this, SIGNAL( selectionChanged() ) );
@@ -95,7 +95,7 @@ void DocumentCommon::onCreateNewView( bool theRT )
        
   w->setWindowIcon( QPixmap( dir + QObject::tr("ICON_DOC") ) );
 
-  if ( ws->windowList().isEmpty() )
+  if ( ws->subWindowList().isEmpty() )
   {
     // Due to strange Qt4.2.3 feature the child window icon is not drawn
     // in the main menu if showMaximized() is called for a non-visible child window
@@ -129,7 +129,9 @@ void DocumentCommon::removeView(MDIWindow* theView)
 void DocumentCommon::removeViews()
 {
   while( myViews.count() )
-    removeView( (MDIWindow*)myViews.first() );
+  {
+    removeView( myViews.first() );
+  }
 }
 
 int DocumentCommon::countOfWindow()
@@ -226,49 +228,3 @@ void DocumentCommon::onDelete()
     myContext->ClearSelected();
     getApplication()->onSelectionChanged();
 }
-
-#ifdef HAVE_OPENCL
-
-void DocumentCommon::onShadows( int state )
-{
-  QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
-
-  MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
-
-  if( window == NULL )
-    return;
-
-  window->setRaytracedShadows( state );
-
-  myContext->UpdateCurrentViewer();
-}
-
-void DocumentCommon::onReflections( int state )
-{
-  QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
-
-  MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
-
-  if( window == NULL )
-    return;
-
-  window->setRaytracedReflections( state );
-
-  myContext->UpdateCurrentViewer();
-}
-
-void DocumentCommon::onAntialiasing( int state )
-{
-  QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
-
-  MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
-
-  if( window == NULL )
-    return;
-
-  window->setRaytracedAntialiasing( state );
-
-  myContext->UpdateCurrentViewer();
-}
-
-#endif
index b8347fc..8d05a6a 100755 (executable)
@@ -28,7 +28,7 @@ public:
        void                           fitAll();
        
 protected:
-  virtual MDIWindow*                   createNewMDIWindow( bool theRT = false );
+  virtual MDIWindow*                   createNewMDIWindow();
 
 signals:
   void                           selectionChanged();
@@ -36,17 +36,11 @@ signals:
 
 public slots:
        virtual void                   onCloseView( MDIWindow* );
-       virtual void                   onCreateNewView( bool theRT = false );
+       virtual void                   onCreateNewView();
        virtual void                   onMaterial();
   virtual void                   onMaterial( int );
        virtual void                   onDelete();
 
-#ifdef HAVE_OPENCL
-  virtual void                   onShadows( int state );
-  virtual void                   onReflections( int state );
-  virtual void                   onAntialiasing( int state );
-#endif
-
        void                           onWireframe();
        void                           onShading();
        void                           onColor();
index d44da21..bf803a2 100755 (executable)
@@ -21,20 +21,11 @@ MDIWindow::MDIWindow(View* aView,
                      Qt::WindowFlags wflags )
 : QMainWindow( parent, wflags )
 {
-
   myView = aView;
        myDocument = aDocument;
-
-#ifdef HAVE_OPENCL
-
-  myShadowsEnabled = true;
-  myReflectionsEnabled = true;
-  myAntialiasingEnabled = false;
-
-#endif
 }  
   
-MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags, bool theRT )
+MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags)
 : QMainWindow( parent, wflags )
 {
        QFrame *vb = new QFrame( this );
@@ -47,24 +38,18 @@ MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlag
        setCentralWidget( vb );
 
        myDocument = aDocument;
-       myView = new View( myDocument->getContext(), vb, theRT );
-       layout->addWidget( myView );
+       myView = new View (myDocument->getContext(), vb);
+       layout->addWidget (myView);
 
   connect( myView, SIGNAL( selectionChanged() ),
            this,   SIGNAL( selectionChanged() ) );
-       createViewActions();
+  
+  createViewActions();
+  createRaytraceActions();
 
   resize( sizeHint() );
 
   setFocusPolicy( Qt::StrongFocus );
-
-#ifdef HAVE_OPENCL
-
-  myShadowsEnabled = true;
-  myReflectionsEnabled = true;
-  myAntialiasingEnabled = false;
-
-#endif
 }
 
 MDIWindow::~MDIWindow()
@@ -98,21 +83,34 @@ void MDIWindow::createViewActions()
   aList->at(View::ViewHlrOffId)->setChecked( true );
 }
 
+void MDIWindow::createRaytraceActions()
+{
+  // populate a tool bar with some actions
+       QToolBar* aToolBar = addToolBar( tr( "Ray-tracing Options" ) );
+       
+  QList<QAction*>* aList = myView->getRaytraceActions();
+       aToolBar->addActions( *aList );
+
+  aToolBar->toggleViewAction()->setVisible (true);
+  aList->at (View::ToolRaytracingId)->setChecked (false);
+  aList->at (View::ToolShadowsId)->setChecked (true);
+  aList->at (View::ToolReflectionsId)->setChecked (true);
+  aList->at (View::ToolAntialiasingId)->setChecked (false);
+}
+
 void MDIWindow::onWindowActivated ()
 {
   getDocument()->getApplication()->onSelectionChanged();
 }
 
-
 void MDIWindow::dump()
 {
-
-       QString datadir = (QString(getenv("CASROOT")) + "/../data/images");
+  QString datadir = (QString(qgetenv ("CASROOT").constData()) + "/../data/images");
        static QString filter;
   filter = "Images Files (*.bmp *.ppm *.png *.jpg *.tiff *.tga *.gif *.exr *.ps *.eps *.tex *.pdf *.svg *.pgf)";
        QFileDialog fd ( 0 );
        fd.setModal( true );
-       fd.setFilter( filter );
+       fd.setNameFilter ( filter );
        fd.setWindowTitle( QObject::tr("INF_APP_EXPORT") );
        fd.setFileMode( QFileDialog::AnyFile );
        int ret = fd.exec(); 
@@ -129,6 +127,7 @@ void MDIWindow::dump()
          QApplication::setOverrideCursor( Qt::WaitCursor );
                if ( !QFileInfo( file ).completeSuffix().length() )
       file += QString( ".bmp" );
+
     bool res = myView->dump( (Standard_CString)file.toLatin1().constData() );
     QApplication::restoreOverrideCursor();                
     if ( !res )
@@ -152,27 +151,3 @@ QSize MDIWindow::sizeHint() const
 {
     return QSize( 450, 300 );
 }
-
-#ifdef HAVE_OPENCL
-
-void MDIWindow::setRaytracedShadows( int state )
-{
-  myView->setRaytracedShadows( state );
-  myShadowsEnabled = state;
-}
-
-void MDIWindow::setRaytracedReflections( int state )
-{
-  myView->setRaytracedReflections( state );
-  myReflectionsEnabled = state;
-}
-
-void MDIWindow::setRaytracedAntialiasing( int state )
-{
-  myView->setRaytracedAntialiasing( state );
-  myAntialiasingEnabled = state;
-}
-
-#endif
-
-
index e2753cc..bf89026 100755 (executable)
@@ -12,7 +12,7 @@ class COMMONSAMPLE_EXPORT MDIWindow: public QMainWindow
     Q_OBJECT
 
 public:
-  MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags, bool theRT = false );
+  MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags );
   MDIWindow( View* aView, DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags );
   ~MDIWindow();
 
@@ -20,18 +20,6 @@ public:
        void                       fitAll();
   virtual QSize              sizeHint() const;
 
-#ifdef HAVE_OPENCL
-
-  void                       setRaytracedShadows( int state );
-  void                       setRaytracedReflections( int state );
-  void                       setRaytracedAntialiasing( int state );
-
-  bool                       ShadowsEnabled() { return myShadowsEnabled; }
-  bool                       ReflectionsEnabled() { return myReflectionsEnabled; }
-  bool                       AntialiasingEnabled() { return myAntialiasingEnabled; }
-
-#endif
-
 signals:
   void                       selectionChanged();
   void                       message(const QString&, int );
@@ -44,19 +32,11 @@ public slots:
 
 protected:
   void                       createViewActions();
+  void                       createRaytraceActions();
 
 protected:
   DocumentCommon*            myDocument;
   View*                      myView;
-
-#ifdef HAVE_OPENCL
-
-  bool                       myShadowsEnabled;
-  bool                       myReflectionsEnabled;
-  bool                       myAntialiasingEnabled;
-
-#endif
 };
 
-#endif
-
+#endif
\ No newline at end of file
index 920face..77f51b8 100755 (executable)
 #include <QFileDialog>
 #include <QMouseEvent>
 #include <QRubberBand>
+#include <QMdiSubWindow>
+#include <QStyleFactory>
 
 #include <Visual3d_View.hxx>
 #include <Graphic3d_ExportFormat.hxx>
 #include <Graphic3d_GraphicDriver.hxx>
 #include <Graphic3d_TextureEnv.hxx>
-#include <QWindowsStyle>
   
 #if defined(_WIN32) || defined(__WIN32__)
 #include <WNT_Window.hxx>
@@ -54,10 +55,14 @@ static QCursor* globPanCursor = NULL;
 static QCursor* zoomCursor    = NULL;
 static QCursor* rotCursor     = NULL;
 
-View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent, bool theRT )
+View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent )
 : QWidget( parent ),
-myIsRT( theRT ),
+myIsRaytracing( false ),
+myIsShadowsEnabled (true),
+myIsReflectionsEnabled (true),
+myIsAntialiasingEnabled (false),
 myViewActions( 0 ),
+myRaytraceActions( 0 ),
 myBackMenu( NULL )
 {
 #if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
@@ -77,7 +82,7 @@ myBackMenu( NULL )
     myCurZoom = 0;
     myRectBand = 0;
 
-       setAttribute(Qt::WA_PaintOnScreen);
+       setAttribute(Qt::WA_PaintOnScreen);
     setAttribute(Qt::WA_NoSystemBackground);
 
 #if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
@@ -153,7 +158,12 @@ myBackMenu( NULL )
     myCurrentMode = CurAction3d_Nothing;
     myHlrModeIsOn = Standard_False;
     setMouseTracking( true );
-
+    
+    if( myFirst )
+    {
+        init();
+        myFirst = false;
+    }
     initViewActions();
     initCursors();
 
@@ -172,8 +182,9 @@ View::~View()
 
 void View::init()
 {
-  if (myView.IsNull())
-  myView = myContext->CurrentViewer()->CreateView();
+  if ( myView.IsNull() )
+    myView = myContext->CurrentViewer()->CreateView();
+  
 #if defined(_WIN32) || defined(__WIN32__)
   Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
   Handle(WNT_Window) hWnd = new WNT_Window (aWindowHandle);
@@ -185,15 +196,16 @@ void View::init()
   Handle(Aspect_DisplayConnection) aDispConnection = myContext->CurrentViewer()->Driver()->GetDisplayConnection();
   Handle(Xw_Window) hWnd = new Xw_Window (aDispConnection, aWindowHandle);
 #endif // WNT
+
   myView->SetWindow (hWnd);
-  if (!hWnd->IsMapped())
+  if ( !hWnd->IsMapped() )
   {
     hWnd->Map();
   }
   myView->SetBackgroundColor (Quantity_NOC_BLACK);
   myView->MustBeResized();
 
-  if (myIsRT)
+  if (myIsRaytracing)
     myView->SetRaytracingMode();
 }
 
@@ -310,28 +322,95 @@ void View::hlrOn()
     QApplication::restoreOverrideCursor();
 }
 
-void View::setRaytracedShadows( int state )
+void View::SetRaytracedShadows (bool theState)
 {
-  if ( state )
+  if (theState)
     myView->EnableRaytracedShadows();
   else
     myView->DisableRaytracedShadows();
+
+  myIsShadowsEnabled = theState;
+
+  myContext->UpdateCurrentViewer();
 }
 
-void View::setRaytracedReflections( int state )
+void View::SetRaytracedReflections (bool theState)
 {
-  if ( state )
+  if (theState)
     myView->EnableRaytracedReflections();
   else
     myView->DisableRaytracedReflections();
+
+  myIsReflectionsEnabled = theState;
+
+  myContext->UpdateCurrentViewer();
 }
 
-void View::setRaytracedAntialiasing( int state )
+void View::onRaytraceAction()
 {
-  if ( state )
+  QAction* aSentBy = (QAction*)sender();
+  
+  if (aSentBy == myRaytraceActions->at (ToolRaytracingId))
+  {
+    bool aState = myRaytraceActions->at (ToolRaytracingId)->isChecked(); 
+
+    QApplication::setOverrideCursor (Qt::WaitCursor);
+    if (aState)
+      EnableRaytracing();
+    else
+      DisableRaytracing();
+    QApplication::restoreOverrideCursor();
+  }
+
+  if (aSentBy == myRaytraceActions->at (ToolShadowsId))
+  {
+    bool aState = myRaytraceActions->at (ToolShadowsId)->isChecked(); 
+    SetRaytracedShadows (aState);
+  }
+
+  if (aSentBy == myRaytraceActions->at (ToolReflectionsId))
+  {
+    bool aState = myRaytraceActions->at (ToolReflectionsId)->isChecked();
+    SetRaytracedReflections (aState);
+  }
+
+  if (aSentBy == myRaytraceActions->at (ToolAntialiasingId))
+  {
+    bool aState = myRaytraceActions->at (ToolAntialiasingId)->isChecked();
+    SetRaytracedAntialiasing (aState);
+  }
+}
+
+void View::SetRaytracedAntialiasing (bool theState)
+{
+  if (theState)
     myView->EnableRaytracedAntialiasing();
   else
     myView->DisableRaytracedAntialiasing();
+
+  myIsAntialiasingEnabled = theState;
+
+  myContext->UpdateCurrentViewer();
+}
+
+void View::EnableRaytracing()
+{
+  if (!myIsRaytracing)
+    myView->SetRaytracingMode();
+
+  myIsRaytracing = true;
+
+  myContext->UpdateCurrentViewer();
+}
+
+void View::DisableRaytracing()
+{
+  if (myIsRaytracing)
+    myView->SetRasterizationMode();
+
+  myIsRaytracing = false;
+
+  myContext->UpdateCurrentViewer();
 }
 
 void View::updateToggled( bool isOn )
@@ -398,6 +477,12 @@ QList<QAction*>* View::getViewActions()
     return myViewActions;
 }
 
+QList<QAction*>* View::getRaytraceActions()
+{
+    initRaytraceActions();
+    return myRaytraceActions;
+}
+
 /*!
   Get paint engine for the OpenGL viewer. [ virtual public ]
 */
@@ -533,6 +618,48 @@ void View::initViewActions()
   myViewActions->insert( ViewHlrOnId, a );
 }
 
+void View::initRaytraceActions()
+{
+  if ( myRaytraceActions )
+    return;
+
+  myRaytraceActions = new QList<QAction*>();
+  QString dir = ApplicationCommonWindow::getResourceDir() + QString( "/" );
+  QAction* a;
+
+  a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_RAYTRACING") ), QObject::tr("MNU_TOOL_RAYTRACING"), this );
+  a->setToolTip( QObject::tr("TBR_TOOL_RAYTRACING") );
+  a->setStatusTip( QObject::tr("TBR_TOOL_RAYTRACING") );
+  a->setCheckable( true );
+  a->setChecked( false );
+  connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
+  myRaytraceActions->insert( ToolRaytracingId, a );
+
+  a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_SHADOWS") ), QObject::tr("MNU_TOOL_SHADOWS"), this );
+  a->setToolTip( QObject::tr("TBR_TOOL_SHADOWS") );
+  a->setStatusTip( QObject::tr("TBR_TOOL_SHADOWS") );
+  a->setCheckable( true );
+  a->setChecked( true );
+  connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
+  myRaytraceActions->insert( ToolShadowsId, a );
+
+  a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_REFLECTIONS") ), QObject::tr("MNU_TOOL_REFLECTIONS"), this );
+  a->setToolTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
+  a->setStatusTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
+  a->setCheckable( true );
+  a->setChecked( true );
+  connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
+  myRaytraceActions->insert( ToolReflectionsId, a );
+
+  a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_ANTIALIASING") ), QObject::tr("MNU_TOOL_ANTIALIASING"), this );
+  a->setToolTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
+  a->setStatusTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
+  a->setCheckable( true );
+  a->setChecked( false );
+  connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
+  myRaytraceActions->insert( ToolAntialiasingId, a );
+}
+
 void View::mousePressEvent( QMouseEvent* e )
 {
   if ( e->button() == Qt::LeftButton )
@@ -855,8 +982,8 @@ void View::MultiInputEvent( const int /*x*/, const int /*y*/ )
 void View::Popup( const int /*x*/, const int /*y*/ )
 {
   ApplicationCommonWindow* stApp = ApplicationCommonWindow::getApplication();
-  QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
-  QWidget* w = ws->activeWindow();
+  QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
+  QMdiSubWindow* w = ws->activeSubWindow();
   if ( myContext->NbSelected() )
   {
     QList<QAction*>* aList = stApp->getToolActions();
@@ -928,7 +1055,7 @@ void View::DrawRectangle(const int MinX, const int MinY,
   if ( !myRectBand ) 
   {
     myRectBand = new QRubberBand( QRubberBand::Rectangle, this );
-    myRectBand->setStyle(new QWindowsStyle);
+    myRectBand->setStyle( QStyleFactory::create("windows") );
     myRectBand->setGeometry( aRect );
     myRectBand->show();
 
@@ -1000,7 +1127,7 @@ void View::onEnvironmentMap()
     QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
                            tr("All Image Files (*.bmp *.gif *.jpg *.jpeg *.png *.tga)"));
 
-    Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toAscii().data() );
+    Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toLatin1().data() );
 
     myView->SetTextureEnv (aTexture);
     myView->SetSurfaceDetail (V3d_TEX_ENVIRONMENT);
index dac41c3..796b2ac 100755 (executable)
@@ -24,22 +24,30 @@ public:
     enum ViewAction { ViewFitAllId, ViewFitAreaId, ViewZoomId, ViewPanId, ViewGlobalPanId,
                       ViewFrontId, ViewBackId, ViewTopId, ViewBottomId, ViewLeftId, ViewRightId,
                       ViewAxoId, ViewRotationId, ViewResetId, ViewHlrOffId, ViewHlrOnId };
+    enum RaytraceAction { ToolRaytracingId, ToolShadowsId, ToolReflectionsId, ToolAntialiasingId };
 
-    View( Handle(AIS_InteractiveContext) theContext,
-          QWidget* parent,
-          bool theRT = false );
+    View( Handle(AIS_InteractiveContext) theContext, QWidget* parent );
 
     ~View();
 
     virtual void                  init();
     bool                          dump( Standard_CString theFile );
     QList<QAction*>*              getViewActions();
+    QList<QAction*>*              getRaytraceActions();
     void                          noActiveActions();
     bool                          isShadingMode();
 
-    void                          setRaytracedShadows( int state );
-    void                          setRaytracedReflections( int state );
-    void                          setRaytracedAntialiasing( int state );
+    void                          EnableRaytracing();
+    void                          DisableRaytracing();
+
+    void                          SetRaytracedShadows (bool theState);
+    void                          SetRaytracedReflections (bool theState);
+    void                          SetRaytracedAntialiasing (bool theState);
+
+    bool                          IsRaytracingMode() const { return myIsRaytracing; }
+    bool                          IsShadowsEnabled() const { return myIsShadowsEnabled; }
+    bool                          IsReflectionsEnabled() const { return myIsReflectionsEnabled; }
+    bool                          IsAntialiasingEnabled() const { return myIsAntialiasingEnabled; }
 
     static QString                GetMessages( int type,TopAbs_ShapeEnum aSubShapeType,
                                                TopAbs_ShapeEnum aShapeType );
@@ -77,6 +85,7 @@ public slots:
     void                          updateToggled( bool );
     void                          onBackground();
     void                          onEnvironmentMap();
+    void                          onRaytraceAction();
 
 protected:
     virtual void                  paintEvent( QPaintEvent* );
@@ -104,6 +113,7 @@ protected:
 private:
     void                          initCursors();
     void                          initViewActions();
+    void                          initRaytraceActions();
     void                          DragEvent( const int x, const int y, const int TheState );
     void                          InputEvent( const int x, const int y );
     void                          MoveEvent( const int x, const int y );
@@ -114,7 +124,11 @@ private:
                                                  const int MaxX, const int MaxY, const bool Draw );
 
 private:
-    bool                            myIsRT;
+    bool                            myIsRaytracing;
+    bool                            myIsShadowsEnabled;
+    bool                            myIsReflectionsEnabled;
+    bool                            myIsAntialiasingEnabled;
+
     bool                            myFirst;
     bool                                       myDrawRect;           // set when a rect is used for selection or magnify 
     Handle(V3d_View)                myView;
@@ -127,6 +141,7 @@ private:
     Quantity_Factor                 myCurZoom;
     Standard_Boolean                myHlrModeIsOn;
     QList<QAction*>*                myViewActions;
+    QList<QAction*>*                myRaytraceActions;
     QMenu*                          myBackMenu;
     QRubberBand*                    myRectBand; //!< selection rectangle rubber band
 };
index 0cad367..bbaf5dd 100644 (file)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7972FDD8-9612-3401-827F-C8DF8E2689B5}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -8,12 +8,12 @@ Global
                Release|Win32 = Release|Win32
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.ActiveCfg = Debug|Win32
-               {7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.Build.0 = Debug|Win32
-               {7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.ActiveCfg = Release|Win32
-               {7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.Build.0 = Release|Win32
+               {7972FDD8-9612-3401-827F-C8DF8E2689B5}.Debug|Win32.ActiveCfg = Debug|Win32
+               {7972FDD8-9612-3401-827F-C8DF8E2689B5}.Debug|Win32.Build.0 = Debug|Win32
+               {7972FDD8-9612-3401-827F-C8DF8E2689B5}.Release|Win32.ActiveCfg = Release|Win32
+               {7972FDD8-9612-3401-827F-C8DF8E2689B5}.Release|Win32.Build.0 = Release|Win32
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
        EndGlobalSection
-EndGlobal
\ No newline at end of file
+EndGlobal
index 1c0f562..e9b9f78 100644 (file)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 10.00
 # Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -8,10 +8,10 @@ Global
                Release|Win32 = Release|Win32
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.ActiveCfg = Debug|Win32
-               {7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.Build.0 = Debug|Win32
-               {7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.ActiveCfg = Release|Win32
-               {7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.Build.0 = Release|Win32
+               {AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Debug|Win32.ActiveCfg = Debug|Win32
+               {AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Debug|Win32.Build.0 = Debug|Win32
+               {AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Release|Win32.ActiveCfg = Release|Win32
+               {AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Release|Win32.Build.0 = Release|Win32
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index fc5d887..05ccdcf 100755 (executable)
@@ -3,10 +3,9 @@ CONFIG += debug_and_release qt
 
 TARGET = IESample
 
-SAMPLESROOT = $$(CASROOT)/samples/qt
+SAMPLESROOT = $$(SAMPLESROOT)
 
-HEADERS   = src/*.h \
-            $${SAMPLESROOT}/Common/src/*.h \
+HEADERS   = $${SAMPLESROOT}/Common/src/*.h \
             $${SAMPLESROOT}/Interface/src/*.h
 
 SOURCES   = src/*.cxx \
@@ -24,7 +23,9 @@ RES_DIR   = $$quote($$(RES_DIR))
 INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
 INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
 
-DEFINES = CSFDB
+OCCT_DEFINES = $$(CSF_DEFINES)
+
+DEFINES = CSFDB $$split(OCCT_DEFINES, ;)
 
 unix {
     UNAME = $$system(uname -s)
@@ -38,11 +39,11 @@ unix {
     CONFIG(debug, debug|release) {
        DESTDIR = ./$$UNAME/bind
        OBJECTS_DIR = ./$$UNAME/objd
-       MOC_DIR = ./$$UNAME/srcd
+       MOC_DIR = ./$$UNAME/mocd
     } else {
        DESTDIR = ./$$UNAME/bin
        OBJECTS_DIR = ./$$UNAME/obj
-       MOC_DIR = ./$$UNAME/src
+       MOC_DIR = ./$$UNAME/moc
     }
 
     MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
@@ -63,107 +64,23 @@ win32 {
 
     CONFIG(debug, debug|release) {
        DEFINES += _DEBUG
+       DESTDIR = ./win$(ARCH)/$(VCVER)/bind
+       OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/objd
+       MOC_DIR = ./win$(ARCH)/$(VCVER)/mocd
        !contains(QMAKE_HOST.arch, x86_64) {
-               LIBS = -L$(CSF_OPT_LIB32D)
-               contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
-               DESTDIR = ./win32/vc7/bind
-               OBJECTS_DIR = ./win32/vc7/objd
-               MOC_DIR = ./win32/vc7/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
-               DESTDIR = ./win32/vc8/bind
-               OBJECTS_DIR = ./win32/vc8/objd
-               MOC_DIR = ./win32/vc8/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
-               DESTDIR = ./win32/vc9/bind
-               OBJECTS_DIR = ./win32/vc9/objd
-               MOC_DIR = ./win32/vc9/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
-               DESTDIR = ./win32/vc10/bind
-               OBJECTS_DIR = ./win32/vc10/objd
-               MOC_DIR = ./win32/vc10/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
-               DESTDIR = ./win32/vc11/bind
-               OBJECTS_DIR = ./win32/vc11/objd
-               MOC_DIR = ./win32/vc11/srcd
-           }
+           LIBS = -L$(CSF_OPT_LIB32D)
        } else {
-               LIBS = -L$(CSF_OPT_LIB64D)
-               contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
-               DESTDIR = ./win64/vc8/bind
-               OBJECTS_DIR = ./win64/vc8/objd
-               MOC_DIR = ./win64/vc8/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
-               DESTDIR = ./win64/vc9/bind
-               OBJECTS_DIR = ./win64/vc9/objd
-               MOC_DIR = ./win64/vc9/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
-               DESTDIR = ./win64/vc10/bind
-               OBJECTS_DIR = ./win64/vc10/objd
-               MOC_DIR = ./win64/vc10/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
-               DESTDIR = ./win64/vc11/bind
-               OBJECTS_DIR = ./win64/vc11/objd
-               MOC_DIR = ./win64/vc11/srcd
-           }
+           LIBS = -L$(CSF_OPT_LIB64D)
        }
     } else {
        DEFINES += NDEBUG
+       DESTDIR = ./win$(ARCH)/$(VCVER)/bin
+       OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/obj
+       MOC_DIR = ./win$(ARCH)/$(VCVER)/moc
        !contains(QMAKE_HOST.arch, x86_64) {
-               LIBS = -L$(CSF_OPT_LIB32)
-               contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
-               DESTDIR = ./win32/vc7/bin
-               OBJECTS_DIR = ./win32/vc7/obj
-               MOC_DIR = ./win32/vc7/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
-               DESTDIR = ./win32/vc8/bin
-               OBJECTS_DIR = ./win32/vc8/obj
-               MOC_DIR = ./win32/vc8/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
-               DESTDIR = ./win32/vc9/bin
-               OBJECTS_DIR = ./win32/vc9/obj
-               MOC_DIR = ./win32/vc9/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
-               DESTDIR = ./win32/vc10/bin
-               OBJECTS_DIR = ./win32/vc10/obj
-               MOC_DIR = ./win32/vc10/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
-               DESTDIR = ./win32/vc11/bin
-               OBJECTS_DIR = ./win32/vc11/obj
-               MOC_DIR = ./win32/vc11/src
-           }
+           LIBS = -L$(CSF_OPT_LIB32)
        } else {
-               LIBS = -L$(CSF_OPT_LIB64)
-               contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
-               DESTDIR = ./win64/vc8/bin
-               OBJECTS_DIR = ./win64/vc8/obj
-               MOC_DIR = ./win64/vc8/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
-               DESTDIR = ./win64/vc9/bin
-               OBJECTS_DIR = ./win64/vc9/obj
-               MOC_DIR = ./win64/vc9/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
-               DESTDIR = ./win64/vc10/bin
-               OBJECTS_DIR = ./win64/vc10/obj
-               MOC_DIR = ./win64/vc10/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
-               DESTDIR = ./win64/vc11/bin
-               OBJECTS_DIR = ./win64/vc11/obj
-               MOC_DIR = ./win64/vc11/src
-           }
+           LIBS = -L$(CSF_OPT_LIB64)
        }
     }
     DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
@@ -199,3 +116,8 @@ copy_res.CONFIG += no_link target_predeps
 win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
 unix:  copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
 QMAKE_EXTRA_COMPILERS += copy_res
+#QMAKE_CXXFLAGS += /wd4996
+
+greaterThan(QT_MAJOR_VERSION, 4) {
+    QT += widgets
+}
index 3fa44b6..3e49806 100755 (executable)
@@ -1,5 +1,6 @@
 call "%~dp0..\..\..\env.bat" %1 %2 %3
 
+SET "SAMPLESROOT=%~dp0.."
 SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
 SET "CSF_ResourcesDefaults=%RES_DIR%"
 SET "CSF_IEResourcesDefaults=%RES_DIR%"
index 7694e23..1c5a7fd 100644 (file)
@@ -7,6 +7,8 @@ REM third argument specifies Debug or Release mode
 
 call "%~dp0env.bat" %1 %2 %3
 
+set EXT=vcproj
+
 if not "%1" == "" (
     if /I "%1" == "vc8" (
         set VCVER=vc8
@@ -16,9 +18,11 @@ if not "%1" == "" (
         set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
     ) else if /I "%1" == "vc10" (
         set VCVER=vc10
+        set EXT=vcxproj
         set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
     ) else if /I "%1" == "vc11" (
         set VCVER=vc11
+        set EXT=vcxproj
         set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
     ) else (
         echo Error: first argument ^(%1^) should specify supported version of Visual C++,
@@ -32,4 +36,4 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
 
 call "%VCVARS%" %VCARCH%
 
-qmake -tp vc -r IESample.pro
+qmake -tp vc -o IESample.%EXT% IESample.pro
index a3655dc..34c55d9 100755 (executable)
@@ -4,6 +4,7 @@
 
 #include <QMessageBox>
 #include <stdlib.h>
+#include <QMdiSubWindow>
 
 ApplicationWindow::ApplicationWindow()
     : ApplicationCommonWindow( ),
@@ -96,7 +97,7 @@ void ApplicationWindow::createTranslatePopups()
 
 void ApplicationWindow::updateFileActions()
 {
-  if ( getWorkspace()->windowList().isEmpty() )
+  if ( myDocuments.isEmpty() )
   {
     if ( !isDocument() )
     {
@@ -124,7 +125,7 @@ void ApplicationWindow::onImport()
     bool stat = translate( type, true );
     if ( stat )
     {
-        DocumentCommon* doc = ((MDIWindow*) getWorkspace()->activeWindow())->getDocument();
+        DocumentCommon* doc = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() )->getDocument();
         doc->fitAll();
     }
 }
@@ -136,7 +137,7 @@ void ApplicationWindow::onExport()
     if ( type < 0 )
         return;
 
-    bool stat = translate( type, false );
+    translate( type, false );
 }
 
 int ApplicationWindow::translationFormat( const QAction* a )
@@ -181,7 +182,7 @@ int ApplicationWindow::translationFormat( const QAction* a )
 bool ApplicationWindow::translate( const int format, const bool import )
 {
     static Translate* anTrans = createTranslator();
-    DocumentCommon* doc = ((MDIWindow*) getWorkspace()->activeWindow())->getDocument();
+    DocumentCommon* doc = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() )->getDocument();
     Handle(AIS_InteractiveContext) context = doc->getContext();
     bool status;
     if ( import )
@@ -210,8 +211,8 @@ void ApplicationWindow::onSelectionChanged()
 {
   ApplicationCommonWindow::onSelectionChanged();
 
-  QWorkspace* ws = getWorkspace();
-  DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
+  QMdiArea* ws = getWorkspace();
+  DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
   Handle(AIS_InteractiveContext) context = doc->getContext();
   int numSel = context->NbSelected();
 
@@ -225,13 +226,15 @@ void ApplicationWindow::onSelectionChanged()
 
 QString ApplicationWindow::getIEResourceDir()
 {
-    static QString resDir( ::getenv( "CSF_IEResourcesDefaults" ) );
-    return resDir;
+  static QString aResourceDir =
+    QString::fromUtf8 (qgetenv ("CSF_IEResourcesDefaults").constData());
+  
+  return aResourceDir;
 }
 
 void ApplicationWindow::onExportImage()
 {
-    MDIWindow* w = (MDIWindow*)getWorkspace()->activeWindow();
+    MDIWindow* w = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() );
     if ( w )
         w->dump();
 }
index 25f5e80..287c111 100755 (executable)
@@ -15,6 +15,7 @@
 #include <QFileDialog>
 #include <QApplication>
 #include <QWidget>
+#include <QStyleFactory>
 
 #include <AIS_Shape.hxx>
 #include <AIS_InteractiveObject.hxx>
@@ -89,7 +90,9 @@ private:
 TranslateDlg::TranslateDlg( QWidget* parent, Qt::WindowFlags flags, bool modal )
 : QFileDialog( parent, flags )
 {
+  setOption( QFileDialog::DontUseNativeDialog );
   setModal( modal );
+
   QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
 
   if( grid )
@@ -331,7 +334,7 @@ QString Translate::selectFileName( const int format, const bool import )
 
   if ( !QFileInfo( file ).completeSuffix().length() )
   {
-    QString selFilter = theDlg->selectedFilter();
+    QString selFilter = theDlg->selectedNameFilter();
                int idx = selFilter.indexOf( "(*." );
     if ( idx != -1 )
     {
@@ -371,7 +374,7 @@ TranslateDlg* Translate::getDialog( const int format, const bool import )
 
   cout << filter.toLatin1().constData() << endl;
   QStringList filters = filter.split( "\t" );
-  myDlg->setFilters( filters );
+  myDlg->setNameFilters ( filters );
 
        if ( import )
   {
@@ -384,7 +387,7 @@ TranslateDlg* Translate::getDialog( const int format, const bool import )
     ((QFileDialog*)myDlg)->setFileMode( QFileDialog::AnyFile );
   }
 
-       QString datadir = (QString(getenv("CASROOT")) + QObject::tr( QString("INF_PATH_%1").arg( format ).toLatin1().constData() ) );
+  QString datadir = (QString (qgetenv ("CASROOT").constData()) + QObject::tr( QString("INF_PATH_%1").arg( format ).toLatin1().constData() ) );
 
   myDlg->clear();
 
@@ -459,7 +462,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importSTEP( const QString& file )
            {
                bool ok = aReader.TransferRoot( n );
                int nbs = aReader.NbShapes();
-               if ( nbs > 0 )
+               if ( ok == true && nbs > 0 )
             {
                    aSequence = new TopTools_HSequenceOfShape();
                    for ( int i = 1; i <= nbs; i++ )
index 4fb1550..13fea24 100644 (file)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -8,10 +8,10 @@ Global
                Release|Win32 = Release|Win32
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Debug|Win32.ActiveCfg = Debug|Win32
-               {59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Debug|Win32.Build.0 = Debug|Win32
-               {59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Release|Win32.ActiveCfg = Release|Win32
-               {59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Release|Win32.Build.0 = Release|Win32
+               {E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Debug|Win32.ActiveCfg = Debug|Win32
+               {E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Debug|Win32.Build.0 = Debug|Win32
+               {E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Release|Win32.ActiveCfg = Release|Win32
+               {E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Release|Win32.Build.0 = Release|Win32
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index d6228ed..e133f70 100755 (executable)
@@ -3,7 +3,7 @@ CONFIG += debug_and_release qt
 
 TARGET = Tutorial
 
-SAMPLESROOT = $$(CASROOT)/samples/qt
+SAMPLESROOT = $$(SAMPLESROOT)
 
 HEADERS   = src/*.h \
             $${SAMPLESROOT}/Common/src/*.h \
@@ -26,7 +26,9 @@ RES_DIR   = $$quote($$(RES_DIR))
 INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
 INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
 
-DEFINES = CSFDB
+OCCT_DEFINES = $$(CSF_DEFINES)
+
+DEFINES = CSFDB $$split(OCCT_DEFINES, ;)
 
 unix {
     UNAME = $$system(uname -s)
@@ -40,11 +42,11 @@ unix {
     CONFIG(debug, debug|release) {
        DESTDIR = ./$$UNAME/bind
        OBJECTS_DIR = ./$$UNAME/objd
-       MOC_DIR = ./$$UNAME/srcd
+       MOC_DIR = ./$$UNAME/mocd
     } else {
        DESTDIR = ./$$UNAME/bin
        OBJECTS_DIR = ./$$UNAME/obj
-       MOC_DIR = ./$$UNAME/src
+       MOC_DIR = ./$$UNAME/moc
     }
 
     MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
@@ -65,107 +67,23 @@ win32 {
 
     CONFIG(debug, debug|release) {
        DEFINES += _DEBUG
+       DESTDIR = ./win$(ARCH)/$(VCVER)/bind
+       OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/objd
+       MOC_DIR = ./win$(ARCH)/$(VCVER)/mocd
        !contains(QMAKE_HOST.arch, x86_64) {
-               LIBS = -L$(CSF_OPT_LIB32D)
-               contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
-               DESTDIR = ./win32/vc7/bind
-               OBJECTS_DIR = ./win32/vc7/objd
-               MOC_DIR = ./win32/vc7/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
-               DESTDIR = ./win32/vc8/bind
-               OBJECTS_DIR = ./win32/vc8/objd
-               MOC_DIR = ./win32/vc8/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
-               DESTDIR = ./win32/vc9/bind
-               OBJECTS_DIR = ./win32/vc9/objd
-               MOC_DIR = ./win32/vc9/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
-               DESTDIR = ./win32/vc10/bind
-               OBJECTS_DIR = ./win32/vc10/objd
-               MOC_DIR = ./win32/vc10/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
-               DESTDIR = ./win32/vc11/bind
-               OBJECTS_DIR = ./win32/vc11/objd
-               MOC_DIR = ./win32/vc11/srcd
-           }
+           LIBS = -L$(CSF_OPT_LIB32D)
        } else {
-               LIBS = -L$(CSF_OPT_LIB64D)
-               contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
-               DESTDIR = ./win64/vc8/bind
-               OBJECTS_DIR = ./win64/vc8/objd
-               MOC_DIR = ./win64/vc8/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
-               DESTDIR = ./win64/vc9/bind
-               OBJECTS_DIR = ./win64/vc9/objd
-               MOC_DIR = ./win64/vc9/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
-               DESTDIR = ./win64/vc10/bind
-               OBJECTS_DIR = ./win64/vc10/objd
-               MOC_DIR = ./win64/vc10/srcd
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
-               DESTDIR = ./win64/vc11/bind
-               OBJECTS_DIR = ./win64/vc11/objd
-               MOC_DIR = ./win64/vc11/srcd
-           }
+           LIBS = -L$(CSF_OPT_LIB64D)
        }
     } else {
        DEFINES += NDEBUG
+       DESTDIR = ./win$(ARCH)/$(VCVER)/bin
+       OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/obj
+       MOC_DIR = ./win$(ARCH)/$(VCVER)/moc
        !contains(QMAKE_HOST.arch, x86_64) {
-               LIBS = -L$(CSF_OPT_LIB32)
-               contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
-               DESTDIR = ./win32/vc7/bin
-               OBJECTS_DIR = ./win32/vc7/obj
-               MOC_DIR = ./win32/vc7/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
-               DESTDIR = ./win32/vc8/bin
-               OBJECTS_DIR = ./win32/vc8/obj
-               MOC_DIR = ./win32/vc8/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
-               DESTDIR = ./win32/vc9/bin
-               OBJECTS_DIR = ./win32/vc9/obj
-               MOC_DIR = ./win32/vc9/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
-               DESTDIR = ./win32/vc10/bin
-               OBJECTS_DIR = ./win32/vc10/obj
-               MOC_DIR = ./win32/vc10/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
-               DESTDIR = ./win32/vc11/bin
-               OBJECTS_DIR = ./win32/vc11/obj
-               MOC_DIR = ./win32/vc11/src
-           }
+           LIBS = -L$(CSF_OPT_LIB32)
        } else {
-               LIBS = -L$(CSF_OPT_LIB64)
-               contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
-               DESTDIR = ./win64/vc8/bin
-               OBJECTS_DIR = ./win64/vc8/obj
-               MOC_DIR = ./win64/vc8/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
-               DESTDIR = ./win64/vc9/bin
-               OBJECTS_DIR = ./win64/vc9/obj
-               MOC_DIR = ./win64/vc9/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
-               DESTDIR = ./win64/vc10/bin
-               OBJECTS_DIR = ./win64/vc10/obj
-               MOC_DIR = ./win64/vc10/src
-           }
-           contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
-               DESTDIR = ./win64/vc11/bin
-               OBJECTS_DIR = ./win64/vc11/obj
-               MOC_DIR = ./win64/vc11/src
-           }
+           LIBS = -L$(CSF_OPT_LIB64)
        }
     }
     DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
@@ -201,4 +119,8 @@ copy_res.CONFIG += no_link target_predeps
 win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
 unix:  copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
 QMAKE_EXTRA_COMPILERS += copy_res
+#QMAKE_CXXFLAGS += /wd4996
 
+greaterThan(QT_MAJOR_VERSION, 4) {
+    QT += widgets
+} 
\ No newline at end of file
index 08a92b3..dc58bd5 100755 (executable)
@@ -1,6 +1,6 @@
 call "%~dp0..\..\..\env.bat" %1 %2 %3
 
+SET "SAMPLESROOT=%~dp0.."
 SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
 SET "CSF_ResourcesDefaults=%RES_DIR%"
 SET "CSF_TutorialResourcesDefaults=%RES_DIR%"
-
index 2d2c619..b93f8ff 100644 (file)
@@ -7,6 +7,8 @@ REM third argument specifies Debug or Release mode
 
 call "%~dp0env.bat" %1 %2 %3
 
+set EXT=vcproj
+
 if not "%1" == "" (
     if /I "%1" == "vc8" (
         set VCVER=vc8
@@ -16,9 +18,11 @@ if not "%1" == "" (
         set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
     ) else if /I "%1" == "vc10" (
         set VCVER=vc10
+        set EXT=vcxproj
         set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
     ) else if /I "%1" == "vc11" (
         set VCVER=vc11
+        set EXT=vcxproj
         set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
     ) else (
         echo Error: first argument ^(%1^) should specify supported version of Visual C++,
@@ -32,4 +36,4 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
 
 call "%VCVARS%" %VCARCH%
 
-qmake -tp vc -r Tutorial.pro
+qmake -tp vc -o Tutorial.%EXT% Tutorial.pro
index a20891b..6a6baa5 100755 (executable)
@@ -3,6 +3,7 @@
 
 #include <QFileDialog>
 #include <QStatusBar>
+#include <QMdiSubWindow>
 
 ApplicationTut::ApplicationTut()
     : ApplicationCommonWindow( )
@@ -33,7 +34,7 @@ void ApplicationTut::createMakeBottleOperation(){
 
 void ApplicationTut::updateFileActions()
 {
-  if ( getWorkspace()->windowList().isEmpty() )
+  if ( getWorkspace()->subWindowList().isEmpty() )
   {
          if ( !isDocument() )
                {
@@ -49,8 +50,8 @@ void ApplicationTut::updateFileActions()
 
 void ApplicationTut::onMakeBottleAction()
 {
-       QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
-  DocumentTut* doc = (DocumentTut*)((MDIWindow*)ws->activeWindow())->getDocument();
+       QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
+  DocumentTut* doc = (DocumentTut*)( qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument() );
        statusBar()->showMessage( QObject::tr("INF_MAKE_BOTTLE"), 5000 );
        doc->onMakeBottle();
        statusBar()->showMessage(QObject::tr("INF_DONE"));
@@ -58,7 +59,7 @@ void ApplicationTut::onMakeBottleAction()
 
 QString ApplicationTut::getTutResourceDir()
 {
-    static QString resDir( ::getenv( "CSF_TutorialResourcesDefaults" ) );
-    return resDir;
+  static QString resDir (qgetenv ("CSF_TutorialResourcesDefaults").constData());
+  return resDir;
 }