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 |
|
---|
28 | /* Qt includes */
|
---|
29 | #include <QDialog>
|
---|
30 |
|
---|
31 | class QLineEdit;
|
---|
32 | class QPushButton;
|
---|
33 | class QCheckBox;
|
---|
34 | class SFTreeViewItem;
|
---|
35 | class QDialogButtonBox;
|
---|
36 |
|
---|
37 | enum SFDialogType
|
---|
38 | {
|
---|
39 | WrongType = 0x00,
|
---|
40 | GlobalType = 0x01,
|
---|
41 | MachineType = 0x02,
|
---|
42 | ConsoleType = 0x04
|
---|
43 | };
|
---|
44 | typedef QPair<QString, SFDialogType> SFolderName;
|
---|
45 | typedef QList<SFolderName> SFoldersNameList;
|
---|
46 |
|
---|
47 | class VBoxSharedFoldersSettings : public QWidget, public Ui::VBoxSharedFoldersSettings
|
---|
48 | {
|
---|
49 | Q_OBJECT;
|
---|
50 |
|
---|
51 | public:
|
---|
52 |
|
---|
53 | VBoxSharedFoldersSettings (QWidget *aParent = 0, int aType = WrongType);
|
---|
54 |
|
---|
55 | int dialogType() { return mDialogType; }
|
---|
56 |
|
---|
57 | void getFromGlobal();
|
---|
58 | void getFromMachine (const CMachine &aMachine);
|
---|
59 | void getFromConsole (const CConsole &aConsole);
|
---|
60 |
|
---|
61 | void putBackToGlobal();
|
---|
62 | void putBackToMachine();
|
---|
63 | void putBackToConsole();
|
---|
64 |
|
---|
65 | private slots:
|
---|
66 |
|
---|
67 | void tbAddPressed();
|
---|
68 | void tbEditPressed();
|
---|
69 | void tbRemovePressed();
|
---|
70 |
|
---|
71 | void processCurrentChanged (QTreeWidgetItem *aCurrentItem,
|
---|
72 | QTreeWidgetItem *aPreviousItem = 0);
|
---|
73 | void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
|
---|
74 |
|
---|
75 | void adjustList();
|
---|
76 | void adjustFields();
|
---|
77 |
|
---|
78 | private:
|
---|
79 |
|
---|
80 | void showEvent (QShowEvent *aEvent);
|
---|
81 |
|
---|
82 | void removeSharedFolder (const QString &aName, const QString &aPath,
|
---|
83 | SFDialogType aType);
|
---|
84 | void createSharedFolder (const QString &aName, const QString &aPath,
|
---|
85 | bool aWritable,
|
---|
86 | SFDialogType aType);
|
---|
87 |
|
---|
88 | void getFrom (const CSharedFolderEnumerator &aEn, SFTreeViewItem *aItem);
|
---|
89 | void putBackTo (CSharedFolderEnumerator &aEn, SFTreeViewItem *aItem);
|
---|
90 |
|
---|
91 | SFTreeViewItem* searchRoot (bool aIsPermanent,
|
---|
92 | SFDialogType aType = WrongType);
|
---|
93 | bool isEditable (const QString &);
|
---|
94 | SFoldersNameList usedList (bool aIncludeSelected);
|
---|
95 |
|
---|
96 | int mDialogType;
|
---|
97 | bool mIsListViewChanged;
|
---|
98 | CMachine mMachine;
|
---|
99 | CConsole mConsole;
|
---|
100 | QString mTrFull;
|
---|
101 | QString mTrReadOnly;
|
---|
102 | };
|
---|
103 |
|
---|
104 | class VBoxAddSFDialog : public QDialog
|
---|
105 | {
|
---|
106 | Q_OBJECT;
|
---|
107 |
|
---|
108 | public:
|
---|
109 |
|
---|
110 | enum DialogType
|
---|
111 | {
|
---|
112 | AddDialogType,
|
---|
113 | EditDialogType
|
---|
114 | };
|
---|
115 |
|
---|
116 | VBoxAddSFDialog (VBoxSharedFoldersSettings *aParent,
|
---|
117 | VBoxAddSFDialog::DialogType aType,
|
---|
118 | bool aEnableSelector /* for "permanent" checkbox */,
|
---|
119 | const SFoldersNameList &aUsedNames);
|
---|
120 | ~VBoxAddSFDialog() {}
|
---|
121 |
|
---|
122 | QString getPath();
|
---|
123 | QString getName();
|
---|
124 | bool getPermanent();
|
---|
125 | bool getWritable();
|
---|
126 |
|
---|
127 | void setPath (const QString &aPath);
|
---|
128 | void setName (const QString &aName);
|
---|
129 | void setPermanent (bool aPermanent);
|
---|
130 | void setWritable (bool aWritable);
|
---|
131 |
|
---|
132 | private slots:
|
---|
133 |
|
---|
134 | void validate();
|
---|
135 | void showFileDialog();
|
---|
136 |
|
---|
137 | private:
|
---|
138 |
|
---|
139 | void showEvent (QShowEvent *aEvent);
|
---|
140 |
|
---|
141 | QDialogButtonBox *mButtonBox;
|
---|
142 | QLineEdit *mLePath;
|
---|
143 | QLineEdit *mLeName;
|
---|
144 | QCheckBox *mCbPermanent;
|
---|
145 | QCheckBox *mCbReadonly;
|
---|
146 | SFoldersNameList mUsedNames;
|
---|
147 | };
|
---|
148 |
|
---|
149 | #endif // __VBoxSharedFoldersSettings_h__
|
---|
150 |
|
---|