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