From 48a27c798fd1c130ffe82283d89b72b129aa2318 Mon Sep 17 00:00:00 2001 From: rkv Date: Mon, 11 Nov 2013 10:48:16 +0000 Subject: [PATCH] Fix for the bug #37: Error when import image with format not supported. --- src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx | 13 ++++++++++++- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx index c31cbdb6..862876e6 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx @@ -24,12 +24,16 @@ #include "HYDROGUI_PrsImage.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Module.h" #include #include +#include #include #include +#include +#include #include #include @@ -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 ); diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index bb8bf240..e2fcf529 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -15,6 +15,10 @@ CASE_REGIONS Regions + + FILE_CAN_NOT_BE_IMPORTED + The file '%1' can not be imported: format *.%2 is not supported. + FILE_NOT_EXISTS_OR_CANT_BE_READ The file '%1' -- 2.39.2