Salome HOME
Merge from V6_5_BR 05/06/2012
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FileInfoDlg.cxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // SMESH SMESHGUI : GUI for SMESH component
21 // File   : SMESHGUI_FileInfoDlg.cxx
22 // Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com)
23 //
24 #include "SMESHGUI_FileInfoDlg.h"
25
26 #include <MED_Common.hxx>
27
28 #include <QGridLayout>
29 #include <QLabel>
30 #include <QLineEdit>
31
32 SMESHGUI_FileInfoDlg::SMESHGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf )
33   : QtxDialog( parent, true, true, QtxDialog::OK )
34 {
35   setWindowTitle( tr( "CAPTION" ) );
36   setSizeGripEnabled( true );
37   
38   QLineEdit* fname = new QLineEdit( mainFrame() );
39   fname->setReadOnly( true );
40   QLineEdit* fsize = new QLineEdit( mainFrame() );
41   fsize->setReadOnly( true );
42   QLineEdit* medversion = new QLineEdit( mainFrame() );
43   medversion->setReadOnly( true );
44   fname->setMinimumWidth( 300 );
45   
46   QGridLayout* lay = new QGridLayout( mainFrame() );
47   lay->setMargin( 5 ); lay->setSpacing( 5 );
48   lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 );
49   lay->addWidget( fname, 0, 1 );
50   lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 );
51   lay->addWidget( fsize, 1, 1 );
52   lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 );
53   lay->addWidget( medversion, 2, 1 );
54
55   fname->setText( (char*)inf->fileName );
56   fname->home( false );
57   fsize->setText( QString::number( inf->fileSize ) );
58
59   QString version;
60   if( inf->major>=0 )
61   {
62     version = QString::number( inf->major );
63     if( inf->minor>=0 )
64     {
65       version += "." + QString::number( inf->minor );
66       if( inf->release>=0 )
67         version += "." + QString::number( inf->release );
68     }
69   }
70   medversion->setText( version );
71 }
72
73 SMESHGUI_FileInfoDlg::~SMESHGUI_FileInfoDlg()
74 {
75 }