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