1 | /* $Id: UIEmptyFilePathSelector.h 103977 2024-03-21 02:04:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIEmptyFilePathSelector class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-2023 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_widgets_UIEmptyFilePathSelector_h
|
---|
29 | #define FEQT_INCLUDED_SRC_widgets_UIEmptyFilePathSelector_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* VBox includes */
|
---|
35 | #include "QIWithRetranslateUI.h"
|
---|
36 |
|
---|
37 | /* Qt includes */
|
---|
38 | #include <QComboBox>
|
---|
39 |
|
---|
40 | /* VBox forward declarations */
|
---|
41 | class QILabel;
|
---|
42 | class QILineEdit;
|
---|
43 |
|
---|
44 | /* Qt forward declarations */
|
---|
45 | class QHBoxLayout;
|
---|
46 | class QAction;
|
---|
47 | class QToolButton;
|
---|
48 |
|
---|
49 |
|
---|
50 | class UIEmptyFilePathSelector: public QIWithRetranslateUI<QWidget>
|
---|
51 | {
|
---|
52 | Q_OBJECT;
|
---|
53 |
|
---|
54 | public:
|
---|
55 |
|
---|
56 | enum Mode
|
---|
57 | {
|
---|
58 | Mode_Folder = 0,
|
---|
59 | Mode_File_Open,
|
---|
60 | Mode_File_Save
|
---|
61 | };
|
---|
62 |
|
---|
63 | enum ButtonPosition
|
---|
64 | {
|
---|
65 | LeftPosition,
|
---|
66 | RightPosition
|
---|
67 | };
|
---|
68 |
|
---|
69 | UIEmptyFilePathSelector (QWidget *aParent = NULL);
|
---|
70 |
|
---|
71 | void setMode (UIEmptyFilePathSelector::Mode aMode);
|
---|
72 | UIEmptyFilePathSelector::Mode mode() const;
|
---|
73 |
|
---|
74 | void setButtonPosition (ButtonPosition aPos);
|
---|
75 | ButtonPosition buttonPosition() const;
|
---|
76 |
|
---|
77 | void setEditable (bool aOn);
|
---|
78 | bool isEditable() const;
|
---|
79 |
|
---|
80 | void setChooserVisible (bool aOn);
|
---|
81 | bool isChooserVisible() const;
|
---|
82 |
|
---|
83 | QString path() const;
|
---|
84 |
|
---|
85 | void setDefaultSaveExt (const QString &aExt);
|
---|
86 | QString defaultSaveExt() const;
|
---|
87 |
|
---|
88 | bool isModified () const { return mIsModified; }
|
---|
89 | void resetModified () { mIsModified = false; }
|
---|
90 |
|
---|
91 | void setChooseButtonToolTip(const QString &strToolTip);
|
---|
92 | QString chooseButtonToolTip() const;
|
---|
93 |
|
---|
94 | void setFileDialogTitle (const QString& aTitle);
|
---|
95 | QString fileDialogTitle() const;
|
---|
96 |
|
---|
97 | void setFileFilters (const QString& aFilters);
|
---|
98 | QString fileFilters() const;
|
---|
99 |
|
---|
100 | void setHomeDir (const QString& aDir);
|
---|
101 | QString homeDir() const;
|
---|
102 |
|
---|
103 | signals:
|
---|
104 | void pathChanged (QString);
|
---|
105 |
|
---|
106 | public slots:
|
---|
107 | void setPath (const QString& aPath);
|
---|
108 |
|
---|
109 | protected:
|
---|
110 | virtual void retranslateUi() RT_OVERRIDE;
|
---|
111 |
|
---|
112 | private slots:
|
---|
113 | void choose();
|
---|
114 | void textChanged (const QString& aPath);
|
---|
115 |
|
---|
116 | private:
|
---|
117 | /* Private member vars */
|
---|
118 | QHBoxLayout *mMainLayout;
|
---|
119 | QWidget *mPathWgt;
|
---|
120 | QILabel *mLabel;
|
---|
121 | UIEmptyFilePathSelector::Mode mMode;
|
---|
122 | QILineEdit *mLineEdit;
|
---|
123 | QToolButton *mSelectButton;
|
---|
124 | bool m_fButtonToolTipSet;
|
---|
125 | QString mFileDialogTitle;
|
---|
126 | QString mFileFilters;
|
---|
127 | QString mDefaultSaveExt;
|
---|
128 | QString mHomeDir;
|
---|
129 | bool mIsModified;
|
---|
130 | QString mPath;
|
---|
131 | };
|
---|
132 |
|
---|
133 | #endif /* !FEQT_INCLUDED_SRC_widgets_UIEmptyFilePathSelector_h */
|
---|
134 |
|
---|