0032630: Coding - get rid of unsused forward declarations [BinMDF to IFSelect]
[occt.git] / samples / qt / Tutorial / src / ApplicationTut.cxx
index 663f142..e2ea797 100755 (executable)
@@ -1,8 +1,13 @@
 #include "ApplicationTut.h"
 #include "DocumentTut.h"
 
+#include <OSD_Environment.hxx>
+
+#include <Standard_WarningsDisable.hxx>
 #include <QFileDialog>
 #include <QStatusBar>
+#include <QMdiSubWindow>
+#include <Standard_WarningsRestore.hxx>
 
 ApplicationTut::ApplicationTut()
     : ApplicationCommonWindow( )
@@ -23,7 +28,7 @@ void ApplicationTut::createMakeBottleOperation(){
   MakeBottleAction->setToolTip( QObject::tr( "TBR_MAKEBOT" ) );
   MakeBottleAction->setStatusTip( QObject::tr("TBR_MAKEBOT") );
   MakeBottleAction->setShortcut( QObject::tr( "CTRL+M" ) );
-       connect( MakeBottleAction, SIGNAL( activated() ) , this, SLOT( onMakeBottleAction() ) );
+       connect( MakeBottleAction, SIGNAL( triggered() ) , this, SLOT( onMakeBottleAction() ) );
        
        myMakeBottleBar = addToolBar( tr( "Make Bottle" ) );
   insertToolBar( getCasCadeBar(), myMakeBottleBar );
@@ -33,7 +38,7 @@ void ApplicationTut::createMakeBottleOperation(){
 
 void ApplicationTut::updateFileActions()
 {
-  if ( getWorkspace()->windowList().isEmpty() )
+  if ( getWorkspace()->subWindowList().isEmpty() )
   {
          if ( !isDocument() )
                {
@@ -49,8 +54,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 +63,8 @@ void ApplicationTut::onMakeBottleAction()
 
 QString ApplicationTut::getTutResourceDir()
 {
-    static QString resDir( ::getenv( "CSF_TutorialResourcesDefaults" ) );
-    return resDir;
+  static QString resDir (OSD_Environment ("CSF_TutorialResourcesDefaults").Value().ToCString());
+  if (resDir.isEmpty())
+    resDir = QString (OSD_Environment ("CSF_OCCTResourcePath").Value().ToCString()) + "/samples";
+  return resDir;
 }
-