LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
filedialog.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_FILEDIALOG_H
21 #define LIBREPCB_FILEDIALOG_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include <QtCore>
27 #include <QtWidgets>
28 
29 /*******************************************************************************
30  * Namespace / Forward Declarations
31  ******************************************************************************/
32 namespace librepcb {
33 
34 /*******************************************************************************
35  * Class FileDialog
36  ******************************************************************************/
37 
45 class FileDialog final {
46 public:
47  // Constructors / Destructor
48  FileDialog() = delete;
49  FileDialog(const FileDialog& other) = delete;
50  ~FileDialog() = delete;
51 
52  static QString getOpenFileName(QWidget* parent = 0,
53  const QString& caption = QString(),
54  const QString& dir = QString(),
55  const QString& filter = QString(),
56  QString* selectedFilter = 0,
57  QFileDialog::Options options = 0);
58 
59  static QStringList getOpenFileNames(QWidget* parent = 0,
60  const QString& caption = QString(),
61  const QString& dir = QString(),
62  const QString& filter = QString(),
63  QString* selectedFilter = 0,
64  QFileDialog::Options options = 0);
65 
66  static QString getSaveFileName(QWidget* parent = 0,
67  const QString& caption = QString(),
68  const QString& dir = QString(),
69  const QString& filter = QString(),
70  QString* selectedFilter = 0,
71  QFileDialog::Options options = 0);
72 
73  static QString getExistingDirectory(
74  QWidget* parent = 0, const QString& caption = QString(),
75  const QString& dir = QString(),
76  QFileDialog::Options options = QFileDialog::ShowDirsOnly);
77 
78 private:
79  static void patchOptions(QFileDialog::Options& options) noexcept;
80 };
81 
82 /*******************************************************************************
83  * End of File
84  ******************************************************************************/
85 
86 } // namespace librepcb
87 
88 #endif // LIBREPCB_FILEDIALOG_H
Wrapper around QFileDialog to slightly change its behaviour.
Definition: filedialog.h:45
static void patchOptions(QFileDialog::Options &options) noexcept
Definition: filedialog.cpp:75
static QStringList getOpenFileNames(QWidget *parent=0, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=0, QFileDialog::Options options=0)
Definition: filedialog.cpp:43
static QString getExistingDirectory(QWidget *parent=0, const QString &caption=QString(), const QString &dir=QString(), QFileDialog::Options options=QFileDialog::ShowDirsOnly)
Definition: filedialog.cpp:63
static QString getOpenFileName(QWidget *parent=0, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=0, QFileDialog::Options options=0)
Definition: filedialog.cpp:34
static QString getSaveFileName(QWidget *parent=0, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=0, QFileDialog::Options options=0)
Definition: filedialog.cpp:54