[55401] | 1 | /* $Id: QIFileDialog.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[52727] | 3 | * VBox Qt GUI - Qt extensions: QIFileDialog class declarations.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[106061] | 7 | * Copyright (C) 2009-2024 Oracle and/or its affiliates.
|
---|
[25177] | 8 | *
|
---|
[96407] | 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
|
---|
[25177] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_extensions_QIFileDialog_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_extensions_QIFileDialog_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[25177] | 33 |
|
---|
[71392] | 34 | /* Qt includes: */
|
---|
[25177] | 35 | #include <QFileDialog>
|
---|
| 36 |
|
---|
[71630] | 37 | /* GUI includes: */
|
---|
| 38 | #include "UILibraryDefs.h"
|
---|
| 39 |
|
---|
[71392] | 40 | /** QFileDialog subclass simplifying access to it's static stuff. */
|
---|
[71630] | 41 | class SHARED_LIBRARY_STUFF QIFileDialog : public QFileDialog
|
---|
[25177] | 42 | {
|
---|
| 43 | Q_OBJECT;
|
---|
| 44 |
|
---|
[71392] | 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 |
|
---|
[25177] | 49 | public:
|
---|
| 50 |
|
---|
[71392] | 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);
|
---|
[25177] | 61 |
|
---|
[71392] | 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);
|
---|
[25177] | 73 |
|
---|
[71392] | 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);
|
---|
[25177] | 84 |
|
---|
[71392] | 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);
|
---|
[25177] | 97 |
|
---|
[71392] | 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);
|
---|
[25177] | 101 | };
|
---|
| 102 |
|
---|
[76581] | 103 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIFileDialog_h */
|
---|