Salome HOME
bos #23995 Porting to Qt 5.12: disable workaround for splitter resize (see bos #14540...
[modules/gui.git] / src / Qtx / QtxPathDialog.h
old mode 100755 (executable)
new mode 100644 (file)
index 22c90d4..8f66ea6
@@ -1,12 +1,34 @@
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 // File:      QtxPathDialog.h
 // Author:    Sergey TELKOV
-
+//
 #ifndef QTXPATHDIALOG_H
 #define QTXPATHDIALOG_H
 
 #include "QtxDialog.h"
 
-#include <qmap.h>
+#include <QMap>
 
 class QFrame;
 class QLineEdit;
@@ -22,10 +44,12 @@ class QTX_EXPORT QtxPathDialog : public QtxDialog
   Q_OBJECT
 
 protected:
-  QtxPathDialog( QWidget* = 0, const bool = true, const bool = false, const int = Standard, WFlags = 0 );
+  QtxPathDialog( QWidget* = 0, const bool = true, const bool = false,
+                 const int = Standard, Qt::WindowFlags = 0 );
 
 public:
-  QtxPathDialog( const bool, QWidget* = 0, const bool = true, const bool = false, const int = Standard, WFlags = 0 );
+  QtxPathDialog( const bool, QWidget* = 0, const bool = true,
+                 const bool = false, const int = Standard, Qt::WindowFlags = 0 );
   virtual ~QtxPathDialog();
 
   QString            fileName() const;
@@ -34,11 +58,12 @@ public:
   QString            filter() const;
   void               setFilter( const QString& );
 
-  virtual void       show();
-
 signals:
   void               fileNameChanged( QString );
 
+public slots:
+  virtual void       setVisible( bool );
+
 protected slots:
   void               validate();
 
@@ -56,33 +81,37 @@ protected:
   QString            fileName( const int ) const;
   void               setFileName( const int, const QString&, const bool = false );
 
+  QString            filter( const int ) const;
+  void               setFilter( const int, const QString& );
+
   QLineEdit*         fileEntry( const int ) const;
   QLineEdit*         fileEntry( const int, int& ) const;
-  int                createFileEntry( const QString&, const int, const int = -1 );
+  int                createFileEntry( const QString&, const int,
+                                      const QString& = QString(), const int = -1 );
 
   int                defaultEntry() const;
   void               setDefaultEntry( const int );
 
 private:
   void               initialize();
-  QStringList        prepareFilters() const;
-       bool               hasVisibleChildren( QWidget* ) const;
+  void               updateVisibility();
+  QStringList        prepareFilters( const QString& ) const;
+        bool               hasVisibleChildren( QWidget* ) const;
   QStringList        filterWildCards( const QString& ) const;
-  QString            autoExtension( const QString&, const QString& = QString::null ) const;
+  QString            autoExtension( const QString&, const QString& = QString() ) const;
 
 protected:
   enum { OpenFile, SaveFile, OpenDir, SaveDir, NewDir };
 
 private:
-  typedef struct { int mode; QLineEdit* edit;
+  typedef struct { int mode; QLineEdit* edit; QString filter;
                    QPushButton* btn; QFileDialog* dlg; } FileEntry;
   typedef QMap<int, FileEntry> FileEntryMap;
 
 private:
-  QString            myFilter;
   FileEntryMap       myEntries;
   int                myDefault;
-  QFrame*            myEntriesFrame;
+  QWidget*           myEntriesFrame;
   QFrame*            myOptionsFrame;
 };