1 | /* $Id: QIFileDialog.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIFileDialog class declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_extensions_QIFileDialog_h
|
---|
29 | #define FEQT_INCLUDED_SRC_extensions_QIFileDialog_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QFileDialog>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UILibraryDefs.h"
|
---|
39 |
|
---|
40 | /** QFileDialog subclass simplifying access to it's static stuff. */
|
---|
41 | class SHARED_LIBRARY_STUFF QIFileDialog : public QFileDialog
|
---|
42 | {
|
---|
43 | Q_OBJECT;
|
---|
44 |
|
---|
45 | /** Constructs our own file-dialog passing @a pParent and enmFlags to the base-class.
|
---|
46 | * Doesn't mean to be used directly, cause this subclass is a bunch of statics. */
|
---|
47 | QIFileDialog(QWidget *pParent, Qt::WindowFlags enmFlags);
|
---|
48 |
|
---|
49 | public:
|
---|
50 |
|
---|
51 | /** Returns an existing directory selected by the user.
|
---|
52 | * @param strDir Brings the dir to start from.
|
---|
53 | * @param pParent Brings the parent.
|
---|
54 | * @param strCaption Brings the dialog caption.
|
---|
55 | * @param fDirOnly Brings whether dialog should show dirs only.
|
---|
56 | * @param fResolveSymLinks Brings whether dialog should resolve sym-links. */
|
---|
57 | static QString getExistingDirectory(const QString &strDir, QWidget *pParent,
|
---|
58 | const QString &strCaption = QString(),
|
---|
59 | bool fDirOnly = true,
|
---|
60 | bool fResolveSymLinks = true);
|
---|
61 |
|
---|
62 | /** Returns a file name selected by the user. The file does not have to exist.
|
---|
63 | * @param strStartWith Brings the full file path to start from.
|
---|
64 | * @param strFilters Brings the filters.
|
---|
65 | * @param pParent Brings the parent.
|
---|
66 | * @param strCaption Brings the dialog caption.
|
---|
67 | * @param pStrSelectedFilter Brings the selected filter.
|
---|
68 | * @param fResolveSymLinks Brings whether dialog should resolve sym-links.
|
---|
69 | * @param fConfirmOverwrite Brings whether dialog should confirm overwrite. */
|
---|
70 | static QString getSaveFileName(const QString &strStartWith, const QString &strFilters, QWidget *pParent,
|
---|
71 | const QString &strCaption, QString *pStrSelectedFilter = 0,
|
---|
72 | bool fResolveSymLinks = true, bool fConfirmOverwrite = false);
|
---|
73 |
|
---|
74 | /** Returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
|
---|
75 | * @param strStartWith Brings the full file path to start from.
|
---|
76 | * @param strFilters Brings the filters.
|
---|
77 | * @param pParent Brings the parent.
|
---|
78 | * @param strCaption Brings the dialog caption.
|
---|
79 | * @param pStrSelectedFilter Brings the selected filter.
|
---|
80 | * @param fResolveSymLinks Brings whether dialog should resolve sym-links. */
|
---|
81 | static QString getOpenFileName(const QString &strStartWith, const QString &strFilters, QWidget *pParent,
|
---|
82 | const QString &strCaption, QString *pStrSelectedFilter = 0,
|
---|
83 | bool fResolveSymLinks = true);
|
---|
84 |
|
---|
85 | /** Returns one or more existing files selected by the user.
|
---|
86 | * @param strStartWith Brings the full file path to start from.
|
---|
87 | * @param strFilters Brings the filters.
|
---|
88 | * @param pParent Brings the parent.
|
---|
89 | * @param strCaption Brings the dialog caption.
|
---|
90 | * @param pStrSelectedFilter Brings the selected filter.
|
---|
91 | * @param fResolveSymLinks Brings whether dialog should resolve sym-links.
|
---|
92 | * @param fSingleFile Brings whether dialog should allow chosing single file only. */
|
---|
93 | static QStringList getOpenFileNames(const QString &strStartWith, const QString &strFilters, QWidget *pParent,
|
---|
94 | const QString &strCaption, QString *pStrSelectedFilter = 0,
|
---|
95 | bool fResolveSymLinks = true,
|
---|
96 | bool fSingleFile = false);
|
---|
97 |
|
---|
98 | /** Search for the first directory that exists starting from the
|
---|
99 | * passed one @a strStartDir and going up through its parents. */
|
---|
100 | static QString getFirstExistingDir(const QString &strStartDir);
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIFileDialog_h */
|
---|