1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : VisuGUI_FileDlg.cxx
23 // $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/VISUGUI/Visu_FileDlg.cxx
26 #include <qapplication.h>
27 #include <qpushbutton.h>
28 #include <qcheckbox.h>
32 #include "VISUConfig.hh"
33 #include "VisuGUI_FileDlg.h"
34 #include "SUIT_ResourceMgr.h"
38 bool VisuGUI_FileDlg::IsBuild = false;
43 VisuGUI_FileDlg::VisuGUI_FileDlg (QWidget* parent,
47 SUIT_FileDlg(parent, open, showQuickDir, modal)
49 myCBuildAll = new QCheckBox (tr("FULL_LOAD"), this);
50 QLabel* label = new QLabel("", this);
51 label->setMaximumWidth(0);
52 QPushButton* pb = new QPushButton(this);
53 pb->setMaximumWidth(0);
54 addWidgets( label, myCBuildAll, pb );
55 bool toBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false);
56 if (toBuildAll) myCBuildAll->setChecked(true);
62 VisuGUI_FileDlg::~VisuGUI_FileDlg()
67 Processes selection : tries to set given path or filename as selection
69 bool VisuGUI_FileDlg::processPath( const QString& path )
71 if ( !path.isNull() ) {
76 else if ( fi.isDir() )
81 if ( QFileInfo( fi.dirPath() ).exists() ) {
82 setDir( fi.dirPath() );
91 Returns the file name for Open/Save [ static ]
93 QString VisuGUI_FileDlg::getFileName( QWidget* parent,
94 const QString& initial,
95 const QStringList& filters,
96 const QString& caption,
99 SUIT_FileValidator* validator )
101 VisuGUI_FileDlg* fd = new VisuGUI_FileDlg( parent, open, showQuickDir, true );
102 if ( !caption.isEmpty() )
103 fd->setCaption( caption );
104 if ( !initial.isEmpty() ) {
105 fd->processPath( initial ); // VSR 24/03/03 check for existing of directory has been added to avoid QFileDialog's bug
107 fd->setFilters( filters );
109 fd->setValidator( validator );
111 QString filename = fd->selectedFile();
113 VisuGUI_FileDlg::IsBuild = fd->IsChecked();
116 qApp->processEvents();
121 bool VisuGUI_FileDlg::IsChecked()
123 return myCBuildAll->isChecked();