Salome HOME
78803f5f8980c7c5a0ed680e28acef9c697cd1c9
[modules/visu.git] / src / VISUGUI / VisuGUI_FileInfoDlg.cxx
1 // Copyright (C) 2007-2011  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 // VISU VISUGUI : GUI of VISU component
21 // File   : VisuGUI_FileInfoDlg.cxx
22 // Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. ( alexander.solovyov@opencascade.com)
23 // Module : VISU
24 //
25 #include "VisuGUI_FileInfoDlg.h"
26
27 #include <MED_Common.hxx>
28
29 #include <QGridLayout>
30 #include <QLabel>
31 #include <QLineEdit>
32
33 VisuGUI_FileInfoDlg::VisuGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf )
34   : QtxDialog( parent, true, true, QtxDialog::OK )
35 {
36   setWindowTitle( tr( "CAPTION" ) );
37   setSizeGripEnabled( true );
38   
39   QLineEdit* fname = new QLineEdit( mainFrame() );
40   fname->setReadOnly( true );
41   QLineEdit* fsize = new QLineEdit( mainFrame() );
42   fsize->setReadOnly( true );
43   QLineEdit* medversion = new QLineEdit( mainFrame() );
44   medversion->setReadOnly( true );
45   fname->setMinimumWidth( 300 );
46   
47   QGridLayout* lay = new QGridLayout( mainFrame() );
48   lay->setMargin( 5 ); lay->setSpacing( 5 );
49   lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 );
50   lay->addWidget( fname, 0, 1 );
51   lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 );
52   lay->addWidget( fsize, 1, 1 );
53   lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 );
54   lay->addWidget( medversion, 2, 1 );
55
56   fname->setText( (char*)inf->fileName );
57   fname->home( false );
58   fsize->setText( QString::number( inf->fileSize ) );
59
60   QString version;
61   if( inf->major>=0 )
62   {
63     version = QString::number( inf->major );
64     if( inf->minor>=0 )
65     {
66       version += "." + QString::number( inf->minor );
67       if( inf->release>=0 )
68         version += "." + QString::number( inf->release );
69     }
70   }
71   medversion->setText( version );
72 }
73
74 VisuGUI_FileInfoDlg::~VisuGUI_FileInfoDlg()
75 {
76 }