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