]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Fix for the bug #37: Error when import image with format not supported.
authorrkv <rkv@opencascade.com>
Mon, 11 Nov 2013 10:48:16 +0000 (10:48 +0000)
committerrkv <rkv@opencascade.com>
Mon, 11 Nov 2013 10:48:16 +0000 (10:48 +0000)
src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index c31cbdb62671fcbd17d8ceac1ad803288de48add..862876e6b2436d87e70e8efe96451a0d9cf47cb3 100644 (file)
 
 #include "HYDROGUI_PrsImage.h"
 #include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Module.h"
 
 #include <HYDROData_Lambert93.h>
 #include <HYDROData_Image.h>
 
+#include <LightApp_Application.h>
 #include <SUIT_FileDlg.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
 #include <SUIT_Session.h>
 
 #include <QtxDoubleSpinBox.h>
@@ -605,7 +609,14 @@ void HYDROGUI_ImportImageDlg::onBrowse()
   if( !aFileName.isEmpty() )
   {
     QImage anImage( aFileName );
-    if( !anImage.isNull() )
+    if( anImage.isNull() )
+    {
+      QString aTitle = QObject::tr( "INPUT_VALID_DATA" );
+      QString aMessage = QObject::tr( "FILE_CAN_NOT_BE_IMPORTED" ).
+        arg( aFileName ).arg( QFileInfo( aFileName ).suffix() );
+      SUIT_MessageBox::warning( module()->getApp()->desktop(), aTitle, aMessage );
+    }
+    else
     {
       myFileName->setText( aFileName );
       emit createPreview( anImage );
index bb8bf240fd962cb868ff2fa7259105592cee7a09..e2fcf52914b1e819142069753be3fd35d874f523 100644 (file)
       <source>CASE_REGIONS</source>
       <translation>Regions</translation>
     </message>
+    <message>
+      <source>FILE_CAN_NOT_BE_IMPORTED</source>
+      <translation>The file '%1' can not be imported: format *.%2 is not supported.</translation>
+    </message>
     <message>
       <source>FILE_NOT_EXISTS_OR_CANT_BE_READ</source>
       <translation>The file '%1'