VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSF.h@ 9774

Last change on this file since 9774 was 9729, checked in by vboxsync, 17 years ago

Backed out 32068 - see comment #163 in bug #2664.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 4.7 KB
Line 
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 "VBoxVMSettingsSF.gen.h"
27#include "QIWithRetranslateUI.h"
28
29/* Qt includes */
30#include <QDialog>
31
32class VBoxVMSettingsDlg;
33class SFTreeViewItem;
34class QIDialogButtonBox;
35
36class QLineEdit;
37class QPushButton;
38class QCheckBox;
39
40enum SFDialogType
41{
42 WrongType = 0x00,
43 GlobalType = 0x01,
44 MachineType = 0x02,
45 ConsoleType = 0x04
46};
47typedef QPair<QString, SFDialogType> SFolderName;
48typedef QList<SFolderName> SFoldersNameList;
49
50class VBoxVMSettingsSF : public QIWithRetranslateUI<QWidget>,
51 public Ui::VBoxVMSettingsSF
52{
53 Q_OBJECT;
54
55public:
56
57 VBoxVMSettingsSF (QWidget *aParent = 0, int aType = WrongType);
58
59 static void getFromMachineEx (const CMachine &aMachine,
60 QWidget *aParent,
61 VBoxVMSettingsDlg *aDlg);
62 static void putBackToMachineEx();
63
64 int dialogType() { return mDialogType; }
65
66 void getFromGlobal();
67 void getFromMachine (const CMachine &aMachine);
68 void getFromConsole (const CConsole &aConsole);
69
70 void putBackToGlobal();
71 void putBackToMachine();
72 void putBackToConsole();
73
74protected:
75
76 void retranslateUi();
77
78private slots:
79
80 void addTriggered();
81 void edtTriggered();
82 void delTriggered();
83
84 void processCurrentChanged (QTreeWidgetItem *aCurrentItem,
85 QTreeWidgetItem *aPreviousItem = 0);
86 void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
87 void showContextMenu (const QPoint &aPos);
88
89 void adjustList();
90 void adjustFields();
91
92private:
93
94 void showEvent (QShowEvent *aEvent);
95
96 void removeSharedFolder (const QString &aName, const QString &aPath,
97 SFDialogType aType);
98 void createSharedFolder (const QString &aName, const QString &aPath,
99 bool aWritable,
100 SFDialogType aType);
101
102 void getFrom (const CSharedFolderEnumerator &aEn, SFTreeViewItem *aItem);
103 void putBackTo (CSharedFolderEnumerator &aEn, SFTreeViewItem *aItem);
104
105 SFTreeViewItem* searchRoot (bool aIsPermanent,
106 SFDialogType aType = WrongType);
107 bool isEditable (const QString &);
108 SFoldersNameList usedList (bool aIncludeSelected);
109
110 static VBoxVMSettingsSF *mSettings;
111
112 int mDialogType;
113 QMenu *mMenu;
114 QAction *mNewAction;
115 QAction *mEdtAction;
116 QAction *mDelAction;
117 bool mIsListViewChanged;
118 CMachine mMachine;
119 CConsole mConsole;
120 QString mTrFull;
121 QString mTrReadOnly;
122};
123
124class VBoxAddSFDialog : public QIWithRetranslateUI<QDialog>
125{
126 Q_OBJECT;
127
128public:
129
130 enum DialogType
131 {
132 AddDialogType,
133 EditDialogType
134 };
135
136 VBoxAddSFDialog (VBoxVMSettingsSF *aParent,
137 VBoxAddSFDialog::DialogType aType,
138 bool aEnableSelector /* for "permanent" checkbox */,
139 const SFoldersNameList &aUsedNames);
140 ~VBoxAddSFDialog() {}
141
142 QString getPath();
143 QString getName();
144 bool getPermanent();
145 bool getWritable();
146
147 void setPath (const QString &aPath);
148 void setName (const QString &aName);
149 void setPermanent (bool aPermanent);
150 void setWritable (bool aWritable);
151
152protected:
153
154 void retranslateUi();
155
156private slots:
157
158 void validate();
159 void showFileDialog();
160
161private:
162
163 void showEvent (QShowEvent *aEvent);
164
165 VBoxAddSFDialog::DialogType mType;
166 QIDialogButtonBox *mButtonBox;
167 QLabel *mLbPath;
168 QLineEdit *mLePath;
169 QToolButton *mTbPath;
170 QLabel *mLbName;
171 QLineEdit *mLeName;
172 QCheckBox *mCbPermanent;
173 QCheckBox *mCbReadonly;
174 SFoldersNameList mUsedNames;
175};
176
177#endif // __VBoxVMSettingsSF_h__
178
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette