]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
refs #1431
authorisn <isn@opencascade.com>
Wed, 22 Nov 2017 13:32:27 +0000 (16:32 +0300)
committerisn <isn@opencascade.com>
Wed, 22 Nov 2017 13:33:32 +0000 (16:33 +0300)
src/SUIT/SUIT_ViewWindow.cxx
src/SUIT/resources/SUIT_msg_en.ts

index e8beaf491e60d99c20f30c17fbfecf8ec8f0d79d..040926319f35426dbc65eb8f0e08669553dd461d 100755 (executable)
@@ -32,6 +32,7 @@
 #include "SUIT_Application.h"
 #include "SUIT_ViewManager.h"
 #include "SUIT_ResourceMgr.h"
+#include "SUIT_FileDlg.h"
 #include "QtxActionToolMgr.h"
 #include "QtxMultiAction.h"
 
@@ -195,27 +196,33 @@ bool SUIT_ViewWindow::event( QEvent* e )
   if ( e->type() == DUMP_EVENT )
   {
     bool bOk = false;
-    if ( myManager && myManager->study() && myManager->study()->application() )
+    SUIT_Application* app = NULL;
+    if (myManager && myManager->study() && myManager->study()->application())
+      app = myManager->study()->application();
+    bool IncludePs = true;
+    QString fileName;
+    if (app)
+      fileName = app->getFileName( false, QString(), filter(IncludePs), tr( "TLT_DUMP_VIEW" ), 0 ); //old way
+    else
     {
-      // get file name
-      SUIT_Application* app = myManager->study()->application();
-      bool IncludePs = true; //TODO for oscar only
-      QString fileName = app->getFileName( false, QString(), filter(IncludePs), tr( "TLT_DUMP_VIEW" ), 0 );
-      if ( !fileName.isEmpty() )
+      QStringList fls = filter(IncludePs).split( ";;", QString::SkipEmptyParts );
+      fileName = SUIT_FileDlg::getFileName( NULL, QString(), fls, tr( "TLT_DUMP_VIEW" ), false, true );
+    }
+    if ( !fileName.isEmpty() )
+    {
+      QString fmt = SUIT_Tools::extension( fileName ).toUpper();
+      if (fmt == "PS" || fmt == "EPS" )
+        bOk = dumpViewToPSFormat(fileName);
+      else
       {
-        QString fmt = SUIT_Tools::extension( fileName ).toUpper();
-        if (fmt == "PS" || fmt == "EPS" )
-          bOk = dumpViewToPSFormat(fileName);
-        else
-        {
-          QImage im = dumpView();      
-          Qtx::Localizer loc;
-          bOk = dumpViewToFormat( im, fileName, fmt );
-        }
+        QImage im = dumpView();        
+        Qtx::Localizer loc;
+        bOk = dumpViewToFormat( im, fileName, fmt );
       }
-      else
-       bOk = true; // cancelled
     }
+    else
+      bOk = true; // cancelled
+
     if ( !bOk )
       SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );
 
index 6f7991d9848524cff1bd0bf38db43caf93d045b0..5c3012b86c0dd1133305a0a569dbda5ef7f83bdb 100644 (file)
@@ -164,4 +164,19 @@ Do you want to overwrite it?</translation>
         <translation>All files (*)</translation>
     </message>
 </context>
+<context>
+    <name>SUIT_ViewWindow</name>
+    <message>
+        <source>TLT_DUMP_VIEW</source>
+        <translation>Dump view to file</translation>
+    </message>
+    <message>
+        <source>TLT_IMAGE_FILES</source>
+        <translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
+    </message>
+    <message>
+        <source>POSTSCRIPT_FILES</source>
+        <translation>PostScript files (*.ps *.eps)</translation>
+    </message>
+</context>     
 </TS>