1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt4 GUI ("VirtualBox"):
|
---|
4 | * VBoxVMSettingsSF 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 __VBoxVMSettingsSF_h__
|
---|
24 | #define __VBoxVMSettingsSF_h__
|
---|
25 |
|
---|
26 | #include "VBoxSettingsPage.h"
|
---|
27 | #include "VBoxVMSettingsSF.gen.h"
|
---|
28 |
|
---|
29 | #include <QDialog>
|
---|
30 |
|
---|
31 | class SFTreeViewItem;
|
---|
32 | class QIDialogButtonBox;
|
---|
33 |
|
---|
34 | class QLineEdit;
|
---|
35 | class QPushButton;
|
---|
36 | class QCheckBox;
|
---|
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 VBoxVMSettingsSF : public VBoxSettingsPage,
|
---|
49 | public Ui::VBoxVMSettingsSF
|
---|
50 | {
|
---|
51 | Q_OBJECT;
|
---|
52 |
|
---|
53 | public:
|
---|
54 |
|
---|
55 | VBoxVMSettingsSF (int aType = WrongType, QWidget *aParent = 0);
|
---|
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 | int dialogType() { return mDialogType; }
|
---|
66 |
|
---|
67 | protected:
|
---|
68 |
|
---|
69 | void getFrom (const CMachine &aMachine);
|
---|
70 | void putBackTo();
|
---|
71 |
|
---|
72 | void setOrderAfter (QWidget *aWidget);
|
---|
73 |
|
---|
74 | void retranslateUi();
|
---|
75 |
|
---|
76 | private slots:
|
---|
77 |
|
---|
78 | void addTriggered();
|
---|
79 | void edtTriggered();
|
---|
80 | void delTriggered();
|
---|
81 |
|
---|
82 | void processCurrentChanged (QTreeWidgetItem *aCurrentItem,
|
---|
83 | QTreeWidgetItem *aPreviousItem = 0);
|
---|
84 | void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
|
---|
85 | void showContextMenu (const QPoint &aPos);
|
---|
86 |
|
---|
87 | void adjustList();
|
---|
88 | void adjustFields();
|
---|
89 |
|
---|
90 | private:
|
---|
91 |
|
---|
92 | void showEvent (QShowEvent *aEvent);
|
---|
93 |
|
---|
94 | void removeSharedFolder (const QString &aName, const QString &aPath,
|
---|
95 | SFDialogType aType);
|
---|
96 | void createSharedFolder (const QString &aName, const QString &aPath,
|
---|
97 | bool aWritable,
|
---|
98 | SFDialogType aType);
|
---|
99 |
|
---|
100 | void getFrom (const CSharedFolderEnumerator &aEn, SFTreeViewItem *aItem);
|
---|
101 | void putBackTo (CSharedFolderEnumerator &aEn, SFTreeViewItem *aItem);
|
---|
102 |
|
---|
103 | SFTreeViewItem* searchRoot (bool aIsPermanent,
|
---|
104 | SFDialogType aType = WrongType);
|
---|
105 | bool isEditable (const QString &);
|
---|
106 | SFoldersNameList usedList (bool aIncludeSelected);
|
---|
107 |
|
---|
108 | int mDialogType;
|
---|
109 | QMenu *mMenu;
|
---|
110 | QAction *mNewAction;
|
---|
111 | QAction *mEdtAction;
|
---|
112 | QAction *mDelAction;
|
---|
113 | bool mIsListViewChanged;
|
---|
114 | CMachine mMachine;
|
---|
115 | CConsole mConsole;
|
---|
116 | QString mTrFull;
|
---|
117 | QString mTrReadOnly;
|
---|
118 | };
|
---|
119 |
|
---|
120 | class VBoxAddSFDialog : public QIWithRetranslateUI<QDialog>
|
---|
121 | {
|
---|
122 | Q_OBJECT;
|
---|
123 |
|
---|
124 | public:
|
---|
125 |
|
---|
126 | enum DialogType
|
---|
127 | {
|
---|
128 | AddDialogType,
|
---|
129 | EditDialogType
|
---|
130 | };
|
---|
131 |
|
---|
132 | VBoxAddSFDialog (VBoxVMSettingsSF *aParent,
|
---|
133 | VBoxAddSFDialog::DialogType aType,
|
---|
134 | bool aEnableSelector /* for "permanent" checkbox */,
|
---|
135 | const SFoldersNameList &aUsedNames);
|
---|
136 | ~VBoxAddSFDialog() {}
|
---|
137 |
|
---|
138 | QString getPath();
|
---|
139 | QString getName();
|
---|
140 | bool getPermanent();
|
---|
141 | bool getWritable();
|
---|
142 |
|
---|
143 | void setPath (const QString &aPath);
|
---|
144 | void setName (const QString &aName);
|
---|
145 | void setPermanent (bool aPermanent);
|
---|
146 | void setWritable (bool aWritable);
|
---|
147 |
|
---|
148 | protected:
|
---|
149 |
|
---|
150 | void retranslateUi();
|
---|
151 |
|
---|
152 | private slots:
|
---|
153 |
|
---|
154 | void validate();
|
---|
155 | void showFileDialog();
|
---|
156 |
|
---|
157 | private:
|
---|
158 |
|
---|
159 | void showEvent (QShowEvent *aEvent);
|
---|
160 |
|
---|
161 | VBoxAddSFDialog::DialogType mType;
|
---|
162 | QIDialogButtonBox *mButtonBox;
|
---|
163 | QLabel *mLbPath;
|
---|
164 | QLineEdit *mLePath;
|
---|
165 | QToolButton *mTbPath;
|
---|
166 | QLabel *mLbName;
|
---|
167 | QLineEdit *mLeName;
|
---|
168 | QCheckBox *mCbPermanent;
|
---|
169 | QCheckBox *mCbReadonly;
|
---|
170 | SFoldersNameList mUsedNames;
|
---|
171 | };
|
---|
172 |
|
---|
173 | #endif // __VBoxVMSettingsSF_h__
|
---|
174 |
|
---|