LibrePCB Developers Documentation
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_EDITOR_FILEDIALOG_H
21#define LIBREPCB_EDITOR_FILEDIALOG_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27#include <QtWidgets>
28
29/*******************************************************************************
30 * Namespace / Forward Declarations
31 ******************************************************************************/
32namespace librepcb {
33namespace editor {
34
35/*******************************************************************************
36 * Class FileDialog
37 ******************************************************************************/
38
46class FileDialog final {
47public:
48 // Constructors / Destructor
49 FileDialog() = delete;
50 FileDialog(const FileDialog& other) = delete;
51 ~FileDialog() = delete;
52
53 static QString getOpenFileName(
54 QWidget* parent = nullptr, const QString& caption = QString(),
55 const QString& dir = QString(), const QString& filter = QString(),
56 QString* selectedFilter = nullptr,
57 QFileDialog::Options options = QFileDialog::Options());
58
59 static QStringList getOpenFileNames(
60 QWidget* parent = nullptr, const QString& caption = QString(),
61 const QString& dir = QString(), const QString& filter = QString(),
62 QString* selectedFilter = nullptr,
63 QFileDialog::Options options = QFileDialog::Options());
64
65 static QString getSaveFileName(
66 QWidget* parent = nullptr, const QString& caption = QString(),
67 const QString& dir = QString(), const QString& filter = QString(),
68 QString* selectedFilter = nullptr,
69 QFileDialog::Options options = QFileDialog::Options());
70
71 static QString getExistingDirectory(
72 QWidget* parent = nullptr, const QString& caption = QString(),
73 const QString& dir = QString(),
74 QFileDialog::Options options = QFileDialog::ShowDirsOnly);
75
76private:
77 static void patchOptions(QFileDialog::Options& options) noexcept;
78};
79
80/*******************************************************************************
81 * End of File
82 ******************************************************************************/
83
84} // namespace editor
85} // namespace librepcb
86
87#endif
Wrapper around QFileDialog to slightly change its behaviour.
Definition: filedialog.h:46
static void patchOptions(QFileDialog::Options &options) noexcept
Definition: filedialog.cpp:76
static QString getOpenFileName(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, QFileDialog::Options options=QFileDialog::Options())
Definition: filedialog.cpp:35
FileDialog(const FileDialog &other)=delete
static QStringList getOpenFileNames(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, QFileDialog::Options options=QFileDialog::Options())
Definition: filedialog.cpp:44
static QString getSaveFileName(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, QFileDialog::Options options=QFileDialog::Options())
Definition: filedialog.cpp:55
static QString getExistingDirectory(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), QFileDialog::Options options=QFileDialog::ShowDirsOnly)
Definition: filedialog.cpp:64
Definition: occmodel.cpp:77