1 // SALOME SALOMEGUI : GUI of VISU module
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : VisuGUI_FileDlg.cxx
10 // $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/VISUGUI/Visu_FileDlg.cxx
13 #include <qapplication.h>
14 #include <qpushbutton.h>
15 #include <qcheckbox.h>
19 #include "VISUConfig.hh"
20 #include "VisuGUI_FileDlg.h"
21 #include "SUIT_ResourceMgr.h"
25 bool VisuGUI_FileDlg::IsBuild = false;
30 VisuGUI_FileDlg::VisuGUI_FileDlg (QWidget* parent,
34 SUIT_FileDlg(parent, open, showQuickDir, modal)
36 myCBuildAll = new QCheckBox (tr("FULL_LOAD"), this);
37 QLabel* label = new QLabel("", this);
38 label->setMaximumWidth(0);
39 QPushButton* pb = new QPushButton(this);
40 pb->setMaximumWidth(0);
41 addWidgets( label, myCBuildAll, pb );
42 bool toBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false);
43 if (toBuildAll) myCBuildAll->setChecked(true);
49 VisuGUI_FileDlg::~VisuGUI_FileDlg()
54 Processes selection : tries to set given path or filename as selection
56 bool VisuGUI_FileDlg::processPath( const QString& path )
58 if ( !path.isNull() ) {
63 else if ( fi.isDir() )
68 if ( QFileInfo( fi.dirPath() ).exists() ) {
69 setDir( fi.dirPath() );
78 Returns the file name for Open/Save [ static ]
80 QString VisuGUI_FileDlg::getFileName( QWidget* parent,
81 const QString& initial,
82 const QStringList& filters,
83 const QString& caption,
86 SUIT_FileValidator* validator )
88 VisuGUI_FileDlg* fd = new VisuGUI_FileDlg( parent, open, showQuickDir, true );
89 if ( !caption.isEmpty() )
90 fd->setCaption( caption );
91 if ( !initial.isEmpty() ) {
92 fd->processPath( initial ); // VSR 24/03/03 check for existing of directory has been added to avoid QFileDialog's bug
94 fd->setFilters( filters );
96 fd->setValidator( validator );
98 QString filename = fd->selectedFile();
100 VisuGUI_FileDlg::IsBuild = fd->IsChecked();
103 qApp->processEvents();
108 bool VisuGUI_FileDlg::IsChecked()
110 return myCBuildAll->isChecked();