1 | /* $Id: QIFileDialog.h 71900 2018-04-18 14:40:43Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QIFileDialog class declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2018 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 |
|
---|
21 | /* Qt includes: */
|
---|
22 | #include <QFileDialog>
|
---|
23 |
|
---|
24 | /* GUI includes: */
|
---|
25 | #include "UILibraryDefs.h"
|
---|
26 |
|
---|
27 | /** QFileDialog subclass simplifying access to it's static stuff. */
|
---|
28 | class SHARED_LIBRARY_STUFF QIFileDialog : public QFileDialog
|
---|
29 | {
|
---|
30 | Q_OBJECT;
|
---|
31 |
|
---|
32 | /** Constructs our own file-dialog passing @a pParent and enmFlags to the base-class.
|
---|
33 | * Doesn't mean to be used directly, cause this subclass is a bunch of statics. */
|
---|
34 | QIFileDialog(QWidget *pParent, Qt::WindowFlags enmFlags);
|
---|
35 |
|
---|
36 | public:
|
---|
37 |
|
---|
38 | /** Returns an existing directory selected by the user.
|
---|
39 | * @param strDir Brings the dir to start from.
|
---|
40 | * @param pParent Brings the parent.
|
---|
41 | * @param strCaption Brings the dialog caption.
|
---|
42 | * @param fDirOnly Brings whether dialog should show dirs only.
|
---|
43 | * @param fResolveSymLinks Brings whether dialog should resolve sym-links. */
|
---|
44 | static QString getExistingDirectory(const QString &strDir, QWidget *pParent,
|
---|
45 | const QString &strCaption = QString(),
|
---|
46 | bool fDirOnly = true,
|
---|
47 | bool fResolveSymLinks = true);
|
---|
48 |
|
---|
49 | /** Returns a file name selected by the user. The file does not have to exist.
|
---|
50 | * @param strStartWith Brings the full file path to start from.
|
---|
51 | * @param strFilters Brings the filters.
|
---|
52 | * @param pParent Brings the parent.
|
---|
53 | * @param strCaption Brings the dialog caption.
|
---|
54 | * @param pStrSelectedFilter Brings the selected filter.
|
---|
55 | * @param fResolveSymLinks Brings whether dialog should resolve sym-links.
|
---|
56 | * @param fConfirmOverwrite Brings whether dialog should confirm overwrite. */
|
---|
57 | static QString getSaveFileName(const QString &strStartWith, const QString &strFilters, QWidget *pParent,
|
---|
58 | const QString &strCaption, QString *pStrSelectedFilter = 0,
|
---|
59 | bool fResolveSymLinks = true, bool fConfirmOverwrite = false);
|
---|
60 |
|
---|
61 | /** Returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
|
---|
62 | * @param strStartWith Brings the full file path to start from.
|
---|
63 | * @param strFilters Brings the filters.
|
---|
64 | * @param pParent Brings the parent.
|
---|
65 | * @param strCaption Brings the dialog caption.
|
---|
66 | * @param pStrSelectedFilter Brings the selected filter.
|
---|
67 | * @param fResolveSymLinks Brings whether dialog should resolve sym-links. */
|
---|
68 | static QString getOpenFileName(const QString &strStartWith, const QString &strFilters, QWidget *pParent,
|
---|
69 | const QString &strCaption, QString *pStrSelectedFilter = 0,
|
---|
70 | bool fResolveSymLinks = true);
|
---|
71 |
|
---|
72 | /** Returns one or more existing files selected by the user.
|
---|
73 | * @param strStartWith Brings the full file path to start from.
|
---|
74 | * @param strFilters Brings the filters.
|
---|
75 | * @param pParent Brings the parent.
|
---|
76 | * @param strCaption Brings the dialog caption.
|
---|
77 | * @param pStrSelectedFilter Brings the selected filter.
|
---|
78 | * @param fResolveSymLinks Brings whether dialog should resolve sym-links.
|
---|
79 | * @param fSingleFile Brings whether dialog should allow chosing single file only. */
|
---|
80 | static QStringList getOpenFileNames(const QString &strStartWith, const QString &strFilters, QWidget *pParent,
|
---|
81 | const QString &strCaption, QString *pStrSelectedFilter = 0,
|
---|
82 | bool fResolveSymLinks = true,
|
---|
83 | bool fSingleFile = false);
|
---|
84 |
|
---|
85 | /** Search for the first directory that exists starting from the
|
---|
86 | * passed one @a strStartDir and going up through its parents. */
|
---|
87 | static QString getFirstExistingDir(const QString &strStartDir);
|
---|
88 | };
|
---|
89 |
|
---|
90 | #endif /* !___QIFileDialog_h___ */
|
---|