Back to index

salome-smesh  6.5.0
SMESHGUI_FileInfoDlg.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // SMESH SMESHGUI : GUI for SMESH component
00021 // File   : SMESHGUI_FileInfoDlg.cxx
00022 // Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com)
00023 //
00024 #include "SMESHGUI_FileInfoDlg.h"
00025 
00026 #include <MED_Common.hxx>
00027 
00028 #include <QGridLayout>
00029 #include <QLabel>
00030 #include <QLineEdit>
00031 
00032 SMESHGUI_FileInfoDlg::SMESHGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf )
00033   : QtxDialog( parent, true, true, QtxDialog::OK )
00034 {
00035   setWindowTitle( tr( "CAPTION" ) );
00036   setSizeGripEnabled( true );
00037   
00038   QLineEdit* fname = new QLineEdit( mainFrame() );
00039   fname->setReadOnly( true );
00040   QLineEdit* fsize = new QLineEdit( mainFrame() );
00041   fsize->setReadOnly( true );
00042   QLineEdit* medversion = new QLineEdit( mainFrame() );
00043   medversion->setReadOnly( true );
00044   fname->setMinimumWidth( 300 );
00045   
00046   QGridLayout* lay = new QGridLayout( mainFrame() );
00047   lay->setMargin( 5 ); lay->setSpacing( 5 );
00048   lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 );
00049   lay->addWidget( fname, 0, 1 );
00050   lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 );
00051   lay->addWidget( fsize, 1, 1 );
00052   lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 );
00053   lay->addWidget( medversion, 2, 1 );
00054 
00055   fname->setText( (char*)inf->fileName );
00056   fname->home( false );
00057   fsize->setText( QString::number( inf->fileSize ) );
00058 
00059   QString version;
00060   if( inf->major>=0 )
00061   {
00062     version = QString::number( inf->major );
00063     if( inf->minor>=0 )
00064     {
00065       version += "." + QString::number( inf->minor );
00066       if( inf->release>=0 )
00067         version += "." + QString::number( inf->release );
00068     }
00069   }
00070   medversion->setText( version );
00071 }
00072 
00073 SMESHGUI_FileInfoDlg::~SMESHGUI_FileInfoDlg()
00074 {
00075 }