Back to index

salome-gui  6.5.0
SUIT_FileDlg.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File   : SUIT_FileDlg.h
00024 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
00025 //
00026 #ifndef SUIT_FILEDLG_H
00027 #define SUIT_FILEDLG_H
00028 
00029 #include "SUIT.h"
00030 
00031 #include <QFileDialog>
00032 
00033 class QLabel;
00034 class QLineEdit;
00035 class QComboBox;
00036 class QPushButton;
00037 class QUrl;
00038 class SUIT_FileValidator;
00039 
00040 class SUIT_EXPORT SUIT_FileDlg : public QFileDialog
00041 {
00042   Q_OBJECT
00043 
00044 public:
00045   SUIT_FileDlg( QWidget*, bool, bool = true, bool = true );
00046   virtual ~SUIT_FileDlg();
00047 
00048   bool                isOpenDlg()    const;    
00049   
00050   bool                checkPermissions() const;
00051   void                setCheckPermissions( const bool );
00052 
00053   SUIT_FileValidator* validator() const;
00054   void                setValidator( SUIT_FileValidator* );
00055 
00056   bool                addWidgets( QWidget*, QWidget*, QWidget* );
00057 
00058   QStringList         selectedFiles() const;
00059   QString             selectedFile() const;
00060 
00061   void selectFile( const QString& );
00062 
00063   static QString      getLastVisitedDirectory();
00064 
00065   static QString      getFileName( QWidget*, 
00066                                    const QString&, 
00067                                    const QStringList&, 
00068                                    const QString& = QString(), 
00069                                    const bool = true, 
00070                                    const bool = true,
00071                                    SUIT_FileValidator* = 0 );
00072   static QString      getFileName( QWidget*, 
00073                                    const QString&, 
00074                                    const QString&,
00075                                    const QString& = QString(), 
00076                                    const bool = true,
00077                                    const bool = true,
00078                                    SUIT_FileValidator* = 0 );
00079 
00080   static QStringList  getOpenFileNames( QWidget*, 
00081                                         const QString&,
00082                                         const QStringList&, 
00083                                         const QString& = QString(),
00084                                         const bool = true, 
00085                                         SUIT_FileValidator* = 0 );
00086   static QStringList  getOpenFileNames( QWidget*, 
00087                                         const QString&,
00088                                         const QString&, 
00089                                         const QString& = QString(),
00090                                         const bool = true, 
00091                                         SUIT_FileValidator* = 0 );
00092 
00093   static QString      getExistingDirectory( QWidget*, 
00094                                             const QString&,
00095                                             const QString& = QString(), 
00096                                             const bool = true,
00097                                             SUIT_FileValidator* = 0 );
00098 
00099   static QString      getLastVisitedPath();
00100 
00101 protected:
00102   virtual bool        event( QEvent* );
00103   QLineEdit*          lineEdit() const;
00104   virtual bool        acceptData();
00105   QString             addExtension( const QString& ) const;
00106   bool                processPath( const QString& );
00107   void                addFilter( const QString& );
00108   static bool         hasWildCards( const QString& );
00109 
00110 protected slots:
00111   void                accept();        
00112   void                quickDir( const QString& );
00113   void                addQuickDir();
00114 
00115 private:
00116   void                polish();
00117 
00118 private:
00119   SUIT_FileValidator* myValidator;        
00120   QLabel*             myQuickLab;         
00121   QComboBox*          myQuickCombo;       
00122   QList<QUrl>         myUrls;             
00123   QPushButton*        myQuickButton;      
00124   bool                myCheckPermissions; 
00125   static QString      myLastVisitedPath;  
00126 };
00127 
00128 #endif  // SUIT_FILEDLG_H