Salome HOME
0021803: EDF 2351 : Available versions of MED in TUI function ExportMED aren't consis...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FileInfoDlg.cxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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 <QGridLayout>
27 #include <QLabel>
28 #include <QLineEdit>
29
30 SMESHGUI_FileInfoDlg::SMESHGUI_FileInfoDlg( QWidget* parent, SMESH::MedFileInfo* inf )
31   : QtxDialog( parent, true, true, QtxDialog::OK )
32 {
33   setWindowTitle( tr( "CAPTION" ) );
34   setSizeGripEnabled( true );
35   
36   QLineEdit* fname = new QLineEdit( mainFrame() );
37   fname->setReadOnly( true );
38   QLineEdit* fsize = new QLineEdit( mainFrame() );
39   fsize->setReadOnly( true );
40   QLineEdit* medversion = new QLineEdit( mainFrame() );
41   medversion->setReadOnly( true );
42   fname->setMinimumWidth( 300 );
43   
44   QGridLayout* lay = new QGridLayout( mainFrame() );
45   lay->setMargin( 5 ); lay->setSpacing( 5 );
46   lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 );
47   lay->addWidget( fname, 0, 1 );
48   lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 );
49   lay->addWidget( fsize, 1, 1 );
50   lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 );
51   lay->addWidget( medversion, 2, 1 );
52
53   fname->setText( (char*)inf->fileName );
54   fname->home( false );
55   fsize->setText( QString::number( inf->fileSize ) );
56
57   QString version;
58   if( inf->major>=0 )
59   {
60     version = QString::number( inf->major );
61     if( inf->minor>=0 )
62     {
63       version += "." + QString::number( inf->minor );
64       if( inf->release>=0 )
65         version += "." + QString::number( inf->release );
66     }
67   }
68   medversion->setText( version );
69 }
70
71 SMESHGUI_FileInfoDlg::~SMESHGUI_FileInfoDlg()
72 {
73 }