]> SALOME platform Git repositories - modules/gui.git/blob - src/SUIT/SUIT_FileDlg.h
Salome HOME
2e0d02d99f851edfe1a5e8673522282d0e85e84a
[modules/gui.git] / src / SUIT / SUIT_FileDlg.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : SUIT_FileDlg.h
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
24 //
25 #ifndef SUIT_FILEDLG_H
26 #define SUIT_FILEDLG_H
27
28 #include "SUIT.h"
29
30 #include <QFileDialog>
31
32 class QLabel;
33 class QLineEdit;
34 class QComboBox;
35 class QPushButton;
36 class SUIT_FileValidator;
37
38 class SUIT_EXPORT SUIT_FileDlg : public QFileDialog
39 {
40   Q_OBJECT
41
42 public:
43   SUIT_FileDlg( QWidget*, bool, bool = true, bool = true );
44   virtual ~SUIT_FileDlg();
45
46   bool                isOpenDlg()    const;    
47   
48   bool                checkPermissions() const;
49   void                setCheckPermissions( const bool );
50
51   SUIT_FileValidator* validator() const;
52   void                setValidator( SUIT_FileValidator* );
53
54   bool                addWidgets( QWidget*, QWidget*, QWidget* );
55
56   QStringList         selectedFiles() const;
57   QString             selectedFile() const;
58
59   void selectFile( const QString& );
60
61   static QString      getLastVisitedDirectory();
62
63   static QString      getFileName( QWidget*, 
64                                    const QString&, 
65                                    const QStringList&, 
66                                    const QString& = QString(), 
67                                    const bool = true, 
68                                    const bool = true,
69                                    SUIT_FileValidator* = 0 );
70   static QString      getFileName( QWidget*, 
71                                    const QString&, 
72                                    const QString&,
73                                    const QString& = QString(), 
74                                    const bool = true,
75                                    const bool = true,
76                                    SUIT_FileValidator* = 0 );
77
78   static QStringList  getOpenFileNames( QWidget*, 
79                                         const QString&,
80                                         const QStringList&, 
81                                         const QString& = QString(),
82                                         const bool = true, 
83                                         SUIT_FileValidator* = 0 );
84   static QStringList  getOpenFileNames( QWidget*, 
85                                         const QString&,
86                                         const QString&, 
87                                         const QString& = QString(),
88                                         const bool = true, 
89                                         SUIT_FileValidator* = 0 );
90
91   static QString      getExistingDirectory( QWidget*, 
92                                             const QString&,
93                                             const QString& = QString(), 
94                                             const bool = true,
95                                             SUIT_FileValidator* = 0 );
96
97   static QString      getLastVisitedPath();
98
99 protected:
100   virtual bool        event( QEvent* );
101   QLineEdit*          lineEdit() const;
102   virtual bool        acceptData();
103   QString             addExtension( const QString& ) const;
104   bool                processPath( const QString& );
105   void                addFilter( const QString& );
106   static bool         hasWildCards( const QString& );
107
108 protected slots:
109   void                accept();        
110   void                quickDir( const QString& );
111   void                addQuickDir();
112
113 private:
114   void                polish();
115
116 private:
117   SUIT_FileValidator* myValidator;        //!< file validator
118   QLabel*             myQuickLab;         //!< quick dir combo box
119   QComboBox*          myQuickCombo;       //!< quick dir combo box
120   QPushButton*        myQuickButton;      //!< quick dir add button
121   bool                myCheckPermissions; //!< check permissions option
122   static QString      myLastVisitedPath;  //!< last visited path
123 };
124
125 #endif  // SUIT_FILEDLG_H