]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
getFileName() function is defined as pure virtual public in the SUIT_Application...
authorvsr <vsr@opencascade.com>
Fri, 17 Jun 2005 07:04:45 +0000 (07:04 +0000)
committervsr <vsr@opencascade.com>
Fri, 17 Jun 2005 07:04:45 +0000 (07:04 +0000)
src/CAF/CAF_Application.cxx
src/GLViewer/GLViewer_ViewFrame.cxx
src/GLViewer/resources/GLViewer_msg_en.po
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/Plot2d/Plot2d_ViewFrame.cxx
src/Plot2d/resources/Plot2d_msg_en.po
src/SVTK/SVTK_ViewWindow.cxx
src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx
src/VTKViewer/VTKViewer_ViewWindow.cxx

index 1ce1d0f3063d2c1f89aca2e6873830137a6d0272..3a069fdcb9275ad3d0d486138205ee900b16c711 100755 (executable)
@@ -15,7 +15,6 @@
 #include <qmenubar.h>
 #include <qpopupmenu.h>
 #include <qstatusbar.h>
-#include <qfiledialog.h>
 #include <qapplication.h>
 
 extern "C" CAF_EXPORT SUIT_Application* createApplication()
@@ -175,4 +174,4 @@ void CAF_Application::updateCommandsStatus()
 void CAF_Application::onHelpAbout()
 {
   SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" );
-}
\ No newline at end of file
+}
index 5e9e173802a3e5b42b5b93217987b639a629e77b..14e2305abae6ac18696a2dade2e0e02d1a9dd413 100644 (file)
 #include "GLViewer_ViewPort2d.h"
 
 #include <SUIT_Desktop.h>
+#include <SUIT_Application.h>
 #include <SUIT_Session.h>
 #include <SUIT_ToolButton.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_Tools.h>
 #include <QtxAction.h>
 #include <SUIT_MessageBox.h>
 
 #include <qcolor.h>
-#include <qfiledialog.h>
 #include <qimage.h>
 #include <qlayout.h>
 #include <qstring.h>
@@ -383,39 +384,22 @@ void GLViewer_ViewFrame::onViewDump()
 
     delete [] imageBits;
 
-    QString aFilter( "*.bmp\n*.png" );
+    SUIT_Application* app = getViewManager()->study()->application();
 
-    QFileDialog aFileDlg( QDir::current().absPath(), aFilter, this );
-    aFileDlg.setCaption( tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ) );
-    aFileDlg.setMode( QFileDialog::AnyFile );
+    QString aFileName = app->getFileName( false, QString::null, QString( "*.bmp;*.png" ), tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ), 0 );
 
-    if( !aFileDlg.exec() )
-        return;
-
-    QString aFileName = aFileDlg.selectedFile();
-    QString aFileExt = aFileDlg.selectedFilter();
-
-    if( aFileName.isEmpty() )
-    {
-        SUIT_MessageBox::error1( this,
-                                tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ),
-                                tr( "DUMP_VIEW_ERROR_DLG_TEXT" ),
-                                tr( "BUT_OK" ) );
-    }
+    if( aFileName.isEmpty() ) // cancelled
+      return;
 
-    QString aSaveOp = "BMP";
-    QString aTypedFileExt = QFileInfo( aFileName ).extension( false ).lower();
+    QString aSaveOp = SUIT_Tools::extension( aFileName ).upper();
 
-    if( aFileExt == "*.bmp" )
-    {
-        if( aTypedFileExt.isEmpty() )
-            aFileName += ".bmp";
-        aSaveOp = "BMP";
+    if ( aSaveOp != "BMP" && aSaveOp != "PNG" ) {
+      SUIT_MessageBox::error1( this,
+                              tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ),
+                              tr( "DUMP_VIEW_ERROR_UNSUPPORTED_FORMAT" ).arg( aSaveOp ),
+                              tr( "BUT_OK" ) );
+      return;
     }
-    else if( aFileExt == "*.png" )
-        if( aTypedFileExt.isEmpty() )
-            aFileName += ".png";
-        aSaveOp = "PNG";
 
     if( !anImage.save( aFileName, aSaveOp ) )
     {
index f6a8cdab7d313345fa5f20f9a6381ae817628c49..ca1b5e351a19b3ffcd4a4319185c07838c829215 100644 (file)
@@ -81,10 +81,13 @@ msgid "GLViewer_Viewer2d::CHANGE_BGCOLOR"
 msgstr "Change background..."
 
 msgid "GLViewer_ViewFrame::DUMP_VIEW_SAVE_FILE_DLG_CAPTION"
-msgstr "Save Dump View in file"
+msgstr "Dump View"
 
 msgid "GLViewer_ViewFrame::DUMP_VIEW_ERROR_DLG_CAPTION"
 msgstr "Error"
 
 msgid "GLViewer_ViewFrame::DUMP_VIEW_ERROR_DLG_TEXT"
-msgstr "Can't save Dump View in file"
+msgstr "Dump view operation failed."
+
+msgid "GLViewer_ViewFrame::DUMP_VIEW_ERROR_UNSUPPORTED_FORMAT"
+msgstr "Can't dump view. Unsupported image format: %1."
index 58df1e2456b29cb58efe4202c0de5ca106e148c7..eae8cda773fc5ec2554955644185a99a8c05d04c 100755 (executable)
@@ -13,7 +13,6 @@
 
 #include "SUIT_Tools.h"
 #include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
 #include "SUIT_MessageBox.h"
 
 #include <qptrlist.h>
@@ -22,7 +21,7 @@
 #include <qcolor.h>
 #include <qpainter.h>
 #include <qapplication.h>
-
+#include <qdatetime.h>
 
 const char* imageZoomCursor[] = { 
 "32 32 3 1",
@@ -778,19 +777,18 @@ void OCCViewer_ViewWindow::onDumpView()
   QPixmap px = QPixmap::grabWindow(myViewPort->winId());
   QApplication::restoreOverrideCursor();
   
-  QString fileName = SUIT_FileDlg::getFileName(this,
-                                             QString::null,
-                                             tr("OCC_IMAGE_FILES"),
-                                             tr("INF_APP_DUMP_VIEW"),
-                                             false);
-  if (!fileName.isNull()) {
+  SUIT_Application* app = getViewManager()->study()->application();
+
+  QString aFileName = app->getFileName( false, QString::null, tr("OCC_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
+
+  if ( !aFileName.isNull() ) {
     QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension(fileName).upper();
+    QString fmt = SUIT_Tools::extension( aFileName ).upper();
     if (fmt.isEmpty())
       fmt = QString("BMP"); // default format
     if (fmt == "JPG")
       fmt = "JPEG";
-    bool bOk = px.save(fileName, fmt.latin1());
+    bool bOk = px.save(aFileName, fmt.latin1());
     QApplication::restoreOverrideCursor();
     if (!bOk) {
       SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
index fa5105239f8d26a9dc38238b6a19872075604ce6..a5f7abd2a205b50393de0c5d003e3b49db2c1bea 100755 (executable)
@@ -7,10 +7,10 @@
 #include "Plot2d_SetupViewDlg.h"
 
 #include "SUIT_Tools.h"
-#include "SUIT_FileDlg.h"
 #include "SUIT_Session.h"
 #include "SUIT_MessageBox.h"
 #include "SUIT_ResourceMgr.h"
+#include "SUIT_Application.h"
 
 //#include "utilities.h"
 
@@ -1470,21 +1470,20 @@ void Plot2d_ViewFrame::onDump()
   QApplication::setOverrideCursor( Qt::waitCursor );
   QPixmap px = QPixmap::grabWindow(winId());
   QApplication::restoreOverrideCursor();
-  
-  QString fileName = SUIT_FileDlg::getFileName(this,
-                QString::null,
-                tr("OCC_IMAGE_FILES"),
-                tr("INF_APP_DUMP_VIEW"),
-                false);
-  if ( !fileName.isNull() )
+
+  SUIT_Application* app = ((Plot2d_ViewWindow*)parent())->getViewManager()->study()->application();
+
+  QString aFileName = app->getFileName( false, QString::null, tr("PLOT2D_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
+
+  if ( !aFileName.isNull() )
   {
     QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension( fileName ).upper();
+    QString fmt = SUIT_Tools::extension( aFileName ).upper();
     if (fmt.isEmpty())
       fmt = QString("BMP"); // default format
     if (fmt == "JPG")
       fmt = "JPEG";
-    bool bOk = px.save(fileName, fmt.latin1());
+    bool bOk = px.save(aFileName, fmt.latin1());
     QApplication::restoreOverrideCursor();
     if (!bOk) {
       SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
index 85bdd225600c6077a3f2384b43e26b5a9c33926d..ce99101b582250e3471af5f53a368d4a527da6ff 100755 (executable)
@@ -126,7 +126,7 @@ msgstr "Coordinates: X : %1, Y : %2 ( %3 )"
 #msgid "INF_READY"
 #msgstr "Ready"
 
-msgid "OCC_IMAGE_FILES"
+msgid "PLOT2D_IMAGE_FILES"
 msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)"
 
 msgid "INF_APP_DUMP_VIEW"
index 0b1901d8b324ab9bfc5105bd622f7645d3b487be..a840bb2f5ed06057231f954a5224242fbc64a3d6 100755 (executable)
@@ -15,7 +15,6 @@
 
 #include "SUIT_Tools.h"
 #include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
 
 #include "VTKViewer_Transform.h"
 #include "VTKViewer_Utilities.h"
@@ -427,19 +426,18 @@ SVTK_ViewWindow
   QPixmap px = QPixmap::grabWindow(myRenderWindow->winId());
   QApplication::restoreOverrideCursor();
   
-  QString fileName = SUIT_FileDlg::getFileName(this,
-                                              QString::null,
-                                              tr("VTK_IMAGE_FILES"),
-                                              tr("INF_APP_DUMP_VIEW"),
-                                              false);
-  if (!fileName.isNull()) {
+  SUIT_Application* app = getViewManager()->study()->application();
+
+  QString aFileName = app->getFileName( false, QString::null, tr("VTK_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
+
+  if ( !aFileName.isNull() ) {
     QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension( fileName ).upper();
+    QString fmt = SUIT_Tools::extension( aFileName ).upper();
     if (fmt.isEmpty())
       fmt = QString("BMP"); // default format
     if (fmt == "JPG")
       fmt = "JPEG";
-    bool bOk = px.save(fileName, fmt.latin1());
+    bool bOk = px.save(aFileName, fmt.latin1());
     QApplication::restoreOverrideCursor();
     if (!bOk) {
       SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
index 81e525bd3a9f710a12270566a49f71d65b28b495..d06d2e0e325a6085e94b7aa40407a9931e147519 100755 (executable)
@@ -31,7 +31,6 @@
 
 #include "SUIT_Application.h"
 #include "SUIT_Desktop.h"
-#include "SUIT_FileDlg.h"
 #include "SUIT_MessageBox.h"
 #include "SUIT_Tools.h"
 #include "SUIT_Session.h"
@@ -45,6 +44,7 @@
 #include <qstringlist.h>
 #include <qregexp.h>
 #include <qvalidator.h>
+#include <qfile.h>
 
 #include <OSD_Process.hxx>
 #include <OSD_Path.hxx>
@@ -333,34 +333,21 @@ void ToolsGUI_CatalogGeneratorDlg::onBrowseBtnClicked()
 {
   QPushButton* send = (QPushButton*)sender();
   
-  QWidget* aParent = SUIT_Session::session()->activeApplication()->desktop();
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
 
   if ( send == myBrowseIdlBtn ) {
-    QString file = myIdlEdit->text().stripWhiteSpace();
-    file = SUIT_FileDlg::getFileName(aParent, 
-                                   file,
-                                   tr("TOOLS_MEN_IMPORT_IDL"),
-                                   tr("TOOLS_MEN_IMPORT"),
-                                   true);
+    QString file = app->getFileName( true, myIdlEdit->text().stripWhiteSpace(), tr("TOOLS_MEN_IMPORT_IDL"), tr("TOOLS_MEN_IMPORT"), 0 );
     if ( !file.isEmpty() ) {
       myIdlEdit->setText(file);
     }
   } 
   else if ( send == myBrowseXmlBtn ) {
-    QString file = SUIT_FileDlg::getFileName(aParent,
-                                           myXmlEdit->text().stripWhiteSpace(),
-                                           tr("TOOLS_MEN_EXPORT_XML"),
-                                           tr("TOOLS_MEN_EXPORT"),
-                                           false);
+    QString file = app->getFileName( false, myXmlEdit->text().stripWhiteSpace(), tr("TOOLS_MEN_EXPORT_XML"), tr("TOOLS_MEN_EXPORT"), 0 );
     if ( !file.isEmpty() ) {
       myXmlEdit->setText(file);
     }
   } else if ( send == myBrowsePngBtn ) {
-    QString file = SUIT_FileDlg::getFileName(aParent,
-                                           myXmlEdit->text().stripWhiteSpace(),
-                                           tr("TOOLS_MEN_IMPORT_PNG"),
-                                           tr("TOOLS_MEN_IMPORT"),
-                                           true);
+    QString file = app->getFileName( true, myPngEdit->text().stripWhiteSpace(), tr("TOOLS_MEN_IMPORT_PNG"), tr("TOOLS_MEN_IMPORT"), 0 );
     if ( !file.isEmpty() ) {
       myPngEdit->setText(file);
     
index 6739715d9713d27b0e71e48f9c48bdb37d1c4f86..124b95097ada791ff47072bfdebbe528c77e047d 100755 (executable)
@@ -13,7 +13,6 @@
 
 #include "SUIT_Tools.h"
 #include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
 
 #include <qapplication.h>
 
@@ -393,20 +392,19 @@ void VTKViewer_ViewWindow::onDumpView()
   QApplication::setOverrideCursor( Qt::waitCursor );
   QPixmap px = QPixmap::grabWindow(myRenderWindow->winId());
   QApplication::restoreOverrideCursor();
-  
-  QString fileName = SUIT_FileDlg::getFileName(this,
-                                              QString::null,
-                                              tr("VTK_IMAGE_FILES"),
-                                              tr("INF_APP_DUMP_VIEW"),
-                                              false);
-  if (!fileName.isNull()) {
+  SUIT_Application* app = getViewManager()->study()->application();
+
+  QString aFileName = app->getFileName( false, QString::null, tr("VTK_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
+  if ( !aFileName.isNull() ) {
     QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension( fileName ).upper();
+    QString fmt = SUIT_Tools::extension( aFileName ).upper();
     if (fmt.isEmpty())
       fmt = QString("BMP"); // default format
     if (fmt == "JPG")
       fmt = "JPEG";
-    bool bOk = px.save(fileName, fmt.latin1());
+    bool bOk = px.save(aFileName, fmt.latin1());
     QApplication::restoreOverrideCursor();
     if (!bOk) {
       SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));