ResourceChooser.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file ResourceChooser.h
22 
23  \brief Defines a component for choosing a file or directory.
24 */
25 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_RESOURCECHOOSER_H
26 #define __TERRALIB_QT_WIDGETS_INTERNAL_RESOURCECHOOSER_H
27 
29 
30 //! Qt include files
31 #include <QWidget>
32 
33 namespace te
34 {
35  namespace qt
36  {
37  namespace widgets
38  {
39  //! Forward declarations
40  class FileChooser;
41 
42  /*!
43  \class ResourceChooser
44 
45  \brief Defines a component for choosing a file or directory.
46 
47  This class is used for choosing a file or a directory. Its also possible to inform the file extensions to be searched. This way the
48  client can change the filter for the files to be listed when searching. The component is composed of a line edit containing the
49  complete path of the file or directory selected and a tool button used to open de choose file / directory dialog.
50  */
51  class TEQTWIDGETSEXPORT ResourceChooser : public QWidget
52  {
53  Q_OBJECT
54 
55  public:
56 
57  /*!
58  \brief Constructor.
59  */
60  ResourceChooser(QWidget* parent=0);
61 
62  /*!
63  \brief Destructor.
64  */
65  ~ResourceChooser();
66 
67  /*!
68  \brief Returns the selected resource.
69  */
70  QString getSelectedResource();
71 
72  /*!
73  \brief Setts a pattern for filtering the searched files.
74  \details This class uses internally the FileChooser component. For more details about on how define filter pattern see its documentation.
75  \param filter Pattern to be applied.
76  \sa te::qt::widgets::FileChooser
77  */
78  void setFilterPattern(const QString& filter);
79 
80  /*!
81  \brief use the static when the ResourceChooser have to be presented as a Dialog.
82  \param initialPath
83  \param parent
84  \return
85  */
86  static QString getResource(const QString& initialPath, const QString& filter, QWidget* parent=0);
87 
88  protected slots:
89 
90  /*!
91  \brief This is called when the user changes the type of resource to search.
92  \param id
93  */
94  void setResource(int id);
95 
96  protected:
97 
98  FileChooser* m_fchooser; //!< File chooser component.
99  };
100  }
101  }
102 }
103 
104 #endif //! __TERRALIB_QT_WIDGETS_INTERNAL_RESOURCECHOOSER_H
Configuration flags for the TerraLib Qt Widgets.
FileChooser * m_fchooser
File chooser component.
Defines a component for choose a file.
Definition: FileChooser.h:60
URI C++ Library.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
Defines a component for choosing a file or directory.