1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * VBoxSharedFoldersSettings class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2008 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxSharedFoldersSettings_h__
|
---|
24 | #define __VBoxSharedFoldersSettings_h__
|
---|
25 |
|
---|
26 | #include "VBoxSharedFoldersSettings.gen.h"
|
---|
27 | #include "QIWithRetranslateUI.h"
|
---|
28 |
|
---|
29 | /* Qt includes */
|
---|
30 | #include <QDialog>
|
---|
31 |
|
---|
32 | class QLineEdit;
|
---|
33 | class QPushButton;
|
---|
34 | class QCheckBox;
|
---|
35 | class SFTreeViewItem;
|
---|
36 |
|
---|
37 | class QIDialogButtonBox;
|
---|
38 |
|
---|
39 | enum SFDialogType
|
---|
40 | {
|
---|
41 | WrongType = 0x00,
|
---|
42 | GlobalType = 0x01,
|
---|
43 | MachineType = 0x02,
|
---|
44 | ConsoleType = 0x04
|
---|
45 | };
|
---|
46 | typedef QPair<QString, SFDialogType> SFolderName;
|
---|
47 | typedef QList<SFolderName> SFoldersNameList;
|
---|
48 |
|
---|
49 | class VBoxSharedFoldersSettings : public QIWithRetranslateUI<QWidget>,
|
---|
50 | public Ui::VBoxSharedFoldersSettings
|
---|
51 | {
|
---|
52 | Q_OBJECT;
|
---|
53 |
|
---|
54 | public:
|
---|
55 |
|
---|
56 | VBoxSharedFoldersSettings (QWidget *aParent = 0, int aType = WrongType);
|
---|
57 |
|
---|
58 | int dialogType() { return mDialogType; }
|
---|
59 |
|
---|
60 | void getFromGlobal();
|
---|
61 | void getFromMachine (const CMachine &aMachine);
|
---|
62 | void getFromConsole (const CConsole &aConsole);
|
---|
63 |
|
---|
64 | void putBackToGlobal();
|
---|
65 | void putBackToMachine();
|
---|
66 | void putBackToConsole();
|
---|
67 |
|
---|
68 | protected:
|
---|
69 |
|
---|
70 | void retranslateUi();
|
---|
71 |
|
---|
72 | private slots:
|
---|
73 |
|
---|
74 | void tbAddPressed();
|
---|
75 | void tbEditPressed();
|
---|
76 | void tbRemovePressed();
|
---|
77 |
|
---|
78 | void processCurrentChanged (QTreeWidgetItem *aCurrentItem,
|
---|
79 | QTreeWidgetItem *aPreviousItem = 0);
|
---|
80 | void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
|
---|
81 |
|
---|
82 | void adjustList();
|
---|
83 | void adjustFields();
|
---|
84 |
|
---|
85 | private:
|
---|
86 |
|
---|
87 | void showEvent (QShowEvent *aEvent);
|
---|
88 |
|
---|
89 | void removeSharedFolder (const QString &aName, const QString &aPath,
|
---|
90 | SFDialogType aType);
|
---|
91 | void createSharedFolder (const QString &aName, const QString &aPath,
|
---|
92 | bool aWritable,
|
---|
93 | SFDialogType aType);
|
---|
94 |
|
---|
95 | void getFrom (const CSharedFolderEnumerator &aEn, SFTreeViewItem *aItem);
|
---|
96 | void putBackTo (CSharedFolderEnumerator &aEn, SFTreeViewItem *aItem);
|
---|
97 |
|
---|
98 | SFTreeViewItem* searchRoot (bool aIsPermanent,
|
---|
99 | SFDialogType aType = WrongType);
|
---|
100 | bool isEditable (const QString &);
|
---|
101 | SFoldersNameList usedList (bool aIncludeSelected);
|
---|
102 |
|
---|
103 | int mDialogType;
|
---|
104 | bool mIsListViewChanged;
|
---|
105 | CMachine mMachine;
|
---|
106 | CConsole mConsole;
|
---|
107 | QString mTrFull;
|
---|
108 | QString mTrReadOnly;
|
---|
109 | };
|
---|
110 |
|
---|
111 | class VBoxAddSFDialog : public QIWithRetranslateUI<QDialog>
|
---|
112 | {
|
---|
113 | Q_OBJECT;
|
---|
114 |
|
---|
115 | public:
|
---|
116 |
|
---|
117 | enum DialogType
|
---|
118 | {
|
---|
119 | AddDialogType,
|
---|
120 | EditDialogType
|
---|
121 | };
|
---|
122 |
|
---|
123 | VBoxAddSFDialog (VBoxSharedFoldersSettings *aParent,
|
---|
124 | VBoxAddSFDialog::DialogType aType,
|
---|
125 | bool aEnableSelector /* for "permanent" checkbox */,
|
---|
126 | const SFoldersNameList &aUsedNames);
|
---|
127 | ~VBoxAddSFDialog() {}
|
---|
128 |
|
---|
129 | QString getPath();
|
---|
130 | QString getName();
|
---|
131 | bool getPermanent();
|
---|
132 | bool getWritable();
|
---|
133 |
|
---|
134 | void setPath (const QString &aPath);
|
---|
135 | void setName (const QString &aName);
|
---|
136 | void setPermanent (bool aPermanent);
|
---|
137 | void setWritable (bool aWritable);
|
---|
138 |
|
---|
139 | protected:
|
---|
140 |
|
---|
141 | void retranslateUi();
|
---|
142 |
|
---|
143 | private slots:
|
---|
144 |
|
---|
145 | void validate();
|
---|
146 | void showFileDialog();
|
---|
147 |
|
---|
148 | private:
|
---|
149 |
|
---|
150 | void showEvent (QShowEvent *aEvent);
|
---|
151 |
|
---|
152 | VBoxAddSFDialog::DialogType mType;
|
---|
153 | QIDialogButtonBox *mButtonBox;
|
---|
154 | QLabel *mLbPath;
|
---|
155 | QLineEdit *mLePath;
|
---|
156 | QToolButton *mTbPath;
|
---|
157 | QLabel *mLbName;
|
---|
158 | QLineEdit *mLeName;
|
---|
159 | QCheckBox *mCbPermanent;
|
---|
160 | QCheckBox *mCbReadonly;
|
---|
161 | SFoldersNameList mUsedNames;
|
---|
162 | };
|
---|
163 |
|
---|
164 | #endif // __VBoxSharedFoldersSettings_h__
|
---|
165 |
|
---|