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