Index: trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 25170)
+++ trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 25171)
@@ -208,5 +208,18 @@
 
 VirtualBox_INCS           = \
-	./include \
+	./src \
+	./src/globals \
+	./src/extensions \
+	./src/settings \
+	./src/settings/global \
+	./src/settings/vm \
+	./src/wizards/newvm \
+	./src/wizards/newhd \
+	./src/wizards/firstrun \
+	./src/wizards/exportappliance \
+	./src/wizards/importappliance \
+	./src/widgets \
+	./src/X11 \
+	./src/darwin \
 	$(PATH_VirtualBox)/include
 
@@ -256,85 +269,85 @@
 # Headers containing definitions of classes that use the Q_OBJECT macro.
 VirtualBox_QT_MOCHDRS = \
-	include/QIHttp.h \
-	include/QIWidgetValidator.h \
-	include/QIHotKeyEdit.h \
-	include/QIStatusBar.h \
-	include/QIStateIndicator.h \
-	include/QIRichToolButton.h \
-	include/QIArrowButtonPress.h \
-	include/QIArrowButtonSwitch.h \
-	include/QIArrowSplitter.h \
-	include/QIMessageBox.h \
-	include/QILabel.h \
-	include/QILabelSeparator.h \
-	include/QIAbstractWizard.h \
-	include/QIListView.h \
-	include/QITreeWidget.h \
-	include/QIMainDialog.h \
-	include/QIDialog.h \
-	include/QIFileDialog.h \
-	include/QIAdvancedSlider.h \
-	include/QISplitter.h \
-	include/QITreeView.h \
-	include/QIToolButton.h \
-	include/VBoxFilePathSelectorWidget.h \
-	include/VBoxOSTypeSelectorButton.h \
-	include/VBoxOSTypeSelectorWidget.h \
-	include/VBoxLineTextEdit.h \
-	include/VBoxUtils.h \
-	include/VBoxGlobalSettings.h \
-	include/VBoxGlobal.h \
-	include/VBoxVMListView.h \
-	include/VBoxMediaComboBox.h \
-	include/VBoxSelectorWnd.h \
-	include/VBoxConsoleWnd.h \
-	include/VBoxConsoleView.h \
-	include/VBoxMiniToolBar.h \
-	include/VBoxProblemReporter.h \
-	include/VBoxProgressDialog.h \
-	include/VBoxDownloaderWgt.h \
-	include/VBoxAboutDlg.h \
-	include/VBoxCloseVMDlg.h \
-	include/VBoxNewVMWzd.h \
-	include/VBoxNewHDWzd.h \
-	include/VBoxVMFirstRunWzd.h \
-	include/VBoxRegistrationDlg.h \
-	include/VBoxUpdateDlg.h \
-	include/VBoxSnapshotDetailsDlg.h \
-	include/VBoxVMInformationDlg.h \
-	include/VBoxTakeSnapshotDlg.h \
-	include/VBoxSnapshotsWgt.h \
-	include/VBoxVMLogViewer.h \
-	include/VBoxMediaManagerDlg.h \
-	include/VBoxVMSettingsGeneral.h \
-	include/VBoxVMSettingsSystem.h \
-	include/VBoxVMSettingsDisplay.h \
-	include/VBoxVMSettingsHD.h \
-	include/VBoxVMSettingsAudio.h \
-	include/VBoxVMSettingsNetwork.h \
-	include/VBoxVMSettingsSerial.h \
-	include/VBoxVMSettingsParallel.h \
-	include/VBoxVMSettingsUSB.h \
-	include/VBoxVMSettingsUSBFilterDetails.h \
-	include/VBoxVMSettingsSF.h \
-	include/VBoxVMSettingsSFDetails.h \
-	include/VBoxGLSettingsGeneral.h \
-	include/VBoxGLSettingsInput.h \
-	include/VBoxGLSettingsUpdate.h \
-	include/VBoxGLSettingsLanguage.h \
-	include/VBoxGLSettingsNetwork.h \
-	include/VBoxGLSettingsNetworkDetails.h \
-	include/VBoxSettingsDialog.h \
-	include/VBoxSettingsDialogSpecific.h \
-	include/VBoxSettingsPage.h \
-	include/VBoxSettingsSelector.h \
-	include/VBoxApplianceEditorWgt.h \
-	include/VBoxImportApplianceWgt.h \
-	include/VBoxImportApplianceWzd.h \
-	include/VBoxExportApplianceWgt.h \
-	include/VBoxExportApplianceWzd.h \
-	include/VBoxSpecialControls.h \
-	include/VBoxBootTable.h \
-	include/VBoxWarningPane.h
+	src/VBoxAboutDlg.h \
+	src/VBoxCloseVMDlg.h \
+	src/VBoxConsoleView.h \
+	src/VBoxConsoleWnd.h \
+	src/VBoxGlobalSettings.h \
+	src/VBoxMediaManagerDlg.h \
+	src/VBoxRegistrationDlg.h \
+	src/VBoxSelectorWnd.h \
+	src/VBoxSnapshotDetailsDlg.h \
+	src/VBoxSnapshotsWgt.h \
+	src/VBoxTakeSnapshotDlg.h \
+	src/VBoxUpdateDlg.h \
+	src/VBoxVMInformationDlg.h \
+	src/VBoxVMListView.h \
+	src/VBoxVMLogViewer.h \
+	src/globals/VBoxGlobal.h \
+	src/globals/VBoxProblemReporter.h \
+	src/globals/VBoxUtils.h \
+	src/extensions/QIAbstractWizard.h \
+	src/extensions/QIAdvancedSlider.h \
+	src/extensions/QIArrowButtonPress.h \
+	src/extensions/QIArrowButtonSwitch.h \
+	src/extensions/QIArrowSplitter.h \
+	src/extensions/QIDialog.h \
+	src/extensions/QIFileDialog.h \
+	src/extensions/QIHotKeyEdit.h \
+	src/extensions/QIHttp.h \
+	src/extensions/QILabel.h \
+	src/extensions/QILabelSeparator.h \
+	src/extensions/QIListView.h \
+	src/extensions/QIMainDialog.h \
+	src/extensions/QIMessageBox.h \
+	src/extensions/QIRichToolButton.h \
+	src/extensions/QISplitter.h \
+	src/extensions/QIStateIndicator.h \
+	src/extensions/QIStatusBar.h \
+	src/extensions/QIToolButton.h \
+	src/extensions/QITreeView.h \
+	src/extensions/QITreeWidget.h \
+	src/extensions/QIWidgetValidator.h \
+	src/settings/VBoxSettingsDialog.h \
+	src/settings/VBoxSettingsDialogSpecific.h \
+	src/settings/VBoxSettingsPage.h \
+	src/settings/VBoxSettingsSelector.h \
+	src/settings/global/VBoxGLSettingsGeneral.h \
+	src/settings/global/VBoxGLSettingsInput.h \
+	src/settings/global/VBoxGLSettingsUpdate.h \
+	src/settings/global/VBoxGLSettingsLanguage.h \
+	src/settings/global/VBoxGLSettingsNetwork.h \
+	src/settings/global/VBoxGLSettingsNetworkDetails.h \
+	src/settings/vm/VBoxVMSettingsGeneral.h \
+	src/settings/vm/VBoxVMSettingsSystem.h \
+	src/settings/vm/VBoxVMSettingsDisplay.h \
+	src/settings/vm/VBoxVMSettingsHD.h \
+	src/settings/vm/VBoxVMSettingsAudio.h \
+	src/settings/vm/VBoxVMSettingsNetwork.h \
+	src/settings/vm/VBoxVMSettingsSerial.h \
+	src/settings/vm/VBoxVMSettingsParallel.h \
+	src/settings/vm/VBoxVMSettingsUSB.h \
+	src/settings/vm/VBoxVMSettingsUSBFilterDetails.h \
+	src/settings/vm/VBoxVMSettingsSF.h \
+	src/settings/vm/VBoxVMSettingsSFDetails.h \
+	src/wizards/newvm/VBoxNewVMWzd.h \
+	src/wizards/newhd/VBoxNewHDWzd.h \
+	src/wizards/firstrun/VBoxVMFirstRunWzd.h \
+	src/wizards/exportappliance/VBoxExportApplianceWzd.h \
+	src/wizards/importappliance/VBoxImportApplianceWzd.h \
+	src/widgets/VBoxApplianceEditorWgt.h \
+	src/widgets/VBoxBootTable.h \
+	src/widgets/VBoxDownloaderWgt.h \
+	src/widgets/VBoxExportApplianceWgt.h \
+	src/widgets/VBoxFilePathSelectorWidget.h \
+	src/widgets/VBoxImportApplianceWgt.h \
+	src/widgets/VBoxLineTextEdit.h \
+	src/widgets/VBoxMediaComboBox.h \
+	src/widgets/VBoxMiniToolBar.h \
+	src/widgets/VBoxOSTypeSelectorButton.h \
+	src/widgets/VBoxOSTypeSelectorWidget.h \
+	src/widgets/VBoxProgressDialog.h \
+	src/widgets/VBoxSpecialControls.h \
+	src/widgets/VBoxWarningPane.h
 
 # Sources containing local definitions of classes that use the Q_OBJECT macro.
@@ -345,117 +358,117 @@
 ifdef VBOX_WITH_XPCOM
  VirtualBox_QT_MOCSRCS += \
-	src/COMDefs.cpp
+	src/globals/COMDefs.cpp
 endif
 ifeq ($(KBUILD_TARGET),win)
 VirtualBox_QT_MOCSRCS += \
-	src/QIFileDialog.cpp
+	src/extensions/QIFileDialog.cpp
 endif
 
 VirtualBox_SOURCES = \
 	src/main.cpp \
-	src/COMDefs.cpp \
-	src/QIWidgetValidator.cpp \
-	src/QIHotKeyEdit.cpp \
-	src/QIStateIndicator.cpp \
-	src/QIStatusBar.cpp \
-	src/QIRichToolButton.cpp \
-	src/QIArrowButtonSwitch.cpp \
-	src/QIArrowButtonPress.cpp \
-	src/QIArrowSplitter.cpp \
-	src/QIMessageBox.cpp \
-	src/QILabel.cpp \
-	src/QILabelSeparator.cpp \
-	src/QIAbstractWizard.cpp \
-	src/QIDialog.cpp \
-	src/QIFileDialog.cpp \
-	src/QIAdvancedSlider.cpp \
-	src/QIDialogButtonBox.cpp \
-	src/QIListView.cpp \
-	src/QITreeWidget.cpp \
-	src/QIMainDialog.cpp \
-	src/QILineEdit.cpp \
-	src/QISplitter.cpp \
-	src/QITreeView.cpp \
-	src/VBoxGuestRAMSlider.cpp \
-	src/VBoxFilePathSelectorWidget.cpp \
-	src/VBoxOSTypeSelectorButton.cpp \
-	src/VBoxOSTypeSelectorWidget.cpp \
-	src/VBoxLineTextEdit.cpp \
-	src/VBoxDefs.cpp \
-	src/VBoxGlobalSettings.cpp \
-	src/VBoxGlobal.cpp \
-	src/VBoxMediaComboBox.cpp \
-	src/VBoxProblemReporter.cpp \
-	src/VBoxProgressDialog.cpp \
-	src/VBoxHelpActions.cpp \
-	src/VBoxSelectorWnd.cpp \
+	src/VBoxAboutDlg.cpp \
+	src/VBoxCloseVMDlg.cpp \
 	src/VBoxConsoleView.cpp \
 	src/VBoxConsoleWnd.cpp \
-	src/VBoxMiniToolBar.cpp \
-	src/VBoxDownloaderWgt.cpp \
-	src/VBoxVMListView.cpp \
 	src/VBoxFrameBuffer.cpp \
-	src/VBoxAboutDlg.cpp \
-	src/VBoxCloseVMDlg.cpp \
-	src/VBoxNewVMWzd.cpp \
-	src/VBoxNewHDWzd.cpp \
-	src/VBoxVMFirstRunWzd.cpp \
-	src/VBoxRegistrationDlg.cpp \
-	src/VBoxUpdateDlg.cpp \
-	src/VBoxSnapshotDetailsDlg.cpp \
-	src/VBoxVMInformationDlg.cpp \
-	src/VBoxTakeSnapshotDlg.cpp \
-	src/VBoxSnapshotsWgt.cpp \
-	src/VBoxVMLogViewer.cpp \
-	src/VBoxVMSettingsGeneral.cpp \
-	src/VBoxVMSettingsSystem.cpp \
-	src/VBoxVMSettingsDisplay.cpp \
-	src/VBoxVMSettingsHD.cpp \
-	src/VBoxVMSettingsAudio.cpp \
-	src/VBoxVMSettingsNetwork.cpp \
-	src/VBoxVMSettingsSerial.cpp \
-	src/VBoxVMSettingsParallel.cpp \
-	src/VBoxVMSettingsUSB.cpp \
-	src/VBoxVMSettingsUSBFilterDetails.cpp \
-	src/VBoxVMSettingsSF.cpp \
-	src/VBoxVMSettingsSFDetails.cpp \
-	src/VBoxGLSettingsGeneral.cpp \
-	src/VBoxGLSettingsInput.cpp \
-	src/VBoxGLSettingsUpdate.cpp \
-	src/VBoxGLSettingsLanguage.cpp \
-	src/VBoxGLSettingsNetwork.cpp \
-	src/VBoxGLSettingsNetworkDetails.cpp \
-	src/VBoxSettingsDialog.cpp \
-	src/VBoxSettingsDialogSpecific.cpp \
-	src/VBoxSettingsSelector.cpp \
+	src/VBoxGlobalSettings.cpp \
+	src/VBoxHelpActions.cpp \
 	src/VBoxMediaManagerDlg.cpp \
 	src/VBoxMedium.cpp \
-	src/VBoxApplianceEditorWgt.cpp \
-	src/VBoxImportApplianceWgt.cpp \
-	src/VBoxImportApplianceWzd.cpp \
-	src/VBoxExportApplianceWgt.cpp \
-	src/VBoxExportApplianceWzd.cpp \
-	src/VBoxSpecialControls.cpp \
-	src/VBoxBootTable.cpp \
-	src/VBoxWarningPane.cpp
+	src/VBoxRegistrationDlg.cpp \
+	src/VBoxSelectorWnd.cpp \
+	src/VBoxSnapshotDetailsDlg.cpp \
+	src/VBoxSnapshotsWgt.cpp \
+	src/VBoxTakeSnapshotDlg.cpp \
+	src/VBoxUpdateDlg.cpp \
+	src/VBoxVMInformationDlg.cpp \
+	src/VBoxVMListView.cpp \
+	src/VBoxVMLogViewer.cpp \
+	src/globals/COMDefs.cpp \
+	src/globals/VBoxDefs.cpp \
+	src/globals/VBoxGlobal.cpp \
+	src/globals/VBoxProblemReporter.cpp \
+	src/extensions/QIAbstractWizard.cpp \
+	src/extensions/QIAdvancedSlider.cpp \
+	src/extensions/QIArrowButtonPress.cpp \
+	src/extensions/QIArrowButtonSwitch.cpp \
+	src/extensions/QIArrowSplitter.cpp \
+	src/extensions/QIDialog.cpp \
+	src/extensions/QIDialogButtonBox.cpp \
+	src/extensions/QIFileDialog.cpp \
+	src/extensions/QIHotKeyEdit.cpp \
+	src/extensions/QILabel.cpp \
+	src/extensions/QILabelSeparator.cpp \
+	src/extensions/QILineEdit.cpp \
+	src/extensions/QIListView.cpp \
+	src/extensions/QIMainDialog.cpp \
+	src/extensions/QIMessageBox.cpp \
+	src/extensions/QIRichToolButton.cpp \
+	src/extensions/QISplitter.cpp \
+	src/extensions/QIStateIndicator.cpp \
+	src/extensions/QIStatusBar.cpp \
+	src/extensions/QITreeView.cpp \
+	src/extensions/QITreeWidget.cpp \
+	src/extensions/QIWidgetValidator.cpp \
+	src/settings/VBoxSettingsDialog.cpp \
+	src/settings/VBoxSettingsDialogSpecific.cpp \
+	src/settings/VBoxSettingsSelector.cpp \
+	src/settings/global/VBoxGLSettingsGeneral.cpp \
+	src/settings/global/VBoxGLSettingsInput.cpp \
+	src/settings/global/VBoxGLSettingsUpdate.cpp \
+	src/settings/global/VBoxGLSettingsLanguage.cpp \
+	src/settings/global/VBoxGLSettingsNetwork.cpp \
+	src/settings/global/VBoxGLSettingsNetworkDetails.cpp \
+	src/settings/vm/VBoxVMSettingsGeneral.cpp \
+	src/settings/vm/VBoxVMSettingsSystem.cpp \
+	src/settings/vm/VBoxVMSettingsDisplay.cpp \
+	src/settings/vm/VBoxVMSettingsHD.cpp \
+	src/settings/vm/VBoxVMSettingsAudio.cpp \
+	src/settings/vm/VBoxVMSettingsNetwork.cpp \
+	src/settings/vm/VBoxVMSettingsSerial.cpp \
+	src/settings/vm/VBoxVMSettingsParallel.cpp \
+	src/settings/vm/VBoxVMSettingsUSB.cpp \
+	src/settings/vm/VBoxVMSettingsUSBFilterDetails.cpp \
+	src/settings/vm/VBoxVMSettingsSF.cpp \
+	src/settings/vm/VBoxVMSettingsSFDetails.cpp \
+	src/wizards/newvm/VBoxNewVMWzd.cpp \
+	src/wizards/newhd/VBoxNewHDWzd.cpp \
+	src/wizards/firstrun/VBoxVMFirstRunWzd.cpp \
+	src/wizards/exportappliance/VBoxExportApplianceWzd.cpp \
+	src/wizards/importappliance/VBoxImportApplianceWzd.cpp \
+	src/widgets/VBoxApplianceEditorWgt.cpp \
+	src/widgets/VBoxBootTable.cpp \
+	src/widgets/VBoxDownloaderWgt.cpp \
+	src/widgets/VBoxExportApplianceWgt.cpp \
+	src/widgets/VBoxFilePathSelectorWidget.cpp \
+	src/widgets/VBoxGuestRAMSlider.cpp \
+	src/widgets/VBoxImportApplianceWgt.cpp \
+	src/widgets/VBoxLineTextEdit.cpp \
+	src/widgets/VBoxMediaComboBox.cpp \
+	src/widgets/VBoxMiniToolBar.cpp \
+	src/widgets/VBoxOSTypeSelectorButton.cpp \
+	src/widgets/VBoxOSTypeSelectorWidget.cpp \
+	src/widgets/VBoxProgressDialog.cpp \
+	src/widgets/VBoxSpecialControls.cpp \
+	src/widgets/VBoxWarningPane.cpp
 
 ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
  ifndef VBOX_OSE
   VirtualBox_QT_MOCHDRS += \
-  	include/VBoxLicenseViewer.h
+ 	src/VBoxLicenseViewer.h
   VirtualBox_SOURCES += \
-  	src/VBoxLicenseViewer.cpp
+ 	src/VBoxLicenseViewer.cpp
  else
   VirtualBox_VBOX_EXTRA_NLS_SOURCES += \
-    include/VBoxLicenseViewer.h \
-  	src/VBoxLicenseViewer.cpp
+ 	src/VBoxLicenseViewer.h \
+ 	src/VBoxLicenseViewer.cpp
  endif
  VirtualBox_SOURCES += \
  	src/X11/XKeyboard-new.cpp \
-	src/VBoxX11Helper.cpp
+ 	src/X11/VBoxX11Helper.cpp
 else
  VirtualBox_VBOX_EXTRA_NLS_SOURCES += \
-    include/VBoxLicenseViewer.h \
-  	src/VBoxLicenseViewer.cpp
+ 	src/VBoxLicenseViewer.h \
+ 	src/VBoxLicenseViewer.cpp
 endif
 
@@ -480,13 +493,12 @@
  	src/darwin/VBoxCocoaApplication.m \
  	src/darwin/VBoxUtils-darwin-cocoa.mm \
-	src/darwin/VBoxCocoaSpecialControls.mm \
-	src/darwin/CocoaDockIconPreview.mm
+ 	src/darwin/VBoxCocoaSpecialControls.mm \
+ 	src/darwin/CocoaDockIconPreview.mm
  VirtualBox_QT_MOCHDRS.darwin = \
-	include/VBoxCocoaSpecialControls.h
-
+ 	src/darwin/VBoxCocoaSpecialControls.h
 else
  VirtualBox_SOURCES.darwin += \
  	src/darwin/VBoxUtils-darwin-carbon.cpp \
-	src/darwin/CarbonDockIconPreview.cpp
+ 	src/darwin/CarbonDockIconPreview.cpp
 endif
 
@@ -507,5 +519,5 @@
 # Import QDesigner UI sources and translations from VBoxUI.pro.
 ifndef VBOX_WITH_REGISTRATION
- FORMS := $(filter-out ui/VBoxRegistrationDlg.ui,$(FORMS))
+ FORMS := $(filter-out src/VBoxRegistrationDlg.ui,$(FORMS))
 endif
 $(eval VirtualBox_SOURCES += $(FORMS))
@@ -537,5 +549,5 @@
 # bird: What about $(if $(VBOX_GCC_Wno-missing-base-class-initializer),$(VBOX_GCC_Wno-missing-base-class-initializer),$(VBOX_GCC_Wno-extra))?
 ifdef VBOX_WITH_XPCOM
- VirtualBox_src/COMDefs.cpp_CXXFLAGS  = $(VBOX_GCC_Wno-extra)
+ VirtualBox_src/globals/COMDefs.cpp_CXXFLAGS  = $(VBOX_GCC_Wno-extra)
 endif
 
@@ -559,9 +571,9 @@
 +| $$(PATH_VirtualBox)/include/COMWrappers.cpp: \
 		$(VBOX_XIDL_FILE) \
-		$(VBOX_VIRTUALBOX4_SRC)/include/COMWrappers.xsl \
+		$(VBOX_VIRTUALBOX4_SRC)/src/globals/COMWrappers.xsl \
 		| $$(dir $$@)
 	$(call MSG_GENERATE,VirtualBox,$<,$@)
 	$(QUIET)$(RM) -f $@ $@.tmp $@.h $@.cpp
-	$(QUIET)$(VBOX_XSLTPROC) -o $@ $(VBOX_VIRTUALBOX4_SRC)/include/COMWrappers.xsl $<
+	$(QUIET)$(VBOX_XSLTPROC) -o $@ $(VBOX_VIRTUALBOX4_SRC)/src/globals/COMWrappers.xsl $<
 
 	$(QUIET)$(SED) -e '1,/\/\/ wrapper definitions/ !d' \
Index: trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro	(revision 25170)
+++ trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro	(revision 25171)
@@ -26,38 +26,38 @@
 
 FORMS = \
-    ui/VBoxCloseVMDlg.ui \
-    ui/VBoxMediaManagerDlg.ui \
-    ui/VBoxSettingsDialog.ui \
-    ui/VBoxNewHDWzd.ui \
-    ui/VBoxNewVMWzd.ui \
-    ui/VBoxRegistrationDlg.ui \
-    ui/VBoxUpdateDlg.ui \
-    ui/VBoxSnapshotDetailsDlg.ui \
-    ui/VBoxSnapshotsWgt.ui \
-    ui/VBoxTakeSnapshotDlg.ui \
-    ui/VBoxVMFirstRunWzd.ui \
-    ui/VBoxVMInformationDlg.ui \
-    ui/VBoxVMLogViewer.ui \
-    ui/VBoxVMSettingsGeneral.ui \
-    ui/VBoxVMSettingsSystem.ui \
-    ui/VBoxVMSettingsDisplay.ui \
-    ui/VBoxVMSettingsHD.ui \
-    ui/VBoxVMSettingsAudio.ui \
-    ui/VBoxVMSettingsNetwork.ui \
-    ui/VBoxVMSettingsSerial.ui \
-    ui/VBoxVMSettingsParallel.ui \
-    ui/VBoxVMSettingsUSB.ui \
-    ui/VBoxVMSettingsUSBFilterDetails.ui \
-    ui/VBoxVMSettingsSF.ui \
-    ui/VBoxVMSettingsSFDetails.ui \
-    ui/VBoxGLSettingsGeneral.ui \
-    ui/VBoxGLSettingsInput.ui \
-    ui/VBoxGLSettingsUpdate.ui \
-    ui/VBoxGLSettingsLanguage.ui \
-    ui/VBoxGLSettingsNetwork.ui \
-    ui/VBoxGLSettingsNetworkDetails.ui \
-    ui/VBoxApplianceEditorWgt.ui \
-    ui/VBoxImportApplianceWzd.ui \
-    ui/VBoxExportApplianceWzd.ui
+    src/VBoxCloseVMDlg.ui \
+    src/VBoxVMInformationDlg.ui \
+    src/VBoxMediaManagerDlg.ui \
+    src/VBoxSnapshotDetailsDlg.ui \
+    src/VBoxSnapshotsWgt.ui \
+    src/VBoxRegistrationDlg.ui \
+    src/VBoxTakeSnapshotDlg.ui \
+    src/VBoxUpdateDlg.ui \
+    src/VBoxVMLogViewer.ui \
+    src/settings/VBoxSettingsDialog.ui \
+    src/settings/vm/VBoxVMSettingsGeneral.ui \
+    src/settings/vm/VBoxVMSettingsSystem.ui \
+    src/settings/vm/VBoxVMSettingsDisplay.ui \
+    src/settings/vm/VBoxVMSettingsHD.ui \
+    src/settings/vm/VBoxVMSettingsAudio.ui \
+    src/settings/vm/VBoxVMSettingsNetwork.ui \
+    src/settings/vm/VBoxVMSettingsSerial.ui \
+    src/settings/vm/VBoxVMSettingsParallel.ui \
+    src/settings/vm/VBoxVMSettingsUSB.ui \
+    src/settings/vm/VBoxVMSettingsUSBFilterDetails.ui \
+    src/settings/vm/VBoxVMSettingsSF.ui \
+    src/settings/vm/VBoxVMSettingsSFDetails.ui \
+    src/settings/global/VBoxGLSettingsGeneral.ui \
+    src/settings/global/VBoxGLSettingsInput.ui \
+    src/settings/global/VBoxGLSettingsUpdate.ui \
+    src/settings/global/VBoxGLSettingsLanguage.ui \
+    src/settings/global/VBoxGLSettingsNetwork.ui \
+    src/settings/global/VBoxGLSettingsNetworkDetails.ui \
+    src/wizards/newvm/VBoxNewVMWzd.ui \
+    src/wizards/newhd/VBoxNewHDWzd.ui \
+    src/wizards/firstrun/VBoxVMFirstRunWzd.ui \
+    src/wizards/exportappliance/VBoxExportApplianceWzd.ui \
+    src/wizards/importappliance/VBoxImportApplianceWzd.ui \
+    src/widgets/VBoxApplianceEditorWgt.ui
 
 TRANSLATIONS = \
Index: trunk/src/VBox/Frontends/VirtualBox/src/COMDefs.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/COMDefs.cpp	(revision 25170)
+++ 	(revision )
@@ -1,413 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * CInterface implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "COMDefs.h"
-
-#if !defined (VBOX_WITH_XPCOM)
-
-#else /* !defined (VBOX_WITH_XPCOM) */
-
-/* Qt includes */
-#include <QObject>
-#include <QSocketNotifier>
-
-#include <nsEventQueueUtils.h>
-#include <nsIEventQueue.h>
-
-// for exception fetching
-#include <nsIExceptionService.h>
-
-#include <iprt/env.h>
-#include <iprt/path.h>
-#include <iprt/param.h>
-#include <iprt/err.h>
-
-/* Mac OS X (Carbon mode) and OS/2 will notify the native queue
-   internally in plevent.c. Because moc doesn't seems to respect
-   #ifdefs, we still have to include the definition of the class.
-   very silly. */
-# if !defined (Q_OS_MAC)  && !defined (Q_OS_OS2)
-XPCOMEventQSocketListener *COMBase::sSocketListener = 0;
-
-# endif
-
-/**
- *  Internal class to asyncronously handle IPC events on the GUI thread
- *  using the event queue socket FD and QSocketNotifier.
- */
-class XPCOMEventQSocketListener : public QObject
-{
-    Q_OBJECT
-
-public:
-
-    XPCOMEventQSocketListener (nsIEventQueue *eq)
-    {
-        mEventQ = eq;
-        mNotifier = new QSocketNotifier (mEventQ->GetEventQueueSelectFD(),
-                                         QSocketNotifier::Read, this);
-        QObject::connect (mNotifier, SIGNAL (activated (int)),
-                          this, SLOT (processEvents()));
-    }
-
-    virtual ~XPCOMEventQSocketListener()
-    {
-        delete mNotifier;
-    }
-
-public slots:
-
-    void processEvents() { mEventQ->ProcessPendingEvents(); }
-
-private:
-
-    QSocketNotifier *mNotifier;
-    nsCOMPtr <nsIEventQueue> mEventQ;
-};
-
-#endif /* !defined (VBOX_WITH_XPCOM) */
-
-/**
- *  Initializes COM/XPCOM.
- */
-HRESULT COMBase::InitializeCOM()
-{
-    LogFlowFuncEnter();
-
-    /* Note: On Win32, Qt somehow calls CoInitialize[Ex]() during creation of
-     * the QApplication instance (didn't explore deeply why it does so) with
-     * different flags which is incompatible with our multithreaded
-     * apartment. com::Initialize() will properly care of this situation. */
-
-    HRESULT rc = com::Initialize();
-
-#if defined (VBOX_WITH_XPCOM)
-
-# if !defined (RT_OS_DARWIN) && !defined (RT_OS_OS2)
-
-    if (NS_SUCCEEDED (rc))
-    {
-        nsCOMPtr <nsIEventQueue> eventQ;
-        rc = NS_GetMainEventQ (getter_AddRefs (eventQ));
-        if (NS_SUCCEEDED (rc))
-        {
-#  ifdef DEBUG
-            BOOL isNative = FALSE;
-            eventQ->IsQueueNative (&isNative);
-            AssertMsg (isNative, ("The event queue must be native"));
-#  endif
-            BOOL isOnMainThread = FALSE;
-            rc = eventQ->IsOnCurrentThread (&isOnMainThread);
-            if (NS_SUCCEEDED (rc) && isOnMainThread)
-            {
-                sSocketListener = new XPCOMEventQSocketListener (eventQ);
-            }
-        }
-    }
-
-# endif /* !defined (RT_OS_DARWIN) && !defined (RT_OS_OS) */
-
-#endif /* defined (VBOX_WITH_XPCOM) */
-
-    if (FAILED (rc))
-        CleanupCOM();
-
-    AssertComRC (rc);
-
-    LogFlowFunc (("rc=%08X\n", rc));
-    LogFlowFuncLeave();
-    return rc;
-
-}
-
-/**
- *  Cleans up COM/XPCOM.
- */
-HRESULT COMBase::CleanupCOM()
-{
-    LogFlowFuncEnter();
-
-    HRESULT rc = S_OK;
-
-#if defined (VBOX_WITH_XPCOM)
-
-    /* scope the code to make smart references are released before calling
-     * com::Shutdown() */
-    {
-        nsCOMPtr <nsIEventQueue> eventQ;
-        rc = NS_GetMainEventQ (getter_AddRefs (eventQ));
-        if (NS_SUCCEEDED (rc))
-        {
-            BOOL isOnMainThread = FALSE;
-            rc = eventQ->IsOnCurrentThread (&isOnMainThread);
-            if (NS_SUCCEEDED (rc) && isOnMainThread)
-            {
-# if !defined (RT_OS_DARWIN) && !defined (RT_OS_OS2)
-                if (sSocketListener)
-                {
-                    delete sSocketListener;
-                    sSocketListener = NULL;
-                }
-# endif
-            }
-        }
-    }
-
-#endif /* defined (VBOX_WITH_XPCOM) */
-
-    HRESULT rc2 = com::Shutdown();
-    if (SUCCEEDED (rc))
-        rc = rc2;
-
-    AssertComRC (rc);
-
-    LogFlowFunc (("rc=%08X\n", rc));
-    LogFlowFuncLeave();
-    return rc;
-}
-
-/* static */
-void COMBase::ToSafeArray (const QVector <QString> &aVec,
-                           com::SafeArray <BSTR> &aArr)
-{
-    aArr.reset (aVec.size());
-    for (int i = 0; i < aVec.size(); ++ i)
-        aArr [i] = SysAllocString ((const OLECHAR *)
-            (aVec.at (i).isNull() ? 0 : aVec.at (i).utf16()));
-}
-
-/* static */
-void COMBase::FromSafeArray (const com::SafeArray <BSTR> &aArr,
-                             QVector <QString> &aVec)
-{
-    aVec.resize (static_cast <int> (aArr.size()));
-    for (int i = 0; i < aVec.size(); ++ i)
-        aVec [i] = QString::fromUtf16 (aArr [i]);
-}
-
-/* static */
-void COMBase::ToSafeArray (const QVector <QUuid> &aVec,
-                           com::SafeGUIDArray &aArr)
-{
-    AssertCompileSize (GUID, sizeof (QUuid));
-    aArr.reset (aVec.size());
-    for (int i = 0; i < aVec.size(); ++ i)
-        aArr [i] = *(GUID*) &aVec [i];
-}
-
-/* static */
-void COMBase::FromSafeArray (const com::SafeGUIDArray &aArr,
-                             QVector <QUuid> &aVec)
-{
-    AssertCompileSize (GUID, sizeof (QUuid));
-    aVec.resize (static_cast <int> (aArr.size()));
-    for (int i = 0; i < aVec.size(); ++ i)
-        aVec [i] = *(QUuid*) &aArr [i];
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-void COMErrorInfo::init (const CVirtualBoxErrorInfo &info)
-{
-    AssertReturnVoid (!info.isNull());
-
-    bool gotSomething = false;
-    bool gotAll = true;
-
-    mResultCode = info.GetResultCode();
-    gotSomething |= info.isOk();
-    gotAll &= info.isOk();
-
-    mInterfaceID = info.GetInterfaceID();
-    gotSomething |= info.isOk();
-    gotAll &= info.isOk();
-    if (info.isOk())
-        mInterfaceName = getInterfaceNameFromIID (mInterfaceID);
-
-    mComponent = info.GetComponent();
-    gotSomething |= info.isOk();
-    gotAll &= info.isOk();
-
-    mText = info.GetText();
-    gotSomething |= info.isOk();
-    gotAll &= info.isOk();
-
-    CVirtualBoxErrorInfo next = info.GetNext();
-    if (info.isOk() && !next.isNull())
-    {
-        mNext.reset (new COMErrorInfo (next));
-        Assert (mNext.get());
-    }
-    else
-        mNext.reset();
-    gotSomething |= info.isOk();
-    gotAll &= info.isOk();
-
-    mIsBasicAvailable = gotSomething;
-    mIsFullAvailable = gotAll;
-
-    mIsNull = gotSomething;
-
-    AssertMsg (gotSomething, ("Nothing to fetch!\n"));
-}
-
-/**
- *  Fetches error info from the current thread.
- *  If callee is NULL, then error info is fetched in "interfaceless"
- *  manner (so calleeIID() and calleeName() will return null).
- *
- *  @param  callee
- *      pointer to the interface whose method returned an error
- *  @param  calleeIID
- *      UUID of the callee's interface. Ignored when callee is NULL
- */
-void COMErrorInfo::fetchFromCurrentThread (IUnknown *callee, const GUID *calleeIID)
-{
-    mIsNull = true;
-    mIsFullAvailable = mIsBasicAvailable = false;
-
-    AssertReturn (!callee || calleeIID, (void) 0);
-
-    HRESULT rc = E_FAIL;
-
-#if !defined (VBOX_WITH_XPCOM)
-
-    if (callee)
-    {
-        CComPtr <IUnknown> iface = callee;
-        CComQIPtr <ISupportErrorInfo> serr;
-        serr = callee;
-        if (!serr)
-            return;
-        rc = serr->InterfaceSupportsErrorInfo (*calleeIID);
-        if (!SUCCEEDED (rc))
-            return;
-    }
-
-    CComPtr <IErrorInfo> err;
-    rc = ::GetErrorInfo (0, &err);
-    if (rc == S_OK && err)
-    {
-        CComPtr <IVirtualBoxErrorInfo> info;
-        info = err;
-        if (info)
-            init (CVirtualBoxErrorInfo (info));
-
-        if (!mIsFullAvailable)
-        {
-            bool gotSomething = false;
-
-            rc = err->GetGUID (COMBase::GUIDOut (mInterfaceID));
-            gotSomething |= SUCCEEDED (rc);
-            if (SUCCEEDED (rc))
-                mInterfaceName = getInterfaceNameFromIID (mInterfaceID);
-
-            rc = err->GetSource (COMBase::BSTROut (mComponent));
-            gotSomething |= SUCCEEDED (rc);
-
-            rc = err->GetDescription (COMBase::BSTROut (mText));
-            gotSomething |= SUCCEEDED (rc);
-
-            if (gotSomething)
-                mIsBasicAvailable = true;
-
-            mIsNull = gotSomething;
-
-            AssertMsg (gotSomething, ("Nothing to fetch!\n"));
-        }
-    }
-
-#else /* !defined (VBOX_WITH_XPCOM) */
-
-    nsCOMPtr <nsIExceptionService> es;
-    es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
-    if (NS_SUCCEEDED (rc))
-    {
-        nsCOMPtr <nsIExceptionManager> em;
-        rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
-        if (NS_SUCCEEDED (rc))
-        {
-            nsCOMPtr <nsIException> ex;
-            rc = em->GetCurrentException (getter_AddRefs(ex));
-            if (NS_SUCCEEDED (rc) && ex)
-            {
-                nsCOMPtr <IVirtualBoxErrorInfo> info;
-                info = do_QueryInterface (ex, &rc);
-                if (NS_SUCCEEDED (rc) && info)
-                    init (CVirtualBoxErrorInfo (info));
-
-                if (!mIsFullAvailable)
-                {
-                    bool gotSomething = false;
-
-                    rc = ex->GetResult (&mResultCode);
-                    gotSomething |= NS_SUCCEEDED (rc);
-
-                    char *message = NULL; // utf8
-                    rc = ex->GetMessage (&message);
-                    gotSomething |= NS_SUCCEEDED (rc);
-                    if (NS_SUCCEEDED (rc) && message)
-                    {
-                        mText = QString::fromUtf8 (message);
-                        nsMemory::Free (message);
-                    }
-
-                    if (gotSomething)
-                        mIsBasicAvailable = true;
-
-                    mIsNull = gotSomething;
-
-                    AssertMsg (gotSomething, ("Nothing to fetch!\n"));
-                }
-
-                // set the exception to NULL (to emulate Win32 behavior)
-                em->SetCurrentException (NULL);
-
-                rc = NS_OK;
-            }
-        }
-    }
-
-    AssertComRC (rc);
-
-#endif /* !defined (VBOX_WITH_XPCOM) */
-
-    if (callee && calleeIID && mIsBasicAvailable)
-    {
-        mCalleeIID = COMBase::ToQUuid (*calleeIID);
-        mCalleeName = getInterfaceNameFromIID (mCalleeIID);
-    }
-}
-
-// static
-QString COMErrorInfo::getInterfaceNameFromIID (const QUuid &id)
-{
-    QString name;
-
-    com::GetInterfaceNameByIID (COMBase::GUIDIn (id), COMBase::BSTROut (name));
-
-    return name;
-}
-
-#if defined (VBOX_WITH_XPCOM)
-#include "COMDefs.moc"
-#endif
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIAbstractWizard.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIAbstractWizard.cpp	(revision 25170)
+++ 	(revision )
@@ -1,257 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * QIAbstractWizard class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIAbstractWizard.h"
-#include "QILabel.h"
-
-/* Qt includes */
-#include <QStackedWidget>
-#include <QPushButton>
-#include <QScrollBar>
-#include <VBoxGlobal.h>
-
-QITextEdit::QITextEdit (QWidget *aParent)
-    : QTextEdit (aParent)
-{
-    /* Disable the background painting of the editor widget. */
-    viewport()->setAutoFillBackground (false);
-    /* Make editor readonly by default. */
-    setReadOnly (true);
-}
-
-QSize QITextEdit::sizeHint() const
-{
-    /* If there is an updated sizeHint() present - using it. */
-    return mOwnSizeHint.isValid() ? mOwnSizeHint : QTextEdit::sizeHint();
-}
-
-QSize QITextEdit::minimumSizeHint() const
-{
-    /* Viewer should not influent layout if there is no text. */
-    return QSize (0, 0);
-}
-
-void QITextEdit::updateSizeHint()
-{
-    if (document())
-    {
-        int w = (int)document()->size().width();
-        int h = (int)document()->size().height() + 2;
-        if (horizontalScrollBar()->isVisible())
-            h += horizontalScrollBar()->height();
-        mOwnSizeHint = QSize (w, h);
-    }
-    updateGeometry();
-}
-
-void QITextEdit::setText (const QString &aText)
-{
-    QTextEdit::setText (aText);
-    updateSizeHint();
-}
-
-
-QIAbstractWizard::QIAbstractWizard (QWidget *aParent,
-                                    Qt::WindowFlags aFlags)
-    : QDialog (aParent, aFlags)
-    , mStackedWidget (0)
-    , mFinishButton (0)
-{
-}
-
-void QIAbstractWizard::initializeWizardHdr()
-{
-    /* Search for widget stack of inherited dialog.
-     * Please note what widget stack should have objectName()
-     * equal "mPageStack". */
-    mStackedWidget = findChild<QStackedWidget*> ("mPageStack");
-    Assert (mStackedWidget);
-    connect (mStackedWidget, SIGNAL (currentChanged (int)),
-             this, SLOT (onPageShow()));
-    mStackedWidget->setCurrentIndex (0);
-
-    /* Assigning all next buttons of inherited dialog.
-     * Please note what all next buttons should have objectName()
-     * matching mBtnNext<number> rule. */
-    for (int i = 0; i < mStackedWidget->count() - 1; ++ i)
-    {
-        QWidget *page = mStackedWidget->widget (i);
-        QList<QPushButton*> list =
-            page->findChildren<QPushButton*> (QRegExp ("mBtnNext\\d*"));
-        Assert (list.count() <= 1);
-        if (list.count() == 1)
-        {
-            connect (list [0], SIGNAL (clicked()), this, SLOT (showNextPage()));
-            mNextButtons << list [0];
-        }
-    }
-
-    /* Assigning all back buttons of inherited dialog.
-     * Please note what all back buttons should have objectName()
-     * matching mBtnBack<number> rule. */
-    for (int i = 0; i < mStackedWidget->count(); ++ i)
-    {
-        QWidget *page = mStackedWidget->widget (i);
-        QList<QPushButton*> list =
-            page->findChildren<QPushButton*> (QRegExp ("mBtnBack\\d*"));
-        Assert (list.count() <= 1);
-        if (list.count() == 1)
-        {
-            connect (list [0], SIGNAL (clicked()), this, SLOT (showBackPage()));
-            mBackButtons << list [0];
-        }
-    }
-
-    /* Assigning all cancel buttons of inherited dialog.
-     * Please note what all cancel buttons should have objectName()
-     * matching mBtnCancel<number> rule. */
-    for (int i = 0; i < mStackedWidget->count(); ++ i)
-    {
-        QWidget *page = mStackedWidget->widget (i);
-        QList<QPushButton*> list =
-            page->findChildren<QPushButton*> (QRegExp ("mBtnCancel\\d*"));
-        Assert (list.count() <= 1);
-        if (list.count() == 1)
-        {
-            connect (list [0], SIGNAL (clicked()), this, SLOT (reject()));
-            mCancelButtons << list [0];
-        }
-    }
-
-    /* Assigning finish button of inherited dialog.
-     * Please note what finish button should have objectName()
-     * matching mBtnFinish. */
-    mFinishButton = findChild<QPushButton*> ("mBtnFinish");
-    Assert (mFinishButton);
-    connect (mFinishButton, SIGNAL (clicked()), this, SLOT (accept()));
-
-    /* Decorating all wizard logo images of inherited dialog.
-     * Please note what all logo images should have objectName()
-     * matching mLogo<subname> rule. */
-    QList<QLabel*> logoImages =
-        findChildren<QLabel*> (QRegExp ("mLogo.+"));
-    Assert (logoImages.count());
-    for (int i = 0; i < logoImages.count(); ++ i)
-        VBoxGlobal::adoptLabelPixmap (logoImages [i]);
-
-#ifdef Q_WS_MAC
-    /* On the Mac we need at least a size of 14 points. */
-    QList<QLabel*> pageHeaders =
-        findChildren<QLabel*> (QRegExp ("m.+Hdr"));
-    for (int i = 0; i < pageHeaders.count(); ++i)
-    {
-        QLabel *lb = pageHeaders [i];
-        QFont f = lb->font();
-        f.setPointSize (14);
-        lb->setFont (f);
-    }
-#endif /* Q_WS_MAC */
-}
-
-void QIAbstractWizard::initializeWizardFtr()
-{
-    /* Update sizeHint() of all text labels of inherited dialog.
-     * Please note what all text labels should have objectName()
-     * matching mText<subname> rule. */
-    QList<QILabel*> textLabels =
-        findChildren<QILabel*> (QRegExp ("mText.+"));
-    for (int i = 0; i < textLabels.count(); ++ i)
-        textLabels [i]->useSizeHintForWidth (400);
-
-    /* Update sizeHint() of summary viewer of inherited dialog.
-     * Please note what summary viewer should have objectName()
-     * matching mTeSummary. */
-    QITextEdit *teSummary = findChild<QITextEdit*> ("mTeSummary");
-    if (teSummary)
-    {
-        teSummary->setMinimumWidth (400);
-        teSummary->updateSizeHint();
-    }
-}
-
-QPushButton* QIAbstractWizard::nextButton (QWidget *aOfPage)
-{
-    return getButton (aOfPage ? aOfPage : mStackedWidget->currentWidget(),
-                      "mBtnNext\\d*");
-}
-
-QPushButton* QIAbstractWizard::backButton (QWidget *aOfPage)
-{
-    return getButton (aOfPage ? aOfPage : mStackedWidget->currentWidget(),
-                      "mBtnBack\\d*");
-}
-
-QPushButton* QIAbstractWizard::cancelButton (QWidget *aOfPage)
-{
-    return getButton (aOfPage ? aOfPage : mStackedWidget->currentWidget(),
-                      "mBtnCancel\\d*");
-}
-
-QPushButton* QIAbstractWizard::finishButton()
-{
-    return getButton (mStackedWidget->widget (mStackedWidget->count() - 1),
-                      "mBtnFinish");
-}
-
-void QIAbstractWizard::showEvent (QShowEvent *aEvent)
-{
-    QDialog::showEvent (aEvent);
-
-    resize (minimumSize());
-
-    onPageShow();
-
-    VBoxGlobal::centerWidget (this, parentWidget());
-}
-
-void QIAbstractWizard::showNextPage()
-{
-    /* Switch to the next page */
-    mStackedWidget->setCurrentIndex (nextButtonIndex (nextButton()) + 1);
-}
-
-void QIAbstractWizard::showBackPage()
-{
-    /* Switch to the previous page */
-    mStackedWidget->setCurrentIndex (backButtonIndex (backButton()) - 1);
-}
-
-int QIAbstractWizard::nextButtonIndex (QPushButton *aNextButton)
-{
-    return mNextButtons.indexOf (aNextButton);
-}
-
-int QIAbstractWizard::backButtonIndex (QPushButton *aBackButton)
-{
-    return mBackButtons.indexOf (aBackButton);
-}
-
-QPushButton* QIAbstractWizard::getButton (QWidget *aOfPage,
-                                          const QString &aRegExp)
-{
-    Assert (aOfPage && !aRegExp.isNull());
-    QList<QPushButton*> buttonsList =
-        aOfPage->findChildren<QPushButton*> (QRegExp (aRegExp));
-    Assert (buttonsList.count() == 1);
-    return buttonsList [0];
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIAdvancedSlider.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIAdvancedSlider.cpp	(revision 25170)
+++ 	(revision )
@@ -1,289 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIAdvancedSlider class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIAdvancedSlider.h"
-#include "VBoxGlobal.h"
-
-/* Qt includes */
-#include <QVBoxLayout>
-#include <QPainter>
-#include <QStyle>
-#include <QStyleOptionSlider>
-
-/* System includes */
-#include <math.h>
-
-class CPrivateSlider: public QSlider
-{
-public:
-    CPrivateSlider (Qt::Orientation aOrientation, QWidget *aParent = 0)
-      : QSlider (aOrientation, aParent)
-      , mOptColor (0x0, 0xff, 0x0, 0x3c)
-      , mWrnColor (0xff, 0x54, 0x0, 0x3c)
-      , mErrColor (0xff, 0x0, 0x0, 0x3c)
-      , mMinOpt (-1)
-      , mMaxOpt (-1)
-      , mMinWrn (-1)
-      , mMaxWrn (-1)
-      , mMinErr (-1)
-      , mMaxErr (-1)
-    {}
-
-    int positionForValue (int aVal) const
-    {
-        QStyleOptionSlider opt;
-        initStyleOption (&opt);
-        opt.subControls = QStyle::SC_All;
-        int available = opt.rect.width() - style()->pixelMetric (QStyle::PM_SliderLength, &opt, this);
-        return QStyle::sliderPositionFromValue (opt.minimum, opt.maximum, aVal, available);
-    }
-
-    virtual void paintEvent (QPaintEvent *aEvent)
-    {
-        QPainter p(this);
-
-        QStyleOptionSlider opt;
-        initStyleOption (&opt);
-        opt.subControls = QStyle::SC_All;
-
-        int available = opt.rect.width() - style()->pixelMetric (QStyle::PM_SliderLength, &opt, this);
-        QSize s = size();
-
-        QRect ticks = style()->subControlRect (QStyle::CC_Slider, &opt, QStyle::SC_SliderTickmarks, this);
-#ifdef Q_WS_MAC
-        ticks.setRect ((s.width() - available) / 2, s.height() - ticks.y(), available, ticks.height());
-#else /* Q_WS_MAC */
-        if (ticks.isNull() || ticks.isEmpty())
-        {
-            ticks = style()->subControlRect (QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this) | style()->subControlRect (QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, this);
-            ticks.setRect ((s.width() - available) / 2, ticks.bottom() + 1, available, s.height() - ticks.bottom() - 1);
-        }
-#endif /* Q_WS_MAC */
-        if ((mMinOpt != -1 &&
-             mMaxOpt != -1) &&
-            mMinOpt != mMaxOpt)
-        {
-            int posMinOpt = QStyle::sliderPositionFromValue (opt.minimum, opt.maximum, mMinOpt, available);
-            int posMaxOpt = QStyle::sliderPositionFromValue (opt.minimum, opt.maximum, mMaxOpt, available);
-            p.fillRect (ticks.x() + posMinOpt, ticks.y(), posMaxOpt - posMinOpt + 1, ticks.height(), mOptColor);
-        }
-        if ((mMinWrn != -1 &&
-             mMaxWrn != -1) &&
-            mMinWrn != mMaxWrn)
-        {
-            int posMinWrn = QStyle::sliderPositionFromValue (opt.minimum, opt.maximum, mMinWrn, available);
-            int posMaxWrn = QStyle::sliderPositionFromValue (opt.minimum, opt.maximum, mMaxWrn, available);
-            p.fillRect (ticks.x() + posMinWrn, ticks.y(), posMaxWrn - posMinWrn + 1, ticks.height(), mWrnColor);
-        }
-        if ((mMinErr != -1 &&
-             mMaxErr != -1) &&
-            mMinErr != mMaxErr)
-        {
-            int posMinErr = QStyle::sliderPositionFromValue (opt.minimum, opt.maximum, mMinErr, available);
-            int posMaxErr = QStyle::sliderPositionFromValue (opt.minimum, opt.maximum, mMaxErr, available);
-            p.fillRect (ticks.x() + posMinErr, ticks.y(), posMaxErr - posMinErr + 1, ticks.height(), mErrColor);
-        }
-        p.end();
-
-        QSlider::paintEvent (aEvent);
-    }
-
-    QColor mOptColor;
-    QColor mWrnColor;
-    QColor mErrColor;
-
-    int mMinOpt;
-    int mMaxOpt;
-    int mMinWrn;
-    int mMaxWrn;
-    int mMinErr;
-    int mMaxErr;
-};
-
-QIAdvancedSlider::QIAdvancedSlider (QWidget *aParent /* = 0 */)
-  : QWidget (aParent)
-{
-    init();
-}
-
-QIAdvancedSlider::QIAdvancedSlider (Qt::Orientation aOrientation, QWidget *aParent /* = 0 */)
-  : QWidget (aParent)
-{
-    init (aOrientation);
-}
-
-int QIAdvancedSlider::value() const
-{
-    return mSlider->value();
-}
-
-void QIAdvancedSlider::setRange (int aMinV, int aMaxV)
-{
-    mSlider->setRange (aMinV, aMaxV);
-}
-
-void QIAdvancedSlider::setMaximum (int aVal)
-{
-    mSlider->setMaximum (aVal);
-}
-
-int QIAdvancedSlider::maximum() const
-{
-    return mSlider->maximum();
-}
-
-void QIAdvancedSlider::setMinimum (int aVal)
-{
-    mSlider->setMinimum (aVal);
-}
-
-int QIAdvancedSlider::minimum() const
-{
-    return mSlider->minimum();
-}
-
-void QIAdvancedSlider::setPageStep (int aVal)
-{
-    mSlider->setPageStep (aVal);
-}
-
-int QIAdvancedSlider::pageStep() const
-{
-    return mSlider->pageStep();
-}
-
-void QIAdvancedSlider::setSingleStep (int aVal)
-{
-    mSlider->setSingleStep (aVal);
-}
-
-int QIAdvancedSlider::singelStep() const
-{
-    return mSlider->singleStep();
-}
-
-void QIAdvancedSlider::setTickInterval (int aVal)
-{
-    mSlider->setTickInterval (aVal);
-}
-
-int QIAdvancedSlider::tickInterval() const
-{
-    return mSlider->tickInterval();
-}
-
-void QIAdvancedSlider::setTickPosition (QSlider::TickPosition aPos)
-{
-    mSlider->setTickPosition (aPos);
-}
-
-QSlider::TickPosition QIAdvancedSlider::tickPosition() const
-{
-    return mSlider->tickPosition();
-}
-
-Qt::Orientation QIAdvancedSlider::orientation() const
-{
-    return mSlider->orientation();
-}
-
-void QIAdvancedSlider::setSnappingEnabled (bool aOn)
-{
-    mSnappingEnabled = aOn;
-}
-
-bool QIAdvancedSlider::isSnappingEnabled() const
-{
-    return mSnappingEnabled;
-}
-
-void QIAdvancedSlider::setOptimalHint (int aMin, int aMax)
-{
-    mSlider->mMinOpt = aMin;
-    mSlider->mMaxOpt = aMax;
-}
-
-void QIAdvancedSlider::setWarningHint (int aMin, int aMax)
-{
-    mSlider->mMinWrn = aMin;
-    mSlider->mMaxWrn = aMax;
-}
-
-void QIAdvancedSlider::setErrorHint (int aMin, int aMax)
-{
-    mSlider->mMinErr = aMin;
-    mSlider->mMaxErr = aMax;
-}
-
-void QIAdvancedSlider::setOrientation (Qt::Orientation aOrientation)
-{
-    mSlider->setOrientation (aOrientation);
-}
-
-void QIAdvancedSlider::setValue (int aVal)
-{
-    mSlider->setValue (aVal);
-}
-
-void QIAdvancedSlider::prvSliderMoved(int val)
-{
-    val = snapValue(val);
-    mSlider->setValue(val);
-    emit sliderMoved(val);
-}
-
-void QIAdvancedSlider::init (Qt::Orientation aOrientation /* = Qt::Horizontal */)
-{
-    mSnappingEnabled = false;
-
-    QVBoxLayout *pMainLayout = new QVBoxLayout (this);
-    VBoxGlobal::setLayoutMargin (pMainLayout, 0);
-    mSlider = new CPrivateSlider (aOrientation, this);
-    pMainLayout->addWidget (mSlider);
-
-    connect(mSlider, SIGNAL (sliderMoved(int)), this, SLOT (prvSliderMoved(int)));
-    connect(mSlider, SIGNAL (valueChanged(int)), this, SIGNAL (valueChanged(int)));
-    connect(mSlider, SIGNAL (sliderPressed()), this, SIGNAL (sliderPressed()));
-    connect(mSlider, SIGNAL (sliderReleased()), this, SIGNAL (sliderReleased()));
-}
-
-int QIAdvancedSlider::snapValue(int val)
-{
-    if (mSnappingEnabled &&
-        val > 2)
-    {
-        float l2 = log ((float)val)/log (2.0);
-        int newVal = (int) pow ((float)2, (int)qRound (l2)); /* The value to snap on */
-        int pos = mSlider->positionForValue (val); /* Get the relative screen pos for the original value */
-        int newPos = mSlider->positionForValue (newVal); /* Get the relative screen pos for the snap value */
-        if (abs (newPos - pos) < 5) /* 10 pixel snapping range */
-        {
-            val = newVal;
-            if (val > mSlider->maximum())
-                val = mSlider->maximum();
-            else if (val < mSlider->minimum())
-                val = mSlider->minimum();
-        }
-    }
-    return val;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIArrowButtonPress.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIArrowButtonPress.cpp	(revision 25170)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowButtonPress class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "QIArrowButtonPress.h"
-
-/* Qt includes */
-#include <QKeyEvent>
-
-
-/** @class QIArrowButtonPress
- *
- *  The QIArrowButtonPress class is an arrow tool-botton with text-label,
- *  used as back/next buttons in QIMessageBox class.
- *
- */
-
-QIArrowButtonPress::QIArrowButtonPress (QWidget *aParent)
-    : QIRichToolButton (aParent)
-    , mNext (true)
-{
-    updateIcon();
-}
-
-QIArrowButtonPress::QIArrowButtonPress (bool aNext, const QString &aName, QWidget *aParent)
-    : QIRichToolButton (aName, aParent)
-    , mNext (aNext)
-{
-    updateIcon();
-}
-
-void QIArrowButtonPress::updateIcon()
-{
-    mButton->setIcon (VBoxGlobal::iconSet (mNext ?
-                      ":/arrow_right_10px.png" : ":/arrow_left_10px.png"));
-}
-
-bool QIArrowButtonPress::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    /* Process only QIArrowButtonPress or children */
-    if (!(aObject == this || children().contains (aObject)))
-        return QIRichToolButton::eventFilter (aObject, aEvent);
-
-    /* Process keyboard events */
-    if (aEvent->type() == QEvent::KeyPress)
-    {
-        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
-        if ((mNext && kEvent->key() == Qt::Key_PageUp) ||
-            (!mNext && kEvent->key() == Qt::Key_PageDown))
-            animateClick();
-    }
-
-    /* Default one handler */
-    return QIRichToolButton::eventFilter (aObject, aEvent);
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIArrowButtonSwitch.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIArrowButtonSwitch.cpp	(revision 25170)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowButtonSwitch class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "QIArrowButtonSwitch.h"
-
-/* Qt includes */
-#include <QKeyEvent>
-
-
-/** @class QIArrowButtonSwitch
- *
- *  The QIArrowButtonSwitch class is an arrow tool-botton with text-label,
- *  used as collaps/expand switch in QIMessageBox class.
- *
- */
-
-QIArrowButtonSwitch::QIArrowButtonSwitch (QWidget *aParent)
-    : QIRichToolButton (aParent)
-    , mIsExpanded (false)
-{
-    updateIcon();
-}
-
-QIArrowButtonSwitch::QIArrowButtonSwitch (const QString &aName, QWidget *aParent)
-    : QIRichToolButton (aName, aParent)
-    , mIsExpanded (false)
-{
-    updateIcon();
-}
-
-void QIArrowButtonSwitch::buttonClicked()
-{
-    mIsExpanded = !mIsExpanded;
-    updateIcon();
-    QIRichToolButton::buttonClicked();
-}
-
-void QIArrowButtonSwitch::updateIcon()
-{
-    mButton->setIcon (VBoxGlobal::iconSet (mIsExpanded ?
-                      ":/arrow_down_10px.png" : ":/arrow_right_10px.png"));
-}
-
-bool QIArrowButtonSwitch::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    /* Process only QIArrowButtonSwitch or children */
-    if (!(aObject == this || children().contains (aObject)))
-        return QIRichToolButton::eventFilter (aObject, aEvent);
-
-    /* Process keyboard events */
-    if (aEvent->type() == QEvent::KeyPress)
-    {
-        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
-        if ((mIsExpanded && kEvent->key() == Qt::Key_Minus) ||
-            (!mIsExpanded && kEvent->key() == Qt::Key_Plus))
-            animateClick();
-    }
-
-    /* Default one handler */
-    return QIRichToolButton::eventFilter (aObject, aEvent);
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIArrowSplitter.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIArrowSplitter.cpp	(revision 25170)
+++ 	(revision )
@@ -1,168 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowSplitter class implementation
- */
-
-/*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "QIArrowSplitter.h"
-
-/* Qt includes */
-#include <QHBoxLayout>
-#include <QKeyEvent>
-
-QIArrowSplitter::QIArrowSplitter (QWidget *aChild, QWidget *aParent)
-    : QWidget (aParent)
-    , mMainLayout (new QVBoxLayout (this))
-    , mSwitchButton (new QIArrowButtonSwitch())
-    , mBackButton (new QIArrowButtonPress (false, tr ("&Back")))
-    , mNextButton (new QIArrowButtonPress (true,  tr ("&Next")))
-    , mChild (aChild)
-{
-    /* Setup main-layout */
-    VBoxGlobal::setLayoutMargin (mMainLayout, 0);
-
-    /* Setup buttons */
-    mBackButton->setVisible (false);
-    mNextButton->setVisible (false);
-
-    /* Setup connections */
-    connect (mSwitchButton, SIGNAL (clicked()), this, SLOT (toggleWidget()));
-    connect (mBackButton, SIGNAL (clicked()), this, SIGNAL (showBackDetails()));
-    connect (mNextButton, SIGNAL (clicked()), this, SIGNAL (showNextDetails()));
-
-    /* Setup button layout */
-    QHBoxLayout *buttonLayout = new QHBoxLayout();
-    VBoxGlobal::setLayoutMargin (buttonLayout, 0);
-    buttonLayout->setSpacing (0);
-    buttonLayout->addWidget (mSwitchButton);
-    buttonLayout->addStretch();
-    buttonLayout->addWidget (mBackButton);
-    buttonLayout->addWidget (mNextButton);
-
-    /* Append layout with children */
-    mMainLayout->addLayout (buttonLayout);
-    mMainLayout->addWidget (mChild);
-
-    /* Install event-filter */
-    qApp->installEventFilter (this);
-}
-
-void QIArrowSplitter::setMultiPaging (bool aMultiPage)
-{
-    mBackButton->setVisible (aMultiPage);
-    mNextButton->setVisible (aMultiPage);
-}
-
-void QIArrowSplitter::setButtonEnabled (bool aNext, bool aEnabled)
-{
-    aNext ? mNextButton->setEnabled (aEnabled)
-          : mBackButton->setEnabled (aEnabled);
-}
-
-void QIArrowSplitter::setName (const QString &aName)
-{
-    mSwitchButton->setText (aName);
-    relayout();
-}
-
-void QIArrowSplitter::toggleWidget()
-{
-    mChild->setVisible (mSwitchButton->isExpanded());
-    relayout();
-}
-
-bool QIArrowSplitter::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    /* Process only parent window children */
-    if (!(aObject == window() || window()->children().contains (aObject)))
-        return QWidget::eventFilter (aObject, aEvent);
-
-    /* Do not process QIArrowButtonSwitch & QIArrowButtonPress children */
-    if (aObject == mSwitchButton ||
-        aObject == mBackButton ||
-        aObject == mNextButton ||
-        mSwitchButton->children().contains (aObject) ||
-        mBackButton->children().contains (aObject) ||
-        mNextButton->children().contains (aObject))
-        return QWidget::eventFilter (aObject, aEvent);
-
-    /* Process some keyboard events */
-    if (aEvent->type() == QEvent::KeyPress)
-    {
-        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
-        switch (kEvent->key())
-        {
-            case Qt::Key_Plus:
-            {
-                if (!mSwitchButton->isExpanded())
-                    mSwitchButton->animateClick();
-                break;
-            }
-            case Qt::Key_Minus:
-            {
-                if (mSwitchButton->isExpanded())
-                    mSwitchButton->animateClick();
-                break;
-            }
-            case Qt::Key_PageUp:
-            {
-                if (mNextButton->isEnabled())
-                    mNextButton->animateClick();
-                break;
-            }
-            case Qt::Key_PageDown:
-            {
-                if (mBackButton->isEnabled())
-                    mBackButton->animateClick();
-                break;
-            }
-        }
-    }
-
-    /* Default one handler */
-    return QWidget::eventFilter (aObject, aEvent);
-}
-
-void QIArrowSplitter::relayout()
-{
-    /* Update full layout system of message window */
-    QList <QLayout*> layouts = findChildren <QLayout*> ();
-    foreach (QLayout *item, layouts)
-    {
-        item->update();
-        item->activate();
-    }
-
-    /* Update main layout of message window at last */
-    window()->layout()->update();
-    window()->layout()->activate();
-    qApp->processEvents();
-
-    /* Now resize window to minimum possible size */
-    window()->resize (window()->minimumSizeHint());
-    qApp->processEvents();
-
-    /* Check if we have to make dialog fixed in height */
-    if (mSwitchButton->isExpanded())
-        window()->setMaximumHeight (QWIDGETSIZE_MAX);
-    else
-        window()->setFixedHeight (window()->minimumSizeHint().height());
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIDialog.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIDialog.cpp	(revision 25170)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIDialog class implementation
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "QIDialog.h"
-#include "VBoxGlobal.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-#endif /* Q_WS_MAC */
-
-/* Qt includes */
-#include <QPointer>
-
-QIDialog::QIDialog (QWidget *aParent /* = 0 */, Qt::WindowFlags aFlags /* = 0 */)
-    : QDialog (aParent, aFlags)
-    , mPolished (false)
-    , mEventLoop (0)
-{
-}
-
-void QIDialog::showEvent (QShowEvent * /* aEvent */)
-{
-    /* Two thinks to do for fixed size dialogs on MacOS X:
-     * 1. Make sure the layout is polished and have the right size
-     * 2. Disable that _unnecessary_ size grip (Bug in Qt?) */
-    QSizePolicy policy = sizePolicy();
-    if ((policy.horizontalPolicy() == QSizePolicy::Fixed &&
-         policy.verticalPolicy() == QSizePolicy::Fixed) ||
-        (windowFlags() & Qt::Sheet) == Qt::Sheet)
-    {
-        adjustSize();
-        setFixedSize (size());
-#ifdef Q_WS_MAC
-        ::darwinSetShowsResizeIndicator (this, false);
-#endif /* Q_WS_MAC */
-    }
-
-    /* Polishing border */
-    if (mPolished)
-        return;
-    mPolished = true;
-
-    /* Explicit widget centering relatively to it's parent
-     * if any or desktop if parent is missed. */
-    VBoxGlobal::centerWidget (this, parentWidget(), false);
-}
-
-int QIDialog::exec (bool aShow /* = true */)
-{
-    /* Reset the result code */
-    setResult (QDialog::Rejected);
-
-    bool wasDeleteOnClose = testAttribute (Qt::WA_DeleteOnClose);
-    setAttribute (Qt::WA_DeleteOnClose, false);
-#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500
-    /* After 4.5 Qt changed the behavior of Sheets for the window/application
-     * modal case. See "New Ways of Using Dialogs" in
-     * http://doc.trolltech.com/qq/QtQuarterly30.pdf why. We want the old
-     * behavior back, where all modal windows where shown as sheets. So make
-     * the modal mode window, but be application modal in any case. */
-    Qt::WindowModality winModality = windowModality();
-    bool wasSetWinModality = testAttribute (Qt::WA_SetWindowModality);
-    if ((windowFlags() & Qt::Sheet) == Qt::Sheet)
-    {
-        setWindowModality (Qt::WindowModal);
-        setAttribute (Qt::WA_SetWindowModality, false);
-    }
-#endif /* defined(Q_WS_MAC) && QT_VERSION >= 0x040500 */
-    /* The dialog has to modal in any case. Save the current modality to
-     * restore it later. */
-    bool wasShowModal = testAttribute (Qt::WA_ShowModal);
-    setAttribute (Qt::WA_ShowModal, true);
-
-    /* Create a local event loop */
-    mEventLoop = new QEventLoop();
-    /* Show the window if requested */
-    if (aShow)
-        show();
-    /* A guard to ourself for the case we destroy ourself. */
-    QPointer<QIDialog> guard = this;
-    /* Start the event loop. This blocks. */
-    mEventLoop->exec();
-    /* Delete the event loop */
-    delete mEventLoop;
-    mEventLoop = 0;
-    /* Are we valid anymore? */
-    if (guard.isNull())
-        return QDialog::Rejected;
-    /* Save the result code in case we delete ourself */
-    QDialog::DialogCode res = (QDialog::DialogCode)result();
-#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500
-    /* Restore old modality mode */
-    if ((windowFlags() & Qt::Sheet) == Qt::Sheet)
-    {
-        setWindowModality (winModality);
-        setAttribute (Qt::WA_SetWindowModality, wasSetWinModality);
-    }
-#endif /* defined(Q_WS_MAC) && QT_VERSION >= 0x040500 */
-    /* Set the old show modal attribute */
-    setAttribute (Qt::WA_ShowModal, wasShowModal);
-    /* Delete us in the case we should do so on close */
-    if (wasDeleteOnClose)
-        delete this;
-    /* Return the final result */
-    return res;
-}
-
-void QIDialog::setVisible (bool aVisible)
-{
-    QDialog::setVisible (aVisible);
-    /* Exit from the event loop if there is any and we are changing our state
-     * from visible to invisible. */
-    if (mEventLoop && !aVisible)
-        mEventLoop->exit();
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIDialogButtonBox.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIDialogButtonBox.cpp	(revision 25170)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIDialogButtonBox class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIDialogButtonBox.h"
-#include "VBoxSpecialControls.h"
-
-#include <iprt/assert.h>
-
-/* Qt includes */
-#include <QPushButton>
-#include <QEvent>
-#include <QBoxLayout>
-
-QIDialogButtonBox::QIDialogButtonBox (StandardButtons aButtons, Qt::Orientation aOrientation, QWidget *aParent)
-   : QIWithRetranslateUI<QDialogButtonBox> (aParent)
-{
-    setOrientation (aOrientation);
-    setStandardButtons (aButtons);
-
-    retranslateUi();
-}
-
-QPushButton *QIDialogButtonBox::button (StandardButton aWhich) const
-{
-    QPushButton *button = QDialogButtonBox::button (aWhich);
-    if (!button &&
-        aWhich == QDialogButtonBox::Help)
-        button = mHelpButton;
-    return button;
-}
-
-QPushButton *QIDialogButtonBox::addButton (const QString &aText, ButtonRole aRole)
-{
-    QPushButton *btn = QDialogButtonBox::addButton (aText, aRole);
-    retranslateUi();
-    return btn;
-}
-
-QPushButton *QIDialogButtonBox::addButton (StandardButton aButton)
-{
-    QPushButton *btn = QDialogButtonBox::addButton (aButton);
-    retranslateUi();
-    return btn;
-}
-
-void QIDialogButtonBox::setStandardButtons (StandardButtons aButtons)
-{
-    QDialogButtonBox::setStandardButtons (aButtons);
-    retranslateUi();
-}
-
-void QIDialogButtonBox::addExtraWidget (QWidget* aWidget)
-{
-    QBoxLayout *layout = boxLayout();
-    int index = findEmptySpace (layout);
-    layout->insertWidget (index + 1, aWidget);
-    layout->insertStretch(index + 2);
-}
-
-
-void QIDialogButtonBox::addExtraLayout (QLayout* aLayout)
-{
-    QBoxLayout *layout = boxLayout();
-    int index = findEmptySpace (layout);
-    layout->insertLayout (index + 1, aLayout);
-    layout->insertStretch(index + 2);
-}
-
-QBoxLayout *QIDialogButtonBox::boxLayout() const
-{
-  QBoxLayout *boxlayout = qobject_cast<QBoxLayout*> (layout());
-  AssertMsg (VALID_PTR (boxlayout), ("Layout of the QDialogButtonBox isn't a box layout."));
-  return boxlayout;
-}
-
-int QIDialogButtonBox::findEmptySpace (QBoxLayout *aLayout) const
-{
-  /* Search for the first occurrence of QSpacerItem and return the index.
-   * Please note that this is Qt internal, so it may change at any time. */
-  int i=0;
-  for (; i < aLayout->count(); ++i)
-  {
-      QLayoutItem *item = aLayout->itemAt(i);
-      if (item->spacerItem())
-          break;
-  }
-  return i;
-}
-
-void QIDialogButtonBox::retranslateUi()
-{
-    QPushButton *btn = QDialogButtonBox::button (QDialogButtonBox::Help);
-    if (btn)
-    {
-        /* Use our very own help button if the user requested for one. */
-        if (!mHelpButton)
-            mHelpButton = new VBoxHelpButton;
-        mHelpButton->initFrom (btn);
-        removeButton (btn);
-        QDialogButtonBox::addButton (mHelpButton, QDialogButtonBox::HelpRole);
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIFileDialog.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIFileDialog.cpp	(revision 25170)
+++ 	(revision )
@@ -1,854 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Qt extensions: QIFileDialog class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "QIFileDialog.h"
-
-#if defined Q_WS_WIN
-
-/// @todo bird: Use (U)INT_PTR, (U)LONG_PTR, DWORD_PTR, or (u)intptr_t.
-#if defined Q_OS_WIN64
-typedef unsigned __int64 Q_ULONG;   /* word up to 64 bit unsigned */
-#else
-typedef unsigned long Q_ULONG;      /* word up to 64 bit unsigned */
-#endif
-
-/* Qt includes */
-#include <QEvent>
-#include <QEventLoop>
-#include <QThread>
-
-/* WinAPI includes */
-#include "shlobj.h"
-
-static QString extractFilter (const QString &aRawFilter)
-{
-    static const char qt_file_dialog_filter_reg_exp[] =
-        "([a-zA-Z0-9 ]*)\\(([a-zA-Z0-9_.*? +;#\\[\\]]*)\\)$";
-
-    QString result = aRawFilter;
-    QRegExp r (QString::fromLatin1 (qt_file_dialog_filter_reg_exp));
-    int index = r.indexIn (result);
-    if (index >= 0)
-        result = r.cap (2);
-    return result.replace (QChar (' '), QChar (';'));
-}
-
-/**
- * Converts QFileDialog filter list to Win32 API filter list.
- */
-static QString winFilter (const QString &aFilter)
-{
-    QStringList filterLst;
-
-    if (!aFilter.isEmpty())
-    {
-        int i = aFilter.indexOf (";;", 0);
-        QString sep (";;");
-        if (i == -1)
-        {
-            if (aFilter.indexOf ("\n", 0) != -1)
-            {
-                sep = "\n";
-                i = aFilter.indexOf (sep, 0);
-            }
-        }
-
-        filterLst = aFilter.split (sep);
-    }
-
-    QStringList::Iterator it = filterLst.begin();
-    QString winfilters;
-    for (; it != filterLst.end(); ++ it)
-    {
-        winfilters += *it;
-        winfilters += QChar::Null;
-        winfilters += extractFilter (*it);
-        winfilters += QChar::Null;
-    }
-    winfilters += QChar::Null;
-    return winfilters;
-}
-
-/*
- * Callback function to control the native Win32 API file dialog
- */
-UINT_PTR CALLBACK OFNHookProc (HWND aHdlg, UINT aUiMsg, WPARAM aWParam, LPARAM aLParam)
-{
-    if (aUiMsg == WM_NOTIFY)
-    {
-        OFNOTIFY *notif = (OFNOTIFY*) aLParam;
-        if (notif->hdr.code == CDN_TYPECHANGE)
-        {
-            /* locate native dialog controls */
-            HWND parent = GetParent (aHdlg);
-            HWND button = GetDlgItem (parent, IDOK);
-            HWND textfield = ::GetDlgItem (parent, cmb13);
-            if (textfield == NULL)
-                textfield = ::GetDlgItem (parent, edt1);
-            if (textfield == NULL)
-                return FALSE;
-            HWND selector = ::GetDlgItem (parent, cmb1);
-
-            /* simulate filter change by pressing apply-key */
-            int    size = 256;
-            TCHAR *buffer = (TCHAR*)malloc (size);
-            SendMessage (textfield, WM_GETTEXT, size, (LPARAM)buffer);
-            SendMessage (textfield, WM_SETTEXT, 0, (LPARAM)"\0");
-            SendMessage (button, BM_CLICK, 0, 0);
-            SendMessage (textfield, WM_SETTEXT, 0, (LPARAM)buffer);
-            free (buffer);
-
-            /* make request for focus moving to filter selector combo-box */
-            HWND curFocus = GetFocus();
-            PostMessage (curFocus, WM_KILLFOCUS, (WPARAM)selector, 0);
-            PostMessage (selector, WM_SETFOCUS, (WPARAM)curFocus, 0);
-            WPARAM wParam = MAKEWPARAM (WA_ACTIVE, 0);
-            PostMessage (selector, WM_ACTIVATE, wParam, (LPARAM)curFocus);
-        }
-    }
-    return FALSE;
-}
-
-/*
- * Callback function to control the native Win32 API folders dialog
- */
-static int __stdcall winGetExistDirCallbackProc (HWND hwnd, UINT uMsg,
-                                                 LPARAM lParam, LPARAM lpData)
-{
-    if (uMsg == BFFM_INITIALIZED && lpData != 0)
-    {
-        QString *initDir = (QString *)(lpData);
-        if (!initDir->isEmpty())
-        {
-            SendMessage (hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG (
-                initDir->isNull() ? 0 : initDir->utf16()));
-        }
-    }
-    else if (uMsg == BFFM_SELCHANGED)
-    {
-        TCHAR path [MAX_PATH];
-        SHGetPathFromIDList (LPITEMIDLIST (lParam), path);
-        QString tmpStr = QString::fromUtf16 ((ushort*)path);
-        if (!tmpStr.isEmpty())
-            SendMessage (hwnd, BFFM_ENABLEOK, 1, 1);
-        else
-            SendMessage (hwnd, BFFM_ENABLEOK, 0, 0);
-        SendMessage (hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG (path));
-    }
-    return 0;
-}
-
-/**
- *  QEvent class to carry Win32 API native dialog's result information
- */
-class OpenNativeDialogEvent : public QEvent
-{
-public:
-
-    OpenNativeDialogEvent (const QString &aResult, QEvent::Type aType)
-        : QEvent (aType), mResult (aResult) {}
-
-    const QString& result() { return mResult; }
-
-private:
-
-    QString mResult;
-};
-
-/**
- *  QObject class reimplementation which is the target for OpenNativeDialogEvent
- *  event. It receives OpenNativeDialogEvent event from another thread,
- *  stores result information and exits the given local event loop.
- */
-class LoopObject : public QObject
-{
-    Q_OBJECT;
-
-public:
-
-    LoopObject (QEvent::Type aType, QEventLoop &aLoop)
-        : mType (aType), mLoop (aLoop), mResult (QString::null) {}
-    const QString& result() { return mResult; }
-
-private:
-
-    bool event (QEvent *aEvent)
-    {
-        if (aEvent->type() == mType)
-        {
-            OpenNativeDialogEvent *ev = (OpenNativeDialogEvent*) aEvent;
-            mResult = ev->result();
-            mLoop.quit();
-            return true;
-        }
-        return QObject::event (aEvent);
-    }
-
-    QEvent::Type mType;
-    QEventLoop &mLoop;
-    QString mResult;
-};
-
-#endif /* Q_WS_WIN */
-
-QIFileDialog::QIFileDialog (QWidget *aParent, Qt::WindowFlags aFlags)
-    : QFileDialog (aParent, aFlags)
-{
-}
-
-/**
- *  Reimplementation of QFileDialog::getExistingDirectory() that removes some
- *  oddities and limitations.
- *
- *  On Win32, this function makes sure a native dialog is launched in
- *  another thread to avoid dialog visualization errors occuring due to
- *  multi-threaded COM apartment initialization on the main UI thread while
- *  the appropriate native dialog function expects a single-threaded one.
- *
- *  On all other platforms, this function is equivalent to
- *  QFileDialog::getExistingDirectory().
- */
-QString QIFileDialog::getExistingDirectory (const QString &aDir,
-                                            QWidget *aParent,
-                                            const QString &aCaption,
-                                            bool aDirOnly,
-                                            bool aResolveSymlinks)
-{
-#if defined Q_WS_WIN
-
-    /**
-     *  QEvent class reimplementation to carry Win32 API
-     *  native dialog's result folder information
-     */
-    class GetExistDirectoryEvent : public OpenNativeDialogEvent
-    {
-    public:
-
-        enum { TypeId = QEvent::User + 1 };
-
-        GetExistDirectoryEvent (const QString &aResult)
-            : OpenNativeDialogEvent (aResult, (QEvent::Type) TypeId) {}
-    };
-
-    /**
-     *  QThread class reimplementation to open Win32 API
-     *  native folder's dialog
-     */
-    class Thread : public QThread
-    {
-    public:
-
-        Thread (QWidget *aParent, QObject *aTarget,
-                const QString &aDir, const QString &aCaption)
-            : mParent (aParent), mTarget (aTarget), mDir (aDir), mCaption (aCaption) {}
-
-        virtual void run()
-        {
-            QString result;
-
-            QWidget *topParent = mParent ? mParent->window() : vboxGlobal().mainWindow();
-            QString title = mCaption.isNull() ? tr ("Select a directory") : mCaption;
-
-            TCHAR path [MAX_PATH];
-            path [0] = 0;
-            TCHAR initPath [MAX_PATH];
-            initPath [0] = 0;
-
-            BROWSEINFO bi;
-            bi.hwndOwner = topParent ? topParent->winId() : 0;
-            bi.pidlRoot = 0;
-            bi.lpszTitle = (TCHAR*)(title.isNull() ? 0 : title.utf16());
-            bi.pszDisplayName = initPath;
-            bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
-            bi.lpfn = winGetExistDirCallbackProc;
-            bi.lParam = Q_ULONG (&mDir);
-
-            LPITEMIDLIST itemIdList = SHBrowseForFolder (&bi);
-            if (itemIdList)
-            {
-                SHGetPathFromIDList (itemIdList, path);
-                IMalloc *pMalloc;
-                if (SHGetMalloc (&pMalloc) != NOERROR)
-                    result = QString::null;
-                else
-                {
-                    pMalloc->Free (itemIdList);
-                    pMalloc->Release();
-                    result = QString::fromUtf16 ((ushort*)path);
-                }
-            }
-            else
-                result = QString::null;
-            QApplication::postEvent (mTarget, new GetExistDirectoryEvent (result));
-        }
-
-    private:
-
-        QWidget *mParent;
-        QObject *mTarget;
-        QString mDir;
-        QString mCaption;
-    };
-
-    /* Local event loop to run while waiting for the result from another
-     * thread */
-    QEventLoop loop;
-
-    QString dir = QDir::toNativeSeparators (aDir);
-    LoopObject loopObject ((QEvent::Type) GetExistDirectoryEvent::TypeId, loop);
-
-    Thread openDirThread (aParent, &loopObject, dir, aCaption);
-    openDirThread.start();
-    loop.exec();
-    openDirThread.wait();
-
-    return loopObject.result();
-
-#elif defined (Q_WS_X11) && (QT_VERSION < 0x040400)
-
-    /* Here is workaround for Qt4.3 bug with QFileDialog which crushes when
-     * gets initial path as hidden directory if no hidden files are shown.
-     * See http://trolltech.com/developer/task-tracker/index_html?method=entry&id=193483
-     * for details */
-    QFileDialog dlg (aParent);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aDir);
-    dlg.setResolveSymlinks (aResolveSymlinks);
-    dlg.setFileMode (aDirOnly ? QFileDialog::DirectoryOnly : QFileDialog::Directory);
-    QAction *hidden = dlg.findChild <QAction*> ("qt_show_hidden_action");
-    if (hidden)
-    {
-        hidden->trigger();
-        hidden->setVisible (false);
-    }
-    return dlg.exec() ? dlg.selectedFiles() [0] : QString::null;
-#elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600)
-
-    /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using
-     * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because
-     * we are lazy, we recreate the old behavior. Unfortunately there is a bug
-     * in Qt 4.5.x which result in showing the native & the Qt dialog at the
-     * same time. */
-    QFileDialog dlg (aParent, Qt::Sheet);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aDir);
-    dlg.setResolveSymlinks (aResolveSymlinks);
-    dlg.setFileMode (aDirOnly ? QFileDialog::DirectoryOnly : QFileDialog::Directory);
-
-    QEventLoop eventLoop;
-    QObject::connect(&dlg, SIGNAL(finished(int)),
-                     &eventLoop, SLOT(quit()));
-    /* Use the new open call. */
-    dlg.open();
-    eventLoop.exec();
-
-    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles() [0] : QString::null;
-
-#else
-
-    QFileDialog::Options o;
-    if (aDirOnly)
-        o = QFileDialog::ShowDirsOnly;
-    if (!aResolveSymlinks)
-        o |= QFileDialog::DontResolveSymlinks;
-    return QFileDialog::getExistingDirectory (aParent, aCaption, aDir, o);
-
-#endif
-}
-
-/**
- *  Reimplementation of QFileDialog::getSaveFileName() that removes some
- *  oddities and limitations.
- *
- *  On Win32, this function makes sure a file filter is applied automatically
- *  right after it is selected from the drop-down list, to conform to common
- *  experience in other applications. Note that currently, @a selectedFilter
- *  is always set to null on return.
- *
- *  On all other platforms, this function is equivalent to
- *  QFileDialog::getSaveFileName().
- */
-/* static */
-QString QIFileDialog::getSaveFileName (const QString &aStartWith,
-                                       const QString &aFilters,
-                                       QWidget       *aParent,
-                                       const QString &aCaption,
-                                       QString       *aSelectedFilter /* = 0 */,
-                                       bool           aResolveSymlinks /* = true */)
-{
-#if defined Q_WS_WIN
-
-    /**
-     *  QEvent class reimplementation to carry Win32 API native dialog's
-     *  result folder information
-     */
-    class GetOpenFileNameEvent : public OpenNativeDialogEvent
-    {
-    public:
-
-        enum { TypeId = QEvent::User + 2 };
-
-        GetOpenFileNameEvent (const QString &aResult)
-            : OpenNativeDialogEvent (aResult, (QEvent::Type) TypeId) {}
-    };
-
-    /**
-     *  QThread class reimplementation to open Win32 API native file dialog
-     */
-    class Thread : public QThread
-    {
-    public:
-
-        Thread (QWidget *aParent, QObject *aTarget,
-                const QString &aStartWith, const QString &aFilters,
-                const QString &aCaption) :
-                mParent (aParent), mTarget (aTarget),
-                mStartWith (aStartWith), mFilters (aFilters),
-                mCaption (aCaption) {}
-
-        virtual void run()
-        {
-            QString result;
-
-            QString workDir;
-            QString initSel;
-            QFileInfo fi (mStartWith);
-
-            if (fi.isDir())
-                workDir = mStartWith;
-            else
-            {
-                workDir = fi.absolutePath();
-                initSel = fi.fileName();
-            }
-
-            workDir = QDir::toNativeSeparators (workDir);
-            if (!workDir.endsWith ("\\"))
-                workDir += "\\";
-
-            QString title = mCaption.isNull() ? tr ("Select a file") : mCaption;
-
-            QWidget *topParent = mParent ? mParent->window() : vboxGlobal().mainWindow();
-            QString winFilters = winFilter (mFilters);
-            AssertCompile (sizeof (TCHAR) == sizeof (QChar));
-            TCHAR buf [1024];
-            if (initSel.length() > 0 && initSel.length() < sizeof (buf))
-                memcpy (buf, initSel.isNull() ? 0 : initSel.utf16(),
-                        (initSel.length() + 1) * sizeof (TCHAR));
-            else
-                buf [0] = 0;
-
-            OPENFILENAME ofn;
-            memset (&ofn, 0, sizeof (OPENFILENAME));
-
-            ofn.lStructSize = sizeof (OPENFILENAME);
-            ofn.hwndOwner = topParent ? topParent->winId() : 0;
-            ofn.lpstrFilter = (TCHAR *) winFilters.isNull() ? 0 : winFilters.utf16();
-            ofn.lpstrFile = buf;
-            ofn.nMaxFile = sizeof (buf) - 1;
-            ofn.lpstrInitialDir = (TCHAR *) workDir.isNull() ? 0 : workDir.utf16();
-            ofn.lpstrTitle = (TCHAR *) title.isNull() ? 0 : title.utf16();
-            ofn.Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY |
-                         OFN_EXPLORER | OFN_ENABLEHOOK |
-                         OFN_NOTESTFILECREATE);
-            ofn.lpfnHook = OFNHookProc;
-
-            if (GetSaveFileName (&ofn))
-            {
-                result = QString::fromUtf16 ((ushort *) ofn.lpstrFile);
-            }
-
-            // qt_win_eatMouseMove();
-            MSG msg = {0, 0, 0, 0, 0, 0, 0};
-            while (PeekMessage (&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
-            if (msg.message == WM_MOUSEMOVE)
-                PostMessage (msg.hwnd, msg.message, 0, msg.lParam);
-
-            result = result.isEmpty() ? result : QFileInfo (result).absoluteFilePath();
-
-            QApplication::postEvent (mTarget, new GetOpenFileNameEvent (result));
-        }
-
-    private:
-
-        QWidget *mParent;
-        QObject *mTarget;
-        QString mStartWith;
-        QString mFilters;
-        QString mCaption;
-    };
-
-    if (aSelectedFilter)
-        *aSelectedFilter = QString::null;
-
-    /* Local event loop to run while waiting for the result from another
-     * thread */
-    QEventLoop loop;
-
-    QString startWith = QDir::toNativeSeparators (aStartWith);
-    LoopObject loopObject ((QEvent::Type) GetOpenFileNameEvent::TypeId, loop);
-
-    if (aParent)
-        aParent->setWindowModality (Qt::WindowModal);
-
-    Thread openDirThread (aParent, &loopObject, startWith, aFilters, aCaption);
-    openDirThread.start();
-    loop.exec();
-    openDirThread.wait();
-
-    if (aParent)
-        aParent->setWindowModality (Qt::NonModal);
-
-    return loopObject.result();
-
-#elif defined (Q_WS_X11) && (QT_VERSION < 0x040400)
-
-    /* Here is workaround for Qt4.3 bug with QFileDialog which crushes when
-     * gets initial path as hidden directory if no hidden files are shown.
-     * See http://trolltech.com/developer/task-tracker/index_html?method=entry&id=193483
-     * for details */
-    QFileDialog dlg (aParent);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aStartWith);
-    dlg.setFilter (aFilters);
-    dlg.setFileMode (QFileDialog::QFileDialog::AnyFile);
-    dlg.setAcceptMode (QFileDialog::AcceptSave);
-    if (aSelectedFilter)
-        dlg.selectFilter (*aSelectedFilter);
-    dlg.setResolveSymlinks (aResolveSymlinks);
-    dlg.setConfirmOverwrite (false);
-    QAction *hidden = dlg.findChild <QAction*> ("qt_show_hidden_action");
-    if (hidden)
-    {
-        hidden->trigger();
-        hidden->setVisible (false);
-    }
-    return dlg.exec() == QDialog::Accepted ? dlg.selectedFiles().value (0, "") : QString::null;
-
-#elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600)
-
-    /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using
-     * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because
-     * we are lazy, we recreate the old behavior. Unfortunately there is a bug
-     * in Qt 4.5.x which result in showing the native & the Qt dialog at the
-     * same time. */
-    QFileDialog dlg (aParent);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aStartWith);
-    dlg.setFilter (aFilters);
-    dlg.setFileMode (QFileDialog::QFileDialog::AnyFile);
-    dlg.setAcceptMode (QFileDialog::AcceptSave);
-    if (aSelectedFilter)
-        dlg.selectFilter (*aSelectedFilter);
-    dlg.setResolveSymlinks (aResolveSymlinks);
-    dlg.setConfirmOverwrite (false);
-
-    QEventLoop eventLoop;
-    QObject::connect(&dlg, SIGNAL(finished(int)),
-                     &eventLoop, SLOT(quit()));
-    /* Use the new open call. */
-    dlg.open();
-    eventLoop.exec();
-
-    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles().value (0, "") : QString::null;
-
-#else
-
-    QFileDialog::Options o;
-    if (!aResolveSymlinks)
-        o |= QFileDialog::DontResolveSymlinks;
-    o |= QFileDialog::DontConfirmOverwrite;
-    return QFileDialog::getSaveFileName (aParent, aCaption, aStartWith,
-                                         aFilters, aSelectedFilter, o);
-#endif
-}
-
-/**
- *  Reimplementation of QFileDialog::getOpenFileName() that removes some
- *  oddities and limitations.
- *
- *  On Win32, this function makes sure a file filter is applied automatically
- *  right after it is selected from the drop-down list, to conform to common
- *  experience in other applications. Note that currently, @a selectedFilter
- *  is always set to null on return.
- *
- *  On all other platforms, this function is equivalent to
- *  QFileDialog::getOpenFileName().
- */
-/* static */
-QString QIFileDialog::getOpenFileName (const QString &aStartWith,
-                                       const QString &aFilters,
-                                       QWidget       *aParent,
-                                       const QString &aCaption,
-                                       QString       *aSelectedFilter /* = 0 */,
-                                       bool           aResolveSymlinks /* = true */)
-{
-    return getOpenFileNames (aStartWith,
-                             aFilters,
-                             aParent,
-                             aCaption,
-                             aSelectedFilter,
-                             aResolveSymlinks,
-                             true /* aSingleFile */).value (0, "");
-}
-
-/**
- *  Reimplementation of QFileDialog::getOpenFileNames() that removes some
- *  oddities and limitations.
- *
- *  On Win32, this function makes sure a file filter is applied automatically
- *  right after it is selected from the drop-down list, to conform to common
- *  experience in other applications. Note that currently, @a selectedFilter
- *  is always set to null on return.
- *  @todo: implement the multiple file selection on win
- *  @todo: is this extra handling on win still necessary with Qt4?
- *
- *  On all other platforms, this function is equivalent to
- *  QFileDialog::getOpenFileNames().
- */
-/* static */
-QStringList QIFileDialog::getOpenFileNames (const QString &aStartWith,
-                                            const QString &aFilters,
-                                            QWidget       *aParent,
-                                            const QString &aCaption,
-                                            QString       *aSelectedFilter /* = 0 */,
-                                            bool           aResolveSymlinks /* = true */,
-                                            bool           aSingleFile /* = false */)
-{
-#if defined Q_WS_WIN
-
-    /**
-     *  QEvent class reimplementation to carry Win32 API native dialog's
-     *  result folder information
-     */
-    class GetOpenFileNameEvent : public OpenNativeDialogEvent
-    {
-    public:
-
-        enum { TypeId = QEvent::User + 3 };
-
-        GetOpenFileNameEvent (const QString &aResult)
-            : OpenNativeDialogEvent (aResult, (QEvent::Type) TypeId) {}
-    };
-
-    /**
-     *  QThread class reimplementation to open Win32 API native file dialog
-     */
-    class Thread : public QThread
-    {
-    public:
-
-        Thread (QWidget *aParent, QObject *aTarget,
-                const QString &aStartWith, const QString &aFilters,
-                const QString &aCaption) :
-                mParent (aParent), mTarget (aTarget),
-                mStartWith (aStartWith), mFilters (aFilters),
-                mCaption (aCaption) {}
-
-        virtual void run()
-        {
-            QString result;
-
-            QString workDir;
-            QString initSel;
-            QFileInfo fi (mStartWith);
-
-            if (fi.isDir())
-                workDir = mStartWith;
-            else
-            {
-                workDir = fi.absolutePath();
-                initSel = fi.fileName();
-            }
-
-            workDir = QDir::toNativeSeparators (workDir);
-            if (!workDir.endsWith ("\\"))
-                workDir += "\\";
-
-            QString title = mCaption.isNull() ? tr ("Select a file") : mCaption;
-
-            QWidget *topParent = mParent ? mParent->window() : vboxGlobal().mainWindow();
-            QString winFilters = winFilter (mFilters);
-            AssertCompile (sizeof (TCHAR) == sizeof (QChar));
-            TCHAR buf [1024];
-            if (initSel.length() > 0 && initSel.length() < sizeof (buf))
-                memcpy (buf, initSel.isNull() ? 0 : initSel.utf16(),
-                        (initSel.length() + 1) * sizeof (TCHAR));
-            else
-                buf [0] = 0;
-
-            OPENFILENAME ofn;
-            memset (&ofn, 0, sizeof (OPENFILENAME));
-
-            ofn.lStructSize = sizeof (OPENFILENAME);
-            ofn.hwndOwner = topParent ? topParent->winId() : 0;
-            ofn.lpstrFilter = (TCHAR *) winFilters.isNull() ? 0 : winFilters.utf16();
-            ofn.lpstrFile = buf;
-            ofn.nMaxFile = sizeof (buf) - 1;
-            ofn.lpstrInitialDir = (TCHAR *) workDir.isNull() ? 0 : workDir.utf16();
-            ofn.lpstrTitle = (TCHAR *) title.isNull() ? 0 : title.utf16();
-            ofn.Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY |
-                          OFN_EXPLORER | OFN_ENABLEHOOK |
-                          OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST);
-            ofn.lpfnHook = OFNHookProc;
-
-            if (GetOpenFileName (&ofn))
-            {
-                result = QString::fromUtf16 ((ushort *) ofn.lpstrFile);
-            }
-
-            // qt_win_eatMouseMove();
-            MSG msg = {0, 0, 0, 0, 0, 0, 0};
-            while (PeekMessage (&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
-            if (msg.message == WM_MOUSEMOVE)
-                PostMessage (msg.hwnd, msg.message, 0, msg.lParam);
-
-            result = result.isEmpty() ? result : QFileInfo (result).absoluteFilePath();
-
-            QApplication::postEvent (mTarget, new GetOpenFileNameEvent (result));
-        }
-
-    private:
-
-        QWidget *mParent;
-        QObject *mTarget;
-        QString mStartWith;
-        QString mFilters;
-        QString mCaption;
-    };
-
-    if (aSelectedFilter)
-        *aSelectedFilter = QString::null;
-
-    /* Local event loop to run while waiting for the result from another
-     * thread */
-    QEventLoop loop;
-
-    QString startWith = QDir::toNativeSeparators (aStartWith);
-    LoopObject loopObject ((QEvent::Type) GetOpenFileNameEvent::TypeId, loop);
-
-    if (aParent)
-        aParent->setWindowModality (Qt::WindowModal);
-
-    Thread openDirThread (aParent, &loopObject, startWith, aFilters, aCaption);
-    openDirThread.start();
-    loop.exec();
-    openDirThread.wait();
-
-    if (aParent)
-        aParent->setWindowModality (Qt::NonModal);
-
-    return QStringList() << loopObject.result();
-
-#elif defined (Q_WS_X11) && (QT_VERSION < 0x040400)
-
-    /* Here is workaround for Qt4.3 bug with QFileDialog which crushes when
-     * gets initial path as hidden directory if no hidden files are shown.
-     * See http://trolltech.com/developer/task-tracker/index_html?method=entry&id=193483
-     * for details */
-    QFileDialog dlg (aParent);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aStartWith);
-    dlg.setFilter (aFilters);
-    if (aSingleFile)
-        dlg.setFileMode (QFileDialog::ExistingFile);
-    else
-        dlg.setFileMode (QFileDialog::ExistingFiles);
-    if (aSelectedFilter)
-        dlg.selectFilter (*aSelectedFilter);
-    dlg.setResolveSymlinks (aResolveSymlinks);
-    QAction *hidden = dlg.findChild <QAction*> ("qt_show_hidden_action");
-    if (hidden)
-    {
-        hidden->trigger();
-        hidden->setVisible (false);
-    }
-    return dlg.exec() == QDialog::Accepted ? dlg.selectedFiles() : QStringList() << QString::null;
-
-#elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600)
-
-    /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using
-     * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because
-     * we are lazy, we recreate the old behavior. Unfortunately there is a bug
-     * in Qt 4.5.x which result in showing the native & the Qt dialog at the
-     * same time. */
-    QFileDialog dlg (aParent, Qt::Sheet);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aStartWith);
-    dlg.setNameFilter (aFilters);
-    if (aSingleFile)
-        dlg.setFileMode (QFileDialog::ExistingFile);
-    else
-        dlg.setFileMode (QFileDialog::ExistingFiles);
-    if (aSelectedFilter)
-        dlg.selectFilter (*aSelectedFilter);
-    dlg.setResolveSymlinks (aResolveSymlinks);
-
-    QEventLoop eventLoop;
-    QObject::connect(&dlg, SIGNAL(finished(int)),
-                     &eventLoop, SLOT(quit()));
-    /* Use the new open call. */
-    dlg.open();
-    eventLoop.exec();
-
-    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles() : QStringList() << QString::null;
-
-#else
-
-    QFileDialog::Options o;
-    if (!aResolveSymlinks)
-        o |= QFileDialog::DontResolveSymlinks;
-    if (aSingleFile)
-        return QStringList() << QFileDialog::getOpenFileName (aParent, aCaption, aStartWith,
-                                                              aFilters, aSelectedFilter, o);
-    else
-        return QFileDialog::getOpenFileNames (aParent, aCaption, aStartWith,
-                                              aFilters, aSelectedFilter, o);
-#endif
-}
-
-/**
- *  Search for the first directory that exists starting from the passed one
- *  and going up through its parents.  In case if none of the directories
- *  exist (except the root one), the function returns QString::null.
- */
-/* static */
-QString QIFileDialog::getFirstExistingDir (const QString &aStartDir)
-{
-    QString result = QString::null;
-    QDir dir (aStartDir);
-    while (!dir.exists() && !dir.isRoot())
-    {
-        QFileInfo dirInfo (dir.absolutePath());
-        dir = dirInfo.absolutePath();
-    }
-    if (dir.exists() && !dir.isRoot())
-        result = dir.absolutePath();
-    return result;
-}
-
-#if defined Q_WS_WIN
-#include "QIFileDialog.moc"
-#endif
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIHotKeyEdit.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIHotKeyEdit.cpp	(revision 25170)
+++ 	(revision )
@@ -1,802 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIHotKeyEdit class implementation
- */
-
-/*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIHotKeyEdit.h"
-#include "VBoxDefs.h"
-#include "VBoxGlobal.h"
-
-/* Qt includes */
-#include <QApplication>
-#include <QStyleOption>
-#include <QStylePainter>
-
-#ifdef Q_WS_WIN
-/* VBox/cdefs.h defines these: */
-#undef LOWORD
-#undef HIWORD
-#undef LOBYTE
-#undef HIBYTE
-#include <windows.h>
-#endif
-
-#if defined (Q_WS_PM)
-QMap<int, QString> QIHotKeyEdit::sKeyNames;
-#endif
-
-#ifdef Q_WS_X11
-/* We need to capture some X11 events directly which
- * requires the XEvent structure to be defined. However,
- * including the Xlib header file will cause some nasty
- * conflicts with Qt. Therefore we use the following hack
- * to redefine those conflicting identifiers. */
-#define XK_XKB_KEYS
-#define XK_MISCELLANY
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysymdef.h>
-#ifdef KeyPress
-const int XFocusOut = FocusOut;
-const int XFocusIn = FocusIn;
-const int XKeyPress = KeyPress;
-const int XKeyRelease = KeyRelease;
-#undef KeyRelease
-#undef KeyPress
-#undef FocusOut
-#undef FocusIn
-#endif
-#include "XKeyboard.h"
-QMap<QString, QString> QIHotKeyEdit::sKeyNames;
-#include <QX11Info>
-#endif
-
-#ifdef Q_WS_MAC
-# include "DarwinKeyboard.h"
-# include <Carbon/Carbon.h>
-# ifdef QT_MAC_USE_COCOA
-#  include "darwin/VBoxCocoaApplication.h"
-#  include "VBoxUtils.h"
-# endif
-#endif
-
-
-#if defined (Q_WS_WIN32)
-/**
- *  Returns the correct modifier vkey for the *last* keyboard message,
- *  distinguishing between left and right keys. If both are pressed
- *  the left key wins. If the pressed key not a modifier, wParam is returned
- *  unchanged.
- */
-int qi_distinguish_modifier_vkey (WPARAM wParam)
-{
-    int keyval = wParam;
-    switch (wParam)
-    {
-        case VK_SHIFT:
-            if (::GetKeyState (VK_LSHIFT) & 0x8000) keyval = VK_LSHIFT;
-            else if (::GetKeyState (VK_RSHIFT) & 0x8000) keyval = VK_RSHIFT;
-            break;
-        case VK_CONTROL:
-            if (::GetKeyState (VK_LCONTROL) & 0x8000) keyval = VK_LCONTROL;
-            else if (::GetKeyState (VK_RCONTROL) & 0x8000) keyval = VK_RCONTROL;
-            break;
-        case VK_MENU:
-            if (::GetKeyState (VK_LMENU) & 0x8000) keyval = VK_LMENU;
-            else if (::GetKeyState (VK_RMENU) & 0x8000) keyval = VK_RMENU;
-            break;
-    }
-    return keyval;
-}
-#endif
-
-/** @class QIHotKeyEdit
- *
- *  The QIHotKeyEdit widget is a hot key editor.
- */
-
-const char *QIHotKeyEdit::kNoneSymbName = "<none>";
-
-QIHotKeyEdit::QIHotKeyEdit (QWidget *aParent) :
-    QLabel (aParent)
-{
-#ifdef Q_WS_X11
-    /* Initialize the X keyboard subsystem */
-    initMappedX11Keyboard(QX11Info::display(),
-            vboxGlobal().settings().publicProperty ("GUI/RemapScancodes"));
-#endif
-
-    clear();
-
-#if defined (Q_WS_WIN32)
-    /* Qt documentation hasn't mentioned this is
-     * windows-only flag, but looks like that is so,
-     * anyway it is required for winEvent() handler only */
-    setAttribute (Qt::WA_NativeWindow);
-#endif
-    setFrameStyle (QFrame::StyledPanel | Sunken);
-    setAlignment (Qt::AlignCenter);
-    setFocusPolicy (Qt::StrongFocus);
-    setAutoFillBackground (true);
-
-    QPalette p = palette();
-    p.setColor (QPalette::Active, QPalette::Foreground,
-                p.color (QPalette::Active, QPalette::Text));
-    p.setColor (QPalette::Active, QPalette::Background,
-                p.color (QPalette::Active, QPalette::Base));
-    setPalette (p);
-
-#ifdef Q_WS_MAC
-    mDarwinKeyModifiers = GetCurrentEventKeyModifiers();
-# ifdef QT_MAC_USE_COCOA
-    ::VBoxCocoaApplication_setCallback (UINT32_MAX, QIHotKeyEdit::darwinEventHandlerProc, this);
-# else  /* !QT_MAC_USE_COCOA */
-    EventTypeSpec eventTypes [4];
-    eventTypes [0].eventClass = kEventClassKeyboard;
-    eventTypes [0].eventKind  = kEventRawKeyDown;
-    eventTypes [1].eventClass = kEventClassKeyboard;
-    eventTypes [1].eventKind  = kEventRawKeyUp;
-    eventTypes [2].eventClass = kEventClassKeyboard;
-    eventTypes [2].eventKind  = kEventRawKeyRepeat;
-    eventTypes [3].eventClass = kEventClassKeyboard;
-    eventTypes [3].eventKind  = kEventRawKeyModifiersChanged;
-
-    EventHandlerUPP eventHandler = ::NewEventHandlerUPP (QIHotKeyEdit::darwinEventHandlerProc);
-
-    mDarwinEventHandlerRef = NULL;
-    ::InstallApplicationEventHandler (eventHandler, RT_ELEMENTS (eventTypes), &eventTypes [0],
-                                      this, &mDarwinEventHandlerRef);
-    ::DisposeEventHandlerUPP (eventHandler);
-# endif /* !QT_MAC_USE_COCOA */
-    ::DarwinGrabKeyboard (false /* just modifiers */);
-#endif
-}
-
-QIHotKeyEdit::~QIHotKeyEdit()
-{
-#ifdef Q_WS_MAC
-    ::DarwinReleaseKeyboard();
-# ifdef QT_MAC_USE_COCOA
-    ::VBoxCocoaApplication_unsetCallback (UINT32_MAX, QIHotKeyEdit::darwinEventHandlerProc, this);
-# else
-    ::RemoveEventHandler (mDarwinEventHandlerRef);
-    mDarwinEventHandlerRef = NULL;
-# endif
-#endif
-}
-
-// Public members
-/////////////////////////////////////////////////////////////////////////////
-
-/**
- *  Set the hot key value. O means there is no hot key.
- *
- *  @note
- *      The key value is platform-dependent. On Win32 it is the
- *      virtial key, on Linux it is the first (0) keysym corresponding
- *      to the keycode.
- */
-void QIHotKeyEdit::setKey (int aKeyVal)
-{
-    mKeyVal = aKeyVal;
-    mSymbName = QIHotKeyEdit::keyName (aKeyVal);
-    updateText();
-}
-
-/**@@ QIHotKeyEdit::key() const
- *
- *  Returns the value of the last recodred hot key.
- *  O means there is no hot key.
- *
- *  @note
- *      The key value is platform-dependent. On Win32 it is the
- *      virtial key, on Linux it is the first (0) keysym corresponding
- *      to the keycode.
- */
-
-/**
- *  Stolen from QLineEdit.
- */
-QSize QIHotKeyEdit::sizeHint() const
-{
-    ensurePolished();
-    QFontMetrics fm (font());
-    int h = qMax (fm.lineSpacing(), 14) + 2;
-    int w = fm.width ('x') * 17; // "some"
-    int m = frameWidth() * 2;
-    QStyleOption option;
-    option.initFrom (this);
-    return (style()->sizeFromContents (QStyle::CT_LineEdit, &option,
-                                       QSize (w + m, h + m)
-                                       .expandedTo (QApplication::globalStrut()),
-                                       this));
-}
-
-/**
- *  Stolen from QLineEdit.
- */
-QSize QIHotKeyEdit::minimumSizeHint() const
-{
-    ensurePolished();
-    QFontMetrics fm = fontMetrics();
-    int h = fm.height() + qMax (2, fm.leading());
-    int w = fm.maxWidth();
-    int m = frameWidth() * 2;
-    return QSize (w + m, h + m);
-}
-
-#if defined (Q_WS_PM)
-/**
- *  Returns the virtual key extracted from the QMSG structure.
- *
- *  This function tries to detect some extra virtual keys definitions missing
- *  in PM (like Left Shift, Left Ctrl, Win keys). In all other cases it simply
- *  returns SHORT2FROMMP (aMsg->mp2).
- *
- *  @param aMsg  Pointer to the QMSG structure to extract the virtual key from.
- *  @return The extracted virtual key code or zero if there is no virtual key.
- */
-/* static */
-int QIHotKeyEdit::virtualKey (QMSG *aMsg)
-{
-    USHORT f = SHORT1FROMMP (aMsg->mp1);
-    CHAR scan = CHAR4FROMMP (aMsg->mp1);
-    USHORT ch = SHORT1FROMMP (aMsg->mp2);
-    int vkey = (unsigned int) SHORT2FROMMP (aMsg->mp2);
-
-    if (f & KC_VIRTUALKEY)
-    {
-        /* distinguish Left Shift from Right Shift) */
-        if (vkey == VK_SHIFT && scan == 0x2A)
-            vkey = VK_LSHIFT;
-        /* distinguish Left Ctrl from Right Ctrl */
-        else if (vkey == VK_CTRL && scan == 0x1D)
-            vkey = VK_LCTRL;
-        /* distinguish Ctrl+ScrLock from Ctrl+Break */
-        else if (vkey == VK_BREAK && scan == 0x46 && f & KC_CTRL)
-            vkey = VK_SCRLLOCK;
-    }
-    else if (!(f & KC_CHAR))
-    {
-        /* detect some special keys that have a pseudo char code in the high
-         * byte of ch (probably this is less device-dependent than
-         * scancode) */
-        switch (ch)
-        {
-            case 0xEC00: vkey = VK_LWIN; break;
-            case 0xED00: vkey = VK_RWIN; break;
-            case 0xEE00: vkey = VK_WINMENU; break;
-            case 0xF900: vkey = VK_FORWARD; break;
-            case 0xFA00: vkey = VK_BACKWARD; break;
-            default: vkey = 0;
-        }
-    }
-
-    return vkey;
-}
-#endif
-
-#if defined (Q_WS_PM)
-/**
- *  Updates the associative array containing the translations of PM virtual
- *  keys to human readable key names.
- */
-void QIHotKeyEdit::retranslateUi()
-{
-    /* Note: strings for the same key must match strings in retranslateUi()
-     * versions for all platforms, to keep translators happy. */
-
-    sKeyNames [VK_LSHIFT]        = tr ("Left Shift");
-    sKeyNames [VK_SHIFT]         = tr ("Right Shift");
-    sKeyNames [VK_LCTRL]         = tr ("Left Ctrl");
-    sKeyNames [VK_CTRL]          = tr ("Right Ctrl");
-    sKeyNames [VK_ALT]           = tr ("Left Alt");
-    sKeyNames [VK_ALTGRAF]       = tr ("Right Alt");
-    sKeyNames [VK_LWIN]          = tr ("Left WinKey");
-    sKeyNames [VK_RWIN]          = tr ("Right WinKey");
-    sKeyNames [VK_WINMENU]       = tr ("Menu key");
-    sKeyNames [VK_CAPSLOCK]      = tr ("Caps Lock");
-    sKeyNames [VK_SCRLLOCK]      = tr ("Scroll Lock");
-
-    sKeyNames [VK_PAUSE]         = tr ("Pause");
-    sKeyNames [VK_PRINTSCRN]     = tr ("Print Screen");
-
-    sKeyNames [VK_F1]            = tr ("F1");
-    sKeyNames [VK_F2]            = tr ("F2");
-    sKeyNames [VK_F3]            = tr ("F3");
-    sKeyNames [VK_F4]            = tr ("F4");
-    sKeyNames [VK_F5]            = tr ("F5");
-    sKeyNames [VK_F6]            = tr ("F6");
-    sKeyNames [VK_F7]            = tr ("F7");
-    sKeyNames [VK_F8]            = tr ("F8");
-    sKeyNames [VK_F9]            = tr ("F9");
-    sKeyNames [VK_F10]           = tr ("F10");
-    sKeyNames [VK_F11]           = tr ("F11");
-    sKeyNames [VK_F12]           = tr ("F12");
-    sKeyNames [VK_F13]           = tr ("F13");
-    sKeyNames [VK_F14]           = tr ("F14");
-    sKeyNames [VK_F15]           = tr ("F15");
-    sKeyNames [VK_F16]           = tr ("F16");
-    sKeyNames [VK_F17]           = tr ("F17");
-    sKeyNames [VK_F18]           = tr ("F18");
-    sKeyNames [VK_F19]           = tr ("F19");
-    sKeyNames [VK_F20]           = tr ("F20");
-    sKeyNames [VK_F21]           = tr ("F21");
-    sKeyNames [VK_F22]           = tr ("F22");
-    sKeyNames [VK_F23]           = tr ("F23");
-    sKeyNames [VK_F24]           = tr ("F24");
-
-    sKeyNames [VK_NUMLOCK]       = tr ("Num Lock");
-    sKeyNames [VK_FORWARD]       = tr ("Forward");
-    sKeyNames [VK_BACKWARD]      = tr ("Back");
-}
-#elif defined (Q_WS_X11)
-/**
- *  Updates the associative array containing the translations of X11 key strings to human
- *  readable key names.
- */
-void QIHotKeyEdit::retranslateUi()
-{
-    /* Note: strings for the same key must match strings in retranslateUi()
-     * versions for all platforms, to keep translators happy. */
-
-    sKeyNames ["Shift_L"]          = tr ("Left Shift");
-    sKeyNames ["Shift_R"]          = tr ("Right Shift");
-    sKeyNames ["Control_L"]        = tr ("Left Ctrl");
-    sKeyNames ["Control_R"]        = tr ("Right Ctrl");
-    sKeyNames ["Alt_L"]            = tr ("Left Alt");
-    sKeyNames ["Alt_R"]            = tr ("Right Alt");
-    sKeyNames ["Super_L"]          = tr ("Left WinKey");
-    sKeyNames ["Super_R"]          = tr ("Right WinKey");
-    sKeyNames ["Menu"]             = tr ("Menu key");
-    sKeyNames ["ISO_Level3_Shift"] = tr ("Alt Gr");
-    sKeyNames ["Caps_Lock"]        = tr ("Caps Lock");
-    sKeyNames ["Scroll_Lock"]      = tr ("Scroll Lock");
-}
-#endif
-
-/**
- *  Returns the string representation of a given key.
- *
- *  @note
- *      The key value is platform-dependent. On Win32 it is the
- *      virtial key, on Linux it is the first (0) keysym corresponding
- *      to the keycode.
- */
-/* static */
-QString QIHotKeyEdit::keyName (int aKeyVal)
-{
-    QString name;
-
-    if (!aKeyVal)
-    {
-        name = tr (kNoneSymbName);
-    }
-    else
-    {
-#if defined (Q_WS_WIN32)
-        /* Stupid MapVirtualKey doesn't distinguish between right and left
-         * vkeys, even under XP, despite that it stated in msdn. Do it by
-         * hands. Besides that it can't recognize such virtual keys as
-         * VK_DIVIDE & VK_PAUSE, this is also known bug. */
-        int scan;
-        switch (aKeyVal)
-        {
-            /* Processing special keys... */
-            case VK_PAUSE: scan = 0x45 << 16; break;
-            case VK_RSHIFT: scan = 0x36 << 16; break;
-            case VK_RCONTROL: scan = (0x1D << 16) | (1 << 24); break;
-            case VK_RMENU: scan = (0x38 << 16) | (1 << 24); break;
-            /* Processing extended keys... */
-            case VK_APPS:
-            case VK_LWIN:
-            case VK_RWIN:
-            case VK_NUMLOCK: scan = (::MapVirtualKey (aKeyVal, 0) | 256) << 16; break;
-            default: scan = ::MapVirtualKey (aKeyVal, 0) << 16;
-        }
-        TCHAR *str = new TCHAR [256];
-        if (::GetKeyNameText (scan, str, 256))
-        {
-            name = QString::fromUtf16 (str);
-        }
-        else
-        {
-            AssertFailed();
-            name = QString (tr ("<key_%1>")).arg (aKeyVal);
-        }
-        delete[] str;
-#elif defined (Q_WS_PM)
-        name = sKeyNames [aKeyVal];
-        if (name.isNull())
-        {
-            AssertFailed();
-            name = QString (tr ("<key_%1>")).arg (aKeyVal);
-        }
-#elif defined (Q_WS_X11)
-        char *sn = ::XKeysymToString ((KeySym) aKeyVal);
-        if (sn)
-        {
-            name = sKeyNames [sn];
-            if (name.isEmpty())
-                name = sn;
-        }
-        else
-        {
-            AssertFailed();
-            name = QString (tr ("<key_%1>")).arg (aKeyVal);
-        }
-#elif defined(Q_WS_MAC)
-        UInt32 modMask = DarwinKeyCodeToDarwinModifierMask (aKeyVal);
-        switch (modMask)
-        {
-            case shiftKey:
-            case optionKey:
-            case controlKey:
-            case cmdKey:
-                name = tr ("Left ");
-                break;
-            case rightShiftKey:
-            case rightOptionKey:
-            case rightControlKey:
-            case kEventKeyModifierRightCmdKeyMask:
-                name = tr ("Right ");
-                break;
-            default:
-                AssertMsgFailedReturn (("modMask=%#x\n", modMask), QString());
-        }
-        switch (modMask)
-        {
-            case shiftKey:
-            case rightShiftKey:
-                name += QChar (kShiftUnicode);
-                break;
-            case optionKey:
-            case rightOptionKey:
-                name += QChar (kOptionUnicode);
-                break;
-            case controlKey:
-            case rightControlKey:
-                name += QChar (kControlUnicode);
-                break;
-            case cmdKey:
-            case kEventKeyModifierRightCmdKeyMask:
-                name += QChar (kCommandUnicode);
-                break;
-        }
-#else
-        AssertFailed();
-        name = QString (tr ("<key_%1>")).arg (aKeyVal);
-#endif
-    }
-
-    return name;
-}
-
-/* static */
-bool QIHotKeyEdit::isValidKey (int aKeyVal)
-{
-#if defined(Q_WS_WIN32)
-    return (
-        (aKeyVal >= VK_SHIFT && aKeyVal <= VK_CAPITAL) ||
-        aKeyVal == VK_PRINT ||
-        aKeyVal == VK_LWIN || aKeyVal == VK_RWIN ||
-        aKeyVal == VK_APPS ||
-        (aKeyVal >= VK_F1 && aKeyVal <= VK_F24) ||
-        aKeyVal == VK_NUMLOCK || aKeyVal == VK_SCROLL ||
-        (aKeyVal >= VK_LSHIFT && aKeyVal <= VK_RMENU));
-#elif defined(Q_WS_PM)
-    return (
-        (aKeyVal >= VK_SHIFT && aKeyVal <= VK_CAPSLOCK) ||
-        aKeyVal == VK_PRINTSCRN ||
-        (aKeyVal >= VK_F1 && aKeyVal <= VK_F24) ||
-        aKeyVal == VK_NUMLOCK || aKeyVal == VK_SCRLLOCK ||
-        (aKeyVal >= VK_LSHIFT && aKeyVal <= VK_BACKWARD));
-#elif defined(Q_WS_X11)
-    KeySym ks = (KeySym) aKeyVal;
-    return
-        (
-            ks != NoSymbol &&
-            ks != XK_Insert
-        ) && (
-            ks == XK_Scroll_Lock ||
-            IsModifierKey (ks) ||
-            IsFunctionKey (ks) ||
-            IsMiscFunctionKey (ks)
-        );
-#elif defined(Q_WS_MAC)
-    UInt32 modMask = ::DarwinKeyCodeToDarwinModifierMask (aKeyVal);
-    switch (modMask)
-    {
-        case shiftKey:
-        case optionKey:
-        case controlKey:
-        case rightShiftKey:
-        case rightOptionKey:
-        case rightControlKey:
-        case cmdKey:
-        case kEventKeyModifierRightCmdKeyMask:
-            return true;
-        default:
-            return false;
-    }
-#else
-    Q_UNUSED (aKeyVal);
-    return true;
-#endif
-}
-
-// Public slots
-/////////////////////////////////////////////////////////////////////////////
-
-void QIHotKeyEdit::clear()
-{
-    mKeyVal = 0;
-    mSymbName = tr (kNoneSymbName);
-    updateText();
-}
-
-// Protected members
-/////////////////////////////////////////////////////////////////////////////
-
-// Protected events
-/////////////////////////////////////////////////////////////////////////////
-
-#if defined (Q_WS_WIN32)
-
-bool QIHotKeyEdit::winEvent (MSG *aMsg, long* /* aResult */)
-{
-    if (!(aMsg->message == WM_KEYDOWN || aMsg->message == WM_SYSKEYDOWN ||
-          aMsg->message == WM_KEYUP || aMsg->message == WM_SYSKEYUP ||
-          aMsg->message == WM_CHAR || aMsg->message == WM_SYSCHAR ||
-          aMsg->message == WM_DEADCHAR || aMsg->message == WM_SYSDEADCHAR ||
-          aMsg->message == WM_CONTEXTMENU))
-        return false;
-
-    /* ignore if not a valid hot key */
-    if (!isValidKey (aMsg->wParam))
-        return false;
-
-#if 0
-    LogFlow (("%WM_%04X: vk=%04X rep=%05d scan=%02X ext=%01d"
-              "rzv=%01X ctx=%01d prev=%01d tran=%01d\n",
-              aMsg->message, aMsg->wParam,
-              (aMsg->lParam & 0xFFFF),
-              ((aMsg->lParam >> 16) & 0xFF),
-              ((aMsg->lParam >> 24) & 0x1),
-              ((aMsg->lParam >> 25) & 0xF),
-              ((aMsg->lParam >> 29) & 0x1),
-              ((aMsg->lParam >> 30) & 0x1),
-              ((aMsg->lParam >> 31) & 0x1)));
-#endif
-
-    if (aMsg->message == WM_KEYDOWN || aMsg->message == WM_SYSKEYDOWN)
-    {
-        /* determine platform-dependent key */
-        mKeyVal = qi_distinguish_modifier_vkey (aMsg->wParam);
-        /* determine symbolic name */
-        TCHAR *str = new TCHAR [256];
-        if (::GetKeyNameText (aMsg->lParam, str, 256))
-        {
-            mSymbName = QString::fromUtf16 (str);
-        }
-        else
-        {
-            AssertFailed();
-            mSymbName = QString (tr ("<key_%1>")).arg (mKeyVal);
-        }
-        delete[] str;
-        /* update the display */
-        updateText();
-    }
-
-    return true;
-}
-
-#elif defined (Q_WS_PM)
-
-bool QIHotKeyEdit::pmEvent (QMSG *aMsg)
-{
-    if (aMsg->msg != WM_CHAR)
-        return false;
-
-    USHORT f = SHORT1FROMMP (aMsg->mp1);
-
-    int vkey = QIHotKeyEdit::virtualKey (aMsg);
-
-    /* ignore if not a valid hot key */
-    if (!isValidKey (vkey))
-        return false;
-
-    if (!(f & KC_KEYUP))
-    {
-        /* determine platform-dependent key */
-        mKeyVal = vkey;
-        /* determine symbolic name */
-        mSymbName = QIHotKeyEdit::keyName (mKeyVal);
-        /* update the display */
-        updateText();
-    }
-
-    return true;
-}
-
-#elif defined (Q_WS_X11)
-
-bool QIHotKeyEdit::x11Event (XEvent *event)
-{
-    switch (event->type)
-    {
-        case XKeyPress:
-        case XKeyRelease:
-        {
-            XKeyEvent *ke = (XKeyEvent *) event;
-            KeySym ks = ::XKeycodeToKeysym (ke->display, ke->keycode, 0);
-            /* ignore if not a valid hot key */
-            if (!isValidKey ((int) ks))
-                return false;
-
-            /* skip key releases */
-            if (event->type == XKeyRelease)
-                return true;
-
-            /* determine platform-dependent key */
-            mKeyVal = (int) ks;
-            /* determine symbolic name */
-            mSymbName = QIHotKeyEdit::keyName (mKeyVal);
-            /* update the display */
-            updateText();
-#if 0
-            LogFlow (("%s: state=%08X keycode=%08X keysym=%08X symb=%s\n",
-                      event->type == XKeyPress ? "XKeyPress" : "XKeyRelease",
-                      ke->state, ke->keycode, ks,
-                      symbname.latin1()));
-#endif
-            return true;
-        }
-    }
-
-    return false;
-}
-
-#elif defined (Q_WS_MAC)
-# ifdef QT_MAC_USE_COCOA
-/* static */
-bool QIHotKeyEdit::darwinEventHandlerProc (const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser)
-{
-    QIHotKeyEdit *edit = (QIHotKeyEdit *) pvUser;
-    EventRef inEvent = (EventRef)pvCarbonEvent;
-    UInt32 EventClass = ::GetEventClass (inEvent);
-    if (EventClass == kEventClassKeyboard)
-        return edit->darwinKeyboardEvent (pvCocoaEvent, inEvent);
-    return false;
-}
-
-# else  /* !QT_MAC_USE_COCOA */
-/* static */
-pascal OSStatus QIHotKeyEdit::darwinEventHandlerProc (EventHandlerCallRef inHandlerCallRef,
-                                                      EventRef inEvent, void *inUserData)
-{
-    QIHotKeyEdit *edit = (QIHotKeyEdit *) inUserData;
-    UInt32 EventClass = ::GetEventClass (inEvent);
-    if (EventClass == kEventClassKeyboard)
-    {
-        if (edit->darwinKeyboardEvent (NULL, inEvent))
-            return 0;
-    }
-    return CallNextEventHandler (inHandlerCallRef, inEvent);
-}
-# endif /* !QT_MAC_USE_COCOA */
-
-bool QIHotKeyEdit::darwinKeyboardEvent (const void *pvCocoaEvent, EventRef inEvent)
-{
-#if 0 /* for debugging */
-    ::darwinDebugPrintEvent("QIHotKeyEdit", inEvent);
-#endif
-
-    /* ignore key changes unless we're the focus widget */
-    if (!hasFocus())
-        return false;
-
-    UInt32 eventKind = ::GetEventKind (inEvent);
-    switch (eventKind)
-    {
-        /*case kEventRawKeyDown:
-        case kEventRawKeyUp:
-        case kEventRawKeyRepeat:*/
-        case kEventRawKeyModifiersChanged:
-        {
-            UInt32 modifierMask = 0;
-            ::GetEventParameter (inEvent, kEventParamKeyModifiers, typeUInt32, NULL,
-                                 sizeof (modifierMask), NULL, &modifierMask);
-
-            modifierMask = ::DarwinAdjustModifierMask (modifierMask, pvCocoaEvent);
-            UInt32 changed = mDarwinKeyModifiers ^ modifierMask;
-            mDarwinKeyModifiers = modifierMask;
-
-            /* skip key releases */
-            if (changed && (changed & modifierMask))
-                break;
-
-            /* convert to keycode and skip keycodes we don't care about. */
-            unsigned keyCode = ::DarwinModifierMaskToDarwinKeycode (changed);
-            if (!keyCode || keyCode == ~0U || !isValidKey (keyCode))
-                break;
-
-            /* update key current key. */
-            mKeyVal = keyCode;
-            mSymbName = QIHotKeyEdit::keyName (keyCode);
-            updateText();
-            break; //return true;
-        }
-        break;
-    }
-    return false;
-}
-
-#else
-# warning "Port me!"
-#endif
-
-void QIHotKeyEdit::focusInEvent (QFocusEvent *aEvent)
-{
-    QLabel::focusInEvent (aEvent);
-
-    QPalette p = palette();
-    p.setColor (QPalette::Active, QPalette::Foreground,
-                p.color (QPalette::Active, QPalette::HighlightedText));
-    p.setColor (QPalette::Active, QPalette::Background,
-                p.color (QPalette::Active, QPalette::Highlight));
-    setPalette (p);
-}
-
-void QIHotKeyEdit::focusOutEvent (QFocusEvent *aEvent)
-{
-    QLabel::focusOutEvent (aEvent);
-
-    QPalette p = palette();
-    p.setColor (QPalette::Active, QPalette::Foreground,
-                p.color (QPalette::Active, QPalette::Text));
-    p.setColor (QPalette::Active, QPalette::Background,
-                p.color (QPalette::Active, QPalette::Base));
-    setPalette (p);
-}
-
-void QIHotKeyEdit::paintEvent (QPaintEvent *aEvent)
-{
-    if (hasFocus())
-    {
-        QStylePainter painter (this);
-        QStyleOptionFocusRect option;
-        option.initFrom (this);
-        option.backgroundColor = palette().color (QPalette::Background);
-        option.rect = contentsRect();
-        painter.drawPrimitive (QStyle::PE_FrameFocusRect, option);
-    }
-    QLabel::paintEvent (aEvent);
-}
-
-// Private members
-/////////////////////////////////////////////////////////////////////////////
-
-void QIHotKeyEdit::updateText()
-{
-    setText (QString (" %1 ").arg (mSymbName));
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QILabel.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QILabel.cpp	(revision 25170)
+++ 	(revision )
@@ -1,337 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QILabel class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/*
- * This class is based on the original QLabel implementation.
- */
-
-/* Global includes */
-#include <QApplication>
-#include <QClipboard>
-#include <QContextMenuEvent>
-#include <QFocusEvent>
-#include <QMenu>
-#include <QMimeData>
-#include <QMouseEvent>
-#include <QPainter>
-#include <QStyleOptionFocusRect>
-
-/* Local inclused */
-#include "QILabel.h"
-
-/* Some constant predefines */
-const QRegExp QILabel::mCopyRegExp = QRegExp ("<[^>]*>");
-QRegExp QILabel::mElideRegExp = QRegExp ("(<compact\\s+elipsis=\"(start|middle|end)\"?>([^<]*)</compact>)");
-
-#define HOR_PADDING 1
-
-QILabel::QILabel (QWidget *aParent /* = 0 */, Qt::WindowFlags aFlags /* = 0 */)
-    : QLabel (aParent, aFlags)
-{
-    init();
-}
-
-QILabel::QILabel (const QString &aText, QWidget *aParent /* = 0 */, Qt::WindowFlags aFlags /* = 0 */)
-    : QLabel (aParent, aFlags)
-{
-    init();
-    setFullText (aText);
-}
-
-bool QILabel::fullSizeSelection () const
-{
-    return mFullSizeSelection;
-}
-
-void QILabel::setFullSizeSelection (bool aEnabled)
-{
-    mFullSizeSelection = aEnabled;
-    if (mFullSizeSelection)
-    {
-        /* Enable mouse interaction only */
-        setTextInteractionFlags (Qt::LinksAccessibleByMouse);
-        /* The label should be able to get the focus */
-        setFocusPolicy (Qt::StrongFocus);
-        /* Change the appearance in the focus state a little bit.
-         * Note: Unfortunately QLabel, precisely the text of a QLabel isn't
-         * styleable. The trolls have forgotten the simplest case ... So this
-         * is done by changing the currently used palette in the In/Out-focus
-         * events below. Next broken feature is drawing a simple dotted line
-         * around the label. So this is done manually in the paintEvent. Not
-         * sure if the stylesheet stuff is ready for production environments. */
-        setStyleSheet (QString ("QLabel::focus {\
-                                background-color: palette(highlight);\
-                                }\
-                                QLabel {\
-                                padding: 0px %1px 0px %1px;\
-                                }").arg (HOR_PADDING));
-    }
-    else
-    {
-        /* Text should be selectable/copyable */
-        setTextInteractionFlags (Qt::TextBrowserInteraction);
-        /* No Focus an the label */
-        setFocusPolicy (Qt::NoFocus);
-        /* No focus style change */
-        setStyleSheet ("");
-    }
-}
-
-void QILabel::useSizeHintForWidth (int aWidthHint) const
-{
-    mWidthHint = aWidthHint;
-    updateSizeHint();
-}
-
-QSize QILabel::sizeHint() const
-{
-    if (!mIsHintValid)
-        updateSizeHint();
-
-    /* If there is an updated sizeHint() present - using it. */
-    return mOwnSizeHint.isValid() ? mOwnSizeHint : QLabel::sizeHint();
-}
-
-QSize QILabel::minimumSizeHint() const
-{
-    if (!mIsHintValid)
-        updateSizeHint();
-
-    /* If there is an updated minimumSizeHint() present - using it. */
-    return mOwnSizeHint.isValid() ? mOwnSizeHint : QLabel::minimumSizeHint();
-}
-
-QString QILabel::text() const
-{
-    return mText;
-}
-
-void QILabel::clear()
-{
-    QLabel::clear();
-    setFullText ("");
-}
-
-void QILabel::setText (const QString &aText)
-{
-    setFullText (aText);
-
-    /* If QILabel forced to be fixed vertically */
-    if (minimumHeight() == maximumHeight())
-    {
-        /* Check if new text requires label growing */
-        QSize sh (width(), heightForWidth (width()));
-        if (sh.height() > minimumHeight())
-            setFixedHeight (sh.height());
-    }
-}
-
-void QILabel::copy()
-{
-    QString text = removeHtmlTags (mText);
-    /* Copy the current text to the global and selection clipboard. */
-    QApplication::clipboard()->setText (text, QClipboard::Clipboard);
-    QApplication::clipboard()->setText (text, QClipboard::Selection);
-}
-
-void QILabel::resizeEvent (QResizeEvent *aEvent)
-{
-    QLabel::resizeEvent (aEvent);
-    /* Recalculate the elipsis of the text after every resize. */
-    updateText();
-}
-
-void QILabel::mousePressEvent (QMouseEvent *aEvent)
-{
-    if (aEvent->button() == Qt::LeftButton && geometry().contains (aEvent->pos()) && mFullSizeSelection)
-        mStartDragging = true;
-    else
-        QLabel::mousePressEvent (aEvent);
-}
-
-void QILabel::mouseReleaseEvent (QMouseEvent *aEvent)
-{
-    mStartDragging = false;
-    QLabel::mouseReleaseEvent (aEvent);
-}
-
-void QILabel::mouseMoveEvent (QMouseEvent *aEvent)
-{
-    if (mStartDragging)
-    {
-        mStartDragging = false;
-        /* Create a drag object out of the given data. */
-        QDrag *drag = new QDrag (this);
-        QMimeData *mimeData = new QMimeData;
-        mimeData->setText (removeHtmlTags (mText));
-        drag->setMimeData (mimeData);
-        /* Start the dragging */
-#if QT_VERSION >= 0x040300
-        drag->exec();
-#else /* QT_VERSION >= 0x040300 */
-        drag->start (Qt::MoveAction);
-#endif /* QT_VERSION >= 0x040300 */
-    }
-    else
-        QLabel::mouseMoveEvent (aEvent);
-}
-
-void QILabel::contextMenuEvent (QContextMenuEvent *aEvent)
-{
-    if (mFullSizeSelection)
-    {
-        /* Create a context menu for the copy to clipboard action. */
-        QMenu menu;
-        mCopyAction->setText (tr ("&Copy"));
-        menu.addAction (mCopyAction);
-        menu.exec (aEvent->globalPos());
-    }
-    else
-        QLabel::contextMenuEvent (aEvent);
-}
-
-void QILabel::focusInEvent (QFocusEvent * /* aEvent */)
-{
-    if (mFullSizeSelection)
-    {
-        /* Set the text color to the current used highlight text color. */
-        QPalette pal = qApp->palette();
-        pal.setBrush (QPalette::WindowText, pal.brush (QPalette::HighlightedText));
-        setPalette (pal);
-    }
-}
-
-void QILabel::focusOutEvent (QFocusEvent *aEvent)
-{
-    /* Reset to the default palette */
-    if (mFullSizeSelection && aEvent->reason() != Qt::PopupFocusReason)
-        setPalette (qApp->palette());
-}
-
-void QILabel::paintEvent (QPaintEvent *aEvent)
-{
-    QLabel::paintEvent (aEvent);
-
-    if (mFullSizeSelection && hasFocus())
-    {
-        QPainter painter (this);
-        /* Paint a focus rect based on the current style. */
-        QStyleOptionFocusRect option;
-        option.initFrom (this);
-        style()->drawPrimitive (QStyle::PE_FrameFocusRect, &option, &painter, this);
-    }
-}
-
-void QILabel::init()
-{
-    /* Initial setup */
-    mIsHintValid = false;
-    mWidthHint = -1;
-    mStartDragging = false;
-    setFullSizeSelection (false);
-    setOpenExternalLinks (true);
-
-    /* Create invisible copy action */
-    mCopyAction = new QAction (this);
-    addAction (mCopyAction);
-    mCopyAction->setShortcut (QKeySequence (QKeySequence::Copy));
-    mCopyAction->setShortcutContext (Qt::WidgetShortcut);
-    connect (mCopyAction, SIGNAL (triggered()), this, SLOT (copy()));
-}
-
-void QILabel::updateSizeHint() const
-{
-    mOwnSizeHint = mWidthHint == -1 ? QSize() : QSize (mWidthHint, heightForWidth (mWidthHint));
-    mIsHintValid = true;
-}
-
-void QILabel::setFullText (const QString &aText)
-{
-    QSizePolicy sp = sizePolicy();
-    sp.setHeightForWidth (wordWrap());
-    setSizePolicy (sp);
-    mIsHintValid = false;
-
-    mText = aText;
-    updateText();
-}
-
-void QILabel::updateText()
-{
-    QString comp = compressText (mText);
-
-    QLabel::setText (comp);
-    /* Only set the tooltip if the text is shortened in any way. */
-    if (removeHtmlTags (comp) != removeHtmlTags (mText))
-        setToolTip (removeHtmlTags (mText));
-    else
-        setToolTip ("");
-}
-
-QString QILabel::removeHtmlTags (QString aText) const
-{
-    /* Remove all HTML tags from the text and return it. */
-    return QString(aText).remove (mCopyRegExp);
-}
-
-Qt::TextElideMode QILabel::toTextElideMode (const QString& aStr) const
-{
-    /* Converts a string to a Qt elide mode */
-    Qt::TextElideMode mode = Qt::ElideNone;
-    if (aStr == "start")
-        mode = Qt::ElideLeft;
-    else if (aStr == "middle")
-        mode = Qt::ElideMiddle;
-    else if (aStr == "end")
-        mode  = Qt::ElideRight;
-    return mode;
-}
-
-QString QILabel::compressText (const QString &aText) const
-{
-    QStringList strResult;
-    QFontMetrics fm = fontMetrics();
-    /* Split up any multi line text */
-    QStringList strList = aText.split (QRegExp ("<br */?>"));
-    foreach (QString text, strList)
-    {
-        /* Search for the compact tag */
-        if (mElideRegExp.indexIn (text) > -1)
-        {
-            QString workStr = text;
-            /* Grep out the necessary info of the regexp */
-            QString compactStr = mElideRegExp.cap (1);
-            QString elideModeStr = mElideRegExp.cap (2);
-            QString elideStr = mElideRegExp.cap (3);
-            /* Remove the whole compact tag (also the text) */
-            QString flatStr = removeHtmlTags (QString (workStr).remove (compactStr));
-            /* What size will the text have without the compact text */
-            int flatWidth = fm.width (flatStr);
-            /* Create the shortened text */
-            QString newStr = fm.elidedText (elideStr, toTextElideMode (elideModeStr), width() - (2 * HOR_PADDING) - flatWidth);
-            /* Replace the compact part with the shortened text in the initial string */
-            text = QString (workStr).replace (compactStr, newStr);
-        }
-        strResult << text;
-    }
-    return strResult.join ("<br />");
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/QILabelSeparator.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QILabelSeparator.cpp	(revision 25170)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QILabelSeparator class implementation
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global includes */
-#include <QLabel>
-#include <QHBoxLayout>
-
-/* Local includes */
-#include "QILabelSeparator.h"
-#include "VBoxGlobal.h"
-
-QILabelSeparator::QILabelSeparator (QWidget *aParent /* = NULL */, Qt::WindowFlags aFlags /* = 0 */)
-    : QWidget (aParent, aFlags)
-    , mLabel (0)
-{
-    init();
-}
-
-QILabelSeparator::QILabelSeparator (const QString &aText, QWidget *aParent /* = NULL */, Qt::WindowFlags aFlags /* = 0 */)
-    : QWidget (aParent, aFlags)
-    , mLabel (0)
-{
-    init();
-    setText (aText);
-}
-
-QString QILabelSeparator::text() const
-{
-    return mLabel->text();
-}
-
-void QILabelSeparator::setBuddy (QWidget *aBuddy)
-{
-    mLabel->setBuddy (aBuddy);
-}
-
-void QILabelSeparator::clear()
-{
-    mLabel->clear();
-}
-
-void QILabelSeparator::setText (const QString &aText)
-{
-    mLabel->setText (aText);
-}
-
-void QILabelSeparator::init()
-{
-    mLabel = new QLabel();
-    QFrame *separator = new QFrame();
-    separator->setFrameShape (QFrame::HLine);
-    separator->setFrameShadow (QFrame::Sunken);
-    separator->setEnabled (false);
-    separator->setContentsMargins (0, 0, 0, 0);
-    // separator->setStyleSheet ("QFrame {border: 1px outset black; }");
-    separator->setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
-
-    QHBoxLayout *pLayout = new QHBoxLayout (this);
-    VBoxGlobal::setLayoutMargin (pLayout, 0);
-    pLayout->addWidget (mLabel);
-    pLayout->addWidget (separator, Qt::AlignBottom);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QILineEdit.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QILineEdit.cpp	(revision 25170)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QILineEdit class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QILineEdit.h"
-
-/* Qt includes */
-#include <QStyleOptionFrame>
-
-#if defined (Q_WS_WIN32)
-#include <QWindowsVistaStyle>
-#include <QLibrary>
-#endif
-
-void QILineEdit::setMinimumWidthByText (const QString &aText)
-{
-    setMinimumWidth (featTextWidth (aText).width());
-}
-
-void QILineEdit::setFixedWidthByText (const QString &aText)
-{
-    setFixedWidth (featTextWidth (aText).width());
-}
-
-QSize QILineEdit::featTextWidth (const QString &aText) const
-{
-    QStyleOptionFrame sof;
-    sof.initFrom (this);
-    sof.rect = contentsRect();
-    sof.lineWidth = hasFrame() ? style()->pixelMetric (QStyle::PM_DefaultFrameWidth) : 0;
-    sof.midLineWidth = 0;
-    sof.state |= QStyle::State_Sunken;
-
-    /* The margins are based on qlineedit.cpp of Qt. Maybe they where changed
-     * at some time in the future. */
-    QSize sc (fontMetrics().width (aText) + 2*2,
-              fontMetrics().xHeight()     + 2*1);
-    QSize sa = style()->sizeFromContents (QStyle::CT_LineEdit, &sof, sc, this);
-
-#if defined (Q_WS_WIN32)
-    /* Vista l&f style has a bug where the last parameter of sizeFromContents
-     * function ('widget' what corresponds to 'this' in our class) is ignored.
-     * Due to it QLineEdit processed as QComboBox and size calculation includes
-     * non-existing combo-box button of 23 pix in width. So fixing it here: */
-    if (qobject_cast <QWindowsVistaStyle*> (style()))
-    {
-        /* Check if l&f style theme is really active else painting performed by
-         * Windows Classic theme and there is no such shifting error. */
-        typedef bool (*IsAppThemedFunction)();
-        IsAppThemedFunction isAppThemed =
-            (IsAppThemedFunction) QLibrary::resolve ("uxtheme", "IsAppThemed");
-        if (isAppThemed && isAppThemed()) sa -= QSize (23, 0);
-    }
-#endif
-
-    return sa;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIListView.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIListView.cpp	(revision 25170)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIListView, QIItemDelegate class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIListView.h"
-#include "VBoxDefs.h"
-
-#if MAC_LEOPARD_STYLE
-/* Qt includes */
-# include <QPainter>
-# include <QApplication>
-# include <qmacstyle_mac.h>
-#endif /* MAC_LEOPARD_STYLE */
-
-
-/* VBoxVMListView class */
-
-QIListView::QIListView (QWidget *aParent /* = 0 */)
-    :QListView (aParent)
-{
-    /* Track if the application lost the focus */
-#if MAC_LEOPARD_STYLE
-    connect (QCoreApplication::instance(), SIGNAL (focusChanged (QWidget *, QWidget *)),
-             this, SLOT (focusChanged (QWidget *, QWidget *)));
-    /* 1 pixel line frame */
-    setMidLineWidth (1);
-    setLineWidth (0);
-    setFrameShape (QFrame::Box);
-    focusChanged (NULL, this);
-    /* Nesty hack to disable the focus rect on the list view. This interface
-     * may change at any time! */
-    static_cast<QMacStyle *> (style())->setFocusRectPolicy (this, QMacStyle::FocusDisabled);
-#endif /* MAC_LEOPARD_STYLE */
-}
-
-void QIListView::focusChanged (QWidget * /* aOld */, QWidget *aNow)
-{
-#if MAC_LEOPARD_STYLE
-    QColor bgColor (212, 221, 229);
-    if (aNow == NULL)
-        bgColor.setRgb (232, 232, 232);
-    QPalette pal = viewport()->palette();
-    pal.setColor (QPalette::Base, bgColor);
-    viewport()->setPalette (pal);
-    viewport()->setAutoFillBackground (true);
-#else /* MAC_LEOPARD_STYLE */
-    Q_UNUSED (aNow);
-#endif /* MAC_LEOPARD_STYLE */
-}
-
-/* VBoxVMItemPainter class */
-
-void QIItemDelegate::drawBackground (QPainter *aPainter, const QStyleOptionViewItem &aOption, 
-                                        const QModelIndex &aIndex) const
-{   
-#if MAC_LEOPARD_STYLE
-    NOREF (aIndex);
-    /* Macify for Leopard */
-    if (aOption.state & QStyle::State_Selected)
-    {   
-        /* Standard color for selected items and focus on the widget */
-        QColor topLineColor (69, 128, 200);
-        QColor topGradColor (92, 147, 214);
-        QColor bottomGradColor (21, 83, 169);
-        /* Color for selected items and no focus on the widget */
-        if (QWidget *p = qobject_cast<QWidget *> (parent()))
-            if (!p->hasFocus())
-            {
-                topLineColor.setRgb (145, 160, 192);
-                topGradColor.setRgb (162, 177, 207);
-                bottomGradColor.setRgb (110, 129, 169);
-            }
-        /* Color for selected items and no focus on the application at all */
-        if (qApp->focusWidget() == NULL)
-            {
-                topLineColor.setRgb (151, 151, 151);
-                topGradColor.setRgb (180, 180, 180);
-                bottomGradColor.setRgb (137, 137, 137);
-            }
-        /* Paint the background */
-        QRect r = aOption.rect;
-        r.setTop (r.top() + 1);
-        QLinearGradient linearGrad (QPointF(0, r.top()), QPointF(0, r.bottom()));
-        linearGrad.setColorAt (0, topGradColor);
-        linearGrad.setColorAt (1, bottomGradColor);
-        aPainter->setPen (topLineColor);
-        aPainter->drawLine (r.left(), r.top() - 1, r.right(), r.top() - 1);
-        aPainter->fillRect (r, linearGrad);
-    }
-#else /* MAC_LEOPARD_STYLE */
-    QItemDelegate::drawBackground (aPainter, aOption, aIndex);
-#endif /* MAC_LEOPARD_STYLE */
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIMainDialog.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIMainDialog.cpp	(revision 25170)
+++ 	(revision )
@@ -1,398 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIMainDialog class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIMainDialog.h"
-#include "VBoxUtils.h"
-#include "VBoxGlobal.h"
-
-#include <iprt/assert.h>
-
-/* Qt includes */
-#include <QProcess>
-#include <QEventLoop>
-#include <QApplication>
-#include <QFileIconProvider>
-#include <QDir>
-#include <QUrl>
-#include <QMenu>
-#include <QSizeGrip>
-#include <QPushButton>
-#include <QDialogButtonBox>
-
-QIMainDialog::QIMainDialog (QWidget *aParent /* = 0 */,
-                            Qt::WindowFlags aFlags /* = Qt::Dialog */)
-    : QMainWindow (aParent, aFlags)
-    , mRescode (QDialog::Rejected)
-    , mPolished (false)
-    , mCenterWidget (aParent)
-{
-    qApp->installEventFilter (this);
-}
-
-QDialog::DialogCode QIMainDialog::exec()
-{
-    AssertMsg (!mEventLoop, ("exec is called recursively!\n"));
-
-    /* Reset the result code */
-    setResult (QDialog::Rejected);
-    bool deleteOnClose = testAttribute (Qt::WA_DeleteOnClose);
-    setAttribute (Qt::WA_DeleteOnClose, false);
-    bool wasShowModal = testAttribute (Qt::WA_ShowModal);
-    setAttribute (Qt::WA_ShowModal, true);
-
-    /* Create a local event loop */
-    mEventLoop = new QEventLoop();
-    /* Show the window */
-    show();
-    /* A guard to ourself for the case we destroy ourself. */
-    QPointer<QIMainDialog> guard = this;
-    /* Start the event loop. This blocks. */
-    mEventLoop->exec();
-    /* Delete the event loop */
-    delete mEventLoop;
-    /* Are we valid anymore? */
-    if (guard.isNull())
-        return QDialog::Rejected;
-    QDialog::DialogCode res = result();
-    /* Set the old show modal attribute */
-    setAttribute (Qt::WA_ShowModal, wasShowModal);
-    /* Delete us in the case we should do so on close */
-    if (deleteOnClose)
-        delete this;
-    /* Return the final result */
-    return res;
-}
-
-QDialog::DialogCode QIMainDialog::result() const
-{
-    return mRescode;
-}
-
-void QIMainDialog::setFileForProxyIcon (const QString& aFile)
-{
-    mFileForProxyIcon = aFile;
-}
-
-QString QIMainDialog::fileForProxyIcon() const
-{
-    return mFileForProxyIcon;
-}
-
-void QIMainDialog::setSizeGripEnabled (bool aEnabled)
-{
-    if (!mSizeGrip && aEnabled)
-    {
-        mSizeGrip = new QSizeGrip (this);
-        mSizeGrip->resize (mSizeGrip->sizeHint());
-        mSizeGrip->show();
-    }
-    else if (mSizeGrip && !aEnabled)
-        delete mSizeGrip;
-}
-
-bool QIMainDialog::isSizeGripEnabled() const
-{
-    return mSizeGrip;
-}
-
-void QIMainDialog::setDefaultButton (QPushButton* aButton)
-{
-    mDefaultButton = aButton;
-}
-
-QPushButton* QIMainDialog::defaultButton() const
-{
-    return mDefaultButton;
-}
-
-
-void QIMainDialog::setVisible (bool aVisible)
-{
-    QMainWindow::setVisible (aVisible);
-    /* Exit from the event loop if there is any and we are changing our state
-     * from visible to invisible. */
-    if (mEventLoop && !aVisible)
-        mEventLoop->exit();
-}
-
-bool QIMainDialog::event (QEvent *aEvent)
-{
-     switch (aEvent->type())
-     {
-#ifdef Q_WS_MAC
-          case QEvent::IconDrag:
-          {
-              Qt::KeyboardModifiers currentModifiers = qApp->keyboardModifiers();
-
-              if (currentModifiers == Qt::NoModifier)
-              {
-                  if (!mFileForProxyIcon.isEmpty())
-                  {
-                      aEvent->accept();
-                      /* Create a drag object we can use */
-                      QDrag *drag = new QDrag (this);
-                      QMimeData *data = new QMimeData();
-                      /* Set the appropriate url data */
-                      data->setUrls (QList<QUrl>() << QUrl::fromLocalFile (mFileForProxyIcon));
-                      drag->setMimeData (data);
-                      /* Make a nice looking DnD icon */
-                      QFileInfo fi (mFileForProxyIcon);
-                      QPixmap cursorPixmap (::darwinCreateDragPixmap (QPixmap (windowIcon().pixmap (16, 16)), fi.fileName()));
-                      drag->setPixmap (cursorPixmap);
-                      drag->setHotSpot (QPoint (5, cursorPixmap.height() - 5));
-                      /* Start the DnD action */
-                      drag->start (Qt::LinkAction | Qt::CopyAction);
-                      return true;
-                  }
-              }
-#if QT_VERSION < 0x040400
-              else if (currentModifiers == Qt::ShiftModifier)
-#else
-              else if (currentModifiers == Qt::ControlModifier)
-#endif
-              {
-                  if (!mFileForProxyIcon.isEmpty())
-                  {
-                      aEvent->accept();
-                      /* Create the proxy icon menu */
-                      QMenu menu (this);
-                      connect (&menu, SIGNAL (triggered (QAction*)),
-                               this, SLOT (openAction (QAction*)));
-                      /* Add the file with the disk icon to the menu */
-                      QFileInfo fi (mFileForProxyIcon);
-                      QAction *action = menu.addAction (fi.fileName());
-                      action->setIcon (windowIcon());
-                      /* Create some nice looking menu out of the other
-                       * directory parts. */
-                      QFileIconProvider fip;
-                      QDir dir (fi.absolutePath());
-                      do
-                      {
-                          if (dir.isRoot())
-                              action = menu.addAction ("/");
-                          else
-                              action = menu.addAction (dir.dirName());
-                          action->setIcon (fip.icon (QFileInfo (dir, "")));
-                      }
-                      while (dir.cdUp());
-                      /* Show the menu */
-                      menu.exec (QPoint (QCursor::pos().x() - 20, frameGeometry().y() - 5));
-                      return true;
-                  }
-              }
-              break;
-          }
-#endif /* Q_WS_MAC */
-          case QEvent::Polish:
-          {
-              /* Initially search for the default button. */
-              mDefaultButton = searchDefaultButton();
-              break;
-          }
-          default:
-              break;
-     }
-     return QMainWindow::event (aEvent);
-}
-
-void QIMainDialog::showEvent (QShowEvent *aEvent)
-{
-    QMainWindow::showEvent (aEvent);
-
-    /* Polishing border */
-    if (mPolished)
-        return;
-    mPolished = true;
-
-    /* Explicit widget centering relatively to it's centering
-     * widget if any or desktop if centering widget is missed. */
-    VBoxGlobal::centerWidget (this, mCenterWidget, false);
-}
-
-void QIMainDialog::resizeEvent (QResizeEvent *aEvent)
-{
-    QMainWindow::resizeEvent (aEvent);
-
-    /* Adjust the size-grip location for the current resize event */
-    if (mSizeGrip)
-    {
-        if (isRightToLeft())
-            mSizeGrip->move (rect().bottomLeft() - mSizeGrip->rect().bottomLeft());
-        else
-            mSizeGrip->move (rect().bottomRight() - mSizeGrip->rect().bottomRight());
-        aEvent->accept();
-    }
-}
-
-bool QIMainDialog::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    if (!isActiveWindow())
-        return QMainWindow::eventFilter (aObject, aEvent);
-
-    if (qobject_cast<QWidget*> (aObject) &&
-        qobject_cast<QWidget*> (aObject)->window() != this)
-        return QMainWindow::eventFilter (aObject, aEvent);
-
-    switch (aEvent->type())
-    {
-        /* Auto-default button focus-in processor used to move the "default"
-         * button property into the currently focused button. */
-        case QEvent::FocusIn:
-        {
-            if (qobject_cast<QPushButton*> (aObject) &&
-                (aObject->parent() == centralWidget() ||
-                 qobject_cast<QDialogButtonBox*> (aObject->parent())))
-            {
-                qobject_cast<QPushButton*> (aObject)->setDefault (aObject != mDefaultButton);
-                if (mDefaultButton)
-                    mDefaultButton->setDefault (aObject == mDefaultButton);
-            }
-            break;
-        }
-        /* Auto-default button focus-out processor used to remove the "default"
-         * button property from the previously focused button. */
-        case QEvent::FocusOut:
-        {
-            if (qobject_cast<QPushButton*> (aObject) &&
-                (aObject->parent() == centralWidget() ||
-                 qobject_cast<QDialogButtonBox*> (aObject->parent())))
-            {
-                if (mDefaultButton)
-                    mDefaultButton->setDefault (aObject != mDefaultButton);
-                qobject_cast<QPushButton*> (aObject)->setDefault (aObject == mDefaultButton);
-            }
-            break;
-        }
-        case QEvent::KeyPress:
-        {
-#if defined (Q_WS_MAC) && (QT_VERSION < 0x040402)
-            /* Bug in Qt below 4.4.2. The key events are send to the current
-             * window even if a menu is shown & has the focus. See
-             * http://trolltech.com/developer/task-tracker/index_html?method=entry&id=214681. */
-            if (::darwinIsMenuOpen())
-                return true;
-#endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */
-            /* Make sure that we only proceed if no
-             * popup or other modal widgets are open. */
-            if (qApp->activePopupWidget() ||
-                (qApp->activeModalWidget() && qApp->activeModalWidget() != this))
-                break;
-
-            QKeyEvent *event = static_cast<QKeyEvent*> (aEvent);
-#ifdef Q_WS_MAC
-            if (event->modifiers() == Qt::ControlModifier &&
-                event->key() == Qt::Key_Period)
-                reject();
-            else
-#endif
-                if (event->modifiers() == Qt::NoModifier ||
-                    (event->modifiers() & Qt::KeypadModifier && event->key() == Qt::Key_Enter))
-                {
-                    switch (event->key())
-                    {
-                        case Qt::Key_Enter:
-                        case Qt::Key_Return:
-                        {
-                            QPushButton *currentDefault = searchDefaultButton();
-                            if (currentDefault)
-                            {
-                                /* We handle this, so return true after
-                                 * that. */
-                                currentDefault->animateClick();
-                                return true;
-                            }
-                            break;
-                        }
-                        case Qt::Key_Escape:
-                        {
-                            reject();
-                            return true;
-                            break;
-                        }
-                    }
-                }
-        }
-        default:
-            break;
-    }
-    return QMainWindow::eventFilter (aObject, aEvent);
-}
-
-QPushButton* QIMainDialog::searchDefaultButton() const
-{
-    /* Search for the first default button in the dialog. */
-    QPushButton *button = 0;
-    QList<QPushButton*> list = qFindChildren<QPushButton*> (this);
-    foreach (button, list)
-        if (button->isDefault() &&
-            (button->parent() == centralWidget() ||
-             qobject_cast<QDialogButtonBox*> (button->parent())))
-            break;
-    return button;
-}
-
-
-void QIMainDialog::accept()
-{
-    done (QDialog::Accepted);
-}
-
-void QIMainDialog::reject()
-{
-    done (QDialog::Rejected);
-}
-
-void QIMainDialog::done (QDialog::DialogCode aResult)
-{
-    /* Set the final result */
-    setResult (aResult);
-    /* Hide this window */
-    hide();
-    /* And close the window */
-    close();
-}
-
-void QIMainDialog::setResult (QDialog::DialogCode aRescode)
-{
-    mRescode = aRescode;
-}
-
-void QIMainDialog::openAction (QAction *aAction)
-{
-#ifdef Q_WS_MAC
-    if (!mFileForProxyIcon.isEmpty())
-    {
-        QString path = mFileForProxyIcon.left (mFileForProxyIcon.indexOf (aAction->text())) + aAction->text();
-        /* Check for the first item */
-        if (mFileForProxyIcon != path)
-        {
-            /* @todo: vboxGlobal().openURL (path); should be able to open paths */
-            QProcess process;
-            process.start ("/usr/bin/open", QStringList() << path, QIODevice::ReadOnly);
-            process.waitForFinished();
-        }
-    }
-#else /* Q_WS_MAC */
-    NOREF (aAction);
-#endif /* Q_WS_MAC */
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIMessageBox.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIMessageBox.cpp	(revision 25170)
+++ 	(revision )
@@ -1,456 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIMessageBox class implementation
- */
-
-/*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxDefs.h"
-#include "VBoxGlobal.h"
-#include "QIArrowSplitter.h"
-#include "QIMessageBox.h"
-#include "QILabel.h"
-#include "QIDialogButtonBox.h"
-#ifdef Q_WS_MAC
-# include "VBoxConsoleWnd.h"
-#endif /* Q_WS_MAC */
-
-/* Qt includes */
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QPushButton>
-#include <QStyleOptionFocusRect>
-#include <QStylePainter>
-#include <QToolButton>
-#include <QKeyEvent>
-
-
-/** @class QIMessageBox
- *
- *  The QIMessageBox class is a message box similar to QMessageBox.
- *  It partly implements the QMessageBox interface and adds some enhanced
- *  functionality.
- */
-
-/**
- *  See QMessageBox for details.
- */
-QIMessageBox::QIMessageBox (const QString &aCaption, const QString &aText,
-                            Icon aIcon, int aButton0, int aButton1, int aButton2,
-                            QWidget *aParent, const char *aName, bool aModal)
-    : QIDialog (aParent)
-    , mText (aText)
-    , mDetailsIndex (-1)
-    , mWasDone (false)
-    , mWasPolished (false)
-{
-#ifdef Q_WS_MAC
-    /* Sheets are broken if the window is in fullscreen mode. So make it a
-     * normal window in that case. */
-    VBoxConsoleWnd *cwnd = qobject_cast<VBoxConsoleWnd*> (aParent);
-    if (cwnd == NULL ||
-        (!cwnd->isTrueFullscreen() &&
-         !cwnd->isTrueSeamless()))
-        setWindowFlags (Qt::Sheet);
-#endif /* Q_WS_MAC */
-
-    setWindowTitle (aCaption);
-    /* Necessary to later find some of the message boxes */
-    setObjectName (aName);
-    setModal (aModal);
-
-    mButton0 = aButton0;
-    mButton1 = aButton1;
-    mButton2 = aButton2;
-
-    QVBoxLayout *layout = new QVBoxLayout (this);
-#ifdef Q_WS_MAC
-    layout->setContentsMargins (40, 11, 40, 11);
-#else /* !Q_WS_MAC */
-    VBoxGlobal::setLayoutMargin (layout, 11);
-#endif /* !Q_WS_MAC */
-    layout->setSpacing (10);
-    layout->setSizeConstraint (QLayout::SetMinimumSize);
-
-    QWidget *main = new QWidget();
-
-    QHBoxLayout *hLayout = new QHBoxLayout (main);
-    VBoxGlobal::setLayoutMargin (hLayout, 0);
-    hLayout->setSpacing (10);
-    layout->addWidget (main);
-
-    mIconLabel = new QLabel();
-    mIconLabel->setPixmap (standardPixmap (aIcon));
-    mIconLabel->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Minimum);
-    mIconLabel->setAlignment (Qt::AlignHCenter | Qt::AlignTop);
-    hLayout->addWidget (mIconLabel);
-
-    QVBoxLayout* messageVBoxLayout = new QVBoxLayout();
-    VBoxGlobal::setLayoutMargin (messageVBoxLayout, 0);
-    messageVBoxLayout->setSpacing (10);
-    hLayout->addLayout (messageVBoxLayout);
-
-    mTextLabel = new QILabel (aText);
-    mTextLabel->setAlignment (Qt::AlignLeft | Qt::AlignTop);
-    mTextLabel->setWordWrap (true);
-    QSizePolicy sp (QSizePolicy::Minimum, QSizePolicy::Minimum);
-    sp.setHeightForWidth (true);
-    mTextLabel->setSizePolicy (sp);
-    messageVBoxLayout->addWidget (mTextLabel);
-
-    mFlagCB_Main = new QCheckBox();
-    mFlagCB_Main->hide();
-    messageVBoxLayout->addWidget (mFlagCB_Main);
-
-    mDetailsVBox = new QWidget();
-    layout->addWidget (mDetailsVBox);
-
-    QVBoxLayout* detailsVBoxLayout = new QVBoxLayout (mDetailsVBox);
-    VBoxGlobal::setLayoutMargin (detailsVBoxLayout, 0);
-    detailsVBoxLayout->setSpacing (10);
-
-    mDetailsText = new QTextEdit();
-    {
-        /* Calculate the minimum size dynamically, approx.
-         * for 40 chars, 4 lines & 2 <table> margins */
-        QFontMetrics fm = mDetailsText->fontMetrics();
-        mDetailsText->setMinimumSize (fm.width ('m') * 40,
-                                      fm.lineSpacing() * 4 + 4 * 2);
-    }
-    mDetailsText->setReadOnly (true);
-    mDetailsText->setSizePolicy (QSizePolicy::Expanding,
-                                 QSizePolicy::MinimumExpanding);
-    mDetailsSplitter = new QIArrowSplitter (mDetailsText);
-    connect (mDetailsSplitter, SIGNAL (showBackDetails()), this, SLOT (detailsBack()));
-    connect (mDetailsSplitter, SIGNAL (showNextDetails()), this, SLOT (detailsNext()));
-    detailsVBoxLayout->addWidget (mDetailsSplitter);
-
-    mFlagCB_Details = new QCheckBox();
-    mFlagCB_Details->hide();
-    detailsVBoxLayout->addWidget (mFlagCB_Details);
-
-    mSpacer = new QSpacerItem (0, 0);
-    layout->addItem (mSpacer);
-
-    mButtonBox = new QIDialogButtonBox;
-    mButtonBox->setCenterButtons (true);
-    layout->addWidget (mButtonBox);
-
-    mButtonEsc = 0;
-
-    mButton0PB = createButton (aButton0);
-    if (mButton0PB)
-        connect (mButton0PB, SIGNAL (clicked()), SLOT (done0()));
-    mButton1PB = createButton (aButton1);
-    if (mButton1PB)
-        connect (mButton1PB, SIGNAL (clicked()), SLOT (done1()));
-    mButton2PB = createButton (aButton2);
-    if (mButton2PB)
-        connect (mButton2PB, SIGNAL (clicked()), SLOT (done2()));
-
-    /* this call is a must -- it initializes mFlagCB and mSpacer */
-    setDetailsShown (false);
-}
-
-/**
- *  Returns the text of the given message box button.
- *  See QMessageBox::buttonText() for details.
- *
- *  @param aButton Button index (0, 1 or 2).
- */
-QString QIMessageBox::buttonText (int aButton) const
-{
-    switch (aButton)
-    {
-        case 0: if (mButton0PB) return mButton0PB->text(); break;
-        case 1: if (mButton1PB) return mButton1PB->text(); break;
-        case 2: if (mButton2PB) return mButton2PB->text(); break;
-        default: break;
-    }
-
-    return QString::null;
-}
-
-/**
- *  Sets the text of the given message box button.
- *  See QMessageBox::setButtonText() for details.
- *
- *  @param aButton  Button index (0, 1 or 2).
- *  @param aText    New button text.
- */
-void QIMessageBox::setButtonText (int aButton, const QString &aText)
-{
-    switch (aButton)
-    {
-        case 0: if (mButton0PB) mButton0PB->setText (aText); break;
-        case 1: if (mButton1PB) mButton1PB->setText (aText); break;
-        case 2: if (mButton2PB) mButton2PB->setText (aText); break;
-        default: break;
-    }
-}
-
-/** @fn QIMessageBox::flagText() const
- *
- *  Returns the text of the optional message box flag. If the flag is hidden
- *  (by default) a null string is returned.
- *
- *  @see #setFlagText()
- */
-
-/**
- *  Sets the text for the optional message box flag (check box) that is
- *  displayed under the message text. Passing the null string as the argument
- *  will hide the flag. By default, the flag is hidden.
- */
-void QIMessageBox::setFlagText (const QString &aText)
-{
-    if (aText.isNull())
-    {
-        mFlagCB->hide();
-    }
-    else
-    {
-        mFlagCB->setText (aText);
-        mFlagCB->show();
-        mFlagCB->setFocus();
-    }
-}
-
-/** @fn QIMessageBox::isFlagChecked() const
- *
- *  Returns true if the optional message box flag is checked and false
- *  otherwise. By default, the flag is not checked.
- *
- *  @see #setFlagChecked()
- *  @see #setFlagText()
- */
-
-/** @fn QIMessageBox::setFlagChecked (bool)
- *
- *  Sets the state of the optional message box flag to a value of the argument.
- *
- *  @see #isFlagChecked()
- *  @see #setFlagText()
- */
-
-QPushButton *QIMessageBox::createButton (int aButton)
-{
-    if (aButton == 0)
-        return 0;
-
-    QString text;
-    QDialogButtonBox::ButtonRole role;
-    switch (aButton & ButtonMask)
-    {
-        case Ok:        text = tr ("OK"); role = QDialogButtonBox::AcceptRole; break;
-        case Yes:       text = tr ("Yes"); role = QDialogButtonBox::YesRole; break;
-        case No:        text = tr ("No"); role = QDialogButtonBox::NoRole; break;
-        case Cancel:    text = tr ("Cancel"); role = QDialogButtonBox::RejectRole; break;
-        case Ignore:    text = tr ("Ignore"); role = QDialogButtonBox::AcceptRole; break;
-        default:
-            AssertMsgFailed (("Type %d is not implemented", aButton));
-            return NULL;
-    }
-
-    QPushButton *b = mButtonBox->addButton (text, role);
-
-    if (aButton & Default)
-    {
-        b->setDefault (true);
-        b->setFocus();
-    }
-
-    if (aButton & Escape)
-        mButtonEsc = aButton & ButtonMask;
-
-    return b;
-}
-
-/** @fn QIMessageBox::detailsText() const
- *
- *  Returns the text of the optional details box. The details box is empty
- *  by default, so QString::null will be returned.
- *
- *  @see #setDetailsText()
- */
-
-/**
- *  Sets the text for the optional details box. Note that the details box
- *  is hidden by default, call #setDetailsShown(true) to make it visible.
- *
- *  @see #detailsText()
- *  @see #setDetailsShown()
- */
-void QIMessageBox::setDetailsText (const QString &aText)
-{
-    AssertMsg (!aText.isEmpty(), ("Details text should NOT be empty."));
-
-    QStringList paragraphs (aText.split ("<!--EOP-->", QString::SkipEmptyParts));
-    AssertMsg (paragraphs.size() != 0, ("There should be at least one paragraph."));
-
-    foreach (QString paragraph, paragraphs)
-    {
-        QStringList parts (paragraph.split ("<!--EOM-->", QString::KeepEmptyParts));
-        AssertMsg (parts.size() == 2, ("Each paragraph should consist of 2 parts."));
-        mDetailsList << QPair <QString, QString> (parts [0], parts [1]);
-    }
-
-    mDetailsSplitter->setMultiPaging (mDetailsList.size() > 1);
-    mDetailsIndex = 0;
-    refreshDetails();
-}
-
-QPixmap QIMessageBox::standardPixmap (QIMessageBox::Icon aIcon)
-{
-    QIcon icon;
-    switch (aIcon)
-    {
-        case QIMessageBox::Information:
-            icon = vboxGlobal().standardIcon (QStyle::SP_MessageBoxInformation, this);
-            break;
-        case QMessageBox::Warning:
-            icon = vboxGlobal().standardIcon (QStyle::SP_MessageBoxWarning, this);
-            break;
-        case QIMessageBox::Critical:
-            icon = vboxGlobal().standardIcon (QStyle::SP_MessageBoxCritical, this);
-            break;
-        case QIMessageBox::Question:
-            icon = vboxGlobal().standardIcon (QStyle::SP_MessageBoxQuestion, this);
-            break;
-        case QIMessageBox::GuruMeditation:
-            icon = QIcon (":/meditation_32px.png");
-            break;
-        default:
-            break;
-    }
-    if (!icon.isNull())
-    {
-        int size = style()->pixelMetric (QStyle::PM_MessageBoxIconSize, 0, this);
-        return icon.pixmap (size, size);
-    }else
-        return QPixmap();
-}
-
-void QIMessageBox::closeEvent (QCloseEvent *e)
-{
-    if (mWasDone)
-        e->accept();
-    else
-        e->ignore();
-}
-
-void QIMessageBox::showEvent (QShowEvent *e)
-{
-    if (!mWasPolished)
-    {
-        /* Polishing sub-widgets */
-        resize (minimumSizeHint());
-        qApp->processEvents();
-        mTextLabel->useSizeHintForWidth (mTextLabel->width());
-        mTextLabel->updateGeometry();
-        qApp->processEvents();
-        setFixedWidth (width());
-        mDetailsSplitter->toggleWidget();
-        mWasPolished = true;
-    }
-
-    QIDialog::showEvent (e);
-}
-
-void QIMessageBox::refreshDetails()
-{
-    /* Update message text iteself */
-    mTextLabel->setText (mText + mDetailsList [mDetailsIndex].first);
-    /* Update details table */
-    mDetailsText->setText (mDetailsList [mDetailsIndex].second);
-    setDetailsShown (!mDetailsText->toPlainText().isEmpty());
-
-    /* Update multi-paging system */
-    if (mDetailsList.size() > 1)
-    {
-        mDetailsSplitter->setButtonEnabled (true, mDetailsIndex < mDetailsList.size() - 1);
-        mDetailsSplitter->setButtonEnabled (false, mDetailsIndex > 0);
-    }
-
-    /* Update details label */
-    mDetailsSplitter->setName (mDetailsList.size() == 1 ? tr ("&Details") :
-        tr ("&Details (%1 of %2)").arg (mDetailsIndex + 1).arg (mDetailsList.size()));
-}
-
-/**
- *  Sets the visibility state of the optional details box
- *  to a value of the argument.
- *
- *  @see #isDetailsShown()
- *  @see #setDetailsText()
- */
-void QIMessageBox::setDetailsShown (bool aShown)
-{
-    if (aShown)
-    {
-        mFlagCB_Details->setVisible (mFlagCB_Main->isVisible());
-        mFlagCB_Details->setChecked (mFlagCB_Main->isChecked());
-        mFlagCB_Details->setText (mFlagCB_Main->text());
-        if (mFlagCB_Main->hasFocus())
-            mFlagCB_Details->setFocus();
-        mFlagCB_Main->setVisible (false);
-        mFlagCB = mFlagCB_Details;
-        mSpacer->changeSize (0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum);
-    }
-
-    mDetailsVBox->setVisible (aShown);
-
-    if (!aShown)
-    {
-        mFlagCB_Main->setVisible (mFlagCB_Details->isVisible());
-        mFlagCB_Main->setChecked (mFlagCB_Details->isChecked());
-        mFlagCB_Main->setText (mFlagCB_Details->text());
-        if (mFlagCB_Details->hasFocus())
-            mFlagCB_Main->setFocus();
-        mFlagCB = mFlagCB_Main;
-        mSpacer->changeSize (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
-    }
-}
-
-void QIMessageBox::detailsBack()
-{
-    if (mDetailsIndex > 0)
-    {
-        -- mDetailsIndex;
-        refreshDetails();
-    }
-}
-
-void QIMessageBox::detailsNext()
-{
-    if (mDetailsIndex < mDetailsList.size() - 1)
-    {
-        ++ mDetailsIndex;
-        refreshDetails();
-    }
-}
-
-void QIMessageBox::reject()
-{
-    if (mButtonEsc)
-    {
-        QDialog::reject();
-        setResult (mButtonEsc & ButtonMask);
-    }
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIRichToolButton.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIRichToolButton.cpp	(revision 25170)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIRichToolButton class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "QIRichToolButton.h"
-
-/* Qt includes */
-#include <QLabel>
-#include <QHBoxLayout>
-#include <QToolButton>
-#include <QKeyEvent>
-#include <QStylePainter>
-#include <QStyleOptionFocusRect>
-
-QIRichToolButton::QIRichToolButton (QWidget *aParent)
-    : QWidget (aParent)
-    , mButton (new QToolButton())
-    , mLabel (new QLabel())
-{
-    init();
-}
-
-QIRichToolButton::QIRichToolButton (const QString &aName, QWidget *aParent)
-    : QWidget (aParent)
-    , mButton (new QToolButton())
-    , mLabel (new QLabel (aName))
-{
-    init();
-}
-
-void QIRichToolButton::init()
-{
-    /* Setup itself */
-    setFocusPolicy (Qt::StrongFocus);
-
-    /* Setup tool-button */
-    mButton->setAutoRaise (true);
-    mButton->setFixedSize (17, 16);
-    mButton->setFocusPolicy (Qt::NoFocus);
-    mButton->setStyleSheet ("QToolButton {border: 0px none black;}");
-    connect (mButton, SIGNAL (clicked (bool)), this, SLOT (buttonClicked()));
-
-    /* Setup text-label */
-    mLabel->setBuddy (mButton);
-    mLabel->setStyleSheet ("QLabel {padding: 2px 0px 2px 0px;}");
-
-    /* Setup main-layout */
-    QHBoxLayout *mainLayout = new QHBoxLayout (this);
-    VBoxGlobal::setLayoutMargin (mainLayout, 0);
-    mainLayout->setSpacing (0);
-    mainLayout->addWidget (mButton);
-    mainLayout->addWidget (mLabel);
-
-    /* Install event-filter */
-    qApp->installEventFilter (this);
-}
-
-bool QIRichToolButton::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    /* Process only QIRichToolButton or children */
-    if (!(aObject == this || children().contains (aObject)))
-        return QWidget::eventFilter (aObject, aEvent);
-
-    /* Process keyboard events */
-    if (aEvent->type() == QEvent::KeyPress)
-    {
-        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
-        if (kEvent->key() == Qt::Key_Space)
-            animateClick();
-    }
-
-    /* Process mouse events */
-    if ((aEvent->type() == QEvent::MouseButtonPress ||
-         aEvent->type() == QEvent::MouseButtonDblClick)
-        && aObject == mLabel)
-    {
-        /* Label click as toggle */
-        animateClick();
-    }
-
-    /* Default one handler */
-    return QWidget::eventFilter (aObject, aEvent);
-}
-
-void QIRichToolButton::paintEvent (QPaintEvent *aEvent)
-{
-    /* Draw focus around mLabel if focused */
-    if (hasFocus())
-    {
-        QStylePainter painter (this);
-        QStyleOptionFocusRect option;
-        option.initFrom (this);
-        option.rect = mLabel->frameGeometry();
-        painter.drawPrimitive (QStyle::PE_FrameFocusRect, option);
-    }
-    QWidget::paintEvent (aEvent);
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/QISplitter.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QISplitter.cpp	(revision 25170)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QISplitter class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global includes */
-#include <QApplication>
-#include <QEvent>
-#include <QPainter>
-#include <QPaintEvent>
-
-/* Local includes */
-#include "QISplitter.h"
-
-QISplitter::QISplitter (QWidget *aParent)
-    : QSplitter (aParent)
-    , mPolished (false)
-{
-    qApp->installEventFilter (this);
-}
-
-bool QISplitter::eventFilter (QObject *aWatched, QEvent *aEvent)
-{
-    if (aWatched == handle (1))
-    {
-        switch (aEvent->type())
-        {
-            case QEvent::MouseButtonDblClick:
-                restoreState (mBaseState);
-                break;
-            default:
-                break;
-        }
-    }
-
-    return QSplitter::eventFilter (aWatched, aEvent);
-}
-
-void QISplitter::showEvent (QShowEvent *aEvent)
-{
-    if (!mPolished)
-    {
-        mPolished = true;
-        mBaseState = saveState();
-    }
-
-    return QSplitter::showEvent (aEvent);
-}
-
-QSplitterHandle* QISplitter::createHandle()
-{
-    return new QISplitterHandle (orientation(), this);
-}
-
-QISplitterHandle::QISplitterHandle (Qt::Orientation aOrientation, QISplitter *aParent)
-    : QSplitterHandle (aOrientation, aParent)
-{
-}
-
-void QISplitterHandle::paintEvent (QPaintEvent *aEvent)
-{
-    QPainter painter (this);
-    QLinearGradient gradient;
-    if (orientation() == Qt::Horizontal)
-    {
-        gradient.setStart (rect().left(), rect().height() / 2);
-        gradient.setFinalStop (rect().right(), rect().height() / 2);
-    }
-    else
-    {
-        gradient.setStart (rect().width() / 2, rect().top());
-        gradient.setFinalStop (rect().width() / 2, rect().bottom());
-    }
-    painter.fillRect (aEvent->rect(), QBrush (gradient));
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIStateIndicator.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIStateIndicator.cpp	(revision 25170)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIStateIndicator class implementation
- */
-
-/*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIStateIndicator.h"
-
-/* Qt includes */
-#include <QPainter>
-#ifdef Q_WS_MAC
-# include <QContextMenuEvent>
-#endif
-
-/** @clas QIStateIndicator
- *
- *  The QIStateIndicator class is a simple class that can visually indicate
- *  the state of some thing, as described by the state property.
- */
-
-/**
- *  Constructs a new QIStateIndicator instance. This instance is useless
- *  until icons are specified for necessary states.
- *
- *  @param aState
- *      the initial indicator state
- */
-QIStateIndicator::QIStateIndicator (int aState)
-//    : QFrame (aParent, aName, aFlags | Qt::WStaticContents | Qt::WMouseNoMask)
-{
-    mState = aState;
-    mSize = QSize (0, 0);
-
-    setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed));
-
-    /* we will precompose the pixmap background using the widget bacground in
-     * drawContents(), so try to set the correct bacground origin for the
-     * case when a pixmap is used as a widget background. */
-//    if (aParent)
-//        setBackgroundOrigin (aParent->backgroundOrigin());
-}
-
-QIStateIndicator::~QIStateIndicator()
-{
-    qDeleteAll (mStateIcons);
-}
-
-QSize QIStateIndicator::sizeHint() const
-{
-    return mSize;
-}
-
-QPixmap QIStateIndicator::stateIcon (int aState) const
-{
-    Icon *icon = mStateIcons [aState];
-    return icon ? icon->pixmap : QPixmap();
-}
-
-/**
- *  Sets an icon for the specified state. The first icon set by this method
- *  defines the preferred size of this indicator. All other icons will be
- *  scaled to fit this size.
- *
- *  @note If this widget is constructed with the WNoAutoErase flag, then all
- *  transparent areas of the new state icon are filled with the widget
- *  background color or pixmap (as taken from the widget palette), to provide
- *  flicker free state redraws in one single operation (which is useful for
- *  indicators that frequently change their state).
- */
-void QIStateIndicator::setStateIcon (int aState, const QPixmap &aPixmap)
-{
-    /* Here we just set the original pixmap. All actual work from the @note
-     * above takes place in #drawContents(). */
-    mStateIcons.insert (aState, new Icon (aPixmap));
-
-    if (mSize.isNull())
-        mSize = aPixmap.size();
-}
-
-void QIStateIndicator::setState (int aState)
-{
-    mState = aState;
-    repaint();
-}
-
-void QIStateIndicator::paintEvent (QPaintEvent * /* aEv */)
-{
-    QPainter painter (this);
-    drawContents (&painter);
-}
-
-void QIStateIndicator::drawContents (QPainter *aPainter)
-{
-    Icon *icon = mStateIcons [mState];
-    if (icon)
-        aPainter->drawPixmap (contentsRect(), icon->pixmap);
-}
-
-#ifdef Q_WS_MAC
-/**
- * Make the left button also show the context menu to make things
- * simpler for users with single mouse button mice (laptops++).
- */
-void QIStateIndicator::mousePressEvent (QMouseEvent *aEv)
-{
-    /* Do this for the left mouse button event only, cause in the case of the
-     * right mouse button it could happen that the context menu event is
-     * triggered twice. Also this isn't necessary for the middle mouse button
-     * which would be some kind of overstated. */
-    if (aEv->button() == Qt::LeftButton)
-    {
-        QContextMenuEvent qme (QContextMenuEvent::Mouse, aEv->pos(), aEv->globalPos());
-        emit contextMenuRequested (this, &qme);
-        if (qme.isAccepted())
-            aEv->accept();
-        else
-            QFrame::mousePressEvent (aEv);
-    }else
-        QFrame::mousePressEvent (aEv);
-}
-#endif /* Q_WS_MAC */
-
-void QIStateIndicator::mouseDoubleClickEvent (QMouseEvent * e)
-{
-    emit mouseDoubleClicked (this, e);
-}
-
-void QIStateIndicator::contextMenuEvent (QContextMenuEvent * e)
-{
-    emit contextMenuRequested (this, e);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIStatusBar.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIStatusBar.cpp	(revision 25170)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIStatusBar class implementation
- */
-
-/*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIStatusBar.h"
-
-QIStatusBar::QIStatusBar (QWidget *aParent)
-    : QStatusBar (aParent)
-{
-    connect (this, SIGNAL (messageChanged (const QString&)),
-             this, SLOT (rememberLastMessage (const QString&)));
-
-    /* Remove that ugly border around the statusbar items on every platform */
-    setStyleSheet ("QStatusBar::item { border: 0px none black; }");
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QITreeView.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QITreeView.cpp	(revision 25170)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITreeView class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global includes */
-#include <QMouseEvent>
-#include <QPainter>
-
-/* Local includes */
-#include "QITreeView.h"
-
-QITreeView::QITreeView (QWidget *aParent)
-    : QTreeView (aParent)
-{
-    setHeaderHidden (true);
-    setRootIsDecorated (false);
-}
-
-void QITreeView::currentChanged (const QModelIndex &aCurrent, const QModelIndex &aPrevious)
-{
-    emit currentItemChanged (aCurrent, aPrevious);
-    QTreeView::currentChanged (aCurrent, aPrevious);
-}
-
-void QITreeView::drawBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex) const
-{
-    emit drawItemBranches (aPainter, aRect, aIndex);
-    QTreeView::drawBranches (aPainter, aRect, aIndex);
-}
-
-void QITreeView::mouseMoveEvent (QMouseEvent *aEvent)
-{
-    aEvent->setAccepted (false);
-    emit mouseMoved (aEvent);
-    if (!aEvent->isAccepted())
-        QTreeView::mouseMoveEvent (aEvent);
-}
-
-void QITreeView::mousePressEvent (QMouseEvent *aEvent)
-{
-    aEvent->setAccepted (false);
-    emit mousePressed (aEvent);
-    if (!aEvent->isAccepted())
-        QTreeView::mousePressEvent (aEvent);
-}
-
-void QITreeView::mouseDoubleClickEvent (QMouseEvent *aEvent)
-{
-    aEvent->setAccepted (false);
-    emit mouseDoubleClicked (aEvent);
-    if (!aEvent->isAccepted())
-        QTreeView::mouseDoubleClickEvent (aEvent);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/QITreeWidget.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QITreeWidget.cpp	(revision 25170)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITreeWidget class implementation
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global includes */
-#include <QPainter>
-#include <QResizeEvent>
-
-/* Local includes */
-#include "QITreeWidget.h"
-
-QITreeWidget::QITreeWidget (QWidget *aParent)
-    : QTreeWidget (aParent)
-{
-}
-
-void QITreeWidget::paintEvent (QPaintEvent *aEvent)
-{
-    /* Opens Items Painter */
-    QPainter painter;
-    painter.begin (viewport());
-
-    /* Notify connected objects about painting */
-    QTreeWidgetItemIterator it (this);
-    while (*it)
-    {
-        emit painted (*it, &painter);
-        ++ it;
-    }
-
-    /* Close Items Painter */
-    painter.end();
-
-    /* Base-class paint-event */
-    QTreeWidget::paintEvent (aEvent);
-}
-
-void QITreeWidget::resizeEvent (QResizeEvent *aEvent)
-{
-    /* Base-class resize-event */
-    QTreeWidget::resizeEvent (aEvent);
-
-    /* Notify connected objects about resize */
-    emit resized (aEvent->size(), aEvent->oldSize());
-}
-
-void QITreeWidget::addTopBottomMarginToItems (int aMargin)
-{
-    for (int i = 0; i < topLevelItemCount(); ++ i)
-    {
-        QTreeWidgetItem *item = topLevelItem (i);
-        QSize s = item->sizeHint (0);
-        item->setSizeHint (0, QSize (s.width(), s.height() + 2 * aMargin));
-    }
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/QIWidgetValidator.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/QIWidgetValidator.cpp	(revision 25170)
+++ 	(revision )
@@ -1,391 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIWidgetValidator class implementation
- */
-
-/*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIWidgetValidator.h"
-
-/* Qt includes */
-#include <QLineEdit>
-#include <QComboBox>
-#include <QLabel>
-
-#include <iprt/assert.h>
-
-#include "VBoxGlobal.h"
-
-/** @class QIWidgetValidator
- *
- *  The QIWidgetValidator class is a widget validator. Its purpose is to
- *  answer the question: whether all relevant (grand) children of the given
- *  widget are valid or not. Relevant children are those widgets which
- *  receive some user input that can be checked for validity (i.e. they
- *  have a validator() method that returns a pointer to a QValidator instance
- *  used to validate widget's input). The QLineEdit class is an example of
- *  such a widget.
- *
- *  When a QIWidgetValidator instance is created it receives a pointer to
- *  a widget whose children should be checked for validity. The instance
- *  connects itself to signals emitted by input widgets when their contents
- *  changes, and emits its own signal, validityChanged() (common for all
- *  child widgets being observed), whenever the change happens.
- *
- *  Objects that want to know when the validity state changes should connect
- *  themselves to the validityChanged() signal and then use the isValid()
- *  method to determine whether all children are valid or not.
- *
- *  It is assumed that all children that require validity checks have been
- *  already added to the widget when it is passed to the QIWidgetValidator
- *  constructor. If other children (that need to be validated) are added
- *  later, it's necessary to call the rescan() method to rescan the widget
- *  hierarchy again, otherwise the results of validity checks are undefined.
- *
- *  It's also necessary to call the revalidate() method every time the
- *  enabled state of the child widget is changed, because QIWidgetValidator
- *  skips disabled widgets when it calculates the combined validity state.
- *
- *  This class is useful for example for QWizard dialogs, where a separate
- *  instance validates every page of the wizard that has children to validate,
- *  and the validityChanged() signal of every instance is connected to some
- *  signal of the QWizard subclass, that enables or disables the Next button,
- *  depending on the result of the validity check.
- *
- *  Currently, only QLineEdit and QComboBox classes and their successors are
- *  recognized by QIWidgetValidator. It uses the QLineEdit::hasAcceptableInput()
- *  and QCombobox::validator() methods to determine the validity state o
- *  the corresponding widgets (note that the QComboBox widget must be editable,
- *  otherwise it will be skipped).
- */
-
-/**
- *  Constructs a new instance that will check the validity of children
- *  of the given widget.
- *
- *  @param aWidget  Widget whose children should be checked.
- */
-QIWidgetValidator::QIWidgetValidator (QWidget *aWidget, QObject *aParent)
-    : QObject (aParent)
-    , mWidget (aWidget)
-    , mOtherValid (true)
-{
-    rescan();
-}
-
-/**
- *  Constructs a new instance that will check the validity of children
- *  of the given widget.
- *
- *  @param aCaption Caption to use for the warning message.
- *  @param aWidget  Widget whose children should be checked.
- */
-QIWidgetValidator::QIWidgetValidator (const QString &aCaption,
-                                      QWidget *aWidget, QObject *aParent)
-    : QObject (aParent)
-    , mCaption (aCaption)
-    , mWidget (aWidget)
-    , mOtherValid (true)
-{
-    rescan();
-}
-
-/**
- *  Destructs this validator instance.
- *  Before destruction, the #validityChanged() signal is emitted; the
- *  value of #isValid() is always true at this time.
- */
-QIWidgetValidator::~QIWidgetValidator()
-{
-    mWidget = 0;
-    doRevalidate();
-}
-
-//
-// Public members
-/////////////////////////////////////////////////////////////////////////////
-
-/** @fn QIWidgetValidator::widget() const
- *
- *  Returns a widget managed by this instance.
- */
-
-/**
- *  Returns true if all relevant children of the widget managed by this
- *  instance are valid AND if #isOtherValid() returns true; otherwise returns
- *  false. Disabled children and children without validation
- *  are skipped and don't affect the result.
- *
- *  The method emits the #isValidRequested() signal before calling
- *  #isOtherValid(), thus giving someone an opportunity to affect its result by
- *  calling #setOtherValid() from the signal handler. Note that #isOtherValid()
- *  returns true by default, until #setOtherValid( false ) is called.
- *
- *  @note If #isOtherValid() returns true this method does a hierarchy scan, so
- *  it's a good idea to store the returned value in a local variable if needed
- *  more than once within a context of a single check.
- */
-bool QIWidgetValidator::isValid() const
-{
-    // wgt is null, we assume we're valid
-    if (!mWidget)
-        return true;
-
-    QIWidgetValidator *that = const_cast <QIWidgetValidator *> (this);
-    emit that->isValidRequested (that);
-    if (!isOtherValid())
-        return false;
-
-    QValidator::State state = QValidator::Acceptable;
-
-    foreach (Watched watched, mWatched)
-    {
-        if (watched.widget->inherits ("QLineEdit"))
-        {
-            QLineEdit *le = ((QLineEdit *) watched.widget);
-            Assert (le->validator());
-            if (!le->validator() || !le->isEnabled())
-                continue;
-            QString text = le->text();
-            int pos;
-            state = le->validator()->validate (text, pos);
-        }
-        else if (watched.widget->inherits ("QComboBox"))
-        {
-            QComboBox *cb = ((QComboBox *) watched.widget);
-            Assert (cb->validator());
-            if (!cb->validator() || !cb->isEnabled())
-                continue;
-            QString text = cb->lineEdit()->text();
-            int pos;
-            state = cb->lineEdit()->validator()->validate (text, pos);
-        }
-
-        if (state != QValidator::Acceptable)
-        {
-            that->mLastInvalid = watched;
-            that->mLastInvalid.state = state;
-            return false;
-        }
-    }
-
-    /* reset last invalid */
-    that->mLastInvalid = Watched();
-    return true;
-}
-
-/**
- *  Rescans all (grand) children of the managed widget and:
- *
- *  1) remembers all supported widgets with validators to speed up further
- *     validation;
- *
- *  2) connects itself to those that can be validated, in order to emit the
- *     validityChanged() signal to give its receiver an opportunity to do
- *     useful actions.
- *
- *  Must be called every time a child widget is added or removed.
- */
-void QIWidgetValidator::rescan()
-{
-    if (!mWidget)
-        return;
-
-    mWatched.clear();
-
-    Watched watched;
-
-    QList<QWidget *> list = mWidget->findChildren<QWidget *>();
-    QWidget *wgt;
-
-    /* detect all widgets that support validation */
-    QListIterator<QWidget *> it (list);
-    while (it.hasNext())
-    {
-        wgt = it.next();
-
-        if (QLineEdit *le = qobject_cast<QLineEdit *> (wgt))
-        {
-            if (!le->validator())
-                continue;
-            /* disconnect to avoid duplicate connections */
-            disconnect (le, SIGNAL (editingFinished ()),
-                        this, SLOT (doRevalidate()));
-            disconnect (le, SIGNAL (cursorPositionChanged (int, int)),
-                        this, SLOT (doRevalidate()));
-            disconnect (le, SIGNAL (textChanged (const QString &)),
-                        this, SLOT (doRevalidate()));
-            /* Use all signals which indicate some change in the text. The
-             * textChanged signal isn't sufficient in Qt4. */
-            connect (le, SIGNAL (textChanged (const QString &)),
-                     this, SLOT (doRevalidate()));
-            connect (le, SIGNAL (cursorPositionChanged (int, int)),
-                     this, SLOT (doRevalidate()));
-            connect (le, SIGNAL (editingFinished ()),
-                     this, SLOT (doRevalidate()));
-        }
-        else if (QComboBox *cb = qobject_cast<QComboBox *> (wgt))
-        {
-
-            if (!cb->validator() || !cb->lineEdit())
-                continue;
-            /* disconnect to avoid duplicate connections */
-            disconnect (cb, SIGNAL (textChanged (const QString &)),
-                        this, SLOT (doRevalidate()));
-            connect (cb, SIGNAL (textChanged (const QString &)),
-                     this, SLOT (doRevalidate()));
-        }
-
-        watched.widget = wgt;
-
-        /* try to find a buddy widget in order to determine the title for
-         * the watched widget which is used in the warning text */
-        QListIterator<QWidget *> it2 (list);
-        while (it2.hasNext())
-        {
-            wgt = it2.next();
-            if (QLabel *label = qobject_cast<QLabel *> (wgt))
-                if (label->buddy() == watched.widget)
-                {
-                    watched.buddy = label;
-                    break;
-                }
-        }
-
-        /* memorize */
-        mWatched << watched;
-    }
-}
-
-/**
- *  Returns a message that describes the last detected error (invalid or
- *  incomplete input).
- *
- *  This message uses the caption text passed to the constructor as a page
- *  name to refer to. If the caption is NULL, this function will return a null
- *  string.
- *
- *  Also, if the failed widget has a buddy widget, this buddy widget's text
- *  will be used as a field name to refer to.
- */
-QString QIWidgetValidator::warningText() const
-{
-    /* cannot generate an informative message if no caption provided */
-    if (mCaption.isEmpty())
-        return QString::null;
-
-    if (mLastInvalid.state == QValidator::Acceptable)
-        return QString::null;
-
-    AssertReturn (mLastInvalid.widget, QString::null);
-
-    QString title;
-    if (mLastInvalid.buddy != NULL)
-    {
-        if (mLastInvalid.buddy->inherits ("QLabel"))
-        {
-            /* Remove '&' symbol from the buddy field name */
-            title = VBoxGlobal::
-                removeAccelMark (((QLabel *) mLastInvalid.buddy)->text());
-
-            /* Remove ':' symbol from the buddy field name */
-            title = title.remove (':');
-        }
-    }
-
-    QString state;
-    if (mLastInvalid.state == QValidator::Intermediate)
-        state = tr ("not complete", "value state");
-    else
-        state = tr ("invalid", "value state");
-
-    if (!title.isEmpty())
-        return tr ("<qt>The value of the <b>%1</b> field "
-                   "on the <b>%2</b> page is %3.</qt>")
-            .arg (title, mCaption, state);
-
-    return tr ("<qt>One of the values "
-               "on the <b>%1</b> page is %2.</qt>")
-        .arg (mCaption, state);
-}
-
-/** @fn QIWidgetValidator::setOtherValid()
- *
- *  Sets the generic validity flag to true or false depending on the
- *  argument.
- *
- *  @see #isOtherValid()
- */
-
-/** @fn QIWidgetValidator::isOtherValid()
- *
- *  Returns the current value of the generic validity flag.
- *  This generic validity flag is used by #isValid() to determine
- *  the overall validity of the managed widget. This flag is true by default,
- *  until #setOtherValid( false ) is called.
- */
-
-/** @fn QIWidgetValidator::validityChanged( const QIWidgetValidator * ) const
- *
- *  Emitted when any of the relevant children of the widget managed by this
- *  instance changes its validity state. The argument is this instance.
- */
-
-/** @fn QIWidgetValidator::isValidRequested( const QIWidgetValidator * ) const
- *
- *  Emitted whenever #sValid() is called, right before querying the generic
- *  validity value using the #isOtherValid() method.
- *  The argument is this instance.
- */
-
-/** @fn QIWidgetValidator::revalidate()
- *
- *  Emits the validityChanged() signal, from where receivers can use the
- *  isValid() method to check for validity.
- */
-
-
-/** @class QIULongValidator
- *
- *  The QIULongValidator class is a QIntValidator-like class to validate
- *  unsigned integer numbers. As opposed to QIntValidator, this class accepts
- *  all three integer number formats: decimal, hexadecimal (the string starts
- *  with "0x") and octal (the string starts with "0").
- */
-
-QValidator::State QIULongValidator::validate (QString &aInput, int &aPos) const
-{
-    Q_UNUSED (aPos);
-
-    QString stripped = aInput.trimmed();
-
-    if (stripped.isEmpty() ||
-        stripped.toUpper() == QString ("0x").toUpper())
-        return Intermediate;
-
-    bool ok;
-    ulong entered = aInput.toULong (&ok, 0);
-
-    if (!ok)
-        return Invalid;
-
-    if (entered >= mBottom && entered <= mTop)
-        return Acceptable;
-
-    return (entered > mTop ) ? Invalid : Intermediate;
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h	(revision 25171)
@@ -0,0 +1,54 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxAboutDlg class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxAboutDlg_h__
+#define __VBoxAboutDlg_h__
+
+#include "QIWithRetranslateUI.h"
+#include "QIDialog.h"
+
+/* Qt includes */
+#include <QPixmap>
+
+class QEvent;
+
+class VBoxAboutDlg: public QIWithRetranslateUI2<QIDialog>
+{
+    Q_OBJECT;
+
+public:
+    VBoxAboutDlg (QWidget* aParent, const QString &aVersion);
+
+protected:
+    bool event (QEvent *aEvent);
+    void paintEvent (QPaintEvent *aEvent);
+    void mouseReleaseEvent (QMouseEvent *aEvent);
+
+    void retranslateUi();
+
+private:
+    QString mAboutText;
+    QString mVersion;
+    QPixmap mBgImage;
+};
+
+#endif /* __VBoxAboutDlg_h__ */
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxApplianceEditorWgt.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxApplianceEditorWgt.cpp	(revision 25170)
+++ 	(revision )
@@ -1,1058 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxApplianceEditorWgt class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxApplianceEditorWgt.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "VBoxOSTypeSelectorButton.h"
-#include "VBoxLineTextEdit.h"
-
-/* Qt includes */
-#include <QItemDelegate>
-#include <QSortFilterProxyModel>
-#include <QHeaderView>
-#include <QLineEdit>
-#include <QTextEdit>
-#include <QSpinBox>
-#include <QComboBox>
-
-////////////////////////////////////////////////////////////////////////////////
-// ModelItem
-
-/* This & the following derived classes represent the data items of a Virtual
-   System. All access/manipulation is done with the help of virtual functions
-   to keep the interface clean. ModelItem is able to handle tree structures
-   with a parent & several children's. */
-ModelItem::ModelItem (int aNumber, ModelItemType aType, ModelItem *aParent /* = NULL */)
-  : mNumber (aNumber)
-  , mType (aType)
-  , mParentItem (aParent)
-{}
-
-ModelItem::~ModelItem()
-{
-    qDeleteAll (mChildItems);
-}
-
-void ModelItem::appendChild (ModelItem *aChild)
-{
-    AssertPtr (aChild);
-    mChildItems << aChild;
-}
-
-ModelItem * ModelItem::child (int aRow) const
-{
-    return mChildItems.value (aRow);
-}
-
-int ModelItem::row() const
-{
-    if (mParentItem)
-        return mParentItem->mChildItems.indexOf (const_cast<ModelItem*> (this));
-
-    return 0;
-}
-
-int ModelItem::childCount() const
-{
-    return mChildItems.count();
-}
-
-void ModelItem::putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
-{
-    for (int i = 0; i < childCount(); ++i)
-        child (i)->putBack (aFinalStates, aFinalValues, aFinalExtraValues);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VirtualSystemItem
-
-VirtualSystemItem::VirtualSystemItem (int aNumber, CVirtualSystemDescription aDesc, ModelItem *aParent)
-  : ModelItem (aNumber, VirtualSystemType, aParent)
-  , mDesc (aDesc)
-{}
-
-QVariant VirtualSystemItem::data (int aColumn, int aRole) const
-{
-    QVariant v;
-    if (aColumn == DescriptionSection &&
-        aRole == Qt::DisplayRole)
-        v = VBoxApplianceEditorWgt::tr ("Virtual System %1").arg (mNumber + 1);
-    return v;
-}
-
-void VirtualSystemItem::putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
-{
-    /* Resize the vectors */
-    unsigned long count = mDesc.GetCount();
-    aFinalStates.resize (count);
-    aFinalValues.resize (count);
-    aFinalExtraValues.resize (count);
-    /* Recursively fill the vectors */
-    ModelItem::putBack (aFinalStates, aFinalValues, aFinalExtraValues);
-    /* Set all final values at once */
-    mDesc.SetFinalValues (aFinalStates, aFinalValues, aFinalExtraValues);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// HardwareItem
-
-HardwareItem::HardwareItem (int aNumber,
-                            KVirtualSystemDescriptionType aType,
-                            const QString &aRef,
-                            const QString &aOrigValue,
-                            const QString &aConfigValue,
-                            const QString &aExtraConfigValue,
-                            ModelItem *aParent)
-  : ModelItem (aNumber, HardwareType, aParent)
-  , mType (aType)
-  , mRef (aRef)
-  , mOrigValue (aOrigValue)
-  , mConfigValue (aConfigValue)
-  , mConfigDefaultValue (aConfigValue)
-  , mExtraConfigValue (aExtraConfigValue)
-  , mCheckState (Qt::Checked)
-{}
-
-void HardwareItem::putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues)
-{
-    aFinalStates[mNumber] = mCheckState == Qt::Checked;
-    aFinalValues[mNumber] = mConfigValue;
-    aFinalExtraValues[mNumber] = mExtraConfigValue;
-    ModelItem::putBack (aFinalStates, aFinalValues, aFinalExtraValues);
-}
-
-bool HardwareItem::setData (int aColumn, const QVariant &aValue, int aRole)
-{
-    bool fDone = false;
-    switch (aRole)
-    {
-        case Qt::CheckStateRole:
-            {
-                if (aColumn == ConfigValueSection &&
-                    (mType == KVirtualSystemDescriptionType_Floppy ||
-                     mType == KVirtualSystemDescriptionType_CDROM ||
-                     mType == KVirtualSystemDescriptionType_USBController ||
-                     mType == KVirtualSystemDescriptionType_SoundCard ||
-                     mType == KVirtualSystemDescriptionType_NetworkAdapter))
-                {
-                    mCheckState = static_cast<Qt::CheckState> (aValue.toInt());
-                    fDone = true;
-                }
-                break;
-            }
-        default: break;
-    }
-    return fDone;
-}
-
-QVariant HardwareItem::data (int aColumn, int aRole) const
-{
-    QVariant v;
-    switch (aRole)
-    {
-        case Qt::DisplayRole:
-            {
-                if (aColumn == DescriptionSection)
-                {
-                    switch (mType)
-                    {
-                        case KVirtualSystemDescriptionType_Name: v = VBoxApplianceEditorWgt::tr ("Name"); break;
-                        case KVirtualSystemDescriptionType_Product: v = VBoxApplianceEditorWgt::tr ("Product"); break;
-                        case KVirtualSystemDescriptionType_ProductUrl: v = VBoxApplianceEditorWgt::tr ("Product-URL"); break;
-                        case KVirtualSystemDescriptionType_Vendor: v = VBoxApplianceEditorWgt::tr ("Vendor"); break;
-                        case KVirtualSystemDescriptionType_VendorUrl: v = VBoxApplianceEditorWgt::tr ("Vendor-URL"); break;
-                        case KVirtualSystemDescriptionType_Version: v = VBoxApplianceEditorWgt::tr ("Version"); break;
-                        case KVirtualSystemDescriptionType_Description: v = VBoxApplianceEditorWgt::tr ("Description"); break;
-                        case KVirtualSystemDescriptionType_License: v = VBoxApplianceEditorWgt::tr ("License"); break;
-                        case KVirtualSystemDescriptionType_OS: v = VBoxApplianceEditorWgt::tr ("Guest OS Type"); break;
-                        case KVirtualSystemDescriptionType_CPU: v = VBoxApplianceEditorWgt::tr ("CPU"); break;
-                        case KVirtualSystemDescriptionType_Memory: v = VBoxApplianceEditorWgt::tr ("RAM"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerIDE: v = VBoxApplianceEditorWgt::tr ("Hard Disk Controller (IDE)"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerSATA: v = VBoxApplianceEditorWgt::tr ("Hard Disk Controller (SATA)"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerSCSI: v = VBoxApplianceEditorWgt::tr ("Hard Disk Controller (SCSI)"); break;
-                        case KVirtualSystemDescriptionType_CDROM: v = VBoxApplianceEditorWgt::tr ("DVD"); break;
-                        case KVirtualSystemDescriptionType_Floppy: v = VBoxApplianceEditorWgt::tr ("Floppy"); break;
-                        case KVirtualSystemDescriptionType_NetworkAdapter: v = VBoxApplianceEditorWgt::tr ("Network Adapter"); break;
-                        case KVirtualSystemDescriptionType_USBController: v = VBoxApplianceEditorWgt::tr ("USB Controller"); break;
-                        case KVirtualSystemDescriptionType_SoundCard: v = VBoxApplianceEditorWgt::tr ("Sound Card"); break;
-                        case KVirtualSystemDescriptionType_HardDiskImage: v = VBoxApplianceEditorWgt::tr ("Virtual Disk Image"); break;
-                        default: v = VBoxApplianceEditorWgt::tr ("Unknown Hardware Item"); break;
-                    }
-                }
-                else if (aColumn == OriginalValueSection)
-                    v = mOrigValue;
-                else if (aColumn == ConfigValueSection)
-                {
-                    switch (mType)
-                    {
-                        case KVirtualSystemDescriptionType_Description:
-                        case KVirtualSystemDescriptionType_License:
-                            {
-                                /* Shorten the big text if there is more than
-                                 * one line */
-                                QString tmp (mConfigValue);
-                                int i = tmp.indexOf ('\n');
-                                if (i > -1)
-                                    tmp.replace (i, tmp.length(), "...");
-                                v = tmp; break;
-                            }
-                        case KVirtualSystemDescriptionType_OS: v = vboxGlobal().vmGuestOSTypeDescription (mConfigValue); break;
-                        case KVirtualSystemDescriptionType_Memory: v = mConfigValue + " " + VBoxApplianceEditorWgt::tr ("MB"); break;
-                        case KVirtualSystemDescriptionType_SoundCard: v = vboxGlobal().toString (static_cast<KAudioControllerType> (mConfigValue.toInt())); break;
-                        case KVirtualSystemDescriptionType_NetworkAdapter: v = vboxGlobal().toString (static_cast<KNetworkAdapterType> (mConfigValue.toInt())); break;
-                        default: v = mConfigValue; break;
-                    }
-                }
-                break;
-            }
-        case Qt::ToolTipRole:
-            {
-                if (aColumn == ConfigValueSection)
-                {
-                    if (!mOrigValue.isEmpty())
-                        v = VBoxApplianceEditorWgt::tr ("<b>Original Value:</b> %1").arg (mOrigValue);
-                }
-                break;
-            }
-        case Qt::DecorationRole:
-            {
-                if (aColumn == DescriptionSection)
-                {
-                    switch (mType)
-                    {
-                        case KVirtualSystemDescriptionType_Name: v = QIcon (":/name_16px.png"); break;
-                        case KVirtualSystemDescriptionType_Product:
-                        case KVirtualSystemDescriptionType_ProductUrl:
-                        case KVirtualSystemDescriptionType_Vendor:
-                        case KVirtualSystemDescriptionType_VendorUrl:
-                        case KVirtualSystemDescriptionType_Version:
-                        case KVirtualSystemDescriptionType_Description:
-                        case KVirtualSystemDescriptionType_License: v = QIcon (":/description_16px.png"); break;
-                        case KVirtualSystemDescriptionType_OS: v = QIcon (":/os_type_16px.png"); break;
-                        case KVirtualSystemDescriptionType_CPU: v = QIcon (":/cpu_16px.png"); break;
-                        case KVirtualSystemDescriptionType_Memory: v = QIcon (":/ram_16px.png"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerIDE: v = QIcon (":/ide_16px.png"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerSATA: v = QIcon (":/sata_16px.png"); break;
-                        case KVirtualSystemDescriptionType_HardDiskControllerSCSI: v = QIcon (":/scsi_16px.png"); break;
-                        case KVirtualSystemDescriptionType_HardDiskImage: v = QIcon (":/hd_16px.png"); break;
-                        case KVirtualSystemDescriptionType_CDROM: v = QIcon (":/cd_16px.png"); break;
-                        case KVirtualSystemDescriptionType_Floppy: v = QIcon (":/fd_16px.png"); break;
-                        case KVirtualSystemDescriptionType_NetworkAdapter: v = QIcon (":/nw_16px.png"); break;
-                        case KVirtualSystemDescriptionType_USBController: v = QIcon (":/usb_16px.png"); break;
-                        case KVirtualSystemDescriptionType_SoundCard: v = QIcon (":/sound_16px.png"); break;
-                        default: break;
-                    }
-                }
-                else if (aColumn == ConfigValueSection &&
-                         mType == KVirtualSystemDescriptionType_OS)
-                {
-                    v = vboxGlobal().vmGuestOSTypeIcon (mConfigValue).scaledToHeight (16, Qt::SmoothTransformation);
-                }
-                break;
-            }
-        case Qt::FontRole:
-            {
-                /* If the item is unchecked mark it with italic text. */
-                if (aColumn == ConfigValueSection &&
-                    mCheckState == Qt::Unchecked)
-                {
-                    QFont font = qApp->font();
-                    font.setItalic (true);
-                    v = font;
-                }
-                break;
-            }
-        case Qt::ForegroundRole:
-            {
-                /* If the item is unchecked mark it with gray text. */
-                if (aColumn == ConfigValueSection &&
-                    mCheckState == Qt::Unchecked)
-                {
-                    QPalette pal = qApp->palette();
-                    v = pal.brush (QPalette::Disabled, QPalette::WindowText);
-                }
-                break;
-            }
-        case Qt::CheckStateRole:
-            {
-                if (aColumn == ConfigValueSection &&
-                    (mType == KVirtualSystemDescriptionType_Floppy ||
-                     mType == KVirtualSystemDescriptionType_CDROM ||
-                     mType == KVirtualSystemDescriptionType_USBController ||
-                     mType == KVirtualSystemDescriptionType_SoundCard ||
-                     mType == KVirtualSystemDescriptionType_NetworkAdapter))
-                    v = mCheckState;
-                break;
-            }
-    }
-    return v;
-}
-
-Qt::ItemFlags HardwareItem::itemFlags (int aColumn) const
-{
-    Qt::ItemFlags flags = 0;
-    if (aColumn == ConfigValueSection)
-    {
-        /* Some items are checkable */
-        if (mType == KVirtualSystemDescriptionType_Floppy ||
-            mType == KVirtualSystemDescriptionType_CDROM ||
-            mType == KVirtualSystemDescriptionType_USBController ||
-            mType == KVirtualSystemDescriptionType_SoundCard ||
-            mType == KVirtualSystemDescriptionType_NetworkAdapter)
-            flags |= Qt::ItemIsUserCheckable;
-        /* Some items are editable */
-        if ((mType == KVirtualSystemDescriptionType_Name ||
-             mType == KVirtualSystemDescriptionType_Product ||
-             mType == KVirtualSystemDescriptionType_ProductUrl ||
-             mType == KVirtualSystemDescriptionType_Vendor ||
-             mType == KVirtualSystemDescriptionType_VendorUrl ||
-             mType == KVirtualSystemDescriptionType_Version ||
-             mType == KVirtualSystemDescriptionType_Description ||
-             mType == KVirtualSystemDescriptionType_License ||
-             mType == KVirtualSystemDescriptionType_OS ||
-             mType == KVirtualSystemDescriptionType_CPU ||
-             mType == KVirtualSystemDescriptionType_Memory ||
-             mType == KVirtualSystemDescriptionType_SoundCard ||
-             mType == KVirtualSystemDescriptionType_NetworkAdapter ||
-             mType == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
-             mType == KVirtualSystemDescriptionType_HardDiskImage) &&
-            mCheckState == Qt::Checked) /* Item has to be enabled */
-            flags |= Qt::ItemIsEditable;
-    }
-    return flags;
-}
-
-QWidget * HardwareItem::createEditor (QWidget *aParent, const QStyleOptionViewItem & /* aOption */, const QModelIndex &aIndex) const
-{
-    QWidget *editor = NULL;
-    if (aIndex.column() == ConfigValueSection)
-    {
-        switch (mType)
-        {
-            case KVirtualSystemDescriptionType_OS:
-                {
-                    VBoxOSTypeSelectorButton *e = new VBoxOSTypeSelectorButton (aParent);
-                    /* Fill the background with the highlight color in the case
-                     * the button hasn't a rectangle shape. This prevents the
-                     * display of parts from the current text on the Mac. */
-#ifdef QT_MAC_USE_COCOA
-                    /* Use the palette from the tree view, not the one from the
-                     * editor. */
-                    QPalette p = e->palette();
-                    p.setBrush (QPalette::Highlight, aParent->palette().brush (QPalette::Highlight));
-                    e->setPalette(p);
-#endif /* QT_MAC_USE_COCOA */
-                    e->setAutoFillBackground (true);
-                    e->setBackgroundRole (QPalette::Highlight);
-                    editor = e;
-                    break;
-                }
-            case KVirtualSystemDescriptionType_Name:
-            case KVirtualSystemDescriptionType_Product:
-            case KVirtualSystemDescriptionType_ProductUrl:
-            case KVirtualSystemDescriptionType_Vendor:
-            case KVirtualSystemDescriptionType_VendorUrl:
-            case KVirtualSystemDescriptionType_Version:
-                {
-                    QLineEdit *e = new QLineEdit (aParent);
-                    editor = e;
-                    break;
-                }
-            case KVirtualSystemDescriptionType_Description:
-            case KVirtualSystemDescriptionType_License:
-                {
-                    VBoxLineTextEdit *e = new VBoxLineTextEdit (aParent);
-                    editor = e;
-                    break;
-                }
-            case KVirtualSystemDescriptionType_CPU:
-                {
-                    QSpinBox *e = new QSpinBox (aParent);
-                    e->setRange (VBoxApplianceEditorWgt::minGuestCPUCount(), VBoxApplianceEditorWgt::maxGuestCPUCount());
-                    editor = e;
-                    break;
-                }
-            case KVirtualSystemDescriptionType_Memory:
-                {
-                    QSpinBox *e = new QSpinBox (aParent);
-                    e->setRange (VBoxApplianceEditorWgt::minGuestRAM(), VBoxApplianceEditorWgt::maxGuestRAM());
-                    e->setSuffix (" " + VBoxApplianceEditorWgt::tr ("MB"));
-                    editor = e;
-                    break;
-                }
-            case KVirtualSystemDescriptionType_SoundCard:
-                {
-                    QComboBox *e = new QComboBox (aParent);
-                    e->addItem (vboxGlobal().toString (KAudioControllerType_AC97), KAudioControllerType_AC97);
-                    e->addItem (vboxGlobal().toString (KAudioControllerType_SB16), KAudioControllerType_SB16);
-                    editor = e;
-                    break;
-                }
-            case KVirtualSystemDescriptionType_NetworkAdapter:
-                {
-                    QComboBox *e = new QComboBox (aParent);
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_Am79C970A), KNetworkAdapterType_Am79C970A);
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_Am79C973), KNetworkAdapterType_Am79C973);
-#ifdef VBOX_WITH_E1000
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_I82540EM), KNetworkAdapterType_I82540EM);
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_I82543GC), KNetworkAdapterType_I82543GC);
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_I82545EM), KNetworkAdapterType_I82545EM);
-#endif /* VBOX_WITH_E1000 */
-#ifdef VBOX_WITH_VIRTIO
-                    e->addItem (vboxGlobal().toString (KNetworkAdapterType_Virtio), KNetworkAdapterType_Virtio);
-#endif /* VBOX_WITH_VIRTIO */
-                    editor = e;
-                    break;
-                }
-            case KVirtualSystemDescriptionType_HardDiskControllerIDE:
-                {
-                    QComboBox *e = new QComboBox (aParent);
-                    e->addItem (vboxGlobal().toString (KStorageControllerType_PIIX3), "PIIX3");
-                    e->addItem (vboxGlobal().toString (KStorageControllerType_PIIX4), "PIIX4");
-                    e->addItem (vboxGlobal().toString (KStorageControllerType_ICH6),  "ICH6");
-                    editor = e;
-                    break;
-                }
-            case KVirtualSystemDescriptionType_HardDiskImage:
-                {
-                    /* disabled for now
-                       VBoxFilePathSelectorWidget *e = new VBoxFilePathSelectorWidget (aParent);
-                       e->setMode (VBoxFilePathSelectorWidget::Mode_File);
-                       e->setResetEnabled (false);
-                       */
-                    QLineEdit *e = new QLineEdit (aParent);
-                    editor = e;
-                    break;
-                }
-            default: break;
-        }
-    }
-    return editor;
-}
-
-bool HardwareItem::setEditorData (QWidget *aEditor, const QModelIndex & /* aIndex */) const
-{
-    bool fDone = false;
-    switch (mType)
-    {
-        case KVirtualSystemDescriptionType_OS:
-            {
-                if (VBoxOSTypeSelectorButton *e = qobject_cast<VBoxOSTypeSelectorButton*> (aEditor))
-                {
-                    e->setOSTypeId (mConfigValue);
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_HardDiskControllerIDE:
-            {
-                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
-                {
-                    int i = e->findData (mConfigValue);
-                    if (i != -1)
-                        e->setCurrentIndex (i);
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_CPU:
-        case KVirtualSystemDescriptionType_Memory:
-            {
-                if (QSpinBox *e = qobject_cast<QSpinBox*> (aEditor))
-                {
-                    e->setValue (mConfigValue.toInt());
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_Name:
-        case KVirtualSystemDescriptionType_Product:
-        case KVirtualSystemDescriptionType_ProductUrl:
-        case KVirtualSystemDescriptionType_Vendor:
-        case KVirtualSystemDescriptionType_VendorUrl:
-        case KVirtualSystemDescriptionType_Version:
-            {
-                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
-                {
-                    e->setText (mConfigValue);
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_Description:
-        case KVirtualSystemDescriptionType_License:
-            {
-                if (VBoxLineTextEdit *e = qobject_cast<VBoxLineTextEdit*> (aEditor))
-                {
-                    e->setText (mConfigValue);
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_SoundCard:
-        case KVirtualSystemDescriptionType_NetworkAdapter:
-            {
-                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
-                {
-                    int i = e->findData (mConfigValue.toInt());
-                    if (i != -1)
-                        e->setCurrentIndex (i);
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_HardDiskImage:
-            {
-                /* disabled for now
-                   if (VBoxFilePathSelectorWidget *e = qobject_cast<VBoxFilePathSelectorWidget*> (aEditor))
-                   {
-                   e->setPath (mConfigValue);
-                   }
-                   */
-                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
-                {
-                    e->setText (mConfigValue);
-                    fDone = true;
-                }
-                break;
-            }
-        default: break;
-    }
-    return fDone;
-}
-
-bool HardwareItem::setModelData (QWidget *aEditor, QAbstractItemModel * /* aModel */, const QModelIndex & /* aIndex */)
-{
-    bool fDone = false;
-    switch (mType)
-    {
-        case KVirtualSystemDescriptionType_OS:
-            {
-                if (VBoxOSTypeSelectorButton *e = qobject_cast<VBoxOSTypeSelectorButton*> (aEditor))
-                {
-                    mConfigValue = e->osTypeId();
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_HardDiskControllerIDE:
-            {
-                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
-                {
-                    mConfigValue = e->itemData (e->currentIndex()).toString();
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_CPU:
-        case KVirtualSystemDescriptionType_Memory:
-            {
-                if (QSpinBox *e = qobject_cast<QSpinBox*> (aEditor))
-                {
-                    mConfigValue = QString::number (e->value());
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_Name:
-        case KVirtualSystemDescriptionType_Product:
-        case KVirtualSystemDescriptionType_ProductUrl:
-        case KVirtualSystemDescriptionType_Vendor:
-        case KVirtualSystemDescriptionType_VendorUrl:
-        case KVirtualSystemDescriptionType_Version:
-            {
-                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
-                {
-                    mConfigValue = e->text();
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_Description:
-        case KVirtualSystemDescriptionType_License:
-            {
-                if (VBoxLineTextEdit *e = qobject_cast<VBoxLineTextEdit*> (aEditor))
-                {
-                    mConfigValue = e->text();
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_SoundCard:
-        case KVirtualSystemDescriptionType_NetworkAdapter:
-            {
-                if (QComboBox *e = qobject_cast<QComboBox*> (aEditor))
-                {
-                    mConfigValue = e->itemData (e->currentIndex()).toString();
-                    fDone = true;
-                }
-                break;
-            }
-        case KVirtualSystemDescriptionType_HardDiskImage:
-            {
-                /* disabled for now
-                   if (VBoxFilePathSelectorWidget *e = qobject_cast<VBoxFilePathSelectorWidget*> (aEditor))
-                   {
-                   mConfigValue = e->path();
-                   }
-                   */
-                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
-                {
-                    mConfigValue = e->text();
-                    fDone = true;
-                }
-                break;
-            }
-        default: break;
-    }
-    return fDone;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VirtualSystemModel
-
-/* This class is a wrapper model for our ModelItem. It could be used with any
-   TreeView & forward mostly all calls to the methods of ModelItem. The
-   ModelItems itself are stored as internal pointers in the QModelIndex class. */
-VirtualSystemModel::VirtualSystemModel (QVector<CVirtualSystemDescription>& aVSDs, QObject *aParent /* = NULL */)
-   : QAbstractItemModel (aParent)
-{
-    mRootItem = new ModelItem (0, RootType);
-    for (int a = 0; a < aVSDs.size(); ++a)
-    {
-        CVirtualSystemDescription vs = aVSDs[a];
-
-        VirtualSystemItem *vi = new VirtualSystemItem (a, vs, mRootItem);
-        mRootItem->appendChild (vi);
-
-        /* @todo: ask Dmitry about include/COMDefs.h:232 */
-        QVector<KVirtualSystemDescriptionType> types;
-        QVector<QString> refs;
-        QVector<QString> origValues;
-        QVector<QString> configValues;
-        QVector<QString> extraConfigValues;
-
-        QList<int> hdIndizies;
-        QMap<int, HardwareItem*> controllerMap;
-        vs.GetDescription (types, refs, origValues, configValues, extraConfigValues);
-        for (int i = 0; i < types.size(); ++i)
-        {
-            /* We add the hard disk images in an second step, so save a
-               reference to them. */
-            if (types[i] == KVirtualSystemDescriptionType_HardDiskImage)
-                hdIndizies << i;
-            else
-            {
-                HardwareItem *hi = new HardwareItem (i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], vi);
-                vi->appendChild (hi);
-                /* Save the hard disk controller types in an extra map */
-                if (types[i] == KVirtualSystemDescriptionType_HardDiskControllerIDE ||
-                    types[i] == KVirtualSystemDescriptionType_HardDiskControllerSATA ||
-                    types[i] == KVirtualSystemDescriptionType_HardDiskControllerSCSI)
-                    controllerMap[i] = hi;
-            }
-        }
-        QRegExp rx ("controller=(\\d+);?");
-        /* Now process the hard disk images */
-        for (int a = 0; a < hdIndizies.size(); ++a)
-        {
-            int i = hdIndizies[a];
-            QString ecnf = extraConfigValues[i];
-            if (rx.indexIn (ecnf) != -1)
-            {
-                /* Get the controller */
-                HardwareItem *ci = controllerMap[rx.cap (1).toInt()];
-                if (ci)
-                {
-                    /* New hardware item as child of the controller */
-                    HardwareItem *hi = new HardwareItem (i, types[i], refs[i], origValues[i], configValues[i], extraConfigValues[i], ci);
-                    ci->appendChild (hi);
-                }
-            }
-        }
-    }
-}
-
-QModelIndex VirtualSystemModel::index (int aRow, int aColumn, const QModelIndex &aParent /* = QModelIndex() */) const
-{
-    if (!hasIndex (aRow, aColumn, aParent))
-        return QModelIndex();
-
-    ModelItem *parentItem;
-
-    if (!aParent.isValid())
-        parentItem = mRootItem;
-    else
-        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
-
-    ModelItem *childItem = parentItem->child (aRow);
-    if (childItem)
-        return createIndex (aRow, aColumn, childItem);
-    else
-        return QModelIndex();
-}
-
-QModelIndex VirtualSystemModel::parent (const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return QModelIndex();
-
-    ModelItem *childItem = static_cast<ModelItem*> (aIndex.internalPointer());
-    ModelItem *parentItem = childItem->parent();
-
-    if (parentItem == mRootItem)
-        return QModelIndex();
-
-    return createIndex (parentItem->row(), 0, parentItem);
-}
-
-int VirtualSystemModel::rowCount (const QModelIndex &aParent /* = QModelIndex() */) const
-{
-    ModelItem *parentItem;
-    if (aParent.column() > 0)
-        return 0;
-
-    if (!aParent.isValid())
-        parentItem = mRootItem;
-    else
-        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
-
-    return parentItem->childCount();
-}
-
-int VirtualSystemModel::columnCount (const QModelIndex &aParent /* = QModelIndex() */) const
-{
-    if (aParent.isValid())
-        return static_cast<ModelItem*> (aParent.internalPointer())->columnCount();
-    else
-        return mRootItem->columnCount();
-}
-
-bool VirtualSystemModel::setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole)
-{
-    if (!aIndex.isValid())
-        return false;
-
-    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
-
-    return item->setData (aIndex.column(), aValue, aRole);
-}
-
-QVariant VirtualSystemModel::data (const QModelIndex &aIndex, int aRole /* = Qt::DisplayRole */) const
-{
-    if (!aIndex.isValid())
-        return QVariant();
-
-    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
-
-    return item->data (aIndex.column(), aRole);
-}
-
-Qt::ItemFlags VirtualSystemModel::flags (const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return 0;
-
-    ModelItem *item = static_cast<ModelItem*> (aIndex.internalPointer());
-
-    return Qt::ItemIsEnabled | Qt::ItemIsSelectable | item->itemFlags (aIndex.column());
-}
-
-QVariant VirtualSystemModel::headerData (int aSection, Qt::Orientation aOrientation, int aRole) const
-{
-    if (aRole != Qt::DisplayRole ||
-        aOrientation != Qt::Horizontal)
-        return QVariant();
-
-    QString title;
-    switch (aSection)
-    {
-        case DescriptionSection: title = VBoxApplianceEditorWgt::tr ("Description"); break;
-        case ConfigValueSection: title = VBoxApplianceEditorWgt::tr ("Configuration"); break;
-    }
-    return title;
-}
-
-QModelIndex VirtualSystemModel::buddy (const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return QModelIndex();
-
-    if (aIndex.column() == ConfigValueSection)
-        return aIndex;
-    else
-        return index (aIndex.row(), ConfigValueSection, aIndex.parent());
-}
-
-void VirtualSystemModel::restoreDefaults (const QModelIndex& aParent /* = QModelIndex() */)
-{
-    ModelItem *parentItem;
-
-    if (!aParent.isValid())
-        parentItem = mRootItem;
-    else
-        parentItem = static_cast<ModelItem*> (aParent.internalPointer());
-
-    for (int i = 0; i < parentItem->childCount(); ++i)
-    {
-        parentItem->child (i)->restoreDefaults();
-        restoreDefaults (index (i, 0, aParent));
-    }
-    emit dataChanged (index (0, 0, aParent), index (parentItem->childCount()-1, 0, aParent));
-}
-
-void VirtualSystemModel::putBack()
-{
-    QVector<BOOL> v1;
-    QVector<QString> v2;
-    QVector<QString> v3;
-    mRootItem->putBack (v1, v2, v3);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VirtualSystemDelegate
-
-/* The delegate is used for creating/handling the different editors for the
-   various types we support. This class forward the requests to the virtual
-   methods of our different ModelItems. If this is not possible the default
-   methods of QItemDelegate are used to get some standard behavior. Note: We
-   have to handle the proxy model ourself. I really don't understand why Qt is
-   not doing this for us. */
-VirtualSystemDelegate::VirtualSystemDelegate (QAbstractProxyModel *aProxy, QObject *aParent /* = NULL */)
-  : QItemDelegate (aParent)
-  , mProxy (aProxy)
-{}
-
-QWidget * VirtualSystemDelegate::createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return QItemDelegate::createEditor (aParent, aOption, aIndex);
-
-    QModelIndex index (aIndex);
-    if (mProxy)
-        index = mProxy->mapToSource (aIndex);
-
-    ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
-    QWidget *editor = item->createEditor (aParent, aOption, index);
-
-    if (editor == NULL)
-        return QItemDelegate::createEditor (aParent, aOption, index);
-    else
-        return editor;
-}
-
-void VirtualSystemDelegate::setEditorData (QWidget *aEditor, const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return QItemDelegate::setEditorData (aEditor, aIndex);
-
-    QModelIndex index (aIndex);
-    if (mProxy)
-        index = mProxy->mapToSource (aIndex);
-
-    ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
-
-    if (!item->setEditorData (aEditor, index))
-        QItemDelegate::setEditorData (aEditor, index);
-}
-
-void VirtualSystemDelegate::setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return QItemDelegate::setModelData (aEditor, aModel, aIndex);
-
-    QModelIndex index = aModel->index (aIndex.row(), aIndex.column());
-    if (mProxy)
-        index = mProxy->mapToSource (aIndex);
-
-    ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
-    if (!item->setModelData (aEditor, aModel, index))
-        QItemDelegate::setModelData (aEditor, aModel, aIndex);
-}
-
-void VirtualSystemDelegate::updateEditorGeometry (QWidget *aEditor, const QStyleOptionViewItem &aOption, const QModelIndex & /* aIndex */) const
-{
-    if (aEditor)
-        aEditor->setGeometry (aOption.rect);
-}
-
-#ifdef QT_MAC_USE_COCOA
-bool VirtualSystemDelegate::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    if (aEvent->type() == QEvent::FocusOut)
-    {
-        /* On Mac OS X Cocoa the OS type selector widget loses it focus when
-         * the popup menu is shown. Prevent this here, cause otherwise the new
-         * selected OS will not be updated. */
-        VBoxOSTypeSelectorButton *button = qobject_cast<VBoxOSTypeSelectorButton*> (aObject);
-        if (button && button->isMenuShown())
-            return false;
-        /* The same counts for the text edit buttons of the license or
-         * description fields. */
-        else if (qobject_cast<VBoxLineTextEdit*> (aObject))
-            return false;
-    }
-
-    return QItemDelegate::eventFilter (aObject, aEvent);
-}
-#endif /* QT_MAC_USE_COCOA */
-
-////////////////////////////////////////////////////////////////////////////////
-// VirtualSystemSortProxyModel
-
-/* How to sort the items in the tree view */
-KVirtualSystemDescriptionType VirtualSystemSortProxyModel::mSortList[] =
-{
-    KVirtualSystemDescriptionType_Name,
-    KVirtualSystemDescriptionType_Product,
-    KVirtualSystemDescriptionType_ProductUrl,
-    KVirtualSystemDescriptionType_Vendor,
-    KVirtualSystemDescriptionType_VendorUrl,
-    KVirtualSystemDescriptionType_Version,
-    KVirtualSystemDescriptionType_Description,
-    KVirtualSystemDescriptionType_License,
-    KVirtualSystemDescriptionType_OS,
-    KVirtualSystemDescriptionType_CPU,
-    KVirtualSystemDescriptionType_Memory,
-    KVirtualSystemDescriptionType_Floppy,
-    KVirtualSystemDescriptionType_CDROM,
-    KVirtualSystemDescriptionType_USBController,
-    KVirtualSystemDescriptionType_SoundCard,
-    KVirtualSystemDescriptionType_NetworkAdapter,
-    KVirtualSystemDescriptionType_HardDiskControllerIDE,
-    KVirtualSystemDescriptionType_HardDiskControllerSATA,
-    KVirtualSystemDescriptionType_HardDiskControllerSCSI
-};
-
-VirtualSystemSortProxyModel::VirtualSystemSortProxyModel (QObject *aParent)
-    : QSortFilterProxyModel (aParent)
-{}
-
-bool VirtualSystemSortProxyModel::filterAcceptsRow (int aSourceRow, const QModelIndex & aSourceParent) const
-{
-    /* By default enable all, we will explicitly filter out below */
-    if (aSourceParent.isValid())
-    {
-        QModelIndex i = aSourceParent.child (aSourceRow, 0);
-        if (i.isValid())
-        {
-            ModelItem *item = static_cast<ModelItem*> (i.internalPointer());
-            /* We filter hardware types only */
-            if (item->type() == HardwareType)
-            {
-                HardwareItem *hwItem = static_cast<HardwareItem*> (item);
-                /* The license type shouldn't be displayed */
-                if (mFilterList.contains (hwItem->mType))
-                    return false;
-            }
-        }
-    }
-    return true;
-}
-
-bool VirtualSystemSortProxyModel::lessThan (const QModelIndex &aLeft, const QModelIndex &aRight) const
-{
-    if (!aLeft.isValid() ||
-        !aRight.isValid())
-        return false;
-
-    ModelItem *leftItem = static_cast<ModelItem*> (aLeft.internalPointer());
-    ModelItem *rightItem = static_cast<ModelItem*> (aRight.internalPointer());
-
-    /* We sort hardware types only */
-    if (!(leftItem->type() == HardwareType &&
-          rightItem->type() == HardwareType))
-        return false;
-
-    HardwareItem *hwLeft = static_cast<HardwareItem*> (leftItem);
-    HardwareItem *hwRight = static_cast<HardwareItem*> (rightItem);
-
-    for (unsigned int i = 0; i < RT_ELEMENTS (mSortList); ++i)
-        if (hwLeft->mType == mSortList[i])
-        {
-            for (unsigned int a = 0; a <= i; ++a)
-                if (hwRight->mType == mSortList[a])
-                    return true;
-            return false;
-        }
-
-    return true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxApplianceEditorWgt
-
-int VBoxApplianceEditorWgt::mMinGuestRAM = -1;
-int VBoxApplianceEditorWgt::mMaxGuestRAM = -1;
-int VBoxApplianceEditorWgt::mMinGuestCPUCount = -1;
-int VBoxApplianceEditorWgt::mMaxGuestCPUCount = -1;
-
-VBoxApplianceEditorWgt::VBoxApplianceEditorWgt (QWidget *aParent /* = NULL */)
-    : QIWithRetranslateUI<QWidget> (aParent)
-    , mAppliance (NULL)
-    , mModel (NULL)
-{
-    /* Make sure all static content is properly initialized */
-    initSystemSettings();
-
-    /* Apply UI decorations */
-    Ui::VBoxApplianceEditorWgt::setupUi (this);
-
-    /* Make the tree looking nicer */
-    mTvSettings->setRootIsDecorated (false);
-    mTvSettings->setAlternatingRowColors (true);
-    mTvSettings->setAllColumnsShowFocus (true);
-    mTvSettings->header()->setStretchLastSection (true);
-    mTvSettings->header()->setResizeMode (QHeaderView::ResizeToContents);
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxApplianceEditorWgt::restoreDefaults()
-{
-    mModel->restoreDefaults();
-}
-
-void VBoxApplianceEditorWgt::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxApplianceEditorWgt::retranslateUi (this);
-}
-
-/* static */
-void VBoxApplianceEditorWgt::initSystemSettings()
-{
-    if (mMinGuestRAM == -1)
-    {
-        /* We need some global defaults from the current VirtualBox
-           installation */
-        CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties();
-        mMinGuestRAM = sp.GetMinGuestRAM();
-        mMaxGuestRAM = sp.GetMaxGuestRAM();
-        mMinGuestCPUCount = sp.GetMinGuestCPUCount();
-        mMaxGuestCPUCount = sp.GetMaxGuestCPUCount();
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxBootTable.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxBootTable.cpp	(revision 25170)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxBootTable class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global include */
-#include <QHeaderView>
-#include <QKeyEvent>
-
-/* Local includes */
-#include "VBoxBootTable.h"
-#include "VBoxGlobal.h"
-
-VBoxBootTable::VBoxBootTable(QWidget *pParent)
-    : QTreeWidget(pParent)
-{
-    header()->hide();
-    connect(this, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(onItemChanged()));
-}
-
-void VBoxBootTable::onItemChanged()
-{
-    emit itemToggled();
-}
-
-void VBoxBootTable::keyPressEvent(QKeyEvent *pEvent)
-{
-    if (pEvent->QInputEvent::modifiers() == Qt::ControlModifier)
-    {
-        switch (pEvent->key())
-        {
-            case Qt::Key_Up:
-                emit moveItemUp();
-                return;
-            case Qt::Key_Down:
-                emit moveItemDown();
-                return;
-            default:
-                break;
-        }
-    }
-    QTreeWidget::keyPressEvent(pEvent);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxCloseVMDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxCloseVMDlg.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxCloseVMDlg.h	(revision 25171)
@@ -0,0 +1,45 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxCloseVMDlg class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxCloseVMDlg_h__
+#define __VBoxCloseVMDlg_h__
+
+#include "VBoxCloseVMDlg.gen.h"
+#include "QIWithRetranslateUI.h"
+#include "QIDialog.h"
+
+class VBoxCloseVMDlg : public QIWithRetranslateUI<QIDialog>,
+                       public Ui::VBoxCloseVMDlg
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxCloseVMDlg (QWidget *aParent);
+
+protected:
+
+    void retranslateUi();
+};
+
+#endif // __VBoxCloseVMDlg_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxCloseVMDlg.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxCloseVMDlg.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxCloseVMDlg.ui	(revision 25171)
@@ -0,0 +1,291 @@
+<ui version="4.0" >
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxCloseVMDlg</class>
+ <widget class="QDialog" name="VBoxCloseVMDlg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>323</width>
+    <height>192</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Close Virtual Machine</string>
+  </property>
+  <property name="sizeGripEnabled" >
+   <bool>false</bool>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="spacing" >
+    <number>10</number>
+   </property>
+   <item>
+    <layout class="QHBoxLayout" >
+     <item>
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QLabel" name="pmIcon" >
+         <property name="sizePolicy" >
+          <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="pixmap" >
+          <pixmap resource="../VirtualBox2.qrc" >:/os_unknown.png</pixmap>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType" >
+          <enum>QSizePolicy::Expanding</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QLabel" name="label" >
+         <property name="text" >
+          <string>You want to:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QGridLayout" >
+         <item row="0" column="0" >
+          <widget class="QLabel" name="mTxSave_2" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="pixmap" >
+            <pixmap resource="../VirtualBox1.qrc" >:/state_saved_16px.png</pixmap>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1" >
+          <widget class="QRadioButton" name="mRbSave" >
+           <property name="whatsThis" >
+            <string>&lt;p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.&lt;/p>&lt;p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.&lt;/p>&lt;p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to the virtual machine.&lt;/p></string>
+           </property>
+           <property name="text" >
+            <string>&amp;Save the machine state</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0" >
+          <widget class="QLabel" name="mTxShutDown_2" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="pixmap" >
+            <pixmap resource="../VirtualBox1.qrc" >:/acpi_16px.png</pixmap>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1" >
+          <widget class="QRadioButton" name="mRbShutdown" >
+           <property name="whatsThis" >
+            <string>&lt;p>Sends the ACPI Power Button press event to the virtual machine.&lt;/p>&lt;p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.&lt;/p>&lt;p>If the machine doesn't respond to this action then the guest operating system may be misconfigured or doesn't understand ACPI Power Button events at all. In this case you should select the &lt;b>Power off the machine&lt;/b> action to stop virtual machine execution.&lt;/p></string>
+           </property>
+           <property name="text" >
+            <string>S&amp;end the shutdown signal</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0" >
+          <widget class="QLabel" name="mTxPowerOff_2" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text" >
+            <string/>
+           </property>
+           <property name="pixmap" >
+            <pixmap resource="../VirtualBox1.qrc" >:/poweroff_16px.png</pixmap>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1" >
+          <widget class="QRadioButton" name="mRbPowerOff" >
+           <property name="whatsThis" >
+            <string>&lt;p>Turns off the virtual machine.&lt;/p>&lt;p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in &lt;i>data loss&lt;/i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the &lt;b>Send the shutdown signal&lt;/b> action.&lt;/p></string>
+           </property>
+           <property name="text" >
+            <string>&amp;Power off the machine</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" >
+         <property name="spacing" >
+          <number>0</number>
+         </property>
+         <property name="leftMargin" >
+          <number>0</number>
+         </property>
+         <property name="topMargin" >
+          <number>0</number>
+         </property>
+         <property name="rightMargin" >
+          <number>0</number>
+         </property>
+         <property name="bottomMargin" >
+          <number>0</number>
+         </property>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType" >
+            <enum>QSizePolicy::Fixed</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>38</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="mCbDiscardCurState" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+           <property name="toolTip" >
+            <string>Restore the machine state stored in the current snapshot</string>
+           </property>
+           <property name="whatsThis" >
+            <string>&lt;p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.&lt;/p></string>
+           </property>
+           <property name="text" >
+            <string>&amp;Restore current snapshot '%1'</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QIDialogButtonBox" name="mButtonBox" >
+     <property name="standardButtons" >
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <customwidgets>
+  <customwidget>
+   <class>QIDialogButtonBox</class>
+   <extends>QDialogButtonBox</extends>
+   <header>QIDialogButtonBox.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources>
+  <include location="../VirtualBox1.qrc" />
+  <include location="../VirtualBox2.qrc" />
+ </resources>
+ <connections>
+  <connection>
+   <sender>mRbPowerOff</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>mCbDiscardCurState</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>VBoxCloseVMDlg</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>161</x>
+     <y>171</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>161</x>
+     <y>95</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>VBoxCloseVMDlg</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>161</x>
+     <y>171</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>161</x>
+     <y>95</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.h	(revision 25171)
@@ -0,0 +1,374 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxConsoleView class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___VBoxConsoleView_h___
+#define ___VBoxConsoleView_h___
+
+#include "COMDefs.h"
+
+#include "VBoxDefs.h"
+#include "VBoxGlobalSettings.h"
+
+/* Qt includes */
+#include <QAbstractScrollArea>
+#include <QScrollBar>
+
+#if defined (Q_WS_PM)
+#include "src/os2/VBoxHlp.h"
+#define UM_PREACCEL_CHAR WM_USER
+#endif
+
+#if defined (Q_WS_MAC)
+# include <ApplicationServices/ApplicationServices.h>
+# ifndef QT_MAC_USE_COCOA
+#  include <Carbon/Carbon.h>
+# endif /* !QT_MAC_USE_COCOA */
+#endif
+
+class VBoxConsoleWnd;
+class MousePointerChangeEvent;
+class VBoxFrameBuffer;
+class VBoxDockIconPreview;
+
+class QPainter;
+class QLabel;
+class QMenuData;
+
+class VBoxConsoleView : public QAbstractScrollArea
+{
+    Q_OBJECT
+
+public:
+
+    enum {
+        MouseCaptured = 0x01,
+        MouseAbsolute = 0x02,
+        MouseAbsoluteDisabled = 0x04,
+        MouseNeedsHostCursor = 0x08,
+        KeyboardCaptured = 0x01,
+        HostKeyPressed = 0x02,
+    };
+
+    VBoxConsoleView (VBoxConsoleWnd *mainWnd,
+                     const CConsole &console,
+                     VBoxDefs::RenderMode rm,
+#ifdef VBOX_WITH_VIDEOHWACCEL
+                     bool accelerate2DVideo,
+#endif
+                     QWidget *parent = 0);
+    ~VBoxConsoleView();
+
+    QSize sizeHint() const;
+
+    void attach();
+    void detach();
+    void refresh() { doRefresh(); }
+    void normalizeGeometry (bool adjustPosition = false);
+
+    CConsole &console() { return mConsole; }
+
+    bool pause (bool on);
+    bool isPaused()
+    {
+        return mLastState == KMachineState_Paused
+            || mLastState == KMachineState_TeleportingPausedVM;
+    }
+    const QPixmap& pauseShot() const { return mPausedShot; }
+
+    void setMouseIntegrationEnabled (bool enabled);
+
+    bool isMouseAbsolute() const { return mMouseAbsolute; }
+
+    bool shouldHideHostPointer() const
+    { return mMouseCaptured || (mMouseAbsolute && mHideHostPointer); }
+
+    void setAutoresizeGuest (bool on);
+
+    void onFullscreenChange (bool on);
+
+    void onViewOpened();
+
+    void fixModifierState (LONG *codes, uint *count);
+
+    void toggleFSMode (const QSize &aSize = QSize());
+
+    void setIgnoreMainwndResize (bool aYes) { mIgnoreMainwndResize = aYes; }
+    void setIgnoreGuestResize (bool aYes) { mIgnoreGuestResize = aYes; }
+
+    QRect desktopGeometry();
+
+    QRegion lastVisibleRegion() const;
+
+    bool isAutoresizeGuestActive();
+
+    /* todo: This are some support functions for the qt4 port. Maybe we get rid
+     * of them some day. */
+    int contentsX() const { return horizontalScrollBar()->value(); }
+    int contentsY() const { return verticalScrollBar()->value(); }
+    int contentsWidth() const;
+    int contentsHeight() const;
+    int visibleWidth() const { return horizontalScrollBar()->pageStep(); }
+    int visibleHeight() const { return verticalScrollBar()->pageStep(); }
+    void scrollBy (int dx, int dy)
+    {
+        horizontalScrollBar()->setValue (horizontalScrollBar()->value() + dx);
+        verticalScrollBar()->setValue (verticalScrollBar()->value() + dy);
+    }
+    QPoint viewportToContents ( const QPoint & vp ) const
+    {
+        return QPoint (vp.x() + contentsX(),
+                       vp.y() + contentsY());
+    }
+    void updateSliders();
+
+    void requestToResize (const QSize &aSize);
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    void scrollContentsBy (int dx, int dy);
+#endif
+
+#if defined(Q_WS_MAC)
+    void updateDockIcon();
+    void updateDockOverlay();
+    void setDockIconEnabled (bool aOn) { mDockIconEnabled = aOn; };
+    void setMouseCoalescingEnabled (bool aOn);
+#endif
+
+signals:
+
+    void keyboardStateChanged (int state);
+    void mouseStateChanged (int state);
+    void machineStateChanged (KMachineState state);
+    void additionsStateChanged (const QString &, bool, bool, bool);
+    void mediaDriveChanged (VBoxDefs::MediumType aType);
+    void networkStateChange();
+    void usbStateChange();
+    void sharedFoldersChanged();
+    void resizeHintDone();
+
+protected:
+
+    // events
+    bool event (QEvent *e);
+    bool eventFilter (QObject *watched, QEvent *e);
+
+#if defined(Q_WS_WIN32)
+    bool winLowKeyboardEvent (UINT msg, const KBDLLHOOKSTRUCT &event);
+    bool winEvent (MSG *aMsg, long *aResult);
+#elif defined(Q_WS_PM)
+    bool pmEvent (QMSG *aMsg);
+#elif defined(Q_WS_X11)
+    bool x11Event (XEvent *event);
+#elif defined(Q_WS_MAC)
+    bool darwinKeyboardEvent (const void *pvCocoaEvent, EventRef inEvent);
+    void darwinGrabKeyboardEvents (bool fGrab);
+#endif
+
+private:
+
+    /** Flags for keyEvent(). */
+    enum {
+        KeyExtended = 0x01,
+        KeyPressed = 0x02,
+        KeyPause = 0x04,
+        KeyPrint = 0x08,
+    };
+
+    void focusEvent (bool aHasFocus, bool aReleaseHostKey = true);
+    bool keyEvent (int aKey, uint8_t aScan, int aFlags,
+                   wchar_t *aUniKey = NULL);
+    bool mouseEvent (int aType, const QPoint &aPos, const QPoint &aGlobalPos,
+                     Qt::MouseButtons aButtons, Qt::KeyboardModifiers aModifiers,
+                     int aWheelDelta, Qt::Orientation aWheelDir);
+
+    void emitKeyboardStateChanged()
+    {
+        emit keyboardStateChanged (
+            (mKbdCaptured ? KeyboardCaptured : 0) |
+            (mIsHostkeyPressed ? HostKeyPressed : 0));
+    }
+
+    void emitMouseStateChanged() {
+        emit mouseStateChanged ((mMouseCaptured ? MouseCaptured : 0) |
+                                (mMouseAbsolute ? MouseAbsolute : 0) |
+                                (!mMouseIntegration ? MouseAbsoluteDisabled : 0));
+    }
+
+    // IConsoleCallback event handlers
+    void onStateChange (KMachineState state);
+
+    void doRefresh();
+
+    void resizeEvent (QResizeEvent *);
+    void moveEvent (QMoveEvent *);
+    void paintEvent (QPaintEvent *);
+
+    void captureKbd (bool aCapture, bool aEmitSignal = true);
+    void captureMouse (bool aCapture, bool aEmitSignal = true);
+
+    bool processHotKey (const QKeySequence &key, const QList<QAction*>& data);
+    void updateModifiers (bool fNumLock, bool fCapsLock, bool fScrollLock);
+
+    void releaseAllPressedKeys (bool aReleaseHostKey = true);
+    void saveKeyStates();
+    void sendChangedKeyStates();
+    void updateMouseClipping();
+
+    void setPointerShape (MousePointerChangeEvent *me);
+
+    bool isRunning()
+    {
+        return mLastState == KMachineState_Running
+            || mLastState == KMachineState_Teleporting
+            || mLastState == KMachineState_LiveSnapshotting;
+    }
+
+    static void dimImage (QImage &img);
+
+private slots:
+
+    void doResizeHint (const QSize &aSize = QSize());
+    void doResizeDesktop (int);
+
+private:
+
+    enum DesktopGeo
+    {
+        DesktopGeo_Invalid = 0, DesktopGeo_Fixed,
+        DesktopGeo_Automatic, DesktopGeo_Any
+    };
+
+    void setDesktopGeometry (DesktopGeo aGeo, int aWidth, int aHeight);
+    void storeConsoleSize (int aWidth, int aHeight);
+    void calculateDesktopGeometry();
+    void maybeRestrictMinimumSize();
+
+    VBoxConsoleWnd *mMainWnd;
+
+    CConsole mConsole;
+
+    const VBoxGlobalSettings &gs;
+
+    KMachineState mLastState;
+
+    bool mAttached : 1;
+    bool mKbdCaptured : 1;
+    bool mMouseCaptured : 1;
+    bool mMouseAbsolute : 1;
+    bool mMouseIntegration : 1;
+    QPoint mLastPos;
+    QPoint mCapturedPos;
+
+    bool mDisableAutoCapture : 1;
+
+    enum { IsKeyPressed = 0x01, IsExtKeyPressed = 0x02, IsKbdCaptured = 0x80 };
+    uint8_t mPressedKeys [128];
+    uint8_t mPressedKeysCopy [128];
+
+    bool mIsHostkeyPressed : 1;
+    bool mIsHostkeyAlone : 1;
+
+    /** mKbdCaptured value during the the last host key press or release */
+    bool hostkey_in_capture : 1;
+
+    bool mIgnoreMainwndResize : 1;
+    bool mAutoresizeGuest : 1;
+    bool mIgnoreFrameBufferResize : 1;
+    bool mIgnoreGuestResize : 1;
+
+    /**
+     * This flag indicates whether the last console resize should trigger
+     * a size hint to the guest.  This is important particularly when
+     * enabling the autoresize feature to know whether to send a hint.
+     */
+    bool mDoResize : 1;
+
+    bool mGuestSupportsGraphics : 1;
+
+    bool mNumLock : 1;
+    bool mScrollLock : 1;
+    bool mCapsLock : 1;
+    long muNumLockAdaptionCnt;
+    long muCapsLockAdaptionCnt;
+
+
+    VBoxDefs::RenderMode mode;
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    bool mAccelerate2DVideo;
+#endif
+
+    QRegion mLastVisibleRegion;
+    QSize mNormalSize;
+
+#if defined(Q_WS_WIN)
+    HCURSOR mAlphaCursor;
+#endif
+
+#if defined(Q_WS_MAC)
+# if !defined (VBOX_WITH_HACKED_QT) && !defined (QT_MAC_USE_COCOA)
+    /** Event handler reference. NULL if the handler isn't installed. */
+    EventHandlerRef mDarwinEventHandlerRef;
+# endif
+    /** The current modifier key mask. Used to figure out which modifier
+     *  key was pressed when we get a kEventRawKeyModifiersChanged event. */
+    UInt32 mDarwinKeyModifiers;
+    bool mKeyboardGrabbed;
+#endif
+
+    VBoxFrameBuffer *mFrameBuf;
+    CConsoleCallback mCallback;
+
+    friend class VBoxConsoleCallback;
+
+#if defined (Q_WS_WIN32)
+    static LRESULT CALLBACK lowLevelKeyboardProc (int nCode,
+                                                  WPARAM wParam, LPARAM lParam);
+#elif defined (Q_WS_MAC)
+# if defined (QT_MAC_USE_COCOA)
+    static bool darwinEventHandlerProc (const void *pvCocoaEvent, const
+                                        void *pvCarbonEvent, void *pvUser);
+# elif !defined (VBOX_WITH_HACKED_QT)
+    static pascal OSStatus darwinEventHandlerProc (EventHandlerCallRef inHandlerCallRef,
+                                                   EventRef inEvent, void *inUserData);
+# else  /* VBOX_WITH_HACKED_QT */
+    static bool macEventFilter (EventRef inEvent, void *inUserData);
+# endif /* VBOX_WITH_HACKED_QT */
+#endif
+
+    QPixmap mPausedShot;
+#if defined(Q_WS_MAC)
+# if !defined (QT_MAC_USE_COCOA)
+    EventHandlerRef mDarwinWindowOverlayHandlerRef;
+# endif
+    VBoxDockIconPreview *mDockIconPreview;
+    bool mDockIconEnabled;
+#endif
+    DesktopGeo mDesktopGeo;
+    QRect mDesktopGeometry;
+    QRect mStoredConsoleSize;
+    bool mPassCAD;
+    bool mHideHostPointer;
+    QCursor mLastCursor;
+};
+
+#endif // !___VBoxConsoleView_h___
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.h	(revision 25171)
@@ -0,0 +1,434 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxConsoleWnd class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxConsoleWnd_h__
+#define __VBoxConsoleWnd_h__
+
+/* Global includes */
+#include <QColor>
+#include <QDialog>
+#include <QMainWindow>
+#include <QMap>
+#include <QMenu>
+#include <QPointer>
+
+/* Local includes */
+#include "COMDefs.h"
+#include "QIWithRetranslateUI.h"
+#include "VBoxProblemReporter.h"
+#include "VBoxHelpActions.h"
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+# include <VBox/dbggui.h>
+#endif
+#ifdef Q_WS_MAC
+# include <ApplicationServices/ApplicationServices.h>
+# ifndef QT_MAC_USE_COCOA
+#  include <Carbon/Carbon.h>
+# endif /* !QT_MAC_USE_COCOA */
+#endif
+
+/* Global forwards */
+class QAction;
+class QActionGroup;
+class QLabel;
+class QSpacerItem;
+class QIWidgetValidator;
+
+/* Local forwards */
+class QIMenu;
+class QIStateIndicator;
+class VBoxChangeDockIconUpdateEvent;
+class VBoxConsoleView;
+class VBoxMiniToolBar;
+class VBoxSwitchMenu;
+class VBoxUSBMenu;
+
+class VBoxConsoleWnd : public QIWithRetranslateUI2 <QMainWindow>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxConsoleWnd (VBoxConsoleWnd **aSelf, QWidget* aParent = 0, Qt::WindowFlags aFlags = Qt::Window);
+    virtual ~VBoxConsoleWnd();
+
+    bool isWindowMaximized() const
+    {
+#ifdef Q_WS_MAC
+        /* On Mac OS X we didn't really jump to the fullscreen mode but
+         * maximize the window. This situation has to be considered when
+         * checking for maximized or fullscreen mode. */
+        return !isTrueSeamless() && QMainWindow::isMaximized();
+#else /* Q_WS_MAC */
+        return QMainWindow::isMaximized();
+#endif /* Q_WS_MAC */
+    }
+    bool isWindowFullScreen() const
+    {
+#ifdef Q_WS_MAC
+        /* On Mac OS X we didn't really jump to the fullscreen mode but
+         * maximize the window. This situation has to be considered when
+         * checking for maximized or fullscreen mode. */
+        return isTrueFullscreen() || isTrueSeamless();
+#else /* Q_WS_MAC */
+        return QMainWindow::isFullScreen();
+#endif /* Q_WS_MAC */
+    }
+    bool isTrueFullscreen() const { return mIsFullscreen; }
+    bool isTrueSeamless() const { return mIsSeamless; }
+
+    KMachineState machineState() const { return mMachineState; }
+
+    bool openView (const CSession &aSession);
+
+    void setMouseIntegrationLocked (bool aDisabled);
+
+    void popupMainMenu (bool aCenter);
+
+    void installGuestAdditionsFrom (const QString &aSource);
+
+    void setMask (const QRegion &aRegion);
+    void clearMask();
+
+signals:
+
+    void closing();
+
+protected:
+
+    bool event (QEvent *aEvent);
+    void closeEvent (QCloseEvent *aEvent);
+#ifdef Q_WS_X11
+    bool x11Event (XEvent *aEvent);
+#endif
+
+    void retranslateUi();
+
+private slots:
+
+    void finalizeOpenView();
+    void tryClose();
+
+    void vmFullscreen (bool aOn);
+    void vmSeamless (bool aOn);
+    void vmAutoresizeGuest (bool aOn);
+    void vmAdjustWindow();
+    void vmDisableMouseIntegration (bool aOff);
+    void vmTypeCAD();
+#ifdef Q_WS_X11
+    void vmTypeCABS();
+#endif
+    void vmTakeSnapshot();
+    void vmShowInfoDialog();
+    void vmReset();
+    void vmPause (bool aOn);
+    void vmACPIShutdown();
+    void vmClose();
+
+    void devicesSwitchVrdp (bool aOn);
+    void devicesOpenNetworkDialog();
+    void devicesOpenSFDialog();
+    void devicesInstallGuestAdditions();
+
+    void prepareStorageMenu();
+    void prepareNetworkMenu();
+    void prepareSFMenu();
+
+    void mountMedium();
+    void switchUSB (QAction *aAction);
+
+    void showIndicatorContextMenu (QIStateIndicator *aInd, QContextMenuEvent *aEvent);
+
+    void updateDeviceLights();
+    void updateMachineState (KMachineState aState);
+    void updateMouseState (int aState);
+    void updateAdditionsState (const QString &aVersion, bool aActive,
+                               bool aSeamlessSupported, bool aGraphicsSupported);
+    void updateNetworkAdaptersState();
+    void updateUsbState();
+    void updateMediaDriveState (VBoxDefs::MediumType aType);
+    void updateSharedFoldersState();
+
+    void onExitFullscreen();
+    void unlockActionsSwitch();
+
+    void mtExitMode();
+    void mtCloseVM();
+    void mtMaskUpdate();
+
+    void changeDockIconUpdate (const VBoxChangeDockIconUpdateEvent &aEvent);
+    void processGlobalSettingChange (const char *aPublicName, const char *aName);
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    void dbgPrepareDebugMenu();
+    void dbgShowStatistics();
+    void dbgShowCommandLine();
+    void dbgLoggingToggled (bool aBool);
+#endif
+
+private:
+
+    enum /* Stuff */
+    {
+        HardDiskStuff               = 0x01,
+        DVDStuff                    = 0x02,
+        FloppyStuff                 = 0x04,
+        PauseAction                 = 0x08,
+        NetworkStuff                = 0x10,
+        DisableMouseIntegrAction    = 0x20,
+        Caption                     = 0x40,
+        USBStuff                    = 0x80,
+        VRDPStuff                   = 0x100,
+        SharedFolderStuff           = 0x200,
+        VirtualizationStuff         = 0x400,
+        AllStuff                    = 0xFFFF,
+    };
+
+    void checkRequiredFeatures();
+    void activateUICustomizations();
+
+    void updateAppearanceOf (int aElement);
+
+    bool toggleFullscreenMode (bool aOn, bool aSeamless);
+    void switchToFullscreen (bool aOn, bool aSeamless);
+    void setViewInSeamlessMode (const QRect &aTargetRect);
+
+    void closeView();
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    bool dbgCreated();
+    void dbgDestroy();
+    void dbgAdjustRelativePos();
+#endif
+
+    /* COM Variables */
+    CSession mSession;
+
+    /* Machine State */
+    KMachineState mMachineState;
+
+    /* Window Variables */
+    QString mCaptionPrefix;
+    int mConsoleStyle;
+
+    /* Menu items */
+    QIMenu *mMainMenu;
+    QMenu *mVMMenu;
+    QMenu *mVMMenuMini;
+    QMenu *mDevicesMenu;
+    QMenu *mDevicesCDMenu;
+    QMenu *mDevicesFDMenu;
+    QMenu *mDevicesNetworkMenu;
+    QMenu *mDevicesSFMenu;
+    VBoxUSBMenu *mDevicesUSBMenu;
+    VBoxSwitchMenu *mVmDisMouseIntegrMenu;
+#if 0 /* todo: allow to setup */
+    VBoxSwitchMenu *mDevicesVRDPMenu;
+    VBoxSwitchMenu *mVmAutoresizeMenu;
+#endif
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    QMenu *mDbgMenu;
+#endif
+    QMenu *mHelpMenu;
+
+    QActionGroup *mRunningActions;
+    QActionGroup *mRunningOrPausedActions;
+
+    /* Machine actions */
+    QAction *mVmFullscreenAction;
+    QAction *mVmSeamlessAction;
+    QAction *mVmAutoresizeGuestAction;
+    QAction *mVmAdjustWindowAction;
+    QAction *mVmDisableMouseIntegrAction;
+    QAction *mVmTypeCADAction;
+#ifdef Q_WS_X11
+    QAction *mVmTypeCABSAction;
+#endif
+    QAction *mVmTakeSnapshotAction;
+    QAction *mVmShowInformationDlgAction;
+    QAction *mVmResetAction;
+    QAction *mVmPauseAction;
+    QAction *mVmACPIShutdownAction;
+    QAction *mVmCloseAction;
+
+    /* Devices actions */
+    QAction *mDevicesNetworkDialogAction;
+    QAction *mDevicesSFDialogAction;
+    QAction *mDevicesSwitchVrdpSeparator;
+    QAction *mDevicesSwitchVrdpAction;
+    QAction *mDevicesInstallGuestToolsAction;
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /* Debugger actions */
+    QAction *mDbgStatisticsAction;
+    QAction *mDbgCommandLineAction;
+    QAction *mDbgLoggingAction;
+#endif
+
+    /* Help actions */
+    VBoxHelpActions mHelpActions;
+
+    /* Widgets */
+    VBoxConsoleView *mConsole;
+    VBoxMiniToolBar *mMiniToolBar;
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** The handle to the debugger gui. */
+    PDBGGUI mDbgGui;
+    /** The virtual method table for the debugger GUI. */
+    PCDBGGUIVT mDbgGuiVT;
+#endif
+
+    /* Timer to update LEDs */
+    QTimer *mIdleTimer;
+
+    /* LEDs */
+    QIStateIndicator *mHDLed;
+    QIStateIndicator *mCDLed;
+#if 0 /* todo: allow to setup */
+    QIStateIndicator *mFDLed;
+#endif
+    QIStateIndicator *mNetLed;
+    QIStateIndicator *mUSBLed;
+    QIStateIndicator *mSFLed;
+    QIStateIndicator *mVirtLed;
+    QIStateIndicator *mMouseLed;
+    QIStateIndicator *mHostkeyLed;
+    QWidget *mHostkeyLedContainer;
+    QLabel *mHostkeyName;
+#if 0 /* todo: allow to setup */
+    QIStateIndicator *mVrdpLed;
+    QIStateIndicator *mAutoresizeLed;
+#endif
+
+    /* Normal Mode */
+    QRect mNormalGeo;
+
+    /* Fullscreen/Seamless Mode */
+    QList < QPointer <QWidget> > mHiddenChildren;
+    QSpacerItem *mShiftingSpacerLeft;
+    QSpacerItem *mShiftingSpacerTop;
+    QSpacerItem *mShiftingSpacerRight;
+    QSpacerItem *mShiftingSpacerBottom;
+    QPalette mErasePalette;
+    QSize mPrevMinSize;
+    QSize mMaskShift;
+    QRegion mStrictedRegion;
+#ifdef Q_WS_WIN
+    QRegion mPrevRegion;
+#endif
+#ifdef Q_WS_MAC
+    //QRegion mCurrRegion;
+# ifndef QT_MAC_USE_COCOA
+    //EventHandlerRef mDarwinRegionEventHandlerRef;
+# endif
+    /* For seamless maximizing */
+    QRect mNormalGeometry;
+    Qt::WindowFlags mSavedFlags;
+    /* For the fade effect if the the window goes fullscreen */
+    CGDisplayFadeReservationToken mFadeToken;
+#endif
+
+    /* Different bool flags */
+    bool mIsOpenViewFinished : 1;
+    bool mIsFirstTimeStarted : 1;
+    bool mIsAutoSaveMedia : 1;
+    bool mNoAutoClose : 1;
+    bool mIsFullscreen : 1;
+    bool mIsSeamless : 1;
+    bool mIsSeamlessSupported : 1;
+    bool mIsGraphicsSupported : 1;
+    bool mIsWaitingModeResize : 1;
+    bool mWasMax : 1;
+};
+
+/* We want to make the first action highlighted but not
+ * selected, but Qt makes the both or neither one of this,
+ * so, just move the focus to the next eligible object,
+ * which will be the first menu action. This little
+ * subclass made only for that purpose. */
+class QIMenu : public QMenu
+{
+    Q_OBJECT;
+
+public:
+
+    QIMenu (QWidget *aParent) : QMenu (aParent) {}
+
+    void selectFirstAction() { QMenu::focusNextChild(); }
+};
+
+class VBoxSettingsPage;
+class VBoxNetworkDialog : public QIWithRetranslateUI <QDialog>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxNetworkDialog (QWidget *aParent, CSession &aSession);
+
+protected:
+
+    void retranslateUi();
+
+protected slots:
+
+    virtual void accept();
+
+protected:
+
+    void showEvent (QShowEvent *aEvent);
+
+private:
+
+    VBoxSettingsPage *mSettings;
+    CSession &mSession;
+};
+
+class VBoxVMSettingsSF;
+class VBoxSFDialog : public QIWithRetranslateUI <QDialog>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSFDialog (QWidget *aParent, CSession &aSession);
+
+protected:
+
+    void retranslateUi();
+
+protected slots:
+
+    virtual void accept();
+
+protected:
+
+    void showEvent (QShowEvent *aEvent);
+
+private:
+
+    VBoxVMSettingsSF *mSettings;
+    CSession &mSession;
+};
+
+#endif // __VBoxConsoleWnd_h__
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxDefs.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxDefs.cpp	(revision 25170)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxDefs implementation
- */
-
-/*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include <VBoxDefs.h>
-
-const QUuid QUuid_null;
-
-const char* VBoxDefs::GUI_LastWindowPosition = "GUI/LastWindowPostion";
-const char* VBoxDefs::GUI_LastWindowPosition_Max = "max";
-const char* VBoxDefs::GUI_Fullscreen = "GUI/Fullscreen";
-const char* VBoxDefs::GUI_Seamless = "GUI/Seamless";
-const char* VBoxDefs::GUI_AutoresizeGuest = "GUI/AutoresizeGuest";
-const char* VBoxDefs::GUI_FirstRun = "GUI/FirstRun";
-const char* VBoxDefs::GUI_SaveMountedAtRuntime = "GUI/SaveMountedAtRuntime";
-const char* VBoxDefs::GUI_ShowMiniToolBar = "GUI/ShowMiniToolBar";
-const char* VBoxDefs::GUI_MiniToolBarAlignment = "GUI/MiniToolBarAlignment";
-const char* VBoxDefs::GUI_MiniToolBarAutoHide = "GUI/MiniToolBarAutoHide";
-const char* VBoxDefs::GUI_LastCloseAction = "GUI/LastCloseAction";
-const char* VBoxDefs::GUI_SuppressMessages = "GUI/SuppressMessages";
-const char* VBoxDefs::GUI_PermanentSharedFoldersAtRuntime = "GUI/PermanentSharedFoldersAtRuntime";
-#ifdef Q_WS_X11
-const char* VBoxDefs::GUI_LicenseKey = "GUI/LicenseAgreed";
-#endif
-const char* VBoxDefs::GUI_RegistrationDlgWinID = "GUI/RegistrationDlgWinID";
-const char* VBoxDefs::GUI_RegistrationData = "GUI/SUNOnlineData";
-const char* VBoxDefs::GUI_UpdateDlgWinID = "GUI/UpdateDlgWinID";
-const char* VBoxDefs::GUI_UpdateDate = "GUI/UpdateDate";
-const char* VBoxDefs::GUI_UpdateCheckCount = "GUI/UpdateCheckCount";
-const char* VBoxDefs::GUI_LastVMSelected = "GUI/LastVMSelected";
-const char* VBoxDefs::GUI_InfoDlgState = "GUI/InfoDlgState";
-const char* VBoxDefs::GUI_RenderMode = "GUI/RenderMode";
-#ifdef VBOX_GUI_WITH_SYSTRAY
-const char* VBoxDefs::GUI_TrayIconWinID = "GUI/TrayIcon/WinID";
-const char* VBoxDefs::GUI_MainWindowCount = "GUI/MainWindowCount";
-#endif
-#ifdef Q_WS_MAC
-const char* VBoxDefs::GUI_RealtimeDockIconUpdateEnabled = "GUI/RealtimeDockIconUpdateEnabled";
-#endif /* Q_WS_MAC */
-const char* VBoxDefs::GUI_PassCAD = "GUI/PassCAD";
-const char* VBoxDefs::GUI_Export_StorageType = "GUI/Export/StorageType";
-const char* VBoxDefs::GUI_Export_Username = "GUI/Export/Username";
-const char* VBoxDefs::GUI_Export_Hostname = "GUI/Export/Hostname";
-const char* VBoxDefs::GUI_Export_Bucket = "GUI/Export/Bucket";
-const char* VBoxDefs::GUI_PreventBetaWarning = "GUI/PreventBetaWarning";
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxDownloaderWgt.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxDownloaderWgt.cpp	(revision 25170)
+++ 	(revision )
@@ -1,193 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxDownloaderWgt class implementation
- */
-
-/*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIHttp.h"
-#include "VBoxDownloaderWgt.h"
-#include "VBoxGlobal.h"
-
-/* Qt includes */
-#include <QFile>
-#include <QHBoxLayout>
-#include <QHttpResponseHeader>
-#include <QProgressBar>
-#include <QToolButton>
-
-VBoxDownloaderWgt::VBoxDownloaderWgt (const QString &aSource, const QString &aTarget)
-    : mSource (aSource), mTarget (aTarget), mHttp (0)
-    , mProgressBar (new QProgressBar (this))
-    , mCancelButton (new QToolButton (this))
-{
-    /* Progress Bar setup */
-    mProgressBar->setFixedWidth (100);
-    mProgressBar->setFormat ("%p%");
-    mProgressBar->setValue (0);
-
-    /* Cancel Button setup */
-    mCancelButton->setAutoRaise (true);
-    mCancelButton->setFocusPolicy (Qt::TabFocus);
-    connect (mCancelButton, SIGNAL (clicked()), this, SLOT (cancelDownloading()));
-
-    /* Downloader setup */
-    setFixedHeight (16);
-    QHBoxLayout *mainLayout = new QHBoxLayout (this);
-    mainLayout->setSpacing (0);
-    VBoxGlobal::setLayoutMargin (mainLayout, 0);
-    mainLayout->addWidget (mProgressBar);
-    mainLayout->addWidget (mCancelButton);
-    mainLayout->addStretch (1);
-}
-
-void VBoxDownloaderWgt::start()
-{
-    /* By default we are not using acknowledging step, so
-     * making downloading immediately */
-    downloadStart();
-}
-
-/* This function is used to start acknowledging mechanism:
- * checking file presence & size */
-void VBoxDownloaderWgt::acknowledgeStart()
-{
-    delete mHttp;
-    mHttp = new QIHttp (this, mSource.host());
-    connect (mHttp, SIGNAL (responseHeaderReceived (const QHttpResponseHeader &)),
-             this, SLOT (acknowledgeProcess (const QHttpResponseHeader &)));
-    connect (mHttp, SIGNAL (allIsDone (bool)), this, SLOT (acknowledgeFinished (bool)));
-    mHttp->get (mSource.toEncoded());
-}
-
-/* This function is used to store content length */
-void VBoxDownloaderWgt::acknowledgeProcess (const QHttpResponseHeader & /* aResponse */)
-{
-    /* Abort connection as we already got all we need */
-    mHttp->abort();
-}
-
-/* This function is used to ask the user about if he really want
- * to download file of proposed size if no error present or
- * abort download progress if error is present */
-void VBoxDownloaderWgt::acknowledgeFinished (bool aError)
-{
-    NOREF(aError);
-
-    AssertMsg (aError, ("Error must be 'true' due to aborting.\n"));
-
-    mHttp->disconnect (this);
-
-    switch (mHttp->errorCode())
-    {
-        case QIHttp::Aborted:
-        {
-            /* Ask the user if he wish to download it */
-            if (confirmDownload())
-                QTimer::singleShot (0, this, SLOT (downloadStart()));
-            else
-                QTimer::singleShot (0, this, SLOT (suicide()));
-            break;
-        }
-        case QIHttp::MovedPermanentlyError:
-        case QIHttp::MovedTemporarilyError:
-        {
-            /* Restart downloading at new location */
-            mSource = mHttp->lastResponse().value ("location");
-            QTimer::singleShot (0, this, SLOT (acknowledgeStart()));
-            break;
-        }
-        default:
-        {
-            /* Show error happens during acknowledging */
-            abortDownload (mHttp->errorString());
-            break;
-        }
-    }
-}
-
-/* This function is used to start downloading mechanism:
- * downloading and saving the target */
-void VBoxDownloaderWgt::downloadStart()
-{
-    delete mHttp;
-    mHttp = new QIHttp (this, mSource.host());
-    connect (mHttp, SIGNAL (dataReadProgress (int, int)),
-             this, SLOT (downloadProcess (int, int)));
-    connect (mHttp, SIGNAL (allIsDone (bool)), this, SLOT (downloadFinished (bool)));
-    mHttp->get (mSource.toEncoded());
-}
-
-/* this function is used to observe the downloading progress through
- * changing the corresponding qprogressbar value */
-void VBoxDownloaderWgt::downloadProcess (int aDone, int aTotal)
-{
-    mProgressBar->setMaximum (aTotal);
-    mProgressBar->setValue (aDone);
-}
-
-/* This function is used to handle the 'downloading finished' issue
- * through saving the downloaded into the file if there in no error or
- * notifying the user about error happens */
-void VBoxDownloaderWgt::downloadFinished (bool aError)
-{
-    mHttp->disconnect (this);
-
-    if (aError)
-    {
-        /* Show information about error happens */
-        if (mHttp->errorCode() == QIHttp::Aborted)
-            abortDownload (tr ("The download process has been cancelled by the user."));
-        else
-            abortDownload (mHttp->errorString());
-    }
-    else
-    {
-        /* Trying to serialize the incoming buffer into the target, this is the
-         * default behavior which have to be reimplemented in sub-class */
-        QFile file (mTarget);
-        if (file.open (QIODevice::WriteOnly))
-        {
-            file.write (mHttp->readAll());
-            file.close();
-        }
-        QTimer::singleShot (0, this, SLOT (suicide()));
-    }
-}
-
-/* This slot is used to process cancel-button clicking */
-void VBoxDownloaderWgt::cancelDownloading()
-{
-    QTimer::singleShot (0, this, SLOT (suicide()));
-}
-
-/* This function is used to abort download by showing aborting reason
- * and calling the downloader's delete function */
-void VBoxDownloaderWgt::abortDownload (const QString &aError)
-{
-    warnAboutError (aError);
-    QTimer::singleShot (0, this, SLOT (suicide()));
-}
-
-/* This function is used to delete the downloader widget itself,
- * should be reimplemented to enhanse necessary functionality in sub-class */
-void VBoxDownloaderWgt::suicide()
-{
-    delete this;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWgt.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWgt.cpp	(revision 25170)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxExportApplianceWgt class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxExportApplianceWgt.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// ExportSortProxyModel
-
-class ExportSortProxyModel: public VirtualSystemSortProxyModel
-{
-public:
-    ExportSortProxyModel (QObject *aParent = NULL)
-      : VirtualSystemSortProxyModel (aParent)
-    {
-        mFilterList
-            << KVirtualSystemDescriptionType_OS
-            << KVirtualSystemDescriptionType_CPU
-            << KVirtualSystemDescriptionType_Memory
-            << KVirtualSystemDescriptionType_Floppy
-            << KVirtualSystemDescriptionType_CDROM
-            << KVirtualSystemDescriptionType_USBController
-            << KVirtualSystemDescriptionType_SoundCard
-            << KVirtualSystemDescriptionType_NetworkAdapter
-            << KVirtualSystemDescriptionType_HardDiskControllerIDE
-            << KVirtualSystemDescriptionType_HardDiskControllerSATA
-            << KVirtualSystemDescriptionType_HardDiskControllerSCSI;
-    }
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxExportApplianceWgt
-
-VBoxExportApplianceWgt::VBoxExportApplianceWgt (QWidget *aParent /* = NULL */)
-  : VBoxApplianceEditorWgt (aParent)
-{
-}
-
-CAppliance* VBoxExportApplianceWgt::init()
-{
-    if (mAppliance)
-        delete mAppliance;
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    /* Create a appliance object */
-    mAppliance = new CAppliance(vbox.CreateAppliance());
-//    bool fResult = mAppliance->isOk();
-    return mAppliance;
-}
-
-void VBoxExportApplianceWgt::populate()
-{
-    if (mModel)
-        delete mModel;
-
-    QVector<CVirtualSystemDescription> vsds = mAppliance->GetVirtualSystemDescriptions();
-
-    mModel = new VirtualSystemModel (vsds, this);
-
-    ExportSortProxyModel *proxy = new ExportSortProxyModel (this);
-    proxy->setSourceModel (mModel);
-    proxy->sort (DescriptionSection, Qt::DescendingOrder);
-
-    VirtualSystemDelegate *delegate = new VirtualSystemDelegate (proxy, this);
-
-    /* Set our own model */
-    mTvSettings->setModel (proxy);
-    /* Set our own delegate */
-    mTvSettings->setItemDelegate (delegate);
-    /* For now we hide the original column. This data is displayed as tooltip
-       also. */
-    mTvSettings->setColumnHidden (OriginalValueSection, true);
-    mTvSettings->expandAll();
-
-    /* Check for warnings & if there are one display them. */
-    bool fWarningsEnabled = false;
-    QVector<QString> warnings = mAppliance->GetWarnings();
-    if (warnings.size() > 0)
-    {
-        foreach (const QString& text, warnings)
-            mWarningTextEdit->append ("- " + text);
-        fWarningsEnabled = true;
-    }
-    mWarningWidget->setShown (fWarningsEnabled);
-}
-
-void VBoxExportApplianceWgt::prepareExport()
-{
-    if (mAppliance)
-        mModel->putBack();
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWzd.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxExportApplianceWzd.cpp	(revision 25170)
+++ 	(revision )
@@ -1,523 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxExportAppliance class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxExportApplianceWzd.h"
-#include "VBoxGlobal.h"
-#include "QIWidgetValidator.h"
-#include "VBoxProblemReporter.h"
-
-/* Qt includes */
-#include <QDir>
-
-class VMListWidgetItems: public QListWidgetItem
-{
-public:
-    VMListWidgetItems (QPixmap &aIcon, QString &aText, QListWidget *aParent)
-      : QListWidgetItem (aIcon, aText, aParent) {}
-
-    /* Sort like in the VM selector of the main window */
-    bool operator< (const QListWidgetItem &aOther) const
-    {
-        return text().toLower() < aOther.text().toLower();
-    }
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxExportApplianceWzd
-
-VBoxExportApplianceWzd::VBoxExportApplianceWzd (QWidget *aParent /* = NULL */, const QString& aSelectName /* = QString::null */)
-    : QIWithRetranslateUI<QIAbstractWizard> (aParent)
-{
-    /* Apply UI decorations */
-    Ui::VBoxExportApplianceWzd::setupUi (this);
-
-    /* Initialize wizard hdr */
-    initializeWizardHdr();
-
-    /* Configure the VM selector widget */
-    mVMListWidget->setAlternatingRowColors (true);
-    mVMListWidget->setSelectionMode (QAbstractItemView::ExtendedSelection);
-
-    /* Validator for the VM selector page */
-    mWValVMSelector = new QIWidgetValidator (mVMSelectPage, this);
-    connect (mWValVMSelector, SIGNAL (validityChanged (const QIWidgetValidator *)),
-             this, SLOT (enableNext (const QIWidgetValidator *)));
-    connect (mWValVMSelector, SIGNAL (isValidRequested (QIWidgetValidator *)),
-             this, SLOT (revalidate (QIWidgetValidator *)));
-    connect (mVMListWidget, SIGNAL (itemSelectionChanged()),
-             mWValVMSelector, SLOT (revalidate()));
-
-    /* Fill the VM selector list */
-    addListViewVMItems (aSelectName);
-    mWValVMSelector->revalidate();
-
-    /* Configure the file selector */
-    mFileSelector->setMode (VBoxFilePathSelectorWidget::Mode_File_Save);
-    mFileSelector->setEditable (true);
-    mFileSelector->setButtonPosition (VBoxEmptyFileSelector::RightPosition);
-    mFileSelector->setFileDialogTitle (tr ("Select a file to export into"));
-    mFileSelector->setFileFilters (tr ("Open Virtualization Format (%1)").arg ("*.ovf"));
-    mFileSelector->setDefaultSaveExt ("ovf");
-    setTabOrder (mLeBucket, mFileSelector);
-
-    /* Connect the restore button with the settings widget */
-    connect (mBtnRestore, SIGNAL (clicked()),
-             mExportSettingsWgt, SLOT (restoreDefaults()));
-
-    /* Validator for the file selector page */
-    mWValFileSelector = new QIWidgetValidator (mTargetOptionsPage, this);
-    connect (mWValFileSelector, SIGNAL (validityChanged (const QIWidgetValidator *)),
-             this, SLOT (enableNext (const QIWidgetValidator *)));
-    connect (mWValFileSelector, SIGNAL (isValidRequested (QIWidgetValidator *)),
-             this, SLOT (revalidate (QIWidgetValidator *)));
-    connect (mFileSelector, SIGNAL (pathChanged (const QString &)),
-             mWValFileSelector, SLOT (revalidate()));
-    connect (mLeUsername, SIGNAL (textChanged (const QString &)),
-             mWValFileSelector, SLOT (revalidate()));
-    connect (mLePassword, SIGNAL (textChanged (const QString &)),
-             mWValFileSelector, SLOT (revalidate()));
-    connect (mLeHostname, SIGNAL (textChanged (const QString &)),
-             mWValFileSelector, SLOT (revalidate()));
-    connect (mLeBucket, SIGNAL (textChanged (const QString &)),
-             mWValFileSelector, SLOT (revalidate()));
-
-//    mLeUsername->setText (vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_Export_Username));
-//    mLeHostname->setText (vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_Export_Hostname));
-//    mLeBucket->setText (vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_Export_Bucket));
-
-    mWValFileSelector->revalidate();
-
-    /* Initialize wizard ftr */
-    initializeWizardFtr();
-
-    retranslateUi();
-
-    /* Type selection is disabled for now */
-    connect (mBtnNext2, SIGNAL (clicked(bool)),
-             mBtnNext3, SLOT (click()));
-    connect (mBtnBack4, SIGNAL (clicked(bool)),
-             mBtnBack3, SLOT (click()));
-
-//    bool ok;
-//    StorageType type = StorageType (vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_Export_StorageType).toInt(&ok));
-//    if (ok)
-//        setCurrentStorageType (type);
-}
-
-void VBoxExportApplianceWzd::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxExportApplianceWzd::retranslateUi (this);
-
-    mDefaultApplianceName = tr("Appliance");
-
-    mExportToFileSystemDesc = tr("Please choose a filename to export the OVF to.");
-    mExportToSunCloudDesc = tr("Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.");
-    mExportToS3Desc = tr("Please complete the additional fields like the username, password, hostname and the bucket, and provide a filename for the OVF target.");
-
-    switch (currentStorageType())
-    {
-        case Filesystem: mTextTargetOptions->setText (mExportToFileSystemDesc); break;
-        case SunCloud: mTextTargetOptions->setText (mExportToSunCloudDesc); break;
-        case S3: mTextTargetOptions->setText (mExportToS3Desc); break;
-    }
-}
-
-void VBoxExportApplianceWzd::revalidate (QIWidgetValidator *aWval)
-{
-    /* Do individual validations for pages */
-    bool valid = aWval->isOtherValid();
-
-    if (aWval == mWValVMSelector)
-        valid = mVMListWidget->selectedItems().size() > 0;
-
-    if (aWval == mWValFileSelector)
-    {
-        valid = mFileSelector->path().toLower().endsWith (".ovf");
-        if (currentStorageType() == SunCloud)
-        {
-            valid &= !mLeUsername->text().isEmpty() &&
-                !mLePassword->text().isEmpty() &&
-                !mLeBucket->text().isEmpty();
-        }
-        else if (currentStorageType() == S3)
-        {
-            valid &= !mLeUsername->text().isEmpty() &&
-                !mLePassword->text().isEmpty() &&
-                !mLeHostname->text().isEmpty() &&
-                !mLeBucket->text().isEmpty();
-        }
-    }
-
-    aWval->setOtherValid (valid);
-}
-
-void VBoxExportApplianceWzd::enableNext (const QIWidgetValidator *aWval)
-{
-    if (aWval == mWValFileSelector)
-        finishButton()->setEnabled (aWval->isValid());
-    else
-        nextButton (aWval->widget())->setEnabled (aWval->isValid());
-}
-
-void VBoxExportApplianceWzd::accept()
-{
-    CAppliance *appliance = mExportSettingsWgt->appliance();
-    QFileInfo fi (mFileSelector->path());
-    QVector<QString> files;
-    files << fi.fileName();
-    /* We need to know every filename which will be created, so that we can
-     * ask the user for confirmation of overwriting. For that we iterating
-     * over all virtual systems & fetch all descriptions of the type
-     * HardDiskImage. */
-    CVirtualSystemDescriptionVector vsds = appliance->GetVirtualSystemDescriptions();
-    for (int i=0; i < vsds.size(); ++i)
-    {
-        QVector<KVirtualSystemDescriptionType> types;
-        QVector<QString> refs, origValues, configValues, extraConfigValues;
-
-        vsds[i].GetDescriptionByType (KVirtualSystemDescriptionType_HardDiskImage, types, refs, origValues, configValues, extraConfigValues);
-        foreach (const QString &s, origValues)
-            files << QString ("%2").arg (s);
-    }
-    CVFSExplorer explorer = appliance->CreateVFSExplorer(uri());
-    CProgress progress = explorer.Update();
-    bool fResult = explorer.isOk();
-    if (fResult)
-    {
-        /* Show some progress, so the user know whats going on */
-        vboxProblem().showModalProgressDialog (progress, tr ("Checking files ..."), this);
-        if (progress.GetCanceled())
-            return;
-        if (!progress.isOk() || progress.GetResultCode() != 0)
-        {
-            vboxProblem().cannotCheckFiles (progress, this);
-            return;
-        }
-    }
-    QVector<QString> exists = explorer.Exists (files);
-    /* Check if the file exists already, if yes get confirmation for
-     * overwriting from the user. */
-    if (!vboxProblem().askForOverridingFiles (exists, this))
-        return;
-    /* Ok all is confirmed so delete all the files which exists */
-    if (!exists.isEmpty())
-    {
-        CProgress progress1 = explorer.Remove (exists);
-        fResult = explorer.isOk();
-        if (fResult)
-        {
-            /* Show some progress, so the user know whats going on */
-            vboxProblem().showModalProgressDialog (progress1, tr ("Removing files ..."), this);
-            if (progress1.GetCanceled())
-                return;
-            if (!progress1.isOk() || progress1.GetResultCode() != 0)
-            {
-                vboxProblem().cannotRemoveFiles (progress1, this);
-                return;
-            }
-        }
-    }
-    /* Export the VMs, on success we are finished */
-    if (exportVMs (*appliance))
-    {
-//        vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_Export_StorageType, QString::number(currentStorageType()));
-//        vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_Export_Username, mLeUsername->text());
-//        vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_Export_Hostname, mLeHostname->text());
-//        vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_Export_Bucket, mLeBucket->text());
-        QIAbstractWizard::accept();
-    }
-}
-
-void VBoxExportApplianceWzd::showNextPage()
-{
-    /* We propose a filename the first time the second page is displayed */
-    if (sender() == mBtnNext1)
-    {
-        prepareSettingsWidget();
-    }
-    else if (sender() == mBtnNext3)
-    {
-        storageTypeChanged();
-        if (mFileSelector->path().isEmpty())
-        {
-            /* Set the default filename */
-            QString name = mDefaultApplianceName;
-            /* If it is one VM only, we use the VM name as file name */
-            if (mVMListWidget->selectedItems().size() == 1)
-                name = mVMListWidget->selectedItems().first()->text();
-
-            name += ".ovf";
-
-            if (currentStorageType() == Filesystem)
-                name = QDir::toNativeSeparators (QString ("%1/%2").arg (vboxGlobal().documentsPath())
-                                                 .arg (name));
-            mFileSelector->setPath (name);
-            mWValFileSelector->revalidate();
-        }
-        mExportSettingsWgt->prepareExport();
-    }
-
-    QIAbstractWizard::showNextPage();
-}
-
-void VBoxExportApplianceWzd::onPageShow()
-{
-    QWidget *page = mPageStack->currentWidget();
-
-    if (page == mTargetOptionsPage)
-        finishButton()->setDefault (true);
-    else
-        nextButton (page)->setDefault (true);
-}
-
-void VBoxExportApplianceWzd::addListViewVMItems (const QString& aSelectName)
-{
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    CMachineVector vec = vbox.GetMachines();
-    for (CMachineVector::ConstIterator m = vec.begin();
-         m != vec.end(); ++ m)
-    {
-        QPixmap icon;
-        QString name;
-        QString uuid;
-        bool enabled;
-        if (m->GetAccessible())
-        {
-            icon = vboxGlobal().vmGuestOSTypeIcon (m->GetOSTypeId()).scaled (16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-            name = m->GetName();
-            uuid = m->GetId();
-            enabled = m->GetSessionState() == KSessionState_Closed;
-        }
-        else
-        {
-            QString settingsFile = m->GetSettingsFilePath();
-            QFileInfo fi (settingsFile);
-            name = fi.completeSuffix().toLower() == "xml" ?
-                   fi.completeBaseName() : fi.fileName();
-            icon = QPixmap (":/os_other.png").scaled (16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-            enabled = false;
-        }
-        QListWidgetItem *item = new VMListWidgetItems (icon, name, mVMListWidget);
-        item->setData (Qt::UserRole, uuid);
-        if (!enabled)
-            item->setFlags (0);
-        mVMListWidget->addItem (item);
-    }
-    mVMListWidget->sortItems();
-
-    /* Make sure aSelectName is initial selected in the list */
-    QList<QListWidgetItem *> list = mVMListWidget->findItems (aSelectName, Qt::MatchExactly);
-    if (list.size() > 0)
-        mVMListWidget->setCurrentItem (list.first());
-}
-
-bool VBoxExportApplianceWzd::prepareSettingsWidget()
-{
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    CAppliance *appliance = mExportSettingsWgt->init();
-    bool fResult = appliance->isOk();
-    if (fResult)
-    {
-        /* Iterate over all selected items */
-        QList<QListWidgetItem *> list = mVMListWidget->selectedItems();
-        foreach (const QListWidgetItem* item, list)
-        {
-            /* The VM uuid can be fetched by the UserRole */
-            QString uuid = item->data (Qt::UserRole).toString();
-            /* Get the machine with the uuid */
-            CMachine m = vbox.GetMachine (uuid);
-            fResult = m.isOk();
-            if (fResult)
-            {
-                /* Add the export description to our appliance object */
-                CVirtualSystemDescription vsd = m.Export (*appliance);
-                fResult = m.isOk();
-                if (!fResult)
-                {
-                    vboxProblem().cannotExportAppliance (m, appliance, this);
-                    return false;
-                }
-                /* Now add some new fields the user may change */
-                vsd.AddDescription (KVirtualSystemDescriptionType_Product, "", "");
-                vsd.AddDescription (KVirtualSystemDescriptionType_ProductUrl, "", "");
-                vsd.AddDescription (KVirtualSystemDescriptionType_Vendor, "", "");
-                vsd.AddDescription (KVirtualSystemDescriptionType_VendorUrl, "", "");
-                vsd.AddDescription (KVirtualSystemDescriptionType_Version, "", "");
-                vsd.AddDescription (KVirtualSystemDescriptionType_License, "", "");
-            }
-            else
-                break;
-        }
-        /* Make sure the settings widget get the new descriptions */
-        mExportSettingsWgt->populate();
-    }
-    if (!fResult)
-        vboxProblem().cannotExportAppliance (appliance, this);
-    return fResult;
-}
-
-bool VBoxExportApplianceWzd::exportVMs (CAppliance &aAppliance)
-{
-    /* Write the appliance */
-    QString version = mSelectOVF09->isChecked() ? "ovf-0.9" : "ovf-1.0";
-    CProgress progress = aAppliance.Write (version, uri());
-    bool fResult = aAppliance.isOk();
-    if (fResult)
-    {
-        /* Show some progress, so the user know whats going on */
-        vboxProblem().showModalProgressDialog (progress, tr ("Exporting Appliance ..."), this);
-        if (progress.GetCanceled())
-            return false;
-        if (!progress.isOk() || progress.GetResultCode() != 0)
-        {
-            vboxProblem().cannotExportAppliance (progress, &aAppliance, this);
-            return false;
-        }
-        else
-            return true;
-    }
-    if (!fResult)
-        vboxProblem().cannotExportAppliance (&aAppliance, this);
-    return false;
-}
-
-QString VBoxExportApplianceWzd::uri() const
-{
-    if (currentStorageType() == Filesystem)
-        return mFileSelector->path();
-    else if (currentStorageType() == SunCloud)
-    {
-        QString uri ("SunCloud://");
-        if (!mLeUsername->text().isEmpty())
-            uri = QString ("%1%2").arg (uri).arg (mLeUsername->text());
-        if (!mLePassword->text().isEmpty())
-            uri = QString ("%1:%2").arg (uri).arg (mLePassword->text());
-        if (!mLeUsername->text().isEmpty() ||
-            !mLePassword->text().isEmpty())
-            uri = QString ("%1@").arg (uri);
-        uri = QString ("%1%2/%3/%4").arg (uri).arg ("object.storage.network.com").arg (mLeBucket->text()).arg (mFileSelector->path());
-        return uri;
-    }
-    else if (currentStorageType() == S3)
-    {
-        QString uri ("S3://");
-        if (!mLeUsername->text().isEmpty())
-            uri = QString ("%1%2").arg (uri).arg (mLeUsername->text());
-        if (!mLePassword->text().isEmpty())
-            uri = QString ("%1:%2").arg (uri).arg (mLePassword->text());
-        if (!mLeUsername->text().isEmpty() ||
-            !mLePassword->text().isEmpty())
-            uri = QString ("%1@").arg (uri);
-        uri = QString ("%1%2/%3/%4").arg (uri).arg (mLeHostname->text()).arg (mLeBucket->text()).arg (mFileSelector->path());
-        return uri;
-    }
-    return "";
-}
-
-VBoxExportApplianceWzd::StorageType VBoxExportApplianceWzd::currentStorageType() const
-{
-    if (mRBtnLocalFileSystem->isChecked())
-        return Filesystem;
-    else if (mRBtnSunCloud->isChecked())
-        return SunCloud;
-    else
-        return S3;
-}
-
-void VBoxExportApplianceWzd::storageTypeChanged()
-{
-    StorageType type = currentStorageType();
-    switch (type)
-    {
-        case Filesystem:
-        {
-            mTextTargetOptions->setText (mExportToFileSystemDesc);
-            mLblUsername->setVisible (false);
-            mLeUsername->setVisible (false);
-            mLblPassword->setVisible (false);
-            mLePassword->setVisible (false);
-            mLblHostname->setVisible (false);
-            mLeHostname->setVisible (false);
-            mLblBucket->setVisible (false);
-            mLeBucket->setVisible (false);
-            mSelectOVF09->setVisible (true);
-            mFileSelector->setChooserVisible (true);
-            mFileSelector->setFocus();
-            break;
-        };
-        case SunCloud:
-        {
-            mTextTargetOptions->setText (mExportToSunCloudDesc);
-            mLblUsername->setVisible (true);
-            mLeUsername->setVisible (true);
-            mLblPassword->setVisible (true);
-            mLePassword->setVisible (true);
-            mLblHostname->setVisible (false);
-            mLeHostname->setVisible (false);
-            mLblBucket->setVisible (true);
-            mLeBucket->setVisible (true);
-            mSelectOVF09->setVisible (false);
-            mSelectOVF09->setChecked (false);
-            mFileSelector->setChooserVisible (false);
-            mLeUsername->setFocus();
-            break;
-        };
-        case S3:
-        {
-            mTextTargetOptions->setText (mExportToS3Desc);
-            mLblUsername->setVisible (true);
-            mLeUsername->setVisible (true);
-            mLblPassword->setVisible (true);
-            mLePassword->setVisible (true);
-            mLblHostname->setVisible (true);
-            mLeHostname->setVisible (true);
-            mLblBucket->setVisible (true);
-            mLeBucket->setVisible (true);
-            mSelectOVF09->setVisible (true);
-            mFileSelector->setChooserVisible (false);
-            mLeUsername->setFocus();
-            break;
-        };
-    }
-
-    if (!mFileSelector->path().isEmpty())
-    {
-        QFileInfo fi (mFileSelector->path());
-        QString name = fi.fileName();
-        if (type == Filesystem)
-            name = QDir::toNativeSeparators (QString ("%1/%2").arg (vboxGlobal().documentsPath())
-                                             .arg (name));
-        mFileSelector->setPath (name);
-    }
-}
-
-void VBoxExportApplianceWzd::setCurrentStorageType (VBoxExportApplianceWzd::StorageType aType)
-{
-    switch (aType)
-    {
-        case Filesystem: mRBtnLocalFileSystem->setChecked(true); mRBtnLocalFileSystem->setFocus(); break;
-        case SunCloud: mRBtnSunCloud->setChecked(true); mRBtnSunCloud->setFocus(); break;
-        case S3: mRBtnS3->setChecked(true); mRBtnS3->setFocus(); break;
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h	(revision 25171)
@@ -0,0 +1,1521 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxFrameBuffer Overly classes declarations
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+#ifndef __VBoxFBOverlay_h__
+#define __VBoxFBOverlay_h__
+#if defined (VBOX_GUI_USE_QGL) || defined(VBOX_WITH_VIDEOHWACCEL)
+
+//#define VBOXQGL_PROF_BASE 1
+//#define VBOXQGL_DBG_SURF 1
+
+#include "COMDefs.h"
+#include <QGLWidget>
+#include <iprt/assert.h>
+#include <iprt/critsect.h>
+
+#include <VBox/VBoxGL2D.h>
+#include "VBoxFBOverlayCommon.h"
+
+#define VBOXVHWA_ALLOW_PRIMARY_AND_OVERLAY_ONLY 1
+
+#ifdef DEBUG_misha
+# define VBOXVHWA_PROFILE_FPS
+#endif
+
+#ifdef DEBUG
+class VBoxVHWADbgTimer
+{
+public:
+    VBoxVHWADbgTimer(uint32_t cPeriods);
+    ~VBoxVHWADbgTimer();
+    void frame();
+    uint64_t everagePeriod() {return mPeriodSum / mcPeriods; }
+    double fps() {return ((double)1000000000.0) / everagePeriod(); }
+    uint64_t frames() {return mcFrames; }
+private:
+    uint64_t mPeriodSum;
+    uint64_t *mpaPeriods;
+    uint64_t mPrevTime;
+    uint64_t mcFrames;
+    uint32_t mcPeriods;
+    uint32_t miPeriod;
+};
+
+#endif
+
+class VBoxVHWADirtyRect
+{
+public:
+    VBoxVHWADirtyRect() :
+        mIsClear(true)
+    {}
+
+    VBoxVHWADirtyRect(const QRect & aRect)
+    {
+        if(aRect.isEmpty())
+        {
+            mIsClear = false;
+            mRect = aRect;
+        }
+        else
+        {
+            mIsClear = true;
+        }
+    }
+
+    bool isClear() const { return mIsClear; }
+
+    void add(const QRect & aRect)
+    {
+        if(aRect.isEmpty())
+            return;
+
+        mRect = mIsClear ? aRect : mRect.united(aRect);
+        mIsClear = false;
+    }
+
+    void add(const VBoxVHWADirtyRect & aRect)
+    {
+        if(aRect.isClear())
+            return;
+        add(aRect.rect());
+    }
+
+    void set(const QRect & aRect)
+    {
+        if(aRect.isEmpty())
+        {
+            mIsClear = true;
+        }
+        else
+        {
+            mRect = aRect;
+            mIsClear = false;
+        }
+    }
+
+    void clear() { mIsClear = true; }
+
+    const QRect & rect() const {return mRect;}
+
+    const QRect & toRect()
+    {
+        if(isClear())
+        {
+            mRect.setCoords(0, 0, -1, -1);
+        }
+        return mRect;
+    }
+
+    bool intersects(const QRect & aRect) const {return mIsClear ? false : mRect.intersects(aRect);}
+
+    bool intersects(const VBoxVHWADirtyRect & aRect) const {return mIsClear ? false : aRect.intersects(mRect);}
+
+    QRect united(const QRect & aRect) const {return mIsClear ? aRect : aRect.united(mRect);}
+
+    bool contains(const QRect & aRect) const {return mIsClear ? false : aRect.contains(mRect);}
+
+    void subst(const VBoxVHWADirtyRect & aRect) { if(!mIsClear && aRect.contains(mRect)) clear(); }
+
+private:
+    QRect mRect;
+    bool mIsClear;
+};
+
+class VBoxVHWAColorKey
+{
+public:
+    VBoxVHWAColorKey() :
+        mUpper(0),
+        mLower(0)
+    {}
+
+    VBoxVHWAColorKey(uint32_t aUpper, uint32_t aLower) :
+        mUpper(aUpper),
+        mLower(aLower)
+    {}
+
+    uint32_t upper() const {return mUpper; }
+    uint32_t lower() const {return mLower; }
+
+    bool operator==(const VBoxVHWAColorKey & other) const { return mUpper == other.mUpper && mLower == other.mLower; }
+private:
+    uint32_t mUpper;
+    uint32_t mLower;
+};
+
+class VBoxVHWAColorComponent
+{
+public:
+    VBoxVHWAColorComponent() :
+        mMask(0),
+        mRange(0),
+        mOffset(32),
+        mcBits(0)
+    {}
+
+    VBoxVHWAColorComponent(uint32_t aMask);
+
+    uint32_t mask() const { return mMask; }
+    uint32_t range() const { return mRange; }
+    uint32_t offset() const { return mOffset; }
+    uint32_t cBits() const { return mcBits; }
+    uint32_t colorVal(uint32_t col) const { return (col & mMask) >> mOffset; }
+    float colorValNorm(uint32_t col) const { return ((float)colorVal(col))/mRange; }
+private:
+    uint32_t mMask;
+    uint32_t mRange;
+    uint32_t mOffset;
+    uint32_t mcBits;
+};
+
+class VBoxVHWAColorFormat
+{
+public:
+
+//    VBoxVHWAColorFormat(GLint aInternalFormat, GLenum aFormat, GLenum aType, uint32_t aDataFormat);
+    VBoxVHWAColorFormat(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b);
+    VBoxVHWAColorFormat(uint32_t fourcc);
+    VBoxVHWAColorFormat(){}
+    GLint internalFormat() const {return mInternalFormat; }
+    GLenum format() const {return mFormat; }
+    GLenum type() const {return mType; }
+    bool isValid() const {return mBitsPerPixel != 0; }
+    uint32_t fourcc() const {return mDataFormat;}
+    uint32_t bitsPerPixel() const { return mBitsPerPixel; }
+    uint32_t bitsPerPixelTex() const { return mBitsPerPixelTex; }
+//    uint32_t bitsPerPixelDd() const { return mBitsPerPixelDd; }
+    void pixel2Normalized(uint32_t pix, float *r, float *g, float *b) const;
+    uint32_t widthCompression() const {return mWidthCompression;}
+    uint32_t heightCompression() const {return mHeightCompression;}
+    const VBoxVHWAColorComponent& r() const {return mR;}
+    const VBoxVHWAColorComponent& g() const {return mG;}
+    const VBoxVHWAColorComponent& b() const {return mB;}
+    const VBoxVHWAColorComponent& a() const {return mA;}
+
+    bool equals (const VBoxVHWAColorFormat & other) const;
+
+private:
+    void init(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b);
+    void init(uint32_t fourcc);
+
+    GLint mInternalFormat;
+    GLenum mFormat;
+    GLenum mType;
+    uint32_t mDataFormat;
+
+    uint32_t mBitsPerPixel;
+    uint32_t mBitsPerPixelTex;
+//    uint32_t mBitsPerPixelDd;
+    uint32_t mWidthCompression;
+    uint32_t mHeightCompression;
+    VBoxVHWAColorComponent mR;
+    VBoxVHWAColorComponent mG;
+    VBoxVHWAColorComponent mB;
+    VBoxVHWAColorComponent mA;
+};
+
+class VBoxVHWATexture
+{
+public:
+    VBoxVHWATexture() {}
+    VBoxVHWATexture(const QRect & aRect, const VBoxVHWAColorFormat &aFormat);
+    virtual ~VBoxVHWATexture();
+    virtual void init(uchar *pvMem);
+    void setAddress(uchar *pvMem) {mAddress = pvMem;}
+    void update(const QRect * pRect) { doUpdate(mAddress, pRect);}
+    void bind() {glBindTexture(texTarget(), mTexture);}
+
+    virtual void texCoord(int x, int y);
+    virtual void multiTexCoord(GLenum texUnit, int x, int y);
+
+//    GLuint texture() {return mTexture;}
+    const QRect & texRect() {return mTexRect;}
+    const QRect & rect() {return mRect;}
+    uchar * address(){ return mAddress; }
+    uint32_t rectSizeTex(const QRect * pRect) {return pRect->width() * pRect->height() * mBytesPerPixelTex;}
+    uchar * pointAddress(int x, int y)
+    {
+        x = toXTex(x);
+        y = toYTex(y);
+        return pointAddressTex(x, y);
+    }
+    uint32_t pointOffsetTex(int x, int y) { return y*mBytesPerLine + x*mBytesPerPixelTex; }
+    uchar * pointAddressTex(int x, int y) { return mAddress + pointOffsetTex(x, y); }
+    int toXTex(int x) {return x/mColorFormat.widthCompression();}
+    int toYTex(int y) {return y/mColorFormat.heightCompression();}
+    ulong memSize(){ return mBytesPerLine * mRect.height(); }
+    uint32_t bytesPerLine() {return mBytesPerLine; }
+
+protected:
+    virtual void doUpdate(uchar * pAddress, const QRect * pRect);
+    virtual void initParams();
+    virtual void load();
+    virtual GLenum texTarget() {return GL_TEXTURE_2D; }
+
+
+    QRect mTexRect; /* texture size */
+    QRect mRect; /* img size */
+    uchar * mAddress;
+    GLuint mTexture;
+    uint32_t mBytesPerPixel;
+    uint32_t mBytesPerPixelTex;
+    uint32_t mBytesPerLine;
+    VBoxVHWAColorFormat mColorFormat;
+private:
+    void uninit();
+};
+
+class VBoxVHWATextureNP2 : public VBoxVHWATexture
+{
+public:
+    VBoxVHWATextureNP2() : VBoxVHWATexture() {}
+    VBoxVHWATextureNP2(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
+        VBoxVHWATexture(aRect, aFormat){
+        mTexRect = QRect(0, 0, aRect.width()/aFormat.widthCompression(), aRect.height()/aFormat.heightCompression());
+    }
+};
+
+class VBoxVHWATextureNP2Rect : public VBoxVHWATextureNP2
+{
+public:
+    VBoxVHWATextureNP2Rect() : VBoxVHWATextureNP2() {}
+    VBoxVHWATextureNP2Rect(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
+        VBoxVHWATextureNP2(aRect, aFormat){}
+
+    virtual void texCoord(int x, int y);
+    virtual void multiTexCoord(GLenum texUnit, int x, int y);
+protected:
+    virtual GLenum texTarget();
+};
+
+class VBoxVHWATextureNP2RectPBO : public VBoxVHWATextureNP2Rect
+{
+public:
+    VBoxVHWATextureNP2RectPBO() : VBoxVHWATextureNP2Rect() {}
+    VBoxVHWATextureNP2RectPBO(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
+        VBoxVHWATextureNP2Rect(aRect, aFormat){}
+    virtual ~VBoxVHWATextureNP2RectPBO();
+
+    virtual void init(uchar *pvMem);
+protected:
+    virtual void load();
+    virtual void doUpdate(uchar * pAddress, const QRect * pRect);
+private:
+    GLuint mPBO;
+};
+
+#ifdef VBOXVHWA_USE_TEXGROUP
+class VBoxVHWATextureGroup
+{
+public:
+    VBoxVHWATextureGroup()
+    {
+        init(0, 0);
+    }
+
+    VBoxVHWATextureGroup(uint32_t cTextures, uint32_t cBacks)
+    {
+        init(cTextures, cBacks);
+    }
+
+    ~VBoxVHWATextureGroup()
+    {
+        delete[] mppTextures;
+        delete[] mpDisplays;
+    }
+
+    VBoxVHWATexture*& operator[] (size_t i) { return mppCurTextures[i]; }
+    void swap()
+    {
+        mCur = ((++mCur) % mcSets);
+        if(mCur)
+            mppCurTextures += mcTextures;
+        else
+            mppCurTextures = mppTextures;
+    }
+    uint32_t numSets() { return mcSets; }
+
+    void init(uint32_t cTextures, uint32_t cBacks)
+    {
+        mCur = 0;
+        mcTextures = cTextures;
+        mcSets = cBacks + 1;
+        if(mcTextures)
+        {
+            mppTextures = new VBoxVHWATexture*[mcSets * cTextures];
+            mppCurTextures = mppTextures;
+            memset(mppTextures, 0, sizeof(mppTextures[0]) * mcSets * cTextures);
+            mpDisplays = new GLuint[mcSets];
+            memset(mpDisplays, 0, sizeof(mpDisplays[0]) * mcSets);
+        }
+        else
+        {
+            mppTextures = mppCurTextures = NULL;
+            mpDisplays = NULL;
+        }
+    }
+
+    GLuint& display() {return mpDisplays[mCur];}
+private:
+    VBoxVHWATexture **mppTextures;
+    VBoxVHWATexture **mppCurTextures;
+    GLuint * mpDisplays;
+    uint32_t mCur;
+    uint32_t mcTextures;
+    uint32_t mcSets;
+};
+#endif
+
+class VBoxVHWAHandleTable
+{
+public:
+    VBoxVHWAHandleTable(uint32_t initialSize);
+    ~VBoxVHWAHandleTable();
+    uint32_t put(void * data);
+    bool mapPut(uint32_t h, void * data);
+    void* get(uint32_t h);
+    void* remove(uint32_t h);
+private:
+    void doPut(uint32_t h, void * data);
+    void doRemove(uint32_t h);
+    void** mTable;
+    uint32_t mcSize;
+    uint32_t mcUsage;
+    uint32_t mCursor;
+};
+
+/* data flow:
+ * I. NON-Yinverted surface:
+ * 1.direct memory update (paint, lock/unlock):
+ *  mem->tex->fb
+ * 2.blt
+ *  srcTex->invFB->tex->fb
+ *              |->mem
+ *
+ * II. Yinverted surface:
+ * 1.direct memory update (paint, lock/unlock):
+ *  mem->tex->fb
+ * 2.blt
+ *  srcTex->fb->tex
+ *           |->mem
+ *
+ * III. flip support:
+ * 1. Yinverted<->NON-YInverted conversion :
+ *  mem->tex-(rotate model view, force LAZY complete fb update)->invFB->tex
+ *  fb-->|                                                           |->mem
+ * */
+class VBoxVHWASurfaceBase
+{
+public:
+    VBoxVHWASurfaceBase(
+            class VBoxGLWidget *mWidget,
+#if 0
+            class VBoxVHWAGlContextState *aState,
+            bool aIsYInverted,
+#endif
+            const QSize & aSize,
+            const QRect & aTargRect,
+            const QRect & aSrcRect,
+            const QRect & aVisTargRect,
+            VBoxVHWAColorFormat & aColorFormat,
+            VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey,
+            VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey,
+#ifdef VBOXVHWA_USE_TEXGROUP
+            uint32_t cBackTex,
+#endif
+            bool bVGA);
+
+    virtual ~VBoxVHWASurfaceBase();
+
+    void init(VBoxVHWASurfaceBase * pPrimary, uchar *pvMem);
+
+    void uninit();
+
+    static void globalInit();
+
+//    int blt(const QRect * aDstRect, VBoxVHWASurfaceBase * aSrtSurface, const QRect * aSrcRect, const VBoxVHWAColorKey * pDstCKeyOverride, const VBoxVHWAColorKey * pSrcCKeyOverride);
+
+    int lock(const QRect * pRect, uint32_t flags);
+
+    int unlock();
+
+    void updatedMem(const QRect * aRect);
+
+    bool performDisplay(VBoxVHWASurfaceBase *pPrimary, bool bForce);
+
+    void setRects (const QRect & aTargRect, const QRect & aSrcRect);
+    void setTargRectPosition (const QPoint & aPoint);
+    void setVisibilityReinitFlag() { mNeedVisibilityReinit = true; }
+    void updateVisibility (VBoxVHWASurfaceBase *pPrimary, const QRect & aVisibleTargRect, bool bNotIntersected, bool bForce);
+
+    static ulong calcBytesPerPixel(GLenum format, GLenum type);
+
+    static GLsizei makePowerOf2(GLsizei val);
+
+    bool    addressAlocated() const { return mFreeAddress; }
+    uchar * address(){ return mAddress; }
+
+    ulong   memSize();
+
+    ulong width()  { return mRect.width();  }
+    ulong height() { return mRect.height(); }
+    const QSize size() {return mRect.size();}
+
+    GLenum format() {return mColorFormat.format(); }
+    GLint  internalFormat() { return mColorFormat.internalFormat(); }
+    GLenum type() { return mColorFormat.type(); }
+    uint32_t fourcc() {return mColorFormat.fourcc(); }
+
+//    ulong  bytesPerPixel() { return mpTex[0]->bytesPerPixel(); }
+    ulong  bitsPerPixel() { return mColorFormat.bitsPerPixel(); }
+//    ulong  bitsPerPixelDd() { return mColorFormat.bitsPerPixelDd(); }
+    ulong  bytesPerLine() { return mpTex[0]->bytesPerLine(); }
+
+    const VBoxVHWAColorKey * dstBltCKey() const { return mpDstBltCKey; }
+    const VBoxVHWAColorKey * srcBltCKey() const { return mpSrcBltCKey; }
+    const VBoxVHWAColorKey * dstOverlayCKey() const { return mpDstOverlayCKey; }
+    const VBoxVHWAColorKey * defaultSrcOverlayCKey() const { return mpDefaultSrcOverlayCKey; }
+    const VBoxVHWAColorKey * defaultDstOverlayCKey() const { return mpDefaultDstOverlayCKey; }
+    const VBoxVHWAColorKey * srcOverlayCKey() const { return mpSrcOverlayCKey; }
+    void resetDefaultSrcOverlayCKey() { mpSrcOverlayCKey = mpDefaultSrcOverlayCKey; }
+    void resetDefaultDstOverlayCKey() { mpDstOverlayCKey = mpDefaultDstOverlayCKey; }
+
+    void setDstBltCKey(const VBoxVHWAColorKey * ckey)
+    {
+        if(ckey)
+        {
+            mDstBltCKey = *ckey;
+            mpDstBltCKey = &mDstBltCKey;
+        }
+        else
+        {
+            mpDstBltCKey = NULL;
+        }
+    }
+
+    void setSrcBltCKey(const VBoxVHWAColorKey * ckey)
+    {
+        if(ckey)
+        {
+            mSrcBltCKey = *ckey;
+            mpSrcBltCKey = &mSrcBltCKey;
+        }
+        else
+        {
+            mpSrcBltCKey = NULL;
+        }
+    }
+
+    void setDefaultDstOverlayCKey(const VBoxVHWAColorKey * ckey)
+    {
+        if(ckey)
+        {
+            mDefaultDstOverlayCKey = *ckey;
+            mpDefaultDstOverlayCKey = &mDefaultDstOverlayCKey;
+        }
+        else
+        {
+            mpDefaultDstOverlayCKey = NULL;
+        }
+    }
+
+    void setDefaultSrcOverlayCKey(const VBoxVHWAColorKey * ckey)
+    {
+        if(ckey)
+        {
+            mDefaultSrcOverlayCKey = *ckey;
+            mpDefaultSrcOverlayCKey = &mDefaultSrcOverlayCKey;
+        }
+        else
+        {
+            mpDefaultSrcOverlayCKey = NULL;
+        }
+    }
+
+    void setOverriddenDstOverlayCKey(const VBoxVHWAColorKey * ckey)
+    {
+        if(ckey)
+        {
+            mOverriddenDstOverlayCKey = *ckey;
+            mpDstOverlayCKey = &mOverriddenDstOverlayCKey;
+        }
+        else
+        {
+            mpDstOverlayCKey = NULL;
+        }
+    }
+
+    void setOverriddenSrcOverlayCKey(const VBoxVHWAColorKey * ckey)
+    {
+        if(ckey)
+        {
+            mOverriddenSrcOverlayCKey = *ckey;
+            mpSrcOverlayCKey = &mOverriddenSrcOverlayCKey;
+        }
+        else
+        {
+            mpSrcOverlayCKey = NULL;
+        }
+    }
+
+    const VBoxVHWAColorKey * getActiveSrcOverlayCKey()
+    {
+        return mpSrcOverlayCKey;
+    }
+
+    const VBoxVHWAColorKey * getActiveDstOverlayCKey(VBoxVHWASurfaceBase * pPrimary)
+    {
+        return mpDstOverlayCKey ? mpDefaultDstOverlayCKey : pPrimary->mpDstOverlayCKey;
+    }
+
+    const VBoxVHWAColorFormat & colorFormat() {return mColorFormat; }
+
+    void setAddress(uchar * addr);
+
+    const QRect& rect() const {return mRect;}
+    const QRect& srcRect() const {return mSrcRect; }
+    const QRect& targRect() const {return mTargRect; }
+    class VBoxVHWASurfList * getComplexList() {return mComplexList; }
+
+    class VBoxVHWAGlProgramMngr * getGlProgramMngr();
+    static int setCKey(class VBoxVHWAGlProgramVHWA * pProgram, const VBoxVHWAColorFormat * pFormat, const VBoxVHWAColorKey * pCKey, bool bDst);
+
+    uint32_t handle() const {return mHGHandle;}
+    void setHandle(uint32_t h) {mHGHandle = h;}
+
+    const VBoxVHWADirtyRect & getDirtyRect() { return mUpdateMem2TexRect; }
+
+    class VBoxVHWAGlProgramVHWA * getProgram(VBoxVHWASurfaceBase * pPrimary)
+    {
+        if(mVisibleDisplayInitialized)
+            return mpProgram;
+        return calcProgram(pPrimary);
+    }
+private:
+    class VBoxVHWAGlProgramVHWA * calcProgram(VBoxVHWASurfaceBase * pPrimary);
+    void setRectValues (const QRect & aTargRect, const QRect & aSrcRect);
+    void setVisibleRectValues (const QRect & aVisTargRect);
+
+    void setComplexList(VBoxVHWASurfList *aComplexList) { mComplexList = aComplexList; }
+    void initDisplay(VBoxVHWASurfaceBase *pPrimary);
+    void deleteDisplay();
+
+    int createDisplay(VBoxVHWASurfaceBase *pPrimary, GLuint *pDisplay, class VBoxVHWAGlProgramVHWA ** ppProgram);
+    void doDisplay(VBoxVHWASurfaceBase *pPrimary, bool bProgram, bool bBindDst);
+    bool synchTexMem(const QRect * aRect);
+
+    int performBlt(const QRect * pDstRect, VBoxVHWASurfaceBase * pSrcSurface, const QRect * pSrcRect, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool blt);
+
+    void doTex2FB(const QRect * pDstRect, const QRect * pSrcRect);
+    void doMultiTex2FB(const QRect * pDstRect, VBoxVHWATexture * pDstTex, const QRect * pSrcRect, int cSrcTex);
+    void doMultiTex2FB(const QRect * pDstRect, const QRect * pSrcRect, int cSrcTex);
+
+    QRect mRect; /* == Inv FB size */
+
+    QRect mSrcRect;
+    QRect mTargRect; /* == Vis FB size */
+
+    QRect mVisibleTargRect;
+    QRect mVisibleSrcRect;
+
+#ifndef VBOXVHWA_USE_TEXGROUP
+    GLuint mVisibleDisplay;
+#endif
+    class VBoxVHWAGlProgramVHWA * mpProgram;
+
+    bool mVisibleDisplayInitialized;
+    bool mNeedVisibilityReinit;
+    bool mNotIntersected;
+
+    uchar * mAddress;
+#ifdef VBOXVHWA_USE_TEXGROUP
+    VBoxVHWATextureGroup mpTex;
+#else
+    VBoxVHWATexture *mpTex[3];
+#endif
+
+    VBoxVHWAColorFormat mColorFormat;
+
+    VBoxVHWAColorKey *mpSrcBltCKey;
+    VBoxVHWAColorKey *mpDstBltCKey;
+    VBoxVHWAColorKey *mpSrcOverlayCKey;
+    VBoxVHWAColorKey *mpDstOverlayCKey;
+
+    VBoxVHWAColorKey *mpDefaultDstOverlayCKey;
+    VBoxVHWAColorKey *mpDefaultSrcOverlayCKey;
+
+    VBoxVHWAColorKey mSrcBltCKey;
+    VBoxVHWAColorKey mDstBltCKey;
+    VBoxVHWAColorKey mOverriddenSrcOverlayCKey;
+    VBoxVHWAColorKey mOverriddenDstOverlayCKey;
+    VBoxVHWAColorKey mDefaultDstOverlayCKey;
+    VBoxVHWAColorKey mDefaultSrcOverlayCKey;
+
+    int mLockCount;
+    /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock  */
+    VBoxVHWADirtyRect mUpdateMem2TexRect;
+
+    bool mFreeAddress;
+
+    class VBoxVHWASurfList *mComplexList;
+
+    class VBoxGLWidget *mWidget;
+
+    uint32_t mHGHandle;
+
+#ifdef DEBUG
+public:
+    uint64_t cFlipsCurr;
+    uint64_t cFlipsTarg;
+#endif
+    friend class VBoxVHWASurfList;
+};
+
+typedef std::list <VBoxVHWASurfaceBase*> SurfList;
+typedef std::list <VBoxVHWASurfList*> OverlayList;
+typedef std::list <struct _VBOXVHWACMD *> VHWACommandList;
+
+class VBoxVHWASurfList
+{
+public:
+
+    VBoxVHWASurfList() : mCurrent(NULL) {}
+    void add(VBoxVHWASurfaceBase *pSurf)
+    {
+        VBoxVHWASurfList * pOld = pSurf->getComplexList();
+        if(pOld)
+        {
+            pOld->remove(pSurf);
+        }
+        mSurfaces.push_back(pSurf);
+        pSurf->setComplexList(this);
+    }
+
+    void clear()
+    {
+        for (SurfList::iterator it = mSurfaces.begin();
+             it != mSurfaces.end(); ++ it)
+        {
+            (*it)->setComplexList(NULL);
+        }
+        mSurfaces.clear();
+        mCurrent = NULL;
+    }
+
+    size_t size() const {return mSurfaces.size(); }
+
+    void remove(VBoxVHWASurfaceBase *pSurf)
+    {
+        mSurfaces.remove(pSurf);
+        pSurf->setComplexList(NULL);
+        if(mCurrent == pSurf)
+            mCurrent = NULL;
+    }
+
+    bool empty() { return mSurfaces.empty(); }
+
+    void setCurrentVisible(VBoxVHWASurfaceBase *pSurf)
+    {
+        mCurrent = pSurf;
+    }
+
+    VBoxVHWASurfaceBase * current() { return mCurrent; }
+    const SurfList & surfaces() const {return mSurfaces;}
+
+private:
+
+    SurfList mSurfaces;
+    VBoxVHWASurfaceBase* mCurrent;
+};
+
+class VBoxVHWADisplay
+{
+public:
+    VBoxVHWADisplay() :
+        mSurfVGA(NULL),
+        mbDisplayPrimary(true)
+//        ,
+//        mSurfPrimary(NULL)
+    {}
+
+    VBoxVHWASurfaceBase * setVGA(VBoxVHWASurfaceBase * pVga)
+    {
+        VBoxVHWASurfaceBase * old = mSurfVGA;
+        mSurfVGA = pVga;
+        mPrimary.clear();
+        if(pVga)
+        {
+            Assert(!pVga->getComplexList());
+            mPrimary.add(pVga);
+            mPrimary.setCurrentVisible(pVga);
+        }
+//        mSurfPrimary = pVga;
+        mOverlays.clear();
+        return old;
+    }
+
+    VBoxVHWASurfaceBase * updateVGA(VBoxVHWASurfaceBase * pVga)
+    {
+        VBoxVHWASurfaceBase * old = mSurfVGA;
+        Assert(old);
+        mSurfVGA = pVga;
+        return old;
+    }
+
+    VBoxVHWASurfaceBase * getVGA() const
+    {
+        return mSurfVGA;
+    }
+
+    VBoxVHWASurfaceBase * getPrimary()
+    {
+        return mPrimary.current();
+    }
+
+    void addOverlay(VBoxVHWASurfList * pSurf)
+    {
+        mOverlays.push_back(pSurf);
+    }
+
+    void checkAddOverlay(VBoxVHWASurfList * pSurf)
+    {
+        if(!hasOverlay(pSurf))
+            addOverlay(pSurf);
+    }
+
+    bool hasOverlay(VBoxVHWASurfList * pSurf)
+    {
+        for (OverlayList::iterator it = mOverlays.begin();
+             it != mOverlays.end(); ++ it)
+        {
+            if((*it) == pSurf)
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    void removeOverlay(VBoxVHWASurfList * pSurf)
+    {
+        mOverlays.remove(pSurf);
+    }
+
+    bool performDisplay(bool bForce)
+    {
+        VBoxVHWASurfaceBase * pPrimary = mPrimary.current();
+
+        if(mbDisplayPrimary)
+        {
+#ifdef DEBUG_misha
+            /* should only display overlay now */
+            AssertBreakpoint();
+#endif
+            bForce |= pPrimary->performDisplay(NULL, bForce);
+        }
+
+        for (OverlayList::const_iterator it = mOverlays.begin();
+             it != mOverlays.end(); ++ it)
+        {
+            VBoxVHWASurfaceBase * pOverlay = (*it)->current();
+            if(pOverlay)
+            {
+                bForce |= pOverlay->performDisplay(pPrimary, bForce);
+            }
+        }
+        return bForce;
+    }
+
+    bool isPrimary(VBoxVHWASurfaceBase * pSurf) { return pSurf->getComplexList() == &mPrimary; }
+
+    void setDisplayPrimary(bool bDisplay) { mbDisplayPrimary = bDisplay; }
+
+    const OverlayList & overlays() const {return mOverlays;}
+    const VBoxVHWASurfList & primaries() const { return mPrimary; }
+
+private:
+    VBoxVHWASurfaceBase *mSurfVGA;
+    VBoxVHWASurfList mPrimary;
+
+    OverlayList mOverlays;
+
+    bool mbDisplayPrimary;
+};
+
+typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );
+
+typedef void (*PFNVBOXQGLFUNC)(void*, void*);
+
+typedef enum
+{
+    VBOXVHWA_PIPECMD_PAINT = 1,
+    VBOXVHWA_PIPECMD_VHWA,
+    VBOXVHWA_PIPECMD_OP,
+    VBOXVHWA_PIPECMD_FUNC,
+}VBOXVHWA_PIPECMD_TYPE;
+
+typedef struct VBOXVHWACALLBACKINFO
+{
+    VBoxGLWidget *pThis;
+    PFNVBOXQGLOP pfnCallback;
+    void * pContext;
+}VBOXVHWACALLBACKINFO;
+
+typedef struct VBOXVHWAFUNCCALLBACKINFO
+{
+    PFNVBOXQGLFUNC pfnCallback;
+    void * pContext1;
+    void * pContext2;
+}VBOXVHWAFUNCCALLBACKINFO;
+
+class VBoxVHWACommandElement
+{
+public:
+    void setVHWACmd(struct _VBOXVHWACMD * pCmd)
+    {
+        mType = VBOXVHWA_PIPECMD_VHWA;
+        u.mpCmd = pCmd;
+    }
+
+    void setPaintCmd(const QRect & aRect)
+    {
+        mType = VBOXVHWA_PIPECMD_PAINT;
+        mRect = aRect;
+    }
+
+    void setOp(const VBOXVHWACALLBACKINFO & aOp)
+    {
+        mType = VBOXVHWA_PIPECMD_OP;
+        u.mCallback = aOp;
+    }
+
+    void setFunc(const VBOXVHWAFUNCCALLBACKINFO & aOp)
+    {
+        mType = VBOXVHWA_PIPECMD_FUNC;
+        u.mFuncCallback = aOp;
+    }
+
+    void setData(VBOXVHWA_PIPECMD_TYPE aType, void * pvData)
+    {
+        switch(aType)
+        {
+        case VBOXVHWA_PIPECMD_PAINT:
+            setPaintCmd(*((QRect*)pvData));
+            break;
+        case VBOXVHWA_PIPECMD_VHWA:
+            setVHWACmd((struct _VBOXVHWACMD *)pvData);
+            break;
+        case VBOXVHWA_PIPECMD_OP:
+            setOp(*((VBOXVHWACALLBACKINFO *)pvData));
+            break;
+        case VBOXVHWA_PIPECMD_FUNC:
+            setFunc(*((VBOXVHWAFUNCCALLBACKINFO *)pvData));
+            break;
+        default:
+            Assert(0);
+            break;
+        }
+    }
+
+    VBOXVHWA_PIPECMD_TYPE type() const {return mType;}
+    const QRect & rect() const {return mRect;}
+    struct _VBOXVHWACMD * vhwaCmd() const {return u.mpCmd;}
+    const VBOXVHWACALLBACKINFO & op() const {return u.mCallback; }
+    const VBOXVHWAFUNCCALLBACKINFO & func() const {return u.mFuncCallback; }
+
+    VBoxVHWACommandElement * mpNext;
+private:
+    VBOXVHWA_PIPECMD_TYPE mType;
+    union
+    {
+        struct _VBOXVHWACMD * mpCmd;
+        VBOXVHWACALLBACKINFO mCallback;
+        VBOXVHWAFUNCCALLBACKINFO mFuncCallback;
+    }u;
+    QRect                 mRect;
+};
+
+class VBoxVHWACommandElementPipe
+{
+public:
+    VBoxVHWACommandElementPipe() :
+        mpFirst(NULL),
+        mpLast(NULL)
+    {}
+
+    void put(VBoxVHWACommandElement *pCmd)
+    {
+        if(mpLast)
+        {
+            Assert(mpFirst);
+            mpLast->mpNext = pCmd;
+            mpLast = pCmd;
+        }
+        else
+        {
+            Assert(!mpFirst);
+            mpFirst = pCmd;
+            mpLast = pCmd;
+        }
+        pCmd->mpNext= NULL;
+
+    }
+
+    VBoxVHWACommandElement * detachList()
+    {
+        if(mpLast)
+        {
+            VBoxVHWACommandElement * pHead = mpFirst;
+            mpFirst = NULL;
+            mpLast = NULL;
+            return pHead;
+        }
+        return NULL;
+    }
+private:
+    VBoxVHWACommandElement *mpFirst;
+    VBoxVHWACommandElement *mpLast;
+};
+
+class VBoxVHWACommandElementStack
+{
+public:
+    VBoxVHWACommandElementStack() :
+        mpFirst(NULL) {}
+
+    void push(VBoxVHWACommandElement *pCmd)
+    {
+        pCmd->mpNext = mpFirst;
+        mpFirst = pCmd;
+    }
+
+    void pusha(VBoxVHWACommandElement *pFirst, VBoxVHWACommandElement *pLast)
+    {
+        pLast->mpNext = mpFirst;
+        mpFirst = pFirst;
+    }
+
+    VBoxVHWACommandElement * pop()
+    {
+        if(mpFirst)
+        {
+            VBoxVHWACommandElement * ret = mpFirst;
+            mpFirst = ret->mpNext;
+            return ret;
+        }
+        return NULL;
+    }
+private:
+    VBoxVHWACommandElement *mpFirst;
+};
+
+#define VBOXVHWACMDPIPEC_NEWEVENT      0x00000001
+#define VBOXVHWACMDPIPEC_COMPLETEEVENT 0x00000002
+class VBoxVHWACommandElementProcessor
+{
+public:
+    VBoxVHWACommandElementProcessor(class VBoxConsoleView *aView);
+    ~VBoxVHWACommandElementProcessor();
+    void postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData, uint32_t flags);
+    void completeCurrentEvent();
+    class VBoxVHWACommandElement * detachCmdList(class VBoxVHWACommandElement * pFirst2Free, VBoxVHWACommandElement * pLast2Free);
+    void reset(class VBoxVHWACommandElement ** ppHead, class VBoxVHWACommandElement ** ppTail);
+private:
+    RTCRITSECT mCritSect;
+    class VBoxVHWACommandProcessEvent *mpFirstEvent;
+    class VBoxVHWACommandProcessEvent *mpLastEvent;
+    class VBoxConsoleView *mView;
+    bool mbNewEvent;
+    bool mbProcessingList;
+    VBoxVHWACommandElementStack mFreeElements;
+    VBoxVHWACommandElement mElementsBuffer[2048];
+};
+
+class VBoxVHWACommandsQueue
+{
+public:
+    void enqueue(PFNVBOXQGLFUNC pfn, void* pContext1, void* pContext2);
+
+    VBoxVHWACommandElement * detachList();
+
+    void freeList(VBoxVHWACommandElement * pList);
+
+private:
+    VBoxVHWACommandElementPipe mCmds;
+};
+
+class VBoxGLWidget : public QGLWidget
+{
+public:
+    VBoxGLWidget (class VBoxConsoleView *aView, QWidget *aParent);
+    ~VBoxGLWidget();
+
+    ulong vboxPixelFormat() { return mPixelFormat; }
+    bool vboxUsesGuestVRAM() { return mUsesGuestVRAM; }
+
+    uchar *vboxAddress() { return mDisplay.getVGA() ? mDisplay.getVGA()->address() : NULL; }
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    uchar *vboxVRAMAddressFromOffset(uint64_t offset);
+    uint64_t vboxVRAMOffsetFromAddress(uchar* addr);
+    uint64_t vboxVRAMOffset(VBoxVHWASurfaceBase * pSurf);
+
+    void vhwaSaveExec(struct SSMHANDLE * pSSM);
+    static void vhwaSaveExecVoid(struct SSMHANDLE * pSSM);
+    static int vhwaLoadExec(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version);
+
+    int vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd);
+    int vhwaSurfaceCreate(struct _VBOXVHWACMD_SURF_CREATE *pCmd);
+    int vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd);
+    int vhwaSurfaceLock(struct _VBOXVHWACMD_SURF_LOCK *pCmd);
+    int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd);
+    int vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd);
+    int vhwaSurfaceFlip(struct _VBOXVHWACMD_SURF_FLIP *pCmd);
+    int vhwaSurfaceOverlayUpdate(struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmf);
+    int vhwaSurfaceOverlaySetPosition(struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION *pCmd);
+    int vhwaSurfaceColorkeySet(struct _VBOXVHWACMD_SURF_COLORKEY_SET *pCmd);
+    int vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd);
+    int vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd);
+    int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
+
+    bool hasSurfaces() const;
+    bool hasVisibleOverlays();
+    QRect overlaysRectUnion();
+    QRect overlaysRectIntersection();
+#endif
+
+    int reset(VHWACommandList * pCmdList);
+
+    ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); }
+    ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : 0; }
+    int vboxFbWidth() {return mDisplay.getVGA()->width(); }
+    int vboxFbHeight() {return mDisplay.getVGA()->height(); }
+    bool vboxIsInitialized() {return mDisplay.getVGA() != NULL; }
+
+    void vboxDoResize(void *re);
+
+//    void vboxPaintEvent (QPaintEvent *pe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoPaint, pe); }
+    void vboxResizeEvent (class VBoxResizeEvent *re) {vboxPerformGLOp(&VBoxGLWidget::vboxDoResize, re); }
+
+    void vboxProcessVHWACommands(class VBoxVHWACommandElementProcessor * pPipe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoProcessVHWACommands, pPipe);}
+
+    class VBoxVHWAGlProgramMngr * vboxVHWAGetGlProgramMngr() { return mpMngr; }
+
+    VBoxVHWASurfaceBase * vboxGetVGASurface() { return mDisplay.getVGA(); }
+
+#ifdef VBOXVHWA_OLD_COORD
+    static void doSetupMatrix(const QSize & aSize, bool bInverted);
+#endif
+
+    void vboxDoUpdateViewport(const QRect & aRect);
+    void vboxDoUpdateRect(const QRect * pRect);
+
+    const QRect & vboxViewport() const {return mViewport;}
+
+#ifdef VBOXVHWA_PROFILE_FPS
+    void reportNewFrame() { mbNewFrame = true; }
+#endif
+
+    bool performDisplayAndSwap(bool bForce)
+    {
+//    	VBOXQGLLOG_METHODTIME("t:");
+
+    	bForce = mDisplay.performDisplay(bForce | mRepaintNeeded);
+        if(bForce)
+        {
+            swapBuffers();
+        }
+
+#ifdef VBOXVHWA_PROFILE_FPS
+        if(mbNewFrame)
+        {
+            mFPSCounter.frame();
+            double fps = mFPSCounter.fps();
+            if(!(mFPSCounter.frames() % 31))
+            {
+                printf("fps: %f\n", fps);
+            }
+            mbNewFrame = false;
+        }
+#endif
+        return bForce;
+    }
+
+    VHWACommandList &onResizeCmdList() { return mOnResizeCmdList; }
+protected:
+
+    void paintGL()
+    {
+        if(mpfnOp)
+        {
+            (this->*mpfnOp)(mOpContext);
+            mpfnOp = NULL;
+        }
+        VBOXQGLLOG(("paintGL\n"));
+//        else
+//        {
+            mDisplay.performDisplay(true);
+//        }
+    }
+
+    void initializeGL();
+
+private:
+    static void setupMatricies(const QSize &display);
+    static void adjustViewport(const QSize &display, const QRect &viewport);
+//    void vboxDoPaint(void *rec);
+
+
+#ifdef VBOXQGL_DBG_SURF
+    void vboxDoTestSurfaces(void *context);
+#endif
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    void vboxDoVHWACmdExec(void *cmd);
+    void vboxDoVHWACmdAndFree(void *cmd);
+    void vboxDoVHWACmd(void *cmd);
+
+    void vboxCheckUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset)
+    {
+        if (pSurface->addressAlocated())
+        {
+            uchar * addr = vboxVRAMAddressFromOffset(offset);
+            if(addr)
+            {
+                pSurface->setAddress(addr);
+            }
+        }
+    }
+
+    int vhwaSaveSurface(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, uint32_t surfCaps);
+    static int vhwaLoadSurface(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t cBackBuffers, uint32_t u32Version);
+    int vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, bool bVisible);
+    static int vhwaLoadOverlayData(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version);
+    static int vhwaLoadVHWAEnable(VHWACommandList * pCmdList);
+
+    void vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd);
+#endif
+    static const QGLFormat & vboxGLFormat();
+
+    VBoxVHWADisplay mDisplay;
+
+
+    /* we do all opengl stuff in the paintGL context,
+     * submit the operation to be performed
+     * @todo: could be moved outside the updateGL */
+    void vboxPerformGLOp(PFNVBOXQGLOP pfn, void* pContext)
+    {
+        mpfnOp = pfn;
+        mOpContext = pContext;
+        updateGL();
+    }
+
+//    /* posts op to UI thread */
+//    int vboxExecOpSynch(PFNVBOXQGLOP pfn, void* pContext);
+//    void vboxExecOnResize(PFNVBOXQGLOP pfn, void* pContext);
+
+    void vboxDoProcessVHWACommands(void *pContext);
+
+    class VBoxVHWACommandElement * processCmdList(class VBoxVHWACommandElement * pCmd);
+
+    VBoxVHWASurfaceBase* handle2Surface(uint32_t h)
+    {
+        VBoxVHWASurfaceBase* pSurf = (VBoxVHWASurfaceBase*)mSurfHandleTable.get(h);
+        Assert(pSurf);
+        return pSurf;
+    }
+
+    VBoxVHWAHandleTable mSurfHandleTable;
+
+    PFNVBOXQGLOP mpfnOp;
+    void *mOpContext;
+
+    ulong  mPixelFormat;
+    bool   mUsesGuestVRAM;
+
+    bool mRepaintNeeded;
+
+//    bool   mbVGASurfCreated;
+    QRect mViewport;
+
+    class VBoxConsoleView *mView;
+
+    VBoxVHWASurfList *mConstructingList;
+    int32_t mcRemaining2Contruct;
+
+    /* this is used in saved state restore to postpone surface restoration
+     * till the framebuffer size is restored */
+    VHWACommandList mOnResizeCmdList;
+
+    class VBoxVHWAGlProgramMngr *mpMngr;
+
+#ifdef VBOXVHWA_PROFILE_FPS
+    VBoxVHWADbgTimer mFPSCounter;
+    bool mbNewFrame;
+#endif
+};
+
+
+//typedef enum
+//{
+//    VBOXFBOVERLAY_DONE = 1,
+//    VBOXFBOVERLAY_MODIFIED,
+//    VBOXFBOVERLAY_UNTOUCHED
+//} VBOXFBOVERLAY_RESUT;
+
+class VBoxQGLOverlay
+{
+public:
+    VBoxQGLOverlay (class VBoxConsoleView *aView, class VBoxFrameBuffer * aContainer);
+
+    int onVHWACommand(struct _VBOXVHWACMD * pCommand);
+
+    void onVHWACommandEvent(QEvent * pEvent);
+
+    /**
+     * to be called on NotifyUpdate framebuffer call
+     * @return true if the request was processed & should not be forwarded to the framebuffer
+     * false - otherwise */
+    bool onNotifyUpdate (ULONG aX, ULONG aY,
+                             ULONG aW, ULONG aH);
+
+    /**
+     * to be called on RequestResize framebuffer call
+     * @return true if the request was processed & should not be forwarded to the framebuffer
+     * false - otherwise */
+    bool onRequestResize (ULONG /*aScreenId*/, ULONG /*aPixelFormat*/,
+                          BYTE * /*aVRAM*/, ULONG /*aBitsPerPixel*/, ULONG /*aBytesPerLine*/,
+                          ULONG /*aWidth*/, ULONG /*aHeight*/,
+                          BOOL * /*aFinished*/)
+    {
+        mCmdPipe.completeCurrentEvent();
+        return false;
+    }
+
+//    VBOXFBOVERLAY_RESUT onPaintEvent (const QPaintEvent *pe, QRect *pRect);
+
+    void onResizeEvent (const class VBoxResizeEvent *re);
+    void onResizeEventPostprocess (const class VBoxResizeEvent *re);
+
+    void onViewportResized(QResizeEvent * /*re*/)
+    {
+        vboxDoCheckUpdateViewport();
+        mGlCurrent = false;
+    }
+
+    void onViewportScrolled(int /*dx*/, int /*dy*/)
+    {
+        vboxDoCheckUpdateViewport();
+        mGlCurrent = false;
+    }
+
+    static bool isAcceleration2DVideoAvailable();
+
+    /** additional video memory required for the best 2D support performance
+     *  total amount of VRAM required is thus calculated as requiredVideoMemory + required2DOffscreenVideoMemory  */
+    static quint64 required2DOffscreenVideoMemory();
+
+    /* not supposed to be called by clients */
+    int vhwaLoadExec(struct SSMHANDLE * pSSM, uint32_t u32Version);
+    void vhwaSaveExec(struct SSMHANDLE * pSSM);
+private:
+    int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd);
+
+    void repaintMain();
+    void repaintOverlay()
+    {
+        if(mNeedOverlayRepaint)
+        {
+            mNeedOverlayRepaint = false;
+            performDisplayOverlay();
+        }
+        if(mNeedSetVisible)
+        {
+            mNeedSetVisible = false;
+            mpOverlayWidget->setVisible(true);
+        }
+    }
+    void repaint()
+    {
+        repaintOverlay();
+        repaintMain();
+    }
+
+    void makeCurrent()
+    {
+        if(!mGlCurrent)
+        {
+            mGlCurrent = true;
+            mpOverlayWidget->makeCurrent();
+        }
+    }
+
+    void performDisplayOverlay()
+    {
+        if(mOverlayVisible)
+        {
+#if 0
+            mpOverlayWidget->updateGL();
+#else
+            makeCurrent();
+            mpOverlayWidget->performDisplayAndSwap(false);
+#endif
+        }
+    }
+
+//    void vboxOpExit()
+//    {
+//        performDisplayOverlay();
+//        mGlCurrent = false;
+//    }
+
+
+    void vboxSetGlOn(bool on);
+    bool vboxGetGlOn() { return mGlOn; }
+    bool vboxSynchGl();
+    void vboxDoVHWACmdExec(void *cmd);
+    void vboxShowOverlay(bool show);
+    void vboxDoCheckUpdateViewport();
+    void vboxDoVHWACmd(void *cmd);
+    void addMainDirtyRect(const QRect & aRect);
+//    void vboxUpdateOverlayPosition(const QPoint & pos);
+    void vboxCheckUpdateOverlay(const QRect & rect);
+    VBoxVHWACommandElement * processCmdList(VBoxVHWACommandElement * pCmd);
+
+    int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
+
+    int reset();
+
+    int resetGl();
+	
+    void initGl();
+
+    VBoxGLWidget *mpOverlayWidget;
+    class VBoxConsoleView *mView;
+    class VBoxFrameBuffer *mContainer;
+    bool mGlOn;
+    bool mOverlayWidgetVisible;
+    bool mOverlayVisible;
+    bool mGlCurrent;
+    bool mProcessingCommands;
+    bool mNeedOverlayRepaint;
+    bool mNeedSetVisible;
+    QRect mOverlayViewport;
+    VBoxVHWADirtyRect mMainDirtyRect;
+
+    VBoxVHWACommandElementProcessor mCmdPipe;
+
+    /* this is used in saved state restore to postpone surface restoration
+     * till the framebuffer size is restored */
+    VHWACommandList mOnResizeCmdList;
+};
+
+
+template <class T>
+class VBoxOverlayFrameBuffer : public T
+{
+public:
+    VBoxOverlayFrameBuffer (class VBoxConsoleView *aView)
+        : T(aView),
+          mOverlay(aView, this)
+    {}
+
+
+    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
+    {
+        return mOverlay.onVHWACommand((struct _VBOXVHWACMD*)pCommand);
+    }
+
+    void doProcessVHWACommand(QEvent * pEvent)
+    {
+        mOverlay.onVHWACommandEvent(pEvent);
+    }
+
+    STDMETHOD(RequestResize) (ULONG aScreenId, ULONG aPixelFormat,
+                              BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine,
+                              ULONG aWidth, ULONG aHeight,
+                              BOOL *aFinished)
+   {
+        if(mOverlay.onRequestResize (aScreenId, aPixelFormat,
+                aVRAM, aBitsPerPixel, aBytesPerLine,
+                aWidth, aHeight,
+                aFinished))
+        {
+            return S_OK;
+        }
+        return T::RequestResize (aScreenId, aPixelFormat,
+                aVRAM, aBitsPerPixel, aBytesPerLine,
+                aWidth, aHeight,
+                aFinished);
+   }
+
+    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
+                             ULONG aW, ULONG aH)
+    {
+        if(mOverlay.onNotifyUpdate(aX, aY, aW, aH))
+            return S_OK;
+        return T::NotifyUpdate(aX, aY, aW, aH);
+    }
+
+//    void paintEvent (QPaintEvent *pe)
+//    {
+//        QRect rect;
+//        VBOXFBOVERLAY_RESUT res = mOverlay.onPaintEvent(pe, &rect);
+//        switch(res)
+//        {
+//            case VBOXFBOVERLAY_MODIFIED:
+//            {
+//                QPaintEvent modified(rect);
+//                T::paintEvent(&modified);
+//            } break;
+//            case VBOXFBOVERLAY_UNTOUCHED:
+//                T::paintEvent(pe);
+//                break;
+//            default:
+//                break;
+//        }
+//    }
+
+    void resizeEvent (VBoxResizeEvent *re)
+    {
+        mOverlay.onResizeEvent(re);
+        T::resizeEvent(re);
+        mOverlay.onResizeEventPostprocess(re);
+    }
+
+    void viewportResized(QResizeEvent * re)
+    {
+        mOverlay.onViewportResized(re);
+        T::viewportResized(re);
+    }
+
+    void viewportScrolled(int dx, int dy)
+    {
+        mOverlay.onViewportScrolled(dx, dy);
+        T::viewportScrolled(dx, dy);
+    }
+private:
+    VBoxQGLOverlay mOverlay;
+};
+
+#endif
+
+#endif /* #ifndef __VBoxFBOverlay_h__ */
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlayCommon.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlayCommon.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlayCommon.h	(revision 25171)
@@ -0,0 +1,108 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxFrameBuffer Overly classes declarations
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+#ifndef __VBoxFBOverlayCommon_h__
+#define __VBoxFBOverlayCommon_h__
+
+#if defined(DEBUG) && !defined(DEBUG_sandervl) && !defined(DEBUG_bird)
+# include "iprt/stream.h"
+# define VBOXQGLLOG(_m) RTPrintf _m
+# define VBOXQGLLOGREL(_m) do { RTPrintf _m ; LogRel( _m ); } while(0)
+#else
+# define VBOXQGLLOG(_m)    do {}while(0)
+# define VBOXQGLLOGREL(_m) LogRel( _m )
+#endif
+#define VBOXQGLLOG_ENTER(_m)
+//do{VBOXQGLLOG(("==>[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
+#define VBOXQGLLOG_EXIT(_m)
+//do{VBOXQGLLOG(("<==[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
+#ifdef DEBUG
+ #define VBOXQGL_ASSERTNOERR() \
+    do { GLenum err = glGetError(); \
+        if(err != GL_NO_ERROR) VBOXQGLLOG(("gl error ocured (0x%x)\n", err)); \
+        Assert(err == GL_NO_ERROR); \
+    }while(0)
+
+ #define VBOXQGL_CHECKERR(_op) \
+    do { \
+        glGetError(); \
+        _op \
+        VBOXQGL_ASSERTNOERR(); \
+    }while(0)
+#else
+ #define VBOXQGL_ASSERTNOERR() \
+    do {}while(0)
+
+ #define VBOXQGL_CHECKERR(_op) \
+    do { \
+        _op \
+    }while(0)
+#endif
+
+#ifdef DEBUG
+#include <iprt/time.h>
+
+#define VBOXGETTIME() RTTimeNanoTS()
+
+#define VBOXPRINTDIF(_nano, _m) do{\
+        uint64_t cur = VBOXGETTIME(); \
+        VBOXQGLLOG(_m); \
+        VBOXQGLLOG(("(%Lu)\n", cur - (_nano))); \
+    }while(0)
+
+class VBoxVHWADbgTimeCounter
+{
+public:
+    VBoxVHWADbgTimeCounter(const char* msg) {mTime = VBOXGETTIME(); mMsg=msg;}
+    ~VBoxVHWADbgTimeCounter() {VBOXPRINTDIF(mTime, (mMsg));}
+private:
+    uint64_t mTime;
+    const char* mMsg;
+};
+
+#define VBOXQGLLOG_METHODTIME(_m) VBoxVHWADbgTimeCounter _dbgTimeCounter(_m)
+
+#define VBOXQG_CHECKCONTEXT() \
+        { \
+            const GLubyte * str; \
+            VBOXQGL_CHECKERR(   \
+                    str = glGetString(GL_VERSION); \
+            ); \
+            Assert(str); \
+            if(str) \
+            { \
+                Assert(str[0]); \
+            } \
+        }
+#else
+#define VBOXQGLLOG_METHODTIME(_m)
+#define VBOXQG_CHECKCONTEXT() do{}while(0)
+#endif
+
+#define VBOXQGLLOG_QRECT(_p, _pr, _s) do{\
+    VBOXQGLLOG((_p " x(%d), y(%d), w(%d), h(%d)" _s, (_pr)->x(), (_pr)->y(), (_pr)->width(), (_pr)->height()));\
+    }while(0)
+
+#define VBOXQGLLOG_CKEY(_p, _pck, _s) do{\
+    VBOXQGLLOG((_p " l(0x%x), u(0x%x)" _s, (_pck)->lower(), (_pck)->upper()));\
+    }while(0)
+
+#endif /* #ifndef __VBoxFBOverlayCommon_h__ */
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxFilePathSelectorWidget.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxFilePathSelectorWidget.cpp	(revision 25170)
+++ 	(revision )
@@ -1,759 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: VBoxFilePathSelectorWidget class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxFilePathSelectorWidget.h"
-#include "VBoxGlobal.h"
-#include "QIFileDialog.h"
-#include "QILabel.h"
-#include "QILineEdit.h"
-
-/* Qt includes */
-#include <QAction>
-#include <QApplication>
-#include <QClipboard>
-#include <QDir>
-#include <QFileIconProvider>
-#include <QFocusEvent>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QTimer>
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxFilePathSelectorWidget
-
-enum
-{
-    PathId = 0,
-    SelectId,
-    ResetId
-};
-
-/**
- * Returns first position of difference between passed strings.
- */
-static int differFrom (const QString &aS1, const QString &aS2)
-{
-    if (aS1 == aS2)
-        return -1;
-
-    int minLength = qMin (aS1.size(), aS2.size());
-    int index = 0;
-    for (index = 0; index < minLength ; ++ index)
-        if (aS1 [index] != aS2 [index])
-            break;
-    return index;
-}
-
-VBoxFilePathSelectorWidget::VBoxFilePathSelectorWidget (QWidget *aParent)
-    : QIWithRetranslateUI<QComboBox> (aParent)
-    , mIconProvider (new QFileIconProvider())
-    , mCopyAction (new QAction (this))
-    , mMode (Mode_Folder)
-    , mHomeDir (QDir::current().absolutePath())
-    , mIsEditable (true)
-    , mIsEditableMode (false)
-    , mIsMouseAwaited (false)
-    , mModified (false)
-{
-    /* Populate items */
-    insertItem (PathId, "");
-    insertItem (SelectId, "");
-    insertItem (ResetId, "");
-
-    /* Attaching known icons */
-    setItemIcon (SelectId, VBoxGlobal::iconSet (":/select_file_16px.png"));
-    setItemIcon (ResetId, VBoxGlobal::iconSet (":/eraser_16px.png"));
-
-    /* Setup context menu */
-    addAction (mCopyAction);
-    mCopyAction->setShortcut (QKeySequence (QKeySequence::Copy));
-    mCopyAction->setShortcutContext (Qt::WidgetShortcut);
-
-    /* Initial Setup */
-    setInsertPolicy (QComboBox::NoInsert);
-    setContextMenuPolicy (Qt::ActionsContextMenu);
-    setMinimumWidth (200);
-
-    /* Setup connections */
-    connect (this, SIGNAL (activated (int)), this, SLOT (onActivated (int)));
-    connect (mCopyAction, SIGNAL (triggered (bool)), this, SLOT (copyToClipboard()));
-
-    /* Editable by default */
-    setEditable (true);
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-VBoxFilePathSelectorWidget::~VBoxFilePathSelectorWidget()
-{
-    delete mIconProvider;
-}
-
-void VBoxFilePathSelectorWidget::setMode (Mode aMode)
-{
-    mMode = aMode;
-}
-
-VBoxFilePathSelectorWidget::Mode VBoxFilePathSelectorWidget::mode() const
-{
-    return mMode;
-}
-
-void VBoxFilePathSelectorWidget::setEditable (bool aOn)
-{
-    mIsEditable = aOn;
-
-    if (mIsEditable)
-    {
-        QComboBox::setEditable (true);
-        Assert (lineEdit());
-        connect (lineEdit(), SIGNAL (textEdited (const QString &)),
-                 this, SLOT (onTextEdited (const QString &)));
-
-        /* Installing necessary event filters */
-        lineEdit()->installEventFilter (this);
-    }else
-    {
-        if (lineEdit())
-        {
-            /* Installing necessary event filters */
-            lineEdit()->installEventFilter (this);
-            disconnect (lineEdit(), SIGNAL (textEdited (const QString &)),
-                        this, SLOT (onTextEdited (const QString &)));
-        }
-        QComboBox::setEditable (false);
-    }
-}
-
-bool VBoxFilePathSelectorWidget::isEditable() const
-{
-    return mIsEditable;
-}
-
-void VBoxFilePathSelectorWidget::setResetEnabled (bool aEnabled)
-{
-    if (!aEnabled && count() - 1 == ResetId)
-        removeItem (ResetId);
-    else if (aEnabled && count() - 1 == ResetId - 1)
-    {
-        insertItem (ResetId, "");
-        setItemIcon (ResetId, VBoxGlobal::iconSet (":/eraser_16px.png"));
-    }
-    retranslateUi();
-}
-
-bool VBoxFilePathSelectorWidget::isResetEnabled() const
-{
-    return (count() - 1  == ResetId);
-}
-
-void VBoxFilePathSelectorWidget::resetModified()
-{
-    mModified = false;
-}
-
-bool VBoxFilePathSelectorWidget::isModified() const
-{
-    return mModified;
-}
-
-void VBoxFilePathSelectorWidget::setFileDialogTitle (const QString& aTitle)
-{
-    mFileDialogTitle = aTitle;
-}
-
-QString VBoxFilePathSelectorWidget::fileDialogTitle() const
-{
-    return mFileDialogTitle;
-}
-
-void VBoxFilePathSelectorWidget::setFileFilters (const QString& aFilters)
-{
-    mFileFilters = aFilters;
-}
-
-QString VBoxFilePathSelectorWidget::fileFilters() const
-{
-    return mFileFilters;
-}
-
-void VBoxFilePathSelectorWidget::setDefaultSaveExt (const QString &aExt)
-{
-    mDefaultSaveExt = aExt;
-}
-
-QString VBoxFilePathSelectorWidget::defaultSaveExt() const
-{
-    return mDefaultSaveExt;
-}
-
-/**
- * Returns @c true if the selected (active) combobox item is a path item.
- *
- * May be used in @c activated() signal handlers to distinguish between
- * non-path items like "Other..." or "Reset" that get temporarily activated
- * when performing the corresponding actiojn and the item that contains a
- * real selected file/folder path.
- */
-bool VBoxFilePathSelectorWidget::isPathSelected() const
-{
-    return (currentIndex() == PathId);
-}
-
-QString VBoxFilePathSelectorWidget::path() const
-{
-    return mPath;
-}
-
-void VBoxFilePathSelectorWidget::setPath (const QString &aPath, bool aRefreshText /* = true */)
-{
-    mPath = aPath.isEmpty() ? QString::null :
-            QDir::toNativeSeparators (aPath);
-    if (aRefreshText)
-        refreshText();
-}
-
-void VBoxFilePathSelectorWidget::setHomeDir (const QString &aHomeDir)
-{
-    mHomeDir = aHomeDir;
-}
-
-void VBoxFilePathSelectorWidget::resizeEvent (QResizeEvent *aEvent)
-{
-    QIWithRetranslateUI<QComboBox>::resizeEvent (aEvent);
-    refreshText();
-}
-
-void VBoxFilePathSelectorWidget::focusInEvent (QFocusEvent *aEvent)
-{
-    if (isPathSelected())
-    {
-        if (mIsEditable)
-            mIsEditableMode = true;
-        if (aEvent->reason() == Qt::MouseFocusReason)
-            mIsMouseAwaited = true;
-        else
-            refreshText();
-    }
-    QIWithRetranslateUI<QComboBox>::focusInEvent (aEvent);
-}
-
-void VBoxFilePathSelectorWidget::focusOutEvent (QFocusEvent *aEvent)
-{
-    if (isPathSelected())
-    {
-        mIsEditableMode = false;
-        refreshText();
-    }
-    QIWithRetranslateUI<QComboBox>::focusOutEvent (aEvent);
-}
-
-bool VBoxFilePathSelectorWidget::eventFilter (QObject *aObj, QEvent *aEv)
-{
-    if (mIsMouseAwaited && (aEv->type() == QEvent::MouseButtonPress))
-        QTimer::singleShot (0, this, SLOT (refreshText()));
-
-    return QIWithRetranslateUI<QComboBox>::eventFilter (aObj, aEv);
-}
-
-void VBoxFilePathSelectorWidget::retranslateUi()
-{
-    /* How do we interpret the "nothing selected" item? */
-    if (isResetEnabled())
-    {
-        mNoneStr = tr ("<reset to default>");
-        mNoneTip = tr ("The actual default path value will be displayed after "
-                       "accepting the changes and opening this dialog again.");
-    }
-    else
-    {
-        mNoneStr = tr ("<not selected>");
-        mNoneTip = tr ("Please use the <b>Other...</b> item from the drop-down "
-                       "list to select a path.");
-    }
-
-    /* Retranslate 'path' item */
-    if (mPath.isNull())
-    {
-        setItemText (PathId, mNoneStr);
-        setItemData (PathId, mNoneTip, Qt::ToolTipRole);
-        setToolTip (mNoneTip);
-    }
-
-    /* Retranslate 'select' item */
-    setItemText (SelectId, tr ("Other..."));
-
-    /* Retranslate 'reset' item */
-    if (count() - 1 == ResetId)
-        setItemText (ResetId, tr ("Reset"));
-
-    /* Set tooltips of the above two items based on the mode */
-    switch (mMode)
-    {
-        case Mode_Folder:
-            setItemData (SelectId,
-                         tr ("Opens a dialog to select a different folder."),
-                         Qt::ToolTipRole);
-            setItemData (ResetId,
-                         tr ("Resets the folder path to the default value."),
-                         Qt::ToolTipRole);
-            break;
-        case Mode_File_Open:
-        case Mode_File_Save:
-            setItemData (SelectId,
-                         tr ("Opens a dialog to select a different file."),
-                         Qt::ToolTipRole);
-            setItemData (ResetId,
-                         tr ("Resets the file path to the default value."),
-                         Qt::ToolTipRole);
-            break;
-        default:
-            AssertFailedBreak();
-    }
-
-    /* Retranslate copy action */
-    mCopyAction->setText (tr ("&Copy"));
-}
-
-void VBoxFilePathSelectorWidget::onActivated (int aIndex)
-{
-    switch (aIndex)
-    {
-        case SelectId:
-        {
-            selectPath();
-            break;
-        }
-        case ResetId:
-        {
-            changePath (QString::null);
-            break;
-        }
-        default:
-            break;
-    }
-    setCurrentIndex (PathId);
-    setFocus();
-}
-
-void VBoxFilePathSelectorWidget::onTextEdited (const QString &aPath)
-{
-    changePath (aPath, false /* refresh text? */);
-}
-
-void VBoxFilePathSelectorWidget::copyToClipboard()
-{
-    QString text (fullPath());
-    /* Copy the current text to the selection and global clipboard. */
-    if (QApplication::clipboard()->supportsSelection())
-        QApplication::clipboard()->setText (text, QClipboard::Selection);
-    QApplication::clipboard()->setText (text, QClipboard::Clipboard);
-}
-
-void VBoxFilePathSelectorWidget::changePath (const QString &aPath,
-                                             bool aRefreshText /* = true */)
-{
-    QString oldPath = mPath;
-    setPath (aPath, aRefreshText);
-    if (!mModified && mPath != oldPath)
-        mModified = true;
-    emit pathChanged (aPath);
-}
-
-void VBoxFilePathSelectorWidget::selectPath()
-{
-    /* Preparing initial directory. */
-    QString initDir = mPath.isNull() ? mHomeDir :
-        QIFileDialog::getFirstExistingDir (mPath);
-    if (initDir.isNull())
-        initDir = mHomeDir;
-
-    QString selPath;
-    switch (mMode)
-    {
-        case Mode_File_Open:
-            selPath = QIFileDialog::getOpenFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle); break;
-        case Mode_File_Save:
-            {
-                selPath = QIFileDialog::getSaveFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle);
-                if (!selPath.isEmpty() && QFileInfo (selPath).suffix().isEmpty())
-                    selPath = QString ("%1.%2").arg (selPath).arg (mDefaultSaveExt);
-                break;
-            }
-        case Mode_Folder:
-            selPath = QIFileDialog::getExistingDirectory (initDir, parentWidget(), mFileDialogTitle); break;
-    }
-
-    if (selPath.isNull())
-        return;
-
-    selPath.remove (QRegExp ("[\\\\/]$"));
-    changePath (selPath);
-}
-
-QIcon VBoxFilePathSelectorWidget::defaultIcon() const
-{
-    if (mMode == Mode_Folder)
-        return mIconProvider->icon (QFileIconProvider::Folder);
-    else
-        return mIconProvider->icon (QFileIconProvider::File);
-}
-
-QString VBoxFilePathSelectorWidget::fullPath (bool aAbsolute /* = true */) const
-{
-    if (mPath.isNull())
-        return mPath;
-
-    QString result;
-    switch (mMode)
-    {
-        case Mode_Folder:
-            result = aAbsolute ? QDir (mPath).absolutePath() :
-                                 QDir (mPath).path();
-            break;
-        case Mode_File_Open:
-        case Mode_File_Save:
-            result = aAbsolute ? QFileInfo (mPath).absoluteFilePath() :
-                                 QFileInfo (mPath).filePath();
-            break;
-        default:
-            AssertFailedBreak();
-    }
-    return QDir::toNativeSeparators (result);
-}
-
-QString VBoxFilePathSelectorWidget::shrinkText (int aWidth) const
-{
-    QString fullText (fullPath (false));
-    if (fullText.isEmpty())
-        return fullText;
-
-    int oldSize = fontMetrics().width (fullText);
-    int indentSize = fontMetrics().width ("x...x");
-
-    /* Compress text */
-    int start = 0;
-    int finish = 0;
-    int position = 0;
-    int textWidth = 0;
-    do {
-        textWidth = fontMetrics().width (fullText);
-        if (textWidth + indentSize > aWidth)
-        {
-            start = 0;
-            finish = fullText.length();
-
-            /* Selecting remove position */
-            QRegExp regExp ("([\\\\/][^\\\\^/]+[\\\\/]?$)");
-            int newFinish = regExp.indexIn (fullText);
-            if (newFinish != -1)
-                finish = newFinish;
-            position = (finish - start) / 2;
-
-            if (position == finish)
-               break;
-
-            fullText.remove (position, 1);
-        }
-    } while (textWidth + indentSize > aWidth);
-
-    fullText.insert (position, "...");
-    int newSize = fontMetrics().width (fullText);
-
-    return newSize < oldSize ? fullText : fullPath (false);
-}
-
-void VBoxFilePathSelectorWidget::refreshText()
-{
-    if (mIsEditable && mIsEditableMode)
-    {
-        /* Cursor positioning variables */
-        int curPos = -1;
-        int diffPos = -1;
-        int fromRight = -1;
-
-        if (mIsMouseAwaited)
-        {
-            /* Store the cursor position */
-            curPos = lineEdit()->cursorPosition();
-            diffPos = differFrom (lineEdit()->text(), mPath);
-            fromRight = lineEdit()->text().size() - curPos;
-        }
-
-        /* In editable mode there should be no any icon
-         * and text have be corresponding real stored path
-         * which can be absolute or relative. */
-        if (lineEdit()->text() != mPath)
-            setItemText (PathId, mPath);
-        setItemIcon (PathId, QIcon());
-        setToolTip (mMode == Mode_Folder ?
-            tr ("Please type the folder path here.") :
-            tr ("Please type the file path here."));
-
-        if (mIsMouseAwaited)
-        {
-            mIsMouseAwaited = false;
-
-            /* Restore the position to the right of dots */
-            if (diffPos != -1 && curPos >= diffPos + 3)
-                lineEdit()->setCursorPosition (lineEdit()->text().size() -
-                                               fromRight);
-            /* Restore the position to the center of text */
-            else if (diffPos != -1 && curPos > diffPos)
-                lineEdit()->setCursorPosition (lineEdit()->text().size() / 2);
-            /* Restore the position to the left of dots */
-            else
-                lineEdit()->setCursorPosition (curPos);
-        }
-    }
-    else if (mPath.isNull())
-    {
-        /* If we are not in editable mode and no path is
-         * stored here - show the translated 'none' string. */
-        if (itemText (PathId) != mNoneStr)
-        {
-            setItemText (PathId, mNoneStr);
-            setItemIcon (PathId, QIcon());
-            setItemData (PathId, mNoneTip, Qt::ToolTipRole);
-            setToolTip (mNoneTip);
-        }
-    }
-    else
-    {
-        /* Compress text in combobox */
-        QStyleOptionComboBox options;
-        options.initFrom (this);
-        QRect rect = QApplication::style()->subControlRect (
-            QStyle::CC_ComboBox, &options, QStyle::SC_ComboBoxEditField);
-        setItemText (PathId, shrinkText (rect.width() - iconSize().width()));
-
-        /* Attach corresponding icon */
-        setItemIcon (PathId, QFileInfo (mPath).exists() ?
-                             mIconProvider->icon (QFileInfo (mPath)) :
-                             defaultIcon());
-
-        /* Set the tooltip */
-        setToolTip (fullPath());
-        setItemData (PathId, toolTip(), Qt::ToolTipRole);
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxEmptyFileSelector
-
-VBoxEmptyFileSelector::VBoxEmptyFileSelector (QWidget *aParent /* = NULL */)
-    : QIWithRetranslateUI<QWidget> (aParent)
-    , mPathWgt (NULL)
-    , mLabel (NULL)
-    , mMode (VBoxFilePathSelectorWidget::Mode_File_Open)
-    , mLineEdit (NULL)
-    , mHomeDir (QDir::current().absolutePath())
-    , mIsModified (false)
-{
-    mMainLayout = new QHBoxLayout (this);
-    mMainLayout->setMargin (0);
-
-    mSelectButton = new QPushButton (this);
-    connect (mSelectButton, SIGNAL (clicked()),
-             this, SLOT (choose()));
-
-    mMainLayout->addWidget (mSelectButton);
-
-    setEditable (false);
-
-    retranslateUi();
-}
-
-void VBoxEmptyFileSelector::setMode (VBoxFilePathSelectorWidget::Mode aMode)
-{
-    mMode = aMode;
-}
-
-VBoxFilePathSelectorWidget::Mode VBoxEmptyFileSelector::mode() const
-{
-    return mMode;
-}
-
-void VBoxEmptyFileSelector::setButtonPosition (ButtonPosition aPos)
-{
-    if (aPos == LeftPosition)
-    {
-        mMainLayout->setDirection (QBoxLayout::LeftToRight);
-        setTabOrder (mSelectButton, mPathWgt);
-    }
-    else
-    {
-        mMainLayout->setDirection (QBoxLayout::RightToLeft);
-        setTabOrder (mPathWgt, mSelectButton);
-    }
-}
-
-VBoxEmptyFileSelector::ButtonPosition VBoxEmptyFileSelector::buttonPosition() const
-{
-    return mMainLayout->direction() == QBoxLayout::LeftToRight ? LeftPosition : RightPosition;
-}
-
-void VBoxEmptyFileSelector::setEditable (bool aOn)
-{
-    if (mPathWgt)
-    {
-        delete mPathWgt;
-        mLabel = NULL;
-        mLineEdit = NULL;
-    }
-
-    if (aOn)
-    {
-        mPathWgt = mLineEdit = new QILineEdit (this);
-        connect (mLineEdit, SIGNAL (textChanged (const QString&)),
-                 this, SLOT (textChanged (const QString&)));
-    }
-    else
-    {
-        mPathWgt = mLabel = new QILabel (this);
-        mLabel->setWordWrap (true);
-    }
-    mMainLayout->addWidget (mPathWgt, 2);
-    setButtonPosition (buttonPosition());
-
-    setPath (mPath);
-}
-
-bool VBoxEmptyFileSelector::isEditable() const
-{
-    return mLabel ? false : true;
-}
-
-void VBoxEmptyFileSelector::setChooserVisible (bool aOn)
-{
-    mSelectButton->setVisible (aOn);
-}
-
-bool VBoxEmptyFileSelector::isChooserVisible() const
-{
-    return mSelectButton->isVisible();
-}
-
-void VBoxEmptyFileSelector::setPath (const QString& aPath)
-{
-	QString tmpPath = QDir::toNativeSeparators (aPath);
-    if (mLabel)
-        mLabel->setText (QString ("<compact elipsis=\"start\">%1</compact>").arg (tmpPath));
-    else if (mLineEdit)
-        mLineEdit->setText (tmpPath);
-    textChanged(tmpPath);
-}
-
-QString VBoxEmptyFileSelector::path() const
-{
-    return mPath;
-}
-
-void VBoxEmptyFileSelector::setDefaultSaveExt (const QString &aExt)
-{
-    mDefaultSaveExt = aExt;
-}
-
-QString VBoxEmptyFileSelector::defaultSaveExt() const
-{
-    return mDefaultSaveExt;
-}
-
-void VBoxEmptyFileSelector::setFileDialogTitle (const QString& aTitle)
-{
-    mFileDialogTitle = aTitle;
-}
-
-QString VBoxEmptyFileSelector::fileDialogTitle() const
-{
-    return mFileDialogTitle;
-}
-
-void VBoxEmptyFileSelector::setFileFilters (const QString& aFilters)
-{
-    mFileFilters = aFilters;
-}
-
-QString VBoxEmptyFileSelector::fileFilters() const
-{
-    return mFileFilters;
-}
-
-void VBoxEmptyFileSelector::setHomeDir (const QString& aDir)
-{
-    mHomeDir = aDir;
-}
-
-QString VBoxEmptyFileSelector::homeDir() const
-{
-    return mHomeDir;
-}
-
-void VBoxEmptyFileSelector::retranslateUi()
-{
-    mSelectButton->setText (tr ("&Choose..."));
-}
-
-void VBoxEmptyFileSelector::choose()
-{
-    QString path = mPath;
-
-    /* Preparing initial directory. */
-    QString initDir = path.isNull() ? mHomeDir :
-        QIFileDialog::getFirstExistingDir (path);
-    if (initDir.isNull())
-        initDir = mHomeDir;
-
-    switch (mMode)
-    {
-        case VBoxFilePathSelectorWidget::Mode_File_Open:
-            path = QIFileDialog::getOpenFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle); break;
-        case VBoxFilePathSelectorWidget::Mode_File_Save:
-        {
-            path = QIFileDialog::getSaveFileName (initDir, mFileFilters, parentWidget(), mFileDialogTitle);
-            if (!path.isEmpty() && QFileInfo (path).suffix().isEmpty())
-                path = QString ("%1.%2").arg (path).arg (mDefaultSaveExt);
-            break;
-        }
-        case VBoxFilePathSelectorWidget::Mode_Folder:
-            path = QIFileDialog::getExistingDirectory (initDir, parentWidget(), mFileDialogTitle); break;
-    }
-    if (path.isEmpty())
-        return;
-
-    path.remove (QRegExp ("[\\\\/]$"));
-    setPath (path);
-}
-
-void VBoxEmptyFileSelector::textChanged (const QString& aPath)
-{
-    const QString oldPath = mPath;
-    mPath = aPath;
-    if (oldPath != mPath)
-    {
-        mIsModified = true;
-        emit pathChanged (mPath);
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.h	(revision 25171)
@@ -0,0 +1,521 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxFrameBuffer class and subclasses declarations
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___VBoxFrameBuffer_h___
+#define ___VBoxFrameBuffer_h___
+#include "COMDefs.h"
+#include <iprt/critsect.h>
+
+/* Qt includes */
+#include <QImage>
+#include <QPixmap>
+#include <QMutex>
+#include <QPaintEvent>
+#include <QMoveEvent>
+#if defined (VBOX_GUI_USE_QGL)
+#include "VBoxFBOverlay.h"
+#endif
+
+#if defined (VBOX_GUI_USE_SDL)
+#include <SDL.h>
+#include <signal.h>
+#endif
+
+#if defined (Q_WS_WIN) && defined (VBOX_GUI_USE_DDRAW)
+// VBox/cdefs.h defines these:
+#undef LOWORD
+#undef HIWORD
+#undef LOBYTE
+#undef HIBYTE
+#include <ddraw.h>
+#endif
+
+class VBoxConsoleView;
+
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  Frame buffer resize event.
+ */
+class VBoxResizeEvent : public QEvent
+{
+public:
+
+    VBoxResizeEvent (ulong aPixelFormat, uchar *aVRAM,
+                     ulong aBitsPerPixel, ulong aBytesPerLine,
+                     ulong aWidth, ulong aHeight) :
+        QEvent ((QEvent::Type) VBoxDefs::ResizeEventType),
+        mPixelFormat (aPixelFormat), mVRAM (aVRAM), mBitsPerPixel (aBitsPerPixel),
+        mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight) {}
+    ulong pixelFormat() { return mPixelFormat; }
+    uchar *VRAM() { return mVRAM; }
+    ulong bitsPerPixel() { return mBitsPerPixel; }
+    ulong bytesPerLine() { return mBytesPerLine; }
+    ulong width() { return mWidth; }
+    ulong height() { return mHeight; }
+
+private:
+
+    ulong mPixelFormat;
+    uchar *mVRAM;
+    ulong mBitsPerPixel;
+    ulong mBytesPerLine;
+    ulong mWidth;
+    ulong mHeight;
+};
+
+/**
+ *  Frame buffer repaint event.
+ */
+class VBoxRepaintEvent : public QEvent
+{
+public:
+    VBoxRepaintEvent (int iX, int iY, int iW, int iH) :
+        QEvent ((QEvent::Type) VBoxDefs::RepaintEventType),
+        ex (iX), ey (iY), ew (iW), eh (iH)
+    {}
+    int x() { return ex; }
+    int y() { return ey; }
+    int width() { return ew; }
+    int height() { return eh; }
+private:
+    int ex, ey, ew, eh;
+};
+
+/**
+ *  Frame buffer set region event.
+ */
+class VBoxSetRegionEvent : public QEvent
+{
+public:
+    VBoxSetRegionEvent (const QRegion &aReg)
+        : QEvent ((QEvent::Type) VBoxDefs::SetRegionEventType)
+        , mReg (aReg) {}
+    QRegion region() { return mReg; }
+private:
+    QRegion mReg;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  Common IFramebuffer implementation for all methods used by GUI to maintain
+ *  the VM display video memory.
+ *
+ *  Note that although this class can be called from multiple threads
+ *  (in particular, the GUI thread and EMT) it doesn't protect access to every
+ *  data field using its mutex lock. This is because all synchronization between
+ *  the GUI and the EMT thread is supposed to be done using the
+ *  IFramebuffer::NotifyUpdate() and IFramebuffer::RequestResize() methods
+ *  (in particular, the \a aFinished parameter of these methods is responsible
+ *  for the synchronization). These methods are always called on EMT and
+ *  therefore always follow one another but never in parallel.
+ *
+ *  Using this object's mutex lock (exposed also in IFramebuffer::Lock() and
+ *  IFramebuffer::Unlock() implementations) usually makes sense only if some
+ *  third-party thread (i.e. other than GUI or EMT) needs to make sure that
+ *  *no* VM display update or resize event can occur while it is accessing
+ *  IFramebuffer properties or the underlying display memory storage area.
+ *
+ *  See IFramebuffer documentation for more info.
+ */
+
+class VBoxFrameBuffer : VBOX_SCRIPTABLE_IMPL(IFramebuffer)
+{
+public:
+
+    VBoxFrameBuffer (VBoxConsoleView *aView);
+    virtual ~VBoxFrameBuffer();
+
+    NS_DECL_ISUPPORTS
+
+#if defined (Q_OS_WIN32)
+
+    STDMETHOD_(ULONG, AddRef)()
+    {
+        return ::InterlockedIncrement (&refcnt);
+    }
+
+    STDMETHOD_(ULONG, Release)()
+    {
+        long cnt = ::InterlockedDecrement (&refcnt);
+        if (cnt == 0)
+            delete this;
+        return cnt;
+    }
+#endif
+    VBOX_SCRIPTABLE_DISPATCH_IMPL(IFramebuffer)
+
+    // IFramebuffer COM methods
+    STDMETHOD(COMGETTER(Address)) (BYTE **aAddress);
+    STDMETHOD(COMGETTER(Width)) (ULONG *aWidth);
+    STDMETHOD(COMGETTER(Height)) (ULONG *aHeight);
+    STDMETHOD(COMGETTER(BitsPerPixel)) (ULONG *aBitsPerPixel);
+    STDMETHOD(COMGETTER(BytesPerLine)) (ULONG *aBytesPerLine);
+    STDMETHOD(COMGETTER(PixelFormat)) (ULONG *aPixelFormat);
+    STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *aUsesGuestVRAM);
+    STDMETHOD(COMGETTER(HeightReduction)) (ULONG *aHeightReduction);
+    STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay);
+    STDMETHOD(COMGETTER(WinId)) (ULONG64 *winId);
+
+    STDMETHOD(Lock)();
+    STDMETHOD(Unlock)();
+
+    STDMETHOD(RequestResize) (ULONG aScreenId, ULONG aPixelFormat,
+                              BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine,
+                              ULONG aWidth, ULONG aHeight,
+                              BOOL *aFinished);
+
+    STDMETHOD(VideoModeSupported) (ULONG aWidth, ULONG aHeight, ULONG aBPP,
+                                   BOOL *aSupported);
+
+    STDMETHOD(GetVisibleRegion)(BYTE *aRectangles, ULONG aCount, ULONG *aCountCopied);
+    STDMETHOD(SetVisibleRegion)(BYTE *aRectangles, ULONG aCount);
+
+    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
+
+    ulong width() { return mWdt; }
+    ulong height() { return mHgt; }
+
+    virtual ulong pixelFormat()
+    {
+        return FramebufferPixelFormat_FOURCC_RGB;
+    }
+
+    virtual bool usesGuestVRAM()
+    {
+        return false;
+    }
+
+    void lock() { RTCritSectEnter(&mCritSect); }
+    void unlock() { RTCritSectLeave(&mCritSect); }
+
+    virtual uchar *address() = 0;
+    virtual ulong bitsPerPixel() = 0;
+    virtual ulong bytesPerLine() = 0;
+
+    /**
+     *  Called on the GUI thread (from VBoxConsoleView) when some part of the
+     *  VM display viewport needs to be repainted on the host screen.
+     */
+    virtual void paintEvent (QPaintEvent *pe) = 0;
+
+    /**
+     *  Called on the GUI thread (from VBoxConsoleView) after it gets a
+     *  VBoxResizeEvent posted from the RequestResize() method implementation.
+     */
+    virtual void resizeEvent (VBoxResizeEvent *re)
+    {
+        mWdt = re->width();
+        mHgt = re->height();
+    }
+
+    /**
+     *  Called on the GUI thread (from VBoxConsoleView) when the VM console
+     *  window is moved.
+     */
+    virtual void moveEvent (QMoveEvent * /*me*/ ) {}
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    /* this method is called from the GUI thread
+     * to perform the actual Video HW Acceleration command processing
+     * the event is framebuffer implementation specific */
+    virtual void doProcessVHWACommand(QEvent * pEvent);
+
+    virtual void viewportResized(QResizeEvent * /*re*/){}
+
+    virtual void viewportScrolled(int /*dx*/, int /*dy*/){}
+#endif
+
+protected:
+
+    VBoxConsoleView *mView;
+    RTCRITSECT mCritSect;
+    int mWdt;
+    int mHgt;
+    uint64_t mWinId;
+
+#if defined (Q_OS_WIN32)
+private:
+    long refcnt;
+#endif
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+#if defined (VBOX_GUI_USE_QIMAGE)
+
+class VBoxQImageFrameBuffer : public VBoxFrameBuffer
+{
+public:
+
+    VBoxQImageFrameBuffer (VBoxConsoleView *aView);
+
+    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
+                             ULONG aW, ULONG aH);
+
+    ulong pixelFormat() { return mPixelFormat; }
+    bool usesGuestVRAM() { return mUsesGuestVRAM; }
+
+    uchar *address() { return mImg.bits(); }
+    ulong bitsPerPixel() { return mImg.depth(); }
+    ulong bytesPerLine() { return mImg.bytesPerLine(); }
+
+    void paintEvent (QPaintEvent *pe);
+    void resizeEvent (VBoxResizeEvent *re);
+
+private:
+
+    QPixmap mPM;
+    QImage mImg;
+    ulong mPixelFormat;
+    bool mUsesGuestVRAM;
+};
+
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+
+#if defined (VBOX_GUI_USE_QGL)
+
+class VBoxQGLFrameBuffer : public VBoxFrameBuffer
+{
+public:
+
+    VBoxQGLFrameBuffer (VBoxConsoleView *aView);
+
+    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
+                             ULONG aW, ULONG aH);
+#ifdef VBOXQGL_PROF_BASE
+    STDMETHOD(RequestResize) (ULONG aScreenId, ULONG aPixelFormat,
+                              BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine,
+                              ULONG aWidth, ULONG aHeight,
+                              BOOL *aFinished);
+#endif
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
+#endif
+
+    ulong pixelFormat() { return vboxWidget()->vboxPixelFormat(); }
+    bool usesGuestVRAM() { return vboxWidget()->vboxUsesGuestVRAM(); }
+
+    uchar *address() { return vboxWidget()->vboxAddress(); }
+    ulong bitsPerPixel() { return vboxWidget()->vboxBitsPerPixel(); }
+    ulong bytesPerLine() { return vboxWidget()->vboxBytesPerLine(); }
+
+    void paintEvent (QPaintEvent *pe);
+    void resizeEvent (VBoxResizeEvent *re);
+    void doProcessVHWACommand(QEvent * pEvent);
+
+private:
+//    void vboxMakeCurrent();
+    class VBoxGLWidget * vboxWidget();
+
+    class VBoxVHWACommandElementProcessor mCmdPipe;
+};
+
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+
+#if defined (VBOX_GUI_USE_SDL)
+
+class VBoxSDLFrameBuffer : public VBoxFrameBuffer
+{
+public:
+
+    VBoxSDLFrameBuffer (VBoxConsoleView *aView);
+    virtual ~VBoxSDLFrameBuffer();
+
+    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
+                             ULONG aW, ULONG aH);
+
+    uchar *address()
+    {
+        SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen;
+        return surf ? (uchar *) (uintptr_t) surf->pixels : 0;
+    }
+
+    ulong bitsPerPixel()
+    {
+        SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen;
+        return surf ? surf->format->BitsPerPixel : 0;
+    }
+
+    ulong bytesPerLine()
+    {
+        SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen;
+        return surf ? surf->pitch : 0;
+    }
+
+    ulong pixelFormat()
+    {
+        return mPixelFormat;
+    }
+
+    bool usesGuestVRAM()
+    {
+        return mSurfVRAM != NULL;
+    }
+
+    void paintEvent (QPaintEvent *pe);
+    void resizeEvent (VBoxResizeEvent *re);
+
+private:
+
+    SDL_Surface *mScreen;
+    SDL_Surface *mSurfVRAM;
+
+    ulong mPixelFormat;
+};
+
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+
+#if defined (VBOX_GUI_USE_DDRAW)
+
+class VBoxDDRAWFrameBuffer : public VBoxFrameBuffer
+{
+public:
+
+    VBoxDDRAWFrameBuffer (VBoxConsoleView *aView);
+    virtual ~VBoxDDRAWFrameBuffer();
+
+    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
+                             ULONG aW, ULONG aH);
+
+    uchar *address() { return (uchar *) mSurfaceDesc.lpSurface; }
+    ulong bitsPerPixel() { return mSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; }
+    ulong bytesPerLine() { return (ulong) mSurfaceDesc.lPitch; }
+
+    ulong pixelFormat() { return mPixelFormat; };
+
+    bool usesGuestVRAM() { return mUsesGuestVRAM; }
+
+    void paintEvent (QPaintEvent *pe);
+    void resizeEvent (VBoxResizeEvent *re);
+    void moveEvent (QMoveEvent *me);
+
+private:
+
+    void releaseObjects();
+
+    bool createSurface (ULONG aPixelFormat, uchar *pvVRAM,
+                        ULONG aBitsPerPixel, ULONG aBytesPerLine,
+                        ULONG aWidth, ULONG aHeight);
+    void deleteSurface();
+    void drawRect (ULONG x, ULONG y, ULONG w, ULONG h);
+    void getWindowPosition (void);
+
+    LPDIRECTDRAW7        mDDRAW;
+    LPDIRECTDRAWCLIPPER  mClipper;
+    LPDIRECTDRAWSURFACE7 mSurface;
+    DDSURFACEDESC2       mSurfaceDesc;
+    LPDIRECTDRAWSURFACE7 mPrimarySurface;
+
+    ulong mPixelFormat;
+
+    bool mUsesGuestVRAM;
+
+    int mWndX;
+    int mWndY;
+
+    bool mSynchronousUpdates;
+};
+
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+
+#if defined (Q_WS_MAC) && defined (VBOX_GUI_USE_QUARTZ2D)
+
+#include <Carbon/Carbon.h>
+
+class VBoxQuartz2DFrameBuffer : public VBoxFrameBuffer
+{
+public:
+
+    VBoxQuartz2DFrameBuffer (VBoxConsoleView *aView);
+    virtual ~VBoxQuartz2DFrameBuffer ();
+
+    STDMETHOD (NotifyUpdate) (ULONG aX, ULONG aY,
+                              ULONG aW, ULONG aH);
+    STDMETHOD (SetVisibleRegion) (BYTE *aRectangles, ULONG aCount);
+
+    uchar *address() { return mDataAddress; }
+    ulong bitsPerPixel() { return CGImageGetBitsPerPixel (mImage); }
+    ulong bytesPerLine() { return CGImageGetBytesPerRow (mImage); }
+    ulong pixelFormat() { return mPixelFormat; };
+    bool usesGuestVRAM() { return mBitmapData == NULL; }
+
+    const CGImageRef imageRef() const { return mImage; }
+
+    void paintEvent (QPaintEvent *pe);
+    void resizeEvent (VBoxResizeEvent *re);
+
+#ifndef QT_MAC_USE_COCOA
+    void testAndSetSNCarbonFix();
+#endif /* QT_MAC_USE_COCOA */
+
+private:
+
+    void clean();
+
+    uchar *mDataAddress;
+    void *mBitmapData;
+    ulong mPixelFormat;
+    CGImageRef mImage;
+    typedef struct
+    {
+        /** The size of this structure expressed in rcts entries. */
+        ULONG allocated;
+        /** The number of entries in the rcts array. */
+        ULONG used;
+        /** Variable sized array of the rectangle that makes up the region. */
+        CGRect rcts[1];
+    } RegionRects;
+    /** The current valid region, all access is by atomic cmpxchg or atomic xchg.
+     *
+     * The protocol for updating and using this has to take into account that
+     * the producer (SetVisibleRegion) and consumer (paintEvent) are running
+     * on different threads. Therefore the producer will create a new RegionRects
+     * structure before atomically replace the existing one. While the consumer
+     * will read the value by atomically replace it by NULL, and then when its
+     * done try restore it by cmpxchg. If the producer has already put a new
+     * region there, it will be discarded (see mRegionUnused).
+     */
+    RegionRects volatile *mRegion;
+    /** For keeping the unused region and thus avoid some RTMemAlloc/RTMemFree calls.
+     * This is operated with atomic cmpxchg and atomic xchg. */
+    RegionRects volatile *mRegionUnused;
+
+#ifndef QT_MAC_USE_COCOA
+    bool mSnowLeoCarbonFix;
+    EventHandlerRef mDarwinSNWindowHandlerRef;
+#endif /* QT_MAC_USE_COCOA */
+};
+
+#endif /* Q_WS_MAC && VBOX_GUI_USE_QUARTZ2D */
+
+#endif // !___VBoxFrameBuffer_h___
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsGeneral.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsGeneral.cpp	(revision 25170)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxGLSettingsGeneral class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxGLSettingsGeneral.h"
-#include "VBoxGlobal.h"
-
-#include <QDir>
-
-VBoxGLSettingsGeneral::VBoxGLSettingsGeneral()
-{
-    /* Apply UI decorations */
-    Ui::VBoxGLSettingsGeneral::setupUi (this);
-
-#ifndef VBOX_GUI_WITH_SYSTRAY
-    mCbCheckTrayIcon->hide();
-#endif /* VBOX_GUI_WITH_SYSTRAY */
-#ifndef Q_WS_MAC
-    mCbCheckDockPreview->hide();
-#endif /* Q_WS_MAC */
-    if (mCbCheckTrayIcon->isHidden() && mCbCheckDockPreview->isHidden())
-        mLnSeparator2->hide();
-
-    mPsHardDisk->setHomeDir (vboxGlobal().virtualBox().GetHomeFolder());
-    mPsMach->setHomeDir (vboxGlobal().virtualBox().GetHomeFolder());
-    mPsVRDP->setHomeDir (vboxGlobal().virtualBox().GetHomeFolder());
-    mPsVRDP->setMode (VBoxFilePathSelectorWidget::Mode_File_Open);
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxGLSettingsGeneral::getFrom (const CSystemProperties &aProps,
-                                     const VBoxGlobalSettings &aGs)
-{
-    mPsHardDisk->setPath (aProps.GetDefaultHardDiskFolder());
-    mPsMach->setPath (aProps.GetDefaultMachineFolder());
-    mPsVRDP->setPath (aProps.GetRemoteDisplayAuthLibrary());
-    mCbCheckTrayIcon->setChecked (aGs.trayIconEnabled());
-#ifdef Q_WS_MAC
-    mCbCheckDockPreview->setChecked (aGs.dockPreviewEnabled());
-#endif /* Q_WS_MAC */
-}
-
-void VBoxGLSettingsGeneral::putBackTo (CSystemProperties &aProps,
-                                       VBoxGlobalSettings &aGs)
-{
-    if (mPsHardDisk->isModified())
-        aProps.SetDefaultHardDiskFolder (mPsHardDisk->path());
-    if (aProps.isOk() && mPsMach->isModified())
-        aProps.SetDefaultMachineFolder (mPsMach->path());
-    if (aProps.isOk() && mPsVRDP->isModified())
-        aProps.SetRemoteDisplayAuthLibrary (mPsVRDP->path());
-    aGs.setTrayIconEnabled (mCbCheckTrayIcon->isChecked());
-#ifdef Q_WS_MAC
-    aGs.setDockPreviewEnabled (mCbCheckDockPreview->isChecked());
-#endif /* Q_WS_MAC */
-}
-
-void VBoxGLSettingsGeneral::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mPsHardDisk);
-    setTabOrder (mPsHardDisk, mPsMach);
-    setTabOrder (mPsMach, mPsVRDP);
-    setTabOrder (mPsVRDP, mCbCheckTrayIcon);
-#ifdef Q_WS_MAC
-    setTabOrder (mCbCheckTrayIcon, mCbCheckDockPreview);
-#endif /* Q_WS_MAC */
-}
-
-void VBoxGLSettingsGeneral::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxGLSettingsGeneral::retranslateUi (this);
-
-    mPsHardDisk->setWhatsThis (tr ("Displays the path to the default hard disk "
-                                   "folder. This folder is used, if not explicitly "
-                                   "specified otherwise, when adding existing or "
-                                   "creating new virtual hard disks."));
-    mPsMach->setWhatsThis (tr ("Displays the path to the default virtual "
-                               "machine folder. This folder is used, if not "
-                               "explicitly specified otherwise, when creating "
-                               "new virtual machines."));
-    mPsVRDP->setWhatsThis (tr ("Displays the path to the library that "
-                               "provides authentication for Remote Display "
-                               "(VRDP) clients."));
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsInput.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsInput.cpp	(revision 25170)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxGLSettingsInput class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxGLSettingsInput.h"
-#include "VBoxGlobalSettings.h"
-
-VBoxGLSettingsInput::VBoxGLSettingsInput()
-{
-    /* Apply UI decorations */
-    Ui::VBoxGLSettingsInput::setupUi (this);
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxGLSettingsInput::getFrom (const CSystemProperties &,
-                                   const VBoxGlobalSettings &aGs)
-{
-    mHeHostKey->setKey (aGs.hostKey());
-    mCbAutoGrab->setChecked (aGs.autoCapture());
-}
-
-void VBoxGLSettingsInput::putBackTo (CSystemProperties &,
-                                     VBoxGlobalSettings &aGs)
-{
-    aGs.setHostKey (mHeHostKey->key());
-    aGs.setAutoCapture (mCbAutoGrab->isChecked());
-}
-
-void VBoxGLSettingsInput::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mHeHostKey);
-    setTabOrder (mHeHostKey, mCbAutoGrab);
-}
-
-void VBoxGLSettingsInput::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxGLSettingsInput::retranslateUi (this);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsLanguage.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsLanguage.cpp	(revision 25170)
+++ 	(revision )
@@ -1,329 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxGLSettingsLanguage class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxGLSettingsLanguage.h"
-#include "VBoxGlobalSettings.h"
-#include "VBoxGlobal.h"
-
-#include <QHeaderView>
-#include <QTranslator>
-#include <QDir>
-#include <QPainter>
-
-#include <iprt/err.h>
-#include <iprt/param.h>
-#include <iprt/path.h>
-
-extern const char *gVBoxLangSubDir;
-extern const char *gVBoxLangFileBase;
-extern const char *gVBoxLangFileExt;
-extern const char *gVBoxLangIDRegExp;
-extern const char *gVBoxBuiltInLangName;
-
-class LanguageItem : public QTreeWidgetItem
-{
-public:
-
-    enum { LanguageItemType = QTreeWidgetItem::UserType + 1 };
-
-    LanguageItem (QTreeWidget *aParent, const QTranslator &aTranslator,
-                  const QString &aId, bool aBuiltIn = false)
-        : QTreeWidgetItem (aParent, LanguageItemType), mBuiltIn (aBuiltIn)
-    {
-        Assert (!aId.isEmpty());
-
-        /* Note: context/source/comment arguments below must match strings
-         * used in VBoxGlobal::languageName() and friends (the latter are the
-         * source of information for the lupdate tool that generates
-         * translation files) */
-
-        QString nativeLanguage = tratra (aTranslator,
-            "@@@", "English", "Native language name");
-        QString nativeCountry = tratra (aTranslator,
-            "@@@", "--", "Native language country name "
-            "(empty if this language is for all countries)");
-
-        QString englishLanguage = tratra (aTranslator,
-            "@@@", "English", "Language name, in English");
-        QString englishCountry = tratra (aTranslator,
-            "@@@", "--", "Language country name, in English "
-            "(empty if native country name is empty)");
-
-        QString translatorsName = tratra (aTranslator,
-            "@@@", "Sun Microsystems, Inc.", "Comma-separated list of translators");
-
-        QString itemName = nativeLanguage;
-        QString langName = englishLanguage;
-
-        if (!aBuiltIn)
-        {
-            if (nativeCountry != "--")
-                itemName += " (" + nativeCountry + ")";
-
-            if (englishCountry != "--")
-                langName += " (" + englishCountry + ")";
-
-            if (itemName != langName)
-                langName = itemName + " / " + langName;
-        }
-        else
-        {
-            itemName += VBoxGLSettingsLanguage::tr (" (built-in)", "Language");
-            langName += VBoxGLSettingsLanguage::tr (" (built-in)", "Language");
-        }
-
-        setText (0, itemName);
-        setText (1, aId);
-        setText (2, langName);
-        setText (3, translatorsName);
-
-        /* Current language appears in bold */
-        if (text (1) == VBoxGlobal::languageId())
-        {
-            QFont fnt = font (0);
-            fnt.setBold (true);
-            setFont (0, fnt);
-        }
-    }
-
-    /* Constructs an item for an invalid language ID (i.e. when a language
-     * file is missing or corrupt). */
-    LanguageItem (QTreeWidget *aParent, const QString &aId)
-        : QTreeWidgetItem (aParent, LanguageItemType), mBuiltIn (false)
-    {
-        Assert (!aId.isEmpty());
-
-        setText (0, QString ("<%1>").arg (aId));
-        setText (1, aId);
-        setText (2, VBoxGLSettingsLanguage::tr ("<unavailable>", "Language"));
-        setText (3, VBoxGLSettingsLanguage::tr ("<unknown>", "Author(s)"));
-
-        /* Invalid language appears in italic */
-        QFont fnt = font (0);
-        fnt.setItalic (true);
-        setFont (0, fnt);
-    }
-
-    /* Constructs an item for the default language ID (column 1 will be set
-     * to QString::null) */
-    LanguageItem (QTreeWidget *aParent)
-        : QTreeWidgetItem (aParent, LanguageItemType), mBuiltIn (false)
-    {
-        setText (0, VBoxGLSettingsLanguage::tr ("Default", "Language"));
-        setText (1, QString::null);
-        /* Empty strings of some reasonable length to prevent the info part
-         * from being shrinked too much when the list wants to be wider */
-        setText (2, "                ");
-        setText (3, "                ");
-    }
-
-    bool isBuiltIn() const { return mBuiltIn; }
-
-    bool operator< (const QTreeWidgetItem &aOther) const
-    {
-        QString thisId = text (1);
-        QString thatId = aOther.text (1);
-        if (thisId.isNull())
-            return true;
-        if (thatId.isNull())
-            return false;
-        if (mBuiltIn)
-            return true;
-        if (aOther.type() == LanguageItemType && ((LanguageItem*) &aOther)->mBuiltIn)
-            return false;
-        return QTreeWidgetItem::operator< (aOther);
-    }
-
-private:
-
-    QString tratra (const QTranslator &aTranslator, const char *aCtxt,
-                    const char *aSrc, const char *aCmnt)
-    {
-        QString msg = aTranslator.translate (aCtxt, aSrc, aCmnt);
-        /* return the source text if no translation is found */
-        if (msg.isEmpty())
-            msg = QString (aSrc);
-        return msg;
-    }
-
-    bool mBuiltIn : 1;
-};
-
-
-VBoxGLSettingsLanguage::VBoxGLSettingsLanguage()
-{
-    /* Apply UI decorations */
-    Ui::VBoxGLSettingsLanguage::setupUi (this);
-
-    /* Setup dialog */
-    mTwLanguage->header()->hide();
-    mTwLanguage->hideColumn (1);
-    mTwLanguage->hideColumn (2);
-    mTwLanguage->hideColumn (3);
-
-    /* Setup Connections */
-    connect (mTwLanguage, SIGNAL (painted (QTreeWidgetItem *, QPainter *)),
-             this, SLOT (mTwItemPainted (QTreeWidgetItem *, QPainter *)));
-    connect (mTwLanguage, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)),
-             this, SLOT (mTwLanguageChanged (QTreeWidgetItem *)));
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxGLSettingsLanguage::getFrom (const CSystemProperties & /* aProps */, const VBoxGlobalSettings &aGs)
-{
-    reload (aGs.languageId());
-    mTxName->setFixedHeight (fontMetrics().height() * 4);
-}
-
-void VBoxGLSettingsLanguage::putBackTo (CSystemProperties & /* aProps */, VBoxGlobalSettings &aGs)
-{
-    QTreeWidgetItem *curItem = mTwLanguage->currentItem();
-    Assert (curItem);
-    if (mLanguageChanged && curItem)
-    {
-        aGs.setLanguageId (curItem->text (1));
-        VBoxGlobal::loadLanguage (curItem->text (1));
-    }
-}
-
-void VBoxGLSettingsLanguage::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mTwLanguage);
-}
-
-void VBoxGLSettingsLanguage::reload (const QString &aLangId)
-{
-    /* Clear languages list */
-    mTwLanguage->clear();
-
-    /* Load languages list */
-    char szNlsPath [RTPATH_MAX];
-    int rc = RTPathAppPrivateNoArch (szNlsPath, sizeof(szNlsPath));
-    AssertRC (rc);
-    QString nlsPath = QString (szNlsPath) + gVBoxLangSubDir;
-    QDir nlsDir (nlsPath);
-    QStringList files = nlsDir.entryList (QStringList (QString ("%1*%2")
-        .arg (gVBoxLangFileBase, gVBoxLangFileExt)), QDir::Files);
-
-    QTranslator translator;
-    /* Add the default language */
-    new LanguageItem (mTwLanguage);
-    /* Add the built-in language */
-    new LanguageItem (mTwLanguage, translator, gVBoxBuiltInLangName, true /* built-in */);
-    /* Add all existing languages */
-    for (QStringList::Iterator it = files.begin(); it != files.end(); ++ it)
-    {
-        QString fileName = *it;
-        QRegExp regExp (QString (gVBoxLangFileBase) + gVBoxLangIDRegExp);
-        int pos = regExp.indexIn (fileName);
-        if (pos == -1)
-            continue;
-
-        /* Skip any English version, cause this is extra handled. */
-        QString lang = regExp.cap (2);
-        if (lang.toLower() == "en")
-            continue;
-
-        bool loadOk = translator.load (fileName, nlsPath);
-        if (!loadOk)
-            continue;
-
-        new LanguageItem (mTwLanguage, translator, regExp.cap (1));
-    }
-
-    /* Adjust selector list */
-#ifdef Q_WS_MAC
-    int width = qMax (static_cast<QAbstractItemView*> (mTwLanguage)
-        ->sizeHintForColumn (0) + 2 * mTwLanguage->frameWidth() +
-        QApplication::style()->pixelMetric (QStyle::PM_ScrollBarExtent),
-        220);
-    mTwLanguage->setFixedWidth (width);
-#else /* Q_WS_MAC */
-    mTwLanguage->setMinimumWidth (static_cast<QAbstractItemView*> (mTwLanguage)
-        ->sizeHintForColumn (0) + 2 * mTwLanguage->frameWidth() +
-        QApplication::style()->pixelMetric (QStyle::PM_ScrollBarExtent));
-#endif /* Q_WS_MAC */
-    mTwLanguage->resizeColumnToContents (0);
-
-    /* Search for necessary language */
-    QList<QTreeWidgetItem*> itemsList =
-        mTwLanguage->findItems (aLangId, Qt::MatchExactly, 1);
-    QTreeWidgetItem *item = itemsList.isEmpty() ? 0 : itemsList [0];
-    if (!item)
-    {
-        /* Add an item for an invalid language to represent it in the list */
-        item = new LanguageItem (mTwLanguage, aLangId);
-        mTwLanguage->resizeColumnToContents (0);
-    }
-    Assert (item);
-    if (item)
-        mTwLanguage->setCurrentItem (item);
-
-    mTwLanguage->sortItems (0, Qt::AscendingOrder);
-    mTwLanguage->scrollToItem (item);
-    mLanguageChanged = false;
-}
-
-void VBoxGLSettingsLanguage::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxGLSettingsLanguage::retranslateUi (this);
-    reload (VBoxGlobal::languageId());
-}
-
-void VBoxGLSettingsLanguage::mTwItemPainted (QTreeWidgetItem *aItem, QPainter *aPainter)
-{
-    if (aItem && aItem->type() == LanguageItem::LanguageItemType)
-    {
-        LanguageItem *item = static_cast <LanguageItem*> (aItem);
-        if (item->isBuiltIn())
-        {
-            QRect rect = mTwLanguage->visualItemRect (item);
-            aPainter->setPen (mTwLanguage->palette().color (QPalette::Mid));
-            aPainter->drawLine (rect.x(), rect.y() + rect.height() - 1,
-                                rect.x() + rect.width(), rect.y() + rect.height() - 1);
-        }
-    }
-}
-
-void VBoxGLSettingsLanguage::mTwLanguageChanged (QTreeWidgetItem *aItem)
-{
-    if (!aItem) return;
-
-    /* Disable labels for the Default language item */
-    bool enabled = !aItem->text (1).isNull();
-
-    mTxName->setEnabled (enabled);
-    mTxName->setText (QString ("<table>"
-                               "<tr><td>%1&nbsp;</td><td>%2</td></tr>"
-                               "<tr><td>%3&nbsp;</td><td>%4</td></tr>"
-                               "</table>")
-                      .arg (tr ("Language:"))
-                      .arg (aItem->text (2))
-                      .arg (tr ("Author(s):"))
-                      .arg (aItem->text (3)));
-
-    mLanguageChanged = true;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsNetwork.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsNetwork.cpp	(revision 25170)
+++ 	(revision )
@@ -1,510 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxGLSettingsNetwork class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIWidgetValidator.h"
-#include "VBoxGlobal.h"
-#include "VBoxGLSettingsNetwork.h"
-#include "VBoxGLSettingsNetworkDetails.h"
-#include "VBoxProblemReporter.h"
-
-/* Qt includes */
-#include <QHeaderView>
-#include <QHostAddress>
-
-NetworkItem::NetworkItem()
-    : QTreeWidgetItem()
-    , mChanged (false)
-    , mName (QString::null)
-    , mDhcpClientEnabled (false)
-    , mInterfaceAddress (QString::null)
-    , mInterfaceMask (QString::null)
-    , mIpv6Supported (false)
-    , mInterfaceAddress6 (QString::null)
-    , mInterfaceMaskLength6 (QString::null)
-    , mDhcpServerEnabled (false)
-    , mDhcpServerAddress (QString::null)
-    , mDhcpServerMask (QString::null)
-    , mDhcpLowerAddress (QString::null)
-    , mDhcpUpperAddress (QString::null)
-{
-}
-
-void NetworkItem::getFromInterface (const CHostNetworkInterface &aInterface)
-{
-    /* Initialization */
-    mInterface = aInterface;
-    mName = mInterface.GetName();
-    CDHCPServer dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName (mInterface.GetNetworkName());
-    if (dhcp.isNull()) vboxGlobal().virtualBox().CreateDHCPServer (mInterface.GetNetworkName());
-    dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName (mInterface.GetNetworkName());
-    AssertMsg (!dhcp.isNull(), ("DHCP Server creation failed!\n"));
-    setText (0, VBoxGLSettingsNetwork::tr ("%1 network", "<adapter name> network").arg (mName));
-
-    /* Host-only Interface settings */
-    mDhcpClientEnabled = mInterface.GetDhcpEnabled();
-    mInterfaceAddress = mInterface.GetIPAddress();
-    mInterfaceMask = mInterface.GetNetworkMask();
-    mIpv6Supported = mInterface.GetIPV6Supported();
-    mInterfaceAddress6 = mInterface.GetIPV6Address();
-    mInterfaceMaskLength6 = QString ("%1").arg (mInterface.GetIPV6NetworkMaskPrefixLength());
-
-    /* DHCP Server settings */
-    mDhcpServerEnabled = dhcp.GetEnabled();
-    mDhcpServerAddress = dhcp.GetIPAddress();
-    mDhcpServerMask = dhcp.GetNetworkMask();
-    mDhcpLowerAddress = dhcp.GetLowerIP();
-    mDhcpUpperAddress = dhcp.GetUpperIP();
-
-    /* Update tool-tip */
-    updateInfo();
-}
-
-void NetworkItem::putBackToInterface()
-{
-    /* Host-only Interface settings */
-    if (mDhcpClientEnabled)
-    {
-        mInterface.EnableDynamicIpConfig();
-    }
-    else
-    {
-        AssertMsg (mInterfaceAddress.isEmpty() ||
-                   QHostAddress (mInterfaceAddress).protocol() == QAbstractSocket::IPv4Protocol,
-                   ("Interface IPv4 address must be empty or IPv4-valid!\n"));
-        AssertMsg (mInterfaceMask.isEmpty() ||
-                   QHostAddress (mInterfaceMask).protocol() == QAbstractSocket::IPv4Protocol,
-                   ("Interface IPv4 network mask must be empty or IPv4-valid!\n"));
-        mInterface.EnableStaticIpConfig (mInterfaceAddress, mInterfaceMask);
-        if (mInterface.GetIPV6Supported())
-        {
-            AssertMsg (mInterfaceAddress6.isEmpty() ||
-                       QHostAddress (mInterfaceAddress6).protocol() == QAbstractSocket::IPv6Protocol,
-                       ("Interface IPv6 address must be empty or IPv6-valid!\n"));
-            mInterface.EnableStaticIpConfigV6 (mInterfaceAddress6, mInterfaceMaskLength6.toULong());
-        }
-    }
-
-    /* DHCP Server settings */
-    CDHCPServer dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName (mInterface.GetNetworkName());
-    AssertMsg (!dhcp.isNull(), ("DHCP Server should be already created!\n"));
-    dhcp.SetEnabled (mDhcpServerEnabled);
-    AssertMsg (QHostAddress (mDhcpServerAddress).protocol() == QAbstractSocket::IPv4Protocol,
-               ("DHCP Server IPv4 address must be IPv4-valid!\n"));
-    AssertMsg (QHostAddress (mDhcpServerMask).protocol() == QAbstractSocket::IPv4Protocol,
-               ("DHCP Server IPv4 network mask must be IPv4-valid!\n"));
-    AssertMsg (QHostAddress (mDhcpLowerAddress).protocol() == QAbstractSocket::IPv4Protocol,
-               ("DHCP Server IPv4 lower bound must be IPv4-valid!\n"));
-    AssertMsg (QHostAddress (mDhcpUpperAddress).protocol() == QAbstractSocket::IPv4Protocol,
-               ("DHCP Server IPv4 upper bound must be IPv4-valid!\n"));
-    dhcp.SetConfiguration (mDhcpServerAddress, mDhcpServerMask, mDhcpLowerAddress, mDhcpUpperAddress);
-}
-
-bool NetworkItem::revalidate (QString &aWarning, QString & /* aTitle */)
-{
-    /* Host-only Interface validation */
-    if (!mDhcpClientEnabled)
-    {
-        if (!mInterfaceAddress.isEmpty() &&
-            (QHostAddress (mInterfaceAddress) == QHostAddress::Any ||
-             QHostAddress (mInterfaceAddress).protocol() != QAbstractSocket::IPv4Protocol))
-        {
-            aWarning = VBoxGLSettingsNetwork::tr ("host IPv4 address of <b>%1</b> is wrong").arg (text (0));
-            return false;
-        }
-        if (!mInterfaceMask.isEmpty() &&
-            (QHostAddress (mInterfaceMask) == QHostAddress::Any ||
-             QHostAddress (mInterfaceMask).protocol() != QAbstractSocket::IPv4Protocol))
-        {
-            aWarning = VBoxGLSettingsNetwork::tr ("host IPv4 network mask of <b>%1</b> is wrong").arg (text (0));
-            return false;
-        }
-        if (mIpv6Supported)
-        {
-            if (!mInterfaceAddress6.isEmpty() &&
-                (QHostAddress (mInterfaceAddress6) == QHostAddress::AnyIPv6 ||
-                 QHostAddress (mInterfaceAddress6).protocol() != QAbstractSocket::IPv6Protocol))
-            {
-                aWarning = VBoxGLSettingsNetwork::tr ("host IPv6 address of <b>%1</b> is wrong").arg (text (0));
-                return false;
-            }
-        }
-    }
-
-    /* DHCP Server settings */
-    if (mDhcpServerEnabled)
-    {
-        if (QHostAddress (mDhcpServerAddress) == QHostAddress::Any ||
-            QHostAddress (mDhcpServerAddress).protocol() != QAbstractSocket::IPv4Protocol)
-        {
-            aWarning = VBoxGLSettingsNetwork::tr ("DHCP server address of <b>%1</b> is wrong").arg (text (0));
-            return false;
-        }
-        if (QHostAddress (mDhcpServerMask) == QHostAddress::Any ||
-            QHostAddress (mDhcpServerMask).protocol() != QAbstractSocket::IPv4Protocol)
-        {
-            aWarning = VBoxGLSettingsNetwork::tr ("DHCP server network mask of <b>%1</b> is wrong").arg (text (0));
-            return false;
-        }
-        if (QHostAddress (mDhcpLowerAddress) == QHostAddress::Any ||
-            QHostAddress (mDhcpLowerAddress).protocol() != QAbstractSocket::IPv4Protocol)
-        {
-            aWarning = VBoxGLSettingsNetwork::tr ("DHCP lower address bound of <b>%1</b> is wrong").arg (text (0));
-            return false;
-        }
-        if (QHostAddress (mDhcpUpperAddress) == QHostAddress::Any ||
-            QHostAddress (mDhcpUpperAddress).protocol() != QAbstractSocket::IPv4Protocol)
-        {
-            aWarning = VBoxGLSettingsNetwork::tr ("DHCP upper address bound of <b>%1</b> is wrong").arg (text (0));
-            return false;
-        }
-    }
-    return true;
-}
-
-QString NetworkItem::updateInfo()
-{
-    /* Update information label */
-    QString hdr ("<tr><td><nobr>%1:&nbsp;</nobr></td>"
-                 "<td><nobr>%2</nobr></td></tr>");
-    QString sub ("<tr><td><nobr>&nbsp;&nbsp;%1:&nbsp;</nobr></td>"
-                 "<td><nobr>%2</nobr></td></tr>");
-    QString data, tip, buffer;
-
-    /* Host-only Interface information */
-    buffer = hdr.arg (VBoxGLSettingsNetwork::tr ("Adapter"))
-                .arg (mDhcpClientEnabled ? VBoxGLSettingsNetwork::tr ("Automatically configured", "interface")
-                                         : VBoxGLSettingsNetwork::tr ("Manually configured", "interface"));
-    data += buffer;
-    tip += buffer;
-
-    if (!mDhcpClientEnabled)
-    {
-        buffer = sub.arg (VBoxGLSettingsNetwork::tr ("IPv4 Address"))
-                    .arg (mInterfaceAddress.isEmpty() ? VBoxGLSettingsNetwork::tr ("Not set", "address")
-                                                      : mInterfaceAddress) +
-                 sub.arg (VBoxGLSettingsNetwork::tr ("IPv4 Network Mask"))
-                    .arg (mInterfaceMask.isEmpty() ? VBoxGLSettingsNetwork::tr ("Not set", "mask")
-                                                   : mInterfaceMask);
-        tip += buffer;
-
-        if (mIpv6Supported)
-        {
-            buffer = sub.arg (VBoxGLSettingsNetwork::tr ("IPv6 Address"))
-                        .arg (mInterfaceAddress6.isEmpty() ? VBoxGLSettingsNetwork::tr ("Not set", "address")
-                                                           : mInterfaceAddress6) +
-                     sub.arg (VBoxGLSettingsNetwork::tr ("IPv6 Network Mask Length"))
-                        .arg (mInterfaceMaskLength6.isEmpty() ? VBoxGLSettingsNetwork::tr ("Not set", "length")
-                                                              : mInterfaceMaskLength6);
-            tip += buffer;
-        }
-    }
-
-    /* DHCP Server information */
-    buffer = hdr.arg (VBoxGLSettingsNetwork::tr ("DHCP Server"))
-                .arg (mDhcpServerEnabled ? VBoxGLSettingsNetwork::tr ("Enabled", "server")
-                                         : VBoxGLSettingsNetwork::tr ("Disabled", "server"));
-    data += buffer;
-    tip += buffer;
-
-    if (mDhcpServerEnabled)
-    {
-        buffer = sub.arg (VBoxGLSettingsNetwork::tr ("Address"))
-                    .arg (mDhcpServerAddress.isEmpty() ? VBoxGLSettingsNetwork::tr ("Not set", "address")
-                                                       : mDhcpServerAddress) +
-                 sub.arg (VBoxGLSettingsNetwork::tr ("Network Mask"))
-                    .arg (mDhcpServerMask.isEmpty() ? VBoxGLSettingsNetwork::tr ("Not set", "mask")
-                                                    : mDhcpServerMask) +
-                 sub.arg (VBoxGLSettingsNetwork::tr ("Lower Bound"))
-                    .arg (mDhcpLowerAddress.isEmpty() ? VBoxGLSettingsNetwork::tr ("Not set", "bound")
-                                                      : mDhcpLowerAddress) +
-                 sub.arg (VBoxGLSettingsNetwork::tr ("Upper Bound"))
-                    .arg (mDhcpUpperAddress.isEmpty() ? VBoxGLSettingsNetwork::tr ("Not set", "bound")
-                                                      : mDhcpUpperAddress);
-        tip += buffer;
-    }
-
-    setToolTip (0, tip);
-
-    return QString ("<table>") + data + QString ("</table>");
-}
-
-VBoxGLSettingsNetwork::VBoxGLSettingsNetwork()
-{
-    /* Apply UI decorations */
-    Ui::VBoxGLSettingsNetwork::setupUi (this);
-
-#ifdef Q_WS_MAC
-    /* Make shifting spacer for MAC as we have fixed-size networks list */
-    QSpacerItem *shiftSpacer =
-        new QSpacerItem (0, 1, QSizePolicy::Expanding, QSizePolicy::Preferred);
-    QGridLayout *mainLayout = static_cast <QGridLayout*> (layout());
-    mainLayout->addItem (shiftSpacer, 1, 4, 2);
-    static_cast <QHBoxLayout*> (mWtActions->layout())->addStretch();
-#endif
-
-    /* Setup tree-widget */
-    mTwInterfaces->header()->hide();
-    mTwInterfaces->setContextMenuPolicy (Qt::CustomContextMenu);
-
-    /* Prepare toolbar */
-    mAddInterface = new QAction (mTwInterfaces);
-    mRemInterface = new QAction (mTwInterfaces);
-    mEditInterface = new QAction (mTwInterfaces);
-
-    mAddInterface->setShortcuts (QList <QKeySequence> ()
-                                 << QKeySequence ("Ins")
-                                 << QKeySequence ("Ctrl+N"));
-    mRemInterface->setShortcuts (QList <QKeySequence> ()
-                                 << QKeySequence ("Del")
-                                 << QKeySequence ("Ctrl+R"));
-    mEditInterface->setShortcuts (QList <QKeySequence> ()
-                                  << QKeySequence ("Space")
-                                  << QKeySequence ("F2"));
-
-    mAddInterface->setIcon (VBoxGlobal::iconSet (":/add_host_iface_16px.png",
-                                                 ":/add_host_iface_disabled_16px.png"));
-    mRemInterface->setIcon (VBoxGlobal::iconSet (":/remove_host_iface_16px.png",
-                                                 ":/remove_host_iface_disabled_16px.png"));
-    mEditInterface->setIcon (VBoxGlobal::iconSet (":/guesttools_16px.png",
-                                                  ":/guesttools_disabled_16px.png"));
-
-    mTbActions->setUsesTextLabel (false);
-    mTbActions->setIconSize (QSize (16, 16));
-    mTbActions->setOrientation (Qt::Vertical);
-    mTbActions->addAction (mAddInterface);
-    mTbActions->addAction (mRemInterface);
-    mTbActions->addAction (mEditInterface);
-    mTbActions->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
-    mTbActions->updateGeometry();
-    mTbActions->setMinimumHeight (mTbActions->sizeHint().height());
-
-    /* Setup connections */
-    connect (mAddInterface, SIGNAL (triggered (bool)), this, SLOT (addInterface()));
-    connect (mRemInterface, SIGNAL (triggered (bool)), this, SLOT (remInterface()));
-    connect (mEditInterface, SIGNAL (triggered (bool)), this, SLOT (editInterface()));
-    connect (mTwInterfaces, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)),
-             this, SLOT (updateCurrentItem()));
-    connect (mTwInterfaces, SIGNAL (customContextMenuRequested (const QPoint &)),
-             this, SLOT (showContextMenu (const QPoint &)));
-    connect (mTwInterfaces, SIGNAL (itemDoubleClicked (QTreeWidgetItem*, int)),
-             this, SLOT (editInterface()));
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxGLSettingsNetwork::getFrom (const CSystemProperties &, const VBoxGlobalSettings &)
-{
-    NetworkItem *item = 0;
-    CHostNetworkInterfaceVector interfaces =
-        vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces();
-    for (CHostNetworkInterfaceVector::ConstIterator it = interfaces.begin();
-         it != interfaces.end(); ++ it)
-    {
-        if (it->GetInterfaceType() == KHostNetworkInterfaceType_HostOnly)
-        {
-            item = new NetworkItem();
-            item->getFromInterface (*it);
-            mTwInterfaces->addTopLevelItem (item);
-            mTwInterfaces->sortItems (0, Qt::AscendingOrder);
-        }
-    }
-
-    mTwInterfaces->setCurrentItem (item);
-    updateCurrentItem();
-
-#ifdef Q_WS_MAC
-    int width = qMax (static_cast<QAbstractItemView*> (mTwInterfaces)
-        ->sizeHintForColumn (0) + 2 * mTwInterfaces->frameWidth() +
-        QApplication::style()->pixelMetric (QStyle::PM_ScrollBarExtent),
-        220);
-    mTwInterfaces->setFixedWidth (width);
-    mTwInterfaces->resizeColumnToContents (0);
-#endif /* Q_WS_MAC */
-}
-
-void VBoxGLSettingsNetwork::putBackTo (CSystemProperties &, VBoxGlobalSettings &)
-{
-    for (int i = 0; i < mTwInterfaces->topLevelItemCount(); ++ i)
-    {
-        NetworkItem *item =
-            static_cast <NetworkItem*> (mTwInterfaces->topLevelItem (i));
-        if (item->isChanged())
-            item->putBackToInterface();
-    }
-}
-
-void VBoxGLSettingsNetwork::setValidator (QIWidgetValidator *aValidator)
-{
-    mValidator = aValidator;
-}
-
-bool VBoxGLSettingsNetwork::revalidate (QString &aWarning, QString &aTitle)
-{
-    NetworkItem *item = static_cast <NetworkItem*> (mTwInterfaces->currentItem());
-    return item ? item->revalidate (aWarning, aTitle) : true;
-}
-
-void VBoxGLSettingsNetwork::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mTwInterfaces);
-}
-
-void VBoxGLSettingsNetwork::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxGLSettingsNetwork::retranslateUi (this);
-
-    /* Translate action tool-tips */
-    mAddInterface->setText (tr ("&Add host-only network"));
-    mRemInterface->setText (tr ("&Remove host-only network"));
-    mEditInterface->setText (tr ("&Edit host-only network"));
-
-    mAddInterface->setToolTip (mAddInterface->text().remove ('&') +
-        QString (" (%1)").arg (mAddInterface->shortcut().toString()));
-    mRemInterface->setToolTip (mRemInterface->text().remove ('&') +
-        QString (" (%1)").arg (mRemInterface->shortcut().toString()));
-    mEditInterface->setToolTip (mEditInterface->text().remove ('&') +
-        QString (" (%1)").arg (mEditInterface->shortcut().toString()));
-}
-
-void VBoxGLSettingsNetwork::addInterface()
-{
-#if defined (Q_WS_WIN32)
-    /* Allow the started helper process to make itself the foreground window */
-    AllowSetForegroundWindow (ASFW_ANY);
-#endif
-    /* Creating interface */
-    CHostNetworkInterface iface;
-    CHost host = vboxGlobal().virtualBox().GetHost();
-    CProgress progress = host.CreateHostOnlyNetworkInterface (iface);
-    if (host.isOk())
-    {
-        vboxProblem().showModalProgressDialog (progress,
-            tr ("Performing", "creating/removing host-only network"), this);
-        if (progress.GetResultCode() == 0)
-        {
-            NetworkItem *item = new NetworkItem();
-            item->getFromInterface (iface);
-            mTwInterfaces->addTopLevelItem (item);
-            mTwInterfaces->sortItems (0, Qt::AscendingOrder);
-            mTwInterfaces->setCurrentItem (item);
-        }
-        else
-            vboxProblem().cannotCreateHostInterface (progress, this);
-    }
-    else
-        vboxProblem().cannotCreateHostInterface (host, this);
-#if defined (Q_WS_WIN32)
-    /* Allow the started helper process to make itself the foreground window */
-    AllowSetForegroundWindow (ASFW_ANY);
-#endif
-}
-
-void VBoxGLSettingsNetwork::remInterface()
-{
-#if defined (Q_WS_WIN32)
-    /* Allow the started helper process to make itself the foreground window */
-    AllowSetForegroundWindow (ASFW_ANY);
-#endif
-    /* Check interface presence & name */
-    NetworkItem *item = static_cast <NetworkItem*> (mTwInterfaces->currentItem());
-    AssertMsg (item, ("Current item should be selected!\n"));
-    QString name (item->name());
-
-    /* Asking user about deleting selected network interface */
-    if (vboxProblem().confirmDeletingHostInterface (name, this) ==
-        QIMessageBox::Cancel) return;
-
-    /* Removing interface */
-    CHost host = vboxGlobal().virtualBox().GetHost();
-    CHostNetworkInterface iface = host.FindHostNetworkInterfaceByName (name);
-    if (!iface.isNull())
-    {
-        /* Delete interface */
-        CProgress progress = host.RemoveHostOnlyNetworkInterface (iface.GetId());
-        if (host.isOk())
-        {
-            vboxProblem().showModalProgressDialog (progress,
-                tr ("Performing", "creating/removing host-only network"), this);
-            if (progress.GetResultCode() == 0)
-                delete item;
-            else
-                vboxProblem().cannotRemoveHostInterface (progress, iface, this);
-        }
-    }
-    if (!host.isOk())
-        vboxProblem().cannotRemoveHostInterface (host, iface, this);
-#if defined (Q_WS_WIN32)
-    /* Allow the started helper process to make itself the foreground window */
-    AllowSetForegroundWindow (ASFW_ANY);
-#endif
-}
-
-void VBoxGLSettingsNetwork::editInterface()
-{
-    /* Check interface presence */
-    NetworkItem *item = static_cast <NetworkItem*> (mTwInterfaces->currentItem());
-    AssertMsg (item, ("Current item should be selected!\n"));
-
-    /* Edit current item data */
-    VBoxGLSettingsNetworkDetails details (this);
-    details.getFromItem (item);
-    if (details.exec() == QDialog::Accepted)
-    {
-        details.putBackToItem();
-        item->setChanged (true);
-        item->updateInfo();
-    }
-
-    updateCurrentItem();
-    mValidator->revalidate();
-}
-
-void VBoxGLSettingsNetwork::updateCurrentItem()
-{
-    /* Get current item */
-    NetworkItem *item = static_cast <NetworkItem*> (mTwInterfaces->currentItem());
-    /* Set the final label text */
-    mLbInfo->setText (item ? item->updateInfo() : QString());
-    /* Update availability */
-    mRemInterface->setEnabled (item);
-    mEditInterface->setEnabled (item);
-}
-
-void VBoxGLSettingsNetwork::showContextMenu (const QPoint &aPos)
-{
-    QMenu menu;
-
-    if (mTwInterfaces->itemAt (aPos))
-    {
-        menu.addAction (mEditInterface);
-        menu.addAction (mRemInterface);
-    }
-    else
-    {
-        menu.addAction (mAddInterface);
-    }
-
-    menu.exec (mTwInterfaces->mapToGlobal (aPos));
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsNetworkDetails.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsNetworkDetails.cpp	(revision 25170)
+++ 	(revision )
@@ -1,210 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxGLSettingsNetworkDetails class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox Includes */
-#include "VBoxGLSettingsNetwork.h"
-#include "VBoxGLSettingsNetworkDetails.h"
-
-/* Qt Includes */
-#include <QHostAddress>
-#include <QRegExpValidator>
-
-VBoxGLSettingsNetworkDetails::VBoxGLSettingsNetworkDetails (QWidget *aParent)
-    : QIWithRetranslateUI2 <QIDialog> (aParent
-#ifdef Q_WS_MAC
-    ,Qt::Sheet
-#endif /* Q_WS_MAC */
-    )
-{
-    /* Apply UI decorations */
-    Ui::VBoxGLSettingsNetworkDetails::setupUi (this);
-
-    /* Setup dialog */
-    setWindowIcon (QIcon (":/guesttools_16px.png"));
-
-    /* Setup validators */
-    QString templateIPv4 ("([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\."
-                          "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\."
-                          "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\."
-                          "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])");
-    QString templateIPv6 ("[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
-                          "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
-                          "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}:{1,2}"
-                          "[0-9a-fA-Z]{1,4}:{1,2}[0-9a-fA-Z]{1,4}");
-
-    mLeIPv4->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
-    mLeNMv4->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
-    mLeIPv6->setValidator (new QRegExpValidator (QRegExp (templateIPv6), this));
-    mLeNMv6->setValidator (new QRegExpValidator (QRegExp ("[1-9][0-9]|1[0-1][0-9]|12[0-8]"), this));
-    mLeDhcpAddress->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
-    mLeDhcpMask->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
-    mLeDhcpLowerAddress->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
-    mLeDhcpUpperAddress->setValidator (new QRegExpValidator (QRegExp (templateIPv4), this));
-
-    /* Setup widgets */
-    mLeIPv6->setFixedWidthByText (QString().fill ('X', 32) + QString().fill (':', 7));
-
-#if 0 /* defined (Q_WS_WIN32) */
-    QStyleOption options1;
-    options1.initFrom (mCbManual);
-    QGridLayout *layout1 = qobject_cast <QGridLayout*> (mTwDetails->widget (0)->layout());
-    int wid1 = mCbManual->style()->pixelMetric (QStyle::PM_IndicatorWidth, &options1, mCbManual) +
-               mCbManual->style()->pixelMetric (QStyle::PM_CheckBoxLabelSpacing, &options1, mCbManual) -
-               layout1->spacing() - 1;
-    QSpacerItem *spacer1 = new QSpacerItem (wid1, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
-    layout1->addItem (spacer1, 1, 0, 4);
-#else
-    mCbManual->setVisible (false);
-#endif
-
-    QStyleOption options2;
-    options2.initFrom (mCbDhcpServerEnabled);
-    QGridLayout *layout2 = qobject_cast <QGridLayout*> (mTwDetails->widget (1)->layout());
-    int wid2 = mCbDhcpServerEnabled->style()->pixelMetric (QStyle::PM_IndicatorWidth, &options2, mCbDhcpServerEnabled) +
-               mCbDhcpServerEnabled->style()->pixelMetric (QStyle::PM_CheckBoxLabelSpacing, &options2, mCbDhcpServerEnabled) -
-               layout2->spacing() - 1;
-    QSpacerItem *spacer2 = new QSpacerItem (wid2, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
-    layout2->addItem (spacer2, 1, 0, 4);
-
-    /* Setup connections */
-    connect (mCbManual, SIGNAL (stateChanged (int)),
-             this, SLOT (dhcpClientStatusChanged()));
-    connect (mCbDhcpServerEnabled, SIGNAL (stateChanged (int)),
-             this, SLOT (dhcpServerStatusChanged()));
-
-    /* Applying language settings */
-    retranslateUi();
-
-    /* Fix minimum possible size */
-    resize (minimumSizeHint());
-    qApp->processEvents();
-    setFixedSize (minimumSizeHint());
-}
-
-void VBoxGLSettingsNetworkDetails::getFromItem (NetworkItem *aItem)
-{
-    mItem = aItem;
-
-    /* Host-only Interface */
-    mCbManual->setChecked (!mItem->isDhcpClientEnabled());
-#if !0 /* !defined (Q_WS_WIN32) */
-    /* Disable automatic for all hosts for now */
-    mCbManual->setChecked (true);
-    mCbManual->setEnabled (false);
-#endif
-    dhcpClientStatusChanged();
-
-    /* DHCP Server */
-    mCbDhcpServerEnabled->setChecked (mItem->isDhcpServerEnabled());
-    dhcpServerStatusChanged();
-}
-
-void VBoxGLSettingsNetworkDetails::putBackToItem()
-{
-    /* Host-only Interface */
-    mItem->setDhcpClientEnabled (!mCbManual->isChecked());
-    if (mCbManual->isChecked())
-    {
-        mItem->setInterfaceAddress (mLeIPv4->text());
-        mItem->setInterfaceMask (mLeNMv4->text());
-        if (mItem->isIpv6Supported())
-        {
-            mItem->setInterfaceAddress6 (mLeIPv6->text());
-            mItem->setInterfaceMaskLength6 (mLeNMv6->text());
-        }
-    }
-
-    /* DHCP Server */
-    mItem->setDhcpServerEnabled (mCbDhcpServerEnabled->isChecked());
-    if (mCbDhcpServerEnabled->isChecked())
-    {
-        mItem->setDhcpServerAddress (mLeDhcpAddress->text());
-        mItem->setDhcpServerMask (mLeDhcpMask->text());
-        mItem->setDhcpLowerAddress (mLeDhcpLowerAddress->text());
-        mItem->setDhcpUpperAddress (mLeDhcpUpperAddress->text());
-    }
-}
-
-void VBoxGLSettingsNetworkDetails::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxGLSettingsNetworkDetails::retranslateUi (this);
-}
-
-void VBoxGLSettingsNetworkDetails::dhcpClientStatusChanged()
-{
-    bool isManual = mCbManual->isChecked();
-    bool isIpv6Supported = isManual && mItem->isIpv6Supported();
-
-    mLeIPv4->clear();
-    mLeNMv4->clear();
-    mLeIPv6->clear();
-    mLeNMv6->clear();
-
-    mLbIPv4->setEnabled (isManual);
-    mLbNMv4->setEnabled (isManual);
-    mLeIPv4->setEnabled (isManual);
-    mLeNMv4->setEnabled (isManual);
-    mLbIPv6->setEnabled (isIpv6Supported);
-    mLbNMv6->setEnabled (isIpv6Supported);
-    mLeIPv6->setEnabled (isIpv6Supported);
-    mLeNMv6->setEnabled (isIpv6Supported);
-
-    if (isManual)
-    {
-        mLeIPv4->setText (mItem->interfaceAddress());
-        mLeNMv4->setText (mItem->interfaceMask());
-        if (isIpv6Supported)
-        {
-            mLeIPv6->setText (mItem->interfaceAddress6());
-            mLeNMv6->setText (mItem->interfaceMaskLength6());
-        }
-    }
-}
-
-void VBoxGLSettingsNetworkDetails::dhcpServerStatusChanged()
-{
-    bool isEnabled = mCbDhcpServerEnabled->isChecked();
-
-    mLeDhcpAddress->clear();
-    mLeDhcpMask->clear();
-    mLeDhcpLowerAddress->clear();
-    mLeDhcpUpperAddress->clear();
-
-    mLbDhcpAddress->setEnabled (isEnabled);
-    mLbDhcpMask->setEnabled (isEnabled);
-    mLbDhcpLowerAddress->setEnabled (isEnabled);
-    mLbDhcpUpperAddress->setEnabled (isEnabled);
-    mLeDhcpAddress->setEnabled (isEnabled);
-    mLeDhcpMask->setEnabled (isEnabled);
-    mLeDhcpLowerAddress->setEnabled (isEnabled);
-    mLeDhcpUpperAddress->setEnabled (isEnabled);
-
-    if (isEnabled)
-    {
-        mLeDhcpAddress->setText (mItem->dhcpServerAddress());
-        mLeDhcpMask->setText (mItem->dhcpServerMask());
-        mLeDhcpLowerAddress->setText (mItem->dhcpLowerAddress());
-        mLeDhcpUpperAddress->setText (mItem->dhcpUpperAddress());
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsUpdate.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSettingsUpdate.cpp	(revision 25170)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxGLSettingsUpdate class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxGLSettingsUpdate.h"
-#include "VBoxGlobal.h"
-
-VBoxGLSettingsUpdate::VBoxGLSettingsUpdate()
-    : mSettingsChanged (false)
-    , mLastChosen (0)
-{
-    /* Apply UI decorations */
-    Ui::VBoxGLSettingsUpdate::setupUi (this);
-
-    /* Setup connections */
-    connect (mCbCheck, SIGNAL (toggled (bool)), this, SLOT (toggleUpdater (bool)));
-    connect (mCbOncePer, SIGNAL (activated (int)), this, SLOT (activatedPeriod (int)));
-    connect (mRbStable, SIGNAL (toggled (bool)), this, SLOT (toggledBranch()));
-    connect (mRbAllRelease, SIGNAL (toggled (bool)), this, SLOT (toggledBranch()));
-    connect (mRbWithBetas, SIGNAL (toggled (bool)), this, SLOT (toggledBranch()));
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxGLSettingsUpdate::getFrom (const CSystemProperties &, const VBoxGlobalSettings &)
-{
-    VBoxUpdateData data (vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_UpdateDate));
-
-    mCbCheck->setChecked (!data.isNoNeedToCheck());
-    if (mCbCheck->isChecked())
-    {
-        mCbOncePer->setCurrentIndex (data.periodIndex());
-        if (data.branchIndex() == VBoxUpdateData::BranchWithBetas)
-            mRbWithBetas->setChecked (true);
-        else if (data.branchIndex() == VBoxUpdateData::BranchAllRelease)
-            mRbAllRelease->setChecked (true);
-        else
-            mRbStable->setChecked (true);
-    }
-    mTxDate->setText (data.date());
-
-    mSettingsChanged = false;
-}
-
-void VBoxGLSettingsUpdate::putBackTo (CSystemProperties &, VBoxGlobalSettings &)
-{
-    if (!mSettingsChanged)
-        return;
-
-    VBoxUpdateData newData (periodType(), branchType());
-    vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_UpdateDate, newData.data());
-}
-
-void VBoxGLSettingsUpdate::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mCbCheck);
-    setTabOrder (mCbCheck, mCbOncePer);
-    setTabOrder (mCbOncePer, mRbStable);
-    setTabOrder (mRbStable, mRbAllRelease);
-    setTabOrder (mRbAllRelease, mRbWithBetas);
-}
-
-void VBoxGLSettingsUpdate::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxGLSettingsUpdate::retranslateUi (this);
-
-    /* Retranslate mCbOncePer combobox */
-    int ci = mCbOncePer->currentIndex();
-    mCbOncePer->clear();
-    VBoxUpdateData::populate();
-    mCbOncePer->insertItems (0, VBoxUpdateData::list());
-    mCbOncePer->setCurrentIndex (ci == -1 ? 0 : ci);
-}
-
-void VBoxGLSettingsUpdate::toggleUpdater (bool aOn)
-{
-    /* Enable/disable the sub widget */
-    mLbOncePer->setEnabled (aOn);
-    mCbOncePer->setEnabled (aOn);
-    mLbDate->setEnabled (aOn);
-    mTxDate->setEnabled (aOn);
-    mLbFilter->setEnabled (aOn);
-    mRbStable->setEnabled (aOn);
-    mRbAllRelease->setEnabled (aOn);
-    mRbWithBetas->setEnabled (aOn);
-    mRbStable->setAutoExclusive (aOn);
-    mRbAllRelease->setAutoExclusive (aOn);
-    mRbWithBetas->setAutoExclusive (aOn);
-
-    /* Update 'check for new version' time */
-    if (aOn)
-        activatedPeriod (mCbOncePer->currentIndex());
-    else
-    {
-        activatedPeriod (VBoxUpdateData::PeriodNever);
-        mLastChosen = mRbWithBetas->isChecked() ? mRbWithBetas :
-                      mRbAllRelease->isChecked() ? mRbAllRelease : mRbStable;
-    }
-
-    if (mLastChosen)
-        mLastChosen->setChecked (aOn);
-}
-
-void VBoxGLSettingsUpdate::activatedPeriod (int /*aIndex*/)
-{
-    VBoxUpdateData data (periodType(), branchType());
-    mTxDate->setText (data.date());
-    mSettingsChanged = true;
-}
-
-void VBoxGLSettingsUpdate::toggledBranch()
-{
-    mSettingsChanged = true;
-}
-
-void VBoxGLSettingsUpdate::showEvent (QShowEvent *aEvent)
-{
-    VBoxSettingsPage::showEvent (aEvent);
-
-    /* That little hack allows avoid one of qt4 children focusing bug */
-    QWidget *current = QApplication::focusWidget();
-    mCbOncePer->setFocus (Qt::TabFocusReason);
-    if (current)
-        current->setFocus (Qt::TabFocusReason);
-}
-
-VBoxUpdateData::PeriodType VBoxGLSettingsUpdate::periodType() const
-{
-    VBoxUpdateData::PeriodType result = mCbCheck->isChecked() ?
-        (VBoxUpdateData::PeriodType) mCbOncePer->currentIndex() : VBoxUpdateData::PeriodNever;
-    return result == VBoxUpdateData::PeriodUndefined ? VBoxUpdateData::Period1Day : result;
-}
-
-VBoxUpdateData::BranchType VBoxGLSettingsUpdate::branchType() const
-{
-    if (mRbWithBetas->isChecked())
-        return VBoxUpdateData::BranchWithBetas;
-    else if (mRbAllRelease->isChecked())
-        return VBoxUpdateData::BranchAllRelease;
-    else
-        return VBoxUpdateData::BranchStable;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp	(revision 25170)
+++ 	(revision )
@@ -1,5096 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxGlobal class implementation
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxGlobal.h"
-#include <VBox/VBoxHDD.h>
-
-#include "VBoxDefs.h"
-#include "VBoxSelectorWnd.h"
-#include "VBoxConsoleWnd.h"
-#include "VBoxProblemReporter.h"
-#include "QIHotKeyEdit.h"
-#include "QIMessageBox.h"
-#include "QIDialogButtonBox.h"
-
-#ifdef VBOX_WITH_REGISTRATION
-#include "VBoxRegistrationDlg.h"
-#endif
-#include "VBoxUpdateDlg.h"
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-#include "VBoxFrameBuffer.h"
-#endif
-
-/* Qt includes */
-#include <QProgressDialog>
-#include <QLibraryInfo>
-#include <QFileDialog>
-#include <QToolTip>
-#include <QTranslator>
-#include <QDesktopWidget>
-#include <QDesktopServices>
-#include <QMutex>
-#include <QToolButton>
-#include <QProcess>
-#include <QThread>
-#include <QPainter>
-#include <QSettings>
-#include <QTimer>
-#include <QDir>
-#include <QHelpEvent>
-
-#include <math.h>
-
-#ifdef Q_WS_X11
-#ifndef VBOX_OSE
-# include "VBoxLicenseViewer.h"
-#endif /* VBOX_OSE */
-
-#include <QTextBrowser>
-#include <QScrollBar>
-#include <QX11Info>
-#endif
-
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-#endif /* Q_WS_MAC */
-
-#if defined (Q_WS_WIN)
-#include "shlobj.h"
-#include <QEventLoop>
-#endif
-
-#if defined (Q_WS_X11)
-#undef BOOL /* typedef CARD8 BOOL in Xmd.h conflicts with #define BOOL PRBool
-             * in COMDefs.h. A better fix would be to isolate X11-specific
-             * stuff by placing XX* helpers below to a separate source file. */
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#define BOOL PRBool
-#endif
-
-#include <VBox/sup.h>
-#include <VBox/com/Guid.h>
-
-#include <iprt/asm.h>
-#include <iprt/err.h>
-#include <iprt/param.h>
-#include <iprt/path.h>
-#include <iprt/env.h>
-#include <iprt/file.h>
-#include <iprt/ldr.h>
-#include <iprt/system.h>
-
-#ifdef VBOX_GUI_WITH_SYSTRAY
-#include <iprt/process.h>
-
-#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
-#define HOSTSUFF_EXE ".exe"
-#else /* !RT_OS_WINDOWS */
-#define HOSTSUFF_EXE ""
-#endif /* !RT_OS_WINDOWS */
-#endif
-
-#if defined (Q_WS_X11)
-#include <iprt/mem.h>
-#endif
-
-//#define VBOX_WITH_FULL_DETAILS_REPORT /* hidden for now */
-
-//#warning "port me: check this"
-/// @todo bird: Use (U)INT_PTR, (U)LONG_PTR, DWORD_PTR, or (u)intptr_t.
-#if defined(Q_OS_WIN64)
-typedef __int64 Q_LONG;             /* word up to 64 bit signed */
-typedef unsigned __int64 Q_ULONG;   /* word up to 64 bit unsigned */
-#else
-typedef long Q_LONG;                /* word up to 64 bit signed */
-typedef unsigned long Q_ULONG;      /* word up to 64 bit unsigned */
-#endif
-
-// VBoxMediaEnumEvent
-/////////////////////////////////////////////////////////////////////////////
-
-class VBoxMediaEnumEvent : public QEvent
-{
-public:
-
-    /** Constructs a regular enum event */
-    VBoxMediaEnumEvent (const VBoxMedium &aMedium,
-                        VBoxMediaList::iterator &aIterator)
-        : QEvent ((QEvent::Type) VBoxDefs::MediaEnumEventType)
-        , mMedium (aMedium), mIterator (aIterator), mLast (false)
-        {}
-    /** Constructs the last enum event */
-    VBoxMediaEnumEvent (VBoxMediaList::iterator &aIterator)
-        : QEvent ((QEvent::Type) VBoxDefs::MediaEnumEventType)
-        , mIterator (aIterator), mLast (true)
-        {}
-
-    /** Last enumerated medium (not valid when #last is true) */
-    const VBoxMedium mMedium;
-    /** Opaque iterator provided by the event sender (guaranteed to be
-     *  the same variable for all media in the single enumeration procedure) */
-    VBoxMediaList::iterator &mIterator;
-    /** Whether this is the last event for the given enumeration or not */
-    const bool mLast;
-};
-
-// VirtualBox callback class
-/////////////////////////////////////////////////////////////////////////////
-
-class VBoxCallback : VBOX_SCRIPTABLE_IMPL(IVirtualBoxCallback)
-{
-public:
-
-    VBoxCallback (VBoxGlobal &aGlobal)
-        : mGlobal (aGlobal)
-        , mIsRegDlgOwner (false)
-        , mIsUpdDlgOwner (false)
-#ifdef VBOX_GUI_WITH_SYSTRAY
-        , mIsTrayIconOwner (false)
-#endif
-    {
-#if defined (Q_OS_WIN32)
-        refcnt = 0;
-#endif
-    }
-
-    virtual ~VBoxCallback() {}
-
-    NS_DECL_ISUPPORTS
-
-#if defined (Q_OS_WIN32)
-    STDMETHOD_(ULONG, AddRef)()
-    {
-        return ::InterlockedIncrement (&refcnt);
-    }
-    STDMETHOD_(ULONG, Release)()
-    {
-        long cnt = ::InterlockedDecrement (&refcnt);
-        if (cnt == 0)
-            delete this;
-        return cnt;
-    }
-#endif
-    VBOX_SCRIPTABLE_DISPATCH_IMPL(IVirtualBoxCallback)
-
-    // IVirtualBoxCallback methods
-
-    // Note: we need to post custom events to the GUI event queue
-    // instead of doing what we need directly from here because on Win32
-    // these callback methods are never called on the main GUI thread.
-    // Another reason to handle events asynchronously is that internally
-    // most callback interface methods are called from under the initiator
-    // object's lock, so accessing the initiator object (for example, reading
-    // some property) directly from the callback method will definitely cause
-    // a deadlock.
-
-    STDMETHOD(OnMachineStateChange) (IN_BSTR id, MachineState_T state)
-    {
-        postEvent (new VBoxMachineStateChangeEvent (QString::fromUtf16(id),
-                                                    (KMachineState) state));
-        return S_OK;
-    }
-
-    STDMETHOD(OnMachineDataChange) (IN_BSTR id)
-    {
-        postEvent (new VBoxMachineDataChangeEvent (QString::fromUtf16(id)));
-        return S_OK;
-    }
-
-    STDMETHOD(OnExtraDataCanChange)(IN_BSTR id,
-                                    IN_BSTR key, IN_BSTR value,
-                                    BSTR *error, BOOL *allowChange)
-    {
-        if (!error || !allowChange)
-            return E_INVALIDARG;
-
-        if (com::asGuidStr(id).isNull())
-        {
-            /* it's a global extra data key someone wants to change */
-            QString sKey = QString::fromUtf16 (key);
-            QString sVal = QString::fromUtf16 (value);
-            if (sKey.startsWith ("GUI/"))
-            {
-                if (sKey == VBoxDefs::GUI_RegistrationDlgWinID)
-                {
-                    if (mIsRegDlgOwner)
-                    {
-                        if (sVal.isEmpty() ||
-                            sVal == QString ("%1")
-                                .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
-                            *allowChange = TRUE;
-                        else
-                            *allowChange = FALSE;
-                    }
-                    else
-                        *allowChange = TRUE;
-                    return S_OK;
-                }
-
-                if (sKey == VBoxDefs::GUI_UpdateDlgWinID)
-                {
-                    if (mIsUpdDlgOwner)
-                    {
-                        if (sVal.isEmpty() ||
-                            sVal == QString ("%1")
-                                .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
-                            *allowChange = TRUE;
-                        else
-                            *allowChange = FALSE;
-                    }
-                    else
-                        *allowChange = TRUE;
-                    return S_OK;
-                }
-#ifdef VBOX_GUI_WITH_SYSTRAY
-                if (sKey == VBoxDefs::GUI_TrayIconWinID)
-                {
-                    if (mIsTrayIconOwner)
-                    {
-                        if (sVal.isEmpty() ||
-                            sVal == QString ("%1")
-                                .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
-                            *allowChange = TRUE;
-                        else
-                            *allowChange = FALSE;
-                    }
-                    else
-                        *allowChange = TRUE;
-                    return S_OK;
-                }
-#endif
-                /* try to set the global setting to check its syntax */
-                VBoxGlobalSettings gs (false /* non-null */);
-                if (gs.setPublicProperty (sKey, sVal))
-                {
-                    /* this is a known GUI property key */
-                    if (!gs)
-                    {
-                        /* disallow the change when there is an error*/
-                        *error = SysAllocString ((const OLECHAR *)
-                            (gs.lastError().isNull() ? 0 : gs.lastError().utf16()));
-                        *allowChange = FALSE;
-                    }
-                    else
-                        *allowChange = TRUE;
-                    return S_OK;
-                }
-            }
-        }
-
-        /* not interested in this key -- never disagree */
-        *allowChange = TRUE;
-        return S_OK;
-    }
-
-    STDMETHOD(OnExtraDataChange) (IN_BSTR id,
-                                  IN_BSTR key, IN_BSTR value)
-    {
-        if (com::asGuidStr(id).isNull())
-        {
-            QString sKey = QString::fromUtf16 (key);
-            QString sVal = QString::fromUtf16 (value);
-            if (sKey.startsWith ("GUI/"))
-            {
-                if (sKey == VBoxDefs::GUI_RegistrationDlgWinID)
-                {
-                    if (sVal.isEmpty())
-                    {
-                        mIsRegDlgOwner = false;
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowRegDlgEvent (true));
-                    }
-                    else if (sVal == QString ("%1")
-                             .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
-                    {
-                        mIsRegDlgOwner = true;
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowRegDlgEvent (true));
-                    }
-                    else
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowRegDlgEvent (false));
-                }
-                if (sKey == VBoxDefs::GUI_UpdateDlgWinID)
-                {
-                    if (sVal.isEmpty())
-                    {
-                        mIsUpdDlgOwner = false;
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (true));
-                    }
-                    else if (sVal == QString ("%1")
-                             .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
-                    {
-                        mIsUpdDlgOwner = true;
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (true));
-                    }
-                    else
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (false));
-                }
-                if (sKey == "GUI/LanguageID")
-                    QApplication::postEvent (&mGlobal, new VBoxChangeGUILanguageEvent (sVal));
-#ifdef VBOX_GUI_WITH_SYSTRAY
-                if (sKey == "GUI/MainWindowCount")
-                    QApplication::postEvent (&mGlobal, new VBoxMainWindowCountChangeEvent (sVal.toInt()));
-                if (sKey == VBoxDefs::GUI_TrayIconWinID)
-                {
-                    if (sVal.isEmpty())
-                    {
-                        mIsTrayIconOwner = false;
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowTrayIconEvent (true));
-                    }
-                    else if (sVal == QString ("%1")
-                             .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
-                    {
-                        mIsTrayIconOwner = true;
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowTrayIconEvent (true));
-                    }
-                    else
-                        QApplication::postEvent (&mGlobal, new VBoxCanShowTrayIconEvent (false));
-                }
-                if (sKey == "GUI/TrayIcon/Enabled")
-                    QApplication::postEvent (&mGlobal, new VBoxChangeTrayIconEvent ((sVal.toLower() == "true") ? true : false));
-#endif
-#ifdef Q_WS_MAC
-                if (sKey == VBoxDefs::GUI_RealtimeDockIconUpdateEnabled)
-                {
-                    /* Default to true if it is an empty value */
-                    QString testStr = sVal.toLower();
-                    bool f = (testStr.isEmpty() || testStr == "true");
-                    QApplication::postEvent (&mGlobal, new VBoxChangeDockIconUpdateEvent (f));
-                }
-#endif
-
-                mMutex.lock();
-                mGlobal.gset.setPublicProperty (sKey, sVal);
-                mMutex.unlock();
-                Assert (!!mGlobal.gset);
-            }
-        }
-        return S_OK;
-    }
-
-    STDMETHOD(OnMediumRegistered) (IN_BSTR id, DeviceType_T type,
-                                   BOOL registered)
-    {
-        /** @todo */
-        Q_UNUSED (id);
-        Q_UNUSED (type);
-        Q_UNUSED (registered);
-        return S_OK;
-    }
-
-    STDMETHOD(OnMachineRegistered) (IN_BSTR id, BOOL registered)
-    {
-        postEvent (new VBoxMachineRegisteredEvent (QString::fromUtf16(id),
-                                                   registered));
-        return S_OK;
-    }
-
-    STDMETHOD(OnSessionStateChange) (IN_BSTR id, SessionState_T state)
-    {
-        postEvent (new VBoxSessionStateChangeEvent (QString::fromUtf16(id),
-                                                    (KSessionState) state));
-        return S_OK;
-    }
-
-    STDMETHOD(OnSnapshotTaken) (IN_BSTR aMachineId, IN_BSTR aSnapshotId)
-    {
-        postEvent (new VBoxSnapshotEvent (QString::fromUtf16(aMachineId),
-                                          QString::fromUtf16(aSnapshotId),
-                                          VBoxSnapshotEvent::Taken));
-        return S_OK;
-    }
-
-    STDMETHOD(OnSnapshotDiscarded) (IN_BSTR aMachineId, IN_BSTR aSnapshotId)
-    {
-        postEvent (new VBoxSnapshotEvent (QString::fromUtf16(aMachineId),
-                                          QString::fromUtf16(aSnapshotId),
-                                          VBoxSnapshotEvent::Discarded));
-        return S_OK;
-    }
-
-    STDMETHOD(OnSnapshotChange) (IN_BSTR aMachineId, IN_BSTR aSnapshotId)
-    {
-        postEvent (new VBoxSnapshotEvent (QString::fromUtf16(aMachineId),
-                                          QString::fromUtf16(aSnapshotId),
-                                          VBoxSnapshotEvent::Changed));
-        return S_OK;
-    }
-
-    STDMETHOD(OnGuestPropertyChange) (IN_BSTR /* id */,
-                                      IN_BSTR /* key */,
-                                      IN_BSTR /* value */,
-                                      IN_BSTR /* flags */)
-    {
-        return S_OK;
-    }
-
-private:
-
-    void postEvent (QEvent *e)
-    {
-        // currently, we don't post events if we are in the VM execution
-        // console mode, to save some CPU ticks (so far, there was no need
-        // to handle VirtualBox callback events in the execution console mode)
-        if (!mGlobal.isVMConsoleProcess())
-            QApplication::postEvent (&mGlobal, e);
-    }
-
-    VBoxGlobal &mGlobal;
-
-    /** protects #OnExtraDataChange() */
-    QMutex mMutex;
-
-    bool mIsRegDlgOwner;
-    bool mIsUpdDlgOwner;
-#ifdef VBOX_GUI_WITH_SYSTRAY
-    bool mIsTrayIconOwner;
-#endif
-
-#if defined (Q_OS_WIN32)
-private:
-    long refcnt;
-#endif
-};
-
-#if !defined (Q_OS_WIN32)
-NS_DECL_CLASSINFO (VBoxCallback)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI (VBoxCallback, IVirtualBoxCallback)
-#endif
-
-// VBoxGlobal
-////////////////////////////////////////////////////////////////////////////////
-
-static bool sVBoxGlobalInited = false;
-static bool sVBoxGlobalInCleanup = false;
-
-/** @internal
- *
- *  Special routine to do VBoxGlobal cleanup when the application is being
- *  terminated. It is called before some essential Qt functionality (for
- *  instance, QThread) becomes unavailable, allowing us to use it from
- *  VBoxGlobal::cleanup() if necessary.
- */
-static void vboxGlobalCleanup()
-{
-    Assert (!sVBoxGlobalInCleanup);
-    sVBoxGlobalInCleanup = true;
-    vboxGlobal().cleanup();
-}
-
-/** @internal
- *
- *  Determines the rendering mode from the argument. Sets the appropriate
- *  default rendering mode if the argumen is NULL.
- */
-static VBoxDefs::RenderMode vboxGetRenderMode (const char *aModeStr)
-{
-    VBoxDefs::RenderMode mode = VBoxDefs::InvalidRenderMode;
-
-#if defined (Q_WS_MAC) && defined (VBOX_GUI_USE_QUARTZ2D)
-    mode = VBoxDefs::Quartz2DMode;
-# ifdef RT_ARCH_X86
-    /* Quartz2DMode doesn't refresh correctly on 32-bit Snow Leopard, use image mode. */
-//    char szRelease[80];
-//    if (    RT_SUCCESS (RTSystemQueryOSInfo (RTSYSOSINFO_RELEASE, szRelease, sizeof (szRelease)))
-//        &&  !strncmp (szRelease, "10.", 3))
-//        mode = VBoxDefs::QImageMode;
-# endif
-#elif (defined (Q_WS_WIN32) || defined (Q_WS_PM) || defined (Q_WS_X11)) && defined (VBOX_GUI_USE_QIMAGE)
-    mode = VBoxDefs::QImageMode;
-#elif defined (Q_WS_X11) && defined (VBOX_GUI_USE_SDL)
-    mode = VBoxDefs::SDLMode;
-#elif defined (VBOX_GUI_USE_QIMAGE)
-    mode = VBoxDefs::QImageMode;
-#else
-# error "Cannot determine the default render mode!"
-#endif
-
-    if (aModeStr)
-    {
-        if (0) ;
-#if defined (VBOX_GUI_USE_QIMAGE)
-        else if (::strcmp (aModeStr, "image") == 0)
-            mode = VBoxDefs::QImageMode;
-#endif
-#if defined (VBOX_GUI_USE_SDL)
-        else if (::strcmp (aModeStr, "sdl") == 0)
-            mode = VBoxDefs::SDLMode;
-#endif
-#if defined (VBOX_GUI_USE_DDRAW)
-        else if (::strcmp (aModeStr, "ddraw") == 0)
-            mode = VBoxDefs::DDRAWMode;
-#endif
-#if defined (VBOX_GUI_USE_QUARTZ2D)
-        else if (::strcmp (aModeStr, "quartz2d") == 0)
-            mode = VBoxDefs::Quartz2DMode;
-#endif
-#if defined (VBOX_GUI_USE_QGL)
-        else if (::strcmp (aModeStr, "qgl") == 0)
-            mode = VBoxDefs::QGLMode;
-#endif
-//#if defined (VBOX_GUI_USE_QGL)
-//        else if (::strcmp (aModeStr, "qgloverlay") == 0)
-//            mode = VBoxDefs::QGLOverlayMode;
-//#endif
-
-    }
-
-    return mode;
-}
-
-/** @class VBoxGlobal
- *
- *  The VBoxGlobal class incapsulates the global VirtualBox data.
- *
- *  There is only one instance of this class per VirtualBox application,
- *  the reference to it is returned by the static instance() method, or by
- *  the global vboxGlobal() function, that is just an inlined shortcut.
- */
-
-VBoxGlobal::VBoxGlobal()
-    : mValid (false)
-    , mSelectorWnd (NULL), mConsoleWnd (NULL)
-    , mMainWindow (NULL)
-#ifdef VBOX_WITH_REGISTRATION
-    , mRegDlg (NULL)
-#endif
-    , mUpdDlg (NULL)
-#ifdef VBOX_GUI_WITH_SYSTRAY
-    , mIsTrayMenu (false)
-    , mIncreasedWindowCounter (false)
-#endif
-    , mMediaEnumThread (NULL)
-    , mVerString ("1.0")
-{
-}
-
-//
-// Public members
-/////////////////////////////////////////////////////////////////////////////
-
-/**
- *  Returns a reference to the global VirtualBox data, managed by this class.
- *
- *  The main() function of the VBox GUI must call this function soon after
- *  creating a QApplication instance but before opening any of the main windows
- *  (to let the VBoxGlobal initialization procedure use various Qt facilities),
- *  and continue execution only when the isValid() method of the returned
- *  instancereturns true, i.e. do something like:
- *
- *  @code
- *  if ( !VBoxGlobal::instance().isValid() )
- *      return 1;
- *  @endcode
- *  or
- *  @code
- *  if ( !vboxGlobal().isValid() )
- *      return 1;
- *  @endcode
- *
- *  @note Some VBoxGlobal methods can be used on a partially constructed
- *  VBoxGlobal instance, i.e. from constructors and methods called
- *  from the VBoxGlobal::init() method, which obtain the instance
- *  using this instance() call or the ::vboxGlobal() function. Currently, such
- *  methods are:
- *      #vmStateText, #vmTypeIcon, #vmTypeText, #vmTypeTextList, #vmTypeFromText.
- *
- *  @see ::vboxGlobal
- */
-VBoxGlobal &VBoxGlobal::instance()
-{
-    static VBoxGlobal vboxGlobal_instance;
-
-    if (!sVBoxGlobalInited)
-    {
-        /* check that a QApplication instance is created */
-        if (qApp)
-        {
-            sVBoxGlobalInited = true;
-            vboxGlobal_instance.init();
-            /* add our cleanup handler to the list of Qt post routines */
-            qAddPostRoutine (vboxGlobalCleanup);
-        }
-        else
-            AssertMsgFailed (("Must construct a QApplication first!"));
-    }
-    return vboxGlobal_instance;
-}
-
-VBoxGlobal::~VBoxGlobal()
-{
-    qDeleteAll (mOsTypeIcons);
-    qDeleteAll (mVMStateIcons);
-    qDeleteAll (mVMStateColors);
-}
-
-/* static */
-QString VBoxGlobal::qtRTVersionString()
-{
-    return QString::fromLatin1 (qVersion());
-}
-
-/* static */
-uint VBoxGlobal::qtRTVersion()
-{
-    QString rt_ver_str = VBoxGlobal::qtRTVersionString();
-    return (rt_ver_str.section ('.', 0, 0).toInt() << 16) +
-           (rt_ver_str.section ('.', 1, 1).toInt() << 8) +
-           rt_ver_str.section ('.', 2, 2).toInt();
-}
-
-/* static */
-QString VBoxGlobal::qtCTVersionString()
-{
-    return QString::fromLatin1 (QT_VERSION_STR);
-}
-
-/* static */
-uint VBoxGlobal::qtCTVersion()
-{
-    QString ct_ver_str = VBoxGlobal::qtCTVersionString();
-    return (ct_ver_str.section ('.', 0, 0).toInt() << 16) +
-           (ct_ver_str.section ('.', 1, 1).toInt() << 8) +
-           ct_ver_str.section ('.', 2, 2).toInt();
-}
-
-/**
- *  Sets the new global settings and saves them to the VirtualBox server.
- */
-bool VBoxGlobal::setSettings (const VBoxGlobalSettings &gs)
-{
-    gs.save (mVBox);
-
-    if (!mVBox.isOk())
-    {
-        vboxProblem().cannotSaveGlobalConfig (mVBox);
-        return false;
-    }
-
-    /* We don't assign gs to our gset member here, because VBoxCallback
-     * will update gset as necessary when new settings are successfullly
-     * sent to the VirtualBox server by gs.save(). */
-
-    return true;
-}
-
-/**
- *  Returns a reference to the main VBox VM Selector window.
- *  The reference is valid until application termination.
- *
- *  There is only one such a window per VirtualBox application.
- */
-VBoxSelectorWnd &VBoxGlobal::selectorWnd()
-{
-#if defined (VBOX_GUI_SEPARATE_VM_PROCESS)
-    AssertMsg (!vboxGlobal().isVMConsoleProcess(),
-               ("Must NOT be a VM console process"));
-#endif
-
-    Assert (mValid);
-
-    if (!mSelectorWnd)
-    {
-        /*
-         *  We pass the address of mSelectorWnd to the constructor to let it be
-         *  initialized right after the constructor is called. It is necessary
-         *  to avoid recursion, since this method may be (and will be) called
-         *  from the below constructor or from constructors/methods it calls.
-         */
-        VBoxSelectorWnd *w = new VBoxSelectorWnd (&mSelectorWnd, 0);
-        Assert (w == mSelectorWnd);
-        NOREF(w);
-    }
-
-    return *mSelectorWnd;
-}
-
-/**
- *  Returns a reference to the main VBox VM Console window.
- *  The reference is valid until application termination.
- *
- *  There is only one such a window per VirtualBox application.
- */
-VBoxConsoleWnd &VBoxGlobal::consoleWnd()
-{
-#if defined (VBOX_GUI_SEPARATE_VM_PROCESS)
-    AssertMsg (vboxGlobal().isVMConsoleProcess(),
-               ("Must be a VM console process"));
-#endif
-
-    Assert (mValid);
-
-    if (!mConsoleWnd)
-    {
-        /*
-         *  We pass the address of mConsoleWnd to the constructor to let it be
-         *  initialized right after the constructor is called. It is necessary
-         *  to avoid recursion, since this method may be (and will be) called
-         *  from the below constructor or from constructors/methods it calls.
-         */
-        VBoxConsoleWnd *w = new VBoxConsoleWnd (&mConsoleWnd, 0);
-        Assert (w == mConsoleWnd);
-        NOREF(w);
-    }
-
-    return *mConsoleWnd;
-}
-
-bool VBoxGlobal::brandingIsActive (bool aForce /* = false*/)
-{
-    if (aForce)
-        return true;
-
-    if (mBrandingConfig.isEmpty())
-    {
-        mBrandingConfig = QDir(QApplication::applicationDirPath()).absolutePath();
-        mBrandingConfig += "/custom/custom.ini";
-    }
-    return QFile::exists (mBrandingConfig);
-}
-
-/**
-  * Gets a value from the custom .ini file
-  */
-QString VBoxGlobal::brandingGetKey (QString aKey)
-{
-    QSettings s(mBrandingConfig, QSettings::IniFormat);
-    return s.value(QString("%1").arg(aKey)).toString();
-}
-
-#ifdef VBOX_GUI_WITH_SYSTRAY
-
-/**
- *  Returns true if the current instance a systray menu only (started with
- *  "-systray" parameter).
- */
-bool VBoxGlobal::isTrayMenu() const
-{
-    return mIsTrayMenu;
-}
-
-void VBoxGlobal::setTrayMenu(bool aIsTrayMenu)
-{
-    mIsTrayMenu = aIsTrayMenu;
-}
-
-/**
- *  Spawns a new selector window (process).
- */
-void VBoxGlobal::trayIconShowSelector()
-{
-    /* Get the path to the executable. */
-    char path [RTPATH_MAX];
-    RTPathAppPrivateArch (path, RTPATH_MAX);
-    size_t sz = strlen (path);
-    path [sz++] = RTPATH_DELIMITER;
-    path [sz] = 0;
-    char *cmd = path + sz;
-    sz = RTPATH_MAX - sz;
-
-    int rc = 0;
-    RTPROCESS pid = NIL_RTPROCESS;
-    RTENV env = RTENV_DEFAULT;
-
-    const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE;
-    Assert (sz >= sizeof (VirtualBox_exe));
-    strcpy (cmd, VirtualBox_exe);
-    const char * args[] = {path, 0 };
-# ifdef RT_OS_WINDOWS
-    rc = RTProcCreate (path, args, env, 0, &pid);
-# else
-    rc = RTProcCreate (path, args, env, RTPROC_FLAGS_DAEMONIZE, &pid);
-# endif
-    if (RT_FAILURE (rc))
-        LogRel(("Systray: Failed to start new selector window! Path=%s, rc=%Rrc\n", path, rc));
-}
-
-/**
- *  Tries to install the tray icon using the current instance (singleton).
- *  Returns true if this instance is the tray icon, false if not.
- */
-bool VBoxGlobal::trayIconInstall()
-{
-    int rc = 0;
-    QString strTrayWinID = mVBox.GetExtraData (VBoxDefs::GUI_TrayIconWinID);
-    if (false == strTrayWinID.isEmpty())
-    {
-        /* Check if current tray icon is alive by writing some bogus value. */
-        mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, "0");
-        if (mVBox.isOk())
-        {
-            /* Current tray icon died - clean up. */
-            mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, NULL);
-            strTrayWinID.clear();
-        }
-    }
-
-    /* Is there already a tray icon or is tray icon not active? */
-    if (   (mIsTrayMenu == false)
-        && (vboxGlobal().settings().trayIconEnabled())
-        && (QSystemTrayIcon::isSystemTrayAvailable())
-        && (strTrayWinID.isEmpty()))
-    {
-        /* Get the path to the executable. */
-        char path [RTPATH_MAX];
-        RTPathAppPrivateArch (path, RTPATH_MAX);
-        size_t sz = strlen (path);
-        path [sz++] = RTPATH_DELIMITER;
-        path [sz] = 0;
-        char *cmd = path + sz;
-        sz = RTPATH_MAX - sz;
-
-        RTPROCESS pid = NIL_RTPROCESS;
-        RTENV env = RTENV_DEFAULT;
-
-        const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE;
-        Assert (sz >= sizeof (VirtualBox_exe));
-        strcpy (cmd, VirtualBox_exe);
-        const char * args[] = {path, "-systray", 0 };
-    # ifdef RT_OS_WINDOWS /** @todo drop this once the RTProcCreate bug has been fixed */
-        rc = RTProcCreate (path, args, env, 0, &pid);
-    # else
-        rc = RTProcCreate (path, args, env, RTPROC_FLAGS_DAEMONIZE, &pid);
-    # endif
-
-        if (RT_FAILURE (rc))
-        {
-            LogRel(("Systray: Failed to start systray window! Path=%s, rc=%Rrc\n", path, rc));
-            return false;
-        }
-    }
-
-    if (mIsTrayMenu)
-    {
-        // Use this selector for displaying the tray icon
-        mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID,
-                            QString ("%1").arg ((qulonglong) vboxGlobal().mainWindow()->winId()));
-
-        /* The first process which can grab this "mutex" will win ->
-         * It will be the tray icon menu then. */
-        if (mVBox.isOk())
-        {
-            emit trayIconShow (*(new VBoxShowTrayIconEvent (true)));
-            return true;
-        }
-    }
-
-    return false;
-}
-
-#endif
-
-/**
- *  Returns the list of few guest OS types, queried from
- *  IVirtualBox corresponding to every family id.
- */
-QList <CGuestOSType> VBoxGlobal::vmGuestOSFamilyList() const
-{
-    QList <CGuestOSType> result;
-    for (int i = 0 ; i < mFamilyIDs.size(); ++ i)
-        result << mTypes [i][0];
-    return result;
-}
-
-/**
- *  Returns the list of all guest OS types, queried from
- *  IVirtualBox corresponding to passed family id.
- */
-QList <CGuestOSType> VBoxGlobal::vmGuestOSTypeList (const QString &aFamilyId) const
-{
-    AssertMsg (mFamilyIDs.contains (aFamilyId), ("Family ID incorrect: '%s'.", aFamilyId.toLatin1().constData()));
-    return mFamilyIDs.contains (aFamilyId) ?
-           mTypes [mFamilyIDs.indexOf (aFamilyId)] : QList <CGuestOSType>();
-}
-
-/**
- *  Returns the icon corresponding to the given guest OS type id.
- */
-QPixmap VBoxGlobal::vmGuestOSTypeIcon (const QString &aTypeId) const
-{
-    static const QPixmap none;
-    QPixmap *p = mOsTypeIcons.value (aTypeId);
-    AssertMsg (p, ("Icon for type '%s' must be defined.", aTypeId.toLatin1().constData()));
-    return p ? *p : none;
-}
-
-/**
- *  Returns the guest OS type object corresponding to the given type id of list
- *  containing OS types related to OS family determined by family id attribute.
- *  If the index is invalid a null object is returned.
- */
-CGuestOSType VBoxGlobal::vmGuestOSType (const QString &aTypeId,
-             const QString &aFamilyId /* = QString::null */) const
-{
-    QList <CGuestOSType> list;
-    if (mFamilyIDs.contains (aFamilyId))
-    {
-        list = mTypes [mFamilyIDs.indexOf (aFamilyId)];
-    }
-    else
-    {
-        for (int i = 0; i < mFamilyIDs.size(); ++ i)
-            list += mTypes [i];
-    }
-    for (int j = 0; j < list.size(); ++ j)
-        if (!list [j].GetId().compare (aTypeId))
-            return list [j];
-    AssertMsgFailed (("Type ID incorrect: '%s'.", aTypeId.toLatin1().constData()));
-    return CGuestOSType();
-}
-
-/**
- *  Returns the description corresponding to the given guest OS type id.
- */
-QString VBoxGlobal::vmGuestOSTypeDescription (const QString &aTypeId) const
-{
-    for (int i = 0; i < mFamilyIDs.size(); ++ i)
-    {
-        QList <CGuestOSType> list (mTypes [i]);
-        for ( int j = 0; j < list.size(); ++ j)
-            if (!list [j].GetId().compare (aTypeId))
-                return list [j].GetDescription();
-    }
-    return QString::null;
-}
-
-/**
- * Returns a string representation of the given channel number on the given storage bus.
- * Complementary to #toStorageChannel (KStorageBus, const QString &) const.
- */
-QString VBoxGlobal::toString (KStorageBus aBus, LONG aChannel) const
-{
-    QString channel;
-
-    switch (aBus)
-    {
-        case KStorageBus_IDE:
-        {
-            if (aChannel == 0 || aChannel == 1)
-            {
-                channel = mStorageBusChannels [aChannel];
-                break;
-            }
-            AssertMsgFailed (("Invalid IDE channel %d\n", aChannel));
-            break;
-        }
-        case KStorageBus_SATA:
-        case KStorageBus_SCSI:
-        {
-            channel = mStorageBusChannels [2].arg (aChannel);
-            break;
-        }
-        case KStorageBus_Floppy:
-        {
-            AssertMsgFailed (("Floppy have no channels, only devices\n"));
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed (("Invalid bus type %d\n", aBus));
-            break;
-        }
-    }
-
-    Assert (!channel.isNull());
-    return channel;
-}
-
-/**
- * Returns a channel number on the given storage bus corresponding to the given string representation.
- * Complementary to #toString (KStorageBus, LONG) const.
- */
-LONG VBoxGlobal::toStorageChannel (KStorageBus aBus, const QString &aChannel) const
-{
-    LONG channel = 0;
-
-    switch (aBus)
-    {
-        case KStorageBus_IDE:
-        {
-            QLongStringHash::const_iterator it = qFind (mStorageBusChannels.begin(), mStorageBusChannels.end(), aChannel);
-            AssertMsgBreak (it != mStorageBusChannels.end(), ("No value for {%s}\n", aChannel.toLatin1().constData()));
-            channel = it.key();
-            break;
-        }
-        case KStorageBus_SATA:
-        case KStorageBus_SCSI:
-        {
-            QString tpl = mStorageBusChannels [2].arg ("");
-            if (aChannel.startsWith (tpl))
-            {
-                channel = aChannel.right (aChannel.length() - tpl.length()).toLong();
-                break;
-            }
-            AssertMsgFailed (("Invalid channel {%s}\n", aChannel.toLatin1().constData()));
-            break;
-        }
-        case KStorageBus_Floppy:
-        {
-            channel = 0;
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed (("Invalid bus type %d\n", aBus));
-            break;
-        }
-    }
-
-    return channel;
-}
-
-/**
- * Returns a string representation of the given device number of the given channel on the given storage bus.
- * Complementary to #toStorageDevice (KStorageBus, LONG, const QString &) const.
- */
-QString VBoxGlobal::toString (KStorageBus aBus, LONG aChannel, LONG aDevice) const
-{
-    NOREF (aChannel);
-
-    QString device;
-
-    switch (aBus)
-    {
-        case KStorageBus_IDE:
-        {
-            if (aDevice == 0 || aDevice == 1)
-            {
-                device = mStorageBusDevices [aDevice];
-                break;
-            }
-            AssertMsgFailed (("Invalid device %d\n", aDevice));
-            break;
-        }
-        case KStorageBus_SATA:
-        case KStorageBus_SCSI:
-        {
-            AssertMsgFailed (("SATA & SCSI have no devices, only channels\n"));
-            break;
-        }
-        case KStorageBus_Floppy:
-        {
-            AssertMsgBreak (aChannel == 0, ("Invalid channel %d\n", aChannel));
-            device = mStorageBusDevices [2].arg (aDevice);
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed (("Invalid bus type %d\n", aBus));
-            break;
-        }
-    }
-
-    Assert (!device.isNull());
-    return device;
-}
-
-/**
- * Returns a device number of the given channel on the given storage bus corresponding to the given string representation.
- * Complementary to #toString (KStorageBus, LONG, LONG) const.
- */
-LONG VBoxGlobal::toStorageDevice (KStorageBus aBus, LONG aChannel, const QString &aDevice) const
-{
-    NOREF (aChannel);
-
-    LONG device = 0;
-
-    switch (aBus)
-    {
-        case KStorageBus_IDE:
-        {
-            QLongStringHash::const_iterator it = qFind (mStorageBusDevices.begin(), mStorageBusDevices.end(), aDevice);
-            AssertMsgBreak (it != mStorageBusDevices.end(), ("No value for {%s}", aDevice.toLatin1().constData()));
-            device = it.key();
-            break;
-        }
-        case KStorageBus_SATA:
-        case KStorageBus_SCSI:
-        {
-            device = 0;
-            break;
-        }
-        case KStorageBus_Floppy:
-        {
-            AssertMsgBreak (aChannel == 0, ("Invalid channel %d\n", aChannel));
-            QString tpl = mStorageBusDevices [2].arg ("");
-            if (aDevice.startsWith (tpl))
-            {
-                device = aDevice.right (aDevice.length() - tpl.length()).toLong();
-                break;
-            }
-            AssertMsgFailed (("Invalid device {%s}\n", aDevice.toLatin1().constData()));
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed (("Invalid bus type %d\n", aBus));
-            break;
-        }
-    }
-
-    return device;
-}
-
-/**
- * Returns a full string representation of the given device of the given channel on the given storage bus.
- * This method does not uses any separate string tags related to bus, channel, device, it has own
- * separately translated string tags allowing to translate a full slot name into human readable format
- * to be consistent with i18n.
- * Complementary to #toStorageSlot (const QString &) const.
- */
-QString VBoxGlobal::toString (StorageSlot aSlot) const
-{
-    switch (aSlot.bus)
-    {
-        case KStorageBus_IDE:
-        case KStorageBus_SATA:
-        case KStorageBus_SCSI:
-        case KStorageBus_Floppy:
-            break;
-
-        default:
-        {
-            AssertMsgFailed (("Invalid bus type %d\n", aSlot.bus));
-            break;
-        }
-    }
-
-    int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (aSlot.bus);
-    int maxDevice = virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus (aSlot.bus);
-    if (aSlot.port < 0 || aSlot.port > maxPort)
-        AssertMsgFailed (("Invalid port %d\n", aSlot.port));
-    if (aSlot.device < 0 || aSlot.device > maxDevice)
-        AssertMsgFailed (("Invalid device %d\n", aSlot.device));
-
-    QString result;
-    switch (aSlot.bus)
-    {
-        case KStorageBus_IDE:
-        {
-            result = mSlotTemplates [aSlot.port * maxDevice + aSlot.device];
-            break;
-        }
-        case KStorageBus_SATA:
-        {
-            result = mSlotTemplates [4].arg (aSlot.port);
-            break;
-        }
-        case KStorageBus_SCSI:
-        {
-            result = mSlotTemplates [5].arg (aSlot.port);
-            break;
-        }
-        case KStorageBus_Floppy:
-        {
-            result = mSlotTemplates [6].arg (aSlot.device);
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed (("Invalid bus type %d\n", aSlot.bus));
-            break;
-        }
-    }
-    return result;
-}
-
-/**
- * Returns a StorageSlot based on the given device of the given channel on the given storage bus.
- * Complementary to #toFullString (StorageSlot) const.
- */
-StorageSlot VBoxGlobal::toStorageSlot (const QString &aSlot) const
-{
-    int index = -1;
-    QRegExp regExp;
-    for (int i = 0; i < mSlotTemplates.size(); ++ i)
-    {
-        regExp = QRegExp (i >= 0 && i <= 3 ? mSlotTemplates [i] : mSlotTemplates [i].arg ("(\\d+)"));
-        if (regExp.indexIn (aSlot) != -1)
-        {
-            index = i;
-            break;
-        }
-    }
-
-    StorageSlot result;
-    switch (index)
-    {
-        case 0:
-        case 1:
-        case 2:
-        case 3:
-        {
-            result.bus = KStorageBus_IDE;
-            int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (result.bus);
-            result.port = index / maxPort;
-            result.device = index % maxPort;
-            break;
-        }
-        case 4:
-        {
-            result.bus = KStorageBus_SATA;
-            int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (result.bus);
-            result.port = regExp.cap (1).toInt();
-            if (result.port < 0 || result.port > maxPort)
-                AssertMsgFailed (("Invalid port %d\n", result.port));
-            break;
-        }
-        case 5:
-        {
-            result.bus = KStorageBus_SCSI;
-            int maxPort = virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus (result.bus);
-            result.port = regExp.cap (1).toInt();
-            if (result.port < 0 || result.port > maxPort)
-                AssertMsgFailed (("Invalid port %d\n", result.port));
-            break;
-        }
-        case 6:
-        {
-            result.bus = KStorageBus_Floppy;
-            int maxDevice = virtualBox().GetSystemProperties().GetMaxDevicesPerPortForStorageBus (result.bus);
-            result.device = regExp.cap (1).toInt();
-            if (result.device < 0 || result.device > maxDevice)
-                AssertMsgFailed (("Invalid device %d\n", result.device));
-            break;
-        }
-        default:
-            break;
-    }
-    return result;
-}
-
-/**
- * Returns the list of all device types (VirtualBox::DeviceType COM enum).
- */
-QStringList VBoxGlobal::deviceTypeStrings() const
-{
-    static QStringList list;
-    if (list.empty())
-        for (QULongStringHash::const_iterator it = mDeviceTypes.begin();
-             it != mDeviceTypes.end(); ++ it)
-            list += it.value();
-    return list;
-}
-
-struct PortConfig
-{
-    const char *name;
-    const ulong IRQ;
-    const ulong IOBase;
-};
-
-static const PortConfig kComKnownPorts[] =
-{
-    { "COM1", 4, 0x3F8 },
-    { "COM2", 3, 0x2F8 },
-    { "COM3", 4, 0x3E8 },
-    { "COM4", 3, 0x2E8 },
-    /* must not contain an element with IRQ=0 and IOBase=0 used to cause
-     * toCOMPortName() to return the "User-defined" string for these values. */
-};
-
-static const PortConfig kLptKnownPorts[] =
-{
-    { "LPT1", 7, 0x3BC },
-    { "LPT2", 5, 0x378 },
-    { "LPT3", 5, 0x278 },
-    /* must not contain an element with IRQ=0 and IOBase=0 used to cause
-     * toLPTPortName() to return the "User-defined" string for these values. */
-};
-
-/**
- *  Returns the list of the standard COM port names (i.e. "COMx").
- */
-QStringList VBoxGlobal::COMPortNames() const
-{
-    QStringList list;
-    for (size_t i = 0; i < RT_ELEMENTS (kComKnownPorts); ++ i)
-        list << kComKnownPorts [i].name;
-
-    return list;
-}
-
-/**
- *  Returns the list of the standard LPT port names (i.e. "LPTx").
- */
-QStringList VBoxGlobal::LPTPortNames() const
-{
-    QStringList list;
-    for (size_t i = 0; i < RT_ELEMENTS (kLptKnownPorts); ++ i)
-        list << kLptKnownPorts [i].name;
-
-    return list;
-}
-
-/**
- *  Returns the name of the standard COM port corresponding to the given
- *  parameters, or "User-defined" (which is also returned when both
- *  @a aIRQ and @a aIOBase are 0).
- */
-QString VBoxGlobal::toCOMPortName (ulong aIRQ, ulong aIOBase) const
-{
-    for (size_t i = 0; i < RT_ELEMENTS (kComKnownPorts); ++ i)
-        if (kComKnownPorts [i].IRQ == aIRQ &&
-            kComKnownPorts [i].IOBase == aIOBase)
-            return kComKnownPorts [i].name;
-
-    return mUserDefinedPortName;
-}
-
-/**
- *  Returns the name of the standard LPT port corresponding to the given
- *  parameters, or "User-defined" (which is also returned when both
- *  @a aIRQ and @a aIOBase are 0).
- */
-QString VBoxGlobal::toLPTPortName (ulong aIRQ, ulong aIOBase) const
-{
-    for (size_t i = 0; i < RT_ELEMENTS (kLptKnownPorts); ++ i)
-        if (kLptKnownPorts [i].IRQ == aIRQ &&
-            kLptKnownPorts [i].IOBase == aIOBase)
-            return kLptKnownPorts [i].name;
-
-    return mUserDefinedPortName;
-}
-
-/**
- *  Returns port parameters corresponding to the given standard COM name.
- *  Returns @c true on success, or @c false if the given port name is not one
- *  of the standard names (i.e. "COMx").
- */
-bool VBoxGlobal::toCOMPortNumbers (const QString &aName, ulong &aIRQ,
-                                   ulong &aIOBase) const
-{
-    for (size_t i = 0; i < RT_ELEMENTS (kComKnownPorts); ++ i)
-        if (strcmp (kComKnownPorts [i].name, aName.toUtf8().data()) == 0)
-        {
-            aIRQ = kComKnownPorts [i].IRQ;
-            aIOBase = kComKnownPorts [i].IOBase;
-            return true;
-        }
-
-    return false;
-}
-
-/**
- *  Returns port parameters corresponding to the given standard LPT name.
- *  Returns @c true on success, or @c false if the given port name is not one
- *  of the standard names (i.e. "LPTx").
- */
-bool VBoxGlobal::toLPTPortNumbers (const QString &aName, ulong &aIRQ,
-                                   ulong &aIOBase) const
-{
-    for (size_t i = 0; i < RT_ELEMENTS (kLptKnownPorts); ++ i)
-        if (strcmp (kLptKnownPorts [i].name, aName.toUtf8().data()) == 0)
-        {
-            aIRQ = kLptKnownPorts [i].IRQ;
-            aIOBase = kLptKnownPorts [i].IOBase;
-            return true;
-        }
-
-    return false;
-}
-
-/**
- * Searches for the given hard disk in the list of known media descriptors and
- * calls VBoxMedium::details() on the found desriptor.
- *
- * If the requeststed hard disk is not found (for example, it's a new hard disk
- * for a new VM created outside our UI), then media enumeration is requested and
- * the search is repeated. We assume that the secont attempt always succeeds and
- * assert otherwise.
- *
- * @note Technically, the second attempt may fail if, for example, the new hard
- *       passed to this method disk gets removed before #startEnumeratingMedia()
- *       succeeds. This (unexpected object uninitialization) is a generic
- *       problem though and needs to be addressed using exceptions (see also the
- *       @todo in VBoxMedium::details()).
- */
-QString VBoxGlobal::details (const CMedium &aMedium, bool aPredictDiff)
-{
-    CMedium cmedium (aMedium);
-    VBoxMedium medium;
-
-    if (!findMedium (cmedium, medium))
-    {
-        /* Medium may be new and not already in the media list, request refresh */
-        startEnumeratingMedia();
-        if (!findMedium (cmedium, medium))
-            /* Medium might be deleted already, return null string */
-            return QString();
-    }
-
-    return medium.detailsHTML (true /* aNoDiffs */, aPredictDiff);
-}
-
-/**
- *  Returns the details of the given USB device as a single-line string.
- */
-QString VBoxGlobal::details (const CUSBDevice &aDevice) const
-{
-    QString sDetails;
-    QString m = aDevice.GetManufacturer().trimmed();
-    QString p = aDevice.GetProduct().trimmed();
-    if (m.isEmpty() && p.isEmpty())
-    {
-        sDetails =
-            tr ("Unknown device %1:%2", "USB device details")
-            .arg (QString().sprintf ("%04hX", aDevice.GetVendorId()))
-            .arg (QString().sprintf ("%04hX", aDevice.GetProductId()));
-    }
-    else
-    {
-        if (p.toUpper().startsWith (m.toUpper()))
-            sDetails = p;
-        else
-            sDetails = m + " " + p;
-    }
-    ushort r = aDevice.GetRevision();
-    if (r != 0)
-        sDetails += QString().sprintf (" [%04hX]", r);
-
-    return sDetails.trimmed();
-}
-
-/**
- *  Returns the multi-line description of the given USB device.
- */
-QString VBoxGlobal::toolTip (const CUSBDevice &aDevice) const
-{
-    QString tip =
-        tr ("<nobr>Vendor ID: %1</nobr><br>"
-            "<nobr>Product ID: %2</nobr><br>"
-            "<nobr>Revision: %3</nobr>", "USB device tooltip")
-        .arg (QString().sprintf ("%04hX", aDevice.GetVendorId()))
-        .arg (QString().sprintf ("%04hX", aDevice.GetProductId()))
-        .arg (QString().sprintf ("%04hX", aDevice.GetRevision()));
-
-    QString ser = aDevice.GetSerialNumber();
-    if (!ser.isEmpty())
-        tip += QString (tr ("<br><nobr>Serial No. %1</nobr>", "USB device tooltip"))
-                        .arg (ser);
-
-    /* add the state field if it's a host USB device */
-    CHostUSBDevice hostDev (aDevice);
-    if (!hostDev.isNull())
-    {
-        tip += QString (tr ("<br><nobr>State: %1</nobr>", "USB device tooltip"))
-                        .arg (vboxGlobal().toString (hostDev.GetState()));
-    }
-
-    return tip;
-}
-
-/**
- *  Returns the multi-line description of the given USB filter
- */
-QString VBoxGlobal::toolTip (const CUSBDeviceFilter &aFilter) const
-{
-    QString tip;
-
-    QString vendorId = aFilter.GetVendorId();
-    if (!vendorId.isEmpty())
-        tip += tr ("<nobr>Vendor ID: %1</nobr>", "USB filter tooltip")
-                   .arg (vendorId);
-
-    QString productId = aFilter.GetProductId();
-    if (!productId.isEmpty())
-        tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Product ID: %2</nobr>", "USB filter tooltip")
-                                                .arg (productId);
-
-    QString revision = aFilter.GetRevision();
-    if (!revision.isEmpty())
-        tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Revision: %3</nobr>", "USB filter tooltip")
-                                                .arg (revision);
-
-    QString product = aFilter.GetProduct();
-    if (!product.isEmpty())
-        tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Product: %4</nobr>", "USB filter tooltip")
-                                                .arg (product);
-
-    QString manufacturer = aFilter.GetManufacturer();
-    if (!manufacturer.isEmpty())
-        tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Manufacturer: %5</nobr>", "USB filter tooltip")
-                                                .arg (manufacturer);
-
-    QString serial = aFilter.GetSerialNumber();
-    if (!serial.isEmpty())
-        tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Serial No.: %1</nobr>", "USB filter tooltip")
-                                                .arg (serial);
-
-    QString port = aFilter.GetPort();
-    if (!port.isEmpty())
-        tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>Port: %1</nobr>", "USB filter tooltip")
-                                                .arg (port);
-
-    /* add the state field if it's a host USB device */
-    CHostUSBDevice hostDev (aFilter);
-    if (!hostDev.isNull())
-    {
-        tip += tip.isEmpty() ? "":"<br/>" + tr ("<nobr>State: %1</nobr>", "USB filter tooltip")
-                                                .arg (vboxGlobal().toString (hostDev.GetState()));
-    }
-
-    return tip;
-}
-
-/**
- * Returns a details report on a given VM represented as a HTML table.
- *
- * @param aMachine      Machine to create a report for.
- * @param aWithLinks    @c true if section titles should be hypertext links.
- */
-QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
-{
-    /* Details templates */
-    static const char *sTableTpl =
-        "<table border=0 cellspacing=1 cellpadding=0>%1</table>";
-    static const char *sSectionHrefTpl =
-        "<tr><td width=22 rowspan=%1 align=left><img src='%2'></td>"
-            "<td colspan=3><b><a href='%3'><nobr>%4</nobr></a></b></td></tr>"
-            "%5"
-        "<tr><td colspan=3><font size=1>&nbsp;</font></td></tr>";
-    static const char *sSectionBoldTpl =
-        "<tr><td width=22 rowspan=%1 align=left><img src='%2'></td>"
-            "<td colspan=3><!-- %3 --><b><nobr>%4</nobr></b></td></tr>"
-            "%5"
-        "<tr><td colspan=3><font size=1>&nbsp;</font></td></tr>";
-    static const char *sSectionItemTpl1 =
-        "<tr><td width=40%><nobr><i>%1</i></nobr></td><td/><td/></tr>";
-    static const char *sSectionItemTpl2 =
-        "<tr><td width=40%><nobr>%1:</nobr></td><td/><td>%2</td></tr>";
-    static const char *sSectionItemTpl3 =
-        "<tr><td width=40%><nobr>%1</nobr></td><td/><td/></tr>";
-
-    const QString &sectionTpl = aWithLinks ? sSectionHrefTpl : sSectionBoldTpl;
-
-    /* Compose details report */
-    QString report;
-
-    /* General */
-    {
-        QString item = QString (sSectionItemTpl2).arg (tr ("Name", "details report"),
-                                                       aMachine.GetName())
-                     + QString (sSectionItemTpl2).arg (tr ("OS Type", "details report"),
-                                                       vmGuestOSTypeDescription (aMachine.GetOSTypeId()));
-
-        report += sectionTpl
-                  .arg (2 + 2) /* rows */
-                  .arg (":/machine_16px.png", /* icon */
-                        "#general", /* link */
-                        tr ("General", "details report"), /* title */
-                        item); /* items */
-    }
-
-    /* System */
-    {
-        /* BIOS Settings holder */
-        CBIOSSettings biosSettings = aMachine.GetBIOSSettings();
-
-        /* Boot order */
-        QString bootOrder;
-        for (ulong i = 1; i <= mVBox.GetSystemProperties().GetMaxBootPosition(); ++ i)
-        {
-            KDeviceType device = aMachine.GetBootOrder (i);
-            if (device == KDeviceType_Null)
-                continue;
-            if (!bootOrder.isEmpty())
-                bootOrder += ", ";
-            bootOrder += toString (device);
-        }
-        if (bootOrder.isEmpty())
-            bootOrder = toString (KDeviceType_Null);
-
-#ifdef VBOX_WITH_FULL_DETAILS_REPORT
-        /* ACPI */
-        QString acpi = biosSettings.GetACPIEnabled()
-            ? tr ("Enabled", "details report (ACPI)")
-            : tr ("Disabled", "details report (ACPI)");
-
-        /* IO APIC */
-        QString ioapic = biosSettings.GetIOAPICEnabled()
-            ? tr ("Enabled", "details report (IO APIC)")
-            : tr ("Disabled", "details report (IO APIC)");
-
-        /* PAE/NX */
-        QString pae = aMachine.GetCpuProperty(KCpuPropertyType_PAE)
-            ? tr ("Enabled", "details report (PAE/NX)")
-            : tr ("Disabled", "details report (PAE/NX)");
-#endif /* VBOX_WITH_FULL_DETAILS_REPORT */
-
-        /* VT-x/AMD-V */
-        QString virt = aMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled)
-            ? tr ("Enabled", "details report (VT-x/AMD-V)")
-            : tr ("Disabled", "details report (VT-x/AMD-V)");
-
-        /* Nested Paging */
-        QString nested = aMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging)
-            ? tr ("Enabled", "details report (Nested Paging)")
-            : tr ("Disabled", "details report (Nested Paging)");
-
-        QString item = QString (sSectionItemTpl2).arg (tr ("Base Memory", "details report"),
-                                                       tr ("<nobr>%1 MB</nobr>", "details report"))
-                       .arg (aMachine.GetMemorySize())
-                     + QString (sSectionItemTpl2).arg (tr ("Processor(s)", "details report"),
-                                                       tr ("<nobr>%1</nobr>", "details report"))
-                       .arg (aMachine.GetCPUCount())
-                     + QString (sSectionItemTpl2).arg (tr ("Boot Order", "details report"), bootOrder)
-#ifdef VBOX_WITH_FULL_DETAILS_REPORT
-                     + QString (sSectionItemTpl2).arg (tr ("ACPI", "details report"), acpi)
-                     + QString (sSectionItemTpl2).arg (tr ("IO APIC", "details report"), ioapic)
-                     + QString (sSectionItemTpl2).arg (tr ("PAE/NX", "details report"), pae)
-#endif /* VBOX_WITH_FULL_DETAILS_REPORT */
-                     + QString (sSectionItemTpl2).arg (tr ("VT-x/AMD-V", "details report"), virt)
-                     + QString (sSectionItemTpl2).arg (tr ("Nested Paging", "details report"), nested)
-                     ;
-
-        report += sectionTpl
-#ifdef VBOX_WITH_FULL_DETAILS_REPORT
-                  .arg (2 + 8) /* rows */
-#else
-                  .arg (2 + 5) /* rows */
-#endif /* VBOX_WITH_FULL_DETAILS_REPORT */
-                  .arg (":/chipset_16px.png", /* icon */
-                        "#system", /* link */
-                        tr ("System", "details report"), /* title */
-                        item); /* items */
-    }
-
-    /* Display */
-    {
-        /* Rows including section header and footer */
-        int rows = 2;
-
-        /* Video tab */
-        QString acc3d = aMachine.GetAccelerate3DEnabled()
-            ? tr ("Enabled", "details report (3D Acceleration)")
-            : tr ("Disabled", "details report (3D Acceleration)");
-
-        QString item = QString (sSectionItemTpl2)
-                       .arg (tr ("Video Memory", "details report"),
-                             tr ("<nobr>%1 MB</nobr>", "details report"))
-                       .arg (aMachine.GetVRAMSize())
-                     + QString (sSectionItemTpl2)
-                       .arg (tr ("3D Acceleration", "details report"), acc3d);
-
-        rows += 2;
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-        QString acc2dVideo = aMachine.GetAccelerate2DVideoEnabled()
-            ? tr ("Enabled", "details report (2D Video Acceleration)")
-            : tr ("Disabled", "details report (2D Video Acceleration)");
-
-        item += QString (sSectionItemTpl2)
-                .arg (tr ("2D Video Acceleration", "details report"), acc2dVideo);
-        ++ rows;
-#endif
-
-        /* VRDP tab */
-        CVRDPServer srv = aMachine.GetVRDPServer();
-        if (!srv.isNull())
-        {
-            if (srv.GetEnabled())
-                item += QString (sSectionItemTpl2)
-                        .arg (tr ("Remote Display Server Port", "details report (VRDP Server)"))
-                        .arg (srv.GetPorts());
-            else
-                item += QString (sSectionItemTpl2)
-                        .arg (tr ("Remote Display Server", "details report (VRDP Server)"))
-                        .arg (tr ("Disabled", "details report (VRDP Server)"));
-            ++ rows;
-        }
-
-        report += sectionTpl
-            .arg (rows) /* rows */
-            .arg (":/vrdp_16px.png", /* icon */
-                  "#display", /* link */
-                  tr ("Display", "details report"), /* title */
-                  item); /* items */
-    }
-
-    /* Storage */
-    {
-        /* Rows including section header and footer */
-        int rows = 2;
-
-        QString item;
-
-        CStorageControllerVector controllers = aMachine.GetStorageControllers();
-        foreach (const CStorageController &controller, controllers)
-        {
-            item += QString (sSectionItemTpl3).arg (controller.GetName());
-            ++ rows;
-
-            CMediumAttachmentVector attachments = aMachine.GetMediumAttachmentsOfController (controller.GetName());
-            foreach (const CMediumAttachment &attachment, attachments)
-            {
-                CMedium medium = attachment.GetMedium();
-                if (attachment.isOk())
-                {
-                    item += QString (sSectionItemTpl2)
-                            .arg (QString ("&nbsp;&nbsp;") +
-                                  toString (StorageSlot (controller.GetBus(),
-                                                         attachment.GetPort(),
-                                                         attachment.GetDevice())))
-                            .arg (details (medium, false));
-                    ++ rows;
-                }
-            }
-        }
-
-        if (item.isNull())
-        {
-            item = QString (sSectionItemTpl1)
-                   .arg (tr ("Not Attached", "details report (Storage)"));
-            ++ rows;
-        }
-
-        report += sectionTpl
-            .arg (rows) /* rows */
-            .arg (":/attachment_16px.png", /* icon */
-                  "#storage", /* link */
-                  tr ("Storage", "details report"), /* title */
-                  item); /* items */
-    }
-
-    /* Audio */
-    {
-        QString item;
-
-        CAudioAdapter audio = aMachine.GetAudioAdapter();
-        int rows = audio.GetEnabled() ? 3 : 2;
-        if (audio.GetEnabled())
-            item = QString (sSectionItemTpl2)
-                   .arg (tr ("Host Driver", "details report (audio)"),
-                         toString (audio.GetAudioDriver())) +
-                   QString (sSectionItemTpl2)
-                   .arg (tr ("Controller", "details report (audio)"),
-                         toString (audio.GetAudioController()));
-        else
-            item = QString (sSectionItemTpl1)
-                   .arg (tr ("Disabled", "details report (audio)"));
-
-        report += sectionTpl
-            .arg (rows + 1) /* rows */
-            .arg (":/sound_16px.png", /* icon */
-                  "#audio", /* link */
-                  tr ("Audio", "details report"), /* title */
-                  item); /* items */
-    }
-
-    /* Network */
-    {
-        QString item;
-
-        ulong count = mVBox.GetSystemProperties().GetNetworkAdapterCount();
-        int rows = 2; /* including section header and footer */
-        for (ulong slot = 0; slot < count; slot ++)
-        {
-            CNetworkAdapter adapter = aMachine.GetNetworkAdapter (slot);
-            if (adapter.GetEnabled())
-            {
-                KNetworkAttachmentType type = adapter.GetAttachmentType();
-                QString attType = toString (adapter.GetAdapterType())
-                                  .replace (QRegExp ("\\s\\(.+\\)"), " (%1)");
-                /* don't use the adapter type string for types that have
-                 * an additional symbolic network/interface name field, use
-                 * this name instead */
-                if (type == KNetworkAttachmentType_Bridged)
-                    attType = attType.arg (tr ("Bridged adapter, %1",
-                        "details report (network)").arg (adapter.GetHostInterface()));
-                else if (type == KNetworkAttachmentType_Internal)
-                    attType = attType.arg (tr ("Internal network, '%1'",
-                        "details report (network)").arg (adapter.GetInternalNetwork()));
-                else if (type == KNetworkAttachmentType_HostOnly)
-                    attType = attType.arg (tr ("Host-only adapter, '%1'",
-                        "details report (network)").arg (adapter.GetHostInterface()));
-                else
-                    attType = attType.arg (vboxGlobal().toString (type));
-
-                item += QString (sSectionItemTpl2)
-                        .arg (tr ("Adapter %1", "details report (network)")
-                              .arg (adapter.GetSlot() + 1))
-                        .arg (attType);
-                ++ rows;
-            }
-        }
-        if (item.isNull())
-        {
-            item = QString (sSectionItemTpl1)
-                   .arg (tr ("Disabled", "details report (network)"));
-            ++ rows;
-        }
-
-        report += sectionTpl
-            .arg (rows) /* rows */
-            .arg (":/nw_16px.png", /* icon */
-                  "#network", /* link */
-                  tr ("Network", "details report"), /* title */
-                  item); /* items */
-    }
-
-    /* Serial Ports */
-    {
-        QString item;
-
-        ulong count = mVBox.GetSystemProperties().GetSerialPortCount();
-        int rows = 2; /* including section header and footer */
-        for (ulong slot = 0; slot < count; slot ++)
-        {
-            CSerialPort port = aMachine.GetSerialPort (slot);
-            if (port.GetEnabled())
-            {
-                KPortMode mode = port.GetHostMode();
-                QString data =
-                    toCOMPortName (port.GetIRQ(), port.GetIOBase()) + ", ";
-                if (mode == KPortMode_HostPipe ||
-                    mode == KPortMode_HostDevice ||
-                    mode == KPortMode_RawFile)
-                    data += QString ("%1 (<nobr>%2</nobr>)")
-                            .arg (vboxGlobal().toString (mode))
-                            .arg (QDir::toNativeSeparators (port.GetPath()));
-                else
-                    data += toString (mode);
-
-                item += QString (sSectionItemTpl2)
-                        .arg (tr ("Port %1", "details report (serial ports)")
-                              .arg (port.GetSlot() + 1))
-                        .arg (data);
-                ++ rows;
-            }
-        }
-        if (item.isNull())
-        {
-            item = QString (sSectionItemTpl1)
-                   .arg (tr ("Disabled", "details report (serial ports)"));
-            ++ rows;
-        }
-
-        report += sectionTpl
-            .arg (rows) /* rows */
-            .arg (":/serial_port_16px.png", /* icon */
-                  "#serialPorts", /* link */
-                  tr ("Serial Ports", "details report"), /* title */
-                  item); /* items */
-    }
-
-    /* Parallel Ports */
-    {
-        QString item;
-
-        ulong count = mVBox.GetSystemProperties().GetParallelPortCount();
-        int rows = 2; /* including section header and footer */
-        for (ulong slot = 0; slot < count; slot ++)
-        {
-            CParallelPort port = aMachine.GetParallelPort (slot);
-            if (port.GetEnabled())
-            {
-                QString data =
-                    toLPTPortName (port.GetIRQ(), port.GetIOBase()) +
-                    QString (" (<nobr>%1</nobr>)")
-                    .arg (QDir::toNativeSeparators (port.GetPath()));
-
-                item += QString (sSectionItemTpl2)
-                        .arg (tr ("Port %1", "details report (parallel ports)")
-                              .arg (port.GetSlot() + 1))
-                        .arg (data);
-                ++ rows;
-            }
-        }
-        if (item.isNull())
-        {
-            item = QString (sSectionItemTpl1)
-                   .arg (tr ("Disabled", "details report (parallel ports)"));
-            ++ rows;
-        }
-
-        /* Temporary disabled */
-        QString dummy = sectionTpl /* report += sectionTpl */
-            .arg (rows) /* rows */
-            .arg (":/parallel_port_16px.png", /* icon */
-                  "#parallelPorts", /* link */
-                  tr ("Parallel Ports", "details report"), /* title */
-                  item); /* items */
-    }
-
-    /* USB */
-    {
-        QString item;
-
-        CUSBController ctl = aMachine.GetUSBController();
-        if (!ctl.isNull())
-        {
-            /* the USB controller may be unavailable (i.e. in VirtualBox OSE) */
-
-            if (ctl.GetEnabled())
-            {
-                CUSBDeviceFilterVector coll = ctl.GetDeviceFilters();
-                uint active = 0;
-                for (int i = 0; i < coll.size(); ++i)
-                    if (coll[i].GetActive())
-                        active ++;
-
-                item = QString (sSectionItemTpl2)
-                       .arg (tr ("Device Filters", "details report (USB)"),
-                             tr ("%1 (%2 active)", "details report (USB)")
-                                 .arg (coll.size()).arg (active));
-            }
-            else
-                item = QString (sSectionItemTpl1)
-                       .arg (tr ("Disabled", "details report (USB)"));
-
-            report += sectionTpl
-                .arg (2 + 1) /* rows */
-                .arg (":/usb_16px.png", /* icon */
-                      "#usb", /* link */
-                      tr ("USB", "details report"), /* title */
-                      item); /* items */
-        }
-    }
-
-    /* Shared Folders */
-    {
-        QString item;
-
-        ulong count = aMachine.GetSharedFolders().size();
-        if (count > 0)
-        {
-            item = QString (sSectionItemTpl2)
-                   .arg (tr ("Shared Folders", "details report (shared folders)"))
-                   .arg (count);
-        }
-        else
-            item = QString (sSectionItemTpl1)
-                   .arg (tr ("None", "details report (shared folders)"));
-
-        report += sectionTpl
-            .arg (2 + 1) /* rows */
-            .arg (":/shared_folder_16px.png", /* icon */
-                  "#sfolders", /* link */
-                  tr ("Shared Folders", "details report"), /* title */
-                  item); /* items */
-    }
-
-    return QString (sTableTpl). arg (report);
-}
-
-QString VBoxGlobal::platformInfo()
-{
-    QString platform;
-
-#if defined (Q_OS_WIN)
-    platform = "win";
-#elif defined (Q_OS_LINUX)
-    platform = "linux";
-#elif defined (Q_OS_MACX)
-    platform = "macosx";
-#elif defined (Q_OS_OS2)
-    platform = "os2";
-#elif defined (Q_OS_FREEBSD)
-    platform = "freebsd";
-#elif defined (Q_OS_SOLARIS)
-    platform = "solaris";
-#else
-    platform = "unknown";
-#endif
-
-    /* The format is <system>.<bitness> */
-    platform += QString (".%1").arg (ARCH_BITS);
-
-    /* Add more system information */
-#if defined (Q_OS_WIN)
-    OSVERSIONINFO versionInfo;
-    ZeroMemory (&versionInfo, sizeof (OSVERSIONINFO));
-    versionInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-    GetVersionEx (&versionInfo);
-    int major = versionInfo.dwMajorVersion;
-    int minor = versionInfo.dwMinorVersion;
-    int build = versionInfo.dwBuildNumber;
-    QString sp = QString::fromUtf16 ((ushort*)versionInfo.szCSDVersion);
-
-    QString distrib;
-    if (major == 6)
-        distrib = QString ("Windows Vista %1");
-    else if (major == 5)
-    {
-        if (minor == 2)
-            distrib = QString ("Windows Server 2003 %1");
-        else if (minor == 1)
-            distrib = QString ("Windows XP %1");
-        else if (minor == 0)
-            distrib = QString ("Windows 2000 %1");
-        else
-            distrib = QString ("Unknown %1");
-    }
-    else if (major == 4)
-    {
-        if (minor == 90)
-            distrib = QString ("Windows Me %1");
-        else if (minor == 10)
-            distrib = QString ("Windows 98 %1");
-        else if (minor == 0)
-            distrib = QString ("Windows 95 %1");
-        else
-            distrib = QString ("Unknown %1");
-    }
-    else /** @todo Windows Server 2008 == vista? Probably not... */
-        distrib = QString ("Unknown %1");
-    distrib = distrib.arg (sp);
-    QString version = QString ("%1.%2").arg (major).arg (minor);
-    QString kernel = QString ("%1").arg (build);
-    platform += QString (" [Distribution: %1 | Version: %2 | Build: %3]")
-        .arg (distrib).arg (version).arg (kernel);
-#elif defined (Q_OS_LINUX)
-    /* Get script path */
-    char szAppPrivPath [RTPATH_MAX];
-    int rc = RTPathAppPrivateNoArch (szAppPrivPath, sizeof (szAppPrivPath)); NOREF(rc);
-    AssertRC (rc);
-    /* Run script */
-    QByteArray result =
-        Process::singleShot (QString (szAppPrivPath) + "/VBoxSysInfo.sh");
-    if (!result.isNull())
-        platform += QString (" [%1]").arg (QString (result).trimmed());
-#else
-    /* Use RTSystemQueryOSInfo. */
-    char szTmp[256];
-    QStringList components;
-    int vrc = RTSystemQueryOSInfo (RTSYSOSINFO_PRODUCT, szTmp, sizeof (szTmp));
-    if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
-        components << QString ("Product: %1").arg (szTmp);
-    vrc = RTSystemQueryOSInfo (RTSYSOSINFO_RELEASE, szTmp, sizeof (szTmp));
-    if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
-        components << QString ("Release: %1").arg (szTmp);
-    vrc = RTSystemQueryOSInfo (RTSYSOSINFO_VERSION, szTmp, sizeof (szTmp));
-    if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
-        components << QString ("Version: %1").arg (szTmp);
-    vrc = RTSystemQueryOSInfo (RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof (szTmp));
-    if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
-        components << QString ("SP: %1").arg (szTmp);
-    if (!components.isEmpty())
-        platform += QString (" [%1]").arg (components.join (" | "));
-#endif
-
-    return platform;
-}
-
-#if defined(Q_WS_X11) && !defined(VBOX_OSE)
-double VBoxGlobal::findLicenseFile (const QStringList &aFilesList, QRegExp aPattern, QString &aLicenseFile) const
-{
-    double maxVersionNumber = 0;
-    aLicenseFile = "";
-    for (int index = 0; index < aFilesList.count(); ++ index)
-    {
-        aPattern.indexIn (aFilesList [index]);
-        QString version = aPattern.cap (1);
-        if (maxVersionNumber < version.toDouble())
-        {
-            maxVersionNumber = version.toDouble();
-            aLicenseFile = aFilesList [index];
-        }
-    }
-    return maxVersionNumber;
-}
-
-bool VBoxGlobal::showVirtualBoxLicense()
-{
-    /* get the apps doc path */
-    int size = 256;
-    char *buffer = (char*) RTMemTmpAlloc (size);
-    RTPathAppDocs (buffer, size);
-    QString path (buffer);
-    RTMemTmpFree (buffer);
-    QDir docDir (path);
-    docDir.setFilter (QDir::Files);
-    docDir.setNameFilters (QStringList ("License-*.html"));
-
-    /* Make sure that the language is in two letter code.
-     * Note: if languageId() returns an empty string lang.name() will
-     * return "C" which is an valid language code. */
-    QLocale lang (VBoxGlobal::languageId());
-
-    QStringList filesList = docDir.entryList();
-    QString licenseFile;
-    /* First try to find a localized version of the license file. */
-    double versionNumber = findLicenseFile (filesList, QRegExp (QString ("License-([\\d\\.]+)-%1.html").arg (lang.name())), licenseFile);
-    /* If there wasn't a localized version of the currently selected language,
-     * search for the generic one. */
-    if (versionNumber == 0)
-        versionNumber = findLicenseFile (filesList, QRegExp ("License-([\\d\\.]+).html"), licenseFile);
-    /* Check the version again. */
-    if (!versionNumber)
-    {
-        vboxProblem().cannotFindLicenseFiles (path);
-        return false;
-    }
-
-    /* compose the latest license file full path */
-    QString latestVersion = QString::number (versionNumber);
-    QString latestFilePath = docDir.absoluteFilePath (licenseFile);
-
-    /* check for the agreed license version */
-    QString licenseAgreed = virtualBox().GetExtraData (VBoxDefs::GUI_LicenseKey);
-    if (licenseAgreed == latestVersion)
-        return true;
-
-    VBoxLicenseViewer licenseDialog (latestFilePath);
-    bool result = licenseDialog.exec() == QDialog::Accepted;
-    if (result)
-        virtualBox().SetExtraData (VBoxDefs::GUI_LicenseKey, latestVersion);
-    return result;
-}
-#endif /* defined(Q_WS_X11) && !defined(VBOX_OSE) */
-
-/**
- *  Opens a direct session for a machine with the given ID.
- *  This method does user-friendly error handling (display error messages, etc.).
- *  and returns a null CSession object in case of any error.
- *  If this method succeeds, don't forget to close the returned session when
- *  it is no more necessary.
- *
- *  @param aId          Machine ID.
- *  @param aExisting    @c true to open an existing session with the machine
- *                      which is already running, @c false to open a new direct
- *                      session.
- */
-CSession VBoxGlobal::openSession (const QString &aId, bool aExisting /* = false */)
-{
-    CSession session;
-    session.createInstance (CLSID_Session);
-    if (session.isNull())
-    {
-        vboxProblem().cannotOpenSession (session);
-        return session;
-    }
-
-    if (aExisting)
-        mVBox.OpenExistingSession (session, aId);
-    else
-    {
-        mVBox.OpenSession (session, aId);
-        CMachine machine = session.GetMachine ();
-        /* Make sure that the language is in two letter code.
-         * Note: if languageId() returns an empty string lang.name() will
-         * return "C" which is an valid language code. */
-        QLocale lang (VBoxGlobal::languageId());
-        machine.SetGuestPropertyValue ("/VirtualBox/HostInfo/GUI/LanguageID", lang.name());
-    }
-
-    if (!mVBox.isOk())
-    {
-        CMachine machine = CVirtualBox (mVBox).GetMachine (aId);
-        vboxProblem().cannotOpenSession (mVBox, machine);
-        session.detach();
-    }
-
-    return session;
-}
-
-/**
- *  Starts a machine with the given ID.
- */
-bool VBoxGlobal::startMachine (const QString &id)
-{
-    AssertReturn (mValid, false);
-
-    CSession session = vboxGlobal().openSession (id);
-    if (session.isNull())
-        return false;
-
-    return consoleWnd().openView (session);
-}
-
-/**
- * Appends the NULL medium to the media list.
- * For using with VBoxGlobal::startEnumeratingMedia() only.
- */
-static void addNullMediumToList (VBoxMediaList &aList, VBoxMediaList::iterator aWhere)
-{
-    VBoxMedium medium;
-    aList.insert (aWhere, medium);
-}
-
-/**
- * Appends the given list of mediums to the media list.
- * For using with VBoxGlobal::startEnumeratingMedia() only.
- */
-static void addMediumsToList (const CMediumVector &aVector,
-                              VBoxMediaList &aList,
-                              VBoxMediaList::iterator aWhere,
-                              VBoxDefs::MediumType aType,
-                              VBoxMedium *aParent = 0)
-{
-    VBoxMediaList::iterator first = aWhere;
-
-    for (CMediumVector::ConstIterator it = aVector.begin(); it != aVector.end(); ++ it)
-    {
-        CMedium cmedium (*it);
-        VBoxMedium medium (cmedium, aType, aParent);
-
-        /* Search for a proper alphabetic position */
-        VBoxMediaList::iterator jt = first;
-        for (; jt != aWhere; ++ jt)
-            if ((*jt).name().localeAwareCompare (medium.name()) > 0)
-                break;
-
-        aList.insert (jt, medium);
-
-        /* Adjust the first item if inserted before it */
-        if (jt == first)
-            -- first;
-    }
-}
-
-/**
- * Appends the given list of hard disks and all their children to the media list.
- * For using with VBoxGlobal::startEnumeratingMedia() only.
- */
-static void addHardDisksToList (const CMediumVector &aVector,
-                                VBoxMediaList &aList,
-                                VBoxMediaList::iterator aWhere,
-                                VBoxMedium *aParent = 0)
-{
-    VBoxMediaList::iterator first = aWhere;
-
-    /* First pass: Add siblings sorted */
-    for (CMediumVector::ConstIterator it = aVector.begin(); it != aVector.end(); ++ it)
-    {
-        CMedium cmedium (*it);
-        VBoxMedium medium (cmedium, VBoxDefs::MediumType_HardDisk, aParent);
-
-        /* Search for a proper alphabetic position */
-        VBoxMediaList::iterator jt = first;
-        for (; jt != aWhere; ++ jt)
-            if ((*jt).name().localeAwareCompare (medium.name()) > 0)
-                break;
-
-        aList.insert (jt, medium);
-
-        /* Adjust the first item if inserted before it */
-        if (jt == first)
-            -- first;
-    }
-
-    /* Second pass: Add children */
-    for (VBoxMediaList::iterator it = first; it != aWhere;)
-    {
-        CMediumVector children = (*it).medium().GetChildren();
-        VBoxMedium *parent = &(*it);
-
-        ++ it; /* go to the next sibling before inserting children */
-        addHardDisksToList (children, aList, it, parent);
-    }
-}
-
-/**
- * Starts a thread that asynchronously enumerates all currently registered
- * media.
- *
- * Before the enumeration is started, the current media list (a list returned by
- * #currentMediaList()) is populated with all registered media and the
- * #mediumEnumStarted() signal is emitted. The enumeration thread then walks this
- * list, checks for media acessiblity and emits #mediumEnumerated() signals of
- * each checked medium. When all media are checked, the enumeration thread is
- * stopped and the #mediumEnumFinished() signal is emitted.
- *
- * If the enumeration is already in progress, no new thread is started.
- *
- * The media list returned by #currentMediaList() is always sorted
- * alphabetically by the location attribute and comes in the following order:
- * <ol>
- *  <li>All hard disks. If a hard disk has children, these children
- *      (alphabetically sorted) immediately follow their parent and terefore
- *      appear before its next sibling hard disk.</li>
- *  <li>All CD/DVD images.</li>
- *  <li>All Floppy images.</li>
- * </ol>
- *
- * Note that #mediumEnumerated() signals are emitted in the same order as
- * described above.
- *
- * @sa #currentMediaList()
- * @sa #isMediaEnumerationStarted()
- */
-void VBoxGlobal::startEnumeratingMedia()
-{
-    AssertReturnVoid (mValid);
-
-    /* check if already started but not yet finished */
-    if (mMediaEnumThread != NULL)
-        return;
-
-    /* ignore the request during application termination */
-    if (sVBoxGlobalInCleanup)
-        return;
-
-    /* composes a list of all currently known media & their children */
-    mMediaList.clear();
-    addNullMediumToList (mMediaList, mMediaList.end());
-    addHardDisksToList (mVBox.GetHardDisks(), mMediaList, mMediaList.end());
-    addMediumsToList (mVBox.GetHost().GetDVDDrives(), mMediaList, mMediaList.end(), VBoxDefs::MediumType_DVD);
-    addMediumsToList (mVBox.GetDVDImages(), mMediaList, mMediaList.end(), VBoxDefs::MediumType_DVD);
-    addMediumsToList (mVBox.GetHost().GetFloppyDrives(), mMediaList, mMediaList.end(), VBoxDefs::MediumType_Floppy);
-    addMediumsToList (mVBox.GetFloppyImages(), mMediaList, mMediaList.end(), VBoxDefs::MediumType_Floppy);
-
-    /* enumeration thread class */
-    class MediaEnumThread : public QThread
-    {
-    public:
-
-        MediaEnumThread (VBoxMediaList &aList)
-            : mVector (aList.size())
-            , mSavedIt (aList.begin())
-        {
-            int i = 0;
-            for (VBoxMediaList::const_iterator it = aList.begin();
-                 it != aList.end(); ++ it)
-                mVector [i ++] = *it;
-        }
-
-        virtual void run()
-        {
-            LogFlow (("MediaEnumThread started.\n"));
-            COMBase::InitializeCOM();
-
-            CVirtualBox mVBox = vboxGlobal().virtualBox();
-            QObject *self = &vboxGlobal();
-
-            /* Enumerate the list */
-            for (int i = 0; i < mVector.size() && !sVBoxGlobalInCleanup; ++ i)
-            {
-                mVector [i].blockAndQueryState();
-                QApplication::
-                    postEvent (self,
-                               new VBoxMediaEnumEvent (mVector [i], mSavedIt));
-            }
-
-            /* Post the end-of-enumeration event */
-            if (!sVBoxGlobalInCleanup)
-                QApplication::postEvent (self, new VBoxMediaEnumEvent (mSavedIt));
-
-            COMBase::CleanupCOM();
-            LogFlow (("MediaEnumThread finished.\n"));
-        }
-
-    private:
-
-        QVector <VBoxMedium> mVector;
-        VBoxMediaList::iterator mSavedIt;
-    };
-
-    mMediaEnumThread = new MediaEnumThread (mMediaList);
-    AssertReturnVoid (mMediaEnumThread);
-
-    /* emit mediumEnumStarted() after we set mMediaEnumThread to != NULL
-     * to cause isMediaEnumerationStarted() to return TRUE from slots */
-    emit mediumEnumStarted();
-
-    mMediaEnumThread->start();
-}
-
-/**
- * Adds a new medium to the current media list and emits the #mediumAdded()
- * signal.
- *
- * @sa #currentMediaList()
- */
-void VBoxGlobal::addMedium (const VBoxMedium &aMedium)
-{
-    /* Note that we maitain the same order here as #startEnumeratingMedia() */
-
-    VBoxMediaList::iterator it = mMediaList.begin();
-
-    if (aMedium.type() == VBoxDefs::MediumType_HardDisk)
-    {
-        VBoxMediaList::iterator itParent = mMediaList.end();
-
-        for (; it != mMediaList.end(); ++ it)
-        {
-            /* skip null medium that come first */
-            if ((*it).isNull()) continue;
-
-            if ((*it).type() != VBoxDefs::MediumType_HardDisk)
-                break;
-
-            if (aMedium.parent() != NULL && itParent == mMediaList.end())
-            {
-                if (&*it == aMedium.parent())
-                    itParent = it;
-            }
-            else
-            {
-                /* break if met a parent's sibling (will insert before it) */
-                if (aMedium.parent() != NULL &&
-                    (*it).parent() == (*itParent).parent())
-                    break;
-
-                /* compare to aMedium's siblings */
-                if ((*it).parent() == aMedium.parent() &&
-                    (*it).name().localeAwareCompare (aMedium.name()) > 0)
-                    break;
-            }
-        }
-
-        AssertReturnVoid (aMedium.parent() == NULL || itParent != mMediaList.end());
-    }
-    else
-    {
-        for (; it != mMediaList.end(); ++ it)
-        {
-            /* skip null medium that come first */
-            if ((*it).isNull()) continue;
-
-            /* skip HardDisks that come first */
-            if ((*it).type() == VBoxDefs::MediumType_HardDisk)
-                continue;
-
-            /* skip DVD when inserting Floppy */
-            if (aMedium.type() == VBoxDefs::MediumType_Floppy &&
-                (*it).type() == VBoxDefs::MediumType_DVD)
-                continue;
-
-            if ((*it).name().localeAwareCompare (aMedium.name()) > 0 ||
-                (aMedium.type() == VBoxDefs::MediumType_DVD &&
-                 (*it).type() == VBoxDefs::MediumType_Floppy))
-                break;
-        }
-    }
-
-    it = mMediaList.insert (it, aMedium);
-
-    emit mediumAdded (*it);
-}
-
-/**
- * Updates the medium in the current media list and emits the #mediumUpdated()
- * signal.
- *
- * @sa #currentMediaList()
- */
-void VBoxGlobal::updateMedium (const VBoxMedium &aMedium)
-{
-    VBoxMediaList::Iterator it;
-    for (it = mMediaList.begin(); it != mMediaList.end(); ++ it)
-        if ((*it).id() == aMedium.id())
-            break;
-
-    AssertReturnVoid (it != mMediaList.end());
-
-    if (&*it != &aMedium)
-        *it = aMedium;
-
-    emit mediumUpdated (*it);
-}
-
-/**
- * Removes the medium from the current media list and emits the #mediumRemoved()
- * signal.
- *
- * @sa #currentMediaList()
- */
-void VBoxGlobal::removeMedium (VBoxDefs::MediumType aType, const QString &aId)
-{
-    VBoxMediaList::Iterator it;
-    for (it = mMediaList.begin(); it != mMediaList.end(); ++ it)
-        if ((*it).id() == aId)
-            break;
-
-    AssertReturnVoid (it != mMediaList.end());
-
-#if DEBUG
-    /* sanity: must be no children */
-    {
-        VBoxMediaList::Iterator jt = it;
-        ++ jt;
-        AssertReturnVoid (jt == mMediaList.end() || (*jt).parent() != &*it);
-    }
-#endif
-
-    VBoxMedium *pParent = (*it).parent();
-
-    /* remove the medium from the list to keep it in sync with the server "for
-     * free" when the medium is deleted from one of our UIs */
-    mMediaList.erase (it);
-
-    emit mediumRemoved (aType, aId);
-
-    /* also emit the parent update signal because some attributes like
-     * isReadOnly() may have been changed after child removal */
-    if (pParent != NULL)
-    {
-        pParent->refresh();
-        emit mediumUpdated (*pParent);
-    }
-}
-
-/**
- *  Searches for a VBoxMedum object representing the given COM medium object.
- *
- *  @return true if found and false otherwise.
- */
-bool VBoxGlobal::findMedium (const CMedium &aObj, VBoxMedium &aMedium) const
-{
-    for (VBoxMediaList::ConstIterator it = mMediaList.begin(); it != mMediaList.end(); ++ it)
-    {
-        if (((*it).medium().isNull() && aObj.isNull()) ||
-            (!(*it).medium().isNull() && !aObj.isNull() && (*it).medium().GetId() == aObj.GetId()))
-        {
-            aMedium = (*it);
-            return true;
-        }
-    }
-    return false;
-}
-
-/**
- *  Searches for a VBoxMedum object with the given medium id attribute.
- *
- *  @return VBoxMedum if found which is invalid otherwise.
- */
-VBoxMedium VBoxGlobal::findMedium (const QString &aMediumId) const
-{
-    for (VBoxMediaList::ConstIterator it = mMediaList.begin(); it != mMediaList.end(); ++ it)
-        if ((*it).id() == aMediumId)
-            return *it;
-    return VBoxMedium();
-}
-
-#ifdef VBOX_GUI_WITH_SYSTRAY
-/**
- *  Returns the number of current running Fe/Qt4 main windows.
- *
- *  @return Number of running main windows.
- */
-int VBoxGlobal::mainWindowCount ()
-{
-    return mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt();
-}
-#endif
-
-/**
- *  Native language name of the currently installed translation.
- *  Returns "English" if no translation is installed
- *  or if the translation file is invalid.
- */
-QString VBoxGlobal::languageName() const
-{
-
-    return qApp->translate ("@@@", "English",
-                            "Native language name");
-}
-
-/**
- *  Native language country name of the currently installed translation.
- *  Returns "--" if no translation is installed or if the translation file is
- *  invalid, or if the language is independent on the country.
- */
-QString VBoxGlobal::languageCountry() const
-{
-    return qApp->translate ("@@@", "--",
-                            "Native language country name "
-                            "(empty if this language is for all countries)");
-}
-
-/**
- *  Language name of the currently installed translation, in English.
- *  Returns "English" if no translation is installed
- *  or if the translation file is invalid.
- */
-QString VBoxGlobal::languageNameEnglish() const
-{
-
-    return qApp->translate ("@@@", "English",
-                            "Language name, in English");
-}
-
-/**
- *  Language country name of the currently installed translation, in English.
- *  Returns "--" if no translation is installed or if the translation file is
- *  invalid, or if the language is independent on the country.
- */
-QString VBoxGlobal::languageCountryEnglish() const
-{
-    return qApp->translate ("@@@", "--",
-                            "Language country name, in English "
-                            "(empty if native country name is empty)");
-}
-
-/**
- *  Comma-separated list of authors of the currently installed translation.
- *  Returns "Sun Microsystems, Inc." if no translation is installed or if the
- *  translation file is invalid, or if the translation is supplied by Sun
- *  Microsystems, inc.
- */
-QString VBoxGlobal::languageTranslators() const
-{
-    return qApp->translate ("@@@", "Sun Microsystems, Inc.",
-                            "Comma-separated list of translators");
-}
-
-/**
- *  Changes the language of all global string constants according to the
- *  currently installed translations tables.
- */
-void VBoxGlobal::retranslateUi()
-{
-    mMachineStates [KMachineState_PoweredOff] = tr ("Powered Off", "MachineState");
-    mMachineStates [KMachineState_Saved] =      tr ("Saved", "MachineState");
-    mMachineStates [KMachineState_Teleported] = tr ("Teleported", "MachineState");
-    mMachineStates [KMachineState_Aborted] =    tr ("Aborted", "MachineState");
-    mMachineStates [KMachineState_Running] =    tr ("Running", "MachineState");
-    mMachineStates [KMachineState_Paused] =     tr ("Paused", "MachineState");
-    mMachineStates [KMachineState_Stuck] =      tr ("Guru Meditation", "MachineState");
-    mMachineStates [KMachineState_Teleporting] = tr ("Teleporting", "MachineState");
-    mMachineStates [KMachineState_LiveSnapshotting] = tr ("Taking Live Snapshot", "MachineState");
-    mMachineStates [KMachineState_Starting] =   tr ("Starting", "MachineState");
-    mMachineStates [KMachineState_Stopping] =   tr ("Stopping", "MachineState");
-    mMachineStates [KMachineState_Saving] =     tr ("Saving", "MachineState");
-    mMachineStates [KMachineState_Restoring] =  tr ("Restoring", "MachineState");
-    mMachineStates [KMachineState_TeleportingPausedVM] = tr ("Teleporting Paused VM", "MachineState");
-    mMachineStates [KMachineState_TeleportingIn] = tr ("Teleporting", "MachineState");
-    mMachineStates [KMachineState_RestoringSnapshot] = tr ("Restoring Snapshot", "MachineState");
-    mMachineStates [KMachineState_DeletingSnapshot] = tr ("Deleting Snapshot", "MachineState");
-    mMachineStates [KMachineState_SettingUp] =  tr ("Setting Up", "MachineState");
-
-    mSessionStates [KSessionState_Closed] =     tr ("Closed", "SessionState");
-    mSessionStates [KSessionState_Open] =       tr ("Open", "SessionState");
-    mSessionStates [KSessionState_Spawning] =   tr ("Spawning", "SessionState");
-    mSessionStates [KSessionState_Closing] =    tr ("Closing", "SessionState");
-
-    mDeviceTypes [KDeviceType_Null] =           tr ("None", "DeviceType");
-    mDeviceTypes [KDeviceType_Floppy] =         tr ("Floppy", "DeviceType");
-    mDeviceTypes [KDeviceType_DVD] =            tr ("CD/DVD-ROM", "DeviceType");
-    mDeviceTypes [KDeviceType_HardDisk] =       tr ("Hard Disk", "DeviceType");
-    mDeviceTypes [KDeviceType_Network] =        tr ("Network", "DeviceType");
-    mDeviceTypes [KDeviceType_USB] =            tr ("USB", "DeviceType");
-    mDeviceTypes [KDeviceType_SharedFolder] =   tr ("Shared Folder", "DeviceType");
-
-    mStorageBuses [KStorageBus_IDE] =       tr ("IDE", "StorageBus");
-    mStorageBuses [KStorageBus_SATA] =      tr ("SATA", "StorageBus");
-    mStorageBuses [KStorageBus_SCSI] =      tr ("SCSI", "StorageBus");
-    mStorageBuses [KStorageBus_Floppy] =    tr ("Floppy", "StorageBus");
-
-    mStorageBusChannels [0] = tr ("Primary", "StorageBusChannel");
-    mStorageBusChannels [1] = tr ("Secondary", "StorageBusChannel");
-    mStorageBusChannels [2] = tr ("Port %1", "StorageBusChannel");
-
-    mStorageBusDevices [0] = tr ("Master", "StorageBusDevice");
-    mStorageBusDevices [1] = tr ("Slave", "StorageBusDevice");
-    mStorageBusDevices [2] = tr ("Device %1", "StorageBusDevice");
-
-    mSlotTemplates [0] = tr ("IDE Primary Master", "New Storage UI : Slot Name");
-    mSlotTemplates [1] = tr ("IDE Primary Slave", "New Storage UI : Slot Name");
-    mSlotTemplates [2] = tr ("IDE Secondary Master", "New Storage UI : Slot Name");
-    mSlotTemplates [3] = tr ("IDE Secondary Slave", "New Storage UI : Slot Name");
-    mSlotTemplates [4] = tr ("SATA Port %1", "New Storage UI : Slot Name");
-    mSlotTemplates [5] = tr ("SCSI Port %1", "New Storage UI : Slot Name");
-    mSlotTemplates [6] = tr ("Floppy Device %1", "New Storage UI : Slot Name");
-
-    mDiskTypes [KMediumType_Normal] =           tr ("Normal", "DiskType");
-    mDiskTypes [KMediumType_Immutable] =        tr ("Immutable", "DiskType");
-    mDiskTypes [KMediumType_Writethrough] =     tr ("Writethrough", "DiskType");
-    mDiskTypes_Differencing =                   tr ("Differencing", "DiskType");
-
-    mVRDPAuthTypes [KVRDPAuthType_Null] =       tr ("Null", "VRDPAuthType");
-    mVRDPAuthTypes [KVRDPAuthType_External] =   tr ("External", "VRDPAuthType");
-    mVRDPAuthTypes [KVRDPAuthType_Guest] =      tr ("Guest", "VRDPAuthType");
-
-    mPortModeTypes [KPortMode_Disconnected] =   tr ("Disconnected", "PortMode");
-    mPortModeTypes [KPortMode_HostPipe] =       tr ("Host Pipe", "PortMode");
-    mPortModeTypes [KPortMode_HostDevice] =     tr ("Host Device", "PortMode");
-    mPortModeTypes [KPortMode_RawFile] =        tr ("Raw File", "PortMode");
-
-    mUSBFilterActionTypes [KUSBDeviceFilterAction_Ignore] =
-        tr ("Ignore", "USBFilterActionType");
-    mUSBFilterActionTypes [KUSBDeviceFilterAction_Hold] =
-        tr ("Hold", "USBFilterActionType");
-
-    mAudioDriverTypes [KAudioDriverType_Null] =
-        tr ("Null Audio Driver", "AudioDriverType");
-    mAudioDriverTypes [KAudioDriverType_WinMM] =
-        tr ("Windows Multimedia", "AudioDriverType");
-    mAudioDriverTypes [KAudioDriverType_SolAudio] =
-        tr ("Solaris Audio", "AudioDriverType");
-    mAudioDriverTypes [KAudioDriverType_OSS] =
-        tr ("OSS Audio Driver", "AudioDriverType");
-    mAudioDriverTypes [KAudioDriverType_ALSA] =
-        tr ("ALSA Audio Driver", "AudioDriverType");
-    mAudioDriverTypes [KAudioDriverType_DirectSound] =
-        tr ("Windows DirectSound", "AudioDriverType");
-    mAudioDriverTypes [KAudioDriverType_CoreAudio] =
-        tr ("CoreAudio", "AudioDriverType");
-    mAudioDriverTypes [KAudioDriverType_Pulse] =
-        tr ("PulseAudio", "AudioDriverType");
-
-    mAudioControllerTypes [KAudioControllerType_AC97] =
-        tr ("ICH AC97", "AudioControllerType");
-    mAudioControllerTypes [KAudioControllerType_SB16] =
-        tr ("SoundBlaster 16", "AudioControllerType");
-
-    mNetworkAdapterTypes [KNetworkAdapterType_Am79C970A] =
-        tr ("PCnet-PCI II (Am79C970A)", "NetworkAdapterType");
-    mNetworkAdapterTypes [KNetworkAdapterType_Am79C973] =
-        tr ("PCnet-FAST III (Am79C973)", "NetworkAdapterType");
-    mNetworkAdapterTypes [KNetworkAdapterType_I82540EM] =
-        tr ("Intel PRO/1000 MT Desktop (82540EM)", "NetworkAdapterType");
-    mNetworkAdapterTypes [KNetworkAdapterType_I82543GC] =
-        tr ("Intel PRO/1000 T Server (82543GC)", "NetworkAdapterType");
-    mNetworkAdapterTypes [KNetworkAdapterType_I82545EM] =
-        tr ("Intel PRO/1000 MT Server (82545EM)", "NetworkAdapterType");
-#ifdef VBOX_WITH_VIRTIO
-    mNetworkAdapterTypes [KNetworkAdapterType_Virtio] =
-        tr ("Paravirtualized Network (virtio-net)", "NetworkAdapterType");
-#endif /* VBOX_WITH_VIRTIO */
-
-    mNetworkAttachmentTypes [KNetworkAttachmentType_Null] =
-        tr ("Not attached", "NetworkAttachmentType");
-    mNetworkAttachmentTypes [KNetworkAttachmentType_NAT] =
-        tr ("NAT", "NetworkAttachmentType");
-    mNetworkAttachmentTypes [KNetworkAttachmentType_Bridged] =
-        tr ("Bridged Adapter", "NetworkAttachmentType");
-    mNetworkAttachmentTypes [KNetworkAttachmentType_Internal] =
-        tr ("Internal Network", "NetworkAttachmentType");
-    mNetworkAttachmentTypes [KNetworkAttachmentType_HostOnly] =
-        tr ("Host-only Adapter", "NetworkAttachmentType");
-
-    mClipboardTypes [KClipboardMode_Disabled] =
-        tr ("Disabled", "ClipboardType");
-    mClipboardTypes [KClipboardMode_HostToGuest] =
-        tr ("Host To Guest", "ClipboardType");
-    mClipboardTypes [KClipboardMode_GuestToHost] =
-        tr ("Guest To Host", "ClipboardType");
-    mClipboardTypes [KClipboardMode_Bidirectional] =
-        tr ("Bidirectional", "ClipboardType");
-
-    mStorageControllerTypes [KStorageControllerType_PIIX3] =
-        tr ("PIIX3", "StorageControllerType");
-    mStorageControllerTypes [KStorageControllerType_PIIX4] =
-        tr ("PIIX4", "StorageControllerType");
-    mStorageControllerTypes [KStorageControllerType_ICH6] =
-        tr ("ICH6", "StorageControllerType");
-    mStorageControllerTypes [KStorageControllerType_IntelAhci] =
-        tr ("AHCI", "StorageControllerType");
-    mStorageControllerTypes [KStorageControllerType_LsiLogic] =
-        tr ("Lsilogic", "StorageControllerType");
-    mStorageControllerTypes [KStorageControllerType_BusLogic] =
-        tr ("BusLogic", "StorageControllerType");
-    mStorageControllerTypes [KStorageControllerType_I82078] =
-        tr ("I82078", "StorageControllerType");
-
-    mUSBDeviceStates [KUSBDeviceState_NotSupported] =
-        tr ("Not supported", "USBDeviceState");
-    mUSBDeviceStates [KUSBDeviceState_Unavailable] =
-        tr ("Unavailable", "USBDeviceState");
-    mUSBDeviceStates [KUSBDeviceState_Busy] =
-        tr ("Busy", "USBDeviceState");
-    mUSBDeviceStates [KUSBDeviceState_Available] =
-        tr ("Available", "USBDeviceState");
-    mUSBDeviceStates [KUSBDeviceState_Held] =
-        tr ("Held", "USBDeviceState");
-    mUSBDeviceStates [KUSBDeviceState_Captured] =
-        tr ("Captured", "USBDeviceState");
-
-    mUserDefinedPortName = tr ("User-defined", "serial port");
-
-    mWarningIcon = standardIcon (QStyle::SP_MessageBoxWarning, 0).pixmap (16, 16);
-    Assert (!mWarningIcon.isNull());
-
-    mErrorIcon = standardIcon (QStyle::SP_MessageBoxCritical, 0).pixmap (16, 16);
-    Assert (!mErrorIcon.isNull());
-
-    /* refresh media properties since they contain some translations too  */
-    for (VBoxMediaList::iterator it = mMediaList.begin();
-         it != mMediaList.end(); ++ it)
-        it->refresh();
-
-#if defined (Q_WS_PM) || defined (Q_WS_X11)
-    /* As PM and X11 do not (to my knowledge) have functionality for providing
-     * human readable key names, we keep a table of them, which must be
-     * updated when the language is changed. */
-    QIHotKeyEdit::retranslateUi();
-#endif
-}
-
-// public static stuff
-////////////////////////////////////////////////////////////////////////////////
-
-/* static */
-bool VBoxGlobal::isDOSType (const QString &aOSTypeId)
-{
-    if (aOSTypeId.left (3) == "dos" ||
-        aOSTypeId.left (3) == "win" ||
-        aOSTypeId.left (3) == "os2")
-        return true;
-
-    return false;
-}
-
-/**
- *  Sets the QLabel background and frame colors according tho the pixmap
- *  contents. The bottom right pixel of the label pixmap defines the
- *  background color of the label, the top right pixel defines the color of
- *  the one-pixel frame around it. This function also sets the alignment of
- *  the pixmap to AlignVTop (to correspond to the color choosing logic).
- *
- *  This method is useful to provide nice scaling of pixmal labels without
- *  scaling pixmaps themselves. To see th eeffect, the size policy of the
- *  label in the corresponding direction (vertical, for now) should be set to
- *  something like MinimumExpanding.
- *
- *  @todo Parametrize corners to select pixels from and set the alignment
- *  accordingly.
- */
-/* static */
-void VBoxGlobal::adoptLabelPixmap (QLabel *aLabel)
-{
-    AssertReturnVoid (aLabel);
-
-    aLabel->setAlignment (Qt::AlignTop);
-    aLabel->setFrameShape (QFrame::Box);
-    aLabel->setFrameShadow (QFrame::Plain);
-
-    const QPixmap *pix = aLabel->pixmap();
-    QImage img = pix->toImage();
-    QRgb rgbBack = img.pixel (img.width() - 1, img.height() - 1);
-    QRgb rgbFrame = img.pixel (img.width() - 1, 0);
-
-    QPalette pal = aLabel->palette();
-    pal.setColor (QPalette::Window, rgbBack);
-    pal.setColor (QPalette::WindowText, rgbFrame);
-    aLabel->setPalette (pal);
-}
-
-const char *gVBoxLangSubDir = "/nls";
-const char *gVBoxLangFileBase = "VirtualBox_";
-const char *gVBoxLangFileExt = ".qm";
-const char *gVBoxLangIDRegExp = "(([a-z]{2})(?:_([A-Z]{2}))?)|(C)";
-const char *gVBoxBuiltInLangName   = "C";
-
-class VBoxTranslator : public QTranslator
-{
-public:
-
-    VBoxTranslator (QObject *aParent = 0)
-        : QTranslator (aParent) {}
-
-    bool loadFile (const QString &aFileName)
-    {
-        QFile file (aFileName);
-        if (!file.open (QIODevice::ReadOnly))
-            return false;
-        mData = file.readAll();
-        return load ((uchar*) mData.data(), mData.size());
-    }
-
-private:
-
-    QByteArray mData;
-};
-
-static VBoxTranslator *sTranslator = 0;
-static QString sLoadedLangId = gVBoxBuiltInLangName;
-
-/**
- *  Returns the loaded (active) language ID.
- *  Note that it may not match with VBoxGlobalSettings::languageId() if the
- *  specified language cannot be loaded.
- *  If the built-in language is active, this method returns "C".
- *
- *  @note "C" is treated as the built-in language for simplicity -- the C
- *  locale is used in unix environments as a fallback when the requested
- *  locale is invalid. This way we don't need to process both the "built_in"
- *  language and the "C" language (which is a valid environment setting)
- *  separately.
- */
-/* static */
-QString VBoxGlobal::languageId()
-{
-    return sLoadedLangId;
-}
-
-/**
- *  Loads the language by language ID.
- *
- *  @param aLangId Language ID in in form of xx_YY. QString::null means the
- *                 system default language.
- */
-/* static */
-void VBoxGlobal::loadLanguage (const QString &aLangId)
-{
-    QString langId = aLangId.isNull() ?
-        VBoxGlobal::systemLanguageId() : aLangId;
-    QString languageFileName;
-    QString selectedLangId = gVBoxBuiltInLangName;
-
-    /* If C is selected we change it temporary to en. This makes sure any extra
-     * "en" translation file will be loaded. This is necessary for loading the
-     * plural forms of some of our translations. */
-    bool fResetToC = false;
-    if (langId == "C")
-    {
-        langId = "en";
-        fResetToC = true;
-    }
-
-    char szNlsPath[RTPATH_MAX];
-    int rc;
-
-    rc = RTPathAppPrivateNoArch(szNlsPath, sizeof(szNlsPath));
-    AssertRC (rc);
-
-    QString nlsPath = QString(szNlsPath) + gVBoxLangSubDir;
-    QDir nlsDir (nlsPath);
-
-    Assert (!langId.isEmpty());
-    if (!langId.isEmpty() && langId != gVBoxBuiltInLangName)
-    {
-        QRegExp regExp (gVBoxLangIDRegExp);
-        int pos = regExp.indexIn (langId);
-        /* the language ID should match the regexp completely */
-        AssertReturnVoid (pos == 0);
-
-        QString lang = regExp.cap (2);
-
-        if (nlsDir.exists (gVBoxLangFileBase + langId + gVBoxLangFileExt))
-        {
-            languageFileName = nlsDir.absoluteFilePath (gVBoxLangFileBase + langId +
-                                                        gVBoxLangFileExt);
-            selectedLangId = langId;
-        }
-        else if (nlsDir.exists (gVBoxLangFileBase + lang + gVBoxLangFileExt))
-        {
-            languageFileName = nlsDir.absoluteFilePath (gVBoxLangFileBase + lang +
-                                                        gVBoxLangFileExt);
-            selectedLangId = lang;
-        }
-        else
-        {
-            /* Never complain when the default language is requested.  In any
-             * case, if no explicit language file exists, we will simply
-             * fall-back to English (built-in). */
-            if (!aLangId.isNull() && langId != "en")
-                vboxProblem().cannotFindLanguage (langId, nlsPath);
-            /* selectedLangId remains built-in here */
-            AssertReturnVoid (selectedLangId == gVBoxBuiltInLangName);
-        }
-    }
-
-    /* delete the old translator if there is one */
-    if (sTranslator)
-    {
-        /* QTranslator destructor will call qApp->removeTranslator() for
-         * us. It will also delete all its child translations we attach to it
-         * below, so we don't have to care about them specially. */
-        delete sTranslator;
-    }
-
-    /* load new language files */
-    sTranslator = new VBoxTranslator (qApp);
-    Assert (sTranslator);
-    bool loadOk = true;
-    if (sTranslator)
-    {
-        if (selectedLangId != gVBoxBuiltInLangName)
-        {
-            Assert (!languageFileName.isNull());
-            loadOk = sTranslator->loadFile (languageFileName);
-        }
-        /* we install the translator in any case: on failure, this will
-         * activate an empty translator that will give us English
-         * (built-in) */
-        qApp->installTranslator (sTranslator);
-    }
-    else
-        loadOk = false;
-
-    if (loadOk)
-        sLoadedLangId = selectedLangId;
-    else
-    {
-        vboxProblem().cannotLoadLanguage (languageFileName);
-        sLoadedLangId = gVBoxBuiltInLangName;
-    }
-
-    /* Try to load the corresponding Qt translation */
-    if (sLoadedLangId != gVBoxBuiltInLangName)
-    {
-#ifdef Q_OS_UNIX
-        /* We use system installations of Qt on Linux systems, so first, try
-         * to load the Qt translation from the system location. */
-        languageFileName = QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" +
-                           sLoadedLangId + gVBoxLangFileExt;
-        QTranslator *qtSysTr = new QTranslator (sTranslator);
-        Assert (qtSysTr);
-        if (qtSysTr && qtSysTr->load (languageFileName))
-            qApp->installTranslator (qtSysTr);
-        /* Note that the Qt translation supplied by Sun is always loaded
-         * afterwards to make sure it will take precedence over the system
-         * translation (it may contain more decent variants of translation
-         * that better correspond to VirtualBox UI). We need to load both
-         * because a newer version of Qt may be installed on the user computer
-         * and the Sun version may not fully support it. We don't do it on
-         * Win32 because we supply a Qt library there and therefore the
-         * Sun translation is always the best one. */
-#endif
-        languageFileName =  nlsDir.absoluteFilePath (QString ("qt_") +
-                                                     sLoadedLangId +
-                                                     gVBoxLangFileExt);
-        QTranslator *qtTr = new QTranslator (sTranslator);
-        Assert (qtTr);
-        if (qtTr && (loadOk = qtTr->load (languageFileName)))
-            qApp->installTranslator (qtTr);
-        /* The below message doesn't fit 100% (because it's an additional
-         * language and the main one won't be reset to built-in on failure)
-         * but the load failure is so rare here that it's not worth a separate
-         * message (but still, having something is better than having none) */
-        if (!loadOk && !aLangId.isNull())
-            vboxProblem().cannotLoadLanguage (languageFileName);
-    }
-    if (fResetToC)
-        sLoadedLangId = "C";
-}
-
-QString VBoxGlobal::helpFile() const
-{
-#if defined (Q_WS_WIN32) || defined (Q_WS_X11)
-    const QString name = "VirtualBox";
-    const QString suffix = "chm";
-#elif defined (Q_WS_MAC)
-    const QString name = "UserManual";
-    const QString suffix = "pdf";
-#endif
-    /* Where are the docs located? */
-    char szDocsPath[RTPATH_MAX];
-    int rc = RTPathAppDocs (szDocsPath, sizeof (szDocsPath));
-    AssertRC (rc);
-    /* Make sure that the language is in two letter code.
-     * Note: if languageId() returns an empty string lang.name() will
-     * return "C" which is an valid language code. */
-    QLocale lang (VBoxGlobal::languageId());
-
-    /* Construct the path and the filename */
-    QString manual = QString ("%1/%2_%3.%4").arg (szDocsPath)
-                                            .arg (name)
-                                            .arg (lang.name())
-                                            .arg (suffix);
-    /* Check if a help file with that name exists */
-    QFileInfo fi (manual);
-    if (fi.exists())
-        return manual;
-
-    /* Fall back to the standard */
-    manual = QString ("%1/%2.%4").arg (szDocsPath)
-                                 .arg (name)
-                                 .arg (suffix);
-    return manual;
-}
-
-QIcon VBoxGlobal::iconSet (const QPixmap &aNormal,
-                           const QPixmap &aDisabled,
-                           const QPixmap &aActive)
-{
-    QIcon iconSet;
-
-    Assert (aNormal);
-        iconSet.addPixmap (aNormal, QIcon::Normal);
-
-    if (!aDisabled.isNull())
-        iconSet.addPixmap (aDisabled, QIcon::Disabled);
-
-    if (!aActive.isNull())
-        iconSet.addPixmap (aActive, QIcon::Active);
-
-    return iconSet;
-}
-
-/* static */
-QIcon VBoxGlobal::iconSet (const char *aNormal,
-                           const char *aDisabled /* = NULL */,
-                           const char *aActive /* = NULL */)
-{
-    QIcon iconSet;
-
-    Assert (aNormal != NULL);
-    iconSet.addFile (aNormal, QSize(),
-                     QIcon::Normal);
-    if (aDisabled != NULL)
-        iconSet.addFile (aDisabled, QSize(),
-                         QIcon::Disabled);
-    if (aActive != NULL)
-        iconSet.addFile (aActive, QSize(),
-                         QIcon::Active);
-    return iconSet;
-}
-
-/* static */
-QIcon VBoxGlobal::iconSetOnOff (const char *aNormal, const char *aNormalOff,
-                                const char *aDisabled /* = NULL */,
-                                const char *aDisabledOff /* = NULL */,
-                                const char *aActive /* = NULL */,
-                                const char *aActiveOff /* = NULL */)
-{
-    QIcon iconSet;
-
-    Assert (aNormal != NULL);
-    iconSet.addFile (aNormal, QSize(), QIcon::Normal, QIcon::On);
-    if (aNormalOff != NULL)
-        iconSet.addFile (aNormalOff, QSize(), QIcon::Normal, QIcon::Off);
-
-    if (aDisabled != NULL)
-        iconSet.addFile (aDisabled, QSize(), QIcon::Disabled, QIcon::On);
-    if (aDisabledOff != NULL)
-        iconSet.addFile (aDisabledOff, QSize(), QIcon::Disabled, QIcon::Off);
-
-    if (aActive != NULL)
-        iconSet.addFile (aActive, QSize(), QIcon::Active, QIcon::On);
-    if (aActiveOff != NULL)
-        iconSet.addFile (aActive, QSize(), QIcon::Active, QIcon::Off);
-
-    return iconSet;
-}
-
-/* static */
-QIcon VBoxGlobal::iconSetFull (const QSize &aNormalSize, const QSize &aSmallSize,
-                               const char *aNormal, const char *aSmallNormal,
-                               const char *aDisabled /* = NULL */,
-                               const char *aSmallDisabled /* = NULL */,
-                               const char *aActive /* = NULL */,
-                               const char *aSmallActive /* = NULL */)
-{
-    QIcon iconSet;
-
-    Assert (aNormal != NULL);
-    Assert (aSmallNormal != NULL);
-    iconSet.addFile (aNormal, aNormalSize, QIcon::Normal);
-    iconSet.addFile (aSmallNormal, aSmallSize, QIcon::Normal);
-
-    if (aSmallDisabled != NULL)
-    {
-        iconSet.addFile (aDisabled, aNormalSize, QIcon::Disabled);
-        iconSet.addFile (aSmallDisabled, aSmallSize, QIcon::Disabled);
-    }
-
-    if (aSmallActive != NULL)
-    {
-        iconSet.addFile (aActive, aNormalSize, QIcon::Active);
-        iconSet.addFile (aSmallActive, aSmallSize, QIcon::Active);
-    }
-
-    return iconSet;
-}
-
-QIcon VBoxGlobal::standardIcon (QStyle::StandardPixmap aStandard, QWidget *aWidget /* = NULL */)
-{
-    QStyle *style = aWidget ? aWidget->style(): QApplication::style();
-    if (!style)
-        return QIcon();
-#ifdef Q_WS_MAC
-    /* At least in Qt 4.3.4/4.4 RC1 SP_MessageBoxWarning is the application
-     * icon. So change this to the critical icon. (Maybe this would be
-     * fixed in a later Qt version) */
-    if (aStandard == QStyle::SP_MessageBoxWarning)
-        return style->standardIcon (QStyle::SP_MessageBoxCritical, 0, aWidget);
-#endif /* Q_WS_MAC */
-    return style->standardIcon (aStandard, 0, aWidget);
-}
-
-/**
- *  Replacement for QToolButton::setTextLabel() that handles the shortcut
- *  letter (if it is present in the argument string) as if it were a setText()
- *  call: the shortcut letter is used to automatically assign an "Alt+<letter>"
- *  accelerator key sequence to the given tool button.
- *
- *  @note This method preserves the icon set if it was assigned before. Only
- *  the text label and the accelerator are changed.
- *
- *  @param aToolButton  Tool button to set the text label on.
- *  @param aTextLabel   Text label to set.
- */
-/* static */
-void VBoxGlobal::setTextLabel (QToolButton *aToolButton,
-                               const QString &aTextLabel)
-{
-    AssertReturnVoid (aToolButton != NULL);
-
-    /* remember the icon set as setText() will kill it */
-    QIcon iset = aToolButton->icon();
-    /* re-use the setText() method to detect and set the accelerator */
-    aToolButton->setText (aTextLabel);
-    QKeySequence accel = aToolButton->shortcut();
-    aToolButton->setText (aTextLabel);
-    aToolButton->setIcon (iset);
-    /* set the accel last as setIconSet() would kill it */
-    aToolButton->setShortcut (accel);
-}
-
-/**
- *  Performs direct and flipped search of position for \a aRectangle to make sure
- *  it is fully contained inside \a aBoundRegion region by moving & resizing
- *  \a aRectangle if necessary. Selects the minimum shifted result between direct
- *  and flipped variants.
- */
-/* static */
-QRect VBoxGlobal::normalizeGeometry (const QRect &aRectangle, const QRegion &aBoundRegion,
-                                     bool aCanResize /* = true */)
-{
-    /* Direct search for normalized rectangle */
-    QRect var1 (getNormalized (aRectangle, aBoundRegion, aCanResize));
-
-    /* Flipped search for normalized rectangle */
-    QRect var2 (flip (getNormalized (flip (aRectangle).boundingRect(),
-                                     flip (aBoundRegion), aCanResize)).boundingRect());
-
-    /* Calculate shift from starting position for both variants */
-    double length1 = sqrt (pow ((double) (var1.x() - aRectangle.x()), (double) 2) +
-                           pow ((double) (var1.y() - aRectangle.y()), (double) 2));
-    double length2 = sqrt (pow ((double) (var2.x() - aRectangle.x()), (double) 2) +
-                           pow ((double) (var2.y() - aRectangle.y()), (double) 2));
-
-    /* Return minimum shifted variant */
-    return length1 > length2 ? var2 : var1;
-}
-
-/**
- *  Ensures that the given rectangle \a aRectangle is fully contained within the
- *  region \a aBoundRegion by moving \a aRectangle if necessary. If \a aRectangle is
- *  larger than \a aBoundRegion, top left corner of \a aRectangle is aligned with the
- *  top left corner of maximum available rectangle and, if \a aCanResize is true,
- *  \a aRectangle is shrinked to become fully visible.
- */
-/* static */
-QRect VBoxGlobal::getNormalized (const QRect &aRectangle, const QRegion &aBoundRegion,
-                                 bool /* aCanResize = true */)
-{
-    /* Storing available horizontal sub-rectangles & vertical shifts */
-    int windowVertical = aRectangle.center().y();
-    QVector <QRect> rectanglesVector (aBoundRegion.rects());
-    QList <QRect> rectanglesList;
-    QList <int> shiftsList;
-    foreach (QRect currentItem, rectanglesVector)
-    {
-        int currentDelta = qAbs (windowVertical - currentItem.center().y());
-        int shift2Top = currentItem.top() - aRectangle.top();
-        int shift2Bot = currentItem.bottom() - aRectangle.bottom();
-
-        int itemPosition = 0;
-        foreach (QRect item, rectanglesList)
-        {
-            int delta = qAbs (windowVertical - item.center().y());
-            if (delta > currentDelta) break; else ++ itemPosition;
-        }
-        rectanglesList.insert (itemPosition, currentItem);
-
-        int shift2TopPos = 0;
-        foreach (int shift, shiftsList)
-            if (qAbs (shift) > qAbs (shift2Top)) break; else ++ shift2TopPos;
-        shiftsList.insert (shift2TopPos, shift2Top);
-
-        int shift2BotPos = 0;
-        foreach (int shift, shiftsList)
-            if (qAbs (shift) > qAbs (shift2Bot)) break; else ++ shift2BotPos;
-        shiftsList.insert (shift2BotPos, shift2Bot);
-    }
-
-    /* Trying to find the appropriate place for window */
-    QRect result;
-    for (int i = -1; i < shiftsList.size(); ++ i)
-    {
-        /* Move to appropriate vertical */
-        QRect rectangle (aRectangle);
-        if (i >= 0) rectangle.translate (0, shiftsList [i]);
-
-        /* Search horizontal shift */
-        int maxShift = 0;
-        foreach (QRect item, rectanglesList)
-        {
-            QRect trectangle (rectangle.translated (item.left() - rectangle.left(), 0));
-            if (!item.intersects (trectangle))
-                continue;
-
-            if (rectangle.left() < item.left())
-            {
-                int shift = item.left() - rectangle.left();
-                maxShift = qAbs (shift) > qAbs (maxShift) ? shift : maxShift;
-            }
-            else if (rectangle.right() > item.right())
-            {
-                int shift = item.right() - rectangle.right();
-                maxShift = qAbs (shift) > qAbs (maxShift) ? shift : maxShift;
-            }
-        }
-
-        /* Shift across the horizontal direction */
-        rectangle.translate (maxShift, 0);
-
-        /* Check the translated rectangle to feat the rules */
-        if (aBoundRegion.united (rectangle) == aBoundRegion)
-            result = rectangle;
-
-        if (!result.isNull()) break;
-    }
-
-    if (result.isNull())
-    {
-        /* Resize window to feat desirable size
-         * using max of available rectangles */
-        QRect maxRectangle;
-        quint64 maxSquare = 0;
-        foreach (QRect item, rectanglesList)
-        {
-            quint64 square = item.width() * item.height();
-            if (square > maxSquare)
-            {
-                maxSquare = square;
-                maxRectangle = item;
-            }
-        }
-
-        result = aRectangle;
-        result.moveTo (maxRectangle.x(), maxRectangle.y());
-        if (maxRectangle.right() < result.right())
-            result.setRight (maxRectangle.right());
-        if (maxRectangle.bottom() < result.bottom())
-            result.setBottom (maxRectangle.bottom());
-    }
-
-    return result;
-}
-
-/**
- *  Returns the flipped (transposed) region.
- */
-/* static */
-QRegion VBoxGlobal::flip (const QRegion &aRegion)
-{
-    QRegion result;
-    QVector <QRect> rectangles (aRegion.rects());
-    foreach (QRect rectangle, rectangles)
-        result += QRect (rectangle.y(), rectangle.x(),
-                         rectangle.height(), rectangle.width());
-    return result;
-}
-
-/**
- *  Aligns the center of \a aWidget with the center of \a aRelative.
- *
- *  If necessary, \a aWidget's position is adjusted to make it fully visible
- *  within the available desktop area. If \a aWidget is bigger then this area,
- *  it will also be resized unless \a aCanResize is false or there is an
- *  inappropriate minimum size limit (in which case the top left corner will be
- *  simply aligned with the top left corner of the available desktop area).
- *
- *  \a aWidget must be a top-level widget. \a aRelative may be any widget, but
- *  if it's not top-level itself, its top-level widget will be used for
- *  calculations. \a aRelative can also be NULL, in which case \a aWidget will
- *  be centered relative to the available desktop area.
- */
-/* static */
-void VBoxGlobal::centerWidget (QWidget *aWidget, QWidget *aRelative,
-                               bool aCanResize /* = true */)
-{
-    AssertReturnVoid (aWidget);
-    AssertReturnVoid (aWidget->isTopLevel());
-
-    QRect deskGeo, parentGeo;
-    QWidget *w = aRelative;
-    if (w)
-    {
-        w = w->window();
-        deskGeo = QApplication::desktop()->availableGeometry (w);
-        parentGeo = w->frameGeometry();
-        /* On X11/Gnome, geo/frameGeo.x() and y() are always 0 for top level
-         * widgets with parents, what a shame. Use mapToGlobal() to workaround. */
-        QPoint d = w->mapToGlobal (QPoint (0, 0));
-        d.rx() -= w->geometry().x() - w->x();
-        d.ry() -= w->geometry().y() - w->y();
-        parentGeo.moveTopLeft (d);
-    }
-    else
-    {
-        deskGeo = QApplication::desktop()->availableGeometry();
-        parentGeo = deskGeo;
-    }
-
-    /* On X11, there is no way to determine frame geometry (including WM
-     * decorations) before the widget is shown for the first time. Stupidly
-     * enumerate other top level widgets to find the thickest frame. The code
-     * is based on the idea taken from QDialog::adjustPositionInternal(). */
-
-    int extraw = 0, extrah = 0;
-
-    QWidgetList list = QApplication::topLevelWidgets();
-    QListIterator<QWidget*> it (list);
-    while ((extraw == 0 || extrah == 0) && it.hasNext())
-    {
-        int framew, frameh;
-        QWidget *current = it.next();
-        if (!current->isVisible())
-            continue;
-
-        framew = current->frameGeometry().width() - current->width();
-        frameh = current->frameGeometry().height() - current->height();
-
-        extraw = qMax (extraw, framew);
-        extrah = qMax (extrah, frameh);
-    }
-
-    /// @todo (r=dmik) not sure if we really need this
-#if 0
-    /* sanity check for decoration frames. With embedding, we
-     * might get extraordinary values */
-    if (extraw == 0 || extrah == 0 || extraw > 20 || extrah > 50)
-    {
-        extrah = 50;
-        extraw = 20;
-    }
-#endif
-
-    /* On non-X11 platforms, the following would be enough instead of the
-     * above workaround: */
-    // QRect geo = frameGeometry();
-    QRect geo = QRect (0, 0, aWidget->width() + extraw,
-                             aWidget->height() + extrah);
-
-    geo.moveCenter (QPoint (parentGeo.x() + (parentGeo.width() - 1) / 2,
-                            parentGeo.y() + (parentGeo.height() - 1) / 2));
-
-    /* ensure the widget is within the available desktop area */
-    QRect newGeo = normalizeGeometry (geo, deskGeo, aCanResize);
-#ifdef Q_WS_MAC
-    /* No idea why, but Qt doesn't respect if there is a unified toolbar on the
-     * ::move call. So manually add the height of the toolbar before setting
-     * the position. */
-    if (w)
-        newGeo.translate (0, ::darwinWindowToolBarHeight (aWidget));
-#endif /* Q_WS_MAC */
-
-    aWidget->move (newGeo.topLeft());
-
-    if (aCanResize &&
-        (geo.width() != newGeo.width() || geo.height() != newGeo.height()))
-        aWidget->resize (newGeo.width() - extraw, newGeo.height() - extrah);
-}
-
-/**
- *  Returns the decimal separator for the current locale.
- */
-/* static */
-QChar VBoxGlobal::decimalSep()
-{
-    return QLocale::system().decimalPoint();
-}
-
-/**
- *  Returns the regexp string that defines the format of the human-readable
- *  size representation, <tt>####[.##] B|KB|MB|GB|TB|PB</tt>.
- *
- *  This regexp will capture 5 groups of text:
- *  - cap(1): integer number in case when no decimal point is present
- *            (if empty, it means that decimal point is present)
- *  - cap(2): size suffix in case when no decimal point is present (may be empty)
- *  - cap(3): integer number in case when decimal point is present (may be empty)
- *  - cap(4): fraction number (hundredth) in case when decimal point is present
- *  - cap(5): size suffix in case when decimal point is present (note that
- *            B cannot appear there)
- */
-/* static */
-QString VBoxGlobal::sizeRegexp()
-{
-    QString regexp =
-        QString ("^(?:(?:(\\d+)(?:\\s?([KMGTP]?B))?)|(?:(\\d*)%1(\\d{1,2})(?:\\s?([KMGTP]B))))$")
-                 .arg (decimalSep());
-    return regexp;
-}
-
-/**
- *  Parses the given size string that should be in form of
- *  <tt>####[.##] B|KB|MB|GB|TB|PB</tt> and returns the size value
- *  in bytes. Zero is returned on error.
- */
-/* static */
-quint64 VBoxGlobal::parseSize (const QString &aText)
-{
-    QRegExp regexp (sizeRegexp());
-    int pos = regexp.indexIn (aText);
-    if (pos != -1)
-    {
-        QString intgS = regexp.cap (1);
-        QString hundS;
-        QString suff = regexp.cap (2);
-        if (intgS.isEmpty())
-        {
-            intgS = regexp.cap (3);
-            hundS = regexp.cap (4);
-            suff = regexp.cap (5);
-        }
-
-        quint64 denom = 0;
-        if (suff.isEmpty() || suff == "B")
-            denom = 1;
-        else if (suff == "KB")
-            denom = _1K;
-        else if (suff == "MB")
-            denom = _1M;
-        else if (suff == "GB")
-            denom = _1G;
-        else if (suff == "TB")
-            denom = _1T;
-        else if (suff == "PB")
-            denom = _1P;
-
-        quint64 intg = intgS.toULongLong();
-        if (denom == 1)
-            return intg;
-
-        quint64 hund = hundS.leftJustified (2, '0').toULongLong();
-        hund = hund * denom / 100;
-        intg = intg * denom + hund;
-        return intg;
-    }
-    else
-        return 0;
-}
-
-/**
- * Formats the given @a aSize value in bytes to a human readable string
- * in form of <tt>####[.##] B|KB|MB|GB|TB|PB</tt>.
- *
- * The @a aMode and @a aDecimal parameters are used for rounding the resulting
- * number when converting the size value to KB, MB, etc gives a fractional part:
- * <ul>
- * <li>When \a aMode is FormatSize_Round, the result is rounded to the
- *     closest number containing \a aDecimal decimal digits.
- * </li>
- * <li>When \a aMode is FormatSize_RoundDown, the result is rounded to the
- *     largest number with \a aDecimal decimal digits that is not greater than
- *     the result. This guarantees that converting the resulting string back to
- *     the integer value in bytes will not produce a value greater that the
- *     initial size parameter.
- * </li>
- * <li>When \a aMode is FormatSize_RoundUp, the result is rounded to the
- *     smallest number with \a aDecimal decimal digits that is not less than the
- *     result. This guarantees that converting the resulting string back to the
- *     integer value in bytes will not produce a value less that the initial
- *     size parameter.
- * </li>
- * </ul>
- *
- * @param aSize     Size value in bytes.
- * @param aMode     Conversion mode.
- * @param aDecimal  Number of decimal digits in result.
- * @return          Human-readable size string.
- */
-/* static */
-QString VBoxGlobal::formatSize (quint64 aSize, uint aDecimal /* = 2 */,
-                                VBoxDefs::FormatSize aMode /* = FormatSize_Round */)
-{
-    static const char *Suffixes [] = { "B", "KB", "MB", "GB", "TB", "PB", NULL };
-
-    quint64 denom = 0;
-    int suffix = 0;
-
-    if (aSize < _1K)
-    {
-        denom = 1;
-        suffix = 0;
-    }
-    else if (aSize < _1M)
-    {
-        denom = _1K;
-        suffix = 1;
-    }
-    else if (aSize < _1G)
-    {
-        denom = _1M;
-        suffix = 2;
-    }
-    else if (aSize < _1T)
-    {
-        denom = _1G;
-        suffix = 3;
-    }
-    else if (aSize < _1P)
-    {
-        denom = _1T;
-        suffix = 4;
-    }
-    else
-    {
-        denom = _1P;
-        suffix = 5;
-    }
-
-    quint64 intg = aSize / denom;
-    quint64 decm = aSize % denom;
-    quint64 mult = 1;
-    for (uint i = 0; i < aDecimal; ++ i) mult *= 10;
-
-    QString number;
-    if (denom > 1)
-    {
-        if (decm)
-        {
-            decm *= mult;
-            /* not greater */
-            if (aMode == VBoxDefs::FormatSize_RoundDown)
-                decm = decm / denom;
-            /* not less */
-            else if (aMode == VBoxDefs::FormatSize_RoundUp)
-                decm = (decm + denom - 1) / denom;
-            /* nearest */
-            else decm = (decm + denom / 2) / denom;
-        }
-        /* check for the fractional part overflow due to rounding */
-        if (decm == mult)
-        {
-            decm = 0;
-            ++ intg;
-            /* check if we've got 1024 XB after rounding and scale down if so */
-            if (intg == 1024 && Suffixes [suffix + 1] != NULL)
-            {
-                intg /= 1024;
-                ++ suffix;
-            }
-        }
-        number = QString::number (intg);
-        if (aDecimal) number += QString ("%1%2").arg (decimalSep())
-            .arg (QString::number (decm).rightJustified (aDecimal, '0'));
-    }
-    else
-    {
-        number = QString::number (intg);
-    }
-
-    return QString ("%1 %2").arg (number).arg (Suffixes [suffix]);
-}
-
-/**
- *  Returns the required video memory in bytes for the current desktop
- *  resolution at maximum possible screen depth in bpp.
- */
-/* static */
-quint64 VBoxGlobal::requiredVideoMemory (CMachine *aMachine)
-{
-    QSize desktopRes = QApplication::desktop()->screenGeometry().size();
-    /* Calculate summary required memory amount in bits */
-    quint64 needBits = (desktopRes.width() /* display width */ *
-                        desktopRes.height() /* display height */ *
-                        32 /* we will take the maximum possible bpp for now */ +
-                        8 * _1M /* current cache per screen - may be changed in future */) *
-                       (!aMachine || aMachine->isNull() ? 1 : aMachine->GetMonitorCount()) +
-                       8 * 4096 /* adapter info */;
-    /* Translate value into megabytes with rounding to highest side */
-    quint64 needMBytes = needBits % (8 * _1M) ? needBits / (8 * _1M) + 1 :
-                         needBits / (8 * _1M) /* convert to megabytes */;
-
-    if (aMachine && !aMachine->isNull())
-    {
-       QString typeId = aMachine->GetOSTypeId();
-       if (typeId.startsWith("Windows"))
-       {
-           /* Windows guests need offscreen VRAM too for graphics acceleration features. */
-           needMBytes *= 2;
-       }
-    }
-
-    return needMBytes * _1M;
-}
-
-/**
- * Puts soft hyphens after every path component in the given file name.
- *
- * @param aFileName File name (must be a full path name).
- */
-/* static */
-QString VBoxGlobal::locationForHTML (const QString &aFileName)
-{
-/// @todo (dmik) remove?
-//    QString result = QDir::toNativeSeparators (fn);
-//#ifdef Q_OS_LINUX
-//    result.replace ('/', "/<font color=red>&shy;</font>");
-//#else
-//    result.replace ('\\', "\\<font color=red>&shy;</font>");
-//#endif
-//    return result;
-    QFileInfo fi (aFileName);
-    return fi.fileName();
-}
-
-/**
- *  Reformats the input string @a aStr so that:
- *  - strings in single quotes will be put inside <nobr> and marked
- *    with blue color;
- *  - UUIDs be put inside <nobr> and marked
- *    with green color;
- *  - replaces new line chars with </p><p> constructs to form paragraphs
- *    (note that <p> and </p> are not appended to the beginnign and to the
- *     end of the string respectively, to allow the result be appended
- *     or prepended to the existing paragraph).
- *
- *  If @a aToolTip is true, colouring is not applied, only the <nobr> tag
- *  is added. Also, new line chars are replaced with <br> instead of <p>.
- */
-/* static */
-QString VBoxGlobal::highlight (const QString &aStr, bool aToolTip /* = false */)
-{
-    QString strFont;
-    QString uuidFont;
-    QString endFont;
-    if (!aToolTip)
-    {
-        strFont = "<font color=#0000CC>";
-        uuidFont = "<font color=#008000>";
-        endFont = "</font>";
-    }
-
-    QString text = aStr;
-
-    /* replace special entities, '&' -- first! */
-    text.replace ('&', "&amp;");
-    text.replace ('<', "&lt;");
-    text.replace ('>', "&gt;");
-    text.replace ('\"', "&quot;");
-
-    /* mark strings in single quotes with color */
-    QRegExp rx = QRegExp ("((?:^|\\s)[(]?)'([^']*)'(?=[:.-!);]?(?:\\s|$))");
-    rx.setMinimal (true);
-    text.replace (rx,
-        QString ("\\1%1<nobr>'\\2'</nobr>%2").arg (strFont).arg (endFont));
-
-    /* mark UUIDs with color */
-    text.replace (QRegExp (
-        "((?:^|\\s)[(]?)"
-        "(\\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\})"
-        "(?=[:.-!);]?(?:\\s|$))"),
-        QString ("\\1%1<nobr>\\2</nobr>%2").arg (uuidFont).arg (endFont));
-
-    /* split to paragraphs at \n chars */
-    if (!aToolTip)
-        text.replace ('\n', "</p><p>");
-    else
-        text.replace ('\n', "<br>");
-
-    return text;
-}
-
-/**
- *  Reformats the input string @a aStr so that:
- *  - strings in single quotes will be put inside <nobr> and marked
- *    with bold style;
- *  - UUIDs be put inside <nobr> and marked
- *    with italic style;
- *  - replaces new line chars with </p><p> constructs to form paragraphs
- *    (note that <p> and </p> are not appended to the beginnign and to the
- *     end of the string respectively, to allow the result be appended
- *     or prepended to the existing paragraph).
- */
-/* static */
-QString VBoxGlobal::emphasize (const QString &aStr)
-{
-    QString strEmphStart ("<b>");
-    QString strEmphEnd ("</b>");
-    QString uuidEmphStart ("<i>");
-    QString uuidEmphEnd ("</i>");
-
-    QString text = aStr;
-
-    /* replace special entities, '&' -- first! */
-    text.replace ('&', "&amp;");
-    text.replace ('<', "&lt;");
-    text.replace ('>', "&gt;");
-    text.replace ('\"', "&quot;");
-
-    /* mark strings in single quotes with bold style */
-    QRegExp rx = QRegExp ("((?:^|\\s)[(]?)'([^']*)'(?=[:.-!);]?(?:\\s|$))");
-    rx.setMinimal (true);
-    text.replace (rx,
-        QString ("\\1%1<nobr>'\\2'</nobr>%2").arg (strEmphStart).arg (strEmphEnd));
-
-    /* mark UUIDs with italic style */
-    text.replace (QRegExp (
-        "((?:^|\\s)[(]?)"
-        "(\\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\})"
-        "(?=[:.-!);]?(?:\\s|$))"),
-        QString ("\\1%1<nobr>\\2</nobr>%2").arg (uuidEmphStart).arg (uuidEmphEnd));
-
-    /* split to paragraphs at \n chars */
-    text.replace ('\n', "</p><p>");
-
-    return text;
-}
-
-/**
- *  This does exactly the same as QLocale::system().name() but corrects its
- *  wrong behavior on Linux systems (LC_NUMERIC for some strange reason takes
- *  precedence over any other locale setting in the QLocale::system()
- *  implementation). This implementation first looks at LC_ALL (as defined by
- *  SUS), then looks at LC_MESSAGES which is designed to define a language for
- *  program messages in case if it differs from the language for other locale
- *  categories. Then it looks for LANG and finally falls back to
- *  QLocale::system().name().
- *
- *  The order of precedence is well defined here:
- *  http://opengroup.org/onlinepubs/007908799/xbd/envvar.html
- *
- *  @note This method will return "C" when the requested locale is invalid or
- *  when the "C" locale is set explicitly.
- */
-/* static */
-QString VBoxGlobal::systemLanguageId()
-{
-#if defined (Q_WS_MAC)
-    /* QLocale return the right id only if the user select the format of the
-     * language also. So we use our own implementation */
-    return ::darwinSystemLanguage();
-#elif defined (Q_OS_UNIX)
-    const char *s = RTEnvGet ("LC_ALL");
-    if (s == 0)
-        s = RTEnvGet ("LC_MESSAGES");
-    if (s == 0)
-        s = RTEnvGet ("LANG");
-    if (s != 0)
-        return QLocale (s).name();
-#endif
-    return  QLocale::system().name();
-}
-
-#if defined (Q_WS_X11)
-
-static char *XXGetProperty (Display *aDpy, Window aWnd,
-                            Atom aPropType, const char *aPropName)
-{
-    Atom propNameAtom = XInternAtom (aDpy, aPropName,
-                                     True /* only_if_exists */);
-    if (propNameAtom == None)
-        return NULL;
-
-    Atom actTypeAtom = None;
-    int actFmt = 0;
-    unsigned long nItems = 0;
-    unsigned long nBytesAfter = 0;
-    unsigned char *propVal = NULL;
-    int rc = XGetWindowProperty (aDpy, aWnd, propNameAtom,
-                                 0, LONG_MAX, False /* delete */,
-                                 aPropType, &actTypeAtom, &actFmt,
-                                 &nItems, &nBytesAfter, &propVal);
-    if (rc != Success)
-        return NULL;
-
-    return reinterpret_cast <char *> (propVal);
-}
-
-static Bool XXSendClientMessage (Display *aDpy, Window aWnd, const char *aMsg,
-                                 unsigned long aData0 = 0, unsigned long aData1 = 0,
-                                 unsigned long aData2 = 0, unsigned long aData3 = 0,
-                                 unsigned long aData4 = 0)
-{
-    Atom msgAtom = XInternAtom (aDpy, aMsg, True /* only_if_exists */);
-    if (msgAtom == None)
-        return False;
-
-    XEvent ev;
-
-    ev.xclient.type = ClientMessage;
-    ev.xclient.serial = 0;
-    ev.xclient.send_event = True;
-    ev.xclient.display = aDpy;
-    ev.xclient.window = aWnd;
-    ev.xclient.message_type = msgAtom;
-
-    /* always send as 32 bit for now */
-    ev.xclient.format = 32;
-    ev.xclient.data.l [0] = aData0;
-    ev.xclient.data.l [1] = aData1;
-    ev.xclient.data.l [2] = aData2;
-    ev.xclient.data.l [3] = aData3;
-    ev.xclient.data.l [4] = aData4;
-
-    return XSendEvent (aDpy, DefaultRootWindow (aDpy), False,
-                       SubstructureRedirectMask, &ev) != 0;
-}
-
-#endif
-
-/**
- * Activates the specified window. If necessary, the window will be
- * de-iconified activation.
- *
- * @note On X11, it is implied that @a aWid represents a window of the same
- * display the application was started on.
- *
- * @param aWId              Window ID to activate.
- * @param aSwitchDesktop    @c true to switch to the window's desktop before
- *                          activation.
- *
- * @return @c true on success and @c false otherwise.
- */
-/* static */
-bool VBoxGlobal::activateWindow (WId aWId, bool aSwitchDesktop /* = true */)
-{
-    bool result = true;
-
-#if defined (Q_WS_WIN32)
-
-    if (IsIconic (aWId))
-        result &= !!ShowWindow (aWId, SW_RESTORE);
-    else if (!IsWindowVisible (aWId))
-        result &= !!ShowWindow (aWId, SW_SHOW);
-
-    result &= !!SetForegroundWindow (aWId);
-
-#elif defined (Q_WS_X11)
-
-    Display *dpy = QX11Info::display();
-
-    if (aSwitchDesktop)
-    {
-        /* try to find the desktop ID using the NetWM property */
-        CARD32 *desktop = (CARD32 *) XXGetProperty (dpy, aWId, XA_CARDINAL,
-                                                    "_NET_WM_DESKTOP");
-        if (desktop == NULL)
-            /* if the NetWM propery is not supported try to find the desktop
-             * ID using the GNOME WM property */
-            desktop = (CARD32 *) XXGetProperty (dpy, aWId, XA_CARDINAL,
-                                                "_WIN_WORKSPACE");
-
-        if (desktop != NULL)
-        {
-            Bool ok = XXSendClientMessage (dpy, DefaultRootWindow (dpy),
-                                           "_NET_CURRENT_DESKTOP",
-                                           *desktop);
-            if (!ok)
-            {
-                LogWarningFunc (("Couldn't switch to desktop=%08X\n",
-                                 desktop));
-                result = false;
-            }
-            XFree (desktop);
-        }
-        else
-        {
-            LogWarningFunc (("Couldn't find a desktop ID for aWId=%08X\n",
-                             aWId));
-            result = false;
-        }
-    }
-
-    Bool ok = XXSendClientMessage (dpy, aWId, "_NET_ACTIVE_WINDOW");
-    result &= !!ok;
-
-    XRaiseWindow (dpy, aWId);
-
-#else
-
-    NOREF (aWId);
-    NOREF (aSwitchDesktop);
-    AssertFailed();
-    result = false;
-
-#endif
-
-    if (!result)
-        LogWarningFunc (("Couldn't activate aWId=%08X\n", aWId));
-
-    return result;
-}
-
-/**
- *  Removes the acceletartor mark (the ampersand symbol) from the given string
- *  and returns the result. The string is supposed to be a menu item's text
- *  that may (or may not) contain the accelerator mark.
- *
- *  In order to support accelerators used in non-alphabet languages
- *  (e.g. Japanese) that has a form of "(&<L>)" (where <L> is a latin letter),
- *  this method first searches for this pattern and, if found, removes it as a
- *  whole. If such a pattern is not found, then the '&' character is simply
- *  removed from the string.
- *
- *  @note This function removes only the first occurense of the accelerator
- *  mark.
- *
- *  @param aText Menu item's text to remove the acceletaror mark from.
- *
- *  @return The resulting string.
- */
-/* static */
-QString VBoxGlobal::removeAccelMark (const QString &aText)
-{
-    QString result = aText;
-
-    QRegExp accel ("\\(&[a-zA-Z]\\)");
-    int pos = accel.indexIn (result);
-    if (pos >= 0)
-        result.remove (pos, accel.cap().length());
-    else
-    {
-        pos = result.indexOf ('&');
-        if (pos >= 0)
-            result.remove (pos, 1);
-    }
-
-    return result;
-}
-
-/* static */
-QString VBoxGlobal::insertKeyToActionText (const QString &aText, const QString &aKey)
-{
-#ifdef Q_WS_MAC
-    QString key ("%1 (Host+%2)");
-#else
-    QString key ("%1 \tHost+%2");
-#endif
-    return key.arg (aText).arg (QKeySequence (aKey).toString (QKeySequence::NativeText));
-}
-
-/* static */
-QString VBoxGlobal::extractKeyFromActionText (const QString &aText)
-{
-    QString key;
-#ifdef Q_WS_MAC
-    QRegExp re (".* \\(Host\\+(.+)\\)");
-#else
-    QRegExp re (".* \\t\\Host\\+(.+)");
-#endif
-    if (re.exactMatch (aText))
-        key = re.cap (1);
-    return key;
-}
-
-/**
- * Joins two pixmaps horizontally with 2px space between them and returns the
- * result.
- *
- * @param aPM1 Left pixmap.
- * @param aPM2 Right pixmap.
- */
-/* static */
-QPixmap VBoxGlobal::joinPixmaps (const QPixmap &aPM1, const QPixmap &aPM2)
-{
-    if (aPM1.isNull())
-        return aPM2;
-    if (aPM2.isNull())
-        return aPM1;
-
-    QPixmap result (aPM1.width() + aPM2.width() + 2,
-                    qMax (aPM1.height(), aPM2.height()));
-    result.fill (Qt::transparent);
-
-    QPainter painter (&result);
-    painter.drawPixmap (0, 0, aPM1);
-    painter.drawPixmap (aPM1.width() + 2, result.height() - aPM2.height(), aPM2);
-    painter.end();
-
-    return result;
-}
-
-/**
- *  Searches for a widget that with @a aName (if it is not NULL) which inherits
- *  @a aClassName (if it is not NULL) and among children of @a aParent. If @a
- *  aParent is NULL, all top-level widgets are searched. If @a aRecursive is
- *  true, child widgets are recursively searched as well.
- */
-/* static */
-QWidget *VBoxGlobal::findWidget (QWidget *aParent, const char *aName,
-                                 const char *aClassName /* = NULL */,
-                                 bool aRecursive /* = false */)
-{
-    if (aParent == NULL)
-    {
-        QWidgetList list = QApplication::topLevelWidgets();
-        QWidget* w = NULL;
-        foreach(w, list)
-        {
-            if ((!aName || strcmp (w->objectName().toAscii().constData(), aName) == 0) &&
-                (!aClassName || strcmp (w->metaObject()->className(), aClassName) == 0))
-                break;
-            if (aRecursive)
-            {
-                w = findWidget (w, aName, aClassName, aRecursive);
-                if (w)
-                    break;
-            }
-        }
-        return w;
-    }
-
-    /* Find the first children of aParent with the appropriate properties.
-     * Please note that this call is recursivly. */
-    QList<QWidget *> list = qFindChildren<QWidget *> (aParent, aName);
-    QWidget *child = NULL;
-    foreach(child, list)
-    {
-        if (!aClassName || strcmp (child->metaObject()->className(), aClassName) == 0)
-            break;
-    }
-    return child;
-}
-
-/**
- * Figures out which hard disk formats are currently supported by VirtualBox.
- * Returned is a list of pairs with the form
- *   <tt>{"Backend Name", "*.suffix1 .suffix2 ..."}</tt>.
- */
-/* static */
-QList <QPair <QString, QString> > VBoxGlobal::HDDBackends()
-{
-    CSystemProperties systemProperties = vboxGlobal().virtualBox().GetSystemProperties();
-    QVector<CMediumFormat> mediumFormats = systemProperties.GetMediumFormats();
-    QList< QPair<QString, QString> > backendPropList;
-    for (int i = 0; i < mediumFormats.size(); ++ i)
-    {
-        /* File extensions */
-        QVector <QString> fileExtensions = mediumFormats [i].GetFileExtensions();
-        QStringList f;
-        for (int a = 0; a < fileExtensions.size(); ++ a)
-            f << QString ("*.%1").arg (fileExtensions [a]);
-        /* Create a pair out of the backend description and all suffix's. */
-        if (!f.isEmpty())
-            backendPropList << QPair<QString, QString> (mediumFormats [i].GetName(), f.join(" "));
-    }
-    return backendPropList;
-}
-
-/* static */
-QString VBoxGlobal::documentsPath()
-{
-    QString path;
-#if QT_VERSION < 0x040400
-    path = QDir::homePath();
-#else
-    path = QDesktopServices::storageLocation (QDesktopServices::DocumentsLocation);
-#endif
-
-    /* Make sure the path exists */
-    QDir dir (path);
-    if (dir.exists())
-        return QDir::cleanPath (dir.canonicalPath());
-    else
-    {
-        dir.setPath (QDir::homePath() + "/Documents");
-        if (dir.exists())
-            return QDir::cleanPath (dir.canonicalPath());
-        else
-            return QDir::homePath();
-    }
-}
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-/* static */
-bool VBoxGlobal::isAcceleration2DVideoAvailable()
-{
-    return VBoxQGLOverlay::isAcceleration2DVideoAvailable();
-}
-
-/** additional video memory required for the best 2D support performance
- *  total amount of VRAM required is thus calculated as requiredVideoMemory + required2DOffscreenVideoMemory  */
-/* static */
-quint64 VBoxGlobal::required2DOffscreenVideoMemory()
-{
-    return VBoxQGLOverlay::required2DOffscreenVideoMemory();
-}
-
-#endif
-
-// Public slots
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Opens the specified URL using OS/Desktop capabilities.
- *
- * @param aURL URL to open
- *
- * @return true on success and false otherwise
- */
-bool VBoxGlobal::openURL (const QString &aURL)
-{
-    /* Service event */
-    class ServiceEvent : public QEvent
-    {
-        public:
-
-            ServiceEvent (bool aResult) : QEvent (QEvent::User), mResult (aResult) {}
-
-            bool result() const { return mResult; }
-
-        private:
-
-            bool mResult;
-    };
-
-    /* Service-Client object */
-    class ServiceClient : public QEventLoop
-    {
-        public:
-
-            ServiceClient() : mResult (false) {}
-
-            bool result() const { return mResult; }
-
-        private:
-
-            bool event (QEvent *aEvent)
-            {
-                if (aEvent->type() == QEvent::User)
-                {
-                    ServiceEvent *pEvent = static_cast <ServiceEvent*> (aEvent);
-                    mResult = pEvent->result();
-                    pEvent->accept();
-                    quit();
-                    return true;
-                }
-                return false;
-            }
-
-            bool mResult;
-    };
-
-    /* Service-Server object */
-    class ServiceServer : public QThread
-    {
-        public:
-
-            ServiceServer (ServiceClient &aClient, const QString &sURL)
-                : mClient (aClient), mURL (sURL) {}
-
-        private:
-
-            void run()
-            {
-                QApplication::postEvent (&mClient, new ServiceEvent (QDesktopServices::openUrl (mURL)));
-            }
-
-            ServiceClient &mClient;
-            const QString &mURL;
-    };
-
-    ServiceClient client;
-    ServiceServer server (client, aURL);
-    server.start();
-    client.exec();
-    server.wait();
-
-    bool result = client.result();
-
-    if (!result)
-        vboxProblem().cannotOpenURL (aURL);
-
-    return result;
-}
-
-/**
- * Shows the VirtualBox registration dialog.
- *
- * @note that this method is not part of VBoxProblemReporter (like e.g.
- *       VBoxProblemReporter::showHelpAboutDialog()) because it is tied to
- *       VBoxCallback::OnExtraDataChange() handling performed by VBoxGlobal.
- *
- * @param aForce
- */
-void VBoxGlobal::showRegistrationDialog (bool aForce)
-{
-#ifdef VBOX_WITH_REGISTRATION
-    if (!aForce && !VBoxRegistrationDlg::hasToBeShown())
-        return;
-
-    if (mRegDlg)
-    {
-        /* Show the already opened registration dialog */
-        mRegDlg->setWindowState (mRegDlg->windowState() & ~Qt::WindowMinimized);
-        mRegDlg->raise();
-        mRegDlg->activateWindow();
-    }
-    else
-    {
-        /* Store the ID of the main window to ensure that only one
-         * registration dialog is shown at a time. Due to manipulations with
-         * OnExtraDataCanChange() and OnExtraDataChange() signals, this extra
-         * data item acts like an inter-process mutex, so the first process
-         * that attempts to set it will win, the rest will get a failure from
-         * the SetExtraData() call. */
-        mVBox.SetExtraData (VBoxDefs::GUI_RegistrationDlgWinID,
-                            QString ("%1").arg ((qulonglong) mMainWindow->winId()));
-
-        if (mVBox.isOk())
-        {
-            /* We've got the "mutex", create a new registration dialog */
-            VBoxRegistrationDlg *dlg =
-                new VBoxRegistrationDlg (&mRegDlg, mMainWindow);
-            dlg->setAttribute (Qt::WA_DeleteOnClose);
-            Assert (dlg == mRegDlg);
-            mRegDlg->show();
-        }
-    }
-#endif
-}
-
-/**
- * Shows the VirtualBox version check & update dialog.
- *
- * @note that this method is not part of VBoxProblemReporter (like e.g.
- *       VBoxProblemReporter::showHelpAboutDialog()) because it is tied to
- *       VBoxCallback::OnExtraDataChange() handling performed by VBoxGlobal.
- *
- * @param aForce
- */
-void VBoxGlobal::showUpdateDialog (bool aForce)
-{
-    /* Silently check in one day after current time-stamp */
-    QTimer::singleShot (24 /* hours */   * 60   /* minutes */ *
-                        60 /* seconds */ * 1000 /* milliseconds */,
-                        this, SLOT (perDayNewVersionNotifier()));
-
-    bool isNecessary = VBoxUpdateDlg::isNecessary();
-
-    if (!aForce && !isNecessary)
-        return;
-
-    if (mUpdDlg)
-    {
-        if (!mUpdDlg->isHidden())
-        {
-            mUpdDlg->setWindowState (mUpdDlg->windowState() & ~Qt::WindowMinimized);
-            mUpdDlg->raise();
-            mUpdDlg->activateWindow();
-        }
-    }
-    else
-    {
-        /* Store the ID of the main window to ensure that only one
-         * update dialog is shown at a time. Due to manipulations with
-         * OnExtraDataCanChange() and OnExtraDataChange() signals, this extra
-         * data item acts like an inter-process mutex, so the first process
-         * that attempts to set it will win, the rest will get a failure from
-         * the SetExtraData() call. */
-        mVBox.SetExtraData (VBoxDefs::GUI_UpdateDlgWinID,
-                            QString ("%1").arg ((qulonglong) mMainWindow->winId()));
-
-        if (mVBox.isOk())
-        {
-            /* We've got the "mutex", create a new update dialog */
-            VBoxUpdateDlg *dlg = new VBoxUpdateDlg (&mUpdDlg, aForce, 0);
-            dlg->setAttribute (Qt::WA_DeleteOnClose);
-            Assert (dlg == mUpdDlg);
-
-            /* Update dialog always in background mode for now.
-             * if (!aForce && isAutomatic) */
-            mUpdDlg->search();
-            /* else mUpdDlg->show(); */
-        }
-    }
-}
-
-void VBoxGlobal::perDayNewVersionNotifier()
-{
-    showUpdateDialog (false /* force show? */);
-}
-
-// Protected members
-////////////////////////////////////////////////////////////////////////////////
-
-bool VBoxGlobal::event (QEvent *e)
-{
-    switch (e->type())
-    {
-        case VBoxDefs::AsyncEventType:
-        {
-            VBoxAsyncEvent *ev = (VBoxAsyncEvent *) e;
-            ev->handle();
-            return true;
-        }
-
-        case VBoxDefs::MediaEnumEventType:
-        {
-            VBoxMediaEnumEvent *ev = (VBoxMediaEnumEvent*) e;
-
-            if (!ev->mLast)
-            {
-                if (ev->mMedium.state() == KMediumState_Inaccessible &&
-                    !ev->mMedium.result().isOk())
-                    vboxProblem().cannotGetMediaAccessibility (ev->mMedium);
-                Assert (ev->mIterator != mMediaList.end());
-                *(ev->mIterator) = ev->mMedium;
-                emit mediumEnumerated (*ev->mIterator);
-                ++ ev->mIterator;
-            }
-            else
-            {
-                /* the thread has posted the last message, wait for termination */
-                mMediaEnumThread->wait();
-                delete mMediaEnumThread;
-                mMediaEnumThread = 0;
-                emit mediumEnumFinished (mMediaList);
-            }
-
-            return true;
-        }
-
-        /* VirtualBox callback events */
-
-        case VBoxDefs::MachineStateChangeEventType:
-        {
-            emit machineStateChanged (*(VBoxMachineStateChangeEvent *) e);
-            return true;
-        }
-        case VBoxDefs::MachineDataChangeEventType:
-        {
-            emit machineDataChanged (*(VBoxMachineDataChangeEvent *) e);
-            return true;
-        }
-        case VBoxDefs::MachineRegisteredEventType:
-        {
-            emit machineRegistered (*(VBoxMachineRegisteredEvent *) e);
-            return true;
-        }
-        case VBoxDefs::SessionStateChangeEventType:
-        {
-            emit sessionStateChanged (*(VBoxSessionStateChangeEvent *) e);
-            return true;
-        }
-        case VBoxDefs::SnapshotEventType:
-        {
-            emit snapshotChanged (*(VBoxSnapshotEvent *) e);
-            return true;
-        }
-        case VBoxDefs::CanShowRegDlgEventType:
-        {
-            emit canShowRegDlg (((VBoxCanShowRegDlgEvent *) e)->mCanShow);
-            return true;
-        }
-        case VBoxDefs::CanShowUpdDlgEventType:
-        {
-            emit canShowUpdDlg (((VBoxCanShowUpdDlgEvent *) e)->mCanShow);
-            return true;
-        }
-        case VBoxDefs::ChangeGUILanguageEventType:
-        {
-            loadLanguage (static_cast<VBoxChangeGUILanguageEvent*> (e)->mLangId);
-            return true;
-        }
-#ifdef VBOX_GUI_WITH_SYSTRAY
-        case VBoxDefs::MainWindowCountChangeEventType:
-
-            emit mainWindowCountChanged (*(VBoxMainWindowCountChangeEvent *) e);
-            return true;
-
-        case VBoxDefs::CanShowTrayIconEventType:
-        {
-            emit trayIconCanShow (*(VBoxCanShowTrayIconEvent *) e);
-            return true;
-        }
-        case VBoxDefs::ShowTrayIconEventType:
-        {
-            emit trayIconShow (*(VBoxShowTrayIconEvent *) e);
-            return true;
-        }
-        case VBoxDefs::TrayIconChangeEventType:
-        {
-            emit trayIconChanged (*(VBoxChangeTrayIconEvent *) e);
-            return true;
-        }
-#endif
-#if defined(Q_WS_MAC)
-        case VBoxDefs::ChangeDockIconUpdateEventType:
-        {
-            emit dockIconUpdateChanged (*(VBoxChangeDockIconUpdateEvent *) e);
-            return true;
-        }
-#endif
-        default:
-            break;
-    }
-
-    return QObject::event (e);
-}
-
-bool VBoxGlobal::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    if (aEvent->type() == QEvent::LanguageChange &&
-        aObject->isWidgetType() &&
-        static_cast <QWidget *> (aObject)->isTopLevel())
-    {
-        /* Catch the language change event before any other widget gets it in
-         * order to invalidate cached string resources (like the details view
-         * templates) that may be used by other widgets. */
-        QWidgetList list = QApplication::topLevelWidgets();
-        if (list.first() == aObject)
-        {
-            /* call this only once per every language change (see
-             * QApplication::installTranslator() for details) */
-            retranslateUi();
-        }
-    }
-
-    return QObject::eventFilter (aObject, aEvent);
-}
-
-// Private members
-////////////////////////////////////////////////////////////////////////////////
-
-void VBoxGlobal::init()
-{
-#ifdef DEBUG
-    mVerString += " [DEBUG]";
-#endif
-
-#ifdef Q_WS_WIN
-    /* COM for the main thread is initialized in main() */
-#else
-    HRESULT rc = COMBase::InitializeCOM();
-    if (FAILED (rc))
-    {
-        vboxProblem().cannotInitCOM (rc);
-        return;
-    }
-#endif
-
-    mVBox.createInstance (CLSID_VirtualBox);
-    if (!mVBox.isOk())
-    {
-        vboxProblem().cannotCreateVirtualBox (mVBox);
-        return;
-    }
-
-    /* create default non-null global settings */
-    gset = VBoxGlobalSettings (false);
-
-    /* try to load global settings */
-    gset.load (mVBox);
-    if (!mVBox.isOk() || !gset)
-    {
-        vboxProblem().cannotLoadGlobalConfig (mVBox, gset.lastError());
-        return;
-    }
-
-    /* Load the customized language as early as possible to get possible error
-     * messages translated */
-    QString sLanguageId = gset.languageId();
-    if (!sLanguageId.isNull())
-        loadLanguage (sLanguageId);
-
-    retranslateUi();
-
-#ifdef VBOX_GUI_WITH_SYSTRAY
-    {
-        /* Increase open Fe/Qt4 windows reference count. */
-        int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() + 1;
-        AssertMsgReturnVoid ((c >= 0) || (mVBox.isOk()),
-            ("Something went wrong with the window reference count!"));
-        mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount, QString ("%1").arg (c));
-        mIncreasedWindowCounter = mVBox.isOk();
-        AssertReturnVoid (mIncreasedWindowCounter);
-    }
-#endif
-
-    /* Initialize guest OS Type list. */
-    CGuestOSTypeVector coll = mVBox.GetGuestOSTypes();
-    int osTypeCount = coll.size();
-    AssertMsg (osTypeCount > 0, ("Number of OS types must not be zero"));
-    if (osTypeCount > 0)
-    {
-        /* Here we assume the 'Other' type is always the first, so we
-         * remember it and will append it to the list when finished. */
-        CGuestOSType otherType = coll[0];
-        QString otherFamilyId (otherType.GetFamilyId());
-
-        /* Fill the lists with all the available OS Types except
-         * the 'Other' type, which will be appended. */
-        for (int i = 1; i < coll.size(); ++i)
-        {
-            CGuestOSType os = coll[i];
-            QString familyId (os.GetFamilyId());
-            if (!mFamilyIDs.contains (familyId))
-            {
-                mFamilyIDs << familyId;
-                mTypes << QList <CGuestOSType> ();
-            }
-            mTypes [mFamilyIDs.indexOf (familyId)].append (os);
-        }
-
-        /* Append the 'Other' OS Type to the end of list. */
-        if (!mFamilyIDs.contains (otherFamilyId))
-        {
-            mFamilyIDs << otherFamilyId;
-            mTypes << QList <CGuestOSType> ();
-        }
-        mTypes [mFamilyIDs.indexOf (otherFamilyId)].append (otherType);
-    }
-
-    /* Fill in OS type icon dictionary. */
-    static const char *kOSTypeIcons [][2] =
-    {
-        {"Other",           ":/os_other.png"},
-        {"DOS",             ":/os_dos.png"},
-        {"Netware",         ":/os_netware.png"},
-        {"L4",              ":/os_l4.png"},
-        {"Windows31",       ":/os_win31.png"},
-        {"Windows95",       ":/os_win95.png"},
-        {"Windows98",       ":/os_win98.png"},
-        {"WindowsMe",       ":/os_winme.png"},
-        {"WindowsNT4",      ":/os_winnt4.png"},
-        {"Windows2000",     ":/os_win2k.png"},
-        {"WindowsXP",       ":/os_winxp.png"},
-        {"WindowsXP_64",    ":/os_winxp_64.png"},
-        {"Windows2003",     ":/os_win2k3.png"},
-        {"Windows2003_64",  ":/os_win2k3_64.png"},
-        {"WindowsVista",    ":/os_winvista.png"},
-        {"WindowsVista_64", ":/os_winvista_64.png"},
-        {"Windows2008",     ":/os_win2k8.png"},
-        {"Windows2008_64",  ":/os_win2k8_64.png"},
-        {"Windows7",        ":/os_win7.png"},
-        {"Windows7_64",     ":/os_win7_64.png"},
-        {"WindowsNT",       ":/os_win_other.png"},
-        {"OS2Warp3",        ":/os_os2warp3.png"},
-        {"OS2Warp4",        ":/os_os2warp4.png"},
-        {"OS2Warp45",       ":/os_os2warp45.png"},
-        {"OS2eCS",          ":/os_os2ecs.png"},
-        {"OS2",             ":/os_os2_other.png"},
-        {"Linux22",         ":/os_linux22.png"},
-        {"Linux24",         ":/os_linux24.png"},
-        {"Linux24_64",      ":/os_linux24_64.png"},
-        {"Linux26",         ":/os_linux26.png"},
-        {"Linux26_64",      ":/os_linux26_64.png"},
-        {"ArchLinux",       ":/os_archlinux.png"},
-        {"ArchLinux_64",    ":/os_archlinux_64.png"},
-        {"Debian",          ":/os_debian.png"},
-        {"Debian_64",       ":/os_debian_64.png"},
-        {"OpenSUSE",        ":/os_opensuse.png"},
-        {"OpenSUSE_64",     ":/os_opensuse_64.png"},
-        {"Fedora",          ":/os_fedora.png"},
-        {"Fedora_64",       ":/os_fedora_64.png"},
-        {"Gentoo",          ":/os_gentoo.png"},
-        {"Gentoo_64",       ":/os_gentoo_64.png"},
-        {"Mandriva",        ":/os_mandriva.png"},
-        {"Mandriva_64",     ":/os_mandriva_64.png"},
-        {"RedHat",          ":/os_redhat.png"},
-        {"RedHat_64",       ":/os_redhat_64.png"},
-        {"Turbolinux",      ":/os_turbolinux.png"},
-        {"Ubuntu",          ":/os_ubuntu.png"},
-        {"Ubuntu_64",       ":/os_ubuntu_64.png"},
-        {"Xandros",         ":/os_xandros.png"},
-        {"Xandros_64",      ":/os_xandros_64.png"},
-        {"Linux",           ":/os_linux_other.png"},
-        {"FreeBSD",         ":/os_freebsd.png"},
-        {"FreeBSD_64",      ":/os_freebsd_64.png"},
-        {"OpenBSD",         ":/os_openbsd.png"},
-        {"OpenBSD_64",      ":/os_openbsd_64.png"},
-        {"NetBSD",          ":/os_netbsd.png"},
-        {"NetBSD_64",       ":/os_netbsd_64.png"},
-        {"Solaris",         ":/os_solaris.png"},
-        {"Solaris_64",      ":/os_solaris_64.png"},
-        {"OpenSolaris",     ":/os_opensolaris.png"},
-        {"OpenSolaris_64",  ":/os_opensolaris_64.png"},
-        {"QNX",             ":/os_qnx.png"},
-    };
-    for (uint n = 0; n < SIZEOF_ARRAY (kOSTypeIcons); ++ n)
-    {
-        mOsTypeIcons.insert (kOSTypeIcons [n][0],
-            new QPixmap (kOSTypeIcons [n][1]));
-    }
-
-    /* fill in VM state icon map */
-    static const struct
-    {
-        KMachineState state;
-        const char *name;
-    }
-    kVMStateIcons[] =
-    {
-        {KMachineState_Null, NULL},
-        {KMachineState_PoweredOff, ":/state_powered_off_16px.png"},
-        {KMachineState_Saved, ":/state_saved_16px.png"},
-        {KMachineState_Aborted, ":/state_aborted_16px.png"},
-        {KMachineState_Teleported, ":/state_saved_16px.png"},           /** @todo Live Migration: New icon? (not really important) */
-        {KMachineState_Running, ":/state_running_16px.png"},
-        {KMachineState_Paused, ":/state_paused_16px.png"},
-        {KMachineState_Teleporting, ":/state_running_16px.png"},        /** @todo Live Migration: New icon? (not really important) */
-        {KMachineState_LiveSnapshotting, ":/state_running_16px.png"},   /** @todo Live Migration: New icon? (not really important) */
-        {KMachineState_Stuck, ":/state_stuck_16px.png"},
-        {KMachineState_Starting, ":/state_running_16px.png"}, /// @todo (dmik) separate icon?
-        {KMachineState_Stopping, ":/state_running_16px.png"}, /// @todo (dmik) separate icon?
-        {KMachineState_Saving, ":/state_saving_16px.png"},
-        {KMachineState_Restoring, ":/state_restoring_16px.png"},
-        {KMachineState_TeleportingPausedVM, ":/state_saving_16px.png"}, /** @todo Live Migration: New icon? (not really important) */
-        {KMachineState_TeleportingIn, ":/state_restoring_16px.png"},    /** @todo Live Migration: New icon? (not really important) */
-        {KMachineState_RestoringSnapshot, ":/state_discarding_16px.png"},
-        {KMachineState_DeletingSnapshot, ":/state_discarding_16px.png"},
-        {KMachineState_SettingUp, ":/settings_16px.png"},
-    };
-    for (uint n = 0; n < SIZEOF_ARRAY (kVMStateIcons); n ++)
-    {
-        mVMStateIcons.insert (kVMStateIcons [n].state,
-            new QPixmap (kVMStateIcons [n].name));
-    }
-
-    /* initialize state colors map */
-    mVMStateColors.insert (KMachineState_Null,          new QColor (Qt::red));
-    mVMStateColors.insert (KMachineState_PoweredOff,    new QColor (Qt::gray));
-    mVMStateColors.insert (KMachineState_Saved,         new QColor (Qt::yellow));
-    mVMStateColors.insert (KMachineState_Aborted,       new QColor (Qt::darkRed));
-    mVMStateColors.insert (KMachineState_Teleported,    new QColor (Qt::red));
-    mVMStateColors.insert (KMachineState_Running,       new QColor (Qt::green));
-    mVMStateColors.insert (KMachineState_Paused,        new QColor (Qt::darkGreen));
-    mVMStateColors.insert (KMachineState_Stuck,         new QColor (Qt::darkMagenta));
-    mVMStateColors.insert (KMachineState_Teleporting,   new QColor (Qt::blue));
-    mVMStateColors.insert (KMachineState_LiveSnapshotting, new QColor (Qt::green));
-    mVMStateColors.insert (KMachineState_Starting,      new QColor (Qt::green));
-    mVMStateColors.insert (KMachineState_Stopping,      new QColor (Qt::green));
-    mVMStateColors.insert (KMachineState_Saving,        new QColor (Qt::green));
-    mVMStateColors.insert (KMachineState_Restoring,     new QColor (Qt::green));
-    mVMStateColors.insert (KMachineState_TeleportingPausedVM, new QColor (Qt::blue));
-    mVMStateColors.insert (KMachineState_TeleportingIn, new QColor (Qt::blue));
-    mVMStateColors.insert (KMachineState_RestoringSnapshot, new QColor (Qt::green));
-    mVMStateColors.insert (KMachineState_DeletingSnapshot, new QColor (Qt::green));
-    mVMStateColors.insert (KMachineState_SettingUp,     new QColor (Qt::green));
-
-    /* online/offline snapshot icons */
-    mOfflineSnapshotIcon = QPixmap (":/offline_snapshot_16px.png");
-    mOnlineSnapshotIcon = QPixmap (":/online_snapshot_16px.png");
-
-    qApp->installEventFilter (this);
-
-    /* process command line */
-
-    vm_render_mode_str = RTStrDup (virtualBox()
-            .GetExtraData (VBoxDefs::GUI_RenderMode).toAscii().constData());
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-# ifdef VBOX_WITH_DEBUGGER_GUI_MENU
-    mDbgEnabled = true;
-# else
-    mDbgEnabled = RTEnvExist("VBOX_GUI_DBG_ENABLED");
-# endif
-    mDbgAutoShow = mDbgAutoShowCommandLine = mDbgAutoShowStatistics
-        = RTEnvExist("VBOX_GUI_DBG_AUTO_SHOW");
-    mStartPaused = false;
-#endif
-
-    int argc = qApp->argc();
-    int i = 1;
-    while (i < argc)
-    {
-        const char *arg = qApp->argv() [i];
-        /* NOTE: the check here must match the corresponding check for the
-         * options to start a VM in main.cpp and hardenedmain.cpp exactly,
-         * otherwise there will be weird error messages. */
-        if (   !::strcmp (arg, "--startvm")
-            || !::strcmp (arg, "-startvm"))
-        {
-            if (++i < argc)
-            {
-                QString param = QString (qApp->argv() [i]);
-                QUuid uuid = QUuid(param);
-                if (!uuid.isNull())
-                {
-                    vmUuid = param;
-                }
-                else
-                {
-                    CMachine m = mVBox.FindMachine (param);
-                    if (m.isNull())
-                    {
-                        vboxProblem().cannotFindMachineByName (mVBox, param);
-                        return;
-                    }
-                    vmUuid = m.GetId();
-                }
-            }
-        }
-#ifdef VBOX_GUI_WITH_SYSTRAY
-        else if (!::strcmp (arg, "-systray") || !::strcmp (arg, "--systray"))
-        {
-            mIsTrayMenu = true;
-        }
-#endif
-        else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment"))
-        {
-            ++i;
-        }
-        else if (!::strcmp (arg, "-rmode") || !::strcmp (arg, "--rmode"))
-        {
-            if (++i < argc)
-                vm_render_mode_str = qApp->argv() [i];
-        }
-#ifdef VBOX_WITH_DEBUGGER_GUI
-        else if (!::strcmp (arg, "-dbg") || !::strcmp (arg, "--dbg"))
-        {
-            mDbgEnabled = true;
-        }
-        else if (!::strcmp( arg, "-debug") || !::strcmp (arg, "--debug"))
-        {
-            mDbgEnabled = true;
-            mDbgAutoShow = mDbgAutoShowCommandLine = mDbgAutoShowStatistics = true;
-            mStartPaused = true;
-        }
-        else if (!::strcmp (arg, "--debug-command-line"))
-        {
-            mDbgEnabled = true;
-            mDbgAutoShow = mDbgAutoShowCommandLine = true;
-            mStartPaused = true;
-        }
-        else if (!::strcmp (arg, "--debug-statistics"))
-        {
-            mDbgEnabled = true;
-            mDbgAutoShow = mDbgAutoShowStatistics = true;
-            mStartPaused = true;
-        }
-        else if (!::strcmp (arg, "-no-debug") || !::strcmp (arg, "--no-debug"))
-        {
-            mDbgEnabled = false;
-            mDbgAutoShow = false;
-            mDbgAutoShowCommandLine = false;
-            mDbgAutoShowStatistics = false;
-        }
-        /* Not quite debug options, but they're only useful with the debugger bits. */
-        else if (!::strcmp (arg, "--start-paused"))
-        {
-            mStartPaused = true;
-        }
-        else if (!::strcmp (arg, "--start-running"))
-        {
-            mStartPaused = false;
-        }
-#endif
-        /** @todo add an else { msgbox(syntax error); exit(1); } here, pretty please... */
-        i++;
-    }
-
-    vm_render_mode = vboxGetRenderMode (vm_render_mode_str);
-
-    /* setup the callback */
-    callback = CVirtualBoxCallback (new VBoxCallback (*this));
-    mVBox.RegisterCallback (callback);
-    AssertWrapperOk (mVBox);
-    if (!mVBox.isOk())
-        return;
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    /* setup the debugger gui. */
-    if (RTEnvExist("VBOX_GUI_NO_DEBUGGER"))
-        mDbgEnabled = mDbgAutoShow =  mDbgAutoShowCommandLine = mDbgAutoShowStatistics = false;
-    if (mDbgEnabled)
-    {
-        int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &mhVBoxDbg);
-        if (RT_FAILURE(vrc))
-        {
-            mhVBoxDbg = NIL_RTLDRMOD;
-            mDbgAutoShow =  mDbgAutoShowCommandLine = mDbgAutoShowStatistics = false;
-            LogRel(("Failed to load VBoxDbg, rc=%Rrc\n", vrc));
-        }
-    }
-#endif
-
-    mValid = true;
-}
-
-/** @internal
- *
- *  This method should be never called directly. It is called automatically
- *  when the application terminates.
- */
-void VBoxGlobal::cleanup()
-{
-    /* sanity check */
-    if (!sVBoxGlobalInCleanup)
-    {
-        AssertMsgFailed (("Should never be called directly\n"));
-        return;
-    }
-
-#ifdef VBOX_GUI_WITH_SYSTRAY
-    if (mIncreasedWindowCounter)
-    {
-        /* Decrease open Fe/Qt4 windows reference count. */
-        int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() - 1;
-        AssertMsg ((c >= 0) || (mVBox.isOk()),
-            ("Something went wrong with the window reference count!"));
-        if (c < 0)
-            c = 0;   /* Clean up the mess. */
-        mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount,
-                            (c > 0) ? QString ("%1").arg (c) : NULL);
-        AssertWrapperOk (mVBox);
-        if (c == 0)
-        {
-            mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, NULL);
-            AssertWrapperOk (mVBox);
-        }
-    }
-#endif
-
-    if (!callback.isNull())
-    {
-        mVBox.UnregisterCallback (callback);
-        AssertWrapperOk (mVBox);
-        callback.detach();
-    }
-
-    if (mMediaEnumThread)
-    {
-        /* sVBoxGlobalInCleanup is true here, so just wait for the thread */
-        mMediaEnumThread->wait();
-        delete mMediaEnumThread;
-        mMediaEnumThread = 0;
-    }
-
-#ifdef VBOX_WITH_REGISTRATION
-    if (mRegDlg)
-        mRegDlg->close();
-#endif
-
-    if (mConsoleWnd)
-        delete mConsoleWnd;
-    if (mSelectorWnd)
-        delete mSelectorWnd;
-
-    /* ensure CGuestOSType objects are no longer used */
-    mFamilyIDs.clear();
-    mTypes.clear();
-
-    /* media list contains a lot of CUUnknown, release them */
-    mMediaList.clear();
-    /* the last step to ensure we don't use COM any more */
-    mVBox.detach();
-
-    /* There may be VBoxMediaEnumEvent instances still in the message
-     * queue which reference COM objects. Remove them to release those objects
-     * before uninitializing the COM subsystem. */
-    QApplication::removePostedEvents (this);
-
-#ifdef Q_WS_WIN
-    /* COM for the main thread is shutdown in main() */
-#else
-    COMBase::CleanupCOM();
-#endif
-
-    mValid = false;
-}
-
-/** @fn vboxGlobal
- *
- *  Shortcut to the static VBoxGlobal::instance() method, for convenience.
- */
-
-
-/**
- *  USB Popup Menu class methods
- *  This class provides the list of USB devices attached to the host.
- */
-VBoxUSBMenu::VBoxUSBMenu (QWidget *aParent) : QMenu (aParent)
-{
-    connect (this, SIGNAL (aboutToShow()),
-             this, SLOT   (processAboutToShow()));
-//    connect (this, SIGNAL (hovered (QAction *)),
-//             this, SLOT   (processHighlighted (QAction *)));
-}
-
-const CUSBDevice& VBoxUSBMenu::getUSB (QAction *aAction)
-{
-    return mUSBDevicesMap [aAction];
-}
-
-void VBoxUSBMenu::setConsole (const CConsole &aConsole)
-{
-    mConsole = aConsole;
-}
-
-void VBoxUSBMenu::processAboutToShow()
-{
-    clear();
-    mUSBDevicesMap.clear();
-
-    CHost host = vboxGlobal().virtualBox().GetHost();
-
-    bool isUSBEmpty = host.GetUSBDevices().size() == 0;
-    if (isUSBEmpty)
-    {
-        QAction *action = addAction (tr ("<no devices available>", "USB devices"));
-        action->setEnabled (false);
-        action->setToolTip (tr ("No supported devices connected to the host PC",
-                                "USB device tooltip"));
-    }
-    else
-    {
-        CHostUSBDeviceVector devvec = host.GetUSBDevices();
-        for (int i = 0; i < devvec.size(); ++i)
-        {
-            CHostUSBDevice dev = devvec[i];
-            CUSBDevice usb (dev);
-            QAction *action = addAction (vboxGlobal().details (usb));
-            action->setCheckable (true);
-            mUSBDevicesMap [action] = usb;
-            /* check if created item was alread attached to this session */
-            if (!mConsole.isNull())
-            {
-                CUSBDevice attachedUSB =
-                    mConsole.FindUSBDeviceById (usb.GetId());
-                action->setChecked (!attachedUSB.isNull());
-                action->setEnabled (dev.GetState() !=
-                                    KUSBDeviceState_Unavailable);
-            }
-        }
-    }
-}
-
-bool VBoxUSBMenu::event(QEvent *aEvent)
-{
-    /* We provide dynamic tooltips for the usb devices */
-    if (aEvent->type() == QEvent::ToolTip)
-    {
-        QHelpEvent *helpEvent = static_cast<QHelpEvent *> (aEvent);
-        QAction *action = actionAt (helpEvent->pos());
-        if (action)
-        {
-            CUSBDevice usb = mUSBDevicesMap [action];
-            if (!usb.isNull())
-            {
-                QToolTip::showText (helpEvent->globalPos(), vboxGlobal().toolTip (usb));
-                return true;
-            }
-        }
-    }
-    return QMenu::event (aEvent);
-}
-
-/**
- *  Enable/Disable Menu class.
- *  This class provides enable/disable menu items.
- */
-VBoxSwitchMenu::VBoxSwitchMenu (QWidget *aParent, QAction *aAction,
-                                bool aInverted)
-    : QMenu (aParent), mAction (aAction), mInverted (aInverted)
-{
-    /* this menu works only with toggle action */
-    Assert (aAction->isCheckable());
-    addAction(aAction);
-    connect (this, SIGNAL (aboutToShow()),
-             this, SLOT   (processAboutToShow()));
-}
-
-void VBoxSwitchMenu::setToolTip (const QString &aTip)
-{
-    mAction->setToolTip (aTip);
-}
-
-void VBoxSwitchMenu::processAboutToShow()
-{
-    QString text = mAction->isChecked() ^ mInverted ? tr ("Disable") : tr ("Enable");
-    mAction->setText (text);
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h	(revision 25171)
@@ -0,0 +1,170 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxGlobalSettingsData, VBoxGlobalSettings class declarations
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxGlobalSettings_h__
+#define __VBoxGlobalSettings_h__
+
+#include "CIShared.h"
+
+/* Qt includes */
+#include <QObject>
+
+class CVirtualBox;
+
+class VBoxGlobalSettingsData
+{
+public:
+
+    VBoxGlobalSettingsData();
+    VBoxGlobalSettingsData( const VBoxGlobalSettingsData &that );
+    virtual ~VBoxGlobalSettingsData();
+    bool operator==( const VBoxGlobalSettingsData &that ) const;
+
+private:
+
+    int hostkey;
+    bool autoCapture;
+    QString guiFeatures;
+    QString languageId;
+    QString maxGuestRes;
+    QString remapScancodes;
+    bool trayIconEnabled;
+    bool dockPreviewEnabled;
+
+    friend class VBoxGlobalSettings;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+class VBoxGlobalSettings : public QObject, public CIShared <VBoxGlobalSettingsData>
+{
+    Q_OBJECT
+    Q_PROPERTY (int hostKey READ hostKey WRITE setHostKey)
+    Q_PROPERTY (bool autoCapture READ autoCapture WRITE setAutoCapture)
+    Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures)
+    Q_PROPERTY (QString languageId READ languageId WRITE setLanguageId)
+    Q_PROPERTY (QString maxGuestRes READ maxGuestRes WRITE setMaxGuestRes)
+    Q_PROPERTY (QString remapScancodes READ remapScancodes WRITE setRemapScancodes)
+    Q_PROPERTY (bool trayIconEnabled READ trayIconEnabled WRITE setTrayIconEnabled)
+    Q_PROPERTY (bool dockPreviewEnabled READ dockPreviewEnabled WRITE setDockPreviewEnabled)
+
+public:
+
+    VBoxGlobalSettings (bool null = true)
+        : CIShared <VBoxGlobalSettingsData> (null) {}
+    VBoxGlobalSettings (const VBoxGlobalSettings &that)
+        : QObject(), CIShared <VBoxGlobalSettingsData> (that) {}
+    VBoxGlobalSettings &operator= (const VBoxGlobalSettings &that) {
+        CIShared <VBoxGlobalSettingsData>::operator= (that);
+        return *this;
+    }
+
+    // Properties
+
+    int hostKey() const { return data()->hostkey; }
+    void setHostKey (int key);
+
+    bool autoCapture() const { return data()->autoCapture; }
+    void setAutoCapture (bool aAutoCapture)
+    {
+        mData()->autoCapture = aAutoCapture;
+        resetError();
+    }
+
+    QString guiFeatures() const { return data()->guiFeatures; }
+    void setGuiFeatures (const QString &aFeatures)
+    {
+        mData()->guiFeatures = aFeatures;
+    }
+    bool isFeatureActive (const char*) const;
+
+    QString languageId() const { return data()->languageId; }
+    void setLanguageId (const QString &aLanguageId)
+    {
+        mData()->languageId = aLanguageId;
+    }
+
+    QString maxGuestRes() const { return data()->maxGuestRes; }
+    void setMaxGuestRes (const QString &aMaxGuestRes)
+    {
+        mData()->maxGuestRes = aMaxGuestRes;
+    }
+
+    QString remapScancodes() const { return data()->remapScancodes; }
+    void setRemapScancodes (const QString &aRemapScancodes)
+    {
+        mData()->remapScancodes = aRemapScancodes;
+    }
+
+
+    bool trayIconEnabled() const { return data()->trayIconEnabled; }
+    void setTrayIconEnabled (bool enabled)
+    {
+        mData()->trayIconEnabled = enabled;
+    }
+
+    bool dockPreviewEnabled() const { return data()->dockPreviewEnabled; }
+    void setDockPreviewEnabled (bool enabled)
+    {
+        mData()->dockPreviewEnabled = enabled;
+    }
+
+
+    //
+
+    void load (CVirtualBox &vbox);
+    void save (CVirtualBox &vbox) const;
+
+    /**
+     *  Returns true if the last setter or #load() operation has been failed
+     *  and false otherwise.
+     */
+    bool operator !() const { return !last_err.isEmpty(); }
+
+    /**
+     *  Returns the description of the error set by the last setter or #load()
+     *  operation, or an empty (or null) string if the last operation was
+     *  successful.
+     */
+    QString lastError() const { return last_err; }
+
+    QString publicProperty (const QString &publicName) const;
+    bool setPublicProperty (const QString &publicName, const QString &value);
+
+signals:
+
+    /**
+     *  This sighal is emitted only when #setPublicProperty() or #load() is called.
+     *  Direct modification of properties through individual setters or through
+     *  QObject::setProperty() currently cannot be tracked.
+     */
+    void propertyChanged (const char *publicName, const char *name);
+
+private:
+
+    void setPropertyPrivate (size_t index, const QString &value);
+    void resetError() { last_err = QString::null; }
+
+    QString last_err;
+};
+
+#endif // __VBoxGlobalSettings_h__
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGuestRAMSlider.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGuestRAMSlider.cpp	(revision 25170)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: VBoxGuestRAMSlider class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGuestRAMSlider.h"
-#include "VBoxGlobal.h"
-
-VBoxGuestRAMSlider::VBoxGuestRAMSlider (QWidget *aParent /* = 0 */)
-  : QIAdvancedSlider (aParent)
-  , mMinRAM (0)
-  , mMaxRAMOpt (0)
-  , mMaxRAMAlw (0)
-  , mMaxRAM (0)
-{
-    init();
-}
-
-VBoxGuestRAMSlider::VBoxGuestRAMSlider (Qt::Orientation aOrientation, QWidget *aParent /* = 0 */)
-  : QIAdvancedSlider (aOrientation, aParent)
-  , mMinRAM (0)
-  , mMaxRAMOpt (0)
-  , mMaxRAMAlw (0)
-  , mMaxRAM (0)
-{
-    init();
-}
-
-uint VBoxGuestRAMSlider::minRAM() const
-{
-    return mMinRAM;
-}
-
-uint VBoxGuestRAMSlider::maxRAMOpt() const
-{
-    return mMaxRAMOpt;
-}
-
-uint VBoxGuestRAMSlider::maxRAMAlw() const
-{
-    return mMaxRAMAlw;
-}
-
-uint VBoxGuestRAMSlider::maxRAM() const
-{
-    return mMaxRAM;
-}
-
-void VBoxGuestRAMSlider::init()
-{
-    ulong fullSize = vboxGlobal().virtualBox().GetHost().GetMemorySize();
-    CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
-    mMinRAM = sys.GetMinGuestRAM();
-    mMaxRAM = RT_MIN (RT_ALIGN (fullSize, _1G / _1M), sys.GetMaxGuestRAM());
-
-    /* Come up with some nice round percent boundaries relative to
-     * the system memory. A max of 75% on a 256GB config is ridiculous,
-     * even on an 8GB rig reserving 2GB for the OS is way to conservative.
-     * The max numbers can be estimated using the following program:
-     *
-     *      double calcMaxPct(uint64_t cbRam)
-     *      {
-     *          double cbRamOverhead = cbRam * 0.0390625; // 160 bytes per page.
-     *          double cbRamForTheOS = RT_MAX(RT_MIN(_512M, cbRam * 0.25), _64M);
-     *          double OSPct  = (cbRamOverhead + cbRamForTheOS) * 100.0 / cbRam;
-     *          double MaxPct = 100 - OSPct;
-     *          return MaxPct;
-     *      }
-     *
-     *      int main()
-     *      {
-     *          uint64_t cbRam = _1G;
-     *          for (; !(cbRam >> 33); cbRam += _1G)
-     *              printf("%8lluGB %.1f%% %8lluKB\n", cbRam >> 30, calcMaxPct(cbRam),
-     *                     (uint64_t)(cbRam * calcMaxPct(cbRam) / 100.0) >> 20);
-     *          for (; !(cbRam >> 51); cbRam <<= 1)
-     *              printf("%8lluGB %.1f%% %8lluKB\n", cbRam >> 30, calcMaxPct(cbRam),
-     *                     (uint64_t)(cbRam * calcMaxPct(cbRam) / 100.0) >> 20);
-     *          return 0;
-     *      }
-     *
-     * Note. We might wanna put these calculations somewhere global later. */
-
-    /* System RAM amount test */
-    mMaxRAMAlw  = (uint)(0.75 * fullSize);
-    mMaxRAMOpt  = (uint)(0.50 * fullSize);
-    if (fullSize < 3072)
-        /* done */;
-    else if (fullSize < 4096)   /* 3GB */
-        mMaxRAMAlw = (uint)(0.80 * fullSize);
-    else if (fullSize < 6144)   /* 4-5GB */
-    {
-        mMaxRAMAlw = (uint)(0.84 * fullSize);
-        mMaxRAMOpt = (uint)(0.60 * fullSize);
-    }
-    else if (fullSize < 8192)   /* 6-7GB */
-    {
-        mMaxRAMAlw = (uint)(0.88 * fullSize);
-        mMaxRAMOpt = (uint)(0.65 * fullSize);
-    }
-    else if (fullSize < 16384)  /* 8-15GB */
-    {
-        mMaxRAMAlw = (uint)(0.90 * fullSize);
-        mMaxRAMOpt = (uint)(0.70 * fullSize);
-    }
-    else if (fullSize < 32768)  /* 16-31GB */
-    {
-        mMaxRAMAlw = (uint)(0.93 * fullSize);
-        mMaxRAMOpt = (uint)(0.75 * fullSize);
-    }
-    else if (fullSize < 65536)  /* 32-63GB */
-    {
-        mMaxRAMAlw = (uint)(0.94 * fullSize);
-        mMaxRAMOpt = (uint)(0.80 * fullSize);
-    }
-    else if (fullSize < 131072) /* 64-127GB */
-    {
-        mMaxRAMAlw = (uint)(0.95 * fullSize);
-        mMaxRAMOpt = (uint)(0.85 * fullSize);
-    }
-    else                        /* 128GB- */
-    {
-        mMaxRAMAlw = (uint)(0.96 * fullSize);
-        mMaxRAMOpt = (uint)(0.90 * fullSize);
-    }
-    /* Now check the calculated maximums are out of the range for the guest
-     * RAM. If so change it accordingly. */
-    mMaxRAMAlw  = RT_MIN (mMaxRAMAlw, mMaxRAM);
-    mMaxRAMOpt  = RT_MIN (mMaxRAMOpt, mMaxRAM);
-
-    setPageStep (calcPageStep (mMaxRAM));
-    setSingleStep (pageStep() / 4);
-    setTickInterval (pageStep());
-    /* Setup the scale so that ticks are at page step boundaries */
-    setMinimum ((mMinRAM / pageStep()) * pageStep());
-    setMaximum (mMaxRAM);
-    setSnappingEnabled (true);
-    setOptimalHint (mMinRAM, mMaxRAMOpt);
-    setWarningHint (mMaxRAMOpt, mMaxRAMAlw);
-    setErrorHint (mMaxRAMAlw, mMaxRAM);
-}
-
-/**
- *  Calculates a suitable page step size for the given max value. The returned
- *  size is so that there will be no more than 32 pages. The minimum returned
- *  page size is 4.
- */
-int VBoxGuestRAMSlider::calcPageStep (int aMax) const
-{
-    /* reasonable max. number of page steps is 32 */
-    uint page = ((uint) aMax + 31) / 32;
-    /* make it a power of 2 */
-    uint p = page, p2 = 0x1;
-    while ((p >>= 1))
-        p2 <<= 1;
-    if (page != p2)
-        p2 <<= 1;
-    if (p2 < 4)
-        p2 = 4;
-    return (int) p2;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxHelpActions.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxHelpActions.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxHelpActions.h	(revision 25171)
@@ -0,0 +1,65 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxHelpActions class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxHelpActions_h__
+#define __VBoxHelpActions_h__
+
+/* Qt includes */
+#include <QObject>
+
+class QMenu;
+class QAction;
+
+/**
+ * Help Menu action container.
+ *
+ * Contains actions for all help menu items and methods to insert them to a
+ * QMenu and to perform NLS string translation.
+ *
+ * Instances of this class are to be created as members of QWidget classes that
+ * need a Help menu. The containing class usually passes itself as an argument
+ * to the #setup() method and then calls #addTo() to add actions to its Help
+ * menu. The #retranslateUi() method is called when it is necessary to
+ * re-translate all action NLS according to the current language.
+ */
+struct VBoxHelpActions
+{
+    VBoxHelpActions()
+        : contentsAction (NULL), webAction (NULL)
+        , resetMessagesAction (NULL), registerAction (NULL)
+        , updateAction (NULL), aboutAction (NULL)
+        {}
+
+    void setup (QObject *aParent);
+    void addTo (QMenu *aMenu);
+    void retranslateUi();
+
+    QAction *contentsAction;
+    QAction *webAction;
+    QAction *resetMessagesAction;
+    QAction *registerAction;
+    QAction *updateAction;
+    QAction *aboutAction;
+};
+
+#endif /* __VBoxHelpActions_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWgt.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWgt.cpp	(revision 25170)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxImportApplianceWgt class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxImportApplianceWgt.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// ImportSortProxyModel
-
-class ImportSortProxyModel: public VirtualSystemSortProxyModel
-{
-public:
-    ImportSortProxyModel (QObject *aParent = NULL)
-      : VirtualSystemSortProxyModel (aParent)
-    {
-        mFilterList << KVirtualSystemDescriptionType_License;
-    }
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxImportApplianceWgt
-
-VBoxImportApplianceWgt::VBoxImportApplianceWgt (QWidget *aParent)
-    : VBoxApplianceEditorWgt (aParent)
-{
-}
-
-bool VBoxImportApplianceWgt::setFile (const QString& aFile)
-{
-    bool fResult = false;
-    if (!aFile.isEmpty())
-    {
-        CVirtualBox vbox = vboxGlobal().virtualBox();
-        /* Create a appliance object */
-        mAppliance = new CAppliance(vbox.CreateAppliance());
-        fResult = mAppliance->isOk();
-        if (fResult)
-        {
-            /* Read the appliance */
-            CProgress progress = mAppliance->Read (aFile);
-            fResult = mAppliance->isOk();
-            if (fResult)
-            {
-                /* Show some progress, so the user know whats going on */
-                vboxProblem().showModalProgressDialog (progress, tr ("Reading Appliance ..."), this);
-                if (!progress.isOk() || progress.GetResultCode() != 0)
-                {
-                    vboxProblem().cannotImportAppliance (progress, mAppliance, this);
-                    return false;
-                }
-                /* Now we have to interpret that stuff */
-                mAppliance->Interpret();
-                fResult = mAppliance->isOk();
-                if (fResult)
-                {
-                    if (mModel)
-                        delete mModel;
-
-                    QVector<CVirtualSystemDescription> vsds = mAppliance->GetVirtualSystemDescriptions();
-
-                    mModel = new VirtualSystemModel (vsds, this);
-
-                    ImportSortProxyModel *proxy = new ImportSortProxyModel (this);
-                    proxy->setSourceModel (mModel);
-                    proxy->sort (DescriptionSection, Qt::DescendingOrder);
-
-                    VirtualSystemDelegate *delegate = new VirtualSystemDelegate (proxy, this);
-
-                    /* Set our own model */
-                    mTvSettings->setModel (proxy);
-                    /* Set our own delegate */
-                    mTvSettings->setItemDelegate (delegate);
-                    /* For now we hide the original column. This data is displayed as tooltip
-                       also. */
-                    mTvSettings->setColumnHidden (OriginalValueSection, true);
-                    mTvSettings->expandAll();
-
-                    /* Check for warnings & if there are one display them. */
-                    bool fWarningsEnabled = false;
-                    QVector<QString> warnings = mAppliance->GetWarnings();
-                    if (warnings.size() > 0)
-                    {
-                        foreach (const QString& text, warnings)
-                            mWarningTextEdit->append ("- " + text);
-                        fWarningsEnabled = true;
-                    }
-                    mWarningWidget->setShown (fWarningsEnabled);
-                }
-            }
-        }
-        if (!fResult)
-        {
-            vboxProblem().cannotImportAppliance (mAppliance, this);
-            /* Delete the appliance in a case of an error */
-            delete mAppliance;
-            mAppliance = NULL;
-        }
-    }
-    return fResult;
-}
-
-void VBoxImportApplianceWgt::prepareImport()
-{
-    if (mAppliance)
-        mModel->putBack();
-}
-
-bool VBoxImportApplianceWgt::import()
-{
-    if (mAppliance)
-    {
-        /* Start the import asynchronously */
-        CProgress progress;
-        progress = mAppliance->ImportMachines();
-        bool fResult = mAppliance->isOk();
-        if (fResult)
-        {
-            /* Show some progress, so the user know whats going on */
-            vboxProblem().showModalProgressDialog (progress, tr ("Importing Appliance ..."), this);
-            if (!progress.isOk() || progress.GetResultCode() != 0)
-            {
-                vboxProblem().cannotImportAppliance (progress, mAppliance, this);
-                return false;
-            }
-            else
-                return true;
-        }
-        if (!fResult)
-            vboxProblem().cannotImportAppliance (mAppliance, this);
-    }
-    return false;
-}
-
-QList < QPair<QString, QString> > VBoxImportApplianceWgt::licenseAgreements() const
-{
-    QList < QPair<QString, QString> > list;
-
-    CVirtualSystemDescriptionVector vsds = mAppliance->GetVirtualSystemDescriptions();
-    for (int i=0; i < vsds.size(); ++i)
-    {
-        QVector<QString> license;
-        license = vsds[i].GetValuesByType (KVirtualSystemDescriptionType_License,
-                                           KVirtualSystemDescriptionValueType_Original);
-        if (!license.isEmpty())
-        {
-            QVector<QString> name;
-            name = vsds[i].GetValuesByType (KVirtualSystemDescriptionType_Name,
-                                            KVirtualSystemDescriptionValueType_Auto);
-            list << QPair<QString, QString> (name.first(), license.first());
-        }
-    }
-
-    return list;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWzd.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWzd.cpp	(revision 25170)
+++ 	(revision )
@@ -1,231 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxImportAppliance class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "VBoxImportApplianceWzd.h"
-#include "VBoxProblemReporter.h"
-#include "QIFileDialog.h"
-#include "QIWidgetValidator.h"
-
-/* Qt includes */
-#include <QDialogButtonBox>
-#include <QFileInfo>
-#include <QPrintDialog>
-#include <QPrinter>
-#include <QTextStream>
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxImportLicenseViewer
-
-VBoxImportLicenseViewer::VBoxImportLicenseViewer (QWidget *aParent /* = NULL */)
-  : QIDialog (aParent)
-{
-    QVBoxLayout *pMainLayout = new QVBoxLayout (this);
-    pMainLayout->setMargin (12);
-
-    mCaption = new QLabel (this);
-    mCaption->setWordWrap (true);
-    pMainLayout->addWidget (mCaption);
-
-    mLicenseText = new QTextEdit (this);
-    mLicenseText->setReadOnly (true);
-    pMainLayout->addWidget (mLicenseText);
-
-    mButtonBox = new QDialogButtonBox (QDialogButtonBox::No | QDialogButtonBox::Yes, Qt::Horizontal, this);
-    mPrintBtn = new QPushButton (this);
-    mButtonBox->addButton (mPrintBtn, QDialogButtonBox::ActionRole);
-    mSaveBtn = new QPushButton (this);
-    mButtonBox->addButton (mSaveBtn, QDialogButtonBox::ActionRole);
-    mButtonBox->button (QDialogButtonBox::Yes)->setDefault (true);
-    connect (mButtonBox, SIGNAL (rejected()),
-             this, SLOT (reject()));
-    connect (mButtonBox, SIGNAL (accepted()),
-             this, SLOT (accept()));
-    connect (mPrintBtn, SIGNAL (clicked()),
-             this, SLOT (print()));
-    connect (mSaveBtn, SIGNAL (clicked()),
-             this, SLOT (save()));
-    pMainLayout->addWidget (mButtonBox);
-
-    retranslateUi();
-}
-
-void VBoxImportLicenseViewer::setContent (const QString &aName, const QString &aText)
-{
-    mName = aName;
-    mText = aText;
-    mCaption->setText (tr ("<b>The virtual system \"%1\" requires that you agree to the terms and conditions of the software license agreement shown below.</b><br /><br />Click <b>Agree</b> to continue or click <b>Disagree</b> to cancel the import.").arg (mName));
-    mLicenseText->setText (mText);
-
-}
-
-void VBoxImportLicenseViewer::retranslateUi()
-{
-    setWindowTitle (tr ("Software License Agreement"));
-    mButtonBox->button (QDialogButtonBox::No)->setText (tr ("&Disagree"));
-    mButtonBox->button (QDialogButtonBox::Yes)->setText (tr ("&Agree"));
-    mPrintBtn->setText (tr ("&Print..."));
-    mSaveBtn->setText (tr ("&Save..."));
-
-    setContent (mName, mText);
-}
-
-void VBoxImportLicenseViewer::print()
-{
-    QPrinter printer;
-    QPrintDialog pd (&printer, this);
-    if (pd.exec() == QDialog::Accepted)
-        mLicenseText->print (&printer);
-}
-
-void VBoxImportLicenseViewer::save()
-{
-    QString fileName = QIFileDialog::getSaveFileName (vboxGlobal().documentsPath(), tr("Text (*.txt)"), this, tr("Save license to file..."));
-    if (!fileName.isEmpty())
-    {
-        QFile file (fileName);
-        if (file.open(QFile::WriteOnly | QFile::Truncate))
-        {
-            QTextStream out (&file);
-            out << mLicenseText->toPlainText();
-        }
-    }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxImportApplianceWzd
-
-VBoxImportApplianceWzd::VBoxImportApplianceWzd (QWidget *aParent /* = NULL */)
-    : QIWithRetranslateUI<QIAbstractWizard> (aParent)
-{
-    /* Apply UI decorations */
-    Ui::VBoxImportApplianceWzd::setupUi (this);
-
-    /* Initialize wizard hdr */
-    initializeWizardHdr();
-
-    /* Configure the file selector */
-    mFileSelector->setMode (VBoxFilePathSelectorWidget::Mode_File_Open);
-    mFileSelector->setFileDialogTitle (tr ("Select an appliance to import"));
-    mFileSelector->setFileFilters (tr ("Open Virtualization Format (%1)").arg ("*.ovf"));
-    mFileSelector->setHomeDir (vboxGlobal().documentsPath());
-
-    /* Validator for the file selector page */
-    mWValFileSelector = new QIWidgetValidator (mFileSelectPage, this);
-    connect (mWValFileSelector, SIGNAL (validityChanged (const QIWidgetValidator *)),
-             this, SLOT (enableNext (const QIWidgetValidator *)));
-    connect (mWValFileSelector, SIGNAL (isValidRequested (QIWidgetValidator *)),
-             this, SLOT (revalidate (QIWidgetValidator *)));
-    connect (mFileSelector, SIGNAL (pathChanged (const QString &)),
-             mWValFileSelector, SLOT (revalidate()));
-
-    /* Connect the restore button with the settings widget */
-    connect (mBtnRestore, SIGNAL (clicked()),
-             mImportSettingsWgt, SLOT (restoreDefaults()));
-
-    mWValFileSelector->revalidate();
-
-    /* Initialize wizard ftr */
-    initializeWizardFtr();
-
-    retranslateUi();
-}
-
-void VBoxImportApplianceWzd::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxImportApplianceWzd::retranslateUi (this);
-}
-
-void VBoxImportApplianceWzd::revalidate (QIWidgetValidator *aWval)
-{
-    /* Do individual validations for pages */
-    bool valid = aWval->isOtherValid();
-
-    if (aWval == mWValFileSelector)
-        valid = mFileSelector->path().toLower().endsWith (".ovf") &&
-                QFileInfo (mFileSelector->path()).exists();
-
-    aWval->setOtherValid (valid);
-}
-
-void VBoxImportApplianceWzd::enableNext (const QIWidgetValidator *aWval)
-{
-    nextButton (aWval->widget())->setEnabled (aWval->isValid());
-}
-
-void VBoxImportApplianceWzd::accept()
-{
-    /* Make sure the final values are puted back. */
-    mImportSettingsWgt->prepareImport();
-    /* Check if there are license agreements the user must confirm */
-    QList < QPair <QString, QString> > licAgreements = mImportSettingsWgt->licenseAgreements();
-    if (!licAgreements.isEmpty())
-    {
-        VBoxImportLicenseViewer ilv (this);
-        for (int i=0; i < licAgreements.size(); ++i)
-        {
-            const QPair <QString, QString> &lic = licAgreements.at (i);
-            ilv.setContent (lic.first, lic.second);
-            if (ilv.exec() == QDialog::Rejected)
-                return;
-        }
-    }
-    /* Now import all virtual systems */
-    if (mImportSettingsWgt->import())
-        QIAbstractWizard::accept();
-}
-
-void VBoxImportApplianceWzd::showNextPage()
-{
-    if (sender() == mBtnNext1)
-    {
-        if (mFileSelector->isModified())
-        {
-            /* Set the file path only if something has changed */
-            mImportSettingsWgt->setFile (mFileSelector->path());
-            /* Reset the modified bit afterwards */
-            mFileSelector->resetModified();
-        }
-
-        /* If we have a valid ovf proceed to the appliance settings page */
-        if (mImportSettingsWgt->isValid())
-            QIAbstractWizard::showNextPage();
-    }
-    else
-        QIAbstractWizard::showNextPage();
-}
-
-void VBoxImportApplianceWzd::onPageShow()
-{
-    /* Make sure all is properly translated & composed */
-    retranslateUi();
-
-    QWidget *page = mPageStack->currentWidget();
-
-    if (page == mSettingsPage)
-        finishButton()->setDefault (true);
-    else
-        nextButton (page)->setDefault (true);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxLineTextEdit.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxLineTextEdit.cpp	(revision 25170)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxLineTextEdit class definitions
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "VBoxLineTextEdit.h"
-#include "QIFileDialog.h"
-
-/* Qt includes */
-#include <QDialogButtonBox>
-#include <QFile>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QTextEdit>
-#include <QTextStream>
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxTextEditor
-
-VBoxTextEditor::VBoxTextEditor (QWidget *aParent /* = NULL */)
-  : QIWithRetranslateUI<QIDialog> (aParent)
-{
-    QVBoxLayout *mainLayout = new QVBoxLayout (this);
-    mainLayout->setMargin (12);
-
-    /* We need a text editor */
-    mTextEdit = new QTextEdit (this);
-    mainLayout->addWidget (mTextEdit);
-    /* and some buttons to interact with */
-    mButtonBox = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-    mOpenBtn = new QPushButton (this);
-    mButtonBox->addButton (mOpenBtn, QDialogButtonBox::ActionRole);
-    mainLayout->addWidget (mButtonBox);
-    /* Connect the buttons so that they are useful */
-    connect (mButtonBox, SIGNAL (accepted()),
-             this, SLOT (accept()));
-    connect (mButtonBox, SIGNAL (rejected()),
-             this, SLOT (reject()));
-    connect (mOpenBtn, SIGNAL (clicked()),
-             this, SLOT (open()));
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxTextEditor::setText (const QString& aText)
-{
-    mTextEdit->setText (aText);
-}
-
-QString VBoxTextEditor::text() const
-{
-    return mTextEdit->toPlainText();
-}
-
-void VBoxTextEditor::retranslateUi()
-{
-    setWindowTitle (tr ("Edit text"));
-    mOpenBtn->setText (tr ("&Replace..."));
-    mOpenBtn->setToolTip (tr ("Replaces the current text with the content of a file."));
-}
-
-void VBoxTextEditor::open()
-{
-    QString fileName = QIFileDialog::getOpenFileName (vboxGlobal().documentsPath(), tr("Text (*.txt);;All (*.*)"), this, tr("Select a file to open..."));
-    if (!fileName.isEmpty())
-    {
-        QFile file (fileName);
-        if (file.open(QFile::ReadOnly))
-        {
-            QTextStream in (&file);
-            mTextEdit->setPlainText (in.readAll());
-        }
-    }
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxLineTextEdit
-
-VBoxLineTextEdit::VBoxLineTextEdit (QWidget *aParent /* = NULL */)
-  : QIWithRetranslateUI<QPushButton> (aParent)
-{
-    connect (this, SIGNAL (clicked()),
-             this, SLOT (edit()));
-
-    setFocusPolicy (Qt::StrongFocus);
-    retranslateUi();
-}
-
-void VBoxLineTextEdit::retranslateUi()
-{
-    QPushButton::setText (tr ("&Edit"));
-}
-
-void VBoxLineTextEdit::edit()
-{
-    VBoxTextEditor te (this);
-    te.setText (mText);
-    if (te.exec() == QDialog::Accepted)
-        mText = te.text();
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp	(revision 25170)
+++ 	(revision )
@@ -1,336 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxMediaComboBox class implementation
- */
-
-/*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxMediaComboBox.h"
-
-#include <QFileInfo>
-#include <QDir>
-#include <QAbstractItemView>
-
-VBoxMediaComboBox::VBoxMediaComboBox (QWidget *aParent)
-    : QComboBox (aParent)
-    , mType (VBoxDefs::MediumType_Invalid)
-    , mLastId (QString::null)
-    , mShowDiffs (false)
-    , mShowNullItem (false)
-    , mMachineId (QString::null)
-{
-    /* Setup the elide mode */
-    view()->setTextElideMode (Qt::ElideRight);
-    QSizePolicy sp1 (QSizePolicy::Ignored, QSizePolicy::Fixed, QSizePolicy::ComboBox);
-    sp1.setHorizontalStretch (2);
-    setSizePolicy (sp1);
-
-    /* Setup enumeration handlers */
-    connect (&vboxGlobal(), SIGNAL (mediumEnumStarted()),
-             this, SLOT (mediumEnumStarted()));
-    connect (&vboxGlobal(), SIGNAL (mediumEnumerated (const VBoxMedium &)),
-             this, SLOT (mediumEnumerated (const VBoxMedium &)));
-
-    /* Setup update handlers */
-    connect (&vboxGlobal(), SIGNAL (mediumAdded (const VBoxMedium &)),
-             this, SLOT (mediumAdded (const VBoxMedium &)));
-    connect (&vboxGlobal(), SIGNAL (mediumUpdated (const VBoxMedium &)),
-             this, SLOT (mediumUpdated (const VBoxMedium &)));
-    connect (&vboxGlobal(), SIGNAL (mediumRemoved (VBoxDefs::MediumType, const QString &)),
-             this, SLOT (mediumRemoved (VBoxDefs::MediumType, const QString &)));
-
-    /* Setup other connections */
-    connect (this, SIGNAL (activated (int)),
-             this, SLOT (processActivated (int)));
-    connect (view(), SIGNAL (entered (const QModelIndex&)),
-             this, SLOT (processOnItem (const QModelIndex&)));
-}
-
-/**
- * Fills this combobox with the current media list.
- */
-void VBoxMediaComboBox::refresh()
-{
-    /* Clearing lists */
-    clear(), mMedia.clear();
-
-    VBoxMediaList list (vboxGlobal().currentMediaList());
-    foreach (VBoxMedium medium, list)
-        mediumAdded (medium);
-
-    /* If at least one real medium present, process null medium */
-    if (count() > 1 && (!mShowNullItem || mType == VBoxDefs::MediumType_HardDisk))
-    {
-        removeItem (0);
-        mMedia.erase (mMedia.begin());
-    }
-
-    /* Inform the interested parties about the possibly changed active item's
-     * icon, text, tooltip etc. */
-    emit activated (currentIndex());
-}
-
-/**
- * Requests the global media list enumeration and repopulates the list with its
- * results.
- */
-void VBoxMediaComboBox::repopulate()
-{
-    if (!vboxGlobal().isMediaEnumerationStarted())
-        vboxGlobal().startEnumeratingMedia();
-    else
-        refresh();
-}
-
-QString VBoxMediaComboBox::id (int aIndex /*= -1*/) const
-{
-    AssertReturn (aIndex == -1 ||
-                  (aIndex >= 0 && aIndex < mMedia.size()),
-                  QString::null);
-
-    if (aIndex == -1) aIndex = currentIndex();
-    return aIndex == -1 ? QString::null : mMedia [aIndex].id;
-}
-
-QString VBoxMediaComboBox::location (int aIndex /*= -1*/) const
-{
-    AssertReturn (aIndex == -1 ||
-                  (aIndex >= 0 && aIndex < mMedia.size()),
-                  QString::null);
-
-    if (aIndex == -1) aIndex = currentIndex();
-    return aIndex == -1 ? QString::null : mMedia [aIndex].location;
-}
-
-void VBoxMediaComboBox::setCurrentItem (const QString &aId)
-{
-    mLastId = aId;
-
-    int index;
-    if (findMediaIndex (aId, index))
-    {
-        /* Note that the media combobox may be not populated here yet, so we
-         * don't assert */
-        QComboBox::setCurrentIndex (index);
-        emit activated (index);
-    }
-}
-
-void VBoxMediaComboBox::setType (VBoxDefs::MediumType aType)
-{
-    mType = aType;
-}
-
-void VBoxMediaComboBox::setMachineId (const QString &aMachineId)
-{
-    mMachineId = aMachineId;
-}
-
-void VBoxMediaComboBox::setNullItemPresent (bool aNullItemPresent)
-{
-    mShowNullItem = aNullItemPresent;
-}
-
-/**
- * Enables or disables the "show diffs" mode.
- *
- * In disabled "show diffs" mode, this combobox will only include base hard
- * disks plus differencing hard disks that are attached to the associated
- * machine passed to the constructor in the current state (if any). Note
- * that for these differencing hard disks, the details of their base hard disks
- * are shown instead of their own details (human-friendly mode).
- *
- * In enabled "show diffs" mode, all hard disks, base and differencing, are
- * shown.
- *
- * Note that you must call #refresh() in order for this change to take effect.
- *
- * @param aShowDiffs    @c true to enable "show diffs" mode.
- */
-void VBoxMediaComboBox::setShowDiffs (bool aShowDiffs)
-{
-    AssertReturnVoid (aShowDiffs == true || !mMachineId.isNull());
-
-    mShowDiffs = aShowDiffs;
-}
-
-
-void VBoxMediaComboBox::mediumEnumStarted()
-{
-    refresh();
-}
-
-void VBoxMediaComboBox::mediumEnumerated (const VBoxMedium &aMedium)
-{
-    mediumUpdated (aMedium);
-}
-
-void VBoxMediaComboBox::mediumAdded (const VBoxMedium &aMedium)
-{
-    if (aMedium.isNull() || aMedium.type() == mType)
-    {
-        if (!mShowDiffs && aMedium.type() == VBoxDefs::MediumType_HardDisk)
-        {
-            if (aMedium.parent() != NULL)
-            {
-                /* In !mShowDiffs mode, we ignore all diffs except ones that are
-                 * directly attached to the related VM in the current state */
-                if (!aMedium.isAttachedInCurStateTo (mMachineId))
-                    return;
-            }
-        }
-
-        appendItem (aMedium);
-
-        /* Activate the required item if there is any */
-        if (aMedium.id() == mLastId)
-            setCurrentItem (aMedium.id());
-        /* Select last added item if there is no item selected */
-        else if (currentText().isEmpty())
-            QComboBox::setCurrentIndex (count() - 1);
-    }
-}
-
-void VBoxMediaComboBox::mediumUpdated (const VBoxMedium &aMedium)
-{
-    if (aMedium.isNull() || aMedium.type() == mType)
-    {
-        int index;
-        if (!findMediaIndex (aMedium.id(), index))
-            return;
-
-        replaceItem (index, aMedium);
-
-        /* Emit the signal to ensure the parent dialog handles the change of
-         * the selected item's data */
-        emit activated (currentIndex());
-    }
-}
-
-void VBoxMediaComboBox::mediumRemoved (VBoxDefs::MediumType aType,
-                                       const QString &aId)
-{
-    if (mType != aType)
-        return;
-
-    int index;
-    if (!findMediaIndex (aId, index))
-        return;
-
-    removeItem (index);
-    mMedia.erase (mMedia.begin() + index);
-
-    /* If no real medium left, add the null medium */
-    if (count() == 0)
-        mediumAdded (VBoxMedium());
-
-    /* Emit the signal to ensure the parent dialog handles the change of
-     * the selected item */
-    emit activated (currentIndex());
-}
-
-
-void VBoxMediaComboBox::processActivated (int aIndex)
-{
-    AssertReturnVoid (aIndex >= 0 && aIndex < mMedia.size());
-
-    mLastId = mMedia [aIndex].id;
-
-    updateToolTip (aIndex);
-}
-
-void VBoxMediaComboBox::updateToolTip (int aIndex)
-{
-    /* Set the combobox tooltip */
-    setToolTip (QString::null);
-    if (aIndex >= 0 && aIndex < mMedia.size())
-        setToolTip (mMedia [aIndex].toolTip);
-}
-
-void VBoxMediaComboBox::processOnItem (const QModelIndex &aIndex)
-{
-    /* Set the combobox item's tooltip */
-    int index = aIndex.row();
-    view()->viewport()->setToolTip (QString::null);
-    view()->viewport()->setToolTip (mMedia [index].toolTip);
-}
-
-
-void VBoxMediaComboBox::appendItem (const VBoxMedium &aMedium)
-{
-    if (!mShowDiffs && aMedium.parent() != NULL)
-    {
-        /* We are adding the direct machine diff in !mShowDiffs mode. Since its
-         * base hard disk has been already appended (enumerated before), we want
-         * to replace the base with the diff to avoid shownig both (both would
-         * be labeled using the base filename and therefore look like
-         * duplicates). Note though that these visual duplicates are still
-         * possible in !mShowDiffs mode if the same base hard disk is attached*
-         * to the VM through different diffs (this is why we don't assert
-         * below on findMediaIndex() == true). However, this situation is
-         * unavoidable so we accept it assuming that the user will switch to
-           mShowDiffs mode if he needs clarity. */
-        int index;
-        if (findMediaIndex (aMedium.root().id(), index))
-        {
-            replaceItem (index, aMedium);
-            return;
-        }
-    }
-
-    mMedia.append (Medium (aMedium.id(), aMedium.location(),
-                           aMedium.toolTipCheckRO (!mShowDiffs, mShowNullItem && mType != VBoxDefs::MediumType_HardDisk)));
-
-    insertItem (count(), aMedium.iconCheckRO (!mShowDiffs),
-                aMedium.details (!mShowDiffs));
-}
-
-void VBoxMediaComboBox::replaceItem (int aIndex, const VBoxMedium &aMedium)
-{
-    AssertReturnVoid (aIndex >= 0 && aIndex < mMedia.size());
-
-    mMedia [aIndex].id = aMedium.id();
-    mMedia [aIndex].location = aMedium.location();
-    mMedia [aIndex].toolTip = aMedium.toolTipCheckRO (!mShowDiffs, mShowNullItem && mType != VBoxDefs::MediumType_HardDisk);
-
-    setItemText (aIndex, aMedium.details (!mShowDiffs));
-    setItemIcon (aIndex, aMedium.iconCheckRO (!mShowDiffs));
-
-    if (aIndex == currentIndex())
-        updateToolTip (aIndex);
-}
-
-/**
- * Searches for a medium with the given ID in mMedia and stores its index in @a
- * aIndex. Returns @c true if the media was found and @c false otherwise (@a
- * aIndex will be set to a value >= mMedia.size() in this case).
- *
- * @param aId       Media ID to search for.
- * @param aIndex    Where to store the found media index.
- */
-bool VBoxMediaComboBox::findMediaIndex (const QString &aId, int &aIndex)
-{
-    aIndex = 0;
-
-    for (; aIndex < mMedia.size(); ++ aIndex)
-        if (mMedia [aIndex].id == aId)
-            break;
-
-    return aIndex < mMedia.size();
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.h	(revision 25171)
@@ -0,0 +1,178 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxMediaManagerDlg class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxMediaManagerDlg_h__
+#define __VBoxMediaManagerDlg_h__
+
+/* Local includes */
+#include "VBoxMediaManagerDlg.gen.h"
+#include "COMDefs.h"
+#include "QIMainDialog.h"
+#include "QIWithRetranslateUI.h"
+#include "VBoxDefs.h"
+#include "VBoxMediaComboBox.h"
+
+/* Local forwards */
+class MediaItem;
+class VBoxProgressBar;
+class VBoxToolBar;
+
+class VBoxMediaManagerDlg : public QIWithRetranslateUI2<QIMainDialog>,
+                            public Ui::VBoxMediaManagerDlg
+{
+    Q_OBJECT;
+
+    enum TabIndex { HDTab = 0, CDTab, FDTab };
+    enum ItemAction { ItemAction_Added, ItemAction_Updated, ItemAction_Removed };
+    enum Action { Action_Select, Action_Edit, Action_Remove, Action_Release };
+
+public:
+
+    VBoxMediaManagerDlg (QWidget *aParent = NULL,
+                         Qt::WindowFlags aFlags = Qt::Dialog);
+    ~VBoxMediaManagerDlg();
+
+    void setup (VBoxDefs::MediumType aType, bool aDoSelect,
+                bool aRefresh = true,
+                const CMachine &aSessionMachine = CMachine(),
+                const QString &aSelectId = QString::null,
+                bool aShowDiffs = true,
+                const QStringList &aUsedMediaIds = QStringList());
+
+    static void showModeless (QWidget *aParent = NULL, bool aRefresh = true);
+
+    QString selectedId() const;
+    QString selectedLocation() const;
+
+    bool showDiffs() const { return mShowDiffs; };
+    bool inAttachMode() const { return !mSessionMachine.isNull(); };
+
+public slots:
+
+    void refreshAll();
+
+protected:
+
+    void retranslateUi();
+    virtual void closeEvent (QCloseEvent *aEvent);
+    virtual bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+private slots:
+
+    void mediumAdded (const VBoxMedium &aMedium);
+    void mediumUpdated (const VBoxMedium &aMedium);
+    void mediumRemoved (VBoxDefs::MediumType aType, const QString &aId);
+
+    void mediumEnumStarted();
+    void mediumEnumerated (const VBoxMedium &aMedium);
+    void mediumEnumFinished (const VBoxMediaList &aList);
+
+    void doNewMedium();
+    void doAddMedium();
+    void doRemoveMedium();
+    void doReleaseMedium();
+
+    bool releaseMediumFrom (const VBoxMedium &aMedium, const QString &aMachineId);
+
+    void processCurrentChanged (int index = -1);
+    void processCurrentChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrevItem = 0);
+    void processDoubleClick (QTreeWidgetItem *aItem, int aColumn);
+    void showContextMenu (const QPoint &aPos);
+
+    void machineStateChanged (const VBoxMachineStateChangeEvent &aEvent);
+
+    void makeRequestForAdjustTable();
+    void performTablesAdjustment();
+
+private:
+
+    QTreeWidget* treeWidget (VBoxDefs::MediumType aType) const;
+    VBoxDefs::MediumType currentTreeWidgetType() const;
+    QTreeWidget* currentTreeWidget() const;
+
+    QTreeWidgetItem* selectedItem (const QTreeWidget *aTree) const;
+    MediaItem* toMediaItem (QTreeWidgetItem *aItem) const;
+
+    void setCurrentItem (QTreeWidget *aTree, QTreeWidgetItem *aItem);
+
+    void addMediumToList (const QString &aLocation, VBoxDefs::MediumType aType);
+
+    MediaItem* createHardDiskItem (QTreeWidget *aTree, const VBoxMedium &aMedium) const;
+
+    void updateTabIcons (MediaItem *aItem, ItemAction aAction);
+
+    MediaItem* searchItem (QTreeWidget *aTree, const QString &aId) const;
+
+    bool checkMediumFor (MediaItem *aItem, Action aAction);
+
+    bool checkDndUrls (const QList<QUrl> &aUrls) const;
+    void addDndUrls (const QList<QUrl> &aUrls);
+
+    void clearInfoPanes();
+    void prepareToRefresh (int aTotal = 0);
+
+    QString formatPaneText (const QString &aText, bool aCompact = true, const QString &aElipsis = "middle");
+
+    /* Private member vars */
+    /* Window status */
+    bool mDoSelect;
+    static VBoxMediaManagerDlg *mModelessDialog;
+    VBoxProgressBar *mProgressBar;
+
+    /* The global VirtualBox instance */
+    CVirtualBox mVBox;
+
+    /* Type if we are in the select modus */
+    int mType;
+
+    bool mShowDiffs : 1;
+    bool mSetupMode : 1;
+
+    /* Icon definitions */
+    QIcon mHardDiskIcon;
+    QIcon mDVDImageIcon;
+    QIcon mFloppyImageIcon;
+
+    /* Menu & Toolbar */
+    QMenu       *mActionsContextMenu;
+    QMenu       *mActionsMenu;
+    VBoxToolBar *mToolBar;
+    QAction     *mNewAction;
+    QAction     *mAddAction;
+    QAction     *mRemoveAction;
+    QAction     *mReleaseAction;
+    QAction     *mRefreshAction;
+
+    /* Machine */
+    CMachine mSessionMachine;
+    QString  mSessionMachineId;
+    bool mHardDisksInaccessible;
+    bool mDVDImagesInaccessible;
+    bool mFloppyImagesInaccessible;
+    QString mHDSelectedId;
+    QString mCDSelectedId;
+    QString mFDSelectedId;
+    QStringList mUsedMediaIds;
+};
+
+#endif /* __VBoxMediaManagerDlg_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.ui	(revision 25171)
@@ -0,0 +1,369 @@
+<ui version="4.0" >
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2006-2009 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxMediaManagerDlg</class>
+ <widget class="QMainWindow" name="VBoxMediaManagerDlg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>620</width>
+    <height>460</height>
+   </rect>
+  </property>
+  <property name="minimumSize" >
+   <size>
+    <width>280</width>
+    <height>190</height>
+   </size>
+  </property>
+  <property name="windowTitle" >
+   <string>Virtual Media Manager</string>
+  </property>
+  <widget class="QWidget" name="mCentralWidget" >
+   <layout class="QVBoxLayout" >
+    <item>
+     <widget class="QTabWidget" name="mTabWidget" >
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <widget class="QWidget" name="mTabHD" >
+       <attribute name="title" >
+        <string>Hard &amp;Disks</string>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <item>
+         <widget class="QITreeWidget" name="mTwHD" >
+          <property name="contextMenuPolicy" >
+           <enum>Qt::CustomContextMenu</enum>
+          </property>
+          <property name="acceptDrops" >
+           <bool>true</bool>
+          </property>
+          <property name="horizontalScrollBarPolicy" >
+           <enum>Qt::ScrollBarAlwaysOff</enum>
+          </property>
+          <property name="alternatingRowColors" >
+           <bool>true</bool>
+          </property>
+          <property name="allColumnsShowFocus" >
+           <bool>true</bool>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Virtual Size</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Actual Size</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+        <item>
+         <widget class="QFrame" name="mHDContainer" >
+          <property name="frameShape" >
+           <enum>QFrame::Box</enum>
+          </property>
+          <property name="frameShadow" >
+           <enum>QFrame::Sunken</enum>
+          </property>
+          <layout class="QGridLayout" >
+           <property name="verticalSpacing" >
+            <number>0</number>
+           </property>
+           <property name="margin" >
+            <number>5</number>
+           </property>
+           <item row="0" column="0" >
+            <widget class="QLabel" name="mLbHD1" >
+             <property name="text" >
+              <string>Location</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1" >
+            <widget class="QILabel" name="mIpHD1" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0" >
+            <widget class="QLabel" name="mLbHD2" >
+             <property name="text" >
+              <string>Type (Format)</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1" >
+            <widget class="QILabel" name="mIpHD2" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="0" >
+            <widget class="QLabel" name="mLbHD3" >
+             <property name="text" >
+              <string>Attached to</string>
+             </property>
+            </widget>
+           </item>
+           <item row="2" column="1" >
+            <widget class="QILabel" name="mIpHD3" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="mTabCD" >
+       <attribute name="title" >
+        <string>&amp;CD/DVD Images</string>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <item>
+         <widget class="QITreeWidget" name="mTwCD" >
+          <property name="contextMenuPolicy" >
+           <enum>Qt::CustomContextMenu</enum>
+          </property>
+          <property name="acceptDrops" >
+           <bool>true</bool>
+          </property>
+          <property name="horizontalScrollBarPolicy" >
+           <enum>Qt::ScrollBarAlwaysOff</enum>
+          </property>
+          <property name="alternatingRowColors" >
+           <bool>true</bool>
+          </property>
+          <property name="allColumnsShowFocus" >
+           <bool>true</bool>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Size</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+        <item>
+         <widget class="QFrame" name="mCDContainer" >
+          <property name="frameShape" >
+           <enum>QFrame::Box</enum>
+          </property>
+          <property name="frameShadow" >
+           <enum>QFrame::Sunken</enum>
+          </property>
+          <layout class="QGridLayout" >
+           <property name="verticalSpacing" >
+            <number>0</number>
+           </property>
+           <property name="margin" >
+            <number>5</number>
+           </property>
+           <item row="0" column="0" >
+            <widget class="QLabel" name="mLbCD1" >
+             <property name="text" >
+              <string>Location</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1" >
+            <widget class="QILabel" name="mIpCD1" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0" >
+            <widget class="QLabel" name="mLbCD2" >
+             <property name="text" >
+              <string>Attached to</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1" >
+            <widget class="QILabel" name="mIpCD2" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="mTabFD" >
+       <attribute name="title" >
+        <string>&amp;Floppy Images</string>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <item>
+         <widget class="QITreeWidget" name="mTwFD" >
+          <property name="contextMenuPolicy" >
+           <enum>Qt::CustomContextMenu</enum>
+          </property>
+          <property name="acceptDrops" >
+           <bool>true</bool>
+          </property>
+          <property name="horizontalScrollBarPolicy" >
+           <enum>Qt::ScrollBarAlwaysOff</enum>
+          </property>
+          <property name="alternatingRowColors" >
+           <bool>true</bool>
+          </property>
+          <property name="allColumnsShowFocus" >
+           <bool>true</bool>
+          </property>
+          <column>
+           <property name="text" >
+            <string>Name</string>
+           </property>
+          </column>
+          <column>
+           <property name="text" >
+            <string>Size</string>
+           </property>
+          </column>
+         </widget>
+        </item>
+        <item>
+         <widget class="QFrame" name="mFDContainer" >
+          <property name="frameShape" >
+           <enum>QFrame::Box</enum>
+          </property>
+          <property name="frameShadow" >
+           <enum>QFrame::Sunken</enum>
+          </property>
+          <layout class="QGridLayout" >
+           <property name="horizontalSpacing" >
+            <number>6</number>
+           </property>
+           <property name="verticalSpacing" >
+            <number>0</number>
+           </property>
+           <property name="margin" >
+            <number>5</number>
+           </property>
+           <item row="0" column="0" >
+            <widget class="QLabel" name="mLbFD1" >
+             <property name="text" >
+              <string>Location</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1" >
+            <widget class="QILabel" name="mIpFD1" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0" >
+            <widget class="QLabel" name="mLbFD2" >
+             <property name="text" >
+              <string>Attached to</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1" >
+            <widget class="QILabel" name="mIpFD2" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+    <item>
+     <widget class="QIDialogButtonBox" name="mButtonBox" >
+      <property name="standardButtons" >
+       <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QStatusBar" name="mStatusBar" />
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QIDialogButtonBox</class>
+   <extends>QDialogButtonBox</extends>
+   <header>QIDialogButtonBox.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QITreeWidget</class>
+   <extends>QTreeWidget</extends>
+   <header>QITreeWidget.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QILabel</class>
+   <extends>QLabel</extends>
+   <header>QILabel.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxMedium.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxMedium.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxMedium.h	(revision 25171)
@@ -0,0 +1,277 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxMedium class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxMedium_h__
+#define __VBoxMedium_h__
+
+/* Global includes */
+#include <QPixmap>
+#include <QLinkedList>
+
+/* Local includes */
+#include "COMDefs.h"
+
+/**
+ * Cache used to override some attributes in the user-friendly "don't show diffs" mode.
+ */
+struct NoDiffsCache
+{
+    NoDiffsCache() : isSet (false), state (KMediumState_NotCreated) {}
+    NoDiffsCache& operator= (const NoDiffsCache &aOther)
+    {
+        isSet = aOther.isSet;
+        state = aOther.state;
+        result = aOther.result;
+        toolTip = aOther.toolTip;
+        return *this;
+    }
+
+    bool isSet : 1;
+
+    KMediumState state;
+    COMResult result;
+    QString toolTip;
+};
+
+/**
+ * Media descriptor for the GUI.
+ *
+ * Maintains the results of the last state (accessibility) check and precomposes
+ * string parameters such as location, size which can be used in various GUI
+ * controls.
+ *
+ * Many getter methods take the boolean @a aNoDiffs argument. Unless explicitly
+ * stated otherwise, this argument, when set to @c true, will cause the
+ * corresponding property of this object's root medium to be returned instead of
+ * its own one. This is useful when hard disk media is represented in the
+ * user-friendly "don't show diffs" mode. For non-hard disk media, the value of
+ * this argument is irrelevant because the root object for such medium is
+ * the medium itself.
+ *
+ * Note that this class "abuses" the KMediumState_NotCreated state value to
+ * indicate that the accessibility check of the given medium (see
+ * #blockAndQueryState()) has not been done yet and therefore some parameters
+ * such as #size() are meaningless because they can be read only from the
+ * accessible medium. The real KMediumState_NotCreated state is not necessary
+ * because this class is only used with created (existing) media.
+ */
+class VBoxMedium
+{
+public:
+
+    /**
+     * Creates a null medium descriptor which is not associated with any medium.
+     * The state field is set to KMediumState_NotCreated.
+     */
+    VBoxMedium()
+        : mType (VBoxDefs::MediumType_Invalid)
+        , mState (KMediumState_NotCreated)
+        , mIsReadOnly (false)
+        , mIsUsedInSnapshots (false)
+        , mParent (0) { refresh(); }
+
+    /**
+     * Creates a media descriptor associated with the given medium.
+     *
+     * The state field remain KMediumState_NotCreated until #blockAndQueryState()
+     * is called. All precomposed strings are filled up by implicitly calling
+     * #refresh(), see the #refresh() details for more info.
+     *
+     * One of the hardDisk, dvdImage, or floppyImage members is assigned from
+     * aMedium according to aType. @a aParent must be always NULL for non-hard
+     * disk media.
+     */
+    VBoxMedium (const CMedium &aMedium, VBoxDefs::MediumType aType, VBoxMedium *aParent = 0)
+        : mMedium (aMedium)
+        , mType (aType)
+        , mState (KMediumState_NotCreated)
+        , mIsReadOnly (false)
+        , mIsUsedInSnapshots (false)
+        , mParent (aParent) { refresh(); }
+
+    /**
+     * Similar to the other non-null constructor but sets the media state to
+     * @a aState. Suitable when the media state is known such as right after
+     * creation.
+     */
+    VBoxMedium (const CMedium &aMedium, VBoxDefs::MediumType aType, KMediumState aState)
+        : mMedium (aMedium)
+        , mType (aType)
+        , mState (aState)
+        , mIsReadOnly (false)
+        , mIsUsedInSnapshots (false)
+        , mParent (0) { refresh(); }
+
+    VBoxMedium& operator= (const VBoxMedium &aOther);
+
+    void blockAndQueryState();
+    void refresh();
+
+    const CMedium &medium() const { return mMedium; }
+
+    VBoxDefs::MediumType type() const { return mType; }
+
+    /**
+     * Media state. In "don't show diffs" mode, this is the worst state (in
+     * terms of inaccessibility) detected on the given hard disk chain.
+     *
+     * @param aNoDiffs  @c true to enable user-friendly "don't show diffs" mode.
+     */
+    KMediumState state (bool aNoDiffs = false) const
+    {
+        unconst (this)->checkNoDiffs (aNoDiffs);
+        return aNoDiffs ? mNoDiffs.state : mState;
+    }
+
+    QString lastAccessError() const { return mLastAccessError; }
+
+    /**
+     * Result of the last blockAndQueryState() call. Will indicate an error and
+     * contain a proper error info if the last state check fails. In "don't show
+     * diffs" mode, this is the worst result (in terms of inaccessibility)
+     * detected on the given hard disk chain.
+     *
+     * @param aNoDiffs  @c true to enable user-friendly "don't show diffs" mode.
+     */
+    const COMResult &result (bool aNoDiffs = false) const
+    {
+        unconst (this)->checkNoDiffs (aNoDiffs);
+        return aNoDiffs ? mNoDiffs.result : mResult;
+    }
+
+    QString id() const { return mId; }
+    QString name (bool aNoDiffs = false) const { return aNoDiffs ? root().mName : mName; }
+    QString location (bool aNoDiffs = false) const { return aNoDiffs ? root().mLocation : mLocation; }
+
+    QString size (bool aNoDiffs = false) const { return aNoDiffs ? root().mSize : mSize; }
+    QString logicalSize (bool aNoDiffs = false) const { return aNoDiffs ? root().mLogicalSize : mLogicalSize; }
+
+    QString hardDiskFormat (bool aNoDiffs = false) const { return aNoDiffs ? root().mHardDiskFormat : mHardDiskFormat; }
+    QString hardDiskType (bool aNoDiffs = false) const { return aNoDiffs ? root().mHardDiskType : mHardDiskType; }
+
+    QString usage (bool aNoDiffs = false) const { return aNoDiffs ? root().mUsage : mUsage; }
+    QString tip() const { return mToolTip; }
+
+    const NoDiffsCache& cache() const { return mNoDiffs; }
+
+    /**
+     * Returns @c true if this medium is read-only (either because it is
+     * Immutable or because it has child hard disks). Read-only media can only
+     * be attached indirectly.
+     */
+    bool isReadOnly() const { return mIsReadOnly; }
+
+    /**
+     * Returns @c true if this medium is attached to any VM (in the current
+     * state or in a snapshot) in which case #usage() will contain a string with
+     * comma-sparated VM names (with snapshot names, if any, in parenthesis).
+     */
+    bool isUsed() const { return !mUsage.isNull(); }
+
+    /**
+     * Returns @c true if this medium is attached to any VM in any snapshot.
+     */
+    bool isUsedInSnapshots() const { return mIsUsedInSnapshots; }
+
+    /**
+     * Returns @c true if this medium corresponds to real host drive.
+     */
+    bool isHostDrive() const { return mIsHostDrive; }
+
+    /**
+     * Returns @c true if this medium is attached to the given machine in the current state.
+     */
+    bool isAttachedInCurStateTo (const QString &aMachineId) const { return mCurStateMachineIds.indexOf (aMachineId) >= 0; }
+
+    /**
+     * Returns a vector of IDs of all machines this medium is attached
+     * to in their current state (i.e. excluding snapshots).
+     */
+    const QList <QString> &curStateMachineIds() const { return mCurStateMachineIds; }
+
+    /**
+     * Returns a parent medium. For non-hard disk media, this is always NULL.
+     */
+    VBoxMedium* parent() const { return mParent; }
+
+    VBoxMedium& root() const;
+
+    QString toolTip (bool aNoDiffs = false, bool aCheckRO = false, bool aNullAllowed = false) const;
+    QPixmap icon (bool aNoDiffs = false, bool aCheckRO = false) const;
+
+    /** Shortcut to <tt>#toolTip (aNoDiffs, true)</tt>. */
+    QString toolTipCheckRO (bool aNoDiffs = false, bool aNullAllowed = false) const { return toolTip (aNoDiffs, true, aNullAllowed); }
+
+    /** Shortcut to <tt>#icon (aNoDiffs, true)</tt>. */
+    QPixmap iconCheckRO (bool aNoDiffs = false) const { return icon (aNoDiffs, true); }
+
+    QString details (bool aNoDiffs = false, bool aPredictDiff = false, bool aUseHTML = false) const;
+
+    /** Shortcut to <tt>#details (aNoDiffs, aPredictDiff, true)</tt>. */
+    QString detailsHTML (bool aNoDiffs = false, bool aPredictDiff = false) const { return details (aNoDiffs, aPredictDiff, true); }
+
+    /** Returns @c true if this media descriptor is a null object. */
+    bool isNull() const { return mMedium.isNull(); }
+
+private:
+
+    void checkNoDiffs (bool aNoDiffs);
+
+    CMedium mMedium;
+
+    VBoxDefs::MediumType mType;
+
+    KMediumState mState;
+    QString mLastAccessError;
+    COMResult mResult;
+
+    QString mId;
+    QString mName;
+    QString mLocation;
+
+    QString mSize;
+    QString mLogicalSize;
+
+    QString mHardDiskFormat;
+    QString mHardDiskType;
+
+    QString mUsage;
+    QString mToolTip;
+
+    bool mIsReadOnly        : 1;
+    bool mIsUsedInSnapshots : 1;
+    bool mIsHostDrive       : 1;
+
+    QList <QString> mCurStateMachineIds;
+
+    VBoxMedium *mParent;
+
+    NoDiffsCache mNoDiffs;
+
+    static QString mTable;
+    static QString mRow;
+};
+
+typedef QLinkedList <VBoxMedium> VBoxMediaList;
+
+#endif /* __VBoxMedium_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxMiniToolBar.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxMiniToolBar.cpp	(revision 25170)
+++ 	(revision )
@@ -1,417 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxMiniToolBar class declaration & implementation. This is the toolbar shown on fullscreen mode.
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "VBoxMiniToolBar.h"
-
-/* Qt includes */
-#include <QCursor>
-#include <QDesktopWidget>
-#include <QLabel>
-#include <QMenu>
-#include <QPainter>
-#include <QPaintEvent>
-#include <QPolygon>
-#include <QRect>
-#include <QRegion>
-#include <QTimer>
-#include <QToolButton>
-
-VBoxMiniToolBar::VBoxMiniToolBar (QWidget *aParent, Alignment aAlignment, bool aActive, bool aAutoHide)
-    : VBoxToolBar (aParent)
-    , mActive (aActive)
-    , mPolished (false)
-    , mSeamless (false)
-    , mAutoHide (aAutoHide)
-    , mSlideToScreen (true)
-    , mHideAfterSlide (false)
-    , mAutoHideCounter (0)
-    , mAlignment (aAlignment)
-    , mAnimated (true)
-    , mScrollDelay (10)
-    , mAutoScrollDelay (100)
-    , mAutoHideTotalCounter (10)
-{
-    AssertMsg (parentWidget(), ("Parent widget must be set!!!\n"));
-
-    /* Various options */
-    setIconSize (QSize (16, 16));
-    setMouseTracking (mAutoHide);
-    setVisible (false);
-
-    /* Left margin of tool-bar */
-    mMargins << widgetForAction (addWidget (new QWidget (this)));
-
-    /* Add pushpin */
-    mAutoHideAct = new QAction (this);
-    mAutoHideAct->setIcon (VBoxGlobal::iconSet (":/pin_16px.png"));
-    mAutoHideAct->setToolTip (tr ("Always show the toolbar"));
-    mAutoHideAct->setCheckable (true);
-    mAutoHideAct->setChecked (!mAutoHide);
-    connect (mAutoHideAct, SIGNAL (toggled (bool)), this, SLOT (togglePushpin (bool)));
-    addAction (mAutoHideAct);
-
-    /* Left menu margin */
-    mSpacings << widgetForAction (addWidget (new QWidget (this)));
-
-    /* Right menu margin */
-    mInsertPosition = addWidget (new QWidget (this));
-    mSpacings << widgetForAction (mInsertPosition);
-
-    /* Left label margin */
-    mLabelMargins << widgetForAction (addWidget (new QWidget (this)));
-
-    /* Insert a label for VM Name */
-    mDisplayLabel = new QLabel (this);
-    mDisplayLabel->setAlignment (Qt::AlignCenter);
-    addWidget (mDisplayLabel);
-
-    /* Right label margin */
-    mLabelMargins << widgetForAction (addWidget (new QWidget (this)));
-
-    /* Exit action */
-    QAction *restoreAct = new QAction (this);
-    restoreAct->setIcon (VBoxGlobal::iconSet (":/restore_16px.png"));
-    restoreAct->setToolTip (tr ("Exit Full Screen or Seamless Mode"));
-    connect (restoreAct, SIGNAL (triggered()), this, SIGNAL (exitAction()));
-    addAction (restoreAct);
-
-    /* Close action */
-    QAction *closeAct = new QAction (this);
-    closeAct->setIcon (VBoxGlobal::iconSet (":/close_16px.png"));
-    closeAct->setToolTip (tr ("Close VM"));
-    connect (closeAct, SIGNAL (triggered()), this, SIGNAL (closeAction()));
-    addAction (closeAct);
-
-    /* Right margin of tool-bar */
-    mMargins << widgetForAction (addWidget (new QWidget (this)));
-}
-
-VBoxMiniToolBar& VBoxMiniToolBar::operator<< (QList <QMenu*> aMenus)
-{
-    for (int i = 0; i < aMenus.size(); ++ i)
-    {
-        QAction *action = aMenus [i]->menuAction();
-        insertAction (mInsertPosition, action);
-        if (QToolButton *button = qobject_cast <QToolButton*> (widgetForAction (action)))
-        {
-            button->setPopupMode (QToolButton::InstantPopup);
-            button->setAutoRaise (true);
-        }
-        if (i != aMenus.size() - 1)
-            mSpacings << widgetForAction (insertWidget (mInsertPosition, new QWidget (this)));
-    }
-    return *this;
-}
-
-void VBoxMiniToolBar::setSeamlessMode (bool aSeamless)
-{
-    mSeamless = aSeamless;
-}
-
-/* Update the display text, usually the VM Name */
-void VBoxMiniToolBar::setDisplayText (const QString &aText)
-{
-    if (mDisplayLabel->text() != aText)
-    {
-        /* Update toolbar label */
-        mDisplayLabel->setText (aText);
-
-        /* Reinitialize */
-        initialize();
-
-        if (!isHidden())
-            updateDisplay (!mAutoHide, false);
-    }
-}
-
-bool VBoxMiniToolBar::isAutoHide() const
-{
-    return mAutoHide;
-}
-
-void VBoxMiniToolBar::updateDisplay (bool aShow, bool aSetHideFlag)
-{
-    mAutoHideCounter = 0;
-
-    setMouseTracking (mAutoHide);
-
-    if (aShow)
-    {
-        if (isHidden())
-            moveToBase();
-
-        if (mAnimated)
-        {
-            if (aSetHideFlag)
-            {
-                mHideAfterSlide = false;
-                mSlideToScreen = true;
-            }
-            if (mActive) show();
-            mScrollTimer.start (mScrollDelay, this);
-        }
-        else if (mActive) show();
-
-        if (mAutoHide)
-            mAutoScrollTimer.start (mAutoScrollDelay, this);
-        else
-            mAutoScrollTimer.stop();
-    }
-    else
-    {
-        if (mAnimated)
-        {
-            if (aSetHideFlag)
-            {
-                mHideAfterSlide = true;
-                mSlideToScreen = false;
-            }
-            mScrollTimer.start (mScrollDelay, this);
-        }
-        else
-            hide();
-
-        if (mAutoHide)
-            mAutoScrollTimer.start (mAutoScrollDelay, this);
-        else
-            mAutoScrollTimer.stop();
-    }
-}
-
-void VBoxMiniToolBar::mouseMoveEvent (QMouseEvent *aEvent)
-{
-    if (!mHideAfterSlide)
-    {
-        mSlideToScreen = true;
-        mScrollTimer.start (mScrollDelay, this);
-    }
-
-    QToolBar::mouseMoveEvent (aEvent);
-}
-
-/* Handles auto hide feature of the toolbar */
-void VBoxMiniToolBar::timerEvent (QTimerEvent *aEvent)
-{
-    if (aEvent->timerId() == mScrollTimer.timerId())
-    {
-        QRect screen = mSeamless ? QApplication::desktop()->availableGeometry (window()) :
-                                   QApplication::desktop()->screenGeometry (window());
-        switch (mAlignment)
-        {
-            case AlignTop:
-            {
-                if (((mPositionY == screen.y()) && mSlideToScreen) ||
-                    ((mPositionY == screen.y() - height() + 1) && !mSlideToScreen))
-                {
-                    mScrollTimer.stop();
-                    if (mHideAfterSlide)
-                    {
-                        mHideAfterSlide = false;
-                        hide();
-                    }
-                    return;
-                }
-                mSlideToScreen ? ++ mPositionY : -- mPositionY;
-                break;
-            }
-            case AlignBottom:
-            {
-                if (((mPositionY == screen.y() + screen.height() - height()) && mSlideToScreen) ||
-                    ((mPositionY == screen.y() + screen.height() - 1) && !mSlideToScreen))
-                {
-                    mScrollTimer.stop();
-                    if (mHideAfterSlide)
-                    {
-                        mHideAfterSlide = false;
-                        hide();
-                    }
-                    return;
-                }
-                mSlideToScreen ? -- mPositionY : ++ mPositionY;
-                break;
-            }
-            default:
-                break;
-        }
-        move (mapFromScreen (QPoint (mPositionX, mPositionY)));
-        emit geometryUpdated();
-    }
-    else if (aEvent->timerId() == mAutoScrollTimer.timerId())
-    {
-        QRect rect = this->rect();
-        QPoint cursor_pos = QCursor::pos();
-        QPoint p = mapFromGlobal (cursor_pos);
-
-        if (!rect.contains (p))
-        {
-            ++ mAutoHideCounter;
-
-            if (mAutoHideCounter == mAutoHideTotalCounter)
-            {
-                mSlideToScreen = false;
-                mScrollTimer.start (mScrollDelay, this);
-            }
-        }
-        else
-            mAutoHideCounter = 0;
-    }
-    else
-        QWidget::timerEvent (aEvent);
-}
-
-void VBoxMiniToolBar::showEvent (QShowEvent *aEvent)
-{
-    if (!mPolished)
-    {
-        /* Tool-bar margins */
-        foreach (QWidget *margin, mMargins)
-            margin->setMinimumWidth (height());
-
-        /* Tool-bar spacings */
-        foreach (QWidget *spacing, mSpacings)
-            spacing->setMinimumWidth (5);
-
-        /* Title spacings */
-        foreach (QWidget *lableMargin, mLabelMargins)
-            lableMargin->setMinimumWidth (15);
-
-        /* Initialize */
-        initialize();
-
-        mPolished = true;
-    }
-
-    VBoxToolBar::showEvent (aEvent);
-}
-
-void VBoxMiniToolBar::paintEvent (QPaintEvent *aEvent)
-{
-    QPainter painter;
-    painter.begin (this);
-    painter.fillRect (aEvent->rect(), palette().brush (QPalette::Window));
-    painter.end();
-    VBoxToolBar::paintEvent (aEvent);
-}
-
-void VBoxMiniToolBar::togglePushpin (bool aOn)
-{
-    mAutoHide = !aOn;
-    updateDisplay (!mAutoHide, false);
-}
-
-void VBoxMiniToolBar::initialize()
-{
-    /* Resize to sizehint */
-    resize (sizeHint());
-
-    /* Update geometry */
-    recreateMask();
-    moveToBase();
-}
-
-void VBoxMiniToolBar::recreateMask()
-{
-    int edgeShift = height();
-    int points [8];
-    switch (mAlignment)
-    {
-        case AlignTop:
-        {
-            points [0] = 0;
-            points [1] = 0;
-
-            points [2] = edgeShift;
-            points [3] = height();
-
-            points [4] = width() - edgeShift;
-            points [5] = height();
-
-            points [6] = width();
-            points [7] = 0;
-
-            break;
-        }
-        case AlignBottom:
-        {
-            points [0] = edgeShift;
-            points [1] = 0;
-
-            points [2] = 0;
-            points [3] = height();
-
-            points [4] = width();
-            points [5] = height();
-
-            points [6] = width() - edgeShift;
-            points [7] = 0;
-
-            break;
-        }
-        default:
-            break;
-    }
-    /* Make sure any old mask is removed first */
-    clearMask();
-    /* Set the new mask */
-    QPolygon polygon;
-    polygon.setPoints (4, points);
-    setMask (polygon);
-}
-
-void VBoxMiniToolBar::moveToBase()
-{
-    QRect screen = mSeamless ? QApplication::desktop()->availableGeometry (window()) :
-                               QApplication::desktop()->screenGeometry (window());
-    mPositionX = screen.x() + screen.width() / 2 - width() / 2;
-    switch (mAlignment)
-    {
-        case AlignTop:
-        {
-            mPositionY = screen.y() - height() + 1;
-            break;
-        }
-        case AlignBottom:
-        {
-            mPositionY = screen.y() + screen.height() - 1;
-            break;
-        }
-        default:
-        {
-            mPositionY = 0;
-            break;
-        }
-    }
-    move (mapFromScreen (QPoint (mPositionX, mPositionY)));
-}
-
-QPoint VBoxMiniToolBar::mapFromScreen (const QPoint &aPoint)
-{
-    QPoint globalPosition = parentWidget()->mapFromGlobal (aPoint);
-    QRect fullArea = QApplication::desktop()->screenGeometry (window());
-    QRect realArea = mSeamless ? QApplication::desktop()->availableGeometry (window()) :
-                                 QApplication::desktop()->screenGeometry (window());
-    QPoint shiftToReal (realArea.topLeft() - fullArea.topLeft());
-    return globalPosition + shiftToReal;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxNewHDWzd.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxNewHDWzd.cpp	(revision 25170)
+++ 	(revision )
@@ -1,428 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxNewHDWzd class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxNewHDWzd.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "iprt/path.h"
-
-/* Qt includes */
-#include <QFileDialog>
-#include <QToolTip>
-
-/** Minimum VDI size in MB */
-static const quint64 MinVDISize = 4;
-
-/** Initial VDI size in MB */
-static const quint64 InitialVDISize = 2 * _1K;
-
-/**
- * Composes a file name from the given relative or full file name based on the
- * home directory and the default VDI directory. See IMedum::location for
- * details.
- */
-static QString composeFullFileName (const QString &aName)
-{
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    QString homeFolder = vbox.GetHomeFolder();
-    QString defaultFolder = vbox.GetSystemProperties().GetDefaultHardDiskFolder();
-
-    /* Note: the logic below must match the logic of the IMedum::location
-     * setter, otherwise the returned path may differ from the path actually
-     * set for the hard disk by the VirtualBox API */
-
-    QFileInfo fi (aName);
-    if (fi.fileName() == aName)
-    {
-        /* no path info at all, use defaultFolder */
-        fi = QFileInfo (defaultFolder, aName);
-    }
-    else if (fi.isRelative())
-    {
-        /* resolve relatively to homeFolder */
-        fi = QFileInfo (homeFolder, aName);
-    }
-
-    return QDir::toNativeSeparators (fi.absoluteFilePath());
-}
-
-static inline int log2i (quint64 val)
-{
-    quint64 n = val;
-    int pow = -1;
-    while (n)
-    {
-        ++ pow;
-        n >>= 1;
-    }
-    return pow;
-}
-
-static inline int sizeMBToSlider (quint64 val, int aSliderScale)
-{
-    int pow = log2i (val);
-    quint64 tickMB = quint64 (1) << pow;
-    quint64 tickMBNext = quint64 (1) << (pow + 1);
-    int step = (val - tickMB) * aSliderScale / (tickMBNext - tickMB);
-    return pow * aSliderScale + step;
-}
-
-static inline quint64 sliderToSizeMB (int val, int aSliderScale)
-{
-    int pow = val / aSliderScale;
-    int step = val % aSliderScale;
-    quint64 tickMB = quint64 (1) << pow;
-    quint64 tickMBNext = quint64 (1) << (pow + 1);
-    return tickMB + (tickMBNext - tickMB) * step / aSliderScale;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-
-
-VBoxNewHDWzd::VBoxNewHDWzd (QWidget *aParent)
-    : QIWithRetranslateUI<QIAbstractWizard> (aParent)
-{
-    /* Apply UI decorations */
-    Ui::VBoxNewHDWzd::setupUi (this);
-
-    /* Initialize wizard hdr */
-    initializeWizardHdr();
-
-    /* Storage type page */
-
-    /* Name and Size page */
-    CSystemProperties sysProps = vboxGlobal().virtualBox().GetSystemProperties();
-    mMaxVDISize = sysProps.GetMaxVDISize();
-    /* Detect how many steps to recognize between adjacent powers of 2
-     * to ensure that the last slider step is exactly mMaxVDISize */
-    mSliderScale = 0;
-    {
-        int pow = log2i (mMaxVDISize);
-        quint64 tickMB = quint64 (1) << pow;
-        if (tickMB < mMaxVDISize)
-        {
-            quint64 tickMBNext = quint64 (1) << (pow + 1);
-            quint64 gap = tickMBNext - mMaxVDISize;
-            mSliderScale = (int) ((tickMBNext - tickMB) / gap);
-        }
-    }
-    mSliderScale = qMax (mSliderScale, 8);
-    mLeName->setValidator (new QRegExpValidator (QRegExp (".+"), this));
-    mLeSize->setValidator (new QRegExpValidator (QRegExp (vboxGlobal().sizeRegexp()), this));
-    mLeSize->setAlignment (Qt::AlignRight);
-    mWValNameAndSize = new QIWidgetValidator (mPageNameAndSize, this);
-    connect (mWValNameAndSize, SIGNAL (validityChanged (const QIWidgetValidator *)),
-             this, SLOT (enableNext (const QIWidgetValidator *)));
-    connect (mWValNameAndSize, SIGNAL (isValidRequested (QIWidgetValidator *)),
-             this, SLOT (revalidate (QIWidgetValidator *)));
-    connect (mLeSize, SIGNAL (textChanged (const QString &)),
-             mWValNameAndSize, SLOT (revalidate()));
-    connect (mTbNameSelect, SIGNAL (clicked()), this, SLOT (tbNameSelectClicked()));
-    connect (mSlSize, SIGNAL (valueChanged (int)), this, SLOT (slSizeValueChanged (int)));
-    connect (mLeSize, SIGNAL (textChanged (const QString&)),
-             this, SLOT (leSizeTextChanged (const QString&)));
-
-    /* Summary page */
-
-    /* Image type page */
-
-    /* Name and Size page */
-    /// @todo NEWMEDIA use extension as reported by CMediumFormat
-    static ulong HDNumber = 0;
-    mLeName->setText (QString ("NewHardDisk%1.vdi").arg (++ HDNumber));
-    mSlSize->setFocusPolicy (Qt::StrongFocus);
-    mSlSize->setPageStep (mSliderScale);
-    mSlSize->setSingleStep (mSliderScale / 8);
-    mSlSize->setTickInterval (0);
-    mSlSize->setMinimum (sizeMBToSlider (MinVDISize, mSliderScale));
-    mSlSize->setMaximum (sizeMBToSlider (mMaxVDISize, mSliderScale));
-    mTxSizeMin->setText (vboxGlobal().formatSize (MinVDISize * _1M));
-    mTxSizeMax->setText (vboxGlobal().formatSize (mMaxVDISize * _1M));
-    /* limit the max. size of QILineEdit */
-    mLeSize->setFixedWidthByText ("88888.88 MB");
-    setRecommendedSize (InitialVDISize);
-
-    /* Summary page */
-    /* Update the next button state for pages with validation
-     * (validityChanged() connected to enableNext() will do the job) */
-    mWValNameAndSize->revalidate();
-
-    /* Initialize wizard ftr */
-    initializeWizardFtr();
-
-    retranslateUi();
-}
-
-void VBoxNewHDWzd::setRecommendedFileName (const QString &aName)
-{
-    mLeName->setText (aName);
-}
-
-void VBoxNewHDWzd::setRecommendedSize (quint64 aSize)
-{
-    AssertReturnVoid (aSize >= MinVDISize && aSize <= mMaxVDISize);
-    mCurrentSize = aSize;
-    mSlSize->setValue (sizeMBToSlider (mCurrentSize, mSliderScale));
-    mLeSize->setText (vboxGlobal().formatSize (mCurrentSize * _1M));
-    updateSizeToolTip (mCurrentSize * _1M);
-}
-
-void VBoxNewHDWzd::retranslateUi()
-{
-   /* Translate uic generated strings */
-    Ui::VBoxNewHDWzd::retranslateUi (this);
-
-    QWidget *page = mPageStack->currentWidget();
-
-    if (page == mPageSummary)
-    {
-        QString type = mRbDynamicType->isChecked() ? mRbDynamicType->text()
-                                                   : mRbFixedType->text();
-        type = VBoxGlobal::removeAccelMark (type);
-
-        quint64 sizeB = mCurrentSize * _1M;
-
-        /* compose summary */
-        QString summary = QString (
-            "<table>"
-            "<tr><td><nobr>%1:&nbsp;</nobr></td><td><nobr>%2</nobr></td></tr>"
-            "<tr><td><nobr>%3:&nbsp;</nobr></td><td><nobr>%4</nobr></td></tr>"
-            "<tr><td><nobr>%5:&nbsp;</nobr></td><td><nobr>%6&nbsp;(%7&nbsp;%8)</nobr></td></tr>"
-            "</table>"
-        )
-            .arg (tr ("Type", "summary")).arg (type)
-            .arg (tr ("Location", "summary")).arg (composeFullFileName (location()))
-            .arg (tr ("Size", "summary")).arg (VBoxGlobal::formatSize (sizeB))
-            .arg (sizeB).arg (tr ("Bytes", "summary"));
-
-        mTeSummary->setText (summary);
-    }
-}
-
-void VBoxNewHDWzd::accept()
-{
-    /* Try to create the hard disk when the Finish button is pressed.
-     * On failure, the wisard will remain open to give it another try. */
-    if (createHardDisk())
-        QIAbstractWizard::accept();
-}
-
-void VBoxNewHDWzd::slSizeValueChanged (int aVal)
-{
-    if (focusWidget() == mSlSize)
-    {
-        mCurrentSize = sliderToSizeMB (aVal, mSliderScale);
-        mLeSize->setText (vboxGlobal().formatSize (mCurrentSize * _1M));
-        updateSizeToolTip (mCurrentSize * _1M);
-    }
-}
-
-void VBoxNewHDWzd::leSizeTextChanged (const QString &aText)
-{
-    if (focusWidget() == mLeSize)
-    {
-        mCurrentSize = vboxGlobal().parseSize (aText);
-        updateSizeToolTip (mCurrentSize);
-        mCurrentSize /= _1M;
-        mSlSize->setValue (sizeMBToSlider (mCurrentSize, mSliderScale));
-    }
-}
-
-void VBoxNewHDWzd::tbNameSelectClicked()
-{
-    /* set the first parent directory that exists as the current */
-    QFileInfo fld (composeFullFileName (mLeName->text()));
-    do
-    {
-        QString dp = fld.path ();
-        fld = QFileInfo (dp);
-    }
-    while (!fld.exists() && !QDir (fld.absoluteFilePath()).isRoot());
-
-    if (!fld.exists())
-    {
-        CVirtualBox vbox = vboxGlobal().virtualBox();
-        fld = QFileInfo (vbox.GetSystemProperties().GetDefaultHardDiskFolder());
-        if (!fld.exists())
-            fld = vbox.GetHomeFolder();
-    }
-
-    QString selected = QFileDialog::getSaveFileName (
-        this,
-        tr ("Select a file for the new hard disk image file"),
-        fld.absoluteFilePath(),
-        tr ("Hard disk images (*.vdi)"));
-
-    if (!selected.isEmpty())
-    {
-        if (QFileInfo (selected).completeSuffix().isEmpty())
-            selected += ".vdi";
-        mLeName->setText (QDir::toNativeSeparators (selected));
-        mLeName->selectAll();
-        mLeName->setFocus();
-    }
-}
-
-void VBoxNewHDWzd::revalidate (QIWidgetValidator *aWval)
-{
-    /* do individual validations for pages */
-    bool valid = aWval->isOtherValid();
-
-    if (aWval == mWValNameAndSize)
-        valid = mCurrentSize >= MinVDISize && mCurrentSize <= mMaxVDISize;
-
-    aWval->setOtherValid (valid);
-}
-
-void VBoxNewHDWzd::enableNext (const QIWidgetValidator *aWval)
-{
-    nextButton (aWval->widget())->setEnabled (aWval->isValid());
-}
-
-void VBoxNewHDWzd::onPageShow()
-{
-    /* Make sure all is properly translated & composed */
-    retranslateUi();
-
-    QWidget *page = mPageStack->currentWidget();
-
-    if (page == mPageWelcome)
-        nextButton (page)->setFocus();
-    else if (page == mPageType)
-        mRbDynamicType->isChecked() ? mRbDynamicType->setFocus() :
-                                      mRbFixedType->setFocus();
-    else if (page == mPageNameAndSize)
-        mLeName->setFocus();
-    else if (page == mPageSummary)
-        mTeSummary->setFocus();
-
-    if (page == mPageSummary)
-        finishButton()->setDefault (true);
-    else
-        nextButton (page)->setDefault (true);
-}
-
-void VBoxNewHDWzd::showNextPage()
-{
-    /* Warn user about already present hard-disk */
-    if (sender() == mBtnNext3 &&
-        QFileInfo (location()).exists())
-    {
-        vboxProblem().sayCannotOverwriteHardDiskStorage (this, location());
-        return;
-    }
-
-    /* Switch to the next page */
-    QIAbstractWizard::showNextPage();
-}
-
-
-QString VBoxNewHDWzd::location()
-{
-    QString name = QDir::toNativeSeparators (mLeName->text());
-
-    /* remove all trailing dots to avoid multiple dots before .vdi */
-    int len;
-    while (len = name.length(), len > 0 && name [len - 1] == '.')
-        name.truncate (len - 1);
-
-    QString ext = QFileInfo (name).completeSuffix();
-
-    if (RTPathCompare (ext.toUtf8(), "vdi") != 0)
-        name += ".vdi";
-
-    return name;
-}
-
-bool VBoxNewHDWzd::isDynamicStorage()
-{
-    return mRbDynamicType->isChecked();
-}
-
-void VBoxNewHDWzd::updateSizeToolTip (quint64 aSizeB)
-{
-    QString tip = tr ("<nobr>%1 Bytes</nobr>").arg (aSizeB);
-    mSlSize->setToolTip (tip);
-    mLeSize->setToolTip (tip);
-}
-
-/**
- * Performs steps necessary to create a hard disk. This method handles all
- * errors and shows the corresponding messages when appropriate.
- *
- * @return Wheter the creation was successful or not.
- */
-bool VBoxNewHDWzd::createHardDisk()
-{
-    KMediumVariant variant = KMediumVariant_Standard;
-    QString loc = location();
-
-    AssertReturn (!loc.isEmpty(), false);
-    AssertReturn (mCurrentSize > 0, false);
-
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-
-    CProgress progress;
-
-    CMedium hd = vbox.CreateHardDisk(QString ("VDI"), loc);
-
-    if (!vbox.isOk())
-    {
-        vboxProblem().cannotCreateHardDiskStorage (this, vbox, loc, hd,
-                                                   progress);
-        return false;
-    }
-
-    if (!isDynamicStorage())
-        variant = (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed);
-
-    progress = hd.CreateBaseStorage (mCurrentSize, variant);
-
-    if (!hd.isOk())
-    {
-        vboxProblem().cannotCreateHardDiskStorage (this, vbox, loc, hd,
-                                                   progress);
-        return false;
-    }
-
-    vboxProblem().showModalProgressDialog (progress, windowTitle(), parentWidget());
-
-    if (progress.GetCanceled())
-        return false;
-
-    if (!progress.isOk() || progress.GetResultCode() != 0)
-    {
-        vboxProblem().cannotCreateHardDiskStorage (this, vbox, loc, hd,
-                                                   progress);
-        return false;
-    }
-
-    /* Inform everybody there is a new medium */
-    vboxGlobal().addMedium (VBoxMedium (CMedium (hd),
-                                        VBoxDefs::MediumType_HardDisk,
-                                        KMediumState_Created));
-
-    mHD = hd;
-    return true;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxNewVMWzd.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxNewVMWzd.cpp	(revision 25170)
+++ 	(revision )
@@ -1,452 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxNewVMWzd class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxNewVMWzd.h"
-#include "VBoxVMSettingsHD.h"
-#include "VBoxUtils.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "VBoxNewHDWzd.h"
-#include "VBoxMediaManagerDlg.h"
-
-VBoxNewVMWzd::VBoxNewVMWzd (QWidget *aParent)
-    : QIWithRetranslateUI<QIAbstractWizard> (aParent)
-{
-    /* Apply UI decorations */
-    Ui::VBoxNewVMWzd::setupUi (this);
-
-    /* Initialize wizard hdr */
-    initializeWizardHdr();
-
-    /* Name and OS page */
-    mLeName->setValidator (new QRegExpValidator (QRegExp (".+"), this));
-
-    mWvalNameAndOS = new QIWidgetValidator (mPageNameAndOS, this);
-    connect (mWvalNameAndOS, SIGNAL (validityChanged (const QIWidgetValidator*)),
-             this, SLOT (enableNext (const QIWidgetValidator*)));
-    connect (mOSTypeSelector, SIGNAL (osTypeChanged()), this, SLOT (onOSTypeChanged()));
-
-    /* Memory page */
-    mLeRAM->setFixedWidthByText ("99999");
-    mLeRAM->setValidator (new QIntValidator (mSlRAM->minRAM(), mSlRAM->maxRAM(), this));
-
-    mWvalMemory = new QIWidgetValidator (mPageMemory, this);
-    connect (mWvalMemory, SIGNAL (validityChanged (const QIWidgetValidator*)),
-             this, SLOT (enableNext (const QIWidgetValidator*)));
-    connect (mWvalMemory, SIGNAL (isValidRequested (QIWidgetValidator*)),
-             this, SLOT (revalidate (QIWidgetValidator*)));
-    connect (mSlRAM, SIGNAL (valueChanged (int)),
-             this, SLOT (slRAMValueChanged (int)));
-    connect (mLeRAM, SIGNAL (textChanged (const QString&)),
-             this, SLOT (leRAMTextChanged (const QString&)));
-
-    /* HDD Images page */
-    QStyleOptionButton options;
-    options.initFrom (mNewVDIRadio);
-    QGridLayout *hdLayout = qobject_cast <QGridLayout*> (mGbHDA->layout());
-    int wid = mNewVDIRadio->style()->subElementRect (QStyle::SE_RadioButtonIndicator, &options, mNewVDIRadio).width() +
-              mNewVDIRadio->style()->pixelMetric (QStyle::PM_RadioButtonLabelSpacing, &options, mNewVDIRadio) -
-              hdLayout->spacing() - 1;
-    QSpacerItem *spacer = new QSpacerItem (wid, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
-    hdLayout->addItem (spacer, 2, 0);
-    mHDCombo->setType (VBoxDefs::MediumType_HardDisk);
-    mHDCombo->repopulate();
-    mTbVmm->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png",
-                                          ":/select_file_dis_16px.png"));
-
-    mWvalHDD = new QIWidgetValidator (mPageHDD, this);
-    connect (mWvalHDD, SIGNAL (validityChanged (const QIWidgetValidator*)),
-             this, SLOT (enableNext (const QIWidgetValidator*)));
-    connect (mWvalHDD, SIGNAL (isValidRequested (QIWidgetValidator*)),
-             this, SLOT (revalidate (QIWidgetValidator*)));
-    connect (mGbHDA, SIGNAL (toggled (bool)), mWvalHDD, SLOT (revalidate()));
-    connect (mNewVDIRadio, SIGNAL (toggled (bool)), this, SLOT (hdTypeChanged()));
-    connect (mExistRadio, SIGNAL (toggled (bool)), this, SLOT (hdTypeChanged()));
-    connect (mHDCombo, SIGNAL (currentIndexChanged (int)),
-             mWvalHDD, SLOT (revalidate()));
-    connect (mTbVmm, SIGNAL (clicked()), this, SLOT (showMediaManager()));
-
-    /* Name and OS page */
-    onOSTypeChanged();
-
-    /* Memory page */
-    slRAMValueChanged (mSlRAM->value());
-
-    /* HDD Images page */
-    hdTypeChanged();
-
-    /* Initial revalidation */
-    mWvalNameAndOS->revalidate();
-    mWvalMemory->revalidate();
-    mWvalHDD->revalidate();
-
-    /* Initialize wizard ftr */
-    initializeWizardFtr();
-
-    retranslateUi();
-}
-
-VBoxNewVMWzd::~VBoxNewVMWzd()
-{
-    ensureNewHardDiskDeleted();
-}
-
-const CMachine& VBoxNewVMWzd::machine() const
-{
-    return mMachine;
-}
-
-void VBoxNewVMWzd::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxNewVMWzd::retranslateUi (this);
-
-    CGuestOSType type = mOSTypeSelector->type();
-
-    mTextRAMBest->setText (
-        tr ("The recommended base memory size is <b>%1</b> MB.")
-            .arg (type.GetRecommendedRAM()));
-    mTextVDIBest->setText (
-        tr ("The recommended size of the boot hard disk is <b>%1</b> MB.")
-            .arg (type.GetRecommendedHDD()));
-
-    mTxRAMMin->setText (QString ("<qt>%1&nbsp;%2</qt>")
-                        .arg (mSlRAM->minRAM()).arg (tr ("MB", "megabytes")));
-    mTxRAMMax->setText (QString ("<qt>%1&nbsp;%2</qt>")
-                        .arg (mSlRAM->maxRAM()).arg (tr ("MB", "megabytes")));
-
-    QWidget *page = mPageStack->currentWidget();
-
-    if (page == mPageSummary)
-    {
-        /* Compose summary */
-        QString summary = QString (
-            "<tr><td><nobr>%1:&nbsp;</nobr></td><td>%2</td></tr>"
-            "<tr><td><nobr>%3:&nbsp;</nobr></td><td>%4</td></tr>"
-            "<tr><td><nobr>%5:&nbsp;</nobr></td><td>%6&nbsp;%7</td></tr>")
-            .arg (tr ("Name", "summary"), mLeName->text())
-            .arg (tr ("OS Type", "summary"), type.GetDescription())
-            .arg (tr ("Base Memory", "summary")).arg (mSlRAM->value())
-            .arg (tr ("MB", "megabytes"));
-
-        if (mGbHDA->isChecked() && !mHDCombo->id().isNull())
-            summary += QString (
-                "<tr><td><nobr>%8:&nbsp;</nobr></td><td><nobr>%9</nobr></td></tr>")
-                .arg (tr ("Boot Hard Disk", "summary"), mHDCombo->currentText());
-
-        mTeSummary->setText ("<table>" + summary + "</table>");
-    }
-}
-
-void VBoxNewVMWzd::accept()
-{
-    /* Try to create the machine when the Finish button is pressed.
-     * On failure, the wisard will remain open to give it another try. */
-    if (constructMachine())
-        QDialog::accept();
-}
-
-void VBoxNewVMWzd::showMediaManager()
-{
-    VBoxMediaManagerDlg dlg (this);
-    dlg.setup (VBoxDefs::MediumType_HardDisk, true);
-
-    if (dlg.exec() == QDialog::Accepted)
-    {
-        QString newId = dlg.selectedId();
-        if (mHDCombo->id() != newId)
-        {
-            ensureNewHardDiskDeleted();
-            mHDCombo->setCurrentItem (newId);
-        }
-    }
-
-    mHDCombo->setFocus();
-}
-
-void VBoxNewVMWzd::onOSTypeChanged()
-{
-    slRAMValueChanged (mOSTypeSelector->type().GetRecommendedRAM());
-}
-
-void VBoxNewVMWzd::slRAMValueChanged (int aValue)
-{
-    mLeRAM->setText (QString().setNum (aValue));
-}
-
-void VBoxNewVMWzd::leRAMTextChanged (const QString &aText)
-{
-    mSlRAM->setValue (aText.toInt());
-}
-
-void VBoxNewVMWzd::hdTypeChanged()
-{
-    mHDCombo->setEnabled (mExistRadio->isChecked());
-    mTbVmm->setEnabled (mExistRadio->isChecked());
-    if (mExistRadio->isChecked())
-        mHDCombo->setFocus();
-
-    mWvalHDD->revalidate();
-}
-
-void VBoxNewVMWzd::revalidate (QIWidgetValidator *aWval)
-{
-    /* Get common result of validators */
-    bool valid = aWval->isOtherValid();
-
-    /* Do individual validations for pages */
-    if (aWval->widget() == mPageMemory)
-    {
-        valid = true;
-        if (mSlRAM->value() > (int)mSlRAM->maxRAMAlw())
-            valid = false;
-    }
-    else if (aWval->widget() == mPageHDD)
-    {
-        valid = true;
-        if (    (mGbHDA->isChecked())
-            &&  (vboxGlobal().findMedium (mHDCombo->id()).isNull())
-            &&  (mExistRadio->isChecked()))
-        {
-            valid = false;
-        }
-    }
-
-    aWval->setOtherValid (valid);
-}
-
-void VBoxNewVMWzd::enableNext (const QIWidgetValidator *aWval)
-{
-    nextButton (aWval->widget())->setEnabled (aWval->isValid());
-}
-
-void VBoxNewVMWzd::onPageShow()
-{
-    /* Make sure all is properly translated & composed */
-    retranslateUi();
-
-    QWidget *page = mPageStack->currentWidget();
-
-    if (page == mPageWelcome)
-        nextButton (page)->setFocus();
-    else if (page == mPageNameAndOS)
-        mLeName->setFocus();
-    else if (page == mPageMemory)
-        mSlRAM->setFocus();
-    else if (page == mPageHDD)
-        mHDCombo->setFocus();
-    else if (page == mPageSummary)
-        mTeSummary->setFocus();
-
-    if (page == mPageSummary)
-        finishButton()->setDefault (true);
-    else
-        nextButton (page)->setDefault (true);
-}
-
-void VBoxNewVMWzd::showBackPage()
-{
-    /* Delete temporary HD if present */
-    if (sender() == mBtnBack5)
-        ensureNewHardDiskDeleted();
-
-    /* Switch to the back page */
-    QIAbstractWizard::showBackPage();
-}
-
-void VBoxNewVMWzd::showNextPage()
-{
-    /* Ask user about disk-less machine */
-    if (sender() == mBtnNext4 && !mGbHDA->isChecked() &&
-        !vboxProblem().confirmHardDisklessMachine (this))
-        return;
-
-    /* Show the New Hard Disk wizard */
-    if (sender() == mBtnNext4 && mGbHDA->isChecked() &&
-        mNewVDIRadio->isChecked() && !showNewHDWizard())
-        return;
-
-    /* Switch to the next page */
-    QIAbstractWizard::showNextPage();
-}
-
-
-bool VBoxNewVMWzd::showNewHDWizard()
-{
-    VBoxNewHDWzd dlg (this);
-
-    dlg.setRecommendedFileName (mLeName->text());
-    dlg.setRecommendedSize (mOSTypeSelector->type().GetRecommendedHDD());
-
-    if (dlg.exec() == QDialog::Accepted)
-    {
-        ensureNewHardDiskDeleted();
-        mHardDisk = dlg.hardDisk();
-        mHDCombo->setCurrentItem (mHardDisk.GetId());
-        return true;
-    }
-
-    return false;
-}
-
-bool VBoxNewVMWzd::constructMachine()
-{
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-
-    /* OS type */
-    CGuestOSType type = mOSTypeSelector->type();
-    AssertMsg (!type.isNull(), ("vmGuestOSType() must return non-null type"));
-    QString typeId = type.GetId();
-
-    /* Create a machine with the default settings file location */
-    if (mMachine.isNull())
-    {
-        mMachine = vbox.CreateMachine (mLeName->text(), typeId, QString::null, QString::null);
-        if (!vbox.isOk())
-        {
-            vboxProblem().cannotCreateMachine (vbox, this);
-            return false;
-        }
-
-        /* The FirstRun wizard is to be shown only when we don't attach any hard
-         * disk or attach a new (empty) one. Selecting an existing hard disk
-         * will cancel the wizard. */
-        if (!mGbHDA->isChecked() || !mHardDisk.isNull())
-            mMachine.SetExtraData (VBoxDefs::GUI_FirstRun, "yes");
-    }
-
-    /* RAM size */
-    mMachine.SetMemorySize (mSlRAM->value());
-
-    /* VRAM size - select maximum between recommended and minimum for fullscreen */
-    mMachine.SetVRAMSize (qMax (type.GetRecommendedVRAM(),
-                                (ULONG) (VBoxGlobal::requiredVideoMemory(&mMachine) / _1M)));
-
-    /* Enabling audio by default */
-    mMachine.GetAudioAdapter().SetEnabled (true);
-
-    /* Enable the OHCI and EHCI controller by default for new VMs. (new in 2.2) */
-    CUSBController usbController = mMachine.GetUSBController();
-    if (!usbController.isNull())
-    {
-        usbController.SetEnabled (true);
-        usbController.SetEnabledEhci (true);
-    }
-
-    /* Create default storage controllers */
-    QString ideCtrName = VBoxVMSettingsHD::tr ("IDE Controller");
-    QString floppyCtrName = VBoxVMSettingsHD::tr ("Floppy Controller");
-    KStorageBus ideBus = KStorageBus_IDE;
-    KStorageBus floppyBus = KStorageBus_Floppy;
-    mMachine.AddStorageController (ideCtrName, ideBus);
-    mMachine.AddStorageController (floppyCtrName, floppyBus);
-
-    /* Register the VM prior to attaching hard disks */
-    vbox.RegisterMachine (mMachine);
-    if (!vbox.isOk())
-    {
-        vboxProblem().cannotCreateMachine (vbox, mMachine, this);
-        return false;
-    }
-
-    /* Attach default devices */
-    {
-        bool success = false;
-        QString machineId = mMachine.GetId();
-        CSession session = vboxGlobal().openSession (machineId);
-        if (!session.isNull())
-        {
-            CMachine m = session.GetMachine();
-
-            /* Boot hard disk (IDE Primary Master) */
-            if (mGbHDA->isChecked())
-            {
-                m.AttachDevice (ideCtrName, 0, 0, KDeviceType_HardDisk, mHDCombo->id());
-                if (!m.isOk())
-                    vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_HardDisk, mHDCombo->location(), ideBus, 0, 0);
-            }
-
-            /* Attach empty CD/DVD ROM Device */
-            m.AttachDevice (ideCtrName, 1, 0, KDeviceType_DVD, QString(""));
-            if (!m.isOk())
-                vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_DVD, QString(), ideBus, 1, 0);
-
-            /* Attach empty Floppy Device */
-            m.AttachDevice (floppyCtrName, 0, 0, KDeviceType_Floppy, QString(""));
-            if (!m.isOk())
-                vboxProblem().cannotAttachDevice (this, m, VBoxDefs::MediumType_Floppy, QString(), floppyBus, 0, 0);
-
-            if (m.isOk())
-            {
-                m.SaveSettings();
-                if (m.isOk())
-                    success = true;
-                else
-                    vboxProblem().cannotSaveMachineSettings (m, this);
-            }
-
-            session.Close();
-        }
-        if (!success)
-        {
-            /* Unregister on failure */
-            vbox.UnregisterMachine (machineId);
-            if (vbox.isOk())
-                mMachine.DeleteSettings();
-            return false;
-        }
-    }
-
-    /* Ensure we don't try to delete a newly created hard disk on success */
-    mHardDisk.detach();
-
-    return true;
-}
-
-void VBoxNewVMWzd::ensureNewHardDiskDeleted()
-{
-    if (!mHardDisk.isNull())
-    {
-        /* Remember ID as it may be lost after the deletion */
-        QString id = mHardDisk.GetId();
-
-        bool success = false;
-
-        CProgress progress = mHardDisk.DeleteStorage();
-        if (mHardDisk.isOk())
-        {
-            vboxProblem().showModalProgressDialog (progress, windowTitle(),
-                                                   parentWidget());
-            if (progress.isOk() && progress.GetResultCode() == S_OK)
-                success = true;
-        }
-
-        if (success)
-            vboxGlobal().removeMedium (VBoxDefs::MediumType_HardDisk, id);
-        else
-            vboxProblem().cannotDeleteHardDiskStorage (this, mHardDisk,
-                                                       progress);
-        mHardDisk.detach();
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxOSTypeSelectorButton.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxOSTypeSelectorButton.cpp	(revision 25170)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxOSTypeSelectorButton class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "VBoxOSTypeSelectorButton.h"
-#include "VBoxGlobal.h"
-
-/* Qt includes */
-#include <QMenu>
-#include <QSignalMapper>
-
-VBoxOSTypeSelectorButton::VBoxOSTypeSelectorButton (QWidget *aParent)
-  : QIWithRetranslateUI <QPushButton> (aParent)
-{
-    /* We have to make sure that the button has strong focus, otherwise the
-     * editing is ended when the menu is shown */
-    setFocusPolicy (Qt::StrongFocus);
-    setIconSize (QSize (16, 16));
-    /* Create a signal mapper so that we not have to react to every single
-     * menu activation ourself. */
-    mSignalMapper = new QSignalMapper (this);
-    connect (mSignalMapper, SIGNAL (mapped (const QString &)),
-             this, SLOT (setOSTypeId (const QString &)));
-    mMainMenu = new QMenu (aParent);
-    setMenu (mMainMenu);
-
-    retranslateUi();
-}
-
-void VBoxOSTypeSelectorButton::setOSTypeId (const QString& aOSTypeId)
-{
-    mOSTypeId = aOSTypeId;
-    CGuestOSType type = vboxGlobal().vmGuestOSType (aOSTypeId);
-    /* Looks ugly on the Mac */
-#ifndef Q_WS_MAC
-    setIcon (vboxGlobal().vmGuestOSTypeIcon (type.GetId()));
-#endif /* Q_WS_MAC */
-    setText (type.GetDescription());
-}
-
-bool VBoxOSTypeSelectorButton::isMenuShown() const
-{
-    return mMainMenu->isVisible();
-}
-
-void VBoxOSTypeSelectorButton::retranslateUi()
-{
-    populateMenu();
-}
-
-void VBoxOSTypeSelectorButton::populateMenu()
-{
-    mMainMenu->clear();
-    /* Create a list of all possible OS types */
-    QList <CGuestOSType> families = vboxGlobal().vmGuestOSFamilyList();
-    foreach (const CGuestOSType& family, families)
-    {
-        QMenu *subMenu = mMainMenu->addMenu (family.GetFamilyDescription());
-        QList <CGuestOSType> types = vboxGlobal().vmGuestOSTypeList (family.GetFamilyId());
-        foreach (const CGuestOSType& type, types)
-        {
-            QAction *a = subMenu->addAction (vboxGlobal().vmGuestOSTypeIcon (type.GetId()), type.GetDescription());
-            connect(a, SIGNAL (triggered()),
-                    mSignalMapper, SLOT(map()));
-            mSignalMapper->setMapping (a, type.GetId());
-        }
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxOSTypeSelectorWidget.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxOSTypeSelectorWidget.cpp	(revision 25170)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxOSTypeSelectorWidget class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxOSTypeSelectorWidget.h"
-
-#include <QComboBox>
-#include <QLabel>
-#include <QVBoxLayout>
-
-enum
-{
-    RoleTypeID = Qt::UserRole + 1
-};
-
-VBoxOSTypeSelectorWidget::VBoxOSTypeSelectorWidget (QWidget *aParent)
-    : QIWithRetranslateUI <QWidget> (aParent)
-    , mTxFamilyName (new QLabel (this))
-    , mTxTypeName (new QLabel (this))
-    , mPxTypeIcon (new QLabel (this))
-    , mCbFamily (new QComboBox (this))
-    , mCbType (new QComboBox (this))
-    , mPolished (false)
-    , mLayoutPosition (-1)
-{
-    /* Setup widgets */
-    mTxFamilyName->setAlignment (Qt::AlignRight);
-    mTxTypeName->setAlignment (Qt::AlignRight);
-    mTxFamilyName->setBuddy (mCbFamily);
-    mTxTypeName->setBuddy (mCbType);
-    mTxFamilyName->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Fixed);
-    mTxTypeName->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Fixed);
-    mCbFamily->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed);
-    mCbType->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed);
-    mPxTypeIcon->setFixedSize (32, 32);
-
-    /* Fill OS family selector */
-    int maximumSize = 0;
-    QFontMetrics fm (mCbFamily->font());
-    QList <CGuestOSType> families (vboxGlobal().vmGuestOSFamilyList());
-    for (int i = 0; i < families.size(); ++ i)
-    {
-        /* Search for maximum length among family names */
-        QString familyName (families [i].GetFamilyDescription());
-        maximumSize = maximumSize < fm.width (familyName) ?
-                      fm.width (familyName) : maximumSize;
-        mCbFamily->insertItem (i, familyName);
-        mCbFamily->setItemData (i, families [i].GetFamilyId(), RoleTypeID);
-        /* Search for maximum length among type names */
-        QList <CGuestOSType> types (vboxGlobal().vmGuestOSTypeList (families [i].GetFamilyId()));
-        for (int j = 0; j < types.size(); ++ j)
-        {
-            QString typeName (types [j].GetDescription());
-            maximumSize = maximumSize < fm.width (typeName) ?
-                          fm.width (typeName) : maximumSize;
-        }
-    }
-    mCbFamily->setCurrentIndex (0);
-    onFamilyChanged (mCbFamily->currentIndex());
-
-    /* Set the minimum size for OS Type & Family selectors. */
-    QStyleOptionComboBox options;
-    options.initFrom (mCbFamily);
-    QSize size (style()->sizeFromContents (QStyle::CT_ComboBox, &options,
-                QSize (maximumSize, fm.height()), mCbFamily));
-    mCbFamily->setMinimumWidth (size.width());
-    mCbType->setMinimumWidth (size.width());
-
-    /* Slots connections */
-    connect (mCbFamily, SIGNAL (currentIndexChanged (int)),
-             this, SLOT (onFamilyChanged (int)));
-    connect (mCbType, SIGNAL (currentIndexChanged (int)),
-             this, SLOT (onTypeChanged (int)));
-
-    /* Retranslate */
-    retranslateUi();
-}
-
-void VBoxOSTypeSelectorWidget::setType (const CGuestOSType &aType)
-{
-    QString familyId (aType.GetFamilyId());
-    QString typeId (aType.GetId());
-
-    int familyIndex = mCbFamily->findData (familyId, RoleTypeID);
-    AssertMsg (familyIndex != -1, ("Family ID should be valid: '%s'", familyId.toLatin1().constData()));
-    if (familyIndex != -1)
-        mCbFamily->setCurrentIndex (familyIndex);
-
-    int typeIndex = mCbType->findData (typeId, RoleTypeID);
-    AssertMsg (typeIndex != -1, ("Type ID should be valid: '%s'", typeId.toLatin1().constData()));
-    if (typeIndex != -1)
-        mCbType->setCurrentIndex (typeIndex);
-}
-
-CGuestOSType VBoxOSTypeSelectorWidget::type() const
-{
-    return mType;
-}
-
-void VBoxOSTypeSelectorWidget::setLayoutPosition (int aPos)
-{
-    mLayoutPosition = aPos;
-}
-
-void VBoxOSTypeSelectorWidget::retranslateUi()
-{
-    mTxFamilyName->setText (tr ("Operating &System:"));
-    mCbFamily->setWhatsThis (tr ("Displays the operating system family that "
-                                 "you plan to install into this virtual machine."));
-    mTxTypeName->setText (tr ("&Version:"));
-    mCbType->setWhatsThis (tr ("Displays the operating system type that "
-                               "you plan to install into this virtual "
-                               "machine (called a guest operating system)."));
-}
-
-void VBoxOSTypeSelectorWidget::showEvent (QShowEvent *aEvent)
-{
-    if (!mPolished)
-    {
-        /* Finally polishing just before first show event */
-        mPolished = true;
-
-        /* Layouting widgets */
-        QVBoxLayout *layout1 = new QVBoxLayout();
-        layout1->setSpacing (0);
-        layout1->addWidget (mPxTypeIcon);
-        layout1->addStretch();
-
-        QGridLayout *layout2 = layout() ? static_cast <QGridLayout*> (layout()) :
-                                          new QGridLayout (this);
-        layout2->setMargin (0);
-        int row = mLayoutPosition == -1 ? layout2->rowCount() : mLayoutPosition;
-        layout2->addWidget (mTxFamilyName, row, 0);
-        layout2->addWidget (mCbFamily, row, 1);
-        layout2->addWidget (mTxTypeName, row + 1, 0);
-        layout2->addWidget (mCbType, row + 1, 1);
-        layout2->addLayout (layout1, row, 2, 2, 1);
-    }
-    QIWithRetranslateUI <QWidget>::showEvent (aEvent);
-}
-
-void VBoxOSTypeSelectorWidget::onFamilyChanged (int aIndex)
-{
-    /* Lock the signals of mCbType to prevent it's reaction on clearing */
-    mCbType->blockSignals (true);
-    mCbType->clear();
-
-    /* Check if host supports (AMD-V or VT-x) and long mode */
-    CHost host = vboxGlobal().virtualBox().GetHost();
-    bool mSupportsHWVirtEx = host.GetProcessorFeature (KProcessorFeature_HWVirtEx);
-    bool mSupportsLongMode = host.GetProcessorFeature (KProcessorFeature_LongMode);
-
-    /* Populate combo-box with OS Types related to currently selected Family ID */
-    QString familyId (mCbFamily->itemData (aIndex, RoleTypeID).toString());
-    QList <CGuestOSType> types (vboxGlobal().vmGuestOSTypeList (familyId));
-    for (int i = 0; i < types.size(); ++ i)
-    {
-        if (types [i].GetIs64Bit() && (!mSupportsHWVirtEx || !mSupportsLongMode))
-            continue;
-        int index = mCbType->count();
-        mCbType->insertItem (index, types [i].GetDescription());
-        mCbType->setItemData (index, types [i].GetId(), RoleTypeID);
-    }
-
-    /* Select the most recently chosen item */
-    if (mCurrentIds.contains (familyId))
-    {
-        QString typeId (mCurrentIds [familyId]);
-        int typeIndex = mCbType->findData (typeId, RoleTypeID);
-        if (typeIndex != -1)
-            mCbType->setCurrentIndex (typeIndex);
-    }
-    /* Or select WinXP item for Windows family as default */
-    else if (familyId == "Windows")
-    {
-        int xpIndex = mCbType->findData ("WindowsXP", RoleTypeID);
-        if (xpIndex != -1)
-            mCbType->setCurrentIndex (xpIndex);
-    }
-    /* Or select Ubuntu item for Linux family as default */
-    else if (familyId == "Linux")
-    {
-        int ubIndex = mCbType->findData ("Ubuntu", RoleTypeID);
-        if (ubIndex != -1)
-            mCbType->setCurrentIndex (ubIndex);
-    }
-    /* Else simply select the first one present */
-    else mCbType->setCurrentIndex (0);
-
-    /* Update all the stuff with new type */
-    onTypeChanged (mCbType->currentIndex());
-
-    /* Unlock the signals of mCbType */
-    mCbType->blockSignals (false);
-}
-
-void VBoxOSTypeSelectorWidget::onTypeChanged (int aIndex)
-{
-    /* Save the new selected OS Type */
-    mType = vboxGlobal().vmGuestOSType (
-        mCbType->itemData (aIndex, RoleTypeID).toString(),
-        mCbFamily->itemData (mCbFamily->currentIndex(), RoleTypeID).toString());
-    mPxTypeIcon->setPixmap (vboxGlobal().vmGuestOSTypeIcon (mType.GetId()));
-
-    /* Save the most recently used item */
-    mCurrentIds [mType.GetFamilyId()] = mType.GetId();
-
-    /* Notify connected objects about type was changed */
-    emit osTypeChanged();
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp	(revision 25170)
+++ 	(revision )
@@ -1,2449 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxProblemReporter class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxProblemReporter.h"
-
-#include "VBoxGlobal.h"
-#include "VBoxSelectorWnd.h"
-#include "VBoxConsoleWnd.h"
-#include "VBoxProgressDialog.h"
-
-#include "VBoxAboutDlg.h"
-
-#include "QIHotKeyEdit.h"
-
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-#endif
-
-/* Qt includes */
-#include <QFileInfo>
-#ifdef Q_WS_MAC
-# include <QPushButton>
-#endif
-
-#include <iprt/err.h>
-#include <iprt/param.h>
-#include <iprt/path.h>
-
-#if defined (Q_WS_WIN32)
-#include <Htmlhelp.h>
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-// VBoxProblemReporter class
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- *  Returns a reference to the global VirtualBox problem reporter instance.
- */
-VBoxProblemReporter &VBoxProblemReporter::instance()
-{
-    static VBoxProblemReporter vboxProblem_instance;
-    return vboxProblem_instance;
-}
-
-bool VBoxProblemReporter::isValid() const
-{
-    return qApp != 0;
-}
-
-// Helpers
-/////////////////////////////////////////////////////////////////////////////
-
-/**
- *  Shows a message box of the given type with the given text and with buttons
- *  according to arguments b1, b2 and b3 (in the same way as QMessageBox does
- *  it), and returns the user's choice.
- *
- *  When all button arguments are zero, a single 'Ok' button is shown.
- *
- *  If aAutoConfirmId is not null, then the message box will contain a
- *  checkbox "Don't show this message again" below the message text and its
- *  state will be saved in the global config. When the checkbox is in the
- *  checked state, this method doesn't actually show the message box but
- *  returns immediately. The return value in this case is the same as if the
- *  user has pressed the Enter key or the default button, but with
- *  AutoConfirmed bit set (AutoConfirmed alone is returned when no default
- *  button is defined in button arguments).
- *
- *  @param  aParent
- *      Parent widget or 0 to use the desktop as the parent. Also,
- *      #mainWindowShown can be used to determine the currently shown VBox
- *      main window (Selector or Console).
- *  @param  aType
- *      One of values of the Type enum, that defines the message box
- *      title and icon.
- *  @param  aMessage
- *      Message text to display (can contain sinmple Qt-html tags).
- *  @param  aDetails
- *      Detailed message description displayed under the main message text using
- *      QTextEdit (that provides rich text support and scrollbars when necessary).
- *      If equals to QString::null, no details text box is shown.
- *  @param  aAutoConfirmId
- *      ID used to save the auto confirmation state across calls. If null,
- *      the auto confirmation feature is turned off (and no checkbox is shown)
- *  @param  aButton1
- *      First button code or 0, see QIMessageBox for a list of codes.
- *  @param  aButton2
- *      Second button code or 0, see QIMessageBox for a list of codes.
- *  @param  aButton3
- *      Third button code or 0, see QIMessageBox for a list of codes.
- *  @param  aText1
- *      Optional custom text for the first button.
- *  @param  aText2
- *      Optional custom text for the second button.
- *  @param  aText3
- *      Optional custom text for the third button.
- *
- *  @return
- *      code of the button pressed by the user
- */
-int VBoxProblemReporter::message (QWidget *aParent, Type aType, const QString &aMessage,
-                                  const QString &aDetails /* = QString::null */,
-                                  const char *aAutoConfirmId /* = 0 */,
-                                  int aButton1 /* = 0 */, int aButton2 /* = 0 */,
-                                  int aButton3 /* = 0 */,
-                                  const QString &aText1 /* = QString::null */,
-                                  const QString &aText2 /* = QString::null */,
-                                  const QString &aText3 /* = QString::null */) const
-{
-    if (aButton1 == 0 && aButton2 == 0 && aButton3 == 0)
-        aButton1 = QIMessageBox::Ok | QIMessageBox::Default;
-
-    CVirtualBox vbox;
-    QStringList msgs;
-
-    if (aAutoConfirmId)
-    {
-        vbox = vboxGlobal().virtualBox();
-        msgs = vbox.GetExtraData (VBoxDefs::GUI_SuppressMessages).split (',');
-        if (msgs.contains (aAutoConfirmId)) {
-            int rc = AutoConfirmed;
-            if (aButton1 & QIMessageBox::Default)
-                rc |= (aButton1 & QIMessageBox::ButtonMask);
-            if (aButton2 & QIMessageBox::Default)
-                rc |= (aButton2 & QIMessageBox::ButtonMask);
-            if (aButton3 & QIMessageBox::Default)
-                rc |= (aButton3 & QIMessageBox::ButtonMask);
-            return rc;
-        }
-    }
-
-    QString title;
-    QIMessageBox::Icon icon;
-
-    switch (aType)
-    {
-        default:
-        case Info:
-            title = tr ("VirtualBox - Information", "msg box title");
-            icon = QIMessageBox::Information;
-            break;
-        case Question:
-            title = tr ("VirtualBox - Question", "msg box title");
-            icon = QIMessageBox::Question;
-            break;
-        case Warning:
-            title = tr ("VirtualBox - Warning", "msg box title");
-            icon = QIMessageBox::Warning;
-            break;
-        case Error:
-            title = tr ("VirtualBox - Error", "msg box title");
-            icon = QIMessageBox::Critical;
-            break;
-        case Critical:
-            title = tr ("VirtualBox - Critical Error", "msg box title");
-            icon = QIMessageBox::Critical;
-            break;
-        case GuruMeditation:
-            title = "VirtualBox - Guru Meditation"; /* don't translate this */
-            icon = QIMessageBox::GuruMeditation;
-            break;
-    }
-
-    QIMessageBox *box = new QIMessageBox (title, aMessage, icon, aButton1, aButton2,
-                                          aButton3, aParent, aAutoConfirmId);
-
-    if (!aText1.isNull())
-        box->setButtonText (0, aText1);
-    if (!aText2.isNull())
-        box->setButtonText (1, aText2);
-    if (!aText3.isNull())
-        box->setButtonText (2, aText3);
-
-    if (!aDetails.isEmpty())
-        box->setDetailsText (aDetails);
-
-    if (aAutoConfirmId)
-    {
-        box->setFlagText (tr ("Do not show this message again", "msg box flag"));
-        box->setFlagChecked (false);
-    }
-
-    int rc = box->exec();
-
-    if (aAutoConfirmId)
-    {
-        if (box->isFlagChecked())
-        {
-            msgs << aAutoConfirmId;
-            vbox.SetExtraData (VBoxDefs::GUI_SuppressMessages, msgs.join (","));
-        }
-    }
-
-    delete box;
-
-    return rc;
-}
-
-/** @fn message (QWidget *, Type, const QString &, const char *, int, int,
- *               int, const QString &, const QString &, const QString &)
- *
- *  A shortcut to #message() that doesn't require to specify the details
- *  text (QString::null is assumed).
- */
-
-/** @fn messageYesNo (QWidget *, Type, const QString &, const QString &, const char *)
- *
- *  A shortcut to #message() that shows 'Yes' and 'No' buttons ('Yes' is the
- *  default) and returns true when the user selects Yes.
- */
-
-/** @fn messageYesNo (QWidget *, Type, const QString &, const char *)
- *
- *  A shortcut to #messageYesNo() that doesn't require to specify the details
- *  text (QString::null is assumed).
- */
-
-/**
- *  Shows a modal progress dialog using a CProgress object passed as an
- *  argument to track the progress.
- *
- *  @param aProgress    progress object to track
- *  @param aTitle       title prefix
- *  @param aParent      parent widget
- *  @param aMinDuration time (ms) that must pass before the dialog appears
- */
-bool VBoxProblemReporter::showModalProgressDialog (
-    CProgress &aProgress, const QString &aTitle, QWidget *aParent,
-    int aMinDuration)
-{
-    VBoxProgressDialog progressDlg (aProgress, aTitle, aMinDuration, aParent);
-
-    /* run the dialog with the 100 ms refresh interval */
-    progressDlg.run (350);
-
-    return true;
-}
-
-/**
- *  Returns what main window (selector or console) is now shown, or
- *  zero if none of them. The selector window takes precedence.
- */
-QWidget *VBoxProblemReporter::mainWindowShown() const
-{
-    /* It may happen that this method is called during VBoxGlobal
-     * initialization or even after it failed (for example, to show some
-     * error message). Return no main window in this case. */
-    if (!vboxGlobal().isValid())
-        return 0;
-
-#if defined (VBOX_GUI_SEPARATE_VM_PROCESS)
-    if (vboxGlobal().isVMConsoleProcess())
-    {
-        if (vboxGlobal().consoleWnd().isVisible())
-            return &vboxGlobal().consoleWnd();
-    }
-    else
-    {
-        if (vboxGlobal().selectorWnd().isVisible())
-            return &vboxGlobal().selectorWnd();
-    }
-#else
-    if (vboxGlobal().consoleWnd().isVisible())
-        return &vboxGlobal().consoleWnd();
-    if (vboxGlobal().selectorWnd().isVisible())
-        return &vboxGlobal().selectorWnd();
-#endif
-    return 0;
-}
-
-// Generic Problem handlers
-/////////////////////////////////////////////////////////////////////////////
-
-bool VBoxProblemReporter::askForOverridingFile (const QString& aPath, QWidget *aParent /* = NULL */) const
-{
-    return messageYesNo (aParent, Question, tr ("A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.").arg (aPath));
-}
-
-bool VBoxProblemReporter::askForOverridingFiles (const QVector<QString>& aPaths, QWidget *aParent /* = NULL */) const
-{
-    if (aPaths.size() == 1)
-        /* If it is only one file use the single question versions above */
-        return askForOverridingFile (aPaths.at (0), aParent);
-    else if (aPaths.size() > 1)
-        return messageYesNo (aParent, Question, tr ("The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.").arg (QStringList(aPaths.toList()).join ("<br />")));
-    else
-        return true;
-}
-
-bool VBoxProblemReporter::askForOverridingFileIfExists (const QString& aPath, QWidget *aParent /* = NULL */) const
-{
-    QFileInfo fi (aPath);
-    if (fi.exists())
-        return askForOverridingFile (aPath, aParent);
-    else
-        return true;
-}
-
-bool VBoxProblemReporter::askForOverridingFilesIfExists (const QVector<QString>& aPaths, QWidget *aParent /* = NULL */) const
-{
-    QVector<QString> existingFiles;
-    foreach (const QString &file, aPaths)
-    {
-        QFileInfo fi (file);
-        if (fi.exists())
-            existingFiles << fi.absoluteFilePath();
-    }
-    if (existingFiles.size() == 1)
-        /* If it is only one file use the single question versions above */
-        return askForOverridingFileIfExists (existingFiles.at (0), aParent);
-    else if (existingFiles.size() > 1)
-        return askForOverridingFiles (existingFiles, aParent);
-    else
-        return true;
-}
-
-void VBoxProblemReporter::cannotDeleteFile (const QString& path, QWidget *aParent /* = NULL */) const
-{
-    message (aParent, Error,
-             tr ("Failed to remove the file <b>%1</b>.<br /><br />Please try to remove the file yourself and try again.")
-             .arg (path));
-}
-
-void VBoxProblemReporter::checkForMountedWrongUSB() const
-{
-#ifdef RT_OS_LINUX
-    QFile file ("/proc/mounts");
-    if (file.exists() && file.open (QIODevice::ReadOnly | QIODevice::Text))
-    {
-        QStringList contents;
-        for (;;)
-        {
-            QByteArray line = file.readLine();
-            if (line.isEmpty())
-                break;
-            contents << line;
-        }
-        QStringList grep1 (contents.filter ("/sys/bus/usb/drivers"));
-        QStringList grep2 (grep1.filter ("usbfs"));
-        if (!grep2.isEmpty())
-            message (mainWindowShown(), Warning,
-                     tr ("You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. "
-                         "We strongly recommend that you change this, as it is a severe mis-configuration of "
-                         "your system which could cause USB devices to fail in unexpected ways."),
-                     "checkForMountedWrongUSB");
-    }
-#endif
-}
-
-// Special Problem handlers
-/////////////////////////////////////////////////////////////////////////////
-
-void VBoxProblemReporter::showBETAWarning()
-{
-    message
-        (0, Warning,
-         tr ("You are running a prerelease version of VirtualBox. "
-             "This version is not suitable for production use."));
-}
-
-void VBoxProblemReporter::showBEBWarning()
-{
-    message
-        (0, Warning,
-         tr ("You are running an EXPERIMENTAL build of VirtualBox. "
-             "This version is not suitable for production use."));
-}
-
-#ifdef Q_WS_X11
-void VBoxProblemReporter::cannotFindLicenseFiles (const QString &aPath)
-{
-    message
-        (0, VBoxProblemReporter::Error,
-         tr ("Failed to find license files in "
-             "<nobr><b>%1</b></nobr>.")
-             .arg (aPath));
-}
-
-void VBoxProblemReporter::cannotOpenLicenseFile (QWidget *aParent,
-                                                 const QString &aPath)
-{
-    message
-        (aParent, VBoxProblemReporter::Error,
-         tr ("Failed to open the license file <nobr><b>%1</b></nobr>. "
-             "Check file permissions.")
-             .arg (aPath));
-}
-#endif
-
-void VBoxProblemReporter::cannotOpenURL (const QString &aURL)
-{
-    message
-        (mainWindowShown(), VBoxProblemReporter::Error,
-         tr ("Failed to open <tt>%1</tt>. Make sure your desktop environment "
-             "can properly handle URLs of this type.")
-         .arg (aURL));
-}
-
-void VBoxProblemReporter::
-cannotCopyFile (const QString &aSrc, const QString &aDst, int aVRC)
-{
-    PCRTSTATUSMSG msg = RTErrGet (aVRC);
-    Assert (msg);
-
-    QString err = QString ("%1: %2").arg (msg->pszDefine, msg->pszMsgShort);
-    if (err.endsWith ("."))
-        err.truncate (err.length() - 1);
-
-    message (mainWindowShown(), VBoxProblemReporter::Error,
-        tr ("Failed to copy file <b><nobr>%1</nobr></b> to "
-             "<b><nobr>%2</nobr></b> (%3).")
-             .arg (aSrc, aDst, err));
-}
-
-void VBoxProblemReporter::cannotFindLanguage (const QString &aLangID,
-                                              const QString &aNlsPath)
-{
-    message (0, VBoxProblemReporter::Error,
-        tr ("<p>Could not find a language file for the language "
-            "<b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>"
-            "<p>The language will be temporarily reset to the system "
-            "default language. Please go to the <b>Preferences</b> "
-            "dialog which you can open from the <b>File</b> menu of the "
-            "main VirtualBox window, and select one of the existing "
-            "languages on the <b>Language</b> page.</p>")
-             .arg (aLangID).arg (aNlsPath));
-}
-
-void VBoxProblemReporter::cannotLoadLanguage (const QString &aLangFile)
-{
-    message (0, VBoxProblemReporter::Error,
-        tr ("<p>Could not load the language file <b><nobr>%1</nobr></b>. "
-            "<p>The language will be temporarily reset to English (built-in). "
-            "Please go to the <b>Preferences</b> "
-            "dialog which you can open from the <b>File</b> menu of the "
-            "main VirtualBox window, and select one of the existing "
-            "languages on the <b>Language</b> page.</p>")
-             .arg (aLangFile));
-}
-
-void VBoxProblemReporter::cannotInitCOM (HRESULT rc)
-{
-    message (0, Critical,
-        tr ("<p>Failed to initialize COM or to find the VirtualBox COM server. "
-            "Most likely, the VirtualBox server is not running "
-            "or failed to start.</p>"
-            "<p>The application will now terminate.</p>"),
-        formatErrorInfo (COMErrorInfo(), rc));
-}
-
-void VBoxProblemReporter::cannotCreateVirtualBox (const CVirtualBox &vbox)
-{
-    message (0, Critical,
-        tr ("<p>Failed to create the VirtualBox COM object.</p>"
-            "<p>The application will now terminate.</p>"),
-        formatErrorInfo (vbox));
-}
-
-void VBoxProblemReporter::cannotSaveGlobalSettings (const CVirtualBox &vbox,
-                                                    QWidget *parent /* = 0 */)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (vbox);
-
-    message (parent ? parent : mainWindowShown(), Error,
-             tr ("<p>Failed to save the global VirtualBox settings to "
-                 "<b><nobr>%1</nobr></b>.</p>")
-                 .arg (vbox.GetSettingsFilePath()),
-             formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotLoadGlobalConfig (const CVirtualBox &vbox,
-                                                  const QString &error)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (vbox);
-
-    message (mainWindowShown(), Critical,
-        tr ("<p>Failed to load the global GUI configuration from "
-            "<b><nobr>%1</nobr></b>.</p>"
-            "<p>The application will now terminate.</p>")
-             .arg (vbox.GetSettingsFilePath()),
-        !res.isOk() ? formatErrorInfo (res)
-                    : QString ("<p>%1.</p>").arg (vboxGlobal().emphasize (error)));
-}
-
-void VBoxProblemReporter::cannotSaveGlobalConfig (const CVirtualBox &vbox)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (vbox);
-
-    message (mainWindowShown(), Critical,
-        tr ("<p>Failed to save the global GUI configuration to "
-            "<b><nobr>%1</nobr></b>.</p>"
-            "<p>The application will now terminate.</p>")
-             .arg (vbox.GetSettingsFilePath()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotSetSystemProperties (const CSystemProperties &props)
-{
-    message (mainWindowShown(), Critical,
-        tr ("Failed to set global VirtualBox properties."),
-        formatErrorInfo (props));
-}
-
-void VBoxProblemReporter::cannotAccessUSB (const COMBaseWithEI &aObj)
-{
-    /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return
-     * E_NOTIMPL, it means the USB support is intentionally missing
-     * (as in the OSE version). Don't show the error message in this case. */
-    COMResult res (aObj);
-    if (res.rc() == E_NOTIMPL)
-        return;
-
-#ifdef RT_OS_LINUX
-    /* xxx There is no macro to turn an error into a warning, but we need
-     *     to do that here. */
-    if (res.rc() == (VBOX_E_HOST_ERROR & ~0x80000000))
-    {
-        message (mainWindowShown(), VBoxProblemReporter::Warning,
-                 tr ("Could not access USB on the host system, because "
-                     "neither the USB file system (usbfs) nor the DBus "
-                     "and hal services are currently available. If you "
-                     "wish to use host USB devices inside guest systems, "
-                     "you must correct this and restart VirtualBox."),
-                 formatErrorInfo (res),
-                 "cannotAccessUSB" /* aAutoConfirmId */);
-        return;
-    }
-#endif
-    message (mainWindowShown(), res.isWarning() ? Warning : Error,
-             tr ("Failed to access the USB subsystem."),
-             formatErrorInfo (res),
-             "cannotAccessUSB");
-}
-
-void VBoxProblemReporter::cannotCreateMachine (const CVirtualBox &vbox,
-                                               QWidget *parent /* = 0 */)
-{
-    message (
-        parent ? parent : mainWindowShown(),
-        Error,
-        tr ("Failed to create a new virtual machine."),
-        formatErrorInfo (vbox)
-    );
-}
-
-void VBoxProblemReporter::cannotCreateMachine (const CVirtualBox &vbox,
-                                               const CMachine &machine,
-                                               QWidget *parent /* = 0 */)
-{
-    message (
-        parent ? parent : mainWindowShown(),
-        Error,
-        tr ("Failed to create a new virtual machine <b>%1</b>.")
-            .arg (machine.GetName()),
-        formatErrorInfo (vbox)
-    );
-}
-
-void VBoxProblemReporter::
-cannotApplyMachineSettings (const CMachine &machine, const COMResult &res)
-{
-    message (
-        mainWindowShown(),
-        Error,
-        tr ("Failed to apply the settings to the virtual machine <b>%1</b>.")
-            .arg (machine.GetName()),
-        formatErrorInfo (res)
-    );
-}
-
-void VBoxProblemReporter::cannotSaveMachineSettings (const CMachine &machine,
-                                                     QWidget *parent /* = 0 */)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (machine);
-
-    message (parent ? parent : mainWindowShown(), Error,
-             tr ("Failed to save the settings of the virtual machine "
-                 "<b>%1</b> to <b><nobr>%2</nobr></b>.")
-                 .arg (machine.GetName(), machine.GetSettingsFilePath()),
-             formatErrorInfo (res));
-}
-
-/**
- * @param  strict  If |false|, this method will silently return if the COM
- *                 result code is E_NOTIMPL.
- */
-void VBoxProblemReporter::cannotLoadMachineSettings (const CMachine &machine,
-                                                     bool strict /* = true */,
-                                                     QWidget *parent /* = 0 */)
-{
-    /* If COM result code is E_NOTIMPL, it means the requested object or
-     * function is intentionally missing (as in the OSE version). Don't show
-     * the error message in this case. */
-    COMResult res (machine);
-    if (!strict && res.rc() == E_NOTIMPL)
-        return;
-
-    message (parent ? parent : mainWindowShown(), Error,
-             tr ("Failed to load the settings of the virtual machine "
-                 "<b>%1</b> from <b><nobr>%2</nobr></b>.")
-                .arg (machine.GetName(), machine.GetSettingsFilePath()),
-             formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotStartMachine (const CConsole &console)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to start the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotStartMachine (const CProgress &progress)
-{
-    AssertWrapperOk (progress);
-    CConsole console (CProgress (progress).GetInitiator());
-    AssertWrapperOk (console);
-
-    message (
-        mainWindowShown(),
-        Error,
-        tr ("Failed to start the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (progress.GetErrorInfo())
-    );
-}
-
-void VBoxProblemReporter::cannotPauseMachine (const CConsole &console)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to pause the execution of the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotResumeMachine (const CConsole &console)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (mainWindowShown(),  Error,
-        tr ("Failed to resume the execution of the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotACPIShutdownMachine (const CConsole &console)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (mainWindowShown(),  Error,
-        tr ("Failed to send the ACPI Power Button press event to the "
-            "virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotSaveMachineState (const CConsole &console)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to save the state of the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotSaveMachineState (const CProgress &progress)
-{
-    AssertWrapperOk (progress);
-    CConsole console (CProgress (progress).GetInitiator());
-    AssertWrapperOk (console);
-
-    message (
-        mainWindowShown(),
-        Error,
-        tr ("Failed to save the state of the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (progress.GetErrorInfo())
-    );
-}
-
-void VBoxProblemReporter::cannotTakeSnapshot (const CConsole &console)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to create a snapshot of the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotTakeSnapshot (const CProgress &progress)
-{
-    AssertWrapperOk (progress);
-    CConsole console (CProgress (progress).GetInitiator());
-    AssertWrapperOk (console);
-
-    message (
-        mainWindowShown(),
-        Error,
-        tr ("Failed to create a snapshot of the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (progress.GetErrorInfo())
-    );
-}
-
-void VBoxProblemReporter::cannotStopMachine (const CConsole &console)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to stop the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotStopMachine (const CProgress &progress)
-{
-    AssertWrapperOk (progress);
-    CConsole console (CProgress (progress).GetInitiator());
-    AssertWrapperOk (console);
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to stop the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (progress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotDeleteMachine (const CVirtualBox &vbox,
-                                               const CMachine &machine)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (machine);
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to remove the virtual machine <b>%1</b>.")
-            .arg (machine.GetName()),
-        !vbox.isOk() ? formatErrorInfo (vbox) : formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotDiscardSavedState (const CConsole &console)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to discard the saved state of the virtual machine <b>%1</b>.")
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotSendACPIToMachine()
-{
-    message (mainWindowShown(),  Warning,
-        tr ("You are trying to shut down the guest with the ACPI power "
-            "button. This is currently not possible because the guest "
-            "does not support software shutdown."));
-}
-
-bool VBoxProblemReporter::warnAboutVirtNotEnabled64BitsGuest()
-{
-    return messageOkCancel (mainWindowShown(), Error,
-        tr ("<p>VT-x/AMD-V hardware acceleration has been enabled, but is "
-            "not operational. Your 64-bit guest will fail to detect a "
-            "64-bit CPU and will not be able to boot.</p><p>Please ensure "
-            "that you have enabled VT-x/AMD-V properly in the BIOS of your "
-            "host computer.</p>"),
-        0 /* aAutoConfirmId */,
-        tr ("Close VM"), tr ("Continue"));
-}
-
-bool VBoxProblemReporter::warnAboutVirtNotEnabledGuestRequired()
-{
-    return messageOkCancel (mainWindowShown(), Error,
-        tr ("<p>VT-x/AMD-V hardware acceleration has been enabled, but is "
-            "not operational. Certain guests (e.g. OS/2 and QNX) require "
-            "this feature.</p><p>Please ensure "
-            "that you have enabled VT-x/AMD-V properly in the BIOS of your "
-            "host computer.</p>"),
-        0 /* aAutoConfirmId */,
-        tr ("Close VM"), tr ("Continue"));
-}
-
-void VBoxProblemReporter::cannotSetSnapshotFolder (const CMachine &aMachine,
-                                                   const QString &aPath)
-{
-    message (
-        mainWindowShown(),
-        Error,
-        tr ("Failed to change the snapshot folder path of the "
-            "virtual machine <b>%1<b> to <nobr><b>%2</b></nobr>.")
-            .arg (aMachine.GetName())
-            .arg (aPath),
-        formatErrorInfo (aMachine));
-}
-
-bool VBoxProblemReporter::askAboutSnapshotRestoring (const QString &aSnapshotName)
-{
-    return messageOkCancel (mainWindowShown(), Question,
-        tr ("<p>Are you sure you want to restore snapshot <b>%1</b>? "
-            "This will cause you to lose your current machine state, which cannot be recovered.</p>")
-            .arg (aSnapshotName),
-        /* Do NOT allow this message to be disabled! */
-        NULL /* aAutoConfirmId */,
-        tr ("Restore"), tr ("Cancel"));
-}
-
-bool VBoxProblemReporter::askAboutSnapshotDeleting (const QString &aSnapshotName)
-{
-    return messageOkCancel (mainWindowShown(), Question,
-        tr ("<p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over "
-            "several image files that VirtualBox has created together with the snapshot will be merged into one file. This can be a lengthy process, and the information "
-            "in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>")
-            .arg (aSnapshotName),
-        /* Do NOT allow this message to be disabled! */
-        NULL /* aAutoConfirmId */,
-        tr ("Delete"), tr ("Cancel"));
-}
-
-void VBoxProblemReporter::cannotRestoreSnapshot (const CConsole &aConsole,
-                                                 const QString &aSnapshotName)
-{
-    message (mainWindowShown(), Error,
-        tr ("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
-            .arg (aSnapshotName)
-            .arg (CConsole (aConsole).GetMachine().GetName()),
-        formatErrorInfo (aConsole));
-}
-
-void VBoxProblemReporter::cannotRestoreSnapshot (const CProgress &aProgress,
-                                                 const QString &aSnapshotName)
-{
-    CConsole console (CProgress (aProgress).GetInitiator());
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
-            .arg (aSnapshotName)
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (aProgress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotDeleteSnapshot (const CConsole &aConsole,
-                                                const QString &aSnapshotName)
-{
-    message (mainWindowShown(), Error,
-        tr ("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
-            .arg (aSnapshotName)
-            .arg (CConsole (aConsole).GetMachine().GetName()),
-        formatErrorInfo (aConsole));
-}
-
-void VBoxProblemReporter::cannotDeleteSnapshot (const CProgress &aProgress,
-                                                const QString &aSnapshotName)
-{
-    CConsole console (CProgress (aProgress).GetInitiator());
-
-    message (mainWindowShown(), Error,
-        tr ("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
-            .arg (aSnapshotName)
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (aProgress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotFindMachineByName (const CVirtualBox &vbox,
-                                                   const QString &name)
-{
-    message (
-        mainWindowShown(),
-        Error,
-        tr ("There is no virtual machine named <b>%1</b>.")
-            .arg (name),
-        formatErrorInfo (vbox)
-    );
-}
-
-void VBoxProblemReporter::cannotEnterSeamlessMode (ULONG /* aWidth */,
-                                                   ULONG /* aHeight */,
-                                                   ULONG /* aBpp */,
-                                                   ULONG64 aMinVRAM)
-{
-    message (&vboxGlobal().consoleWnd(), Error,
-             tr ("<p>Could not enter seamless mode due to insufficient guest "
-                  "video memory.</p>"
-                  "<p>You should configure the virtual machine to have at "
-                  "least <b>%1</b> of video memory.</p>")
-             .arg (VBoxGlobal::formatSize (aMinVRAM)));
-}
-
-int VBoxProblemReporter::cannotEnterFullscreenMode (ULONG /* aWidth */,
-                                                    ULONG /* aHeight */,
-                                                    ULONG /* aBpp */,
-                                                    ULONG64 aMinVRAM)
-{
-    return message (&vboxGlobal().consoleWnd(), Warning,
-             tr ("<p>Could not switch the guest display to fullscreen mode due "
-                 "to insufficient guest video memory.</p>"
-                 "<p>You should configure the virtual machine to have at "
-                 "least <b>%1</b> of video memory.</p>"
-                 "<p>Press <b>Ignore</b> to switch to fullscreen mode anyway "
-                 "or press <b>Cancel</b> to cancel the operation.</p>")
-             .arg (VBoxGlobal::formatSize (aMinVRAM)),
-             0, /* aAutoConfirmId */
-             QIMessageBox::Ignore | QIMessageBox::Default,
-             QIMessageBox::Cancel | QIMessageBox::Escape);
-}
-
-bool VBoxProblemReporter::confirmMachineDeletion (const CMachine &machine)
-{
-    QString msg;
-    QString button;
-    QString name;
-
-    if (machine.GetAccessible())
-    {
-        name = machine.GetName();
-        msg = tr ("<p>Are you sure you want to permanently delete "
-                  "the virtual machine <b>%1</b>?</p>"
-                  "<p>This operation cannot be undone.</p>")
-                  .arg (name);
-        button = tr ("Delete", "machine");
-    }
-    else
-    {
-        /* this should be in sync with VBoxVMListBoxItem::recache() */
-        QFileInfo fi (machine.GetSettingsFilePath());
-        name = fi.suffix().toLower() == "xml" ?
-               fi.completeBaseName() : fi.fileName();
-        msg = tr ("<p>Are you sure you want to unregister the inaccessible "
-                  "virtual machine <b>%1</b>?</p>"
-                  "<p>You will not be able to register it again from "
-                  "GUI.</p>")
-                  .arg (name);
-        button = tr ("Unregister", "machine");
-    }
-
-    return messageOkCancel (&vboxGlobal().selectorWnd(), Question, msg,
-                            0 /* aAutoConfirmId */, button);
-}
-
-bool VBoxProblemReporter::confirmDiscardSavedState (const CMachine &machine)
-{
-    return messageOkCancel (&vboxGlobal().selectorWnd(), Question,
-        tr ("<p>Are you sure you want to discard the saved state of "
-            "the virtual machine <b>%1</b>?</p>"
-            "<p>This operation is equivalent to resetting or powering off "
-            "the machine without doing a proper shutdown of the "
-            "guest OS.</p>")
-            .arg (machine.GetName()),
-        0 /* aAutoConfirmId */,
-        tr ("Discard", "saved state"));
-}
-
-bool VBoxProblemReporter::confirmReleaseMedium (QWidget *aParent,
-                                                const VBoxMedium &aMedium,
-                                                const QString &aUsage)
-{
-    /** @todo (translation-related): the gender of "the" in translations
-     * will depend on the gender of aMedium.type(). */
-    return messageOkCancel (aParent, Question,
-        tr ("<p>Are you sure you want to release the %1 "
-            "<nobr><b>%2</b></nobr>?</p>"
-            "<p>This will detach it from the "
-            "following virtual machine(s): <b>%3</b>.</p>")
-            .arg (mediumToAccusative (aMedium.type()))
-            .arg (aMedium.location())
-            .arg (aUsage),
-        0 /* aAutoConfirmId */,
-        tr ("Release", "detach medium"));
-}
-
-bool VBoxProblemReporter::confirmRemoveMedium (QWidget *aParent,
-                                               const VBoxMedium &aMedium)
-{
-    /** @todo (translation-related): the gender of "the" in translations
-     * will depend on the gender of aMedium.type(). */
-    QString msg =
-        tr ("<p>Are you sure you want to remove the %1 "
-            "<nobr><b>%2</b></nobr> from the list of known media?</p>")
-            .arg (mediumToAccusative (aMedium.type()))
-            .arg (aMedium.location());
-
-    if (aMedium.type() == VBoxDefs::MediumType_HardDisk)
-    {
-        if (aMedium.state() == KMediumState_Inaccessible)
-            msg +=
-                tr ("Note that as this hard disk is inaccessible its "
-                    "storage unit cannot be deleted right now.");
-        else
-            msg +=
-                tr ("The next dialog will let you choose whether you also "
-                    "want to delete the storage unit of this hard disk or "
-                    "keep it for later usage.");
-    }
-    else
-        msg +=
-            tr ("<p>Note that the storage unit of this medium will not be "
-                "deleted and that it will be possible to add it to "
-                "the list later again.</p>");
-
-    return messageOkCancel (aParent, Question, msg,
-        "confirmRemoveMedium", /* aAutoConfirmId */
-        tr ("Remove", "medium"));
-}
-
-void VBoxProblemReporter::sayCannotOverwriteHardDiskStorage (
-    QWidget *aParent, const QString &aLocation)
-{
-    message (aParent, Info,
-        tr ("<p>The hard disk storage unit at location <b>%1</b> already "
-            "exists. You cannot create a new virtual hard disk that uses this "
-            "location because it can be already used by another virtual hard "
-            "disk.</p>"
-            "<p>Please specify a different location.</p>")
-            .arg (aLocation));
-}
-
-int VBoxProblemReporter::confirmDeleteHardDiskStorage (
-    QWidget *aParent, const QString &aLocation)
-{
-    return message (aParent, Question,
-        tr ("<p>Do you want to delete the storage unit of the hard disk "
-            "<nobr><b>%1</b></nobr>?</p>"
-            "<p>If you select <b>Delete</b> then the specified storage unit "
-            "will be permanently deleted. This operation <b>cannot be "
-            "undone</b>.</p>"
-            "<p>If you select <b>Keep</b> then the hard disk will be only "
-            "removed from the list of known hard disks, but the storage unit "
-            "will be left untouched which makes it possible to add this hard "
-            "disk to the list later again.</p>")
-            .arg (aLocation),
-        0, /* aAutoConfirmId */
-        QIMessageBox::Yes,
-        QIMessageBox::No | QIMessageBox::Default,
-        QIMessageBox::Cancel | QIMessageBox::Escape,
-        tr ("Delete", "hard disk storage"),
-        tr ("Keep", "hard disk storage"));
-}
-
-void VBoxProblemReporter::cannotDeleteHardDiskStorage (QWidget *aParent,
-                                                       const CMedium &aHD,
-                                                       const CProgress &aProgress)
-{
-    /* below, we use CMedium (aHD) to preserve current error info
-     * for formatErrorInfo() */
-
-    message (aParent, Error,
-        tr ("Failed to delete the storage unit of the hard disk <b>%1</b>.")
-            .arg (CMedium (aHD).GetLocation()),
-        !aHD.isOk() ? formatErrorInfo (aHD) :
-        !aProgress.isOk() ? formatErrorInfo (aProgress) :
-        formatErrorInfo (aProgress.GetErrorInfo()));
-}
-
-int VBoxProblemReporter::confirmDetachAddControllerSlots (QWidget *aParent) const
-{
-    return messageOkCancel (aParent, Question,
-        tr ("<p>There are hard disks attached to ports of the additional controller. "
-            "If you disable the additional controller, all these hard disks "
-            "will be automatically detached.</p>"
-            "<p>Are you sure you want to "
-            "disable the additional controller?</p>"),
-        0 /* aAutoConfirmId */,
-        tr ("Disable", "hard disk"));
-}
-
-int VBoxProblemReporter::confirmChangeAddControllerSlots (QWidget *aParent) const
-{
-    return messageOkCancel (aParent, Question,
-        tr ("<p>There are hard disks attached to ports of the additional controller. "
-            "If you change the additional controller, all these hard disks "
-            "will be automatically detached.</p>"
-            "<p>Are you sure you want to "
-            "change the additional controller?</p>"),
-        0 /* aAutoConfirmId */,
-        tr ("Change", "hard disk"));
-}
-
-int VBoxProblemReporter::confirmRunNewHDWzdOrVDM (KDeviceType aDeviceType)
-{
-    switch (aDeviceType)
-    {
-        case KDeviceType_HardDisk:
-            return message (QApplication::activeWindow(), Info,
-                            tr ("<p>There are no unused media available for the newly "
-                                "created attachment.</p>"
-                                "<p>Press the <b>Create</b> button to start the <i>New "
-                                "Virtual Disk</i> wizard and create a new medium, "
-                                "or press the <b>Select</b> if you wish to open the <i>Virtual "
-                                "Media Manager</i>.</p>"),
-                            0, /* aAutoConfirmId */
-                            QIMessageBox::Yes,
-                            QIMessageBox::No | QIMessageBox::Default,
-                            QIMessageBox::Cancel | QIMessageBox::Escape,
-                            tr ("&Create", "medium"),
-                            tr ("&Select", "medium"));
-        default:
-            return message (QApplication::activeWindow(), Info,
-                            tr ("<p>There are no unused media available for the newly "
-                                "created attachment.</p>"
-                                "<p>Press the <b>Select</b> if you wish to open the <i>Virtual "
-                                "Media Manager</i>.</p>"),
-                            0, /* aAutoConfirmId */
-                            QIMessageBox::No | QIMessageBox::Default,
-                            QIMessageBox::Cancel | QIMessageBox::Escape,
-                            0,
-                            tr ("&Select", "medium"));
-    }
-    return QIMessageBox::Cancel;
-}
-
-int VBoxProblemReporter::confirmRemovingOfLastDVDDevice() const
-{
-    return messageOkCancel (QApplication::activeWindow(), Info,
-                            tr ("<p>Are you sure you want to delete the CD/DVD-ROM device?</p>"
-                                "<p>You will not be able to mount any CDs or ISO images "
-                                "or install the Guest Additions without it!</p>"),
-                            0, /* aAutoConfirmId */
-                            tr ("&Remove", "medium"));
-}
-
-void VBoxProblemReporter::cannotCreateHardDiskStorage (
-    QWidget *aParent, const CVirtualBox &aVBox, const QString &aLocation,
-    const CMedium &aHD, const CProgress &aProgress)
-{
-    message (aParent, Error,
-        tr ("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
-            .arg (aLocation),
-        !aVBox.isOk() ? formatErrorInfo (aVBox) :
-        !aHD.isOk() ? formatErrorInfo (aHD) :
-        !aProgress.isOk() ? formatErrorInfo (aProgress) :
-        formatErrorInfo (aProgress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotAttachDevice (QWidget *aParent, const CMachine &aMachine,
-                                              VBoxDefs::MediumType aType, const QString &aLocation,
-                                              KStorageBus aBus, LONG aChannel, LONG aDevice)
-{
-    QString what (deviceToAccusative (aType));
-    if (!aLocation.isNull())
-        what += QString (" (<nobr><b>%1</b></nobr>)").arg (aLocation);
-
-    message (aParent, Error,
-             tr ("Failed to attach the %1 to slot <i>%2</i> of the machine <b>%3</b>.")
-                 .arg (what)
-                 .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice)))
-                 .arg (CMachine (aMachine).GetName()),
-             formatErrorInfo (aMachine));
-}
-
-void VBoxProblemReporter::cannotDetachDevice (QWidget *aParent, const CMachine &aMachine,
-                                              VBoxDefs::MediumType aType, const QString &aLocation,
-                                              KStorageBus aBus, LONG aChannel, LONG aDevice)
-{
-    QString what (deviceToAccusative (aType));
-    if (!aLocation.isNull())
-        what += QString (" (<nobr><b>%1</b></nobr>)").arg (aLocation);
-
-    message (aParent, Error,
-             tr ("Failed to detach the %1 from slot <i>%2</i> of the machine <b>%3</b>.")
-                 .arg (what)
-                 .arg (vboxGlobal().toString (StorageSlot (aBus, aChannel, aDevice)))
-                 .arg (CMachine (aMachine).GetName()),
-             formatErrorInfo (aMachine));
-}
-
-int VBoxProblemReporter::cannotRemountMedium (QWidget *aParent, const CMachine &aMachine,
-                                              const VBoxMedium &aMedium, bool aMount, bool aRetry)
-{
-    /** @todo (translation-related): the gender of "the" in translations
-     * will depend on the gender of aMedium.type(). */
-    QString text;
-    if (aMount)
-    {
-        text = tr ("Unable to mount the %1 <nobr><b>%2</b></nobr> on the machine <b>%3</b>.");
-        if (aRetry) text += tr (" Would you like to force mounting of this medium?");
-    }
-    else
-    {
-        text = tr ("Unable to unmount the %1 <nobr><b>%2</b></nobr> from the machine <b>%3</b>.");
-        if (aRetry) text += tr (" Would you like to force unmounting of this medium?");
-    }
-    if (aRetry)
-    {
-        return messageOkCancel (aParent, Question, text
-            .arg (mediumToAccusative (aMedium.type(), aMedium.isHostDrive()))
-            .arg (aMedium.isHostDrive() ? aMedium.name() : aMedium.location())
-            .arg (CMachine (aMachine).GetName()),
-            formatErrorInfo (aMachine),
-            0 /* Auto Confirm ID */,
-            tr ("Force Unmount"));
-    }
-    else
-    {
-        return message (aParent, Error, text
-            .arg (mediumToAccusative (aMedium.type(), aMedium.isHostDrive()))
-            .arg (aMedium.isHostDrive() ? aMedium.name() : aMedium.location())
-            .arg (CMachine (aMachine).GetName()),
-            formatErrorInfo (aMachine));
-    }
-}
-
-void VBoxProblemReporter::cannotOpenMedium (
-    QWidget *aParent, const CVirtualBox &aVBox,
-    VBoxDefs::MediumType aType, const QString &aLocation)
-{
-    /** @todo (translation-related): the gender of "the" in translations
-     * will depend on the gender of aMedium.type(). */
-    message (aParent, Error,
-        tr ("Failed to open the %1 <nobr><b>%2</b></nobr>.")
-            .arg (mediumToAccusative (aType))
-            .arg (aLocation),
-        formatErrorInfo (aVBox));
-}
-
-void VBoxProblemReporter::cannotCloseMedium (
-    QWidget *aParent, const VBoxMedium &aMedium, const COMResult &aResult)
-{
-    /** @todo (translation-related): the gender of "the" in translations
-     * will depend on the gender of aMedium.type(). */
-    message (aParent, Error,
-        tr ("Failed to close the %1 <nobr><b>%2</b></nobr>.")
-            .arg (mediumToAccusative (aMedium.type()))
-            .arg (aMedium.location()),
-        formatErrorInfo (aResult));
-}
-
-void VBoxProblemReporter::cannotEjectDrive()
-{
-    message (mainWindowShown(), Warning,
-             tr ("Failed to eject the disk from the virtual drive. "
-                 "The drive may be locked by the guest operating system. "
-                 "Please check this and try again."));
-}
-
-void VBoxProblemReporter::cannotOpenSession (const CSession &session)
-{
-    Assert (session.isNull());
-
-    message (
-        mainWindowShown(),
-        Error,
-        tr ("Failed to create a new session."),
-        formatErrorInfo (session)
-    );
-}
-
-void VBoxProblemReporter::cannotOpenSession (
-    const CVirtualBox &vbox, const CMachine &machine,
-    const CProgress &progress
-) {
-    Assert (!vbox.isOk() || progress.isOk());
-
-    QString name = machine.GetName();
-    if (name.isEmpty())
-        name = QFileInfo (machine.GetSettingsFilePath()).baseName();
-
-    message (
-        mainWindowShown(),
-        Error,
-        tr ("Failed to open a session for the virtual machine <b>%1</b>.")
-            .arg (name),
-        !vbox.isOk() ? formatErrorInfo (vbox) :
-                       formatErrorInfo (progress.GetErrorInfo())
-    );
-}
-
-void VBoxProblemReporter::cannotGetMediaAccessibility (const VBoxMedium &aMedium)
-{
-    message (qApp->activeWindow(), Error,
-        tr ("Failed to determine the accessibility state of the medium "
-            "<nobr><b>%1</b></nobr>.")
-            .arg (aMedium.location()),
-        formatErrorInfo (aMedium.result()));
-}
-
-int VBoxProblemReporter::confirmDeletingHostInterface (const QString &aName,
-                                                       QWidget *aParent)
-{
-    return vboxProblem().message (aParent, VBoxProblemReporter::Question,
-        tr ("<p>Deleting this host-only network will remove "
-            "the host-only interface this network is based on. Do you want to "
-            "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>"
-            "<p><b>Note:</b> this interface may be in use by one or more "
-            "virtual network adapters belonging to one of your VMs. "
-            "After it is removed, these adapters will no longer be usable until "
-            "you correct their settings by either choosing a different interface "
-            "name or a different adapter attachment type.</p>").arg (aName),
-        0, /* autoConfirmId */
-        QIMessageBox::Ok | QIMessageBox::Default,
-        QIMessageBox::Cancel | QIMessageBox::Escape);
-}
-
-void VBoxProblemReporter::cannotCreateHostInterface (
-    const CHost &host, QWidget *parent)
-{
-    message (parent ? parent : mainWindowShown(), Error,
-        tr ("Failed to create the host-only network interface."),
-        formatErrorInfo (host));
-}
-
-void VBoxProblemReporter::cannotCreateHostInterface (
-    const CProgress &progress, QWidget *parent)
-{
-    message (parent ? parent : mainWindowShown(), Error,
-        tr ("Failed to create the host-only network interface."),
-        formatErrorInfo (progress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotRemoveHostInterface (
-    const CHost &host, const CHostNetworkInterface &iface, QWidget *parent)
-{
-    message (parent ? parent : mainWindowShown(), Error,
-        tr ("Failed to remove the host network interface <b>%1</b>.")
-            .arg (iface.GetName()),
-        formatErrorInfo (host));
-}
-
-void VBoxProblemReporter::cannotRemoveHostInterface (
-    const CProgress &progress, const CHostNetworkInterface &iface, QWidget *parent)
-{
-    message (parent ? parent : mainWindowShown(), Error,
-        tr ("Failed to remove the host network interface <b>%1</b>.")
-            .arg (iface.GetName()),
-        formatErrorInfo (progress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotAttachUSBDevice (const CConsole &console,
-                                                 const QString &device)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (&vboxGlobal().consoleWnd(), Error,
-        tr ("Failed to attach the USB device <b>%1</b> "
-            "to the virtual machine <b>%2</b>.")
-            .arg (device)
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotAttachUSBDevice (const CConsole &console,
-                                                 const QString &device,
-                                                 const CVirtualBoxErrorInfo &error)
-{
-    message (&vboxGlobal().consoleWnd(), Error,
-        tr ("Failed to attach the USB device <b>%1</b> "
-            "to the virtual machine <b>%2</b>.")
-            .arg (device)
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (error));
-}
-
-void VBoxProblemReporter::cannotDetachUSBDevice (const CConsole &console,
-                                                 const QString &device)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (console);
-
-    message (&vboxGlobal().consoleWnd(), Error,
-        tr ("Failed to detach the USB device <b>%1</b> "
-            "from the virtual machine <b>%2</b>.")
-            .arg (device)
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotDetachUSBDevice (const CConsole &console,
-                                                 const QString &device,
-                                                 const CVirtualBoxErrorInfo &error)
-{
-    message (&vboxGlobal().consoleWnd(), Error,
-        tr ("Failed to detach the USB device <b>%1</b> "
-            "from the virtual machine <b>%2</b>.")
-            .arg (device)
-            .arg (console.GetMachine().GetName()),
-        formatErrorInfo (error));
-}
-
-void VBoxProblemReporter::cannotCreateSharedFolder (QWidget        *aParent,
-                                                    const CMachine &aMachine,
-                                                    const QString  &aName,
-                                                    const QString  &aPath)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (aMachine);
-
-    message (aParent, Error,
-             tr ("Failed to create the shared folder <b>%1</b> "
-                 "(pointing to <nobr><b>%2</b></nobr>) "
-                 "for the virtual machine <b>%3</b>.")
-                 .arg (aName)
-                 .arg (aPath)
-                 .arg (aMachine.GetName()),
-             formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotRemoveSharedFolder (QWidget        *aParent,
-                                                    const CMachine &aMachine,
-                                                    const QString  &aName,
-                                                    const QString  &aPath)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (aMachine);
-
-    message (aParent, Error,
-             tr ("Failed to remove the shared folder <b>%1</b> "
-                 "(pointing to <nobr><b>%2</b></nobr>) "
-                 "from the virtual machine <b>%3</b>.")
-                 .arg (aName)
-                 .arg (aPath)
-                 .arg (aMachine.GetName()),
-             formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotCreateSharedFolder (QWidget        *aParent,
-                                                    const CConsole &aConsole,
-                                                    const QString  &aName,
-                                                    const QString  &aPath)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (aConsole);
-
-    message (aParent, Error,
-             tr ("Failed to create the shared folder <b>%1</b> "
-                 "(pointing to <nobr><b>%2</b></nobr>) "
-                 "for the virtual machine <b>%3</b>.")
-                 .arg (aName)
-                 .arg (aPath)
-                 .arg (aConsole.GetMachine().GetName()),
-             formatErrorInfo (res));
-}
-
-void VBoxProblemReporter::cannotRemoveSharedFolder (QWidget        *aParent,
-                                                    const CConsole &aConsole,
-                                                    const QString  &aName,
-                                                    const QString  &aPath)
-{
-    /* preserve the current error info before calling the object again */
-    COMResult res (aConsole);
-
-    message (aParent, Error,
-             tr ("<p>Failed to remove the shared folder <b>%1</b> "
-                 "(pointing to <nobr><b>%2</b></nobr>) "
-                 "from the virtual machine <b>%3</b>.</p>"
-                 "<p>Please close all programs in the guest OS that "
-                 "may be using this shared folder and try again.</p>")
-                 .arg (aName)
-                 .arg (aPath)
-                 .arg (aConsole.GetMachine().GetName()),
-             formatErrorInfo (res));
-}
-
-int VBoxProblemReporter::cannotFindGuestAdditions (const QString &aSrc1,
-                                                   const QString &aSrc2)
-{
-    return message (&vboxGlobal().consoleWnd(), Question,
-                    tr ("<p>Could not find the VirtualBox Guest Additions "
-                        "CD image file <nobr><b>%1</b></nobr> or "
-                        "<nobr><b>%2</b>.</nobr></p><p>Do you wish to "
-                        "download this CD image from the Internet?</p>")
-                        .arg (aSrc1).arg (aSrc2),
-                    0, /* aAutoConfirmId */
-                    QIMessageBox::Yes | QIMessageBox::Default,
-                    QIMessageBox::No | QIMessageBox::Escape);
-}
-
-void VBoxProblemReporter::cannotDownloadGuestAdditions (const QString &aURL,
-                                                        const QString &aReason)
-{
-    message (&vboxGlobal().consoleWnd(), Error,
-             tr ("<p>Failed to download the VirtualBox Guest Additions CD "
-                 "image from <nobr><a href=\"%1\">%2</a>.</nobr></p><p>%3</p>")
-                 .arg (aURL).arg (aURL).arg (aReason));
-}
-
-void VBoxProblemReporter::cannotMountGuestAdditions (const QString &aMachineName)
-{
-    message (&vboxGlobal().consoleWnd(), Error,
-             tr ("<p>Could not insert the VirtualBox Guest Additions "
-                 "installer CD image into the virtual machine <b>%1</b>, as the machine "
-                 "has no CD/DVD-ROM drives. Please add a drive using the "
-                 "storage page of the virtual machine settings dialog.</p>")
-                 .arg (aMachineName));
-}
-
-bool VBoxProblemReporter::confirmDownloadAdditions (const QString &aURL,
-                                                    ulong aSize)
-{
-    return messageOkCancel (&vboxGlobal().consoleWnd(), Question,
-        tr ("<p>Are you sure you want to download the VirtualBox "
-            "Guest Additions CD image from "
-            "<nobr><a href=\"%1\">%2</a></nobr> "
-            "(size %3 bytes)?</p>").arg (aURL).arg (aURL).arg (aSize),
-        0, /* aAutoConfirmId */
-        tr ("Download", "additions"));
-}
-
-bool VBoxProblemReporter::confirmMountAdditions (const QString &aURL,
-                                                const QString &aSrc)
-{
-    return messageOkCancel (&vboxGlobal().consoleWnd(), Question,
-        tr ("<p>The VirtualBox Guest Additions CD image has been "
-            "successfully downloaded from "
-            "<nobr><a href=\"%1\">%2</a></nobr> "
-            "and saved locally as <nobr><b>%3</b>.</nobr></p>"
-            "<p>Do you wish to register this CD image and mount it "
-            "on the virtual CD/DVD drive?</p>")
-            .arg (aURL).arg (aURL).arg (aSrc),
-        0, /* aAutoConfirmId */
-        tr ("Mount", "additions"));
-}
-
-void VBoxProblemReporter::warnAboutTooOldAdditions (QWidget *aParent,
-                                                    const QString &aInstalledVer,
-                                                    const QString &aExpectedVer)
-{
-    message (aParent, VBoxProblemReporter::Error,
-        tr ("<p>The VirtualBox Guest Additions installed in the Guest OS are too "
-            "old: the installed version is %1, the expected version is %2. "
-            "Some features that require Guest Additions (mouse integration, "
-            "guest display auto-resize) will most likely stop "
-            "working properly.</p>"
-            "<p>Please update the Guest Additions to the current version by choosing "
-            "<b>Install Guest Additions</b> from the <b>Devices</b> "
-            "menu.</p>")
-             .arg (aInstalledVer).arg (aExpectedVer),
-        "warnAboutTooOldAdditions");
-}
-
-void VBoxProblemReporter::warnAboutOldAdditions (QWidget *aParent,
-                                                 const QString &aInstalledVer,
-                                                 const QString &aExpectedVer)
-{
-    message (aParent, VBoxProblemReporter::Warning,
-        tr ("<p>The VirtualBox Guest Additions installed in the Guest OS are "
-            "outdated: the installed version is %1, the expected version is %2. "
-            "Some features that require Guest Additions (mouse integration, "
-            "guest display auto-resize) may not work as expected.</p>"
-            "<p>It is recommended to update the Guest Additions to the current version "
-            " by choosing <b>Install Guest Additions</b> from the <b>Devices</b> "
-            "menu.</p>")
-             .arg (aInstalledVer).arg (aExpectedVer),
-        "warnAboutOldAdditions");
-}
-
-void VBoxProblemReporter::warnAboutNewAdditions (QWidget *aParent,
-                                                 const QString &aInstalledVer,
-                                                 const QString &aExpectedVer)
-{
-    message (aParent, VBoxProblemReporter::Error,
-        tr ("<p>The VirtualBox Guest Additions installed in the Guest OS are "
-            "too recent for this version of VirtualBox: the installed version "
-            "is %1, the expected version is %2.</p>"
-            "<p>Using a newer version of Additions with an older version of "
-            "VirtualBox is not supported. Please install the current version "
-            "of the Guest Additions by choosing <b>Install Guest Additions</b> "
-            "from the <b>Devices</b> menu.</p>")
-             .arg (aInstalledVer).arg (aExpectedVer),
-        "warnAboutNewAdditions");
-}
-
-void VBoxProblemReporter::cannotConnectRegister (QWidget *aParent,
-                                                 const QString &aURL,
-                                                 const QString &aReason)
-{
-    /* we don't want to expose the registration script URL to the user
-     * if he simply doesn't have an internet connection */
-    Q_UNUSED (aURL);
-
-    message (aParent, Error,
-             tr ("<p>Failed to connect to the VirtualBox online "
-                 "registration service due to the following error:</p><p><b>%1</b></p>")
-                 .arg (aReason));
-}
-
-void VBoxProblemReporter::showRegisterResult (QWidget *aParent,
-                                              const QString &aResult)
-{
-    if (aResult == "OK")
-    {
-        /* On successful registration attempt */
-        message (aParent, Info,
-                 tr ("<p>Congratulations! You have been successfully registered "
-                     "as a user of VirtualBox.</p>"
-                     "<p>Thank you for finding time to fill out the "
-                     "registration form!</p>"));
-    }
-    else
-    {
-        QString parsed;
-
-        /* Else parse and translate special key-words */
-        if (aResult == "AUTHFAILED")
-            parsed = tr ("<p>Invalid e-mail address or password specified.</p>");
-
-        message (aParent, Error,
-                 tr ("<p>Failed to register the VirtualBox product.</p><p>%1</p>")
-                 .arg (parsed.isNull() ? aResult : parsed));
-    }
-}
-
-void VBoxProblemReporter::showUpdateSuccess (QWidget *aParent,
-                                             const QString &aVersion,
-                                             const QString &aLink)
-{
-    message (aParent, Info,
-             tr ("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href=\"http://www.virtualbox.org/\">virtualbox.org</a>.</p>"
-                 "<p>You can download this version using the link:</p>"
-                 "<p><a href=%2>%3</a></p>")
-                 .arg (aVersion, aLink, aLink));
-}
-
-void VBoxProblemReporter::showUpdateFailure (QWidget *aParent,
-                                             const QString &aReason)
-{
-    message (aParent, Error,
-             tr ("<p>Unable to obtain the new version information "
-                 "due to the following error:</p><p><b>%1</b></p>")
-                 .arg (aReason));
-}
-
-void VBoxProblemReporter::showUpdateNotFound (QWidget *aParent)
-{
-    message (aParent, Info,
-             tr ("You are already running the most recent version of VirtualBox."
-                 ""));
-}
-
-/**
- *  @return @c true if the user has confirmed input capture (this is always
- *  the case if the dialog was autoconfirmed). @a aAutoConfirmed, when not
- *  NULL, will receive @c true if the dialog wasn't actually shown.
- */
-bool VBoxProblemReporter::confirmInputCapture (bool *aAutoConfirmed /* = NULL */)
-{
-    int rc = message (&vboxGlobal().consoleWnd(), Info,
-        tr ("<p>You have <b>clicked the mouse</b> inside the Virtual Machine display "
-            "or pressed the <b>host key</b>. This will cause the Virtual Machine to "
-            "<b>capture</b> the host mouse pointer (only if the mouse pointer "
-            "integration is not currently supported by the guest OS) and the "
-            "keyboard, which will make them unavailable to other applications "
-            "running on your host machine."
-            "</p>"
-            "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the "
-            "keyboard and mouse (if it is captured) and return them to normal "
-            "operation. The currently assigned host key is shown on the status bar "
-            "at the bottom of the Virtual Machine window, next to the&nbsp;"
-            "<img src=:/hostkey_16px.png/>&nbsp;icon. This icon, together "
-            "with the mouse icon placed nearby, indicate the current keyboard "
-            "and mouse capture state."
-            "</p>") +
-        tr ("<p>The host key is currently defined as <b>%1</b>.</p>",
-            "additional message box paragraph")
-            .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())),
-        "confirmInputCapture",
-        QIMessageBox::Ok | QIMessageBox::Default,
-        QIMessageBox::Cancel | QIMessageBox::Escape,
-        0,
-        tr ("Capture", "do input capture"));
-
-    if (aAutoConfirmed)
-        *aAutoConfirmed = (rc & AutoConfirmed);
-
-    return (rc & QIMessageBox::ButtonMask) == QIMessageBox::Ok;
-}
-
-void VBoxProblemReporter::remindAboutAutoCapture()
-{
-    message (&vboxGlobal().consoleWnd(), Info,
-        tr ("<p>You have the <b>Auto capture keyboard</b> option turned on. "
-            "This will cause the Virtual Machine to automatically <b>capture</b> "
-            "the keyboard every time the VM window is activated and make it "
-            "unavailable to other applications running on your host machine: "
-            "when the keyboard is captured, all keystrokes (including system ones "
-            "like Alt-Tab) will be directed to the VM."
-            "</p>"
-            "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the "
-            "keyboard and mouse (if it is captured) and return them to normal "
-            "operation. The currently assigned host key is shown on the status bar "
-            "at the bottom of the Virtual Machine window, next to the&nbsp;"
-            "<img src=:/hostkey_16px.png/>&nbsp;icon. This icon, together "
-            "with the mouse icon placed nearby, indicate the current keyboard "
-            "and mouse capture state."
-            "</p>") +
-        tr ("<p>The host key is currently defined as <b>%1</b>.</p>",
-            "additional message box paragraph")
-            .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())),
-        "remindAboutAutoCapture");
-}
-
-void VBoxProblemReporter::remindAboutMouseIntegration (bool aSupportsAbsolute)
-{
-    static const char *kNames [2] =
-    {
-        "remindAboutMouseIntegrationOff",
-        "remindAboutMouseIntegrationOn"
-    };
-
-    /* Close the previous (outdated) window if any. We use kName as
-     * aAutoConfirmId which is also used as the widget name by default. */
-    {
-        QWidget *outdated =
-            VBoxGlobal::findWidget (NULL, kNames [int (!aSupportsAbsolute)],
-                                    "QIMessageBox");
-        if (outdated)
-            outdated->close();
-    }
-
-    if (aSupportsAbsolute)
-    {
-        message (&vboxGlobal().consoleWnd(), Info,
-            tr ("<p>The Virtual Machine reports that the guest OS supports "
-                "<b>mouse pointer integration</b>. This means that you do not "
-                "need to <i>capture</i> the mouse pointer to be able to use it "
-                "in your guest OS -- all "
-                "mouse actions you perform when the mouse pointer is over the "
-                "Virtual Machine's display are directly sent to the guest OS. "
-                "If the mouse is currently captured, it will be automatically "
-                "uncaptured."
-                "</p>"
-                "<p>The mouse icon on the status bar will look like&nbsp;"
-                "<img src=:/mouse_seamless_16px.png/>&nbsp;to inform you that mouse "
-                "pointer integration is supported by the guest OS and is "
-                "currently turned on."
-                "</p>"
-                "<p><b>Note</b>: Some applications may behave incorrectly in "
-                "mouse pointer integration mode. You can always disable it for "
-                "the current session (and enable it again) by selecting the "
-                "corresponding action from the menu bar."
-                "</p>"),
-            kNames [1] /* aAutoConfirmId */);
-    }
-    else
-    {
-        message (&vboxGlobal().consoleWnd(), Info,
-            tr ("<p>The Virtual Machine reports that the guest OS does not "
-                "support <b>mouse pointer integration</b> in the current video "
-                "mode. You need to capture the mouse (by clicking over the VM "
-                "display or pressing the host key) in order to use the "
-                "mouse inside the guest OS.</p>"),
-            kNames [0] /* aAutoConfirmId */);
-    }
-}
-
-/**
- * @return @c false if the dialog wasn't actually shown (i.e. it was
- * autoconfirmed).
- */
-bool VBoxProblemReporter::remindAboutPausedVMInput()
-{
-    int rc = message (
-        &vboxGlobal().consoleWnd(),
-        Info,
-        tr (
-            "<p>The Virtual Machine is currently in the <b>Paused</b> state and "
-            "not able to see any keyboard or mouse input. If you want to "
-            "continue to work inside the VM, you need to resume it by selecting the "
-            "corresponding action from the menu bar.</p>"
-        ),
-        "remindAboutPausedVMInput"
-    );
-    return !(rc & AutoConfirmed);
-}
-
-/** @return true if the user has chosen to show the Disk Manager Window */
-bool VBoxProblemReporter::remindAboutInaccessibleMedia()
-{
-    int rc = message (&vboxGlobal().selectorWnd(), Warning,
-        tr ("<p>One or more virtual hard disks, CD/DVD or "
-            "floppy media are not currently accessible. As a result, you will "
-            "not be able to operate virtual machines that use these media until "
-            "they become accessible later.</p>"
-            "<p>Press <b>Check</b> to open the Virtual Media Manager window and "
-            "see what media are inaccessible, or press <b>Ignore</b> to "
-            "ignore this message.</p>"),
-        "remindAboutInaccessibleMedia",
-        QIMessageBox::Ok | QIMessageBox::Default,
-        QIMessageBox::Ignore | QIMessageBox::Escape,
-        0,
-        tr ("Check", "inaccessible media message box"));
-
-    return rc == QIMessageBox::Ok; /* implies !AutoConfirmed */
-}
-
-/**
- * Shows user a proposal to either convert configuration files or
- * Exit the application leaving all as already is.
- *
- * @param aFileList      List of files for auto-convertion (may use Qt HTML).
- * @param aAfterRefresh  @true when called after the VM refresh.
- *
- * @return QIMessageBox::Ok (Save + Backup), QIMessageBox::Cancel (Exit)
- */
-int VBoxProblemReporter::warnAboutSettingsAutoConversion (const QString &aFileList,
-                                                          bool aAfterRefresh)
-{
-    if (!aAfterRefresh)
-    {
-        /* Common variant for all VMs */
-        return message (mainWindowShown(), Info,
-            tr ("<p>Your existing VirtualBox settings files will be automatically "
-                "converted from the old format to a new format required by the "
-                "new version of VirtualBox.</p>"
-                "<p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if "
-                "you want to terminate the VirtualBox "
-                "application without any further actions.</p>"),
-            NULL /* aAutoConfirmId */,
-            QIMessageBox::Ok | QIMessageBox::Default,
-            QIMessageBox::Cancel | QIMessageBox::Escape,
-            0,
-            0,
-            tr ("E&xit", "warnAboutSettingsAutoConversion message box"));
-    }
-    else
-    {
-        /* Particular VM variant */
-        return message (mainWindowShown(), Info,
-            tr ("<p>The following VirtualBox settings files will be automatically "
-                "converted from the old format to a new format required by the "
-                "new version of VirtualBox.</p>"
-                "<p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if "
-                "you want to terminate the VirtualBox "
-                "application without any further actions.</p>"),
-            QString ("<!--EOM-->%1").arg (aFileList),
-            NULL /* aAutoConfirmId */,
-            QIMessageBox::Ok | QIMessageBox::Default,
-            QIMessageBox::Cancel | QIMessageBox::Escape,
-            0,
-            0,
-            tr ("E&xit", "warnAboutSettingsAutoConversion message box"));
-    }
-}
-
-/**
- *  @param aHotKey Fullscreen hot key as defined in the menu.
- *
- *  @return @c true if the user has chosen to go fullscreen (this is always
- *  the case if the dialog was autoconfirmed).
- */
-bool VBoxProblemReporter::confirmGoingFullscreen (const QString &aHotKey)
-{
-    return messageOkCancel (&vboxGlobal().consoleWnd(), Info,
-        tr ("<p>The virtual machine window will be now switched to "
-            "<b>fullscreen</b> mode. "
-            "You can go back to windowed mode at any time by pressing "
-            "<b>%1</b>. Note that the <i>Host</i> key is currently "
-            "defined as <b>%2</b>.</p>"
-            "<p>Note that the main menu bar is hidden in fullscreen mode. You "
-            "can access it by pressing <b>Host+Home</b>.</p>")
-            .arg (aHotKey)
-            .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())),
-        "confirmGoingFullscreen",
-        tr ("Switch", "fullscreen"));
-}
-
-/**
- *  @param aHotKey Seamless hot key as defined in the menu.
- *
- *  @return @c true if the user has chosen to go seamless (this is always
- *  the case if the dialog was autoconfirmed).
- */
-bool VBoxProblemReporter::confirmGoingSeamless (const QString &aHotKey)
-{
-    return messageOkCancel (&vboxGlobal().consoleWnd(), Info,
-        tr ("<p>The virtual machine window will be now switched to "
-            "<b>Seamless</b> mode. "
-            "You can go back to windowed mode at any time by pressing "
-            "<b>%1</b>. Note that the <i>Host</i> key is currently "
-            "defined as <b>%2</b>.</p>"
-            "<p>Note that the main menu bar is hidden in seamless mode. You "
-            "can access it by pressing <b>Host+Home</b>.</p>")
-            .arg (aHotKey)
-            .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())),
-        "confirmGoingSeamless",
-        tr ("Switch", "seamless"));
-}
-
-void VBoxProblemReporter::remindAboutWrongColorDepth (ulong aRealBPP,
-                                                      ulong aWantedBPP)
-{
-    const char *kName = "remindAboutWrongColorDepth";
-
-    /* Close the previous (outdated) window if any. We use kName as
-     * aAutoConfirmId which is also used as the widget name by default. */
-    {
-        QWidget *outdated = VBoxGlobal::findWidget (NULL, kName, "QIMessageBox");
-        if (outdated)
-            outdated->close();
-    }
-
-    int rc = message (&vboxGlobal().consoleWnd(), Info,
-        tr ("<p>The virtual machine window is optimized to work in "
-            "<b>%1&nbsp;bit</b> color mode but the "
-            "virtual display is currently set to <b>%2&nbsp;bit</b>.</p>"
-            "<p>Please open the display properties dialog of the guest OS and "
-            "select a <b>%3&nbsp;bit</b> color mode, if it is available, for "
-            "best possible performance of the virtual video subsystem.</p>"
-            "<p><b>Note</b>. Some operating systems, like OS/2, may actually "
-            "work in 32&nbsp;bit mode but report it as 24&nbsp;bit "
-            "(16 million colors). You may try to select a different color "
-            "mode to see if this message disappears or you can simply "
-            "disable the message now if you are sure the required color "
-            "mode (%4&nbsp;bit) is not available in the guest OS.</p>")
-            .arg (aWantedBPP).arg (aRealBPP).arg (aWantedBPP).arg (aWantedBPP),
-        kName);
-    NOREF(rc);
-}
-
-/**
- *  Returns @c true if the user has selected to power off the machine.
- */
-bool VBoxProblemReporter::remindAboutGuruMeditation (const CConsole &aConsole,
-                                                     const QString &aLogFolder)
-{
-    Q_UNUSED (aConsole);
-
-    int rc = message (&vboxGlobal().consoleWnd(), GuruMeditation,
-        tr ("<p>A critical error has occurred while running the virtual "
-            "machine and the machine execution has been stopped.</p>"
-            ""
-            "<p>For help, please see the Community section on "
-            "<a href=http://www.virtualbox.org>http://www.virtualbox.org</a> "
-            "or your support contract. Please provide the contents of the "
-            "log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, "
-            "which you can find in the <nobr><b>%1</b></nobr> directory, "
-            "as well as a description of what you were doing when this error "
-            "happened. "
-            ""
-            "Note that you can also access the above files by selecting "
-            "<b>Show Log</b> from the <b>Machine</b> menu of the main "
-            "VirtualBox window.</p>"
-            ""
-            "<p>Press <b>OK</b> if you want to power off the machine "
-            "or press <b>Ignore</b> if you want to leave it as is for debugging. "
-            "Please note that debugging requires special knowledge and tools, so "
-            "it is recommended to press <b>OK</b> now.</p>")
-            .arg (aLogFolder),
-        0, /* aAutoConfirmId */
-        QIMessageBox::Ok | QIMessageBox::Default,
-        QIMessageBox::Ignore | QIMessageBox::Escape);
-
-    return rc == QIMessageBox::Ok;
-}
-
-/**
- *  @return @c true if the user has selected to reset the machine.
- */
-bool VBoxProblemReporter::confirmVMReset (QWidget *aParent)
-{
-    return messageOkCancel (aParent, Question,
-        tr ("<p>Do you really want to reset the virtual machine?</p>"
-            "<p>This will cause any unsaved data in applications running inside "
-            "it to be lost.</p>"),
-        "confirmVMReset" /* aAutoConfirmId */,
-        tr ("Reset", "machine"));
-}
-
-/**
- *  @return @c true if the user has selected to continue without attaching a
- *  hard disk.
- */
-bool VBoxProblemReporter::confirmHardDisklessMachine (QWidget *aParent)
-{
-    return message (aParent, Warning,
-        tr ("<p>You didn't attach a hard disk to the new virtual machine. "
-            "The machine will not be able to boot unless you attach "
-            "a hard disk with a guest operating system or some other bootable "
-            "media to it later using the machine settings dialog or the First "
-            "Run Wizard.</p><p>Do you wish to continue?</p>"),
-        0, /* aAutoConfirmId */
-        QIMessageBox::Ok,
-        QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape,
-        0,
-        tr ("Continue", "no hard disk attached"),
-        tr ("Go Back", "no hard disk attached")) == QIMessageBox::Ok;
-}
-
-void VBoxProblemReporter::cannotRunInSelectorMode()
-{
-    message (mainWindowShown(), Critical,
-        tr ("<p>Cannot run VirtualBox in <i>VM Selector</i> "
-            "mode due to local restrictions.</p>"
-            "<p>The application will now terminate.</p>"));
-}
-
-void VBoxProblemReporter::cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent /* = NULL */) const
-{
-    if (aAppliance->isNull())
-    {
-        message (aParent ? aParent : mainWindowShown(),
-                 Error,
-                 tr ("Failed to open appliance."));
-    }else
-    {
-        /* Preserve the current error info before calling the object again */
-        COMResult res (*aAppliance);
-
-        /* Add the warnings in the case of an early error */
-        QVector<QString> w = aAppliance->GetWarnings();
-        QString wstr;
-        foreach (const QString &str, w)
-            wstr += QString ("<br />Warning: %1").arg (str);
-        if (!wstr.isEmpty())
-            wstr = "<br />" + wstr;
-
-        message (aParent ? aParent : mainWindowShown(),
-                 Error,
-                 tr ("Failed to open/interpret appliance <b>%1</b>.").arg (aAppliance->GetPath()),
-                 wstr +
-                 formatErrorInfo (res));
-    }
-}
-
-void VBoxProblemReporter::cannotImportAppliance (const CProgress &aProgress, CAppliance* aAppliance, QWidget *aParent /* = NULL */) const
-{
-    AssertWrapperOk (aProgress);
-
-    message (aParent ? aParent : mainWindowShown(),
-             Error,
-             tr ("Failed to import appliance <b>%1</b>.").arg (aAppliance->GetPath()),
-             formatErrorInfo (aProgress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotCheckFiles (const CProgress &aProgress, QWidget *aParent /* = NULL */) const
-{
-    AssertWrapperOk (aProgress);
-
-    message (aParent ? aParent : mainWindowShown(),
-             Error,
-             tr ("Failed to check files."),
-             formatErrorInfo (aProgress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotRemoveFiles (const CProgress &aProgress, QWidget *aParent /* = NULL */) const
-{
-    AssertWrapperOk (aProgress);
-
-    message (aParent ? aParent : mainWindowShown(),
-             Error,
-             tr ("Failed to remove file."),
-             formatErrorInfo (aProgress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::cannotExportAppliance (CAppliance *aAppliance, QWidget *aParent /* = NULL */) const
-{
-    if (aAppliance->isNull())
-    {
-        message (aParent ? aParent : mainWindowShown(),
-                 Error,
-                 tr ("Failed to create appliance."));
-    }else
-    {
-        /* Preserve the current error info before calling the object again */
-        COMResult res (*aAppliance);
-
-        message (aParent ? aParent : mainWindowShown(),
-                 Error,
-                 tr ("Failed to prepare the export of the appliance <b>%1</b>.").arg (aAppliance->GetPath()),
-                 formatErrorInfo (res));
-    }
-}
-
-void VBoxProblemReporter::cannotExportAppliance (const CMachine &aMachine, CAppliance *aAppliance, QWidget *aParent /* = NULL */) const
-{
-    if (aAppliance->isNull() ||
-        aMachine.isNull())
-    {
-        message (aParent ? aParent : mainWindowShown(),
-                 Error,
-                 tr ("Failed to create an appliance."));
-    }else
-    {
-        message (aParent ? aParent : mainWindowShown(),
-                 Error,
-                 tr ("Failed to prepare the export of the appliance <b>%1</b>.").arg (aAppliance->GetPath()),
-                 formatErrorInfo (aMachine));
-    }
-}
-
-void VBoxProblemReporter::cannotExportAppliance (const CProgress &aProgress, CAppliance* aAppliance, QWidget *aParent /* = NULL */) const
-{
-    AssertWrapperOk (aProgress);
-
-    message (aParent ? aParent : mainWindowShown(),
-             Error,
-             tr ("Failed to export appliance <b>%1</b>.").arg (aAppliance->GetPath()),
-             formatErrorInfo (aProgress.GetErrorInfo()));
-}
-
-void VBoxProblemReporter::showRuntimeError (const CConsole &aConsole, bool fatal,
-                                            const QString &errorID,
-                                            const QString &errorMsg) const
-{
-    /// @todo (r=dmik) it's just a preliminary box. We need to:
-    //  - for fatal errors and non-fatal with-retry errors, listen for a
-    //    VM state signal to automatically close the message if the VM
-    //    (externally) leaves the Paused state while it is shown.
-    //  - make warning messages modeless
-    //  - add common buttons like Retry/Save/PowerOff/whatever
-
-    QByteArray autoConfimId = "showRuntimeError.";
-
-    CConsole console = aConsole;
-    KMachineState state = console.GetState();
-    Type type;
-    QString severity;
-
-    if (fatal)
-    {
-        /* the machine must be paused on fatal errors */
-        Assert (state == KMachineState_Paused);
-        if (state != KMachineState_Paused)
-            console.Pause();
-        type = Critical;
-        severity = tr ("<nobr>Fatal Error</nobr>", "runtime error info");
-        autoConfimId += "fatal.";
-    }
-    else if (state == KMachineState_Paused)
-    {
-        type = Error;
-        severity = tr ("<nobr>Non-Fatal Error</nobr>", "runtime error info");
-        autoConfimId += "error.";
-    }
-    else
-    {
-        type = Warning;
-        severity = tr ("<nobr>Warning</nobr>", "runtime error info");
-        autoConfimId += "warning.";
-    }
-
-    autoConfimId += errorID.toUtf8();
-
-    QString formatted ("<!--EOM-->");
-
-    if (!errorMsg.isEmpty())
-        formatted.prepend (QString ("<p>%1.</p>").arg (vboxGlobal().emphasize (errorMsg)));
-
-    if (!errorID.isEmpty())
-        formatted += QString ("<table bgcolor=#EEEEEE border=0 cellspacing=0 "
-                              "cellpadding=0 width=100%>"
-                              "<tr><td>%1</td><td>%2</td></tr>"
-                              "<tr><td>%3</td><td>%4</td></tr>"
-                              "</table>")
-                              .arg (tr ("<nobr>Error ID: </nobr>", "runtime error info"),
-                                    errorID)
-                              .arg (tr ("Severity: ", "runtime error info"),
-                                    severity);
-
-    if (!formatted.isEmpty())
-        formatted = "<qt>" + formatted + "</qt>";
-
-    int rc = 0;
-
-    if (type == Critical)
-    {
-        rc = message (&vboxGlobal().consoleWnd(), type,
-            tr ("<p>A fatal error has occurred during virtual machine execution! "
-                "The virtual machine will be powered off. Please copy the "
-                "following error message using the clipboard to help diagnose "
-                "the problem:</p>"),
-            formatted, autoConfimId.data());
-
-        /* always power down after a fatal error */
-        console.PowerDown();
-    }
-    else if (type == Error)
-    {
-        rc = message (&vboxGlobal().consoleWnd(), type,
-            tr ("<p>An error has occurred during virtual machine execution! "
-                "The error details are shown below. You may try to correct "
-                "the error and resume the virtual machine "
-                "execution.</p>"),
-            formatted, autoConfimId.data());
-    }
-    else
-    {
-        rc = message (&vboxGlobal().consoleWnd(), type,
-            tr ("<p>The virtual machine execution may run into an error "
-                "condition as described below. "
-                "We suggest that you take "
-                "an appropriate action to avert the error."
-                "</p>"),
-            formatted, autoConfimId.data());
-    }
-
-    NOREF (rc);
-}
-
-/* static */
-QString VBoxProblemReporter::mediumToAccusative (VBoxDefs::MediumType aType, bool aIsHostDrive /* = false */)
-{
-    QString type =
-        aType == VBoxDefs::MediumType_HardDisk ?
-            tr ("hard disk", "failed to mount ...") :
-        aType == VBoxDefs::MediumType_DVD && aIsHostDrive ?
-            tr ("CD/DVD", "failed to mount ... host-drive") :
-        aType == VBoxDefs::MediumType_DVD && !aIsHostDrive ?
-            tr ("CD/DVD image", "failed to mount ...") :
-        aType == VBoxDefs::MediumType_Floppy && aIsHostDrive ?
-            tr ("floppy", "failed to mount ... host-drive") :
-        aType == VBoxDefs::MediumType_Floppy && !aIsHostDrive ?
-            tr ("floppy image", "failed to mount ...") :
-        QString::null;
-
-    Assert (!type.isNull());
-    return type;
-}
-
-/* static */
-QString VBoxProblemReporter::deviceToAccusative (VBoxDefs::MediumType aType)
-{
-    QString type =
-        aType == VBoxDefs::MediumType_HardDisk ?
-            tr ("hard disk", "failed to attach ...") :
-        aType == VBoxDefs::MediumType_DVD ?
-            tr ("CD/DVD device", "failed to attach ...") :
-        aType == VBoxDefs::MediumType_Floppy ?
-            tr ("floppy device", "failed to close ...") :
-        QString::null;
-
-    Assert (!type.isNull());
-    return type;
-}
-
-/**
- * Formats the given COM result code as a human-readable string.
- *
- * If a mnemonic name for the given result code is found, a string in format
- * "MNEMONIC_NAME (0x12345678)" is returned where the hex number is the result
- * code as is. If no mnemonic name is found, then the raw hex number only is
- * returned (w/o parenthesis).
- *
- * @param aRC   COM result code to format.
- */
-/* static */
-QString VBoxProblemReporter::formatRC (HRESULT aRC)
-{
-    QString str;
-
-    PCRTCOMERRMSG msg = NULL;
-    const char *errMsg = NULL;
-
-    /* first, try as is (only set bit 31 bit for warnings) */
-    if (SUCCEEDED_WARNING (aRC))
-        msg = RTErrCOMGet (aRC | 0x80000000);
-    else
-        msg = RTErrCOMGet (aRC);
-
-    if (msg != NULL)
-        errMsg = msg->pszDefine;
-
-#if defined (Q_WS_WIN)
-
-    PCRTWINERRMSG winMsg = NULL;
-
-    /* if not found, try again using RTErrWinGet with masked off top 16bit */
-    if (msg == NULL)
-    {
-        winMsg = RTErrWinGet (aRC & 0xFFFF);
-
-        if (winMsg != NULL)
-            errMsg = winMsg->pszDefine;
-    }
-
-#endif
-
-    if (errMsg != NULL && *errMsg != '\0')
-        str.sprintf ("%s (0x%08X)", errMsg, aRC);
-    else
-        str.sprintf ("0x%08X", aRC);
-
-    return str;
-}
-
-/* static */
-QString VBoxProblemReporter::formatErrorInfo (const COMErrorInfo &aInfo,
-                                              HRESULT aWrapperRC /* = S_OK */)
-{
-    QString formatted = doFormatErrorInfo (aInfo, aWrapperRC);
-    return QString ("<qt>%1</qt>").arg (formatted);
-}
-
-/* static */
-QString VBoxProblemReporter::doFormatErrorInfo (const COMErrorInfo &aInfo,
-                                                HRESULT aWrapperRC /* = S_OK */)
-{
-    /* Compose complex details string with internal <!--EOM--> delimiter to
-     * make it possible to split string into info & details parts which will
-     * be used separately in QIMessageBox */
-    QString formatted;
-
-    if (!aInfo.text().isEmpty())
-        formatted += QString ("<p>%1.</p>").arg (vboxGlobal().emphasize (aInfo.text()));
-
-    formatted += "<!--EOM--><table bgcolor=#EEEEEE border=0 cellspacing=0 "
-                 "cellpadding=0 width=100%>";
-
-    bool haveResultCode = false;
-
-    if (aInfo.isBasicAvailable())
-    {
-#if defined (Q_WS_WIN)
-        haveResultCode = aInfo.isFullAvailable();
-        bool haveComponent = true;
-        bool haveInterfaceID = true;
-#else /* defined (Q_WS_WIN) */
-        haveResultCode = true;
-        bool haveComponent = aInfo.isFullAvailable();
-        bool haveInterfaceID = aInfo.isFullAvailable();
-#endif
-
-        if (haveResultCode)
-        {
-            formatted += QString ("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
-                .arg (tr ("Result&nbsp;Code: ", "error info"))
-                .arg (formatRC (aInfo.resultCode()));
-        }
-
-        if (haveComponent)
-            formatted += QString ("<tr><td>%1</td><td>%2</td></tr>")
-                .arg (tr ("Component: ", "error info"), aInfo.component());
-
-        if (haveInterfaceID)
-        {
-            QString s = aInfo.interfaceID();
-            if (!aInfo.interfaceName().isEmpty())
-                s = aInfo.interfaceName() + ' ' + s;
-            formatted += QString ("<tr><td>%1</td><td>%2</td></tr>")
-                .arg (tr ("Interface: ", "error info"), s);
-        }
-
-        if (!aInfo.calleeIID().isNull() && aInfo.calleeIID() != aInfo.interfaceID())
-        {
-            QString s = aInfo.calleeIID();
-            if (!aInfo.calleeName().isEmpty())
-                s = aInfo.calleeName() + ' ' + s;
-            formatted += QString ("<tr><td>%1</td><td>%2</td></tr>")
-                .arg (tr ("Callee: ", "error info"), s);
-        }
-    }
-
-    if (FAILED (aWrapperRC) &&
-        (!haveResultCode || aWrapperRC != aInfo.resultCode()))
-    {
-        formatted += QString ("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
-            .arg (tr ("Callee&nbsp;RC: ", "error info"))
-            .arg (formatRC (aWrapperRC));
-    }
-
-    formatted += "</table>";
-
-    if (aInfo.next())
-        formatted = formatted + "<!--EOP-->" + doFormatErrorInfo (*aInfo.next());
-
-    return formatted;
-}
-
-// Public slots
-/////////////////////////////////////////////////////////////////////////////
-
-void VBoxProblemReporter::showHelpWebDialog()
-{
-    vboxGlobal().openURL ("http://www.virtualbox.org");
-}
-
-void VBoxProblemReporter::showHelpAboutDialog()
-{
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    QString fullVersion ;
-    if (vboxGlobal().brandingIsActive())
-    {
-        fullVersion = (QString ("%1 r%2 - %3").arg (vbox.GetVersion())
-                                              .arg (vbox.GetRevision())
-                                              .arg (vboxGlobal().brandingGetKey("Name")));
-    }
-    else
-    {
-        fullVersion = (QString ("%1 r%2").arg (vbox.GetVersion())
-                                         .arg (vbox.GetRevision()));
-    }
-    AssertWrapperOk (vbox);
-
-    // this (QWidget*) cast is necessary to work around a gcc-3.2 bug */
-    VBoxAboutDlg ((QWidget*)mainWindowShown(), fullVersion).exec();
-}
-
-void VBoxProblemReporter::showHelpHelpDialog()
-{
-#ifndef VBOX_OSE
-    QString manual = vboxGlobal().helpFile();
-# if defined (Q_WS_WIN32)
-    HtmlHelp (GetDesktopWindow(), manual.utf16(),
-              HH_DISPLAY_TOPIC, NULL);
-# elif defined (Q_WS_X11)
-    char szViewerPath[RTPATH_MAX];
-    int rc;
-
-    rc = RTPathAppPrivateArch (szViewerPath, sizeof (szViewerPath));
-    AssertRC (rc);
-
-    QProcess::startDetached (QString(szViewerPath) + "/kchmviewer",
-                             QStringList (manual));
-# elif defined (Q_WS_MAC)
-    vboxGlobal().openURL ("file://" + manual);
-# endif
-#endif /* VBOX_OSE */
-}
-
-void VBoxProblemReporter::resetSuppressedMessages()
-{
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    vbox.SetExtraData (VBoxDefs::GUI_SuppressMessages, QString::null);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxProgressDialog.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxProgressDialog.cpp	(revision 25170)
+++ 	(revision )
@@ -1,277 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxProgressDialog class implementation
- */
-
-/*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox includes */
-#include "COMDefs.h"
-#include "QIDialogButtonBox.h"
-#include "QILabel.h"
-#include "VBoxGlobal.h"
-#include "VBoxProgressDialog.h"
-#include "VBoxSpecialControls.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-#endif
-
-/* Qt includes */
-#include <QCloseEvent>
-#include <QEventLoop>
-#include <QProgressBar>
-#include <QTime>
-#include <QTimer>
-#include <QVBoxLayout>
-
-#define VBOX_SECOND 1
-#define VBOX_MINUTE VBOX_SECOND * 60
-#define VBOX_HOUR VBOX_MINUTE * 60
-#define VBOX_DAY VBOX_HOUR * 24
-
-const char *VBoxProgressDialog::sOpDescTpl = "%1... (%2/%3)";
-
-VBoxProgressDialog::VBoxProgressDialog (CProgress &aProgress,
-                                        const QString &aTitle,
-                                        int aMinDuration /* = 2000 */,
-                                        QWidget *aParent /* = 0 */)
-//  : QIDialog (aParent, Qt::Sheet | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint)
-  : QIDialog (aParent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint)
-  , mProgress (aProgress)
-  , mCancelBtn (0)
-  , mCancelEnabled (false)
-  , mOpCount (mProgress.GetOperationCount())
-  , mCurOp (mProgress.GetOperation() + 1)
-  , mEnded (false)
-{
-    setModal (true);
-
-    QVBoxLayout *pLayout1 = new QVBoxLayout (this);
-
-#ifdef Q_WS_MAC
-    ::darwinSetHidesAllTitleButtons (this);
-    ::darwinSetShowsResizeIndicator (this, false);
-    VBoxGlobal::setLayoutMargin (pLayout1, 6);
-#endif /* Q_WS_MAC */
-
-    mLabel = new QILabel (this);
-    pLayout1->addWidget (mLabel, 0, Qt::AlignHCenter);
-
-    QHBoxLayout *pLayout2 = new QHBoxLayout();
-    pLayout2->setMargin (0);
-    pLayout1->addLayout (pLayout2);
-
-    mProgressBar = new QProgressBar (this);
-    pLayout2->addWidget (mProgressBar, 0, Qt::AlignVCenter);
-
-    if (mOpCount > 1)
-        mLabel->setText (QString (sOpDescTpl)
-                         .arg (mProgress.GetOperationDescription())
-                         .arg (mCurOp).arg (mOpCount));
-    else
-        mLabel->setText (QString ("%1...")
-                         .arg (mProgress.GetOperationDescription()));
-    mProgressBar->setMaximum (100);
-    setWindowTitle (QString ("%1: %2").arg (aTitle, mProgress.GetDescription()));
-    mProgressBar->setValue (0);
-    mCancelEnabled = aProgress.GetCancelable();
-    if (mCancelEnabled)
-    {
-        mCancelBtn = new VBoxMiniCancelButton (this);
-        mCancelBtn->setFocusPolicy (Qt::ClickFocus);
-        pLayout2->addWidget (mCancelBtn, 0, Qt::AlignVCenter);
-        connect (mCancelBtn, SIGNAL (clicked()), this, SLOT (cancelOperation()));
-    }
-
-    mETA = new QILabel (this);
-    pLayout1->addWidget (mETA, 0, Qt::AlignLeft | Qt::AlignVCenter);
-
-    setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
-
-    retranslateUi();
-
-    /* The progress dialog will be shown automatically after
-     * the duration is over if progress is not finished yet. */
-    QTimer::singleShot (aMinDuration, this, SLOT (showDialog()));
-}
-
-void VBoxProgressDialog::retranslateUi()
-{
-    mCancelText = tr ("Canceling...");
-    if (mCancelBtn)
-    {
-        mCancelBtn->setText (tr ("&Cancel"));
-        mCancelBtn->setToolTip (tr ("Cancel the current operation"));
-    }
-}
-
-int VBoxProgressDialog::run (int aRefreshInterval)
-{
-    if (mProgress.isOk())
-    {
-        /* Start refresh timer */
-        int id = startTimer (aRefreshInterval);
-
-        /* Set busy cursor */
-        QApplication::setOverrideCursor (QCursor (Qt::WaitCursor));
-
-        /* Enter the modal loop, but don't show the window immediately */
-        exec (false);
-
-        /* Kill refresh timer */
-        killTimer (id);
-
-        QApplication::restoreOverrideCursor();
-
-        return result();
-    }
-    return Rejected;
-}
-
-void VBoxProgressDialog::showDialog()
-{
-    /* We should not show progress-dialog
-     * if it was already finalized but not yet closed.
-     * This could happens in case of some other
-     * modal dialog prevents our event-loop from
-     * being exit overlapping 'this'. */
-    if (!mEnded)
-        show();
-}
-
-void VBoxProgressDialog::cancelOperation()
-{
-    if (mCancelBtn)
-        mCancelBtn->setEnabled (false);
-    mProgress.Cancel();
-}
-
-void VBoxProgressDialog::timerEvent (QTimerEvent * /* aEvent */)
-{
-    /* We should hide progress-dialog
-     * if it was already finalized but not yet closed.
-     * This could happens in case of some other
-     * modal dialog prevents our event-loop from
-     * being exit overlapping 'this'. */
-    if (mEnded && !isHidden())
-    {
-        hide();
-        return;
-    }
-    else if (mEnded)
-        return;
-
-    if (!mEnded && (!mProgress.isOk() || mProgress.GetCompleted()))
-    {
-        /* Progress finished */
-        if (mProgress.isOk())
-        {
-            mProgressBar->setValue (100);
-            done (Accepted);
-        }
-        /* Progress is not valid */
-        else
-            done (Rejected);
-
-        /* Request to exit loop */
-        mEnded = true;
-        return;
-    }
-
-    if (!mProgress.GetCanceled())
-    {
-        /* Update the progress dialog */
-        /* First ETA */
-        long newTime = mProgress.GetTimeRemaining();
-        QDateTime time;
-        time.setTime_t (newTime);
-        QDateTime refTime;
-        refTime.setTime_t (0);
-
-        int days = refTime.daysTo (time);
-        int hours = time.addDays (-days).time().hour();
-        int minutes = time.addDays (-days).time().minute();
-        int seconds = time.addDays (-days).time().second();
-
-        QString strDays = VBoxGlobal::daysToString(days);
-        QString strHours = VBoxGlobal::hoursToString(hours);
-        QString strMinutes = VBoxGlobal::minutesToString(minutes);
-        QString strSeconds = VBoxGlobal::secondsToString(seconds);
-
-        QString strTwoComp = tr ("%1, %2 remaining", "You may wish to translate this more like \"Time remaining: %1, %2\"");
-        QString strOneComp = tr ("%1 remaining", "You may wish to translate this more like \"Time remaining: %1\"");
-
-        if (newTime > VBOX_DAY * 2 + VBOX_HOUR)
-            mETA->setText (strTwoComp.arg (strDays).arg (strHours));
-        else if (newTime > VBOX_DAY * 2 + VBOX_MINUTE * 5)
-            mETA->setText (strTwoComp.arg (strDays).arg (strMinutes));
-        else if (newTime > VBOX_DAY * 2)
-            mETA->setText (strOneComp.arg (strDays));
-        else if (newTime > VBOX_DAY + VBOX_HOUR)
-            mETA->setText (strTwoComp.arg (strDays).arg (strHours));
-        else if (newTime > VBOX_DAY + VBOX_MINUTE * 5)
-            mETA->setText (strTwoComp.arg (strDays).arg (strMinutes));
-        else if (newTime > VBOX_HOUR * 23 + VBOX_MINUTE * 55)
-            mETA->setText (strOneComp.arg (strDays));
-        else if (newTime >= VBOX_HOUR * 2)
-            mETA->setText (strTwoComp.arg (strHours).arg (strMinutes));
-        else if (newTime > VBOX_HOUR + VBOX_MINUTE * 5)
-            mETA->setText (strTwoComp.arg (strHours).arg (strMinutes));
-        else if (newTime > VBOX_MINUTE * 55)
-            mETA->setText (strOneComp.arg (strHours));
-        else if (newTime > VBOX_MINUTE * 2)
-            mETA->setText (strOneComp.arg (strMinutes));
-        else if (newTime > VBOX_MINUTE + VBOX_SECOND * 5)
-            mETA->setText (strTwoComp.arg (strMinutes).arg (strSeconds));
-        else if (newTime > VBOX_SECOND * 55)
-            mETA->setText (strOneComp.arg (strMinutes));
-        else if (newTime > VBOX_SECOND * 5)
-            mETA->setText (strOneComp.arg (strSeconds));
-        else if (newTime >= 0)
-            mETA->setText (tr ("A few seconds remaining"));
-        else
-            mETA->clear();
-
-        /* Then operation text if changed */
-        ulong newOp = mProgress.GetOperation() + 1;
-        if (newOp != mCurOp)
-        {
-            mCurOp = newOp;
-            mLabel->setText (QString (sOpDescTpl)
-                             .arg (mProgress.GetOperationDescription())
-                             .arg (mCurOp).arg (mOpCount));
-        }
-        mProgressBar->setValue (mProgress.GetPercent());
-    }else
-        mETA->setText (mCancelText);
-}
-
-void VBoxProgressDialog::reject()
-{
-    if (mCancelEnabled)
-        cancelOperation();
-}
-
-void VBoxProgressDialog::closeEvent (QCloseEvent *aEvent)
-{
-    if (mCancelEnabled)
-        cancelOperation();
-    else
-        aEvent->ignore();
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.h	(revision 25171)
@@ -0,0 +1,86 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxRegistrationDlg class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxRegistrationDlg_h__
+#define __VBoxRegistrationDlg_h__
+
+#include "QIAbstractWizard.h"
+#include "QIWidgetValidator.h"
+#include "QIWithRetranslateUI.h"
+#include "VBoxRegistrationDlg.gen.h"
+
+/* Qt includes */
+#include <QUrl>
+
+class QIHttp;
+
+class VBoxRegistrationDlg : public QIWithRetranslateUI <QIAbstractWizard>,
+                            public Ui::VBoxRegistrationDlg
+{
+    Q_OBJECT;
+
+public:
+
+    static bool hasToBeShown();
+
+    VBoxRegistrationDlg (VBoxRegistrationDlg **aSelf, QWidget *aParent = 0);
+   ~VBoxRegistrationDlg();
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void radioButtonToggled();
+
+    void accept();
+    void reject();
+    void reinit();
+
+    void handshakeStart();
+    void handshakeResponse (bool aError);
+
+    void registrationStart();
+    void registrationResponse (bool aError);
+
+    void revalidate (QIWidgetValidator *aWval);
+    void enableNext (const QIWidgetValidator *aWval);
+    void onPageShow();
+
+private:
+
+    void populateCountries();
+    void abortRequest (const QString &aReason);
+    void finish();
+
+    bool isFieldValid (QWidget *aWidget) const;
+
+    VBoxRegistrationDlg **mSelf;
+    QIWidgetValidator    *mWvalReg;
+    QUrl                  mUrl;
+    QIHttp               *mHttp;
+    QString               mKey;
+};
+
+#endif // __VBoxRegistrationDlg_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.ui	(revision 25171)
@@ -0,0 +1,461 @@
+<ui version="4.0" >
+ <class>VBoxRegistrationDlg</class>
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <widget class="QDialog" name="VBoxRegistrationDlg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>639</width>
+    <height>513</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>VirtualBox Registration Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="leftMargin" >
+    <number>0</number>
+   </property>
+   <property name="topMargin" >
+    <number>0</number>
+   </property>
+   <property name="rightMargin" >
+    <number>0</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QStackedWidget" name="mPageStack" >
+     <property name="currentIndex" >
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="mPageReg" >
+      <layout class="QGridLayout" name="gridLayout" >
+       <item row="0" column="0" colspan="4" >
+        <widget class="QLabel" name="mPageSummaryHdr" >
+         <property name="font" >
+          <font>
+           <family>Arial</family>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+         <property name="text" >
+          <string>Welcome to the VirtualBox Registration Form!</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0" colspan="4" >
+        <widget class="Line" name="line11" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item rowspan="15" row="2" column="0" >
+        <widget class="QLabel" name="mLogoSummary" >
+         <property name="sizePolicy" >
+          <sizepolicy vsizetype="Minimum" hsizetype="Maximum" >
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="autoFillBackground" >
+          <bool>true</bool>
+         </property>
+         <property name="pixmap" >
+          <pixmap resource="../VirtualBox1.qrc" >:/vmw_new_user.png</pixmap>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1" colspan="3" >
+        <widget class="QILabel" name="mTextRegInfo" >
+         <property name="sizePolicy" >
+          <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize" >
+          <size>
+           <width>500</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text" >
+          <string>&lt;p&gt;Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.&lt;/p&gt;&lt;p&gt;Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we use your personal data can be found in the &lt;b&gt;Privacy Policy&lt;/b&gt; section of the VirtualBox Manual or on the &lt;a href=http://www.virtualbox.org/wiki/PrivacyPolicy&gt;Privacy Policy&lt;/a&gt; page of the VirtualBox web-site.&lt;/p&gt;</string>
+         </property>
+         <property name="wordWrap" >
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1" colspan="3" >
+        <widget class="Line" name="line14" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="1" colspan="3" >
+        <widget class="QRadioButton" name="mRbOld" >
+         <property name="text" >
+          <string>I &amp;already have a Sun Online account:</string>
+         </property>
+         <property name="checked" >
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item rowspan="2" row="5" column="1" >
+        <spacer name="mHorizontalSpacer1" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType" >
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>20</width>
+           <height>0</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="5" column="2" >
+        <widget class="QLabel" name="mTxOldEmail" >
+         <property name="text" >
+          <string>&amp;E-mail:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mLeOldEmail</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="5" column="3" >
+        <widget class="QLineEdit" name="mLeOldEmail" >
+         <property name="whatsThis" >
+          <string>Enter your e-mail address. Please use a valid address here.</string>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="2" >
+        <widget class="QLabel" name="mTxOldPassword" >
+         <property name="text" >
+          <string>&amp;Password:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mLeOldPassword</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="3" >
+        <widget class="QLineEdit" name="mLeOldPassword" >
+         <property name="whatsThis" >
+          <string>Enter your e-mail address. Please use a valid address here.</string>
+         </property>
+         <property name="echoMode" >
+          <enum>QLineEdit::Password</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="7" column="1" colspan="3" >
+        <widget class="Line" name="line13" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="1" colspan="3" >
+        <widget class="QRadioButton" name="mRbNew" >
+         <property name="text" >
+          <string>I &amp;would like to create a new Sun Online account:</string>
+         </property>
+        </widget>
+       </item>
+       <item rowspan="8" row="9" column="1" >
+        <spacer name="mHorizontalSpacer2" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType" >
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>20</width>
+           <height>0</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="9" column="2" >
+        <widget class="QLabel" name="mTxNewFirstName" >
+         <property name="text" >
+          <string>&amp;First Name:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mLeNewFirstName</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="9" column="3" >
+        <widget class="QLineEdit" name="mLeNewFirstName" >
+         <property name="whatsThis" >
+          <string>Enter your full name using Latin characters.</string>
+         </property>
+        </widget>
+       </item>
+       <item row="10" column="2" >
+        <widget class="QLabel" name="mTxNewLastName" >
+         <property name="text" >
+          <string>&amp;Last Name:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mLeNewLastName</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="10" column="3" >
+        <widget class="QLineEdit" name="mLeNewLastName" >
+         <property name="whatsThis" >
+          <string>Enter your full name using Latin characters.</string>
+         </property>
+        </widget>
+       </item>
+       <item row="11" column="2" >
+        <widget class="QLabel" name="mTxNewCompany" >
+         <property name="text" >
+          <string>&amp;Company:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mLeNewCompany</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="11" column="3" >
+        <widget class="QLineEdit" name="mLeNewCompany" >
+         <property name="whatsThis" >
+          <string>Enter your full name using Latin characters.</string>
+         </property>
+        </widget>
+       </item>
+       <item row="12" column="2" >
+        <widget class="QLabel" name="mTxNewCountry" >
+         <property name="text" >
+          <string>Co&amp;untry:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mCbNewCountry</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="12" column="3" >
+        <widget class="QComboBox" name="mCbNewCountry" >
+         <property name="whatsThis" >
+          <string>Enter your full name using Latin characters.</string>
+         </property>
+        </widget>
+       </item>
+       <item row="13" column="2" colspan="2" >
+        <spacer name="mVerticalSpacer2" >
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType" >
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>0</width>
+           <height>5</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="14" column="2" >
+        <widget class="QLabel" name="mTxNewEmail" >
+         <property name="text" >
+          <string>E-&amp;mail:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mLeNewEmail</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="14" column="3" >
+        <widget class="QLineEdit" name="mLeNewEmail" >
+         <property name="whatsThis" >
+          <string>Enter your full name using Latin characters.</string>
+         </property>
+        </widget>
+       </item>
+       <item row="15" column="2" >
+        <widget class="QLabel" name="mTxNewPassword" >
+         <property name="text" >
+          <string>P&amp;assword:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mLeNewPassword</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="15" column="3" >
+        <widget class="QLineEdit" name="mLeNewPassword" >
+         <property name="whatsThis" >
+          <string>Enter your full name using Latin characters.</string>
+         </property>
+         <property name="echoMode" >
+          <enum>QLineEdit::Password</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="16" column="2" >
+        <widget class="QLabel" name="mTxNewPassword2" >
+         <property name="text" >
+          <string>Co&amp;nfirm Password:</string>
+         </property>
+         <property name="alignment" >
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy" >
+          <cstring>mLeNewPassword2</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="16" column="3" >
+        <widget class="QLineEdit" name="mLeNewPassword2" >
+         <property name="whatsThis" >
+          <string>Enter your full name using Latin characters.</string>
+         </property>
+         <property name="echoMode" >
+          <enum>QLineEdit::Password</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="17" column="0" colspan="4" >
+        <widget class="Line" name="line12" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="18" column="0" colspan="4" >
+        <layout class="QHBoxLayout" >
+         <item>
+          <spacer name="mHorizontalSpacer1" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mBtnFinish" >
+           <property name="text" >
+            <string>&amp;Register</string>
+           </property>
+           <property name="default" >
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="mHorizontalSpacer2" >
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType" >
+            <enum>QSizePolicy::Fixed</enum>
+           </property>
+           <property name="sizeHint" stdset="0" >
+            <size>
+             <width>5</width>
+             <height>0</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mBtnCancel" >
+           <property name="text" >
+            <string>Cancel</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QILabel</class>
+   <extends>QLabel</extends>
+   <header>QILabel.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>mBtnFinish</tabstop>
+  <tabstop>mBtnCancel</tabstop>
+ </tabstops>
+ <resources>
+  <include location="../VirtualBox1.qrc" />
+ </resources>
+ <connections/>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.h	(revision 25171)
@@ -0,0 +1,255 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxSelectorWnd class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxSelectorWnd_h__
+#define __VBoxSelectorWnd_h__
+
+#include "COMDefs.h"
+
+#include "QIWithRetranslateUI.h"
+
+#include "VBoxGlobal.h"
+#include "VBoxProblemReporter.h"
+#include "VBoxHelpActions.h"
+
+/* Qt includes */
+#include <QMainWindow>
+#ifdef VBOX_GUI_WITH_SYSTRAY
+    #include <QSystemTrayIcon>
+#endif
+
+class VBoxSnapshotsWgt;
+class VBoxVMDetailsView;
+class VBoxVMDescriptionPage;
+class VBoxVMLogViewer;
+class VBoxVMListView;
+class VBoxVMModel;
+class VBoxVMItem;
+class VBoxTrayIcon;
+class VBoxToolBar;
+
+class QTabWidget;
+class QListView;
+class QEvent;
+
+class VBoxSelectorWnd : public QIWithRetranslateUI2 <QMainWindow>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSelectorWnd (VBoxSelectorWnd **aSelf,
+                     QWidget* aParent = 0,
+                     Qt::WindowFlags aFlags = Qt::Window);
+    virtual ~VBoxSelectorWnd();
+
+signals:
+
+    void closing();
+
+public slots:
+
+    void fileMediaMgr();
+    void fileImportAppliance();
+    void fileExportAppliance();
+    void fileSettings();
+    void fileExit();
+
+    void vmNew();
+    void vmSettings (const QString &aCategory = QString::null,
+                     const QString &aControl = QString::null,
+                     const QString & = QString::null);
+    void vmDelete (const QString & = QString::null);
+    void vmStart (const QString & = QString::null);
+    void vmDiscard (const QString & = QString::null);
+    void vmPause (bool, const QString & = QString::null);
+    void vmRefresh (const QString & = QString::null);
+    void vmShowLogs (const QString & = QString::null);
+
+    void refreshVMList();
+    void refreshVMItem (const QString &aID, bool aDetails,
+                                          bool aSnapshots,
+                                          bool aDescription);
+
+    void showContextMenu (const QPoint &aPoint);
+
+#ifdef VBOX_GUI_WITH_SYSTRAY
+    void trayIconActivated (QSystemTrayIcon::ActivationReason aReason);
+    void showWindow();
+#endif
+
+    const QAction *vmNewAction() const { return mVmNewAction; }
+    const QAction *vmConfigAction() const { return mVmConfigAction; }
+    const QAction *vmDeleteAction() const { return mVmDeleteAction; }
+    const QAction *vmStartAction() const { return mVmStartAction; }
+    const QAction *vmDiscardAction() const { return mVmDiscardAction; }
+    const QAction *vmPauseAction() const { return mVmPauseAction; }
+    const QAction *vmRefreshAction() const { return mVmRefreshAction; }
+    const QAction *vmShowLogsAction() const { return mVmShowLogsAction; }
+
+protected:
+
+    /* Events */
+    bool event (QEvent *aEvent);
+    void closeEvent (QCloseEvent *aEvent);
+#if defined (Q_WS_MAC) && (QT_VERSION < 0x040402)
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+#endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */
+
+    void retranslateUi();
+
+private slots:
+
+    void vmListViewCurrentChanged (bool aRefreshDetails = true,
+                                   bool aRefreshSnapshots = true,
+                                   bool aRefreshDescription = true);
+
+    void mediumEnumStarted();
+    void mediumEnumFinished (const VBoxMediaList &);
+
+    /* VirtualBox callback events we're interested in */
+
+    void machineStateChanged (const VBoxMachineStateChangeEvent &e);
+    void machineDataChanged (const VBoxMachineDataChangeEvent &e);
+    void machineRegistered (const VBoxMachineRegisteredEvent &e);
+    void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
+    void snapshotChanged (const VBoxSnapshotEvent &e);
+#ifdef VBOX_GUI_WITH_SYSTRAY
+    void mainWindowCountChanged (const VBoxMainWindowCountChangeEvent &aEvent);
+    void trayIconCanShow (const VBoxCanShowTrayIconEvent &e);
+    void trayIconShow (const VBoxShowTrayIconEvent &e);
+    void trayIconChanged (const VBoxChangeTrayIconEvent &e);
+#endif
+
+private:
+
+    /* Main menus */
+    QMenu *mFileMenu;
+    QMenu *mVMMenu;
+    QMenu *mHelpMenu;
+
+    /* Main toolbar */
+    VBoxToolBar *mVMToolBar;
+
+    /* VM list context menu */
+    QMenu *mVMCtxtMenu;
+
+    /* Actions */
+    QAction *mFileMediaMgrAction;
+    QAction *mFileApplianceImportAction;
+    QAction *mFileApplianceExportAction;
+    QAction *mFileSettingsAction;
+    QAction *mFileExitAction;
+    QAction *mVmNewAction;
+    QAction *mVmConfigAction;
+    QAction *mVmDeleteAction;
+    QAction *mVmStartAction;
+    QAction *mVmDiscardAction;
+    QAction *mVmPauseAction;
+    QAction *mVmRefreshAction;
+    QAction *mVmShowLogsAction;
+
+    VBoxHelpActions mHelpActions;
+
+#ifdef VBOX_GUI_WITH_SYSTRAY
+    /* The systray icon */
+    VBoxTrayIcon *mTrayIcon;
+#endif
+
+    /* The vm list view/model */
+    VBoxVMListView *mVMListView;
+    VBoxVMModel *mVMModel;
+
+    /* The right information widgets */
+    QTabWidget *mVmTabWidget;
+    VBoxVMDetailsView *mVmDetailsView;
+    VBoxSnapshotsWgt *mVmSnapshotsWgt;
+    VBoxVMDescriptionPage *mVmDescriptionPage;
+
+    QRect mNormalGeo;
+
+    bool mDoneInaccessibleWarningOnce : 1;
+};
+
+#ifdef VBOX_GUI_WITH_SYSTRAY
+
+Q_DECLARE_METATYPE(QString);
+
+class VBoxTrayIcon : public QSystemTrayIcon
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxTrayIcon (VBoxSelectorWnd* aParent, VBoxVMModel* aVMModel);
+    virtual ~VBoxTrayIcon ();
+
+    void refresh ();
+    void retranslateUi ();
+
+protected:
+
+    VBoxVMItem* GetItem (QObject* aObject);
+
+signals:
+
+public slots:
+
+    void trayIconShow (bool aShow = false);
+
+private slots:
+
+    void showSubMenu();
+    void hideSubMenu ();
+
+    void vmSettings();
+    void vmDelete();
+    void vmStart();
+    void vmDiscard();
+    void vmPause(bool aPause);
+    void vmRefresh();
+    void vmShowLogs();
+
+private:
+
+    bool mActive;           /* Is systray menu active/available? */
+
+    /* The vm list model */
+    VBoxVMModel *mVMModel;
+
+    VBoxSelectorWnd* mParent;
+    QMenu *mTrayIconMenu;
+
+    QAction *mShowSelectorAction;
+    QAction *mHideSystrayMenuAction;
+    QAction *mVmConfigAction;
+    QAction *mVmDeleteAction;
+    QAction *mVmStartAction;
+    QAction *mVmDiscardAction;
+    QAction *mVmPauseAction;
+    QAction *mVmRefreshAction;
+    QAction *mVmShowLogsAction;
+};
+
+#endif // VBOX_GUI_WITH_SYSTRAY
+
+#endif // __VBoxSelectorWnd_h__
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialog.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialog.cpp	(revision 25170)
+++ 	(revision )
@@ -1,506 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxSettingsDialog class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-#include "VBoxSettingsDialog.h"
-#include "VBoxWarningPane.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "QIWidgetValidator.h"
-#include "VBoxSettingsSelector.h"
-#include "VBoxSettingsPage.h"
-#include "VBoxToolBar.h"
-
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-#endif /* Q_WS_MAC */
-
-/* Qt includes */
-#include <QPushButton>
-#include <QStackedWidget>
-#include <QTimer>
-
-#if MAC_LEOPARD_STYLE
-# define VBOX_GUI_WITH_TOOLBAR_SETTINGS
-#endif /* MAC_LEOPARD_STYLE */
-
-VBoxSettingsDialog::VBoxSettingsDialog (QWidget *aParent /* = NULL */)
-    : QIWithRetranslateUI <QIMainDialog> (aParent)
-    , mPolished (false)
-    , mValid (true)
-    , mSilent (true)
-    , mIconLabel (new VBoxWarningPane (this))
-    , mWhatsThisTimer (new QTimer (this))
-    , mWhatsThisCandidate (0)
-{
-    /* Apply UI decorations */
-    Ui::VBoxSettingsDialog::setupUi (this);
-
-//    setToolbar (new VBoxToolBar (this));
-#ifdef Q_WS_MAC
-//    VBoxGlobal::setLayoutMargin (centralWidget()->layout(), 0);
-    /* No status bar on the mac */
-    setSizeGripEnabled (false);
-    setStatusBar (NULL);
-#endif
-
-    /* Page title font is derived from the system font */
-    QFont f = font();
-    f.setBold (true);
-    f.setPointSize (f.pointSize() + 2);
-    mLbTitle->setFont (f);
-
-    QGridLayout *mainLayout = static_cast <QGridLayout*> (mAllWidget->layout());
-#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
-    mLbTitle->hide();
-    mLbWhatsThis->hide();
-    mSelector = new VBoxSettingsToolBarSelector (this);
-    static_cast <VBoxToolBar*> (mSelector->widget())->setMacToolbar();
-    addToolBar (qobject_cast <QToolBar*> (mSelector->widget()));
-    /* No title in this mode, we change the title of the window. */
-    mainLayout->setColumnMinimumWidth (0, 0);
-    mainLayout->setHorizontalSpacing (0);
-#else
-    /* Create the classical tree view selector */
-    mSelector = new VBoxSettingsTreeViewSelector (this);
-    mainLayout->addWidget (mSelector->widget(), 0, 0, 3, 1);
-    mSelector->widget()->setFocus();
-    mainLayout->setSpacing (10);
-#endif
-
-    /* Creating stack of pages */
-    mStack = new QStackedWidget (mWtStackHandler);
-    QVBoxLayout *layout = new QVBoxLayout (mWtStackHandler);
-    layout->setContentsMargins (0, 0, 0, 0);
-    layout->addWidget (mStack);
-
-    /* Setup whatsthis stuff */
-    setWhatsThis (tr ("<i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information</i>."));
-    qApp->installEventFilter (this);
-    mWhatsThisTimer->setSingleShot (true);
-    connect (mWhatsThisTimer, SIGNAL (timeout()), this, SLOT (updateWhatsThis()));
-    mLbWhatsThis->setAutoFillBackground (true);
-    QPalette pal = mLbWhatsThis->palette();
-    pal.setBrush (QPalette::Window, pal.brush (QPalette::Midlight));
-    mLbWhatsThis->setPalette (pal);
-    mLbWhatsThis->setFixedHeight (mLbWhatsThis->frameWidth() * 2 +
-                                  mLbWhatsThis->margin() * 2 +
-                                  mLbWhatsThis->fontMetrics().lineSpacing() * 4);
-
-    /* Setup error & warning stuff */
-    mButtonBox->addExtraWidget (mIconLabel);
-    mErrorIcon = vboxGlobal().standardIcon (QStyle::SP_MessageBoxCritical, this).pixmap (16, 16);
-    mWarnIcon = vboxGlobal().standardIcon (QStyle::SP_MessageBoxWarning, this).pixmap (16, 16);
-
-    /* Set the default button */
-    mButtonBox->button (QDialogButtonBox::Ok)->setDefault (true);
-
-    /* Setup connections */
-    connect (mButtonBox, SIGNAL (accepted()), this, SLOT (accept()));
-    connect (mButtonBox, SIGNAL (rejected()), this, SLOT (reject()));
-    connect (mButtonBox, SIGNAL (helpRequested()), &vboxProblem(), SLOT (showHelpHelpDialog()));
-    connect (mSelector, SIGNAL (categoryChanged (int)),
-             this, SLOT (categoryChanged (int)));
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-VBoxSettingsDialog::~VBoxSettingsDialog()
-{
-    delete mSelector;
-}
-
-void VBoxSettingsDialog::revalidate (QIWidgetValidator *aWval)
-{
-    /* Perform validations for particular page */
-    VBoxSettingsPage *page = qobject_cast <VBoxSettingsPage*> (aWval->widget());
-    AssertMsg (page, ("Every validator should corresponds a page!\n"));
-
-    QString warning;
-    QString title = mSelector->itemTextByPage (page);
-    bool valid = page->revalidate (warning, title);
-    if (valid && warning.isEmpty())
-        valid = correlate (page, warning);
-    warning = warning.isEmpty() ? QString::null :
-              tr ("On the <b>%1</b> page, %2").arg (title, warning);
-    aWval->setLastWarning (warning);
-    valid ? setWarning (warning) : setError (warning);
-
-    aWval->setOtherValid (valid);
-}
-
-void VBoxSettingsDialog::categoryChanged (int aId)
-{
-    QWidget *rootPage = mSelector->rootPage (aId);
-#ifndef Q_WS_MAC
-    mLbTitle->setText (mSelector->itemText (aId));
-    mStack->setCurrentIndex (mStack->indexOf (rootPage));
-#else /* Q_WS_MAC */
-    QSize cs = size();
-    /* First make all fully resizeable */
-    setMinimumSize (QSize (minimumWidth(), 0));
-    setMaximumSize (QSize (minimumWidth(), QWIDGETSIZE_MAX));
-    for (int i = 0; i < mStack->count(); ++i)
-        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Ignored);
-    int a = mStack->indexOf (rootPage);
-    if (a < mSizeList.count())
-    {
-        QSize ss = mSizeList.at (a);
-        mStack->widget (a)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
-        /* Switch to the new page first if we are shrinking */
-        if (cs.height() > ss.height())
-            mStack->setCurrentIndex (mStack->indexOf (rootPage));
-        /* Do the animation */
-        ::darwinWindowAnimateResize (this, QRect (x(), y(),
-                                                  ss.width(), ss.height()));
-        /* Switch to the new page last if we are zooming */
-        if (cs.height() <= ss.height())
-            mStack->setCurrentIndex (mStack->indexOf (rootPage));
-        /* Make the widget fixed size */
-        setFixedSize (ss);
-    }
-    ::darwinSetShowsResizeIndicator (this, false);
-#endif /* !Q_WS_MAC */
-# ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
-    setWindowTitle (dialogTitle());
-# endif
-}
-
-void VBoxSettingsDialog::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxSettingsDialog::retranslateUi (this);
-
-    mErrorHint = tr ("Invalid settings detected");
-    mWarnHint = tr ("Non-optimal settings detected");
-    if (!mValid)
-        mIconLabel->setWarningText (mErrorHint);
-    else if (!mSilent)
-        mIconLabel->setWarningText (mWarnHint);
-
-    QList <QIWidgetValidator*> vlist = findChildren <QIWidgetValidator*> ();
-
-    /* Rename all validators to make them feat new language. */
-    foreach (QIWidgetValidator *wval, vlist)
-        wval->setCaption (mSelector->itemTextByPage (
-            qobject_cast <VBoxSettingsPage*> (wval->widget())));
-
-    /* Revalidate all pages to retranslate the warning messages also. */
-    foreach (QIWidgetValidator *wval, vlist)
-        if (!wval->isValid())
-            revalidate (wval);
-}
-
-QString VBoxSettingsDialog::titleExtension() const
-{
-#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
-    return mSelector->itemText (mSelector->currentId());
-#else
-    return tr ("Settings");
-#endif
-}
-
-void VBoxSettingsDialog::setError (const QString &aError)
-{
-    mErrorString = aError.isEmpty() ? QString::null :
-                   QString ("<font color=red>%1</font>").arg (aError);
-
-    /* Not touching QILabel until dialog is polished otherwise
-     * it can change its size to undefined */
-    if (!mPolished)
-        return;
-
-    if (!mErrorString.isEmpty())
-        mLbWhatsThis->setText (mErrorString);
-    else
-        updateWhatsThis (true);
-}
-
-void VBoxSettingsDialog::setWarning (const QString &aWarning)
-{
-    mWarnString = aWarning.isEmpty() ? QString::null :
-                  QString ("<font color=#ff5400>%1</font>").arg (aWarning);
-
-    /* Not touching QILabel until dialog is polished otherwise
-     * it can change its size to undefined */
-    if (!mPolished)
-        return;
-
-    if (!mWarnString.isEmpty())
-        mLbWhatsThis->setText (mWarnString);
-    else
-        updateWhatsThis (true);
-}
-
-void VBoxSettingsDialog::addItem (const QString &aBigIcon,
-                                  const QString &aBigIconDisabled,
-                                  const QString &aSmallIcon,
-                                  const QString &aSmallIconDisabled,
-                                  int aId,
-                                  const QString &aLink,
-                                  VBoxSettingsPage* aPrefPage /* = NULL*/,
-                                  int aParentId /* = -1 */)
-{
-    QWidget *page = mSelector->addItem (aBigIcon, aBigIconDisabled, aSmallIcon, aSmallIconDisabled,
-                                        aId, aLink,
-                                        aPrefPage, aParentId);
-    if (page)
-        mStack->addWidget (page);
-    if (aPrefPage)
-        attachValidator (aPrefPage);
-}
-
-bool VBoxSettingsDialog::correlate (QWidget*, QString&)
-{
-    return true;
-}
-
-void VBoxSettingsDialog::enableOk (const QIWidgetValidator*)
-{
-    QList <QIWidgetValidator*> vlist (findChildren <QIWidgetValidator*> ());
-
-    /* Detect ERROR presence */
-    {
-        setError (QString::null);
-        QString wvalError;
-        bool newValid = true;
-        foreach (QIWidgetValidator *wval, vlist)
-        {
-            newValid = wval->isValid();
-            if (!newValid)
-            {
-                wvalError = wval->warningText();
-                if (wvalError.isNull())
-                    wvalError = wval->lastWarning();
-                break;
-            }
-        }
-
-        /* Try to set the generic error message when invalid
-         * but no specific message is provided */
-        if (mErrorString.isNull() && !wvalError.isNull())
-            setError (wvalError);
-
-        mValid = newValid;
-        mIconLabel->setWarningPixmap (mErrorIcon);
-        mIconLabel->setWarningText (mErrorHint);
-#ifdef Q_WS_MAC
-        mIconLabel->setToolTip (mErrorString);
-#endif /* Q_WS_MAC */
-        mIconLabel->setVisible (!mValid);
-        mButtonBox->button (QDialogButtonBox::Ok)->setEnabled (mValid);
-
-        if (!mValid) return;
-    }
-
-    /* Detect WARNING presence */
-    {
-        setWarning (QString::null);
-        QString wvalWarning;
-        bool newSilent = true;
-        foreach (QIWidgetValidator *wval, vlist)
-        {
-            if (!wval->warningText().isNull() ||
-                !wval->lastWarning().isNull())
-            {
-                newSilent = false;
-                wvalWarning = wval->warningText();
-                if (wvalWarning.isNull())
-                    wvalWarning = wval->lastWarning();
-                break;
-            }
-        }
-
-        /* Try to set the generic error message when invalid
-         * but no specific message is provided */
-        if (mWarnString.isNull() && !wvalWarning.isNull())
-            setWarning (wvalWarning);
-
-        mSilent = newSilent;
-        mIconLabel->setWarningPixmap (mWarnIcon);
-        mIconLabel->setWarningText (mWarnHint);
-#ifdef Q_WS_MAC
-        mIconLabel->setToolTip (mWarnString);
-#endif /* Q_WS_MAC */
-        mIconLabel->setVisible (!mSilent);
-    }
-}
-
-void VBoxSettingsDialog::updateWhatsThis (bool aGotFocus /* = false */)
-{
-    QString text;
-
-    QWidget *widget = 0;
-    if (!aGotFocus)
-    {
-        if (mWhatsThisCandidate && mWhatsThisCandidate != this)
-            widget = mWhatsThisCandidate;
-    }
-    else
-    {
-        widget = QApplication::focusWidget();
-    }
-
-    /* If the given widget lacks the whats'this text, look at its parent */
-    while (widget && widget != this)
-    {
-        text = widget->whatsThis();
-        if (!text.isEmpty())
-            break;
-        widget = widget->parentWidget();
-    }
-
-#ifndef Q_WS_MAC
-    if (text.isEmpty() && !mErrorString.isEmpty())
-        text = mErrorString;
-    else if (text.isEmpty() && !mWarnString.isEmpty())
-        text = mWarnString;
-    if (text.isEmpty())
-        text = whatsThis();
-
-    mLbWhatsThis->setText (text);
-#else /* Q_WS_MAC */
-    if (widget && !text.isEmpty())
-        widget->setToolTip (QString("<qt>%1</qt>").arg(text));
-#endif /* Q_WS_MAC */
-}
-
-void VBoxSettingsDialog::whatsThisCandidateDestroyed (QObject *aObj /* = 0 */)
-{
-    Assert (mWhatsThisCandidate == aObj);
-
-    if (mWhatsThisCandidate == aObj)
-        mWhatsThisCandidate = 0;
-}
-
-bool VBoxSettingsDialog::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    if (!aObject->isWidgetType())
-        return QIMainDialog::eventFilter (aObject, aEvent);
-
-    QWidget *widget = static_cast <QWidget*> (aObject);
-    if (widget->window() != this)
-        return QIMainDialog::eventFilter (aObject, aEvent);
-
-    switch (aEvent->type())
-    {
-        case QEvent::Enter:
-        case QEvent::Leave:
-        {
-            if (aEvent->type() == QEvent::Enter)
-            {
-                /* What if Qt sends Enter w/o Leave... */
-                if (mWhatsThisCandidate)
-                    disconnect (mWhatsThisCandidate, SIGNAL (destroyed (QObject *)),
-                                this, SLOT (whatsThisCandidateDestroyed (QObject *)));
-
-                mWhatsThisCandidate = widget;
-                /* Make sure we don't reference a deleted object after the
-                 * timer is shot */
-                connect (mWhatsThisCandidate, SIGNAL (destroyed (QObject *)),
-                         this, SLOT (whatsThisCandidateDestroyed (QObject *)));
-            }
-            else
-            {
-                /* Cleanup */
-                if (mWhatsThisCandidate)
-                    disconnect (mWhatsThisCandidate, SIGNAL (destroyed (QObject *)),
-                                this, SLOT (whatsThisCandidateDestroyed (QObject *)));
-                mWhatsThisCandidate = NULL;
-            }
-
-            mWhatsThisTimer->start (100);
-            break;
-        }
-        case QEvent::FocusIn:
-        {
-            updateWhatsThis (true /* aGotFocus */);
-            break;
-        }
-        default:
-            break;
-    }
-
-    return QIMainDialog::eventFilter (aObject, aEvent);
-}
-
-void VBoxSettingsDialog::showEvent (QShowEvent *aEvent)
-{
-    QIMainDialog::showEvent (aEvent);
-    /* One may think that QWidget::polish() is the right place to do things
-     * below, but apparently, by the time when QWidget::polish() is called,
-     * the widget style & layout are not fully done, at least the minimum
-     * size hint is not properly calculated. Since this is sometimes necessary,
-     * we provide our own "polish" implementation. */
-
-    if (mPolished)
-        return;
-
-    mPolished = true;
-
-    int minWidth = mSelector->minWidth();
-#ifdef Q_WS_MAC
-    /* Remove all title bar buttons (Buggy Qt) */
-    ::darwinSetHidesAllTitleButtons (this);
-
-    /* Set all size policies to ignored */
-    for (int i = 0; i < mStack->count(); ++i)
-        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Ignored);
-    /* Activate every single page to get the optimal size */
-    for (int i = mStack->count() - 1; i >= 0; --i)
-    {
-        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
-        mStack->setCurrentIndex (i);
-        layout()->activate();
-        QSize s = minimumSize();
-        if (minWidth > s.width())
-            s.setWidth (minWidth);
-        mSizeList.insert (0, s);
-        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Ignored);
-    }
-
-    categoryChanged (mSelector->currentId());
-#else /* Q_WS_MAC */
-    /* Resize to the minimum possible size */
-    QSize s = minimumSize();
-    if (minWidth > s.width())
-        s.setWidth (minWidth);
-    resize (s);
-#endif /* Q_WS_MAC */
-
-    VBoxGlobal::centerWidget (this, parentWidget());
-}
-
-VBoxSettingsPage* VBoxSettingsDialog::attachValidator (VBoxSettingsPage *aPage)
-{
-    QIWidgetValidator *wval = new QIWidgetValidator (mSelector->itemTextByPage (aPage),
-                                                     aPage, this);
-    connect (wval, SIGNAL (validityChanged (const QIWidgetValidator*)),
-             this, SLOT (enableOk (const QIWidgetValidator*)));
-    connect (wval, SIGNAL (isValidRequested (QIWidgetValidator*)),
-             this, SLOT (revalidate (QIWidgetValidator*)));
-
-    aPage->setValidator (wval);
-    aPage->setOrderAfter (mSelector->widget());
-
-    return aPage;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialogSpecific.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialogSpecific.cpp	(revision 25170)
+++ 	(revision )
@@ -1,609 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxSettingsDialog class implementation
- */
-
-/*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-// #define ENABLE_GLOBAL_USB
-
-#include "VBoxSettingsDialogSpecific.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "QIWidgetValidator.h"
-#include "VBoxSettingsSelector.h"
-
-#include "VBoxGLSettingsGeneral.h"
-#include "VBoxGLSettingsInput.h"
-#include "VBoxGLSettingsUpdate.h"
-#include "VBoxGLSettingsLanguage.h"
-#include "VBoxGLSettingsNetwork.h"
-
-#include "VBoxVMSettingsGeneral.h"
-#include "VBoxVMSettingsSystem.h"
-#include "VBoxVMSettingsDisplay.h"
-#include "VBoxVMSettingsHD.h"
-#include "VBoxVMSettingsAudio.h"
-#include "VBoxVMSettingsNetwork.h"
-#include "VBoxVMSettingsSerial.h"
-#include "VBoxVMSettingsParallel.h"
-#include "VBoxVMSettingsUSB.h"
-#include "VBoxVMSettingsSF.h"
-
-/* Qt includes */
-#include <QStackedWidget>
-
-VBoxGLSettingsDlg::VBoxGLSettingsDlg (QWidget *aParent)
-    : VBoxSettingsDialog (aParent)
-{
-#ifndef Q_WS_MAC
-    setWindowIcon (QIcon (":/global_settings_16px.png"));
-#endif /* Q_WS_MAC */
-
-    /* Creating settings pages */
-    VBoxSettingsPage *prefPage = NULL;
-
-    /* General page */
-    if (isAvailable (GeneralId))
-    {
-        prefPage = new VBoxGLSettingsGeneral();
-        addItem (":/machine_32px.png", ":/machine_disabled_32px.png",
-                 ":/machine_16px.png", ":/machine_disabled_16px.png",
-                 GeneralId, "#general", prefPage);
-    }
-
-    /* Input page */
-    if (isAvailable (InputId))
-    {
-        prefPage = new VBoxGLSettingsInput();
-        addItem (":/hostkey_32px.png", ":/hostkey_disabled_32px.png",
-                 ":/hostkey_16px.png", ":/hostkey_disabled_16px.png",
-                 InputId, "#input", prefPage);
-    }
-
-    /* Update page */
-    if (isAvailable (UpdateId))
-    {
-        prefPage = new VBoxGLSettingsUpdate();
-        addItem (":/refresh_32px.png", ":/refresh_disabled_32px.png",
-                 ":/refresh_16px.png", ":/refresh_disabled_16px.png",
-                 UpdateId, "#update", prefPage);
-    }
-
-    /* Language page */
-    if (isAvailable (LanguageId))
-    {
-        prefPage = new VBoxGLSettingsLanguage();
-        addItem (":/site_32px.png", ":/site_disabled_32px.png",
-                 ":/site_16px.png", ":/site_disabled_16px.png",
-                 LanguageId, "#language", prefPage);
-    }
-
-#ifdef ENABLE_GLOBAL_USB
-    /* USB page */
-    if (isAvailable (USBId))
-    {
-        prefPage = new VBoxVMSettingsUSB (VBoxVMSettingsUSB::HostType);
-        addItem (":/usb_32px.png", ":/usb_disabled_32px.png",
-                 ":/usb_16px.png", ":/usb_disabled_16px.png",
-                 USBId, "#usb", prefPage);
-    }
-#endif
-
-#ifdef VBOX_WITH_NETFLT
-    /* Network page */
-    if (isAvailable (NetworkId))
-    {
-        prefPage = new VBoxGLSettingsNetwork();
-        addItem (":/nw_32px.png", ":/nw_disabled_32px.png",
-                 ":/nw_16px.png", ":/nw_disabled_16px.png",
-                 NetworkId, "#language", prefPage);
-    }
-#endif
-
-    /* Applying language settings */
-    retranslateUi();
-
-    /* First item as default */
-    mSelector->selectById (0);
-}
-
-void VBoxGLSettingsDlg::getFrom()
-{
-    CSystemProperties prop = vboxGlobal().virtualBox().GetSystemProperties();
-    VBoxGlobalSettings sett = vboxGlobal().settings();
-
-    QList <VBoxSettingsPage*> pages = mSelector->settingPages();
-    foreach (VBoxSettingsPage *page, pages)
-        if (page->isEnabled())
-            page->getFrom (prop, sett);
-}
-
-void VBoxGLSettingsDlg::putBackTo()
-{
-    CSystemProperties prop = vboxGlobal().virtualBox().GetSystemProperties();
-    VBoxGlobalSettings sett = vboxGlobal().settings();
-    VBoxGlobalSettings newsett = sett;
-
-    QList <VBoxSettingsPage*> pages = mSelector->settingPages();
-    foreach (VBoxSettingsPage *page, pages)
-        if (page->isEnabled())
-            page->putBackTo (prop, newsett);
-
-    if (!prop.isOk())
-        vboxProblem().cannotSetSystemProperties (prop);
-    else
-    {
-        if (!(newsett == sett))
-            vboxGlobal().setSettings (newsett);
-    }
-}
-
-void VBoxGLSettingsDlg::retranslateUi()
-{
-    /* Set dialog's name */
-    setWindowTitle (dialogTitle());
-
-    /* General page */
-    mSelector->setItemText (GeneralId, tr ("General"));
-
-    /* Input page */
-    mSelector->setItemText (InputId, tr ("Input"));
-
-    /* Update page */
-    mSelector->setItemText (UpdateId, tr ("Update"));
-
-    /* Language page */
-    mSelector->setItemText (LanguageId, tr ("Language"));
-
-#ifdef ENABLE_GLOBAL_USB
-    /* USB page */
-    mSelector->setItemText (USBId, tr ("USB"));
-#endif
-
-    /* Network page */
-    mSelector->setItemText (NetworkId, tr ("Network"));
-
-    /* Translate the selector */
-    mSelector->polish();
-
-    VBoxSettingsDialog::retranslateUi();
-}
-
-QString VBoxGLSettingsDlg::dialogTitle() const
-{
-    return tr ("VirtualBox - %1").arg (titleExtension());
-}
-
-bool VBoxGLSettingsDlg::isAvailable (GLSettingsPageIds aId)
-{
-    /* Show the host error message for particular group if present.
-     * We don't use the generic cannotLoadGlobalConfig()
-     * call here because we want this message to be suppressible. */
-    switch (aId)
-    {
-        case USBId:
-        {
-            /* Show the host error message */
-            CHost host = vboxGlobal().virtualBox().GetHost();
-            if (!host.isReallyOk())
-                vboxProblem().cannotAccessUSB (host);
-
-            /* Check if USB is implemented */
-            CHostUSBDeviceFilterVector coll = host.GetUSBDeviceFilters();
-            if (host.lastRC() == E_NOTIMPL)
-                return false;
-
-            /* Break to common result */
-            break;
-        }
-        default:
-            break;
-    }
-    return true;
-}
-
-VBoxVMSettingsDlg::VBoxVMSettingsDlg (QWidget *aParent,
-                                      const CMachine &aMachine,
-                                      const QString &aCategory,
-                                      const QString &aControl)
-    : VBoxSettingsDialog (aParent)
-    , mMachine (aMachine)
-    , mAllowResetFirstRunFlag (false)
-{
-#ifndef Q_WS_MAC
-    setWindowIcon (QIcon (":/settings_16px.png"));
-#endif /* Q_WS_MAC */
-
-    /* Common */
-    connect (&vboxGlobal(), SIGNAL (mediumEnumFinished (const VBoxMediaList &)),
-             this, SLOT (onMediaEnumerationDone()));
-
-    /* Creating settings pages */
-    VBoxSettingsPage *prefPage = NULL;
-
-    /* General page */
-    if (isAvailable (GeneralId))
-    {
-        prefPage = new VBoxVMSettingsGeneral();
-        addItem (":/machine_32px.png", ":/machine_disabled_32px.png",
-                 ":/machine_16px.png", ":/machine_disabled_16px.png",
-                 GeneralId, "#general", prefPage);
-    }
-
-    /* System page */
-    if (isAvailable (SystemId))
-    {
-        prefPage = new VBoxVMSettingsSystem();
-        connect (prefPage, SIGNAL (tableChanged()), this, SLOT (resetFirstRunFlag()));
-        addItem (":/chipset_32px.png", ":/chipset_disabled_32px.png",
-                 ":/chipset_16px.png", ":/chipset_disabled_16px.png",
-                 SystemId, "#system", prefPage);
-    }
-
-    /* Display page */
-    if (isAvailable (DisplayId))
-    {
-        prefPage = new VBoxVMSettingsDisplay();
-        addItem (":/vrdp_32px.png", ":/vrdp_disabled_32px.png",
-                 ":/vrdp_16px.png", ":/vrdp_disabled_16px.png",
-                 DisplayId, "#display", prefPage);
-    }
-
-    /* Storage page */
-    if (isAvailable (StorageId))
-    {
-        prefPage = new VBoxVMSettingsHD();
-        connect (prefPage, SIGNAL (storageChanged()), this, SLOT (resetFirstRunFlag()));
-        addItem (":/hd_32px.png", ":/hd_disabled_32px.png",
-                 ":/attachment_16px.png", ":/attachment_disabled_16px.png",
-                 StorageId, "#storage", prefPage);
-    }
-
-    /* Audio page */
-    if (isAvailable (AudioId))
-    {
-        prefPage = new VBoxVMSettingsAudio();
-        addItem (":/sound_32px.png", ":/sound_disabled_32px.png",
-                 ":/sound_16px.png", ":/sound_disabled_16px.png",
-                 AudioId, "#audio", prefPage);
-    }
-
-    /* Network page */
-    if (isAvailable (NetworkId))
-    {
-        prefPage = new VBoxVMSettingsNetworkPage();
-        addItem (":/nw_32px.png", ":/nw_disabled_32px.png",
-                 ":/nw_16px.png", ":/nw_disabled_16px.png",
-                 NetworkId, "#network", prefPage);
-    }
-
-    /* Ports page */
-    if (isAvailable (PortsId))
-    {
-        addItem (":/serial_port_32px.png", ":/serial_port_disabled_32px.png",
-                 ":/serial_port_16px.png", ":/serial_port_disabled_16px.png",
-                 PortsId, "#ports");
-
-        /* USB page */
-        if (isAvailable (USBId))
-        {
-            prefPage = new VBoxVMSettingsUSB (VBoxVMSettingsUSB::MachineType);
-            addItem (":/usb_32px.png", ":/usb_disabled_32px.png",
-                     ":/usb_16px.png", ":/usb_disabled_16px.png",
-                     USBId, "#usb", prefPage, PortsId);
-        }
-
-        /* Serial page */
-        if (isAvailable (SerialId))
-        {
-            prefPage = new VBoxVMSettingsSerialPage();
-            addItem (":/serial_port_32px.png", ":/serial_port_disabled_32px.png",
-                     ":/serial_port_16px.png", ":/serial_port_disabled_16px.png",
-                     SerialId, "#serialPorts", prefPage, PortsId);
-        }
-
-        /* Parallel page */
-        if (isAvailable (ParallelId))
-        {
-            prefPage = new VBoxVMSettingsParallelPage();
-            addItem (":/parallel_port_32px.png", ":/parallel_port_disabled_32px.png",
-                     ":/parallel_port_16px.png", ":/parallel_port_disabled_16px.png",
-                     ParallelId, "#parallelPorts", prefPage, PortsId);
-        }
-    }
-
-    /* SFolders page */
-    if (isAvailable (SFId))
-    {
-        prefPage = new VBoxVMSettingsSF (MachineType);
-        addItem (":/shared_folder_32px.png", ":/shared_folder_disabled_32px.png", ":/shared_folder_16px.png", ":/shared_folder_disabled_16px.png",
-                 SFId, "#sfolders",
-                 prefPage);
-    }
-
-    /* Applying language settings */
-    retranslateUi();
-
-    /* Setup Settings Dialog */
-    if (!aCategory.isNull())
-    {
-        mSelector->selectByLink (aCategory);
-        /* Search for a widget with the given name */
-        if (!aControl.isNull())
-        {
-            if (QWidget *w = mStack->currentWidget()->findChild <QWidget*> (aControl))
-            {
-                QList <QWidget*> parents;
-                QWidget *p = w;
-                while ((p = p->parentWidget()) != NULL)
-                {
-                    if (QTabWidget *tb = qobject_cast <QTabWidget*> (p))
-                    {
-                        /* The tab contents widget is two steps down
-                         * (QTabWidget -> QStackedWidget -> QWidget) */
-                        QWidget *c = parents [parents.count() - 1];
-                        if (c)
-                            c = parents [parents.count() - 2];
-                        if (c)
-                            tb->setCurrentWidget (c);
-                    }
-                    parents.append (p);
-                }
-
-                w->setFocus();
-            }
-        }
-    }
-    /* First item as default */
-    else
-        mSelector->selectById (0);
-}
-
-void VBoxVMSettingsDlg::getFrom()
-{
-    /* Load all the settings pages */
-    QList <VBoxSettingsPage*> pages = mSelector->settingPages();
-    foreach (VBoxSettingsPage *page, pages)
-        page->getFrom (mMachine);
-
-    /* Finally set the reset First Run Wizard flag to "false" to make sure
-     * user will see this dialog if he hasn't change the boot-order
-     * and/or mounted images configuration */
-    mResetFirstRunFlag = false;
-}
-
-void VBoxVMSettingsDlg::putBackTo()
-{
-    /* Commit all the settings pages */
-    QList <VBoxSettingsPage*> pages = mSelector->settingPages();
-    foreach (VBoxSettingsPage *page, pages)
-        page->putBackTo();
-
-    /* Guest OS type & VT-x/AMD-V option correlation test */
-    VBoxVMSettingsGeneral *generalPage =
-        qobject_cast <VBoxVMSettingsGeneral*> (mSelector->idToPage (GeneralId));
-    VBoxVMSettingsSystem *systemPage =
-        qobject_cast <VBoxVMSettingsSystem*> (mSelector->idToPage (SystemId));
-    if (generalPage && systemPage &&
-        generalPage->is64BitOSTypeSelected() && !systemPage->isHWVirtExEnabled())
-        mMachine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, true);
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    /* Disable 2D Video Acceleration for non-Windows guests */
-    if (generalPage && !generalPage->isWindowsOSTypeSelected())
-    {
-        VBoxVMSettingsDisplay *displayPage =
-            qobject_cast <VBoxVMSettingsDisplay*> (mSelector->idToPage (DisplayId));
-        if (displayPage && displayPage->isAcceleration2DVideoSelected())
-            mMachine.SetAccelerate2DVideoEnabled (false);
-    }
-#endif
-
-    /* Clear the "GUI_FirstRun" extra data key in case if the boot order
-     * and/or disk configuration were changed */
-    if (mResetFirstRunFlag)
-        mMachine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null);
-}
-
-void VBoxVMSettingsDlg::retranslateUi()
-{
-    /* Set dialog's name */
-    setWindowTitle (dialogTitle());
-
-    /* We have to make sure that the Serial & Network subpages are retranslated
-     * before they are revalidated. Cause: They do string comparing within
-     * vboxGlobal which is retranslated at that point already. */
-    QEvent event (QEvent::LanguageChange);
-    QWidget *page = NULL;
-
-    /* General page */
-    mSelector->setItemText (GeneralId, tr ("General"));
-
-    /* System page */
-    mSelector->setItemText (SystemId, tr ("System"));
-
-    /* Display page */
-    mSelector->setItemText (DisplayId, tr ("Display"));
-
-    /* Storage page */
-    mSelector->setItemText (StorageId, tr ("Storage"));
-
-    /* HD page */
-    mSelector->setItemText (HDId, tr ("Hard Disks"));
-
-    /* CD page */
-    mSelector->setItemText (CDId, tr ("CD/DVD-ROM"));
-
-    /* FD page */
-    mSelector->setItemText (FDId, tr ("Floppy"));
-
-    /* Audio page */
-    mSelector->setItemText (AudioId, tr ("Audio"));
-
-    /* Network page */
-    mSelector->setItemText (NetworkId, tr ("Network"));
-    if ((page = mSelector->idToPage (NetworkId)))
-        qApp->sendEvent (page, &event);
-
-    /* Ports page */
-    mSelector->setItemText (PortsId, tr ("Ports"));
-
-    /* Serial page */
-    mSelector->setItemText (SerialId, tr ("Serial Ports"));
-    if ((page = mSelector->idToPage (SerialId)))
-        qApp->sendEvent (page, &event);
-
-    /* Parallel page */
-    mSelector->setItemText (ParallelId, tr ("Parallel Ports"));
-    if ((page = mSelector->idToPage (ParallelId)))
-        qApp->sendEvent (page, &event);
-
-    /* USB page */
-    mSelector->setItemText (USBId, tr ("USB"));
-
-    /* SFolders page */
-    mSelector->setItemText (SFId, tr ("Shared Folders"));
-
-    /* Translate the selector */
-    mSelector->polish();
-
-    VBoxSettingsDialog::retranslateUi();
-
-    /* Revalidate all pages to retranslate the warning messages also. */
-    QList <QIWidgetValidator*> l = this->findChildren <QIWidgetValidator*> ();
-    foreach (QIWidgetValidator *wval, l)
-        if (!wval->isValid())
-            revalidate (wval);
-}
-
-QString VBoxVMSettingsDlg::dialogTitle() const
-{
-    QString dialogTitle;
-    if (!mMachine.isNull())
-        dialogTitle = tr ("%1 - %2").arg (mMachine.GetName())
-                                    .arg (titleExtension());
-    return dialogTitle;
-}
-
-bool VBoxVMSettingsDlg::correlate (QWidget *aPage, QString &aWarning)
-{
-    /* This method performs correlation option check between
-     * different pages of VM Settings dialog */
-
-    if (aPage == mSelector->idToPage (GeneralId) ||
-        aPage == mSelector->idToPage (SystemId))
-    {
-        VBoxVMSettingsGeneral *generalPage =
-            qobject_cast <VBoxVMSettingsGeneral*> (mSelector->idToPage (GeneralId));
-        VBoxVMSettingsSystem *systemPage =
-            qobject_cast <VBoxVMSettingsSystem*> (mSelector->idToPage (SystemId));
-
-        /* Guest OS type & VT-x/AMD-V option correlation test */
-        if (generalPage && systemPage &&
-            generalPage->is64BitOSTypeSelected() && !systemPage->isHWVirtExEnabled())
-        {
-            aWarning = tr (
-                "you have selected a 64-bit guest OS type for this VM. As such guests "
-                "require hardware virtualization (VT-x/AMD-V), this feature will be enabled "
-                "automatically.");
-            return true;
-        }
-
-#ifndef Q_WS_MAC
-        /* Guest OS bitness & SMP slider correlation test */
-        if (ARCH_BITS == 32 && generalPage && systemPage &&
-            generalPage->is64BitOSTypeSelected() && systemPage->cpuCount() > 1)
-        {
-            aWarning = tr (
-                "you have selected a 64-bit guest OS type for this VM. "
-                "VirtualBox does not currently support more than one virtual CPU "
-                "for 64-bit guests executed on 32-bit hosts.");
-            return false;
-        }
-#endif
-    }
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    /* 2D Video Acceleration is available for Windows guests only */
-    if (aPage == mSelector->idToPage (DisplayId))
-    {
-        VBoxVMSettingsGeneral *generalPage =
-            qobject_cast <VBoxVMSettingsGeneral*> (mSelector->idToPage (GeneralId));
-        VBoxVMSettingsDisplay *displayPage =
-            qobject_cast <VBoxVMSettingsDisplay*> (mSelector->idToPage (DisplayId));
-        if (generalPage && displayPage &&
-            displayPage->isAcceleration2DVideoSelected() && !generalPage->isWindowsOSTypeSelected())
-        {
-            aWarning = tr (
-                "you have 2D Video Acceleration enabled. As 2D Video Acceleration "
-                "is supported for Windows guests only, this feature will be disabled.");
-            return true;
-        }
-    }
-#endif
-
-    return true;
-}
-
-void VBoxVMSettingsDlg::onMediaEnumerationDone()
-{
-    mAllowResetFirstRunFlag = true;
-}
-
-void VBoxVMSettingsDlg::resetFirstRunFlag()
-{
-    if (mAllowResetFirstRunFlag)
-        mResetFirstRunFlag = true;
-}
-
-bool VBoxVMSettingsDlg::isAvailable (VMSettingsPageIds aId)
-{
-    if (mMachine.isNull())
-        return false;
-
-    /* Show the machine error message for particular group if present.
-     * We don't use the generic cannotLoadMachineSettings()
-     * call here because we want this message to be suppressible. */
-    switch (aId)
-    {
-        case ParallelId:
-        {
-            /* This page is currently disabled */
-            return false;
-        }
-        case USBId:
-        {
-            /* Show the host error message */
-            CUSBController ctl = mMachine.GetUSBController();
-            if (!mMachine.isReallyOk())
-                vboxProblem().cannotAccessUSB (mMachine);
-
-            /* Check if USB is implemented */
-            if (ctl.isNull())
-                return false;
-
-            /* Break to common result */
-            break;
-        }
-        default:
-            break;
-    }
-    return true;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsSelector.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsSelector.cpp	(revision 25170)
+++ 	(revision )
@@ -1,675 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxSettingsSelector class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global includes */
-#include <QHeaderView>
-#include <QTabWidget>
-
-/* Local includes */
-#include "VBoxSettingsSelector.h"
-#include "VBoxSettingsPage.h"
-#include "VBoxGlobal.h"
-#include "VBoxToolBar.h"
-#include "QITreeWidget.h"
-
-enum
-{
-    /* mTwSelector column numbers */
-    treeWidget_Category = 0,
-    treeWidget_Id,
-    treeWidget_Link
-};
-
-class SelectorItem
-{
-public:
-    SelectorItem (const QIcon &aIcon, const QString &aText, int aId, const QString &aLink, VBoxSettingsPage* aPage, int aParentId)
-        : mIcon (aIcon)
-        , mText (aText)
-        , mId (aId)
-        , mLink (aLink)
-        , mPage (aPage)
-        , mParentId (aParentId)
-    {}
-
-    QIcon icon() const { return mIcon; }
-    QString text() const { return mText; }
-    void setText (const QString &aText) { mText = aText; }
-    int id() const { return mId; }
-    QString link() const { return mLink; }
-    VBoxSettingsPage *page() const { return mPage; }
-    int parentId() const { return mParentId; }
-
-protected:
-
-    QIcon mIcon;
-    QString mText;
-    int mId;
-    QString mLink;
-    VBoxSettingsPage* mPage;
-    int mParentId;
-};
-
-VBoxSettingsSelector::VBoxSettingsSelector (QWidget *aParent /* = NULL */)
-    :QObject (aParent)
-{
-}
-
-VBoxSettingsSelector::~VBoxSettingsSelector()
-{
-    qDeleteAll (mItemList);
-    mItemList.clear();
-}
-
-void VBoxSettingsSelector::setItemText (int aId, const QString &aText)
-{
-    if (SelectorItem *item = findItem (aId))
-        item->setText (aText);
-}
-
-QString VBoxSettingsSelector::itemTextByPage (VBoxSettingsPage *aPage) const
-{
-    QString text;
-    if (SelectorItem *item = findItemByPage (aPage))
-        text = item->text();
-    return text;
-}
-
-QWidget *VBoxSettingsSelector::idToPage (int aId) const
-{
-    VBoxSettingsPage *page = NULL;
-    if (SelectorItem *item = findItem (aId))
-        page = item->page();
-    return page;
-}
-
-QList<VBoxSettingsPage*> VBoxSettingsSelector::settingPages() const
-{
-    QList<VBoxSettingsPage*> list;
-    foreach (SelectorItem *item, mItemList)
-        if (item->page())
-            list << item->page();
-    return list;
-}
-
-QList<QWidget*> VBoxSettingsSelector::rootPages() const
-{
-    QList<QWidget*> list;
-    foreach (SelectorItem *item, mItemList)
-        if (item->page())
-            list << item->page();
-    return list;
-}
-
-
-SelectorItem *VBoxSettingsSelector::findItem (int aId) const
-{
-    SelectorItem *result = NULL;
-    foreach (SelectorItem *item, mItemList)
-        if (item->id() == aId)
-        {
-            result = item;
-            break;
-        }
-    return result;
-}
-
-SelectorItem *VBoxSettingsSelector::findItemByLink (const QString &aLink) const
-{
-    SelectorItem *result = NULL;
-    foreach (SelectorItem *item, mItemList)
-        if (item->link() == aLink)
-        {
-            result = item;
-            break;
-        }
-    return result;
-}
-
-SelectorItem *VBoxSettingsSelector::findItemByPage (VBoxSettingsPage* aPage) const
-{
-    SelectorItem *result = NULL;
-    foreach (SelectorItem *item, mItemList)
-        if (item->page() == aPage)
-        {
-            result = item;
-            break;
-        }
-    return result;
-}
-
-/* VBoxSettingsTreeViewSelector */
-
-/* Returns the path to the item in the form of 'grandparent > parent > item'
- * using the text of the first column of every item. */
-static QString path (QTreeWidgetItem *aItem)
-{
-    static QString sep = ": ";
-    QString p;
-    QTreeWidgetItem *cur = aItem;
-    while (cur)
-    {
-        if (!p.isNull())
-            p = sep + p;
-        p = cur->text (treeWidget_Category).simplified() + p;
-        cur = cur->parent();
-    }
-    return p;
-}
-
-VBoxSettingsTreeViewSelector::VBoxSettingsTreeViewSelector (QWidget *aParent /* = NULL */)
-    :VBoxSettingsSelector (aParent)
-{
-    mTwSelector = new QITreeWidget (aParent);
-    /* Configure the selector */
-    QSizePolicy sizePolicy (QSizePolicy::Minimum, QSizePolicy::Expanding);
-    sizePolicy.setHorizontalStretch (0);
-    sizePolicy.setVerticalStretch (0);
-    sizePolicy.setHeightForWidth (mTwSelector->sizePolicy().hasHeightForWidth());
-    mTwSelector->setSizePolicy (sizePolicy);
-    mTwSelector->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
-    mTwSelector->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
-    mTwSelector->setRootIsDecorated (false);
-    mTwSelector->setUniformRowHeights (true);
-    /* Add the columns */
-    mTwSelector->headerItem()->setText (treeWidget_Category, "Category");
-    mTwSelector->headerItem()->setText (treeWidget_Id, "[id]");
-    mTwSelector->headerItem()->setText (treeWidget_Link, "[link]");
-    /* Hide unnecessary columns and header */
-    mTwSelector->header()->hide();
-    mTwSelector->hideColumn (treeWidget_Id);
-    mTwSelector->hideColumn (treeWidget_Link);
-    /* Setup connections */
-    connect (mTwSelector, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
-             this, SLOT (settingsGroupChanged (QTreeWidgetItem *, QTreeWidgetItem*)));
-}
-
-QWidget *VBoxSettingsTreeViewSelector::widget() const
-{
-    return mTwSelector;
-}
-
-QWidget *VBoxSettingsTreeViewSelector::addItem (const QString & /* aBigIcon */,
-                                                const QString & /* aBigIconDisabled */,
-                                                const QString &aSmallIcon,
-                                                const QString &aSmallIconDisabled,
-                                                int aId,
-                                                const QString &aLink,
-                                                VBoxSettingsPage* aPage /* = NULL */,
-                                                int aParentId /* = -1 */)
-{
-    QWidget *result = NULL;
-    if (aPage != NULL)
-    {
-        QIcon icon (aSmallIcon);
-        if (aSmallIconDisabled.isEmpty())
-            icon.addFile (aSmallIconDisabled, QSize(), QIcon::Disabled);
-
-        SelectorItem *item = new SelectorItem (icon, "", aId, aLink, aPage, aParentId);
-        mItemList.append (item);
-
-        QTreeWidgetItem *twitem = new QTreeWidgetItem (mTwSelector, QStringList() << QString ("")
-                                                                                  << idToString (aId)
-                                                                                  << aLink);
-        twitem->setIcon (treeWidget_Category, item->icon());
-        aPage->setContentsMargins (0, 0, 0, 0);
-        VBoxGlobal::setLayoutMargin (aPage->layout(), 0);
-        result = aPage;
-    }
-    return result;
-}
-
-void VBoxSettingsTreeViewSelector::setItemText (int aId, const QString &aText)
-{
-    VBoxSettingsSelector::setItemText (aId, aText);
-    QTreeWidgetItem *item = findItem (mTwSelector, idToString (aId), treeWidget_Id);
-    if (item)
-        item->setText (treeWidget_Category, QString (" %1 ").arg (aText));
-}
-
-QString VBoxSettingsTreeViewSelector::itemText (int aId) const
-{
-    return pagePath (idToString (aId));
-}
-
-int VBoxSettingsTreeViewSelector::currentId () const
-{
-    int id = -1;
-    QTreeWidgetItem *item = mTwSelector->currentItem();
-    if (item)
-        id = item->text (treeWidget_Id).toInt();
-    return id;
-}
-
-int VBoxSettingsTreeViewSelector::linkToId (const QString &aLink) const
-{
-    int id = -1;
-    QTreeWidgetItem *item = findItem (mTwSelector, aLink, treeWidget_Link);
-    if (item)
-        id = item->text (treeWidget_Id).toInt();
-    return id;
-}
-
-
-void VBoxSettingsTreeViewSelector::selectById (int aId)
-{
-    QTreeWidgetItem *item = findItem (mTwSelector, idToString (aId), treeWidget_Id);
-    if (item)
-        mTwSelector->setCurrentItem (item);
-}
-
-void VBoxSettingsTreeViewSelector::setVisibleById (int aId, bool aShow)
-{
-    QTreeWidgetItem *item = findItem (mTwSelector, idToString (aId), treeWidget_Id);
-    if (item)
-        item->setHidden (!aShow);
-}
-
-void VBoxSettingsTreeViewSelector::polish()
-{
-    mTwSelector->setFixedWidth (static_cast<QAbstractItemView*> (mTwSelector)
-        ->sizeHintForColumn (treeWidget_Category) + 2 * mTwSelector->frameWidth());
-
-    /* Sort selector by the id column */
-    mTwSelector->sortItems (treeWidget_Id, Qt::AscendingOrder);
-    mTwSelector->resizeColumnToContents (treeWidget_Category);
-
-    /* Add some margin to every item in the tree */
-    mTwSelector->addTopBottomMarginToItems (12);
-}
-
-void VBoxSettingsTreeViewSelector::settingsGroupChanged (QTreeWidgetItem *aItem,
-                                                     QTreeWidgetItem * /* aPrevItem */)
-{
-    if (aItem)
-    {
-        int id = aItem->text (treeWidget_Id).toInt();
-        Assert (id >= 0);
-        emit categoryChanged (id);
-    }
-}
-
-void VBoxSettingsTreeViewSelector::clear()
-{
-    mTwSelector->clear();
-}
-
-/**
- *  Returns a path to the given page of this settings dialog. See ::path() for
- *  details.
- */
-QString VBoxSettingsTreeViewSelector::pagePath (const QString &aMatch) const
-{
-    QTreeWidgetItem *li =
-        findItem (mTwSelector,
-                  aMatch,
-                  treeWidget_Id);
-    return ::path (li);
-}
-
-/* Returns first item of 'aView' matching required 'aMatch' value
- * searching the 'aColumn' column. */
-QTreeWidgetItem* VBoxSettingsTreeViewSelector::findItem (QTreeWidget *aView,
-                                                         const QString &aMatch,
-                                                         int aColumn) const
-{
-    QList<QTreeWidgetItem*> list =
-        aView->findItems (aMatch, Qt::MatchExactly, aColumn);
-
-    return list.count() ? list [0] : 0;
-}
-
-QString VBoxSettingsTreeViewSelector::idToString (int aId) const
-{
-    return QString ("%1").arg (aId, 2, 10, QLatin1Char ('0'));
-}
-
-/* VBoxSettingsToolBarSelector */
-
-
-class SelectorActionItem: public SelectorItem
-{
-public:
-    SelectorActionItem (const QIcon &aIcon, const QString &aText, int aId, const QString &aLink, VBoxSettingsPage* aPage, int aParentId, QObject *aParent)
-        : SelectorItem (aIcon, aText, aId, aLink, aPage, aParentId)
-        , mAction (new QAction (aIcon, aText, aParent))
-        , mTabWidget (NULL)
-    {
-        mAction->setCheckable (true);
-    }
-
-    QAction *action() const { return mAction; }
-
-    void setTabWidget (QTabWidget *aTabWidget) { mTabWidget = aTabWidget; }
-    QTabWidget *tabWidget() const { return mTabWidget; }
-
-protected:
-
-    QAction *mAction;
-    QTabWidget *mTabWidget;
-};
-
-VBoxSettingsToolBarSelector::VBoxSettingsToolBarSelector (QWidget *aParent /* = NULL */)
-    : VBoxSettingsSelector (aParent)
-{
-    /* Init the toolbar */
-    mTbSelector = new VBoxToolBar (aParent);
-    mTbSelector->setUsesTextLabel (true);
-    mTbSelector->setIconSize (QSize (32, 32));
-#ifdef Q_WS_MAC
-    mTbSelector->setShowToolBarButton (false);
-#endif /* Q_WS_MAC */
-    /* Init the action group for house keeping */
-    mActionGroup = new QActionGroup (this);
-    mActionGroup->setExclusive (true);
-    connect (mActionGroup, SIGNAL (triggered (QAction*)),
-             this, SLOT (settingsGroupChanged (QAction*)));
-}
-
-VBoxSettingsToolBarSelector::~VBoxSettingsToolBarSelector()
-{
-    delete mTbSelector;
-}
-
-QWidget *VBoxSettingsToolBarSelector::widget() const
-{
-    return mTbSelector;
-}
-
-QWidget *VBoxSettingsToolBarSelector::addItem (const QString &aBigIcon,
-                                               const QString &aBigIconDisabled,
-                                               const QString &aSmallIcon,
-                                               const QString &aSmallIconDisabled,
-                                               int aId,
-                                               const QString &aLink,
-                                               VBoxSettingsPage* aPage /* = NULL */,
-                                               int aParentId /* = -1 */)
-{
-    QIcon icon (aBigIcon);
-    if (!aBigIconDisabled.isEmpty())
-        icon.addFile (aBigIconDisabled, QSize(), QIcon::Disabled);
-
-    QWidget *result = NULL;
-    SelectorActionItem *item = new SelectorActionItem (icon, "", aId, aLink, aPage, aParentId, this);
-    mItemList.append (item);
-
-    if (aParentId == -1 &&
-        aPage != NULL)
-    {
-        mActionGroup->addAction (item->action());
-        mTbSelector->addAction (item->action());
-        aPage->setContentsMargins (0, 0, 0, 0);
-        VBoxGlobal::setLayoutMargin (aPage->layout(), 0);
-        result = aPage;
-    }
-    else if (aParentId == -1 &&
-             aPage == NULL)
-    {
-        mActionGroup->addAction (item->action());
-        mTbSelector->addAction (item->action());
-        QTabWidget *tabWidget= new QTabWidget ();
-        tabWidget->setContentsMargins (0, 0, 0, 0);
-//        connect (tabWidget, SIGNAL (currentChanged (int)),
-//                 this, SLOT (settingsGroupChanged (int)));
-        item->setTabWidget (tabWidget);
-        result = tabWidget;
-    }else
-    {
-        SelectorActionItem *parent = findActionItem (aParentId);
-        if (parent)
-        {
-            QTabWidget *tabWidget = parent->tabWidget();
-            aPage->setContentsMargins (9, 5, 9, 9);
-            VBoxGlobal::setLayoutMargin (aPage->layout(), 0);
-            QIcon icon1 (aSmallIcon);
-            if (!aSmallIconDisabled.isEmpty())
-                icon1.addFile (aSmallIconDisabled, QSize(), QIcon::Disabled);
-            if (tabWidget)
-                tabWidget->addTab (aPage, icon1, "");
-        }
-    }
-    return result;
-}
-
-void VBoxSettingsToolBarSelector::setItemText (int aId, const QString &aText)
-{
-    if (SelectorActionItem *item = findActionItem (aId))
-    {
-        item->setText (aText);
-        if (item->action())
-            item->action()->setText (aText);
-        if (item->parentId() &&
-            item->page())
-        {
-            SelectorActionItem *parent = findActionItem (item->parentId());
-            if (parent &&
-                parent->tabWidget())
-                parent->tabWidget()->setTabText (
-                    parent->tabWidget()->indexOf (item->page()), aText);
-        }
-    }
-}
-
-QString VBoxSettingsToolBarSelector::itemText (int aId) const
-{
-    QString result;
-    if (SelectorItem *item = findItem (aId))
-        result = item->text();
-    return result;
-}
-
-int VBoxSettingsToolBarSelector::currentId () const
-{
-    SelectorActionItem *action = findActionItemByAction (mActionGroup->checkedAction());
-    int id = -1;
-    if (action)
-        id = action->id();
-    return id;
-}
-
-int VBoxSettingsToolBarSelector::linkToId (const QString &aLink) const
-{
-    int id = -1;
-    SelectorItem *item = VBoxSettingsSelector::findItemByLink (aLink);
-    if (item)
-        id = item->id();
-    return id;
-}
-
-QWidget *VBoxSettingsToolBarSelector::idToPage (int aId) const
-{
-    QWidget *page = NULL;
-    if (SelectorActionItem *item = findActionItem (aId))
-    {
-        page = item->page();
-        if (!page)
-            page = item->tabWidget();
-    }
-    return page;
-}
-
-QWidget *VBoxSettingsToolBarSelector::rootPage (int aId) const
-{
-    QWidget *page = NULL;
-    if (SelectorActionItem *item = findActionItem (aId))
-    {
-        if (item->parentId() > -1)
-            page = rootPage (item->parentId());
-        else if (item->page())
-            page = item->page();
-        else
-            page = item->tabWidget();
-    }
-    return page;
-}
-
-void VBoxSettingsToolBarSelector::selectById (int aId)
-{
-    if (SelectorActionItem *item = findActionItem (aId))
-    {
-        if (item->parentId() != -1)
-        {
-            SelectorActionItem *parent = findActionItem (item->parentId());
-            if (parent &&
-                parent->tabWidget())
-            {
-                parent->action()->trigger();
-                parent->tabWidget()->setCurrentIndex (
-                    parent->tabWidget()->indexOf (item->page()));
-            }
-        }
-        else
-            item->action()->trigger();
-    }
-}
-
-
-void VBoxSettingsToolBarSelector::setVisibleById (int aId, bool aShow)
-{
-    SelectorActionItem *item = findActionItem (aId);
-
-    if (item)
-    {
-        item->action()->setVisible (aShow);
-        if (item->parentId() > -1 &&
-            item->page())
-        {
-            SelectorActionItem *parent = findActionItem (item->parentId());
-            if (parent &&
-                parent->tabWidget())
-            {
-                if (aShow &&
-                    parent->tabWidget()->indexOf (item->page()) == -1)
-                    parent->tabWidget()->addTab (item->page(), item->text());
-                else if (!aShow &&
-                         parent->tabWidget()->indexOf (item->page()) > -1)
-                    parent->tabWidget()->removeTab (
-                        parent->tabWidget()->indexOf (item->page()));
-            }
-        }
-    }
-
-}
-
-void VBoxSettingsToolBarSelector::clear()
-{
-    QList<QAction*> list = mActionGroup->actions();
-    foreach (QAction *action, list)
-       delete action;
-}
-
-int VBoxSettingsToolBarSelector::minWidth() const
-{
-    return mTbSelector->sizeHint().width() + 2 * 10;
-}
-
-void VBoxSettingsToolBarSelector::settingsGroupChanged (QAction *aAction)
-{
-    SelectorActionItem *item = findActionItemByAction (aAction);
-    if (item)
-    {
-        emit categoryChanged (item->id());
-//        if (item->page() &&
-//            !item->tabWidget())
-//            emit categoryChanged (item->id());
-//        else
-//        {
-//
-//            item->tabWidget()->blockSignals (true);
-//            item->tabWidget()->setCurrentIndex (0);
-//            item->tabWidget()->blockSignals (false);
-//            printf ("%s\n", qPrintable(item->text()));
-//            SelectorActionItem *child = static_cast<SelectorActionItem*> (
-//                findItemByPage (static_cast<VBoxSettingsPage*> (item->tabWidget()->currentWidget())));
-//            if (child)
-//                emit categoryChanged (child->id());
-//        }
-    }
-}
-
-void VBoxSettingsToolBarSelector::settingsGroupChanged (int aIndex)
-{
-    SelectorActionItem *item = findActionItemByTabWidget (qobject_cast<QTabWidget*> (sender()), aIndex);
-    if (item)
-    {
-        if (item->page() &&
-            !item->tabWidget())
-            emit categoryChanged (item->id());
-        else
-        {
-            SelectorActionItem *child = static_cast<SelectorActionItem*> (
-                findItemByPage (static_cast<VBoxSettingsPage*> (item->tabWidget()->currentWidget())));
-            if (child)
-                emit categoryChanged (child->id());
-        }
-    }
-}
-
-SelectorActionItem* VBoxSettingsToolBarSelector::findActionItem (int aId) const
-{
-    return static_cast<SelectorActionItem*> (VBoxSettingsSelector::findItem (aId));
-}
-
-SelectorActionItem *VBoxSettingsToolBarSelector::findActionItemByTabWidget (QTabWidget* aTabWidget, int aIndex) const
-{
-    SelectorActionItem *result = NULL;
-    foreach (SelectorItem *item, mItemList)
-        if (static_cast<SelectorActionItem*> (item)->tabWidget() == aTabWidget)
-        {
-            QTabWidget *tw = static_cast<SelectorActionItem*> (item)->tabWidget();
-            result = static_cast<SelectorActionItem*> (
-                findItemByPage (static_cast<VBoxSettingsPage*> (tw->widget (aIndex))));
-            break;
-        }
-
-    return result;
-
-}
-
-QList<QWidget*> VBoxSettingsToolBarSelector::rootPages() const
-{
-    QList<QWidget*> list;
-    foreach (SelectorItem *item, mItemList)
-    {
-        SelectorActionItem *ai = static_cast<SelectorActionItem*> (item);
-        if (ai->parentId() == -1 &&
-            ai->page())
-            list << ai->page();
-        else if (ai->tabWidget())
-            list << ai->tabWidget();
-    }
-    return list;
-}
-
-SelectorActionItem *VBoxSettingsToolBarSelector::findActionItemByAction (QAction *aAction) const
-{
-    SelectorActionItem *result = NULL;
-    foreach (SelectorItem *item, mItemList)
-        if (static_cast<SelectorActionItem*> (item)->action() == aAction)
-        {
-            result = static_cast<SelectorActionItem*> (item);
-            break;
-        }
-
-    return result;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.h	(revision 25171)
@@ -0,0 +1,95 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxSnapshotDetailsDlg class declaration
+ */
+
+/*
+ * Copyright (C) 2008-2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxSnapshotDetailsDlg_h__
+#define __VBoxSnapshotDetailsDlg_h__
+
+/* Local includes */
+#include "VBoxSnapshotDetailsDlg.gen.h"
+#include "QIWithRetranslateUI.h"
+#include "COMDefs.h"
+
+/* Global forwards */
+class QScrollArea;
+
+class VBoxSnapshotDetailsDlg : public QIWithRetranslateUI <QDialog>, public Ui::VBoxSnapshotDetailsDlg
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSnapshotDetailsDlg (QWidget *aParent);
+
+    void getFromSnapshot (const CSnapshot &aSnapshot);
+    void putBackToSnapshot();
+
+protected:
+
+    void retranslateUi();
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+    void showEvent (QShowEvent *aEvent);
+
+private slots:
+
+    void onNameChanged (const QString &aText);
+
+private:
+
+    CSnapshot mSnapshot;
+
+    QPixmap mThumbnail;
+    QPixmap mScreenshot;
+};
+
+class VBoxScreenshotViewer : public QIWithRetranslateUI2 <QWidget>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxScreenshotViewer (QWidget *aParent, const QPixmap &aScreenshot,
+                          const QString &aSnapshotName, const QString &aMachineName);
+
+private:
+
+    void retranslateUi();
+
+    void showEvent (QShowEvent *aEvent);
+    void resizeEvent (QResizeEvent *aEvent);
+    void mousePressEvent (QMouseEvent *aEvent);
+    void keyPressEvent (QKeyEvent *aEvent);
+
+    void adjustPicture();
+
+    QScrollArea *mArea;
+    QLabel *mPicture;
+
+    QPixmap mScreenshot;
+    QString mSnapshotName;
+    QString mMachineName;
+
+    bool mZoomMode;
+};
+
+#endif // __VBoxSnapshotDetailsDlg_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.ui	(revision 25171)
@@ -0,0 +1,206 @@
+<ui version="4.0">
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008-2009 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxSnapshotDetailsDlg</class>
+ <widget class="QDialog" name="VBoxSnapshotDetailsDlg">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>450</width>
+    <height>450</height>
+   </rect>
+  </property>
+  <property name="windowIcon">
+   <iconset resource="../VirtualBox1.qrc">:/settings_16px.png</iconset>
+  </property>
+  <layout class="QGridLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="mLbName">
+     <property name="text">
+      <string>&amp;Name:</string>
+     </property>
+     <property name="buddy">
+      <cstring>mLeName</cstring>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QLineEdit" name="mLeName">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+       <horstretch>1</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+    </widget>
+   </item>
+   <item row="0" rowspan="2" column="2">
+    <widget class="QLabel" name="mLbThumbnail">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::Panel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Sunken</enum>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="mLbTaken">
+     <property name="text">
+      <string>Taken:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QLabel" name="mTxTaken">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+       <horstretch>1</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="mLbDescription">
+     <property name="text">
+      <string>&amp;Description:</string>
+     </property>
+     <property name="buddy">
+      <cstring>mTeDescription</cstring>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignTop</set>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1" colspan="2">
+    <widget class="QTextEdit" name="mTeDescription">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>1</horstretch>
+       <verstretch>1</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="tabChangesFocus">
+      <bool>true</bool>
+     </property>
+     <property name="acceptRichText">
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0">
+    <widget class="QLabel" name="mLbDetails">
+     <property name="text">
+      <string>D&amp;etails:</string>
+     </property>
+     <property name="buddy">
+      <cstring>mTeDetails</cstring>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignTop</set>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1" colspan="2">
+    <widget class="QTextEdit" name="mTeDetails">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>1</horstretch>
+       <verstretch>1</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::NoFrame</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Plain</enum>
+     </property>
+     <property name="readOnly">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0" colspan="3">
+    <widget class="QIDialogButtonBox" name="mButtonBox">
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QIDialogButtonBox</class>
+   <extends>QDialogButtonBox</extends>
+   <header>QIDialogButtonBox.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources>
+  <include location="../VirtualBox1.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>VBoxSnapshotDetailsDlg</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>203</x>
+     <y>365</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>203</x>
+     <y>193</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>VBoxSnapshotDetailsDlg</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>203</x>
+     <y>365</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>203</x>
+     <y>193</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.h	(revision 25171)
@@ -0,0 +1,104 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxSnapshotsWgt class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxSnapshotsWgt_h__
+#define __VBoxSnapshotsWgt_h__
+
+/* Global includes */
+#include <QTimer>
+
+/* Local includes */
+#include "VBoxSnapshotsWgt.gen.h"
+#include "VBoxGlobal.h"
+#include "QIWithRetranslateUI.h"
+
+/* Local forwards */
+class SnapshotWgtItem;
+
+/* Snapshot age format */
+enum SnapshotAgeFormat
+{
+    AgeInSeconds,
+    AgeInMinutes,
+    AgeInHours,
+    AgeInDays,
+    AgeMax
+};
+
+class VBoxSnapshotsWgt : public QIWithRetranslateUI <QWidget>, public Ui::VBoxSnapshotsWgt
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSnapshotsWgt (QWidget *aParent);
+
+    void setMachine (const CMachine &aMachine);
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void onCurrentChanged (QTreeWidgetItem *aItem = 0);
+    void onContextMenuRequested (const QPoint &aPoint);
+    void onItemChanged (QTreeWidgetItem *aItem);
+
+    void restoreSnapshot();
+    void deleteSnapshot();
+    void showSnapshotDetails();
+    void takeSnapshot();
+
+    void machineDataChanged (const VBoxMachineDataChangeEvent &aEvent);
+    void machineStateChanged (const VBoxMachineStateChangeEvent &aEvent);
+    void sessionStateChanged (const VBoxSessionStateChangeEvent &aEvent);
+
+    void updateSnapshotsAge();
+
+private:
+
+    void refreshAll();
+    SnapshotWgtItem* findItem (const QString &aSnapshotId);
+    SnapshotWgtItem* curStateItem();
+    void populateSnapshots (const CSnapshot &aSnapshot, QTreeWidgetItem *aItem);
+    SnapshotAgeFormat traverseSnapshotAge (QTreeWidgetItem *aParentItem);
+
+    CMachine         mMachine;
+    QString          mMachineId;
+    KSessionState    mSessionState;
+    SnapshotWgtItem *mCurSnapshotItem;
+    bool             mEditProtector;
+
+    QActionGroup    *mSnapshotActionGroup;
+    QActionGroup    *mCurStateActionGroup;
+
+    QAction         *mRestoreSnapshotAction;
+    QAction         *mDeleteSnapshotAction;
+    QAction         *mShowSnapshotDetailsAction;
+    QAction         *mTakeSnapshotAction;
+
+    QTimer          mAgeUpdateTimer;
+};
+
+#endif // __VBoxSnapshotsWgt_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.ui	(revision 25171)
@@ -0,0 +1,59 @@
+<ui version="4.0" >
+ <class>VBoxSnapshotsWgt</class>
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <widget class="QWidget" name="VBoxSnapshotsWgt" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>VBoxSnapshotsWgt</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="leftMargin" >
+    <number>0</number>
+   </property>
+   <property name="topMargin" >
+    <number>0</number>
+   </property>
+   <property name="rightMargin" >
+    <number>0</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QTreeWidget" name="mTreeWidget" >
+     <property name="contextMenuPolicy" >
+      <enum>Qt::CustomContextMenu</enum>
+     </property>
+     <property name="allColumnsShowFocus" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxSpecialControls.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxSpecialControls.cpp	(revision 25170)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/* VBox includes */
-#include "VBoxSpecialControls.h"
-
-/* VBox includes */
-#include "VBoxGlobal.h"
-
-#ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
-
-/********************************************************************************
- *
- * A mini cancel button in the native Cocoa version.
- *
- ********************************************************************************/
-VBoxMiniCancelButton::VBoxMiniCancelButton (QWidget *aParent /* = 0 */)
-  : QAbstractButton (aParent)
-{
-    setShortcut (QKeySequence (Qt::Key_Escape));
-    mButton = new VBoxCocoaButton (VBoxCocoaButton::CancelButton, this);
-    connect (mButton, SIGNAL (clicked()),
-             this, SIGNAL (clicked()));
-    setFixedSize (mButton->size());
-}
-
-/********************************************************************************
- *
- * A help button in the native Cocoa version.
- *
- ********************************************************************************/
-VBoxHelpButton::VBoxHelpButton (QWidget *aParent /* = 0 */)
-  : QPushButton (aParent)
-{
-    setShortcut (QKeySequence (QKeySequence::HelpContents));
-    mButton = new VBoxCocoaButton (VBoxCocoaButton::HelpButton, this);
-    connect (mButton, SIGNAL (clicked()),
-             this, SIGNAL (clicked()));
-    setFixedSize (mButton->size());
-}
-
-/********************************************************************************
- *
- * A segmented button in the native Cocoa version.
- *
- ********************************************************************************/
-VBoxSegmentedButton::VBoxSegmentedButton (int aCount, QWidget *aParent /* = 0 */)
-  : VBoxCocoaSegmentedButton (aCount, aParent)
-{
-}
-/********************************************************************************
- *
- * A search field in the native Cocoa version.
- *
- ********************************************************************************/
-VBoxSearchField::VBoxSearchField (QWidget *aParent /* = 0 */)
-  : VBoxCocoaSearchField (aParent)
-{
-}
-
-#else /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
-
-/* Qt includes */
-#include <QPainter>
-#include <QBitmap>
-#include <QMouseEvent>
-#include <QSignalMapper>
-
-/********************************************************************************
- *
- * A mini cancel button for the other OS's.
- *
- ********************************************************************************/
-VBoxMiniCancelButton::VBoxMiniCancelButton (QWidget *aParent /* = 0 */)
-  : QIWithRetranslateUI<QIToolButton> (aParent)
-{
-    setAutoRaise (true);
-    setFocusPolicy (Qt::TabFocus);
-    setShortcut (QKeySequence (Qt::Key_Escape));
-    QIcon cancelIcon = style()->standardIcon (QStyle::SP_DialogCancelButton);
-    if (cancelIcon.isNull())
-        cancelIcon = VBoxGlobal::iconSet (":/delete_16px.png",
-                                          ":/delete_dis_16px.png");
-    setIcon (cancelIcon);
-}
-
-/********************************************************************************
- *
- * A help button for the other OS's.
- *
- ********************************************************************************/
-/* From: src/gui/styles/qmacstyle_mac.cpp */
-static const int PushButtonLeftOffset = 6;
-static const int PushButtonTopOffset = 4;
-static const int PushButtonRightOffset = 12;
-static const int PushButtonBottomOffset = 4;
-
-VBoxHelpButton::VBoxHelpButton (QWidget *aParent /* = 0 */)
-    : QIWithRetranslateUI<QPushButton> (aParent)
-{
-#ifdef Q_WS_MAC
-    mButtonPressed = false;
-    mNormalPixmap = new QPixmap (":/help_button_normal_mac_22px.png");
-    mPressedPixmap = new QPixmap (":/help_button_pressed_mac_22px.png");
-    mSize = mNormalPixmap->size();
-    mMask = new QImage (mNormalPixmap->mask().toImage());
-    mBRect = QRect (PushButtonLeftOffset,
-                    PushButtonTopOffset,
-                    mSize.width(),
-                    mSize.height());
-#endif /* Q_WS_MAC */
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxHelpButton::initFrom (QPushButton *aOther)
-{
-    setIcon (aOther->icon());
-    setText (aOther->text());
-    setShortcut (aOther->shortcut());
-    setFlat (aOther->isFlat());
-    setAutoDefault (aOther->autoDefault());
-    setDefault (aOther->isDefault());
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxHelpButton::retranslateUi()
-{
-    QPushButton::setText (tr ("&Help"));
-    if (QPushButton::shortcut().isEmpty())
-        QPushButton::setShortcut (QKeySequence::HelpContents);
-}
-
-#ifdef Q_WS_MAC
-VBoxHelpButton::~VBoxHelpButton()
-{
-    delete mNormalPixmap;
-    delete mPressedPixmap;
-    delete mMask;
-}
-
-QSize VBoxHelpButton::sizeHint() const
-{
-    return QSize (mSize.width() + PushButtonLeftOffset + PushButtonRightOffset,
-                  mSize.height() + PushButtonTopOffset + PushButtonBottomOffset);
-}
-
-void VBoxHelpButton::paintEvent (QPaintEvent * /* aEvent */)
-{
-    QPainter painter (this);
-    painter.drawPixmap (PushButtonLeftOffset, PushButtonTopOffset, mButtonPressed ? *mPressedPixmap: *mNormalPixmap);
-}
-
-bool VBoxHelpButton::hitButton (const QPoint &pos) const
-{
-    if (mBRect.contains (pos))
-        return  mMask->pixel (pos.x() - PushButtonLeftOffset,
-                              pos.y() - PushButtonTopOffset) == 0xff000000;
-    else
-        return false;
-}
-
-void VBoxHelpButton::mousePressEvent (QMouseEvent *aEvent)
-{
-    if (hitButton (aEvent->pos()))
-        mButtonPressed = true;
-    QPushButton::mousePressEvent (aEvent);
-    update();
-}
-
-void VBoxHelpButton::mouseReleaseEvent (QMouseEvent *aEvent)
-{
-    QPushButton::mouseReleaseEvent (aEvent);
-    mButtonPressed = false;
-    update();
-}
-
-void VBoxHelpButton::leaveEvent (QEvent * aEvent)
-{
-    QPushButton::leaveEvent (aEvent);
-    mButtonPressed = false;
-    update();
-}
-#endif /* Q_WS_MAC */
-
-/********************************************************************************
- *
- * A segmented button for the other OS's.
- *
- ********************************************************************************/
-VBoxSegmentedButton::VBoxSegmentedButton (int aCount, QWidget *aParent /* = 0 */)
-  : QWidget (aParent)
-{
-    mSignalMapper = new QSignalMapper (this);
-
-    QHBoxLayout *layout = new QHBoxLayout (this);
-    for (int i=0; i < aCount; ++i)
-    {
-        QIToolButton *button = new QIToolButton (this);
-        button->setAutoRaise (true);
-        button->setFocusPolicy (Qt::TabFocus);
-        button->setToolButtonStyle (Qt::ToolButtonTextBesideIcon);
-        mButtons.append (button);
-        layout->addWidget (button);
-        connect (button, SIGNAL(clicked()),
-                 mSignalMapper, SLOT(map()));
-        mSignalMapper->setMapping (button, i);
-    }
-    connect (mSignalMapper, SIGNAL(mapped(int)),
-             this, SIGNAL(clicked(int)));
-
-}
-
-VBoxSegmentedButton::~VBoxSegmentedButton()
-{
-    delete mSignalMapper;
-    qDeleteAll (mButtons);
-}
-
-void VBoxSegmentedButton::setTitle (int aSegment, const QString &aTitle)
-{
-    mButtons.at (aSegment)->setText (aTitle);
-}
-
-void VBoxSegmentedButton::setToolTip (int aSegment, const QString &aTip)
-{
-    mButtons.at (aSegment)->setToolTip (aTip);
-}
-
-void VBoxSegmentedButton::setIcon (int aSegment, const QIcon &aIcon)
-{
-    mButtons.at (aSegment)->setIcon (aIcon);
-}
-
-void VBoxSegmentedButton::setEnabled (int aSegment, bool fEnabled)
-{
-    mButtons.at (aSegment)->setEnabled (fEnabled);
-}
-
-void VBoxSegmentedButton::animateClick (int aSegment)
-{
-    mButtons.at (aSegment)->animateClick();
-}
-
-/********************************************************************************
- *
- * A search field  for the other OS's.
- *
- ********************************************************************************/
-VBoxSearchField::VBoxSearchField (QWidget *aParent /* = 0 */)
-  : QLineEdit (aParent)
-{
-    mBaseBrush = palette().base();
-}
-
-void VBoxSearchField::markError()
-{
-    QPalette pal = palette();
-    QColor c (Qt::red);
-    c.setAlphaF (0.3);
-    pal.setBrush (QPalette::Base, c);
-    setPalette (pal);
-}
-
-void VBoxSearchField::unmarkError()
-{
-    QPalette pal = palette();
-    pal.setBrush (QPalette::Base, mBaseBrush);
-    setPalette (pal);
-}
-
-#endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.h	(revision 25171)
@@ -0,0 +1,49 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxTakeSnapshotDlg class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxTakeSnapshotDlg_h__
+#define __VBoxTakeSnapshotDlg_h__
+
+/* Local includes */
+#include "VBoxTakeSnapshotDlg.gen.h"
+#include "QIWithRetranslateUI.h"
+#include "COMDefs.h"
+
+class VBoxTakeSnapshotDlg : public QIWithRetranslateUI<QDialog>, public Ui::VBoxTakeSnapshotDlg
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxTakeSnapshotDlg(QWidget *pParent, const CMachine &machine);
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void nameChanged(const QString &strName);
+};
+
+#endif // __VBoxTakeSnapshotDlg_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.ui	(revision 25171)
@@ -0,0 +1,169 @@
+<ui version="4.0" >
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008-2009 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxTakeSnapshotDlg</class>
+ <widget class="QDialog" name="VBoxTakeSnapshotDlg">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>300</width>
+    <height>240</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Take Snapshot of Virtual Machine</string>
+  </property>
+  <layout class="QGridLayout">
+   <item rowspan="2" row="0" column="0">
+    <layout class="QVBoxLayout">
+     <item>
+      <widget class="QLabel" name="mLbIcon">
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Preferred" hsizetype="Maximum">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint">
+        <size>
+         <width>0</width>
+         <height>0</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="0" column="1">
+    <layout class="QVBoxLayout">
+     <property name="spacing">
+      <number>2</number>
+     </property>
+     <item>
+      <widget class="QLabel" name="mLbName">
+       <property name="text" >
+        <string>Snapshot &amp;Name</string>
+       </property>
+       <property name="buddy" >
+        <cstring>mLeName</cstring>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="mLeName"/>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="1">
+    <layout class="QVBoxLayout">
+     <property name="spacing">
+      <number>2</number>
+     </property>
+     <item>
+      <widget class="QLabel" name="mLbDescription">
+       <property name="text">
+        <string>Snapshot &amp;Description</string>
+       </property>
+       <property name="buddy">
+        <cstring>mTeDescription</cstring>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QTextEdit" name="mTeDescription"/>
+     </item>
+    </layout>
+   </item>
+   <item row="2" column="0" colspan="2">
+    <widget class="QILabel" name="mLbInfo">
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Preferred" hsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="wordWrap">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="2">
+    <widget class="QIDialogButtonBox" name="mButtonBox">
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QILabel</class>
+   <extends>QLabel</extends>
+   <header>QILabel.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QIDialogButtonBox</class>
+   <extends>QDialogButtonBox</extends>
+   <header>QIDialogButtonBox.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>VBoxTakeSnapshotDlg</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>156</x>
+     <y>216</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>156</x>
+     <y>119</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>VBoxTakeSnapshotDlg</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>156</x>
+     <y>216</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>156</x>
+     <y>119</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxUpdateDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxUpdateDlg.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxUpdateDlg.h	(revision 25171)
@@ -0,0 +1,151 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxUpdateDlg class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxUpdateDlg_h__
+#define __VBoxUpdateDlg_h__
+
+#include "QIAbstractWizard.h"
+#include "QIWithRetranslateUI.h"
+#include "VBoxUpdateDlg.gen.h"
+
+/* Qt includes */
+#include <QUrl>
+#include <QDate>
+
+class QIHttp;
+
+/**
+ *  This structure is used to store retranslated reminder values.
+ */
+struct UpdateDay
+{
+    UpdateDay (const QString &aVal, const QString &aKey)
+        : val (aVal), key (aKey) {}
+
+    QString val;
+    QString key;
+
+    bool operator== (const UpdateDay &aOther)
+    {
+        return val == aOther.val || key == aOther.key;
+    }
+};
+
+/**
+ *  This class is used to encode/decode the registration data.
+ */
+class VBoxUpdateData
+{
+public:
+
+    enum PeriodType
+    {
+        PeriodNever     = -2,
+        PeriodUndefined = -1,
+        Period1Day      =  0,
+        Period2Days     =  1,
+        Period3Days     =  2,
+        Period4Days     =  3,
+        Period5Days     =  4,
+        Period6Days     =  5,
+        Period1Week     =  6,
+        Period2Weeks    =  7,
+        Period3Weeks    =  8,
+        Period1Month    =  9
+    };
+
+    enum BranchType
+    {
+        BranchStable     = 0,
+        BranchAllRelease = 1,
+        BranchWithBetas  = 2
+    };
+
+    static void populate();
+    static QStringList list();
+
+    VBoxUpdateData (const QString &aData);
+    VBoxUpdateData (PeriodType aPeriodIndex, BranchType aBranchIndex);
+
+    bool isNecessary();
+    bool isNoNeedToCheck();
+
+    QString data() const;
+    PeriodType periodIndex() const;
+    QString date() const;
+    BranchType branchIndex() const;
+    QString branchName() const;
+
+private:
+
+    /* Private functions */
+    void decode();
+    void encode();
+
+    /* Private variables */
+    static QList <UpdateDay> mDayList;
+
+    QString mData;
+    PeriodType mPeriodIndex;
+    QDate mDate;
+    BranchType mBranchIndex;
+};
+
+class VBoxUpdateDlg : public QIWithRetranslateUI <QIAbstractWizard>,
+                      public Ui::VBoxUpdateDlg
+{
+    Q_OBJECT;
+
+public:
+
+    static bool isNecessary();
+
+    VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, QWidget *aParent = 0);
+   ~VBoxUpdateDlg();
+
+public slots:
+
+    void search();
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void accept();
+    void searchResponse (bool aError);
+    void onPageShow();
+
+private:
+
+    void abortRequest (const QString &aReason);
+
+    /* Private variables */
+    VBoxUpdateDlg **mSelf;
+    QUrl            mUrl;
+    QIHttp         *mHttp;
+    bool            mForceRun;
+};
+
+#endif // __VBoxUpdateDlg_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxUpdateDlg.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxUpdateDlg.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxUpdateDlg.ui	(revision 25171)
@@ -0,0 +1,383 @@
+<ui version="4.0" >
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxUpdateDlg</class>
+ <widget class="QDialog" name="VBoxUpdateDlg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>578</width>
+    <height>417</height>
+   </rect>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="leftMargin" >
+    <number>0</number>
+   </property>
+   <property name="topMargin" >
+    <number>0</number>
+   </property>
+   <property name="rightMargin" >
+    <number>0</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QStackedWidget" name="mPageStack" >
+     <property name="currentIndex" >
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="mPageUpdate" >
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QLabel" name="mPageUpdateHdr" >
+         <property name="font" >
+          <font>
+           <family>Arial</family>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="Line" name="line11" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" >
+         <item>
+          <widget class="QLabel" name="mLogoUpdate" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Minimum" hsizetype="Maximum" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="autoFillBackground" >
+            <bool>true</bool>
+           </property>
+           <property name="pixmap" >
+            <pixmap resource="../VirtualBox1.qrc" >:/vmw_new_user.png</pixmap>
+           </property>
+           <property name="alignment" >
+            <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <layout class="QVBoxLayout" >
+           <item>
+            <widget class="QILabel" name="mTextUpdateInfo" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="minimumSize" >
+              <size>
+               <width>300</width>
+               <height>0</height>
+              </size>
+             </property>
+             <property name="wordWrap" >
+              <bool>true</bool>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer>
+             <property name="orientation" >
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeType" >
+              <enum>QSizePolicy::Expanding</enum>
+             </property>
+             <property name="sizeHint" >
+              <size>
+               <width>10</width>
+               <height>0</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="Line" name="line12" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" >
+         <item>
+          <widget class="QProgressBar" name="mPbCheck" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="maximumSize" >
+            <size>
+             <width>16777215</width>
+             <height>16</height>
+            </size>
+           </property>
+           <property name="maximum" >
+            <number>0</number>
+           </property>
+           <property name="value" >
+            <number>-1</number>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mBtnCheck" >
+           <property name="default" >
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeType" >
+            <enum>QSizePolicy::Fixed</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>5</width>
+             <height>0</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mBtnCancel" />
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="mPageFinish" >
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QLabel" name="mPageFinishHdr" >
+         <property name="font" >
+          <font>
+           <family>Arial</family>
+           <pointsize>12</pointsize>
+           <weight>75</weight>
+           <bold>true</bold>
+          </font>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="Line" name="line11_3" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" >
+         <item>
+          <widget class="QLabel" name="mLogoFinish" >
+           <property name="sizePolicy" >
+            <sizepolicy vsizetype="Minimum" hsizetype="Maximum" >
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="autoFillBackground" >
+            <bool>true</bool>
+           </property>
+           <property name="pixmap" >
+            <pixmap resource="../VirtualBox1.qrc" >:/vmw_new_user.png</pixmap>
+           </property>
+           <property name="alignment" >
+            <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <layout class="QVBoxLayout" >
+           <item>
+            <layout class="QVBoxLayout" >
+             <property name="spacing" >
+              <number>10</number>
+             </property>
+             <item>
+              <widget class="QILabel" name="mTextSuccessInfo" >
+               <property name="sizePolicy" >
+                <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize" >
+                <size>
+                 <width>300</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="wordWrap" >
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QILabel" name="mTextFailureInfo" >
+               <property name="sizePolicy" >
+                <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize" >
+                <size>
+                 <width>300</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="wordWrap" >
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="mTextNotFoundInfo" >
+               <property name="sizePolicy" >
+                <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize" >
+                <size>
+                 <width>300</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="wordWrap" >
+                <bool>true</bool>
+               </property>
+              </widget>
+             </item>
+            </layout>
+           </item>
+           <item>
+            <spacer>
+             <property name="orientation" >
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeType" >
+              <enum>QSizePolicy::Expanding</enum>
+             </property>
+             <property name="sizeHint" >
+              <size>
+               <width>10</width>
+               <height>0</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="Line" name="line12_3" >
+         <property name="orientation" >
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" >
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="mBtnFinish" >
+           <property name="default" >
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QILabel</class>
+   <extends>QLabel</extends>
+   <header>QILabel.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>mBtnCheck</tabstop>
+ </tabstops>
+ <resources>
+  <include location="../VirtualBox1.qrc" />
+ </resources>
+ <connections/>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp	(revision 25170)
+++ 	(revision )
@@ -1,196 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMFirstRunWzd class implementation
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Local includes */
-#include "VBoxVMFirstRunWzd.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "VBoxMediaManagerDlg.h"
-#include "QIWidgetValidator.h"
-
-VBoxVMFirstRunWzd::VBoxVMFirstRunWzd (const CMachine &aMachine, QWidget *aParent)
-    : QIWithRetranslateUI <QIAbstractWizard> (aParent)
-    , mValidator (0)
-    , mMachine (aMachine)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMFirstRunWzd::setupUi (this);
-
-    /* Initialize wizard hdr */
-    initializeWizardHdr();
-
-    /* Hide unnecessary text labels */
-    CMediumAttachment hda = mMachine.GetMediumAttachment ("IDE Controller", 0, 0);
-    mTextWelcome1->setHidden (hda.isNull());
-    mTextType1->setHidden (hda.isNull());
-    mTextSource1->setHidden (hda.isNull());
-    mTextSummaryHdr1->setHidden (hda.isNull());
-    mTextSummaryFtr1->setHidden (hda.isNull());
-    mTextWelcome2->setHidden (!hda.isNull());
-    mTextType2->setHidden (!hda.isNull());
-    mTextSource2->setHidden (!hda.isNull());
-    mTextSummaryHdr2->setHidden (!hda.isNull());
-    mTextSummaryFtr2->setHidden (!hda.isNull());
-
-    /* Media page */
-    mCbMedia->setMachineId (mMachine.GetId());
-    mTbVmm->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png", ":/select_file_dis_16px.png"));
-    mValidator = new QIWidgetValidator (mPageMedia, this);
-    connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator *)),
-             this, SLOT (enableNext (const QIWidgetValidator *)));
-    connect (mValidator, SIGNAL (isValidRequested (QIWidgetValidator *)),
-             this, SLOT (revalidate (QIWidgetValidator *)));
-    connect (mRbCdType, SIGNAL (clicked()), this, SLOT (mediaTypeChanged()));
-    connect (mRbFdType, SIGNAL (clicked()), this, SLOT (mediaTypeChanged()));
-    connect (mTbVmm, SIGNAL (clicked()), this, SLOT (openMediaManager()));
-    mRbCdType->animateClick();
-
-    /* Revalidate updated page */
-    mValidator->revalidate();
-
-    /* Initialize wizard ftr */
-    initializeWizardFtr();
-
-    retranslateUi();
-}
-
-void VBoxVMFirstRunWzd::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMFirstRunWzd::retranslateUi (this);
-
-    QWidget *page = mPageStack->currentWidget();
-
-    if (page == mPageSummary)
-    {
-        /* Compose Summary */
-        QString type = mRbCdType->isChecked() ? tr ("CD/DVD-ROM Device") : tr ("Floppy Device");
-        QString source = mCbMedia->currentText();
-        QString summary = QString ("<table>"
-                                   "<tr><td>%1:&nbsp;</td><td>%2</td></tr>"
-                                   "<tr><td>%3:&nbsp;</td><td>%4</td></tr>"
-                                   "</table>")
-                                   .arg (tr ("Type", "summary"), type)
-                                   .arg (tr ("Source", "summary"), source);
-        mTeSummary->setText (summary);
-    }
-}
-
-void VBoxVMFirstRunWzd::accept()
-{
-    /* Composing default controller name */
-    KStorageBus ctrBus (mRbCdType->isChecked() ? KStorageBus_IDE : KStorageBus_Floppy);
-    LONG ctrPort = mRbCdType->isChecked() ? 1 : 0;
-    LONG ctrDevice = 0;
-    QString ctrName;
-    /* Search for the first controller of the given type */
-    QVector<CStorageController> ctrs = mMachine.GetStorageControllers();
-    foreach (CStorageController ctr, ctrs)
-    {
-        if (ctr.GetBus() == ctrBus)
-        {
-            ctrName = ctr.GetName();
-            break;
-        }
-    }
-    Assert (!ctrName.isEmpty());
-    /* Mount medium to the predefined port/device */
-    mMachine.MountMedium (ctrName, ctrPort, ctrDevice, mCbMedia->id(), false /* force */);
-    if (mMachine.isOk())
-        QIAbstractWizard::accept();
-    else
-        vboxProblem().cannotRemountMedium (this, mMachine, vboxGlobal().findMedium (mCbMedia->id()), true /* mount? */, false /* retry? */);
-}
-
-void VBoxVMFirstRunWzd::revalidate (QIWidgetValidator *aValidator)
-{
-    /* Do individual validations for pages */
-    QWidget *pg = aValidator->widget();
-    bool valid = aValidator->isOtherValid();
-
-    /* Allow to go to Summary only if non-null medium selected */
-    if (pg == mPageMedia)
-        valid = !vboxGlobal().findMedium (mCbMedia->id()).isNull();
-
-    aValidator->setOtherValid (valid);
-}
-
-void VBoxVMFirstRunWzd::mediaTypeChanged()
-{
-    /* CD/DVD media type selected */
-    if (sender() == mRbCdType)
-    {
-        /* Switch media combo-box type to CD/DVD */
-        mCbMedia->setType (VBoxDefs::MediumType_DVD);
-    }
-    /* Floppy media type selected */
-    else if (sender() == mRbFdType)
-    {
-        /* Switch media combo-box type to Floppy */
-        mCbMedia->setType (VBoxDefs::MediumType_Floppy);
-    }
-
-    /* Update the media combo-box */
-    mCbMedia->repopulate();
-
-    /* Revalidate updated page */
-    mValidator->revalidate();
-}
-
-void VBoxVMFirstRunWzd::openMediaManager()
-{
-    /* Create & open VMM */
-    VBoxMediaManagerDlg dlg (this);
-    dlg.setup (mCbMedia->type(), true /* aDoSelect */);
-    if (dlg.exec() == QDialog::Accepted)
-        mCbMedia->setCurrentItem (dlg.selectedId());
-
-    /* Revalidate updated page */
-    mValidator->revalidate();
-}
-
-void VBoxVMFirstRunWzd::enableNext (const QIWidgetValidator *aValidator)
-{
-    nextButton (aValidator->widget())->setEnabled (aValidator->isValid());
-}
-
-void VBoxVMFirstRunWzd::onPageShow()
-{
-    /* Make sure all is properly translated & composed */
-    retranslateUi();
-
-    QWidget *page = mPageStack->currentWidget();
-
-    if (page == mPageWelcome)
-        nextButton (page)->setFocus();
-    else if (page == mPageMedia)
-        mRbCdType->isChecked() ? mRbCdType->setFocus() :
-                                 mRbFdType->setFocus();
-    else if (page == mPageSummary)
-        mTeSummary->setFocus();
-
-    if (page == mPageSummary)
-        finishButton()->setDefault (true);
-    else
-        nextButton (page)->setDefault (true);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.h	(revision 25171)
@@ -0,0 +1,93 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMInformationDlg class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxVMInformationDlg_h__
+#define __VBoxVMInformationDlg_h__
+
+#include "VBoxVMInformationDlg.gen.h"
+#include "QIMainDialog.h"
+#include "COMDefs.h"
+#include "QIWithRetranslateUI.h"
+
+class VBoxConsoleView;
+class QTimer;
+
+class VBoxVMInformationDlg : public QIWithRetranslateUI2 <QIMainDialog>, public Ui::VBoxVMInformationDlg
+{
+    Q_OBJECT;
+
+public:
+
+    typedef QMap <QString, QString> DataMapType;
+    typedef QMap <QString, QStringList> LinksMapType;
+    struct CounterElementType { QString type; DataMapType list; };
+    typedef QMap <QString, VBoxVMInformationDlg*> InfoDlgMap;
+
+    static void createInformationDlg (const CSession &aSession, VBoxConsoleView *aConsole);
+
+protected:
+
+    VBoxVMInformationDlg (VBoxConsoleView *aConsole, const CSession &aSession, Qt::WindowFlags aFlags);
+   ~VBoxVMInformationDlg();
+
+    void retranslateUi();
+
+    virtual bool event (QEvent *aEvent);
+    virtual void resizeEvent (QResizeEvent *aEvent);
+    virtual void showEvent (QShowEvent *aEvent);
+
+private slots:
+
+    void updateDetails();
+    void processStatistics();
+    void onPageChanged (int aIndex);
+
+private:
+
+    QString parseStatistics (const QString &aText);
+    void refreshStatistics();
+
+    QString formatValue (const QString &aValueName, const QString &aValue, int aMaxSize);
+    QString formatMedium (const QString &aCtrName, LONG aPort, LONG aDevice, const QString &aBelongsTo);
+    QString formatAdapter (ULONG aSlot, const QString &aBelongsTo);
+
+    QString composeArticle (const QString &aBelongsTo, int aSpacesCount = 0);
+
+    static InfoDlgMap  mSelfArray;
+
+    bool               mIsPolished;
+    VBoxConsoleView   *mConsole;
+    CSession           mSession;
+    QTimer            *mStatTimer;
+
+    int                mWidth;
+    int                mHeight;
+    bool               mMax;
+
+    DataMapType        mNamesMap;
+    DataMapType        mValuesMap;
+    DataMapType        mUnitsMap;
+    LinksMapType       mLinksMap;
+};
+
+#endif // __VBoxVMInformationDlg_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.ui	(revision 25171)
@@ -0,0 +1,154 @@
+<ui version="4.0" >
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxVMInformationDlg</class>
+ <widget class="QMainWindow" name="VBoxVMInformationDlg" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>487</width>
+    <height>391</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>VBoxVMInformationDlg</string>
+  </property>
+  <widget class="QWidget" name="centralwidget" >
+   <layout class="QVBoxLayout" >
+    <item>
+     <widget class="QTabWidget" name="mInfoStack" >
+      <property name="currentIndex" >
+       <number>0</number>
+      </property>
+      <widget class="QWidget" name="mPage1" >
+       <attribute name="title" >
+        <string>&amp;Details</string>
+       </attribute>
+       <attribute name="icon" >
+        <iconset resource="../VirtualBox1.qrc" >:/settings_16px.png</iconset>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <property name="leftMargin" >
+         <number>0</number>
+        </property>
+        <property name="topMargin" >
+         <number>0</number>
+        </property>
+        <property name="rightMargin" >
+         <number>0</number>
+        </property>
+        <property name="bottomMargin" >
+         <number>0</number>
+        </property>
+        <item>
+         <widget class="QRichTextEdit" name="mDetailsText" >
+          <property name="frameShape" >
+           <enum>QFrame::NoFrame</enum>
+          </property>
+          <property name="frameShadow" >
+           <enum>QFrame::Plain</enum>
+          </property>
+          <property name="readOnly" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="mPage2" >
+       <attribute name="title" >
+        <string>&amp;Runtime</string>
+       </attribute>
+       <attribute name="icon" >
+        <iconset resource="../VirtualBox1.qrc" >:/start_16px.png</iconset>
+       </attribute>
+       <layout class="QVBoxLayout" >
+        <property name="leftMargin" >
+         <number>0</number>
+        </property>
+        <property name="topMargin" >
+         <number>0</number>
+        </property>
+        <property name="rightMargin" >
+         <number>0</number>
+        </property>
+        <property name="bottomMargin" >
+         <number>0</number>
+        </property>
+        <item>
+         <widget class="QRichTextEdit" name="mStatisticText" >
+          <property name="frameShape" >
+           <enum>QFrame::NoFrame</enum>
+          </property>
+          <property name="frameShadow" >
+           <enum>QFrame::Plain</enum>
+          </property>
+          <property name="readOnly" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+    <item>
+     <widget class="QIDialogButtonBox" name="mButtonBox" >
+      <property name="standardButtons" >
+       <set>QDialogButtonBox::Close</set>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QIDialogButtonBox</class>
+   <extends>QDialogButtonBox</extends>
+   <header>QIDialogButtonBox.h</header>
+  </customwidget>
+  <customwidget>
+   <class>QRichTextEdit</class>
+   <extends>QTextEdit</extends>
+   <header>VBoxUtils.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources>
+  <include location="../VirtualBox1.qrc" />
+ </resources>
+ <connections>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>VBoxVMInformationDlg</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>246</x>
+     <y>348</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>246</x>
+     <y>195</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMListView.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMListView.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMListView.h	(revision 25171)
@@ -0,0 +1,205 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxVMItem, VBoxVMModel, VBoxVMListView, VBoxVMItemPainter class declarations
+ */
+
+/*
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxVMListView_h__
+#define __VBoxVMListView_h__
+
+#include "VBoxGlobal.h"
+#include "QIListView.h"
+
+/* Qt includes */
+#include <QAbstractListModel>
+#include <QDateTime>
+
+class VBoxSelectorWnd;
+
+class VBoxVMItem
+{
+public:
+
+    VBoxVMItem (const CMachine &aMachine);
+    virtual ~VBoxVMItem();
+
+    CMachine machine() const { return mMachine; }
+
+    QString name() const { return mName; }
+    QIcon osIcon() const { return mAccessible ? vboxGlobal().vmGuestOSTypeIcon (mOSTypeId) : QPixmap (":/os_other.png"); }
+    QString id() const { return mId; }
+
+    QString sessionStateName() const;
+    QIcon sessionStateIcon() const { return mAccessible ? vboxGlobal().toIcon (mState) : QPixmap (":/state_aborted_16px.png"); }
+
+    QString snapshotName() const { return mSnapshotName; }
+    ULONG snapshotCount() const { return mSnapshotCount; }
+
+    QString toolTipText() const;
+
+    bool accessible() const { return mAccessible; }
+    const CVirtualBoxErrorInfo &accessError() const { return mAccessError; }
+    KMachineState state() const { return mState; }
+    KSessionState sessionState() const { return mSessionState; }
+
+    bool recache();
+
+    bool canSwitchTo() const;
+    bool switchTo();
+
+private:
+
+    /* Private member vars */
+    CMachine mMachine;
+
+    /* Cached machine data (to minimize server requests) */
+    QString mId;
+    QString mSettingsFile;
+
+    bool mAccessible;
+    CVirtualBoxErrorInfo mAccessError;
+
+    QString mName;
+    QString mSnapshotName;
+    KMachineState mState;
+    QDateTime mLastStateChange;
+    KSessionState mSessionState;
+    QString mOSTypeId;
+    ULONG mSnapshotCount;
+
+    ULONG mPid;
+};
+
+/* Make the pointer of this class public to the QVariant framework */
+Q_DECLARE_METATYPE(VBoxVMItem *);
+
+class VBoxVMModel: public QAbstractListModel
+{
+    Q_OBJECT;
+
+public:
+    enum { SnapShotDisplayRole = Qt::UserRole,
+           SnapShotFontRole,
+           SessionStateDisplayRole,
+           SessionStateDecorationRole,
+           SessionStateFontRole,
+           VBoxVMItemPtrRole };
+
+    VBoxVMModel(QObject *aParent = 0)
+        :QAbstractListModel (aParent) {}
+
+    void addItem (VBoxVMItem *aItem);
+    void removeItem (VBoxVMItem *aItem);
+    void refreshItem (VBoxVMItem *aItem);
+
+    void itemChanged (VBoxVMItem *aItem);
+
+    void clear();
+
+    VBoxVMItem *itemById (const QString &aId) const;
+    VBoxVMItem *itemByRow (int aRow) const;
+    QModelIndex indexById (const QString &aId) const;
+
+    int rowById (const QString &aId) const;;
+
+    void sort (Qt::SortOrder aOrder = Qt::AscendingOrder) { sort (0, aOrder); }
+
+    /* The following are necessary model implementations */
+    void sort (int aColumn, Qt::SortOrder aOrder = Qt::AscendingOrder);
+
+    int rowCount (const QModelIndex &aParent = QModelIndex()) const;
+
+    QVariant data (const QModelIndex &aIndex, int aRole) const;
+    QVariant headerData (int aSection, Qt::Orientation aOrientation,
+                         int aRole = Qt::DisplayRole) const;
+
+    bool removeRows (int aRow, int aCount, const QModelIndex &aParent = QModelIndex());
+
+private:
+    static bool VBoxVMItemNameCompareLessThan (VBoxVMItem* aItem1, VBoxVMItem* aItem2);
+    static bool VBoxVMItemNameCompareGreaterThan (VBoxVMItem* aItem1, VBoxVMItem* aItem2);
+
+    /* Private member vars */
+    QList<VBoxVMItem *> mVMItemList;
+};
+
+class VBoxVMListView: public QIListView
+{
+    Q_OBJECT;
+
+public:
+    VBoxVMListView (QWidget *aParent = 0);
+
+    void selectItemByRow (int row);
+    void selectItemById (const QString &aID);
+    void ensureSomeRowSelected (int aRowHint);
+    VBoxVMItem * selectedItem() const;
+
+    void ensureCurrentVisible();
+
+signals:
+    void currentChanged();
+    void activated();
+
+protected slots:
+    void selectionChanged (const QItemSelection &aSelected, const QItemSelection &aDeselected);
+    void currentChanged (const QModelIndex &aCurrent, const QModelIndex &aPrevious);
+    void dataChanged (const QModelIndex &aTopLeft, const QModelIndex &aBottomRight);
+
+protected:
+    bool selectCurrent();
+};
+
+class VBoxVMItemPainter: public QIItemDelegate
+{
+public:
+    VBoxVMItemPainter (QObject *aParent = 0)
+      : QIItemDelegate (aParent), mMargin (8), mSpacing (mMargin * 3 / 2) {}
+
+    QSize sizeHint (const QStyleOptionViewItem &aOption,
+                    const QModelIndex &aIndex) const;
+
+    void paint (QPainter *aPainter, const QStyleOptionViewItem &aOption,
+                const QModelIndex &aIndex) const;
+
+private:
+    inline QFontMetrics fontMetric (const QModelIndex &aIndex, int aRole) const { return QFontMetrics (aIndex.data (aRole).value<QFont>()); }
+    inline QIcon::Mode iconMode (QStyle::State aState) const
+    {
+        if (!(aState & QStyle::State_Enabled))
+            return QIcon::Disabled;
+        if (aState & QStyle::State_Selected)
+            return QIcon::Selected;
+        return QIcon::Normal;
+    }
+    inline QIcon::State iconState (QStyle::State aState) const { return aState & QStyle::State_Open ? QIcon::On : QIcon::Off; }
+
+    QRect rect (const QStyleOptionViewItem &aOption,
+                const QModelIndex &aIndex, int aRole) const;
+
+    void calcLayout (const QModelIndex &aIndex,
+                     QRect *aOSType, QRect *aVMName, QRect *aShot,
+                     QRect *aStateIcon, QRect *aState) const;
+
+    /* Private member vars */
+    int mMargin;
+    int mSpacing;
+};
+
+#endif /* __VBoxVMListView_h__ */
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMLogViewer.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMLogViewer.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMLogViewer.h	(revision 25171)
@@ -0,0 +1,137 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMLogViewer class declaration
+ */
+
+/*
+ * Copyright (C) 2006-2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxVMLogViewer_h__
+#define __VBoxVMLogViewer_h__
+
+#include "VBoxVMLogViewer.gen.h"
+#include "QIMainDialog.h"
+#include "COMDefs.h"
+#include "QIWithRetranslateUI.h"
+
+class VBoxLogSearchPanel;
+class QTabWidget;
+class QTextEdit;
+class VBoxSearchField;
+class QLabel;
+class QIToolButton;
+class VBoxMiniCancelButton;
+class VBoxSegmentedButton;
+class QCheckBox;
+
+class VBoxVMLogViewer : public QIWithRetranslateUI2<QIMainDialog>,
+                        public Ui::VBoxVMLogViewer
+{
+    Q_OBJECT;
+
+public:
+
+    typedef QMap <QString, VBoxVMLogViewer*> LogViewersMap;
+
+    VBoxVMLogViewer (QWidget *aParent, Qt::WindowFlags aFlags,
+                     const CMachine &aMachine);
+   ~VBoxVMLogViewer();
+
+    static void createLogViewer (QWidget *aParent, CMachine &aMachine);
+
+    QTextEdit* currentLogPage();
+
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    bool close();
+    void refresh();
+    void save();
+    void search();
+
+    void currentLogPageChanged (int aIndex);
+
+private:
+
+    void showEvent (QShowEvent *aEvent);
+    void loadLogFile (const QString &aName);
+    QTextEdit* createLogPage (const QString &aPage);
+
+    static LogViewersMap  mSelfArray;
+
+    bool                  mIsPolished;
+    bool                  mFirstRun;
+    CMachine              mMachine;
+    QTabWidget           *mLogList;
+    QStringList           mLogFilesList;
+    VBoxLogSearchPanel   *mSearchPanel;
+
+    QPushButton *mBtnHelp;
+    QPushButton *mBtnFind;
+    QPushButton *mBtnSave;
+    QPushButton *mBtnRefresh;
+    QPushButton *mBtnClose;
+};
+
+class VBoxLogSearchPanel : public QIWithRetranslateUI <QWidget>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxLogSearchPanel (QWidget *aParent,
+                        VBoxVMLogViewer *aViewer);
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void find (int aButton);
+    void findNext() { search (true); }
+    void findBack() { search (false); }
+
+    void findCurrent (const QString &aSearchString);
+
+private:
+
+    void search (bool aForward, bool aStartCurrent = false);
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+    void showEvent (QShowEvent *aEvent);
+    void hideEvent (QHideEvent *aEvent);
+
+    void toggleWarning (bool aHide);
+
+    VBoxVMLogViewer      *mViewer;
+    VBoxMiniCancelButton *mButtonClose;
+    QLabel               *mSearchName;
+    VBoxSearchField      *mSearchString;
+    VBoxSegmentedButton  *mButtonsNextPrev;
+    QCheckBox            *mCaseSensitive;
+    QSpacerItem          *mWarningSpacer;
+    QLabel               *mWarningIcon;
+    QLabel               *mWarningString;
+};
+
+#endif // __VBoxVMLogViewer_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMLogViewer.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMLogViewer.ui	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMLogViewer.ui	(revision 25171)
@@ -0,0 +1,80 @@
+<ui version="4.0" >
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008 Sun Microsystems, Inc.
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ Clara, CA 95054 USA or visit http://www.sun.com if you need
+ additional information or have any questions.
+ </comment>
+ <class>VBoxVMLogViewer</class>
+ <widget class="QMainWindow" name="VBoxVMLogViewer" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>588</width>
+    <height>409</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Log Viewer</string>
+  </property>
+  <widget class="QWidget" name="centralwidget" >
+   <layout class="QVBoxLayout" >
+    <item>
+     <widget class="QWidget" native="1" name="mLogsFrame" >
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QIDialogButtonBox" name="mButtonBox" >
+      <property name="standardButtons" >
+       <set>QDialogButtonBox::Close|QDialogButtonBox::Help|QDialogButtonBox::NoButton|QDialogButtonBox::Save</set>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QIDialogButtonBox</class>
+   <extends>QDialogButtonBox</extends>
+   <header>QIDialogButtonBox.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>mButtonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>VBoxVMLogViewer</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>293</x>
+     <y>328</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>293</x>
+     <y>204</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsAudio.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsAudio.cpp	(revision 25170)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsAudio class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxVMSettingsAudio.h"
-#include "VBoxGlobal.h"
-
-VBoxVMSettingsAudio::VBoxVMSettingsAudio()
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsAudio::setupUi (this);
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxVMSettingsAudio::getFrom (const CMachine &aMachine)
-{
-    mMachine = aMachine;
-
-    CAudioAdapter audio = aMachine.GetAudioAdapter();
-    mGbAudio->setChecked (audio.GetEnabled());
-    mCbAudioDriver->setCurrentIndex (mCbAudioDriver->
-        findText (vboxGlobal().toString (audio.GetAudioDriver())));
-    mCbAudioController->setCurrentIndex (mCbAudioController->
-        findText (vboxGlobal().toString (audio.GetAudioController())));
-}
-
-void VBoxVMSettingsAudio::putBackTo()
-{
-    CAudioAdapter audio = mMachine.GetAudioAdapter();
-    audio.SetAudioDriver (vboxGlobal().toAudioDriverType (mCbAudioDriver->currentText()));
-    audio.SetAudioController (vboxGlobal().toAudioControllerType (mCbAudioController->currentText()));
-    audio.SetEnabled (mGbAudio->isChecked());
-    AssertWrapperOk (audio);
-}
-
-void VBoxVMSettingsAudio::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mGbAudio);
-    setTabOrder (mGbAudio, mCbAudioDriver);
-    setTabOrder (mCbAudioDriver, mCbAudioController);
-}
-
-void VBoxVMSettingsAudio::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsAudio::retranslateUi (this);
-    /* Fill the comboboxes */
-    prepareComboboxes();
-}
-
-void VBoxVMSettingsAudio::prepareComboboxes()
-{
-    /* Save the current selected value */
-    int currentDriver = mCbAudioDriver->currentIndex();
-    /* Clear the driver box */
-    mCbAudioDriver->clear();
-    /* Refill them */
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_Null));
-#if defined Q_WS_WIN32
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_DirectSound));
-# ifdef VBOX_WITH_WINMM
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_WinMM));
-# endif
-#endif
-#if defined Q_OS_SOLARIS
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_SolAudio));
-# if defined VBOX_WITH_SOLARIS_OSS
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_OSS));
-#endif
-#endif
-#if defined Q_OS_LINUX || defined Q_OS_FREEBSD
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_OSS));
-#endif
-#if defined Q_OS_LINUX
-# ifdef VBOX_WITH_ALSA
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_ALSA));
-# endif
-# ifdef VBOX_WITH_PULSE
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_Pulse));
-# endif
-#endif
-#if defined Q_OS_MACX
-    mCbAudioDriver->addItem (vboxGlobal().toString (KAudioDriverType_CoreAudio));
-#endif
-    /* Set the old value */
-    mCbAudioDriver->setCurrentIndex (currentDriver);
-
-    /* Save the current selected value */
-    int currentController = mCbAudioController->currentIndex();
-    /* Clear the controller box */
-    mCbAudioController->clear();
-    /* Refill them */
-    mCbAudioController->insertItem (mCbAudioController->count(),
-        vboxGlobal().toString (KAudioControllerType_AC97));
-    mCbAudioController->insertItem (mCbAudioController->count(),
-        vboxGlobal().toString (KAudioControllerType_SB16));
-    /* Set the old value */
-    mCbAudioController->setCurrentIndex (currentController);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsDisplay.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsDisplay.cpp	(revision 25170)
+++ 	(revision )
@@ -1,262 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsDisplay class implementation
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "QIWidgetValidator.h"
-#include "VBoxVMSettingsDisplay.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-
-/**
- *  Calculates a suitable page step size for the given max value. The returned
- *  size is so that there will be no more than 32 pages. The minimum returned
- *  page size is 4.
- */
-static int calcPageStep (int aMax)
-{
-    /* reasonable max. number of page steps is 32 */
-    uint page = ((uint) aMax + 31) / 32;
-    /* make it a power of 2 */
-    uint p = page, p2 = 0x1;
-    while ((p >>= 1))
-        p2 <<= 1;
-    if (page != p2)
-        p2 <<= 1;
-    if (p2 < 4)
-        p2 = 4;
-    return (int) p2;
-}
-
-VBoxVMSettingsDisplay::VBoxVMSettingsDisplay()
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsDisplay::setupUi (this);
-
-    /* Setup constants */
-    CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
-    const uint MinVRAM = sys.GetMinGuestVRAM();
-    const uint MaxVRAM = sys.GetMaxGuestVRAM();
-
-    /* Setup validators */
-    mLeMemory->setValidator (new QIntValidator (MinVRAM, MaxVRAM, this));
-    mLeVRDPPort->setValidator (new QRegExpValidator (QRegExp ("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this));
-    mLeVRDPTimeout->setValidator (new QIntValidator (this));
-
-    /* Setup connections */
-    connect (mSlMemory, SIGNAL (valueChanged (int)),
-             this, SLOT (valueChangedVRAM (int)));
-    connect (mLeMemory, SIGNAL (textChanged (const QString&)),
-             this, SLOT (textChangedVRAM (const QString&)));
-
-    /* Setup initial values */
-    mSlMemory->setPageStep (calcPageStep (MaxVRAM));
-    mSlMemory->setSingleStep (mSlMemory->pageStep() / 4);
-    mSlMemory->setTickInterval (mSlMemory->pageStep());
-    /* Setup the scale so that ticks are at page step boundaries */
-    mSlMemory->setMinimum ((MinVRAM / mSlMemory->pageStep()) * mSlMemory->pageStep());
-    mSlMemory->setMaximum (MaxVRAM);
-    mSlMemory->setSnappingEnabled (true);
-    quint64 needMBytes = VBoxGlobal::requiredVideoMemory (&mMachine) / _1M;
-    mSlMemory->setErrorHint (0, 1);
-    mSlMemory->setWarningHint (1, needMBytes);
-    mSlMemory->setOptimalHint (needMBytes, MaxVRAM);
-    /* Limit min/max. size of QLineEdit */
-    mLeMemory->setFixedWidthByText (QString().fill ('8', 4));
-    /* Ensure mLeMemory value and validation is updated */
-    valueChangedVRAM (mSlMemory->value());
-    /* Setup VRDP widget */
-    mCbVRDPMethod->insertItem (0, ""); /* KVRDPAuthType_Null */
-    mCbVRDPMethod->insertItem (1, ""); /* KVRDPAuthType_External */
-    mCbVRDPMethod->insertItem (2, ""); /* KVRDPAuthType_Guest */
-    /* Initially disabled */
-    mCbVRDP->setChecked (false);
-
-    mCb3D->setEnabled (false);
-
-#ifndef VBOX_WITH_VIDEOHWACCEL
-    mCb2DVideo->setVisible (false);
-#endif
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-bool VBoxVMSettingsDisplay::isAcceleration2DVideoSelected() const
-{
-    return mCb2DVideo->isChecked();
-}
-#endif
-
-void VBoxVMSettingsDisplay::getFrom (const CMachine &aMachine)
-{
-    mMachine = aMachine;
-
-    /* Memory Size */
-    mSlMemory->setValue (mMachine.GetVRAMSize());
-
-    /* 3D Acceleration */
-    bool isAccelerationSupported = vboxGlobal().virtualBox().GetHost()
-                                   .GetAcceleration3DAvailable();
-    mCb3D->setEnabled (isAccelerationSupported);
-    mCb3D->setChecked (mMachine.GetAccelerate3DEnabled());
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    mCb2DVideo->setEnabled (VBoxGlobal::isAcceleration2DVideoAvailable());
-    mCb2DVideo->setChecked (mMachine.GetAccelerate2DVideoEnabled());
-#endif
-
-    /* VRDP Settings */
-    CVRDPServer vrdp = mMachine.GetVRDPServer();
-    if (!vrdp.isNull())
-    {
-        mCbVRDP->setChecked (vrdp.GetEnabled());
-        mLeVRDPPort->setText (vrdp.GetPorts());
-        mCbVRDPMethod->setCurrentIndex (mCbVRDPMethod->
-                                        findText (vboxGlobal().toString (vrdp.GetAuthType())));
-        mLeVRDPTimeout->setText (QString::number (vrdp.GetAuthTimeout()));
-    }
-    else
-    {
-        vboxProblem().cannotLoadMachineSettings (mMachine, false /* strict */);
-        mTwDisplay->setTabEnabled (1, false);
-    }
-}
-
-void VBoxVMSettingsDisplay::putBackTo()
-{
-    /* Memory Size */
-    mMachine.SetVRAMSize (mSlMemory->value());
-
-    /* 3D Acceleration */
-    mMachine.SetAccelerate3DEnabled (mCb3D->isChecked());
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    /* 2D Video Acceleration */
-    mMachine.SetAccelerate2DVideoEnabled (mCb2DVideo->isChecked());
-#endif
-
-    /* VRDP Settings */
-    CVRDPServer vrdp = mMachine.GetVRDPServer();
-    if (!vrdp.isNull())
-    {
-        vrdp.SetEnabled (mCbVRDP->isChecked());
-        vrdp.SetPorts (mLeVRDPPort->text());
-        vrdp.SetAuthType (vboxGlobal().toVRDPAuthType (mCbVRDPMethod->currentText()));
-        vrdp.SetAuthTimeout (mLeVRDPTimeout->text().toULong());
-    }
-}
-
-void VBoxVMSettingsDisplay::setValidator (QIWidgetValidator *aVal)
-{
-    mValidator = aVal;
-    connect (mCb3D, SIGNAL (stateChanged (int)),
-             mValidator, SLOT (revalidate()));
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    connect (mCb2DVideo, SIGNAL (stateChanged (int)),
-             mValidator, SLOT (revalidate()));
-#endif
-    connect (mCbVRDP, SIGNAL (toggled (bool)),
-             mValidator, SLOT (revalidate()));
-    connect (mLeVRDPPort, SIGNAL (textChanged (const QString&)),
-             mValidator, SLOT (revalidate()));
-    connect (mLeVRDPTimeout, SIGNAL (textChanged (const QString&)),
-             mValidator, SLOT (revalidate()));
-}
-
-bool VBoxVMSettingsDisplay::revalidate (QString &aWarning, QString & /* aTitle */)
-{
-    /* Video RAM amount test */
-    quint64 needBytes = VBoxGlobal::requiredVideoMemory (&mMachine);
-    if ((quint64) mSlMemory->value() * _1M < needBytes)
-    {
-        aWarning = tr (
-            "you have assigned less than <b>%1</b> of video memory which is "
-            "the minimum amount required to switch the virtual machine to "
-            "fullscreen or seamless mode.")
-            .arg (vboxGlobal().formatSize (needBytes, 0, VBoxDefs::FormatSize_RoundUp));
-        return true;
-    }
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    if (mCb2DVideo->isChecked())
-    {
-        quint64 needBytesWith2D = needBytes + VBoxGlobal::required2DOffscreenVideoMemory();
-        if ((quint64) mSlMemory->value() * _1M < needBytesWith2D)
-        {
-            aWarning = tr (
-                "you have assigned less than <b>%1</b> of video memory which is "
-                "the minimum amount required for HD Video to be played efficiently.")
-                .arg (vboxGlobal().formatSize (needBytesWith2D, 0, VBoxDefs::FormatSize_RoundUp));
-            return true;
-        }
-    }
-#endif
-
-    /* 3D Acceleration support test */
-    // TODO : W8 for NaN //
-
-    return true;
-}
-
-void VBoxVMSettingsDisplay::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mTwDisplay->focusProxy());
-    setTabOrder (mTwDisplay->focusProxy(), mSlMemory);
-    setTabOrder (mSlMemory, mLeMemory);
-    setTabOrder (mLeMemory, mCb3D);
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    setTabOrder (mCb3D, mCb2DVideo);
-    setTabOrder (mCb2DVideo, mCbVRDP);
-#else
-    setTabOrder (mCb3D, mCbVRDP);
-#endif
-    setTabOrder (mCbVRDP, mLeVRDPPort);
-    setTabOrder (mLeVRDPPort, mCbVRDPMethod);
-    setTabOrder (mCbVRDPMethod, mLeVRDPTimeout);
-}
-
-void VBoxVMSettingsDisplay::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsDisplay::retranslateUi (this);
-
-    CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
-    mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (sys.GetMinGuestVRAM()));
-    mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (sys.GetMaxGuestVRAM()));
-
-    mCbVRDPMethod->setItemText (0,
-        vboxGlobal().toString (KVRDPAuthType_Null));
-    mCbVRDPMethod->setItemText (1,
-        vboxGlobal().toString (KVRDPAuthType_External));
-    mCbVRDPMethod->setItemText (2,
-        vboxGlobal().toString (KVRDPAuthType_Guest));
-}
-
-void VBoxVMSettingsDisplay::valueChangedVRAM (int aVal)
-{
-    mLeMemory->setText (QString().setNum (aVal));
-}
-
-void VBoxVMSettingsDisplay::textChangedVRAM (const QString &aText)
-{
-    mSlMemory->setValue (aText.toInt());
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsGeneral.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsGeneral.cpp	(revision 25170)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsGeneral class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxVMSettingsGeneral.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "QIWidgetValidator.h"
-
-#include <QDir>
-
-VBoxVMSettingsGeneral::VBoxVMSettingsGeneral()
-    : mValidator (0)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsGeneral::setupUi (this);
-
-    /* Setup validators */
-    mLeName->setValidator (new QRegExpValidator (QRegExp (".+"), this));
-
-    /* Shared Clipboard mode */
-    mCbClipboard->addItem (""); /* KClipboardMode_Disabled */
-    mCbClipboard->addItem (""); /* KClipboardMode_HostToGuest */
-    mCbClipboard->addItem (""); /* KClipboardMode_GuestToHost */
-    mCbClipboard->addItem (""); /* KClipboardMode_Bidirectional */
-
-#ifdef Q_WS_MAC
-    mTeDescription->setMinimumHeight (150);
-#endif /* Q_WS_MAC */
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-bool VBoxVMSettingsGeneral::is64BitOSTypeSelected() const
-{
-    return mOSTypeSelector->type().GetIs64Bit();
-}
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-bool VBoxVMSettingsGeneral::isWindowsOSTypeSelected() const
-{
-    return mOSTypeSelector->type().GetFamilyId() == "Windows";
-}
-#endif
-
-void VBoxVMSettingsGeneral::getFrom (const CMachine &aMachine)
-{
-    mMachine = aMachine;
-
-    /* Name */
-    mLeName->setText (aMachine.GetName());
-
-    /* OS type */
-    mOSTypeSelector->setType (vboxGlobal().vmGuestOSType (aMachine.GetOSTypeId()));
-
-    /* Remember mediums mounted at runtime */
-    QString saveRtimeImages = mMachine.GetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime);
-    mCbSaveMounted->setChecked (saveRtimeImages != "no");
-
-    /* Show Mini ToolBar in fullscreen/seamless */
-    QString showMiniToolBar = mMachine.GetExtraData (VBoxDefs::GUI_ShowMiniToolBar);
-    mCbShowToolBar->setChecked (showMiniToolBar != "no");
-
-    /* Show Mini ToolBar at top */
-    QString miniToolBarAlignment = mMachine.GetExtraData (VBoxDefs::GUI_MiniToolBarAlignment);
-    mCbToolBarAlignment->setChecked (miniToolBarAlignment == "top");
-    mCbToolBarAlignment->setEnabled (mCbShowToolBar->isChecked());
-
-    /* Snapshot folder */
-    mPsSnapshot->setPath (aMachine.GetSnapshotFolder());
-    mPsSnapshot->setHomeDir (QFileInfo (mMachine.GetSettingsFilePath()).absolutePath());
-
-    /* Shared clipboard mode */
-    mCbClipboard->setCurrentIndex (aMachine.GetClipboardMode());
-
-    /* Description */
-    mTeDescription->setPlainText (aMachine.GetDescription());
-
-    if (mValidator)
-        mValidator->revalidate();
-}
-
-void VBoxVMSettingsGeneral::putBackTo()
-{
-    /* Name */
-    mMachine.SetName (mLeName->text());
-
-    /* OS type */
-    AssertMsg (!mOSTypeSelector->type().isNull(), ("mOSTypeSelector must return non-null type"));
-    mMachine.SetOSTypeId (mOSTypeSelector->type().GetId());
-
-    /* Remember mediums mounted at runtime */
-    mMachine.SetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime,
-                           mCbSaveMounted->isChecked() ? "yes" : "no");
-
-    /* Show Mini ToolBar in fullscreen/seamless */
-    mMachine.SetExtraData (VBoxDefs::GUI_ShowMiniToolBar,
-                           mCbShowToolBar->isChecked() ? "yes" : "no");
-
-    /* Show Mini ToolBar at top */
-    mMachine.SetExtraData (VBoxDefs::GUI_MiniToolBarAlignment,
-                           mCbToolBarAlignment->isChecked() ? "top" : "bottom");
-
-    /* Saved state folder */
-    if (mPsSnapshot->isModified())
-    {
-        mMachine.SetSnapshotFolder (mPsSnapshot->path());
-        if (!mMachine.isOk())
-            vboxProblem().cannotSetSnapshotFolder (mMachine,
-                    QDir::toNativeSeparators (mPsSnapshot->path()));
-    }
-
-    /* Shared clipboard mode */
-    mMachine.SetClipboardMode ((KClipboardMode) mCbClipboard->currentIndex());
-
-    /* Description (set empty to null to avoid an empty <Description> node
-     * in the settings file) */
-    mMachine.SetDescription (mTeDescription->toPlainText().isEmpty() ?
-                             QString::null : mTeDescription->toPlainText());
-}
-
-void VBoxVMSettingsGeneral::setValidator (QIWidgetValidator *aVal)
-{
-    mValidator = aVal;
-    connect (mOSTypeSelector, SIGNAL (osTypeChanged()), mValidator, SLOT (revalidate()));
-}
-
-void VBoxVMSettingsGeneral::setOrderAfter (QWidget *aWidget)
-{
-    /* Setup Tab order */
-    setTabOrder (aWidget, mTwGeneral->focusProxy());
-    setTabOrder (mTwGeneral->focusProxy(), mLeName);
-    setTabOrder (mLeName, mOSTypeSelector);
-
-    setTabOrder (mOSTypeSelector, mPsSnapshot);
-    setTabOrder (mPsSnapshot, mCbClipboard);
-    setTabOrder (mCbClipboard, mCbSaveMounted);
-
-    setTabOrder (mCbSaveMounted, mTeDescription);
-}
-
-void VBoxVMSettingsGeneral::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsGeneral::retranslateUi (this);
-
-    /* Path selector */
-    mPsSnapshot->setWhatsThis (tr ("Displays the path where snapshots of this "
-                                   "virtual machine will be stored. Be aware that "
-                                   "snapshots can take quite a lot of disk "
-                                   "space."));
-
-    /* Shared Clipboard mode */
-    mCbClipboard->setItemText (0, vboxGlobal().toString (KClipboardMode_Disabled));
-    mCbClipboard->setItemText (1, vboxGlobal().toString (KClipboardMode_HostToGuest));
-    mCbClipboard->setItemText (2, vboxGlobal().toString (KClipboardMode_GuestToHost));
-    mCbClipboard->setItemText (3, vboxGlobal().toString (KClipboardMode_Bidirectional));
-}
-
-void VBoxVMSettingsGeneral::showEvent (QShowEvent *aEvent)
-{
-    QCoreApplication::sendPostedEvents();
-    VBoxSettingsPage::showEvent (aEvent);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp	(revision 25170)
+++ 	(revision )
@@ -1,2570 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsHD class implementation
- */
-
-/*
- * Copyright (C) 2006-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global Includes */
-#include <QHeaderView>
-#include <QItemEditorFactory>
-#include <QMetaProperty>
-#include <QMouseEvent>
-#include <QScrollBar>
-#include <QStylePainter>
-#include <QTimer>
-
-/* Local Includes */
-#include "VBoxVMSettingsHD.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "QIWidgetValidator.h"
-#include "VBoxToolBar.h"
-#include "VBoxMediaManagerDlg.h"
-#include "VBoxNewHDWzd.h"
-
-/* String Tags */
-const char *firstAvailableId = "first available";
-
-/* Type converters */
-VBoxDefs::MediumType typeToLocal (KDeviceType aType)
-{
-    VBoxDefs::MediumType result = VBoxDefs::MediumType_Invalid;
-    switch (aType)
-    {
-        case KDeviceType_HardDisk:
-            result = VBoxDefs::MediumType_HardDisk;
-            break;
-        case KDeviceType_DVD:
-            result = VBoxDefs::MediumType_DVD;
-            break;
-        case KDeviceType_Floppy:
-            result = VBoxDefs::MediumType_Floppy;
-            break;
-        default:
-            AssertMsgFailed (("Incorrect medium type!\n"));
-            break;
-    }
-    return result;
-}
-
-
-QString compressText (const QString &aText)
-{
-    return QString ("<nobr><compact elipsis=\"end\">%1</compact></nobr>").arg (aText);
-}
-
-
-/* Pixmap Storage */
-QPointer <PixmapPool> PixmapPool::mThis = 0;
-
-PixmapPool* PixmapPool::pool (QObject *aParent)
-{
-    if (!mThis)
-    {
-        AssertMsg (aParent, ("This object must have parent!\n"));
-        mThis = new PixmapPool (aParent);
-    }
-    else
-    {
-        AssertMsg (!aParent, ("Parent already set!\n"));
-    }
-    return mThis;
-}
-
-PixmapPool::PixmapPool (QObject *aParent)
-    : QObject (aParent)
-{
-    mPool.resize (MaxIndex);
-
-    mPool [ControllerAddEn]          = QPixmap (":/controller_add_16px.png");
-    mPool [ControllerAddDis]         = QPixmap (":/controller_add_disabled_16px.png");
-    mPool [ControllerDelEn]          = QPixmap (":/controller_remove_16px.png");
-    mPool [ControllerDelDis]         = QPixmap (":/controller_remove_disabled_16px.png");
-
-    mPool [AttachmentAddEn]          = QPixmap (":/attachment_add_16px.png");
-    mPool [AttachmentAddDis]         = QPixmap (":/attachment_add_disabled_16px.png");
-    mPool [AttachmentDelEn]          = QPixmap (":/attachment_remove_16px.png");
-    mPool [AttachmentDelDis]         = QPixmap (":/attachment_remove_disabled_16px.png");
-
-    mPool [IDEControllerNormal]      = QPixmap (":/ide_16px.png");
-    mPool [IDEControllerExpand]      = QPixmap (":/ide_expand_16px.png");
-    mPool [IDEControllerCollapse]    = QPixmap (":/ide_collapse_16px.png");
-    mPool [SATAControllerNormal]     = QPixmap (":/sata_16px.png");
-    mPool [SATAControllerExpand]     = QPixmap (":/sata_expand_16px.png");
-    mPool [SATAControllerCollapse]   = QPixmap (":/sata_collapse_16px.png");
-    mPool [SCSIControllerNormal]     = QPixmap (":/scsi_16px.png");
-    mPool [SCSIControllerExpand]     = QPixmap (":/scsi_expand_16px.png");
-    mPool [SCSIControllerCollapse]   = QPixmap (":/scsi_collapse_16px.png");
-    mPool [FloppyControllerNormal]   = QPixmap (":/floppy_16px.png");
-    mPool [FloppyControllerExpand]   = QPixmap (":/floppy_expand_16px.png");
-    mPool [FloppyControllerCollapse] = QPixmap (":/floppy_collapse_16px.png");
-
-    mPool [IDEControllerAddEn]       = QPixmap (":/ide_add_16px.png");
-    mPool [IDEControllerAddDis]      = QPixmap (":/ide_add_disabled_16px.png");
-    mPool [SATAControllerAddEn]      = QPixmap (":/sata_add_16px.png");
-    mPool [SATAControllerAddDis]     = QPixmap (":/sata_add_disabled_16px.png");
-    mPool [SCSIControllerAddEn]      = QPixmap (":/scsi_add_16px.png");
-    mPool [SCSIControllerAddDis]     = QPixmap (":/scsi_add_disabled_16px.png");
-    mPool [FloppyControllerAddEn]    = QPixmap (":/floppy_add_16px.png");
-    mPool [FloppyControllerAddDis]   = QPixmap (":/floppy_add_disabled_16px.png");
-
-    mPool [HDAttachmentNormal]       = QPixmap (":/hd_16px.png");
-    mPool [CDAttachmentNormal]       = QPixmap (":/cd_16px.png");
-    mPool [FDAttachmentNormal]       = QPixmap (":/fd_16px.png");
-
-    mPool [HDAttachmentAddEn]        = QPixmap (":/hd_add_16px.png");
-    mPool [HDAttachmentAddDis]       = QPixmap (":/hd_add_disabled_16px.png");
-    mPool [CDAttachmentAddEn]        = QPixmap (":/cd_add_16px.png");
-    mPool [CDAttachmentAddDis]       = QPixmap (":/cd_add_disabled_16px.png");
-    mPool [FDAttachmentAddEn]        = QPixmap (":/fd_add_16px.png");
-    mPool [FDAttachmentAddDis]       = QPixmap (":/fd_add_disabled_16px.png");
-
-    mPool [VMMEn]                    = QPixmap (":/select_file_16px.png");
-    mPool [VMMDis]                   = QPixmap (":/select_file_dis_16px.png");
-}
-
-QPixmap PixmapPool::pixmap (PixmapType aType) const
-{
-    return aType > InvalidPixmap && aType < MaxIndex ? mPool [aType] : 0;
-}
-
-/* Abstract Controller Type */
-AbstractControllerType::AbstractControllerType (KStorageBus aBusType, KStorageControllerType aCtrType)
-    : mBusType (aBusType)
-    , mCtrType (aCtrType)
-{
-    AssertMsg (mBusType != KStorageBus_Null, ("Wrong Bus Type {%d}!\n", mBusType));
-    AssertMsg (mCtrType != KStorageControllerType_Null, ("Wrong Controller Type {%d}!\n", mCtrType));
-
-    for (int i = 0; i < State_MAX; ++ i)
-    {
-        mPixmaps << PixmapPool::InvalidPixmap;
-        switch (mBusType)
-        {
-            case KStorageBus_IDE:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::IDEControllerNormal + i);
-                break;
-            case KStorageBus_SATA:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SATAControllerNormal + i);
-                break;
-            case KStorageBus_SCSI:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SCSIControllerNormal + i);
-                break;
-            case KStorageBus_Floppy:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::FloppyControllerNormal + i);
-                break;
-            default:
-                break;
-        }
-        AssertMsg (mPixmaps [i] != PixmapPool::InvalidPixmap, ("Item state pixmap was not set!\n"));
-    }
-}
-
-KStorageBus AbstractControllerType::busType() const
-{
-    return mBusType;
-}
-
-KStorageControllerType AbstractControllerType::ctrType() const
-{
-    return mCtrType;
-}
-
-ControllerTypeList AbstractControllerType::ctrTypes() const
-{
-    ControllerTypeList result;
-    for (uint i = first(); i < first() + size(); ++ i)
-        result << (KStorageControllerType) i;
-    return result;
-}
-
-PixmapPool::PixmapType AbstractControllerType::pixmap (ItemState aState) const
-{
-    return mPixmaps [aState];
-}
-
-void AbstractControllerType::setCtrType (KStorageControllerType aCtrType)
-{
-    mCtrType = aCtrType;
-}
-
-DeviceTypeList AbstractControllerType::deviceTypeList() const
-{
-    return vboxGlobal().virtualBox().GetSystemProperties().GetDeviceTypesForStorageBus (mBusType).toList();
-}
-
-/* IDE Controller Type */
-IDEControllerType::IDEControllerType (KStorageControllerType aSubType)
-    : AbstractControllerType (KStorageBus_IDE, aSubType)
-{
-}
-
-KStorageControllerType IDEControllerType::first() const
-{
-    return KStorageControllerType_PIIX3;
-}
-
-uint IDEControllerType::size() const
-{
-    return 3;
-}
-
-/* SATA Controller Type */
-SATAControllerType::SATAControllerType (KStorageControllerType aSubType)
-    : AbstractControllerType (KStorageBus_SATA, aSubType)
-{
-}
-
-KStorageControllerType SATAControllerType::first() const
-{
-    return KStorageControllerType_IntelAhci;
-}
-
-uint SATAControllerType::size() const
-{
-    return 1;
-}
-
-/* SCSI Controller Type */
-SCSIControllerType::SCSIControllerType (KStorageControllerType aSubType)
-    : AbstractControllerType (KStorageBus_SCSI, aSubType)
-{
-}
-
-KStorageControllerType SCSIControllerType::first() const
-{
-    return KStorageControllerType_LsiLogic;
-}
-
-uint SCSIControllerType::size() const
-{
-    return 2;
-}
-
-/* Floppy Controller Type */
-FloppyControllerType::FloppyControllerType (KStorageControllerType aSubType)
-    : AbstractControllerType (KStorageBus_Floppy, aSubType)
-{
-}
-
-KStorageControllerType FloppyControllerType::first() const
-{
-    return KStorageControllerType_I82078;
-}
-
-uint FloppyControllerType::size() const
-{
-    return 1;
-}
-
-/* Abstract Item */
-AbstractItem::AbstractItem (AbstractItem *aParent)
-    : mParent (aParent)
-    , mId (QUuid::createUuid())
-{
-    if (mParent) mParent->addChild (this);
-}
-
-AbstractItem::~AbstractItem()
-{
-    if (mParent) mParent->delChild (this);
-}
-
-AbstractItem* AbstractItem::parent() const
-{
-    return mParent;
-}
-
-QUuid AbstractItem::id() const
-{
-    return mId;
-}
-
-QString AbstractItem::machineId() const
-{
-    return mMachineId;
-}
-
-void AbstractItem::setMachineId (const QString &aMachineId)
-{
-    mMachineId = aMachineId;
-}
-
-/* Root Item */
-RootItem::RootItem()
-    : AbstractItem (0)
-{
-}
-
-RootItem::~RootItem()
-{
-    while (!mControllers.isEmpty())
-        delete mControllers.first();
-}
-
-ULONG RootItem::childCount (KStorageBus aBus) const
-{
-    ULONG result = 0;
-    foreach (AbstractItem *item, mControllers)
-    {
-        ControllerItem *ctrItem = static_cast <ControllerItem*> (item);
-        if (ctrItem->ctrBusType() == aBus)
-            ++ result;
-    }
-    return result;
-}
-
-AbstractItem::ItemType RootItem::rtti() const
-{
-    return Type_RootItem;
-}
-
-AbstractItem* RootItem::childByPos (int aIndex)
-{
-    return mControllers [aIndex];
-}
-
-AbstractItem* RootItem::childById (const QUuid &aId)
-{
-    for (int i = 0; i < childCount(); ++ i)
-        if (mControllers [i]->id() == aId)
-            return mControllers [i];
-    return 0;
-}
-
-int RootItem::posOfChild (AbstractItem *aItem) const
-{
-    return mControllers.indexOf (aItem);
-}
-
-int RootItem::childCount() const
-{
-    return mControllers.size();
-}
-
-QString RootItem::text() const
-{
-    return QString();
-}
-
-QString RootItem::tip() const
-{
-    return QString();
-}
-
-QPixmap RootItem::pixmap (ItemState /* aState */)
-{
-    return QPixmap();
-}
-
-void RootItem::addChild (AbstractItem *aItem)
-{
-    mControllers << aItem;
-}
-
-void RootItem::delChild (AbstractItem *aItem)
-{
-    mControllers.removeAll (aItem);
-}
-
-/* Controller Item */
-ControllerItem::ControllerItem (AbstractItem *aParent, const QString &aName,
-                                KStorageBus aBusType, KStorageControllerType aControllerType)
-    : AbstractItem (aParent)
-    , mCtrName (aName)
-    , mCtrType (0)
-{
-    /* Check for proper parent type */
-    AssertMsg (mParent->rtti() == AbstractItem::Type_RootItem, ("Incorrect parent type!\n"));
-
-    /* Select default type */
-    switch (aBusType)
-    {
-        case KStorageBus_IDE:
-            mCtrType = new IDEControllerType (aControllerType);
-            break;
-        case KStorageBus_SATA:
-            mCtrType = new SATAControllerType (aControllerType);
-            break;
-        case KStorageBus_SCSI:
-            mCtrType = new SCSIControllerType (aControllerType);
-            break;
-        case KStorageBus_Floppy:
-            mCtrType = new FloppyControllerType (aControllerType);
-            break;
-        default:
-            AssertMsgFailed (("Wrong Controller Type {%d}!\n", aBusType));
-            break;
-    }
-}
-
-ControllerItem::~ControllerItem()
-{
-    delete mCtrType;
-    while (!mAttachments.isEmpty())
-        delete mAttachments.first();
-}
-
-KStorageBus ControllerItem::ctrBusType() const
-{
-    return mCtrType->busType();
-}
-
-QString ControllerItem::ctrName() const
-{
-    return mCtrName;
-}
-
-KStorageControllerType ControllerItem::ctrType() const
-{
-    return mCtrType->ctrType();
-}
-
-ControllerTypeList ControllerItem::ctrTypes() const
-{
-    return mCtrType->ctrTypes();
-}
-
-void ControllerItem::setCtrName (const QString &aCtrName)
-{
-    mCtrName = aCtrName;
-}
-
-void ControllerItem::setCtrType (KStorageControllerType aCtrType)
-{
-    mCtrType->setCtrType (aCtrType);
-}
-
-SlotsList ControllerItem::ctrAllSlots() const
-{
-    SlotsList allSlots;
-    CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties();
-    for (ULONG i = 0; i < sp.GetMaxPortCountForStorageBus (mCtrType->busType()); ++ i)
-        for (ULONG j = 0; j < sp.GetMaxDevicesPerPortForStorageBus (mCtrType->busType()); ++ j)
-            allSlots << StorageSlot (mCtrType->busType(), i, j);
-    return allSlots;
-}
-
-SlotsList ControllerItem::ctrUsedSlots() const
-{
-    SlotsList usedSlots;
-    for (int i = 0; i < mAttachments.size(); ++ i)
-        usedSlots << static_cast <AttachmentItem*> (mAttachments [i])->attSlot();
-    return usedSlots;
-}
-
-DeviceTypeList ControllerItem::ctrDeviceTypeList() const
-{
-     return mCtrType->deviceTypeList();
-}
-
-QStringList ControllerItem::ctrAllMediumIds (bool aShowDiffs) const
-{
-    QStringList allMediums;
-    foreach (const VBoxMedium &medium, vboxGlobal().currentMediaList())
-    {
-         foreach (const KDeviceType &deviceType, mCtrType->deviceTypeList())
-         {
-             if (medium.isNull() || medium.medium().GetDeviceType() == deviceType)
-             {
-                 /* In 'don't show diffs' mode we should only show hard-disks which are:
-                  * 1. Attached to 'current state' of this VM even if these are differencing disks.
-                  * 2. Not attached to this VM at all only if they are not differencing disks. */
-                 if (!aShowDiffs && medium.type() == VBoxDefs::MediumType_HardDisk)
-                 {
-                     if (medium.isAttachedInCurStateTo (parent()->machineId()) ||
-                         (!medium.medium().GetMachineIds().contains (parent()->machineId()) && !medium.parent()))
-                         allMediums << medium.id();
-                 }
-                 else allMediums << medium.id();
-                 break;
-             }
-         }
-    }
-    return allMediums;
-}
-
-QStringList ControllerItem::ctrUsedMediumIds() const
-{
-    QStringList usedImages;
-    for (int i = 0; i < mAttachments.size(); ++ i)
-    {
-        QString usedMediumId = static_cast <AttachmentItem*> (mAttachments [i])->attMediumId();
-        if (!vboxGlobal().findMedium (usedMediumId).isNull())
-            usedImages << usedMediumId;
-    }
-    return usedImages;
-}
-
-AbstractItem::ItemType ControllerItem::rtti() const
-{
-    return Type_ControllerItem;
-}
-
-AbstractItem* ControllerItem::childByPos (int aIndex)
-{
-    return mAttachments [aIndex];
-}
-
-AbstractItem* ControllerItem::childById (const QUuid &aId)
-{
-    for (int i = 0; i < childCount(); ++ i)
-        if (mAttachments [i]->id() == aId)
-            return mAttachments [i];
-    return 0;
-}
-
-int ControllerItem::posOfChild (AbstractItem *aItem) const
-{
-    return mAttachments.indexOf (aItem);
-}
-
-int ControllerItem::childCount() const
-{
-    return mAttachments.size();
-}
-
-QString ControllerItem::text() const
-{
-    return ctrName();
-}
-
-QString ControllerItem::tip() const
-{
-    return VBoxVMSettingsHD::tr ("<nobr><b>%1</b></nobr><br>"
-                                 "<nobr>Bus:&nbsp;&nbsp;%2</nobr><br>"
-                                 "<nobr>Type:&nbsp;&nbsp;%3</nobr>")
-                                 .arg (mCtrName)
-                                 .arg (vboxGlobal().toString (mCtrType->busType()))
-                                 .arg (vboxGlobal().toString (mCtrType->ctrType()));
-}
-
-QPixmap ControllerItem::pixmap (ItemState aState)
-{
-    return PixmapPool::pool()->pixmap (mCtrType->pixmap (aState));
-}
-
-void ControllerItem::addChild (AbstractItem *aItem)
-{
-    mAttachments << aItem;
-}
-
-void ControllerItem::delChild (AbstractItem *aItem)
-{
-    mAttachments.removeAll (aItem);
-}
-
-/* Attachment Item */
-AttachmentItem::AttachmentItem (AbstractItem *aParent, KDeviceType aDeviceType, bool aVerbose)
-    : AbstractItem (aParent)
-    , mAttDeviceType (aDeviceType)
-    , mAttIsShowDiffs (false)
-    , mAttIsHostDrive (false)
-    , mAttIsPassthrough (false)
-{
-    /* Check for proper parent type */
-    AssertMsg (mParent->rtti() == AbstractItem::Type_ControllerItem, ("Incorrect parent type!\n"));
-
-    /* Select default slot */
-    AssertMsg (!attSlots().isEmpty(), ("There should be at least one available slot!\n"));
-    mAttSlot = attSlots() [0];
-
-    /* Try to select unique medium */
-    QStringList freeMediumIds (attMediumIds());
-    switch (mAttDeviceType)
-    {
-        case KDeviceType_HardDisk:
-            if (freeMediumIds.size() > 0)
-                setAttMediumId (freeMediumIds [0]);
-            break;
-        case KDeviceType_DVD:
-        case KDeviceType_Floppy:
-            if (freeMediumIds.size() > 1)
-                setAttMediumId (freeMediumIds [1]);
-            else if (!aVerbose && freeMediumIds.size() > 0)
-                setAttMediumId (freeMediumIds [0]);
-            break;
-        default:
-            break;
-    }
-}
-
-StorageSlot AttachmentItem::attSlot() const
-{
-    return mAttSlot;
-}
-
-SlotsList AttachmentItem::attSlots() const
-{
-    ControllerItem *ctr = static_cast <ControllerItem*> (mParent);
-
-    /* Filter list from used slots */
-    SlotsList allSlots (ctr->ctrAllSlots());
-    SlotsList usedSlots (ctr->ctrUsedSlots());
-    foreach (StorageSlot usedSlot, usedSlots)
-        if (usedSlot != mAttSlot)
-            allSlots.removeAll (usedSlot);
-
-    return allSlots;
-}
-
-KDeviceType AttachmentItem::attDeviceType() const
-{
-    return mAttDeviceType;
-}
-
-DeviceTypeList AttachmentItem::attDeviceTypes() const
-{
-    return static_cast <ControllerItem*> (mParent)->ctrDeviceTypeList();
-}
-
-QString AttachmentItem::attMediumId() const
-{
-    return mAttMediumId;
-}
-
-QStringList AttachmentItem::attMediumIds (bool aFilter) const
-{
-    ControllerItem *ctr = static_cast <ControllerItem*> (mParent);
-    QStringList allMediumIds;
-
-    /* Populate list of suitable medium ids */
-    foreach (QString mediumId, ctr->ctrAllMediumIds (mAttIsShowDiffs))
-    {
-        VBoxMedium medium = vboxGlobal().findMedium (mediumId);
-        if ((medium.isNull() && mAttDeviceType != KDeviceType_HardDisk) ||
-            (!medium.isNull() && medium.medium().GetDeviceType() == mAttDeviceType))
-            allMediumIds << mediumId;
-    }
-
-    if (aFilter)
-    {
-        /* Filter list from used medium ids */
-        QStringList usedMediumIds (ctr->ctrUsedMediumIds());
-        foreach (QString usedMediumId, usedMediumIds)
-            if (usedMediumId != mAttMediumId)
-                allMediumIds.removeAll (usedMediumId);
-    }
-
-    return allMediumIds;
-}
-
-bool AttachmentItem::attIsShowDiffs() const
-{
-    return mAttIsShowDiffs;
-}
-
-bool AttachmentItem::attIsHostDrive() const
-{
-    return mAttIsHostDrive;
-}
-
-bool AttachmentItem::attIsPassthrough() const
-{
-    return mAttIsPassthrough;
-}
-
-void AttachmentItem::setAttSlot (const StorageSlot &aAttSlot)
-{
-    mAttSlot = aAttSlot;
-}
-
-void AttachmentItem::setAttDevice (KDeviceType aAttDeviceType)
-{
-    mAttDeviceType = aAttDeviceType;
-}
-
-void AttachmentItem::setAttMediumId (const QString &aAttMediumId)
-{
-    VBoxMedium medium;
-
-    /* Caching first available medium */
-    if (aAttMediumId == firstAvailableId && !attMediumIds (false).isEmpty())
-        medium = vboxGlobal().findMedium (attMediumIds (false) [0]);
-    /* Caching passed medium */
-    else if (!aAttMediumId.isEmpty())
-        medium = vboxGlobal().findMedium (aAttMediumId);
-
-    mAttMediumId = medium.id();
-    cache();
-}
-
-void AttachmentItem::setAttIsShowDiffs (bool aAttIsShowDiffs)
-{
-    mAttIsShowDiffs = aAttIsShowDiffs;
-    cache();
-}
-
-void AttachmentItem::setAttIsPassthrough (bool aIsAttPassthrough)
-{
-    mAttIsPassthrough = aIsAttPassthrough;
-}
-
-QString AttachmentItem::attSize() const
-{
-    return mAttSize;
-}
-
-QString AttachmentItem::attLogicalSize() const
-{
-    return mAttLogicalSize;
-}
-
-QString AttachmentItem::attLocation() const
-{
-    return mAttLocation;
-}
-
-QString AttachmentItem::attFormat() const
-{
-    return mAttFormat;
-}
-
-QString AttachmentItem::attUsage() const
-{
-    return mAttUsage;
-}
-
-void AttachmentItem::cache()
-{
-    VBoxMedium medium = vboxGlobal().findMedium (mAttMediumId);
-
-    /* Cache medium information */
-    mAttName = medium.name (!mAttIsShowDiffs);
-    mAttTip = medium.toolTipCheckRO (!mAttIsShowDiffs, mAttDeviceType != KDeviceType_HardDisk);
-    mAttPixmap = medium.iconCheckRO (!mAttIsShowDiffs);
-    mAttIsHostDrive = medium.isHostDrive();
-
-    /* Cache additional information */
-    mAttSize = medium.size (!mAttIsShowDiffs);
-    mAttLogicalSize = medium.logicalSize (!mAttIsShowDiffs);
-    mAttLocation = medium.location (!mAttIsShowDiffs);
-    mAttFormat = medium.isNull() ? QString ("--") :
-        QString ("%1 (%2)").arg (medium.hardDiskType (!mAttIsShowDiffs))
-                           .arg (medium.hardDiskFormat (!mAttIsShowDiffs));
-    mAttUsage = medium.usage (!mAttIsShowDiffs);
-
-    /* Fill empty attributes */
-    if (mAttUsage.isEmpty())
-        mAttUsage = QString ("--");
-}
-
-AbstractItem::ItemType AttachmentItem::rtti() const
-{
-    return Type_AttachmentItem;
-}
-
-AbstractItem* AttachmentItem::childByPos (int /* aIndex */)
-{
-    return 0;
-}
-
-AbstractItem* AttachmentItem::childById (const QUuid& /* aId */)
-{
-    return 0;
-}
-
-int AttachmentItem::posOfChild (AbstractItem* /* aItem */) const
-{
-    return 0;
-}
-
-int AttachmentItem::childCount() const
-{
-    return 0;
-}
-
-QString AttachmentItem::text() const
-{
-    return mAttName;
-}
-
-QString AttachmentItem::tip() const
-{
-    return mAttTip;
-}
-
-QPixmap AttachmentItem::pixmap (ItemState /* aState */)
-{
-    if (mAttPixmap.isNull())
-    {
-        switch (mAttDeviceType)
-        {
-            case KDeviceType_HardDisk:
-                mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentNormal);
-                break;
-            case KDeviceType_DVD:
-                mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentNormal);
-                break;
-            case KDeviceType_Floppy:
-                mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentNormal);
-                break;
-            default:
-                break;
-        }
-    }
-    return mAttPixmap;
-}
-
-void AttachmentItem::addChild (AbstractItem* /* aItem */)
-{
-}
-
-void AttachmentItem::delChild (AbstractItem* /* aItem */)
-{
-}
-
-/* Storage model */
-StorageModel::StorageModel (QObject *aParent)
-    : QAbstractItemModel (aParent)
-    , mRootItem (new RootItem)
-    , mToolTipType (DefaultToolTip)
-{
-}
-
-StorageModel::~StorageModel()
-{
-    delete mRootItem;
-}
-
-int StorageModel::rowCount (const QModelIndex &aParent) const
-{
-    return !aParent.isValid() ? 1 /* only root item has invalid parent */ :
-           static_cast <AbstractItem*> (aParent.internalPointer())->childCount();
-}
-
-int StorageModel::columnCount (const QModelIndex & /* aParent */) const
-{
-    return 1;
-}
-
-QModelIndex StorageModel::root() const
-{
-    return index (0, 0);
-}
-
-QModelIndex StorageModel::index (int aRow, int aColumn, const QModelIndex &aParent) const
-{
-    if (!hasIndex (aRow, aColumn, aParent))
-        return QModelIndex();
-
-    AbstractItem *item = !aParent.isValid() ? mRootItem :
-                         static_cast <AbstractItem*> (aParent.internalPointer())->childByPos (aRow);
-
-    return item ? createIndex (aRow, aColumn, item) : QModelIndex();
-}
-
-QModelIndex StorageModel::parent (const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid())
-        return QModelIndex();
-
-    AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer());
-    AbstractItem *parentOfItem = item->parent();
-    AbstractItem *parentOfParent = parentOfItem ? parentOfItem->parent() : 0;
-    int position = parentOfParent ? parentOfParent->posOfChild (parentOfItem) : 0;
-
-    if (parentOfItem)
-        return createIndex (position, 0, parentOfItem);
-    else
-        return QModelIndex();
-}
-
-QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
-{
-    if (!aIndex.isValid())
-        return QVariant();
-
-    switch (aRole)
-    {
-        /* Basic Attributes: */
-        case Qt::FontRole:
-        {
-            return QVariant (qApp->font());
-        }
-        case Qt::SizeHintRole:
-        {
-            QFontMetrics fm (data (aIndex, Qt::FontRole).value <QFont>());
-            int minimumHeight = qMax (fm.height(), data (aIndex, R_IconSize).toInt());
-            int margin = data (aIndex, R_Margin).toInt();
-            return QSize (1 /* ignoring width */, 2 * margin + minimumHeight);
-        }
-        case Qt::ToolTipRole:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-            {
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                {
-                    QString tip (item->tip());
-                    switch (mToolTipType)
-                    {
-                        case ExpanderToolTip:
-                            if (aIndex.child (0, 0).isValid())
-                                tip = VBoxVMSettingsHD::tr ("<nobr>Expand/Collapse&nbsp;Item</nobr>");
-                            break;
-                        case HDAdderToolTip:
-                            tip = VBoxVMSettingsHD::tr ("<nobr>Add&nbsp;Hard&nbsp;Disk</nobr>");
-                            break;
-                        case CDAdderToolTip:
-                            tip = VBoxVMSettingsHD::tr ("<nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr>");
-                            break;
-                        case FDAdderToolTip:
-                            tip = VBoxVMSettingsHD::tr ("<nobr>Add&nbsp;Floppy&nbsp;Device</nobr>");
-                            break;
-                        default:
-                            break;
-                    }
-                    return tip;
-                }
-                return item->tip();
-            }
-            return QString();
-        }
-
-        /* Advanced Attributes: */
-        case R_ItemId:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                return item->id().toString();
-            return QUuid().toString();
-        }
-        case R_ItemPixmap:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-            {
-                ItemState state = State_DefaultItem;
-                if (hasChildren (aIndex))
-                    if (QTreeView *view = qobject_cast <QTreeView*> (QObject::parent()))
-                        state = view->isExpanded (aIndex) ? State_ExpandedItem : State_CollapsedItem;
-                return item->pixmap (state);
-            }
-            return QPixmap();
-        }
-        case R_ItemPixmapRect:
-        {
-            int margin = data (aIndex, R_Margin).toInt();
-            int width = data (aIndex, R_IconSize).toInt();
-            return QRect (margin, margin, width, width);
-        }
-        case R_ItemName:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                return item->text();
-            return QString();
-        }
-        case R_ItemNamePoint:
-        {
-            int margin = data (aIndex, R_Margin).toInt();
-            int spacing = data (aIndex, R_Spacing).toInt();
-            int width = data (aIndex, R_IconSize).toInt();
-            QFontMetrics fm (data (aIndex, Qt::FontRole).value <QFont>());
-            QSize sizeHint = data (aIndex, Qt::SizeHintRole).toSize();
-            return QPoint (margin + width + 2 * spacing,
-                           sizeHint.height() / 2 + fm.ascent() / 2 - 1 /* base line */);
-        }
-        case R_ItemType:
-        {
-            QVariant result (QVariant::fromValue (AbstractItem::Type_InvalidItem));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                result.setValue (item->rtti());
-            return result;
-        }
-        case R_IsController:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                return item->rtti() == AbstractItem::Type_ControllerItem;
-            return false;
-        }
-        case R_IsAttachment:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                return item->rtti() == AbstractItem::Type_AttachmentItem;
-            return false;
-        }
-
-        case R_ToolTipType:
-        {
-            return QVariant::fromValue (mToolTipType);
-        }
-        case R_IsMoreIDEControllersPossible:
-        {
-            return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_IDE) <
-                   vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (KStorageBus_IDE);
-        }
-        case R_IsMoreSATAControllersPossible:
-        {
-            return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_SATA) <
-                   vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (KStorageBus_SATA);
-        }
-        case R_IsMoreSCSIControllersPossible:
-        {
-            return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_SCSI) <
-                   vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (KStorageBus_SCSI);
-        }
-        case R_IsMoreFloppyControllersPossible:
-        {
-            return static_cast <RootItem*> (mRootItem)->childCount (KStorageBus_Floppy) <
-                   vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus (KStorageBus_Floppy);
-        }
-        case R_IsMoreAttachmentsPossible:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-            {
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                {
-                    ControllerItem *ctr = static_cast <ControllerItem*> (item);
-                    CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties();
-                    return (uint) rowCount (aIndex) < sp.GetMaxPortCountForStorageBus (ctr->ctrBusType()) *
-                                                      sp.GetMaxDevicesPerPortForStorageBus (ctr->ctrBusType());
-                }
-            }
-            return false;
-        }
-
-        case R_CtrName:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                    return static_cast <ControllerItem*> (item)->ctrName();
-            return QString();
-        }
-        case R_CtrType:
-        {
-            QVariant result (QVariant::fromValue (KStorageControllerType_Null));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                    result.setValue (static_cast <ControllerItem*> (item)->ctrType());
-            return result;
-        }
-        case R_CtrTypes:
-        {
-            QVariant result (QVariant::fromValue (ControllerTypeList()));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                    result.setValue (static_cast <ControllerItem*> (item)->ctrTypes());
-            return result;
-        }
-        case R_CtrDevices:
-        {
-            QVariant result (QVariant::fromValue (DeviceTypeList()));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                    result.setValue (static_cast <ControllerItem*> (item)->ctrDeviceTypeList());
-            return result;
-        }
-        case R_CtrBusType:
-        {
-            QVariant result (QVariant::fromValue (KStorageBus_Null));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                    result.setValue (static_cast <ControllerItem*> (item)->ctrBusType());
-            return result;
-        }
-
-        case R_AttSlot:
-        {
-            QVariant result (QVariant::fromValue (StorageSlot()));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    result.setValue (static_cast <AttachmentItem*> (item)->attSlot());
-            return result;
-        }
-        case R_AttSlots:
-        {
-            QVariant result (QVariant::fromValue (SlotsList()));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    result.setValue (static_cast <AttachmentItem*> (item)->attSlots());
-            return result;
-        }
-        case R_AttDevice:
-        {
-            QVariant result (QVariant::fromValue (KDeviceType_Null));
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    result.setValue (static_cast <AttachmentItem*> (item)->attDeviceType());
-            return result;
-        }
-        case R_AttMediumId:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attMediumId();
-            return QString();
-        }
-        case R_AttIsShowDiffs:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attIsShowDiffs();
-            return false;
-        }
-        case R_AttIsHostDrive:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attIsHostDrive();
-            return false;
-        }
-        case R_AttIsPassthrough:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attIsPassthrough();
-            return false;
-        }
-        case R_AttSize:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attSize();
-            return QString();
-        }
-        case R_AttLogicalSize:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attLogicalSize();
-            return QString();
-        }
-        case R_AttLocation:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attLocation();
-            return QString();
-        }
-        case R_AttFormat:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attFormat();
-            return QString();
-        }
-        case R_AttUsage:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                    return static_cast <AttachmentItem*> (item)->attUsage();
-            return QString();
-        }
-        case R_Margin:
-        {
-            return 4;
-        }
-        case R_Spacing:
-        {
-            return 4;
-        }
-        case R_IconSize:
-        {
-            return 16;
-        }
-
-        case R_HDPixmapEn:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentNormal);
-        }
-        case R_CDPixmapEn:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentNormal);
-        }
-        case R_FDPixmapEn:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentNormal);
-        }
-
-        case R_HDPixmapAddEn:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddEn);
-        }
-        case R_HDPixmapAddDis:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddDis);
-        }
-        case R_CDPixmapAddEn:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddEn);
-        }
-        case R_CDPixmapAddDis:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddDis);
-        }
-        case R_FDPixmapAddEn:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddEn);
-        }
-        case R_FDPixmapAddDis:
-        {
-            return PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddDis);
-        }
-        case R_HDPixmapRect:
-        {
-            int margin = data (aIndex, R_Margin).toInt();
-            int width = data (aIndex, R_IconSize).toInt();
-            return QRect (0 - width - margin, margin, width, width);
-        }
-        case R_CDPixmapRect:
-        {
-            int margin = data (aIndex, R_Margin).toInt();
-            int spacing = data (aIndex, R_Spacing).toInt();
-            int width = data (aIndex, R_IconSize).toInt();
-            return QRect (0 - width - spacing - width - margin, margin, width, width);
-        }
-        case R_FDPixmapRect:
-        {
-            int margin = data (aIndex, R_Margin).toInt();
-            int width = data (aIndex, R_IconSize).toInt();
-            return QRect (0 - width - margin, margin, width, width);
-        }
-
-        default:
-            break;
-    }
-    return QVariant();
-}
-
-bool StorageModel::setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole)
-{
-    if (!aIndex.isValid())
-        return QAbstractItemModel::setData (aIndex, aValue, aRole);
-
-    switch (aRole)
-    {
-        case R_ToolTipType:
-        {
-            mToolTipType = aValue.value <ToolTipType>();
-            emit dataChanged (aIndex, aIndex);
-            return true;
-        }
-        case R_CtrName:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                {
-                    static_cast <ControllerItem*> (item)->setCtrName (aValue.toString());
-                    emit dataChanged (aIndex, aIndex);
-                    return true;
-                }
-            return false;
-        }
-        case R_CtrType:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_ControllerItem)
-                {
-                    static_cast <ControllerItem*> (item)->setCtrType (aValue.value <KStorageControllerType>());
-                    emit dataChanged (aIndex, aIndex);
-                    return true;
-                }
-            return false;
-        }
-        case R_AttSlot:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                {
-                    static_cast <AttachmentItem*> (item)->setAttSlot (aValue.value <StorageSlot>());
-                    emit dataChanged (aIndex, aIndex);
-                    return true;
-                }
-            return false;
-        }
-        case R_AttDevice:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                {
-                    static_cast <AttachmentItem*> (item)->setAttDevice (aValue.value <KDeviceType>());
-                    emit dataChanged (aIndex, aIndex);
-                    return true;
-                }
-            return false;
-        }
-        case R_AttMediumId:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                {
-                    static_cast <AttachmentItem*> (item)->setAttMediumId (aValue.toString());
-                    emit dataChanged (aIndex, aIndex);
-                    return true;
-                }
-            return false;
-        }
-        case R_AttIsShowDiffs:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                {
-                    static_cast <AttachmentItem*> (item)->setAttIsShowDiffs (aValue.toBool());
-                    emit dataChanged (aIndex, aIndex);
-                    return true;
-                }
-            return false;
-        }
-        case R_AttIsPassthrough:
-        {
-            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
-                if (item->rtti() == AbstractItem::Type_AttachmentItem)
-                {
-                    static_cast <AttachmentItem*> (item)->setAttIsPassthrough (aValue.toBool());
-                    emit dataChanged (aIndex, aIndex);
-                    return true;
-                }
-            return false;
-        }
-        default:
-            break;
-    }
-
-    return false;
-}
-
-QModelIndex StorageModel::addController (const QString &aCtrName, KStorageBus aBusType, KStorageControllerType aCtrType)
-{
-    beginInsertRows (root(), mRootItem->childCount(), mRootItem->childCount());
-    new ControllerItem (mRootItem, aCtrName, aBusType, aCtrType);
-    endInsertRows();
-    return index (mRootItem->childCount() - 1, 0, root());
-}
-
-void StorageModel::delController (const QUuid &aCtrId)
-{
-    if (AbstractItem *item = mRootItem->childById (aCtrId))
-    {
-        int itemPosition = mRootItem->posOfChild (item);
-        beginRemoveRows (root(), itemPosition, itemPosition);
-        delete item;
-        endRemoveRows();
-    }
-}
-
-QModelIndex StorageModel::addAttachment (const QUuid &aCtrId, KDeviceType aDeviceType, bool aVerbose)
-{
-    if (AbstractItem *parent = mRootItem->childById (aCtrId))
-    {
-        int parentPosition = mRootItem->posOfChild (parent);
-        QModelIndex parentIndex = index (parentPosition, 0, root());
-        beginInsertRows (parentIndex, parent->childCount(), parent->childCount());
-        new AttachmentItem (parent, aDeviceType, aVerbose);
-        endInsertRows();
-        return index (parent->childCount() - 1, 0, parentIndex);
-    }
-    return QModelIndex();
-}
-
-void StorageModel::delAttachment (const QUuid &aCtrId, const QUuid &aAttId)
-{
-    if (AbstractItem *parent = mRootItem->childById (aCtrId))
-    {
-        int parentPosition = mRootItem->posOfChild (parent);
-        if (AbstractItem *item = parent->childById (aAttId))
-        {
-            int itemPosition = parent->posOfChild (item);
-            beginRemoveRows (index (parentPosition, 0, root()), itemPosition, itemPosition);
-            delete item;
-            endRemoveRows();
-        }
-    }
-}
-
-void StorageModel::setMachineId (const QString &aMachineId)
-{
-    mRootItem->setMachineId (aMachineId);
-}
-
-Qt::ItemFlags StorageModel::flags (const QModelIndex &aIndex) const
-{
-    return !aIndex.isValid() ? QAbstractItemModel::flags (aIndex) :
-           Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-}
-
-/* Storage Delegate */
-StorageDelegate::StorageDelegate (QObject *aParent)
-    : QItemDelegate (aParent)
-{
-}
-
-void StorageDelegate::paint (QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const
-{
-    if (!aIndex.isValid()) return;
-
-    /* Initialize variables */
-    QStyle::State state = aOption.state;
-    QRect rect = aOption.rect;
-    const StorageModel *model = qobject_cast <const StorageModel*> (aIndex.model());
-    Assert (model);
-
-    aPainter->save();
-
-    /* Draw item background */
-    QItemDelegate::drawBackground (aPainter, aOption, aIndex);
-
-    /* Setup foregroung settings */
-    QPalette::ColorGroup cg = state & QStyle::State_Active ? QPalette::Active : QPalette::Inactive;
-    bool isSelected = state & QStyle::State_Selected;
-    bool isFocused = state & QStyle::State_HasFocus;
-    bool isGrayOnLoosingFocus = QApplication::style()->styleHint (QStyle::SH_ItemView_ChangeHighlightOnFocus, &aOption) != 0;
-    aPainter->setPen (aOption.palette.color (cg, isSelected && (isFocused || !isGrayOnLoosingFocus) ?
-                                             QPalette::HighlightedText : QPalette::Text));
-
-    aPainter->translate (rect.x(), rect.y());
-
-    /* Draw Item Pixmap */
-    aPainter->drawPixmap (model->data (aIndex, StorageModel::R_ItemPixmapRect).toRect().topLeft(),
-                          model->data (aIndex, StorageModel::R_ItemPixmap).value <QPixmap>());
-
-    /* Draw compressed item name */
-    int margin = model->data (aIndex, StorageModel::R_Margin).toInt();
-    int iconWidth = model->data (aIndex, StorageModel::R_IconSize).toInt();
-    int spacing = model->data (aIndex, StorageModel::R_Spacing).toInt();
-    QPoint textPosition = model->data (aIndex, StorageModel::R_ItemNamePoint).toPoint();
-    int textWidth = rect.width() - textPosition.x();
-    if (model->data (aIndex, StorageModel::R_IsController).toBool() && state & QStyle::State_Selected)
-    {
-        textWidth -= (2 * spacing + iconWidth + margin);
-        if (model->data (aIndex, StorageModel::R_CtrBusType).value <KStorageBus>() != KStorageBus_Floppy)
-            textWidth -= (spacing + iconWidth);
-    }
-    QString text (model->data (aIndex, StorageModel::R_ItemName).toString());
-    QString shortText (text);
-    QFont font = model->data (aIndex, Qt::FontRole).value <QFont>();
-    QFontMetrics fm (font);
-    while ((shortText.size() > 1) && (fm.width (shortText) + fm.width ("...") > textWidth))
-        shortText.truncate (shortText.size() - 1);
-    if (shortText != text)
-        shortText += "...";
-    aPainter->setFont (font);
-    aPainter->drawText (textPosition, shortText);
-
-    /* Draw Controller Additions */
-    if (model->data (aIndex, StorageModel::R_IsController).toBool() && state & QStyle::State_Selected)
-    {
-        DeviceTypeList devicesList (model->data (aIndex, StorageModel::R_CtrDevices).value <DeviceTypeList>());
-        for (int i = 0; i < devicesList.size(); ++ i)
-        {
-            KDeviceType deviceType = devicesList [i];
-
-            QRect deviceRect;
-            QPixmap devicePixmap;
-            switch (deviceType)
-            {
-                case KDeviceType_HardDisk:
-                {
-                    deviceRect = model->data (aIndex, StorageModel::R_HDPixmapRect).value <QRect>();
-                    devicePixmap = model->data (aIndex, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
-                                   model->data (aIndex, StorageModel::R_HDPixmapAddEn).value <QPixmap>() :
-                                   model->data (aIndex, StorageModel::R_HDPixmapAddDis).value <QPixmap>();
-                    break;
-                }
-                case KDeviceType_DVD:
-                {
-                    deviceRect = model->data (aIndex, StorageModel::R_CDPixmapRect).value <QRect>();
-                    devicePixmap = model->data (aIndex, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
-                                   model->data (aIndex, StorageModel::R_CDPixmapAddEn).value <QPixmap>() :
-                                   model->data (aIndex, StorageModel::R_CDPixmapAddDis).value <QPixmap>();
-                    break;
-                }
-                case KDeviceType_Floppy:
-                {
-                    deviceRect = model->data (aIndex, StorageModel::R_FDPixmapRect).value <QRect>();
-                    devicePixmap = model->data (aIndex, StorageModel::R_IsMoreAttachmentsPossible).toBool() ?
-                                   model->data (aIndex, StorageModel::R_FDPixmapAddEn).value <QPixmap>() :
-                                   model->data (aIndex, StorageModel::R_FDPixmapAddDis).value <QPixmap>();
-                    break;
-                }
-                default:
-                    break;
-            }
-
-            aPainter->drawPixmap (QPoint (rect.width() + deviceRect.x(), deviceRect.y()), devicePixmap);
-        }
-    }
-
-    aPainter->restore();
-
-    drawFocus (aPainter, aOption, rect);
-}
-
-/**
- * QWidget class reimplementation.
- * Used as HD Settings widget.
- */
-VBoxVMSettingsHD::VBoxVMSettingsHD()
-    : mValidator (0)
-    , mIsPolished (false)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsHD::setupUi (this);
-
-    /* Enumerate Mediums */
-    vboxGlobal().startEnumeratingMedia();
-
-    /* Initialize pixmap pool */
-    PixmapPool::pool (this);
-
-    /* Controller Actions */
-    mAddCtrAction = new QAction (this);
-    mAddCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::ControllerAddEn),
-                                                 PixmapPool::pool()->pixmap (PixmapPool::ControllerAddDis)));
-
-    mAddIDECtrAction = new QAction (this);
-    mAddIDECtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::IDEControllerAddEn),
-                                                    PixmapPool::pool()->pixmap (PixmapPool::IDEControllerAddDis)));
-
-    mAddSATACtrAction = new QAction (this);
-    mAddSATACtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddEn),
-                                                     PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddDis)));
-
-    mAddSCSICtrAction = new QAction (this);
-    mAddSCSICtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::SCSIControllerAddEn),
-                                                     PixmapPool::pool()->pixmap (PixmapPool::SCSIControllerAddDis)));
-
-    mAddFloppyCtrAction = new QAction (this);
-    mAddFloppyCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::FloppyControllerAddEn),
-                                                       PixmapPool::pool()->pixmap (PixmapPool::FloppyControllerAddDis)));
-
-    mDelCtrAction = new QAction (this);
-    mDelCtrAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::ControllerDelEn),
-                                                 PixmapPool::pool()->pixmap (PixmapPool::ControllerDelDis)));
-
-    /* Attachment Actions */
-    mAddAttAction = new QAction (this);
-    mAddAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::AttachmentAddEn),
-                                                 PixmapPool::pool()->pixmap (PixmapPool::AttachmentAddDis)));
-
-    mAddHDAttAction = new QAction (this);
-    mAddHDAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddEn),
-                                                   PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddDis)));
-
-    mAddCDAttAction = new QAction (this);
-    mAddCDAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddEn),
-                                                   PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddDis)));
-
-    mAddFDAttAction = new QAction (this);
-    mAddFDAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddEn),
-                                                   PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddDis)));
-
-    mDelAttAction = new QAction (this);
-    mDelAttAction->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::AttachmentDelEn),
-                                                 PixmapPool::pool()->pixmap (PixmapPool::AttachmentDelDis)));
-
-    /* Storage Model/View */
-    mStorageModel = new StorageModel (mTwStorageTree);
-    StorageDelegate *storageDelegate = new StorageDelegate (mTwStorageTree);
-    mTwStorageTree->setMouseTracking (true);
-    mTwStorageTree->setContextMenuPolicy (Qt::CustomContextMenu);
-    mTwStorageTree->setModel (mStorageModel);
-    mTwStorageTree->setItemDelegate (storageDelegate);
-    mTwStorageTree->setRootIndex (mStorageModel->root());
-    mTwStorageTree->setCurrentIndex (mStorageModel->root());
-
-    /* Storage ToolBar */
-    mTbStorageBar->setIconSize (QSize (16, 16));
-    mTbStorageBar->addAction (mAddAttAction);
-    mTbStorageBar->addAction (mDelAttAction);
-    mTbStorageBar->addAction (mAddCtrAction);
-    mTbStorageBar->addAction (mDelCtrAction);
-
-#ifdef Q_WS_MAC
-    /* We need a little more space for the focus rect. */
-    mLtStorage->setContentsMargins (3, 0, 3, 0);
-    mLtStorage->setSpacing (3);
-#endif /* Q_WS_MAC */
-
-    /* Vdi Combo */
-    mCbVdi->setNullItemPresent (true);
-    mCbVdi->refresh();
-
-    /* Vmm Button */
-    mTbVmm->setIcon (VBoxGlobal::iconSet (PixmapPool::pool()->pixmap (PixmapPool::VMMEn),
-                                          PixmapPool::pool()->pixmap (PixmapPool::VMMDis)));
-
-    /* Info Pane initialization */
-    mLbHDVirtualSizeValue->setFullSizeSelection (true);
-    mLbHDActualSizeValue->setFullSizeSelection (true);
-    mLbSizeValue->setFullSizeSelection (true);
-    mLbLocationValue->setFullSizeSelection (true);
-    mLbHDFormatValue->setFullSizeSelection (true);
-    mLbUsageValue->setFullSizeSelection (true);
-
-    /* Setup connections */
-    connect (&vboxGlobal(), SIGNAL (mediumEnumerated (const VBoxMedium &)),
-             this, SLOT (mediumUpdated (const VBoxMedium &)));
-    connect (&vboxGlobal(), SIGNAL (mediumUpdated (const VBoxMedium &)),
-             this, SLOT (mediumUpdated (const VBoxMedium &)));
-    connect (&vboxGlobal(), SIGNAL (mediumRemoved (VBoxDefs::MediumType, const QString &)),
-             this, SLOT (mediumRemoved (VBoxDefs::MediumType, const QString &)));
-    connect (mAddCtrAction, SIGNAL (triggered (bool)), this, SLOT (addController()));
-    connect (mAddIDECtrAction, SIGNAL (triggered (bool)), this, SLOT (addIDEController()));
-    connect (mAddSATACtrAction, SIGNAL (triggered (bool)), this, SLOT (addSATAController()));
-    connect (mAddSCSICtrAction, SIGNAL (triggered (bool)), this, SLOT (addSCSIController()));
-    connect (mAddFloppyCtrAction, SIGNAL (triggered (bool)), this, SLOT (addFloppyController()));
-    connect (mDelCtrAction, SIGNAL (triggered (bool)), this, SLOT (delController()));
-    connect (mAddAttAction, SIGNAL (triggered (bool)), this, SLOT (addAttachment()));
-    connect (mAddHDAttAction, SIGNAL (triggered (bool)), this, SLOT (addHDAttachment()));
-    connect (mAddCDAttAction, SIGNAL (triggered (bool)), this, SLOT (addCDAttachment()));
-    connect (mAddFDAttAction, SIGNAL (triggered (bool)), this, SLOT (addFDAttachment()));
-    connect (mDelAttAction, SIGNAL (triggered (bool)), this, SLOT (delAttachment()));
-    connect (mStorageModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
-             this, SLOT (onRowInserted (const QModelIndex&, int)));
-    connect (mStorageModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
-             this, SLOT (onRowRemoved()));
-    connect (mTwStorageTree, SIGNAL (currentItemChanged (const QModelIndex&, const QModelIndex&)),
-             this, SLOT (onCurrentItemChanged()));
-    connect (mTwStorageTree, SIGNAL (customContextMenuRequested (const QPoint&)),
-             this, SLOT (onContextMenuRequested (const QPoint&)));
-    connect (mTwStorageTree, SIGNAL (drawItemBranches (QPainter*, const QRect&, const QModelIndex&)),
-             this, SLOT (onDrawItemBranches (QPainter *, const QRect &, const QModelIndex &)));
-    connect (mTwStorageTree, SIGNAL (mouseMoved (QMouseEvent*)),
-             this, SLOT (onMouseMoved (QMouseEvent*)));
-    connect (mTwStorageTree, SIGNAL (mousePressed (QMouseEvent*)),
-             this, SLOT (onMouseClicked (QMouseEvent*)));
-    connect (mTwStorageTree, SIGNAL (mouseDoubleClicked (QMouseEvent*)),
-             this, SLOT (onMouseClicked (QMouseEvent*)));
-    connect (mLeName, SIGNAL (textEdited (const QString&)), this, SLOT (setInformation()));
-    connect (mCbType, SIGNAL (activated (int)), this, SLOT (setInformation()));
-    connect (mCbSlot, SIGNAL (activated (int)), this, SLOT (setInformation()));
-    connect (mCbVdi, SIGNAL (activated (int)), this, SLOT (setInformation()));
-    connect (mTbVmm, SIGNAL (clicked (bool)), this, SLOT (onVmmInvoked()));
-    connect (mCbShowDiffs, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
-    connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
-
-    /* Update actions */
-    updateActionsState();
-
-    /* Applying language settings */
-    retranslateUi();
-
-    /* Initial setup */
-    setMinimumWidth (500);
-    mSplitter->setSizes (QList<int>() << (int) (0.45 * minimumWidth()) << (int) (0.55 * minimumWidth()));
-}
-
-void VBoxVMSettingsHD::getFrom (const CMachine &aMachine)
-{
-    mMachine = aMachine;
-
-    /* Set the machine id for the media-combo */
-    mCbVdi->setMachineId (mMachine.GetId());
-    mStorageModel->setMachineId (mMachine.GetId());
-
-    /* Load currently present controllers & attachments */
-    CStorageControllerVector controllers = mMachine.GetStorageControllers();
-    foreach (const CStorageController &controller, controllers)
-    {
-        QString controllerName = controller.GetName();
-        QModelIndex ctrIndex = mStorageModel->addController (controllerName, controller.GetBus(), controller.GetControllerType());
-        QUuid ctrId = QUuid (mStorageModel->data (ctrIndex, StorageModel::R_ItemId).toString());
-
-        CMediumAttachmentVector attachments = mMachine.GetMediumAttachmentsOfController (controllerName);
-        foreach (const CMediumAttachment &attachment, attachments)
-        {
-            QModelIndex attIndex = mStorageModel->addAttachment (ctrId, attachment.GetType(), false);
-            mStorageModel->setData (attIndex, QVariant::fromValue (StorageSlot (controller.GetBus(), attachment.GetPort(), attachment.GetDevice())), StorageModel::R_AttSlot);
-            CMedium medium (attachment.GetMedium());
-            VBoxMedium vboxMedium;
-            vboxGlobal().findMedium (medium, vboxMedium);
-            mStorageModel->setData (attIndex, vboxMedium.id(), StorageModel::R_AttMediumId);
-            mStorageModel->setData (attIndex, attachment.GetPassthrough(), StorageModel::R_AttIsPassthrough);
-        }
-    }
-
-    /* Set the first controller as current if present */
-    if (mStorageModel->rowCount (mStorageModel->root()) > 0)
-        mTwStorageTree->setCurrentIndex (mStorageModel->index (0, 0, mStorageModel->root()));
-}
-
-void VBoxVMSettingsHD::putBackTo()
-{
-    /* Remove currently present controllers & attachments */
-    CStorageControllerVector controllers = mMachine.GetStorageControllers();
-    foreach (const CStorageController &controller, controllers)
-    {
-        QString controllerName (controller.GetName());
-        CMediumAttachmentVector attachments = mMachine.GetMediumAttachmentsOfController (controllerName);
-        foreach (const CMediumAttachment &attachment, attachments)
-            mMachine.DetachDevice (controllerName, attachment.GetPort(), attachment.GetDevice());
-        mMachine.RemoveStorageController (controllerName);
-    }
-
-    /* Save created controllers & attachments */
-    QModelIndex rootIndex = mStorageModel->root();
-    for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
-    {
-        QModelIndex ctrIndex = rootIndex.child (i, 0);
-        QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
-        KStorageBus ctrBusType = mStorageModel->data (ctrIndex, StorageModel::R_CtrBusType).value <KStorageBus>();
-        KStorageControllerType ctrType = mStorageModel->data (ctrIndex, StorageModel::R_CtrType).value <KStorageControllerType>();
-        CStorageController ctr = mMachine.AddStorageController (ctrName, ctrBusType);
-        ctr.SetControllerType (ctrType);
-        int maxUsedPort = -1;
-        for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
-        {
-            QModelIndex attIndex = ctrIndex.child (j, 0);
-            StorageSlot attStorageSlot = mStorageModel->data (attIndex, StorageModel::R_AttSlot).value <StorageSlot>();
-            KDeviceType attDeviceType = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
-            QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString();
-            mMachine.AttachDevice (ctrName, attStorageSlot.port, attStorageSlot.device, attDeviceType, attMediumId);
-            if (attDeviceType == KDeviceType_DVD)
-                mMachine.PassthroughDevice (ctrName, attStorageSlot.port, attStorageSlot.device,
-                                            mStorageModel->data (attIndex, StorageModel::R_AttIsPassthrough).toBool());
-            maxUsedPort = attStorageSlot.port > maxUsedPort ? attStorageSlot.port : maxUsedPort;
-        }
-        if (ctrBusType == KStorageBus_SATA)
-        {
-            ULONG sataPortsCount = maxUsedPort + 1;
-            sataPortsCount = qMax (sataPortsCount, ctr.GetMinPortCount());
-            sataPortsCount = qMin (sataPortsCount, ctr.GetMaxPortCount());
-            ctr.SetPortCount (sataPortsCount);
-        }
-    }
-}
-
-void VBoxVMSettingsHD::setValidator (QIWidgetValidator *aVal)
-{
-    mValidator = aVal;
-}
-
-bool VBoxVMSettingsHD::revalidate (QString &aWarning, QString &)
-{
-    QModelIndex rootIndex = mStorageModel->root();
-    QMap <QString, QString> config;
-    for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
-    {
-        QModelIndex ctrIndex = rootIndex.child (i, 0);
-        QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
-        for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
-        {
-            QModelIndex attIndex = ctrIndex.child (j, 0);
-            StorageSlot attSlot = mStorageModel->data (attIndex, StorageModel::R_AttSlot).value <StorageSlot>();
-            KDeviceType attDevice = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
-            QString key (mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString());
-            QString value (QString ("%1 (%2)").arg (ctrName, vboxGlobal().toString (attSlot)));
-            /* Check for emptiness */
-            if (vboxGlobal().findMedium (key).isNull() && attDevice == KDeviceType_HardDisk)
-            {
-                aWarning = tr ("No hard disk is selected for <i>%1</i>.").arg (value);
-                return aWarning.isNull();
-            }
-            /* Check for coincidence */
-            if (!vboxGlobal().findMedium (key).isNull() && config.contains (key))
-            {
-                aWarning = tr ("<i>%1</i> uses a medium that is already attached to <i>%2</i>.")
-                              .arg (value).arg (config [key]);
-                return aWarning.isNull();
-            }
-            else config.insert (key, value);
-        }
-    }
-    return aWarning.isNull();
-}
-
-void VBoxVMSettingsHD::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsHD::retranslateUi (this);
-
-    mAddCtrAction->setShortcut (QKeySequence ("Ins"));
-    mDelCtrAction->setShortcut (QKeySequence ("Del"));
-    mAddAttAction->setShortcut (QKeySequence ("+"));
-    mDelAttAction->setShortcut (QKeySequence ("-"));
-
-    mAddCtrAction->setText (tr ("Add Controller"));
-    mAddIDECtrAction->setText (tr ("Add IDE Controller"));
-    mAddSATACtrAction->setText (tr ("Add SATA Controller"));
-    mAddSCSICtrAction->setText (tr ("Add SCSI Controller"));
-    mAddFloppyCtrAction->setText (tr ("Add Floppy Controller"));
-    mDelCtrAction->setText (tr ("Remove Controller"));
-    mAddAttAction->setText (tr ("Add Attachment"));
-    mAddHDAttAction->setText (tr ("Add Hard Disk"));
-    mAddCDAttAction->setText (tr ("Add CD/DVD Device"));
-    mAddFDAttAction->setText (tr ("Add Floppy Device"));
-    mDelAttAction->setText (tr ("Remove Attachment"));
-
-    mAddCtrAction->setWhatsThis (tr ("Adds a new controller to the end of the Storage Tree."));
-    mDelCtrAction->setWhatsThis (tr ("Removes the controller highlighted in the Storage Tree."));
-    mAddAttAction->setWhatsThis (tr ("Adds a new attachment to the Storage Tree using "
-                                     "currently selected controller as parent."));
-    mDelAttAction->setWhatsThis (tr ("Removes the attachment highlighted in the Storage Tree."));
-
-    mAddCtrAction->setToolTip (QString ("<nobr>%1&nbsp;(%2)")
-                               .arg (mAddCtrAction->text().remove ('&'))
-                               .arg (mAddCtrAction->shortcut().toString()));
-    mDelCtrAction->setToolTip (QString ("<nobr>%1&nbsp;(%2)")
-                               .arg (mDelCtrAction->text().remove ('&'))
-                               .arg (mDelCtrAction->shortcut().toString()));
-    mAddAttAction->setToolTip (QString ("<nobr>%1&nbsp;(%2)")
-                               .arg (mAddAttAction->text().remove ('&'))
-                               .arg (mAddAttAction->shortcut().toString()));
-    mDelAttAction->setToolTip (QString ("<nobr>%1&nbsp;(%2)")
-                               .arg (mDelAttAction->text().remove ('&'))
-                               .arg (mDelAttAction->shortcut().toString()));
-}
-
-void VBoxVMSettingsHD::showEvent (QShowEvent *aEvent)
-{
-    if (!mIsPolished)
-    {
-        mIsPolished = true;
-
-        /* First column indent */
-        mLtEmpty->setColumnMinimumWidth (0, 10);
-        mLtController->setColumnMinimumWidth (0, 10);
-        mLtAttachment->setColumnMinimumWidth (0, 10);
-#if 0
-        /* Second column indent minimum width */
-        QList <QLabel*> labelsList;
-        labelsList << mLbSlot << mLbVdi
-                   << mLbHDVirtualSize << mLbHDActualSize << mLbSize
-                   << mLbLocation << mLbHDFormat << mLbUsage;
-        int maxWidth = 0;
-        QFontMetrics metrics (font());
-        foreach (QLabel *label, labelsList)
-        {
-            int width = metrics.width (label->text());
-            maxWidth = width > maxWidth ? width : maxWidth;
-        }
-        mLtAttachment->setColumnMinimumWidth (1, maxWidth);
-#endif
-    }
-    VBoxSettingsPage::showEvent (aEvent);
-}
-
-void VBoxVMSettingsHD::mediumUpdated (const VBoxMedium &aMedium)
-{
-    QModelIndex rootIndex = mStorageModel->root();
-    for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
-    {
-        QModelIndex ctrIndex = rootIndex.child (i, 0);
-        for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
-        {
-            QModelIndex attIndex = ctrIndex.child (j, 0);
-            QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString();
-            if (attMediumId == aMedium.id())
-            {
-                mStorageModel->setData (attIndex, attMediumId, StorageModel::R_AttMediumId);
-                if (mValidator) mValidator->revalidate();
-            }
-        }
-    }
-}
-
-void VBoxVMSettingsHD::mediumRemoved (VBoxDefs::MediumType /* aType */, const QString &aMediumId)
-{
-    QModelIndex rootIndex = mStorageModel->root();
-    for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
-    {
-        QModelIndex ctrIndex = rootIndex.child (i, 0);
-        for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
-        {
-            QModelIndex attIndex = ctrIndex.child (j, 0);
-            QString attMediumId = mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString();
-            if (attMediumId == aMediumId)
-            {
-                mStorageModel->setData (attIndex, firstAvailableId, StorageModel::R_AttMediumId);
-                if (mValidator) mValidator->revalidate();
-            }
-        }
-    }
-}
-
-void VBoxVMSettingsHD::addController()
-{
-    QMenu menu;
-    menu.addAction (mAddIDECtrAction);
-    menu.addAction (mAddSATACtrAction);
-    menu.addAction (mAddSCSICtrAction);
-    menu.addAction (mAddFloppyCtrAction);
-    menu.exec (QCursor::pos());
-}
-
-void VBoxVMSettingsHD::addIDEController()
-{
-    addControllerWrapper (generateUniqueName (tr ("IDE Controller")), KStorageBus_IDE, KStorageControllerType_PIIX4);
-}
-
-void VBoxVMSettingsHD::addSATAController()
-{
-    addControllerWrapper (generateUniqueName (tr ("SATA Controller")), KStorageBus_SATA, KStorageControllerType_IntelAhci);
-}
-
-void VBoxVMSettingsHD::addSCSIController()
-{
-    addControllerWrapper (generateUniqueName (tr ("SCSI Controller")), KStorageBus_SCSI, KStorageControllerType_LsiLogic);
-}
-
-void VBoxVMSettingsHD::addFloppyController()
-{
-    addControllerWrapper (generateUniqueName (tr ("Floppy Controller")), KStorageBus_Floppy, KStorageControllerType_I82078);
-}
-
-void VBoxVMSettingsHD::delController()
-{
-    QModelIndex index = mTwStorageTree->currentIndex();
-    if (!mStorageModel->data (index, StorageModel::R_IsController).toBool()) return;
-
-    mStorageModel->delController (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()));
-    emit storageChanged();
-    if (mValidator) mValidator->revalidate();
-}
-
-void VBoxVMSettingsHD::addAttachment()
-{
-    QModelIndex index = mTwStorageTree->currentIndex();
-    Assert (mStorageModel->data (index, StorageModel::R_IsController).toBool());
-
-    DeviceTypeList deviceTypeList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
-    bool justTrigger = deviceTypeList.size() == 1;
-    bool showMenu = deviceTypeList.size() > 1;
-    QMenu menu;
-    foreach (const KDeviceType &deviceType, deviceTypeList)
-    {
-        switch (deviceType)
-        {
-            case KDeviceType_HardDisk:
-                if (justTrigger)
-                    mAddHDAttAction->trigger();
-                if (showMenu)
-                    menu.addAction (mAddHDAttAction);
-                break;
-            case KDeviceType_DVD:
-                if (justTrigger)
-                    mAddCDAttAction->trigger();
-                if (showMenu)
-                    menu.addAction (mAddCDAttAction);
-                break;
-            case KDeviceType_Floppy:
-                if (justTrigger)
-                    mAddFDAttAction->trigger();
-                if (showMenu)
-                    menu.addAction (mAddFDAttAction);
-                break;
-            default:
-                break;
-        }
-    }
-    if (showMenu)
-        menu.exec (QCursor::pos());
-}
-
-void VBoxVMSettingsHD::addHDAttachment()
-{
-    addAttachmentWrapper (KDeviceType_HardDisk);
-}
-
-void VBoxVMSettingsHD::addCDAttachment()
-{
-    addAttachmentWrapper (KDeviceType_DVD);
-}
-
-void VBoxVMSettingsHD::addFDAttachment()
-{
-    addAttachmentWrapper (KDeviceType_Floppy);
-}
-
-void VBoxVMSettingsHD::delAttachment()
-{
-    QModelIndex index = mTwStorageTree->currentIndex();
-
-    KDeviceType device = mStorageModel->data (index, StorageModel::R_AttDevice).value <KDeviceType>();
-    /* Check if this would be the last DVD. If so let the user confirm this again. */
-    if (   device == KDeviceType_DVD
-        && deviceCount (KDeviceType_DVD) == 1)
-    {
-        if (vboxProblem().confirmRemovingOfLastDVDDevice() != QIMessageBox::Ok)
-            return;
-    }
-
-    QModelIndex parent = index.parent();
-    if (!index.isValid() || !parent.isValid() ||
-        !mStorageModel->data (index, StorageModel::R_IsAttachment).toBool() ||
-        !mStorageModel->data (parent, StorageModel::R_IsController).toBool())
-        return;
-
-    mStorageModel->delAttachment (QUuid (mStorageModel->data (parent, StorageModel::R_ItemId).toString()),
-                                  QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()));
-    emit storageChanged();
-    if (mValidator) mValidator->revalidate();
-}
-
-void VBoxVMSettingsHD::getInformation()
-{
-    mIsLoadingInProgress = true;
-
-    QModelIndex index = mTwStorageTree->currentIndex();
-    if (!index.isValid() || index == mStorageModel->root())
-    {
-        /* Showing Initial Page */
-        mSwRightPane->setCurrentIndex (0);
-    }
-    else
-    {
-        switch (mStorageModel->data (index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
-        {
-            case AbstractItem::Type_ControllerItem:
-            {
-                /* Getting Controller Name */
-                mLeName->setText (mStorageModel->data (index, StorageModel::R_CtrName).toString());
-
-                /* Getting Controller Sub type */
-                mCbType->clear();
-                ControllerTypeList controllerTypeList (mStorageModel->data (index, StorageModel::R_CtrTypes).value <ControllerTypeList>());
-                for (int i = 0; i < controllerTypeList.size(); ++ i)
-                    mCbType->insertItem (mCbType->count(), vboxGlobal().toString (controllerTypeList [i]));
-                KStorageControllerType type = mStorageModel->data (index, StorageModel::R_CtrType).value <KStorageControllerType>();
-                int ctrPos = mCbType->findText (vboxGlobal().toString (type));
-                mCbType->setCurrentIndex (ctrPos == -1 ? 0 : ctrPos);
-
-                /* Showing Controller Page */
-                mSwRightPane->setCurrentIndex (1);
-                break;
-            }
-            case AbstractItem::Type_AttachmentItem:
-            {
-                /* Getting Attachment Slot */
-                mCbSlot->clear();
-                SlotsList slotsList (mStorageModel->data (index, StorageModel::R_AttSlots).value <SlotsList>());
-                for (int i = 0; i < slotsList.size(); ++ i)
-                    mCbSlot->insertItem (mCbSlot->count(), vboxGlobal().toString (slotsList [i]));
-                StorageSlot slt = mStorageModel->data (index, StorageModel::R_AttSlot).value <StorageSlot>();
-                int attSlotPos = mCbSlot->findText (vboxGlobal().toString (slt));
-                mCbSlot->setCurrentIndex (attSlotPos == -1 ? 0 : attSlotPos);
-                mCbSlot->setToolTip (mCbSlot->itemText (mCbSlot->currentIndex()));
-
-                /* Getting Show Diffs state */
-                bool isShowDiffs = mStorageModel->data (index, StorageModel::R_AttIsShowDiffs).toBool();
-                mCbShowDiffs->setChecked (isShowDiffs);
-
-                /* Getting Attachment Medium */
-                KDeviceType device = mStorageModel->data (index, StorageModel::R_AttDevice).value <KDeviceType>();
-                switch (device)
-                {
-                    case KDeviceType_HardDisk:
-                        mLbVdi->setText (tr ("Hard &Disk:"));
-                        break;
-                    case KDeviceType_DVD:
-                        mLbVdi->setText (tr ("&CD/DVD Device:"));
-                        break;
-                    case KDeviceType_Floppy:
-                        mLbVdi->setText (tr ("&Floppy Device:"));
-                        break;
-                    default:
-                        break;
-                }
-                mCbVdi->setType (typeToLocal (device));
-                mCbVdi->setShowDiffs (isShowDiffs);
-                mCbVdi->setCurrentItem (mStorageModel->data (index, StorageModel::R_AttMediumId).toString());
-                mCbVdi->refresh();
-
-                /* Getting Passthrough state */
-                bool isHostDrive = mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool();
-                /* Passthrough is currently available only for the IDE controller DVD device */
-                bool isIdeCtr = mStorageModel->data (index.parent(), StorageModel::R_CtrBusType).value <KStorageBus>() == KStorageBus_IDE;
-                mCbPassthrough->setEnabled (isHostDrive && isIdeCtr);
-                mCbPassthrough->setChecked (isHostDrive && isIdeCtr && mStorageModel->data (index, StorageModel::R_AttIsPassthrough).toBool());
-
-                /* Update optional widgets visibility */
-                updateAdditionalObjects (device);
-
-                /* Getting Other Information */
-                mLbHDVirtualSizeValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttLogicalSize).toString()));
-                mLbHDActualSizeValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttSize).toString()));
-                mLbSizeValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttSize).toString()));
-                mLbLocationValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttLocation).toString()));
-                mLbHDFormatValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttFormat).toString()));
-                mLbUsageValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttUsage).toString()));
-
-                /* Showing Attachment Page */
-                mSwRightPane->setCurrentIndex (2);
-                break;
-            }
-            default:
-                break;
-        }
-    }
-
-    if (mValidator) mValidator->revalidate();
-
-    mIsLoadingInProgress = false;
-}
-
-void VBoxVMSettingsHD::setInformation()
-{
-    QModelIndex index = mTwStorageTree->currentIndex();
-    if (mIsLoadingInProgress || !index.isValid() || index == mStorageModel->root()) return;
-
-    QObject *sdr = sender();
-    switch (mStorageModel->data (index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
-    {
-        case AbstractItem::Type_ControllerItem:
-        {
-            /* Setting Controller Name */
-            if (sdr == mLeName)
-                mStorageModel->setData (index, mLeName->text(), StorageModel::R_CtrName);
-            /* Setting Controller Sub-Type */
-            else if (sdr == mCbType)
-                mStorageModel->setData (index, QVariant::fromValue (vboxGlobal().toControllerType (mCbType->currentText())),
-                                        StorageModel::R_CtrType);
-            break;
-        }
-        case AbstractItem::Type_AttachmentItem:
-        {
-            /* Setting Attachment Slot */
-            if (sdr == mCbSlot)
-                mStorageModel->setData (index, QVariant::fromValue (vboxGlobal().toStorageSlot (mCbSlot->currentText())),
-                                        StorageModel::R_AttSlot);
-            /* Setting Attachment Medium */
-            else if (sdr == mCbVdi)
-                mStorageModel->setData (index, mCbVdi->id(), StorageModel::R_AttMediumId);
-            else if (sdr == mCbShowDiffs)
-                mStorageModel->setData (index, mCbShowDiffs->isChecked(), StorageModel::R_AttIsShowDiffs);
-            else if (sdr == mCbPassthrough)
-            {
-                if (mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool())
-                    mStorageModel->setData (index, mCbPassthrough->isChecked(), StorageModel::R_AttIsPassthrough);
-            }
-            break;
-        }
-        default:
-            break;
-    }
-
-    emit storageChanged();
-    getInformation();
-}
-
-void VBoxVMSettingsHD::onVmmInvoked()
-{
-    QString id = getWithMediaManager (mCbVdi->type());
-    if (!id.isNull())
-        mCbVdi->setCurrentItem (id);
-}
-
-void VBoxVMSettingsHD::updateActionsState()
-{
-    QModelIndex index = mTwStorageTree->currentIndex();
-
-    bool isIDEPossible = mStorageModel->data (index, StorageModel::R_IsMoreIDEControllersPossible).toBool();
-    bool isSATAPossible = mStorageModel->data (index, StorageModel::R_IsMoreSATAControllersPossible).toBool();
-    bool isSCSIPossible = mStorageModel->data (index, StorageModel::R_IsMoreSCSIControllersPossible).toBool();
-    bool isFloppyPossible = mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool();
-
-    bool isController = mStorageModel->data (index, StorageModel::R_IsController).toBool();
-    bool isAttachment = mStorageModel->data (index, StorageModel::R_IsAttachment).toBool();
-    bool isAttachmentsPossible = mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
-
-    mAddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible);
-    mAddIDECtrAction->setEnabled (isIDEPossible);
-    mAddSATACtrAction->setEnabled (isSATAPossible);
-    mAddSCSICtrAction->setEnabled (isSCSIPossible);
-    mAddFloppyCtrAction->setEnabled (isFloppyPossible);
-
-    mAddAttAction->setEnabled (isController && isAttachmentsPossible);
-    mAddHDAttAction->setEnabled (isController && isAttachmentsPossible);
-    mAddCDAttAction->setEnabled (isController && isAttachmentsPossible);
-    mAddFDAttAction->setEnabled (isController && isAttachmentsPossible);
-
-    mDelCtrAction->setEnabled (isController);
-    mDelAttAction->setEnabled (isAttachment);
-}
-
-void VBoxVMSettingsHD::onRowInserted (const QModelIndex &aParent, int aPosition)
-{
-    QModelIndex index = mStorageModel->index (aPosition, 0, aParent);
-
-    switch (mStorageModel->data (index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
-    {
-        case AbstractItem::Type_ControllerItem:
-        {
-            /* Select the newly created Controller Item */
-            mTwStorageTree->setCurrentIndex (index);
-            break;
-        }
-        case AbstractItem::Type_AttachmentItem:
-        {
-            /* Expand parent if it is not expanded yet */
-            if (!mTwStorageTree->isExpanded (aParent))
-                mTwStorageTree->setExpanded (aParent, true);
-
-            /* Check if no medium was selected for this attachment */
-            if (mStorageModel->data (index, StorageModel::R_AttMediumId).toString().isEmpty())
-            {
-                /* Ask the user for the method to select medium */
-                KDeviceType deviceType = mStorageModel->data (index, StorageModel::R_AttDevice).value <KDeviceType>();
-                int askResult = vboxProblem().confirmRunNewHDWzdOrVDM (deviceType);
-                QString mediumId = askResult == QIMessageBox::Yes ? getWithNewHDWizard() :
-                                   askResult == QIMessageBox::No ? getWithMediaManager (typeToLocal (deviceType)) : QString();
-                if (mediumId.isNull())
-                    mediumId = firstAvailableId;
-                mStorageModel->setData (index, mediumId, StorageModel::R_AttMediumId);
-            }
-            break;
-        }
-        default:
-            break;
-    }
-
-    updateActionsState();
-    getInformation();
-}
-
-void VBoxVMSettingsHD::onRowRemoved()
-{
-    if (mStorageModel->rowCount (mStorageModel->root()) == 0)
-        mTwStorageTree->setCurrentIndex (mStorageModel->root());
-
-    updateActionsState();
-    getInformation();
-}
-
-void VBoxVMSettingsHD::onCurrentItemChanged()
-{
-    updateActionsState();
-    getInformation();
-}
-
-void VBoxVMSettingsHD::onContextMenuRequested (const QPoint &aPosition)
-{
-    QModelIndex index = mTwStorageTree->indexAt (aPosition);
-    if (!index.isValid()) return addController();
-
-    QMenu menu;
-    switch (mStorageModel->data (index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
-    {
-        case AbstractItem::Type_ControllerItem:
-        {
-            DeviceTypeList deviceTypeList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
-            foreach (KDeviceType deviceType, deviceTypeList)
-            {
-                switch (deviceType)
-                {
-                    case KDeviceType_HardDisk:
-                        menu.addAction (mAddHDAttAction);
-                        break;
-                    case KDeviceType_DVD:
-                        menu.addAction (mAddCDAttAction);
-                        break;
-                    case KDeviceType_Floppy:
-                        menu.addAction (mAddFDAttAction);
-                        break;
-                    default:
-                        break;
-                }
-            }
-            menu.addAction (mDelCtrAction);
-            break;
-        }
-        case AbstractItem::Type_AttachmentItem:
-        {
-            menu.addAction (mDelAttAction);
-            break;
-        }
-        default:
-            break;
-    }
-    if (!menu.isEmpty())
-        menu.exec (mTwStorageTree->viewport()->mapToGlobal (aPosition));
-}
-
-void VBoxVMSettingsHD::onDrawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex)
-{
-    if (!aIndex.parent().isValid() || !aIndex.parent().parent().isValid()) return;
-
-    aPainter->save();
-    QStyleOption options;
-    options.initFrom (mTwStorageTree);
-    options.rect = aRect;
-    options.state |= QStyle::State_Item;
-    if (aIndex.row() < mStorageModel->rowCount (aIndex.parent()) - 1)
-        options.state |= QStyle::State_Sibling;
-    /* This pen is commonly used by different
-     * look and feel styles to paint tree-view branches. */
-    QPen pen (QBrush (options.palette.dark().color(), Qt::Dense4Pattern), 0);
-    aPainter->setPen (pen);
-    /* If we want tree-view branches to be always painted we have to use QCommonStyle::drawPrimitive()
-     * because QCommonStyle performs branch painting as opposed to particular inherited sub-classing styles. */
-    qobject_cast <QCommonStyle*> (style())->QCommonStyle::drawPrimitive (QStyle::PE_IndicatorBranch, &options, aPainter);
-    aPainter->restore();
-}
-
-void VBoxVMSettingsHD::onMouseMoved (QMouseEvent *aEvent)
-{
-    QModelIndex index = mTwStorageTree->indexAt (aEvent->pos());
-    QRect indexRect = mTwStorageTree->visualRect (index);
-
-    /* Expander tool-tip */
-    if (mStorageModel->data (index, StorageModel::R_IsController).toBool())
-    {
-        QRect expanderRect = mStorageModel->data (index, StorageModel::R_ItemPixmapRect).toRect();
-        expanderRect.translate (indexRect.x(), indexRect.y());
-        if (expanderRect.contains (aEvent->pos()))
-        {
-            aEvent->setAccepted (true);
-            if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::ExpanderToolTip)
-                mStorageModel->setData (index, QVariant::fromValue (StorageModel::ExpanderToolTip), StorageModel::R_ToolTipType);
-            return;
-        }
-    }
-
-    /* Adder tool-tip */
-    if (mStorageModel->data (index, StorageModel::R_IsController).toBool() &&
-        mTwStorageTree->currentIndex() == index)
-    {
-        DeviceTypeList devicesList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
-        for (int i = 0; i < devicesList.size(); ++ i)
-        {
-            KDeviceType deviceType = devicesList [i];
-
-            QRect deviceRect;
-            switch (deviceType)
-            {
-                case KDeviceType_HardDisk:
-                {
-                    deviceRect = mStorageModel->data (index, StorageModel::R_HDPixmapRect).toRect();
-                    break;
-                }
-                case KDeviceType_DVD:
-                {
-                    deviceRect = mStorageModel->data (index, StorageModel::R_CDPixmapRect).toRect();
-                    break;
-                }
-                case KDeviceType_Floppy:
-                {
-                    deviceRect = mStorageModel->data (index, StorageModel::R_FDPixmapRect).toRect();
-                    break;
-                }
-                default:
-                    break;
-            }
-            deviceRect.translate (indexRect.x() + indexRect.width(), indexRect.y());
-
-            if (deviceRect.contains (aEvent->pos()))
-            {
-                aEvent->setAccepted (true);
-                switch (deviceType)
-                {
-                    case KDeviceType_HardDisk:
-                    {
-                        if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::HDAdderToolTip)
-                            mStorageModel->setData (index, QVariant::fromValue (StorageModel::HDAdderToolTip), StorageModel::R_ToolTipType);
-                        break;
-                    }
-                    case KDeviceType_DVD:
-                    {
-                        if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::CDAdderToolTip)
-                            mStorageModel->setData (index, QVariant::fromValue (StorageModel::CDAdderToolTip), StorageModel::R_ToolTipType);
-                        break;
-                    }
-                    case KDeviceType_Floppy:
-                    {
-                        if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::FDAdderToolTip)
-                            mStorageModel->setData (index, QVariant::fromValue (StorageModel::FDAdderToolTip), StorageModel::R_ToolTipType);
-                        break;
-                    }
-                    default:
-                        break;
-                }
-                return;
-            }
-        }
-    }
-
-    /* Default tool-tip */
-    if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::DefaultToolTip)
-        mStorageModel->setData (index, StorageModel::DefaultToolTip, StorageModel::R_ToolTipType);
-}
-
-void VBoxVMSettingsHD::onMouseClicked (QMouseEvent *aEvent)
-{
-    QModelIndex index = mTwStorageTree->indexAt (aEvent->pos());
-    QRect indexRect = mTwStorageTree->visualRect (index);
-
-    /* Expander icon */
-    if (mStorageModel->data (index, StorageModel::R_IsController).toBool())
-    {
-        QRect expanderRect = mStorageModel->data (index, StorageModel::R_ItemPixmapRect).toRect();
-        expanderRect.translate (indexRect.x(), indexRect.y());
-        if (expanderRect.contains (aEvent->pos()))
-        {
-            aEvent->setAccepted (true);
-            mTwStorageTree->setExpanded (index, !mTwStorageTree->isExpanded (index));
-            return;
-        }
-    }
-
-    /* Adder icons */
-    if (mStorageModel->data (index, StorageModel::R_IsController).toBool() &&
-        mTwStorageTree->currentIndex() == index)
-    {
-        DeviceTypeList devicesList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
-        for (int i = 0; i < devicesList.size(); ++ i)
-        {
-            KDeviceType deviceType = devicesList [i];
-
-            QRect deviceRect;
-            switch (deviceType)
-            {
-                case KDeviceType_HardDisk:
-                {
-                    deviceRect = mStorageModel->data (index, StorageModel::R_HDPixmapRect).toRect();
-                    break;
-                }
-                case KDeviceType_DVD:
-                {
-                    deviceRect = mStorageModel->data (index, StorageModel::R_CDPixmapRect).toRect();
-                    break;
-                }
-                case KDeviceType_Floppy:
-                {
-                    deviceRect = mStorageModel->data (index, StorageModel::R_FDPixmapRect).toRect();
-                    break;
-                }
-                default:
-                    break;
-            }
-            deviceRect.translate (indexRect.x() + indexRect.width(), indexRect.y());
-
-            if (deviceRect.contains (aEvent->pos()))
-            {
-                aEvent->setAccepted (true);
-                if (mAddAttAction->isEnabled())
-                    addAttachmentWrapper (deviceType);
-                return;
-            }
-        }
-    }
-}
-
-void VBoxVMSettingsHD::addControllerWrapper (const QString &aName, KStorageBus aBus, KStorageControllerType aType)
-{
-    QModelIndex index = mTwStorageTree->currentIndex();
-    switch (aBus)
-    {
-        case KStorageBus_IDE:
-            Assert (mStorageModel->data (index, StorageModel::R_IsMoreIDEControllersPossible).toBool());
-            break;
-        case KStorageBus_SATA:
-            Assert (mStorageModel->data (index, StorageModel::R_IsMoreSATAControllersPossible).toBool());
-            break;
-        case KStorageBus_SCSI:
-            Assert (mStorageModel->data (index, StorageModel::R_IsMoreSCSIControllersPossible).toBool());
-            break;
-        case KStorageBus_Floppy:
-            Assert (mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool());
-            break;
-        default:
-            break;
-    }
-
-    mStorageModel->addController (aName, aBus, aType);
-    emit storageChanged();
-}
-
-void VBoxVMSettingsHD::addAttachmentWrapper (KDeviceType aDevice)
-{
-    QModelIndex index = mTwStorageTree->currentIndex();
-    Assert (mStorageModel->data (index, StorageModel::R_IsController).toBool());
-    Assert (mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool());
-
-    mStorageModel->addAttachment (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()), aDevice, true);
-    emit storageChanged();
-    if (mValidator) mValidator->revalidate();
-}
-
-QString VBoxVMSettingsHD::getWithNewHDWizard()
-{
-    /* Run New HD Wizard */
-    VBoxNewHDWzd dlg (this);
-
-    return dlg.exec() == QDialog::Accepted ? dlg.hardDisk().GetId() : QString();
-}
-
-QString VBoxVMSettingsHD::getWithMediaManager (VBoxDefs::MediumType aMediumType)
-{
-    /* Run Media Manager */
-    VBoxMediaManagerDlg dlg (this);
-    dlg.setup (aMediumType,
-               true /* do select? */,
-               false /* do refresh? */,
-               mMachine,
-               mCbVdi->id(),
-               mCbShowDiffs->isChecked());
-
-    return dlg.exec() == QDialog::Accepted ? dlg.selectedId() : QString();
-}
-
-void VBoxVMSettingsHD::updateAdditionalObjects (KDeviceType aType)
-{
-    mCbShowDiffs->setVisible (aType == KDeviceType_HardDisk);
-    mCbPassthrough->setVisible (aType == KDeviceType_DVD);
-
-    mLbHDVirtualSize->setVisible (aType == KDeviceType_HardDisk);
-    mLbHDVirtualSizeValue->setVisible (aType == KDeviceType_HardDisk);
-
-    mLbHDActualSize->setVisible (aType == KDeviceType_HardDisk);
-    mLbHDActualSizeValue->setVisible (aType == KDeviceType_HardDisk);
-
-    mLbSize->setVisible (aType != KDeviceType_HardDisk);
-    mLbSizeValue->setVisible (aType != KDeviceType_HardDisk);
-
-    mLbHDFormat->setVisible (aType == KDeviceType_HardDisk);
-    mLbHDFormatValue->setVisible (aType == KDeviceType_HardDisk);
-}
-
-QString VBoxVMSettingsHD::generateUniqueName (const QString &aTemplate) const
-{
-    int maxNumber = 0;
-    QModelIndex rootIndex = mStorageModel->root();
-    for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
-    {
-        QModelIndex ctrIndex = rootIndex.child (i, 0);
-        QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
-        if (ctrName.startsWith (aTemplate))
-        {
-            QString stringNumber (ctrName.right (ctrName.size() - aTemplate.size()));
-            bool isConverted = false;
-            int number = stringNumber.toInt (&isConverted);
-            if (isConverted && number > maxNumber)
-                maxNumber = number;
-        }
-    }
-    return maxNumber ? QString ("%1 %2").arg (aTemplate).arg (++ maxNumber) : aTemplate;
-}
-
-uint32_t VBoxVMSettingsHD::deviceCount (KDeviceType aType) const
-{
-    uint32_t cDevices = 0;
-    QModelIndex rootIndex = mStorageModel->root();
-    for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
-    {
-        QModelIndex ctrIndex = rootIndex.child (i, 0);
-        for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
-        {
-            QModelIndex attIndex = ctrIndex.child (j, 0);
-            KDeviceType attDevice = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
-            if (attDevice == aType)
-                ++cDevices;
-        }
-    }
-
-    return cDevices;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp	(revision 25170)
+++ 	(revision )
@@ -1,752 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsNetwork class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* VBox Includes */
-#include "QIWidgetValidator.h"
-#include "QIArrowButtonSwitch.h"
-#include "VBoxGlobal.h"
-#include "VBoxVMSettingsNetwork.h"
-
-/* Qt Includes */
-#include <QTimer>
-#include <QCompleter>
-
-/* Empty item extra-code */
-const char *emptyItemCode = "#empty#";
-
-/* VBoxVMSettingsNetwork Stuff */
-VBoxVMSettingsNetwork::VBoxVMSettingsNetwork (VBoxVMSettingsNetworkPage *aParent, bool aDisableStaticControls)
-    : QIWithRetranslateUI <QWidget> (0)
-    , mParent (aParent)
-    , mValidator (0)
-    , mPolished (false)
-    , mDisableStaticControls (false)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsNetwork::setupUi (this);
-
-    /* Setup widgets */
-    mCbAdapterName->setInsertPolicy (QComboBox::NoInsert);
-    mLeMAC->setValidator (new QRegExpValidator (QRegExp (
-                          "[0-9A-Fa-f][02468ACEace][0-9A-Fa-f]{10}"), this));
-    mLeMAC->setMinimumWidthByText (QString().fill ('0', 12));
-
-    /* Setup connections */
-    connect (mAbsAdvanced, SIGNAL (clicked()), this, SLOT (toggleAdvanced()));
-    connect (mTbMAC, SIGNAL (clicked()), this, SLOT (generateMac()));
-
-#ifdef Q_WS_MAC
-    /* Prevent this widgets to go in the Small/Mini size state which is
-     * available on Mac OS X. Not sure why this happens but this seems to help
-     * against. */
-    QList <QWidget*> list = findChildren <QWidget*>();
-    foreach (QWidget *w, list)
-        if (w->parent() == this)
-            w->setFixedHeight (w->sizeHint().height());
-#endif /* Q_WS_MAC */
-
-    /* Applying language settings */
-    retranslateUi();
-
-    /* If some controls should be disabled or not when the
-     * same tab widgets are shown during runtime
-     */
-    mDisableStaticControls = aDisableStaticControls;
-}
-
-void VBoxVMSettingsNetwork::getFromAdapter (const CNetworkAdapter &aAdapter)
-{
-    mAdapter = aAdapter;
-
-    /* Load adapter activity state */
-    mCbEnableAdapter->setChecked (aAdapter.GetEnabled());
-
-    /* Load adapter type */
-    int adapterPos = mCbAdapterType->findData (aAdapter.GetAdapterType());
-    mCbAdapterType->setCurrentIndex (adapterPos == -1 ? 0 : adapterPos);
-
-    /* Load attachment type */
-    int attachmentPos = mCbAttachmentType->findData (aAdapter.GetAttachmentType());
-    mCbAttachmentType->setCurrentIndex (attachmentPos == -1 ? 0 : attachmentPos);
-
-    /* Load alternative name */
-    switch (attachmentType())
-    {
-        case KNetworkAttachmentType_Bridged:
-            mBrgName = mAdapter.GetHostInterface();
-            if (mBrgName.isEmpty()) mBrgName = QString::null;
-            break;
-        case KNetworkAttachmentType_Internal:
-            mIntName = mAdapter.GetInternalNetwork();
-            if (mIntName.isEmpty()) mIntName = QString::null;
-            break;
-        case KNetworkAttachmentType_HostOnly:
-            mHoiName = mAdapter.GetHostInterface();
-            if (mHoiName.isEmpty()) mHoiName = QString::null;
-            break;
-        default:
-            break;
-    }
-    updateAttachmentAlternative();
-
-    mLeMAC->setText (mAdapter.GetMACAddress());
-    mCbCableConnected->setChecked (mAdapter.GetCableConnected());
-}
-
-void VBoxVMSettingsNetwork::putBackToAdapter()
-{
-    /* Save adapter activity state */
-    mAdapter.SetEnabled (mCbEnableAdapter->isChecked());
-
-    /* Save adapter type */
-    KNetworkAdapterType type = (KNetworkAdapterType)
-        mCbAdapterType->itemData (mCbAdapterType->currentIndex()).toInt();
-    mAdapter.SetAdapterType (type);
-
-    /* Save attachment type & alternative name */
-    switch (attachmentType())
-    {
-        case KNetworkAttachmentType_Null:
-            mAdapter.Detach();
-            break;
-        case KNetworkAttachmentType_NAT:
-            mAdapter.AttachToNAT();
-            break;
-        case KNetworkAttachmentType_Bridged:
-            mAdapter.SetHostInterface (alternativeName());
-            mAdapter.AttachToBridgedInterface();
-            break;
-        case KNetworkAttachmentType_Internal:
-            mAdapter.SetInternalNetwork (alternativeName());
-            mAdapter.AttachToInternalNetwork();
-            break;
-        case KNetworkAttachmentType_HostOnly:
-            mAdapter.SetHostInterface (alternativeName());
-            mAdapter.AttachToHostOnlyInterface();
-            break;
-        default:
-            break;
-    }
-
-    mAdapter.SetMACAddress (mLeMAC->text().isEmpty() ? QString::null : mLeMAC->text());
-    mAdapter.SetCableConnected (mCbCableConnected->isChecked());
-}
-
-void VBoxVMSettingsNetwork::setValidator (QIWidgetValidator *aValidator)
-{
-    mValidator = aValidator;
-
-    if (!mDisableStaticControls)
-        connect (mCbEnableAdapter, SIGNAL (toggled (bool)),
-                 mValidator, SLOT (revalidate()));
-    connect (mCbAttachmentType, SIGNAL (activated (const QString&)),
-             this, SLOT (updateAttachmentAlternative()));
-    connect (mCbAdapterName, SIGNAL (activated (const QString&)),
-             this, SLOT (updateAlternativeName()));
-    connect (mCbAdapterName, SIGNAL (editTextChanged (const QString&)),
-             this, SLOT (updateAlternativeName()));
-
-    if (!mDisableStaticControls)
-        mValidator->revalidate();
-}
-
-bool VBoxVMSettingsNetwork::revalidate (QString &aWarning, QString &aTitle)
-{
-    /* 'True' for disabled adapter */
-    if (!mCbEnableAdapter->isChecked())
-        return true;
-
-    /* Validate alternatives */
-    bool valid = true;
-    switch (attachmentType())
-    {
-        case KNetworkAttachmentType_Bridged:
-            if (alternativeName().isNull())
-            {
-                aWarning = tr ("no bridged network adapter is selected");
-                valid = false;
-            }
-            break;
-        case KNetworkAttachmentType_Internal:
-            if (alternativeName().isNull())
-            {
-                aWarning = tr ("no internal network name is specified");
-                valid = false;
-            }
-            break;
-        case KNetworkAttachmentType_HostOnly:
-            if (alternativeName().isNull())
-            {
-                aWarning = tr ("no host-only network adapter is selected");
-                valid = false;
-            }
-            break;
-        default:
-            break;
-    }
-
-    if (!valid)
-        aTitle += ": " + vboxGlobal().removeAccelMark (pageTitle());
-
-    return valid;
-}
-
-QWidget* VBoxVMSettingsNetwork::setOrderAfter (QWidget *aAfter)
-{
-    setTabOrder (aAfter, mCbEnableAdapter);
-    setTabOrder (mCbEnableAdapter, mCbAttachmentType);
-    setTabOrder (mCbAttachmentType, mCbAdapterName);
-    setTabOrder (mCbAdapterName, mAbsAdvanced);
-    setTabOrder (mAbsAdvanced, mCbAdapterType);
-    setTabOrder (mCbAdapterType, mLeMAC);
-    setTabOrder (mLeMAC, mTbMAC);
-    setTabOrder (mTbMAC, mCbCableConnected);
-    return mCbCableConnected;
-}
-
-QString VBoxVMSettingsNetwork::pageTitle() const
-{
-    QString title;
-    if (!mAdapter.isNull())
-    {
-        title = VBoxGlobal::tr ("Adapter %1", "network")
-            .arg (QString ("&%1").arg (mAdapter.GetSlot() + 1));
-    }
-    return title;
-}
-
-KNetworkAttachmentType VBoxVMSettingsNetwork::attachmentType() const
-{
-    return (KNetworkAttachmentType) mCbAttachmentType->itemData (
-           mCbAttachmentType->currentIndex()).toInt();
-}
-
-QString VBoxVMSettingsNetwork::alternativeName (int aType) const
-{
-    if (aType == -1) aType = attachmentType();
-    QString result;
-    switch (aType)
-    {
-        case KNetworkAttachmentType_Bridged:
-            result = mBrgName;
-            break;
-        case KNetworkAttachmentType_Internal:
-            result = mIntName;
-            break;
-        case KNetworkAttachmentType_HostOnly:
-            result = mHoiName;
-            break;
-        default:
-            break;
-    }
-    Assert (result.isNull() || !result.isEmpty());
-    return result;
-}
-
-void VBoxVMSettingsNetwork::showEvent (QShowEvent *aEvent)
-{
-    if (!mPolished)
-    {
-        mPolished = true;
-
-        /* Give the minimum size hint to the first layout column */
-        mNetworkChildGridLayout->setColumnMinimumWidth (0, mLbAttachmentType->width());
-
-        if (mDisableStaticControls)
-        {
-            /* Disable controls for dynamically displayed page */
-            mCbEnableAdapter->setEnabled (false);
-            mCbAdapterType->setEnabled (false);
-            mLeMAC->setEnabled (false);
-            mTbMAC->setEnabled (false);
-            mLbAdapterType->setEnabled (false);
-            mLbMAC->setEnabled (false);
-            mAbsAdvanced->animateClick();
-        }
-        else
-        {
-            /* Hide advanced items initially */
-            toggleAdvanced();
-        }
-    }
-    QWidget::showEvent (aEvent);
-}
-
-void VBoxVMSettingsNetwork::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsNetwork::retranslateUi (this);
-
-    /* Translate combo-boxes content */
-    populateComboboxes();
-
-    /* Translate attachment info */
-    updateAttachmentAlternative();
-}
-
-void VBoxVMSettingsNetwork::updateAttachmentAlternative()
-{
-    /* Blocking signals to change content manually */
-    mCbAdapterName->blockSignals (true);
-
-    /* Update alternative-name combo-box availability */
-    mLbAdapterName->setEnabled (attachmentType() != KNetworkAttachmentType_Null &&
-                                attachmentType() != KNetworkAttachmentType_NAT);
-    mCbAdapterName->setEnabled (attachmentType() != KNetworkAttachmentType_Null &&
-                                attachmentType() != KNetworkAttachmentType_NAT);
-
-    /* Refresh list */
-    mCbAdapterName->clear();
-    switch (attachmentType())
-    {
-        case KNetworkAttachmentType_Bridged:
-            mCbAdapterName->insertItems (0, mParent->brgList());
-            mCbAdapterName->setEditable (false);
-            break;
-        case KNetworkAttachmentType_Internal:
-            mCbAdapterName->insertItems (0, mParent->intList());
-            mCbAdapterName->setEditable (true);
-            mCbAdapterName->setCompleter (0);
-            break;
-        case KNetworkAttachmentType_HostOnly:
-            mCbAdapterName->insertItems (0, mParent->hoiList());
-            mCbAdapterName->setEditable (false);
-            break;
-        default:
-            break;
-    }
-
-    /* Prepend 'empty' or 'default' item */
-    if (mCbAdapterName->count() == 0)
-    {
-        switch (attachmentType())
-        {
-            case KNetworkAttachmentType_Bridged:
-            case KNetworkAttachmentType_HostOnly:
-            {
-                /* Adapters list 'empty' */
-                int pos = mCbAdapterName->findData (emptyItemCode);
-                if (pos == -1)
-                    mCbAdapterName->insertItem (0, tr ("Not selected", "network adapter name"), emptyItemCode);
-                else
-                    mCbAdapterName->setItemText (pos, tr ("Not selected", "network adapter name"));
-                break;
-            }
-            case KNetworkAttachmentType_Internal:
-            {
-                /* Internal network 'default' name */
-                if (mCbAdapterName->findText ("intnet") == -1)
-                    mCbAdapterName->insertItem (0, "intnet");
-                break;
-            }
-            default:
-                break;
-        }
-    }
-
-    /* Select previous or default item */
-    switch (attachmentType())
-    {
-        case KNetworkAttachmentType_Bridged:
-        case KNetworkAttachmentType_HostOnly:
-        {
-            int pos = mCbAdapterName->findText (alternativeName());
-            mCbAdapterName->setCurrentIndex (pos == -1 ? 0 : pos);
-            break;
-        }
-        case KNetworkAttachmentType_Internal:
-        {
-            int pos = mCbAdapterName->findText (alternativeName());
-            mCbAdapterName->setCurrentIndex (pos == -1 ? 0 : pos);
-            break;
-        }
-        default:
-            break;
-    }
-
-    /* Remember selected item */
-    updateAlternativeName();
-
-    /* Unblocking signals as content is changed already */
-    mCbAdapterName->blockSignals (false);
-}
-
-void VBoxVMSettingsNetwork::updateAlternativeName()
-{
-    switch (attachmentType())
-    {
-        case KNetworkAttachmentType_Bridged:
-        {
-            QString newName (mCbAdapterName->itemData (mCbAdapterName->currentIndex()).toString() ==
-                             QString (emptyItemCode) ||
-                             mCbAdapterName->currentText().isEmpty() ?
-                             QString::null : mCbAdapterName->currentText());
-            if (mBrgName != newName)
-                mBrgName = newName;
-            break;
-        }
-        case KNetworkAttachmentType_Internal:
-        {
-            QString newName ((mCbAdapterName->itemData (mCbAdapterName->currentIndex()).toString() ==
-                              QString (emptyItemCode) &&
-                              mCbAdapterName->currentText() ==
-                              mCbAdapterName->itemText (mCbAdapterName->currentIndex())) ||
-                              mCbAdapterName->currentText().isEmpty() ?
-                              QString::null : mCbAdapterName->currentText());
-            if (mIntName != newName)
-            {
-                mIntName = newName;
-                if (!mIntName.isNull())
-                    QTimer::singleShot (0, mParent, SLOT (updatePages()));
-            }
-            break;
-        }
-        case KNetworkAttachmentType_HostOnly:
-        {
-            QString newName (mCbAdapterName->itemData (mCbAdapterName->currentIndex()).toString() ==
-                             QString (emptyItemCode) ||
-                             mCbAdapterName->currentText().isEmpty() ?
-                             QString::null : mCbAdapterName->currentText());
-            if (mHoiName != newName)
-                mHoiName = newName;
-            break;
-        }
-        default:
-            break;
-    }
-
-    if (mValidator)
-        mValidator->revalidate();
-}
-
-void VBoxVMSettingsNetwork::toggleAdvanced()
-{
-    mLbAdapterType->setVisible (mAbsAdvanced->isExpanded());
-    mCbAdapterType->setVisible (mAbsAdvanced->isExpanded());
-    mLbMAC->setVisible (mAbsAdvanced->isExpanded());
-    mLeMAC->setVisible (mAbsAdvanced->isExpanded());
-    mTbMAC->setVisible (mAbsAdvanced->isExpanded());
-    mCbCableConnected->setVisible (mAbsAdvanced->isExpanded());
-}
-
-void VBoxVMSettingsNetwork::generateMac()
-{
-    mAdapter.SetMACAddress (QString::null);
-    mLeMAC->setText (mAdapter.GetMACAddress());
-}
-
-void VBoxVMSettingsNetwork::populateComboboxes()
-{
-    /* Save the current selected adapter */
-    int currentAdapter = mCbAdapterType->currentIndex();
-
-    /* Clear the adapters combo-box */
-    mCbAdapterType->clear();
-
-    /* Populate adapters */
-    mCbAdapterType->insertItem (0,
-        vboxGlobal().toString (KNetworkAdapterType_Am79C970A));
-    mCbAdapterType->setItemData (0,
-        KNetworkAdapterType_Am79C970A);
-    mCbAdapterType->setItemData (0,
-        mCbAdapterType->itemText (0), Qt::ToolTipRole);
-    mCbAdapterType->insertItem (1,
-        vboxGlobal().toString (KNetworkAdapterType_Am79C973));
-    mCbAdapterType->setItemData (1,
-        KNetworkAdapterType_Am79C973);
-    mCbAdapterType->setItemData (1,
-        mCbAdapterType->itemText (1), Qt::ToolTipRole);
-#ifdef VBOX_WITH_E1000
-    mCbAdapterType->insertItem (2,
-        vboxGlobal().toString (KNetworkAdapterType_I82540EM));
-    mCbAdapterType->setItemData (2,
-        KNetworkAdapterType_I82540EM);
-    mCbAdapterType->setItemData (2,
-        mCbAdapterType->itemText (2), Qt::ToolTipRole);
-    mCbAdapterType->insertItem (3,
-        vboxGlobal().toString (KNetworkAdapterType_I82543GC));
-    mCbAdapterType->setItemData (3,
-        KNetworkAdapterType_I82543GC);
-    mCbAdapterType->setItemData (3,
-        mCbAdapterType->itemText (3), Qt::ToolTipRole);
-    mCbAdapterType->insertItem (4,
-        vboxGlobal().toString (KNetworkAdapterType_I82545EM));
-    mCbAdapterType->setItemData (4,
-        KNetworkAdapterType_I82545EM);
-    mCbAdapterType->setItemData (4,
-        mCbAdapterType->itemText (4), Qt::ToolTipRole);
-#endif /* VBOX_WITH_E1000 */
-#ifdef VBOX_WITH_VIRTIO
-    mCbAdapterType->insertItem (5,
-        vboxGlobal().toString (KNetworkAdapterType_Virtio));
-    mCbAdapterType->setItemData (5,
-        KNetworkAdapterType_Virtio);
-    mCbAdapterType->setItemData (5,
-        mCbAdapterType->itemText (5), Qt::ToolTipRole);
-#endif /* VBOX_WITH_VIRTIO */
-
-    /* Set the old value */
-    mCbAdapterType->setCurrentIndex (currentAdapter == -1 ?
-                                     0 : currentAdapter);
-
-
-    /* Save the current selected attachment type */
-    int currentAttachment = mCbAttachmentType->currentIndex();
-
-    /* Clear the attachments combo-box */
-    mCbAttachmentType->clear();
-
-    /* Populate attachments */
-    mCbAttachmentType->insertItem (0,
-        vboxGlobal().toString (KNetworkAttachmentType_Null));
-    mCbAttachmentType->setItemData (0,
-        KNetworkAttachmentType_Null);
-    mCbAttachmentType->setItemData (0,
-        mCbAttachmentType->itemText (0), Qt::ToolTipRole);
-    mCbAttachmentType->insertItem (1,
-        vboxGlobal().toString (KNetworkAttachmentType_NAT));
-    mCbAttachmentType->setItemData (1,
-        KNetworkAttachmentType_NAT);
-    mCbAttachmentType->setItemData (1,
-        mCbAttachmentType->itemText (1), Qt::ToolTipRole);
-    mCbAttachmentType->insertItem (2,
-        vboxGlobal().toString (KNetworkAttachmentType_Bridged));
-    mCbAttachmentType->setItemData (2,
-        KNetworkAttachmentType_Bridged);
-    mCbAttachmentType->setItemData (2,
-        mCbAttachmentType->itemText (2), Qt::ToolTipRole);
-    mCbAttachmentType->insertItem (3,
-        vboxGlobal().toString (KNetworkAttachmentType_Internal));
-    mCbAttachmentType->setItemData (3,
-        KNetworkAttachmentType_Internal);
-    mCbAttachmentType->setItemData (3,
-        mCbAttachmentType->itemText (3), Qt::ToolTipRole);
-    mCbAttachmentType->insertItem (4,
-        vboxGlobal().toString (KNetworkAttachmentType_HostOnly));
-    mCbAttachmentType->setItemData (4,
-        KNetworkAttachmentType_HostOnly);
-    mCbAttachmentType->setItemData (4,
-        mCbAttachmentType->itemText (4), Qt::ToolTipRole);
-
-    /* Set the old value */
-    mCbAttachmentType->setCurrentIndex (currentAttachment);
-}
-
-/* VBoxVMSettingsNetworkPage Stuff */
-VBoxVMSettingsNetworkPage::VBoxVMSettingsNetworkPage(bool aDisableStaticControls)
-    : mValidator (0)
-    , mDisableStaticControls (false)
-{
-    /* Setup Main Layout */
-    QVBoxLayout *mainLayout = new QVBoxLayout (this);
-    mainLayout->setContentsMargins (0, 5, 0, 5);
-
-    /* Creating Tab Widget */
-    mTwAdapters = new QTabWidget (this);
-    mainLayout->addWidget (mTwAdapters);
-
-    /* If some controls should be disabled or not when the
-     * same tab widgets are shown during runtime
-     */
-    mDisableStaticControls = aDisableStaticControls;
-}
-
-QStringList VBoxVMSettingsNetworkPage::brgList (bool aRefresh)
-{
-    if (aRefresh)
-    {
-        /* Load & filter interface list */
-        mBrgList.clear();
-        CHostNetworkInterfaceVector interfaces =
-            vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces();
-        for (CHostNetworkInterfaceVector::ConstIterator it = interfaces.begin();
-             it != interfaces.end(); ++ it)
-        {
-            if (it->GetInterfaceType() == KHostNetworkInterfaceType_Bridged)
-                mBrgList << it->GetName();
-        }
-    }
-
-    return mBrgList;
-}
-
-QStringList VBoxVMSettingsNetworkPage::intList (bool aRefresh)
-{
-    if (aRefresh)
-    {
-        /* Load total network list of all VMs */
-        mIntList.clear();
-        CVirtualBox vbox = vboxGlobal().virtualBox();
-        ulong count = qMin ((ULONG) 4, vbox.GetSystemProperties().GetNetworkAdapterCount());
-        CMachineVector vec = vbox.GetMachines();
-        for (CMachineVector::ConstIterator m = vec.begin(); m != vec.end(); ++ m)
-        {
-            if (m->GetAccessible())
-            {
-                for (ulong slot = 0; slot < count; ++ slot)
-                {
-                    QString name = m->GetNetworkAdapter (slot).GetInternalNetwork();
-                    if (!name.isEmpty() && !mIntList.contains (name))
-                        mIntList << name;
-                }
-            }
-        }
-    }
-
-    /* Append network list with names from all the pages */
-    QStringList list (mIntList);
-    for (int index = 0; index < mTwAdapters->count(); ++ index)
-    {
-        VBoxVMSettingsNetwork *page =
-            qobject_cast <VBoxVMSettingsNetwork*> (mTwAdapters->widget (index));
-        if (page)
-        {
-            QString name = page->alternativeName (KNetworkAttachmentType_Internal);
-            if (!name.isEmpty() && !list.contains (name))
-                list << name;
-        }
-    }
-
-    return list;
-}
-
-QStringList VBoxVMSettingsNetworkPage::hoiList (bool aRefresh)
-{
-    if (aRefresh)
-    {
-        /* Load & filter interface list */
-        mHoiList.clear();
-        CHostNetworkInterfaceVector interfaces =
-            vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces();
-        for (CHostNetworkInterfaceVector::ConstIterator it = interfaces.begin();
-             it != interfaces.end(); ++ it)
-        {
-            if (it->GetInterfaceType() == KHostNetworkInterfaceType_HostOnly)
-                mHoiList << it->GetName();
-        }
-    }
-
-    return mHoiList;
-}
-
-void VBoxVMSettingsNetworkPage::getFrom (const CMachine &aMachine)
-{
-    /* Setup tab order */
-    Assert (mFirstWidget);
-    setTabOrder (mFirstWidget, mTwAdapters->focusProxy());
-    QWidget *lastFocusWidget = mTwAdapters->focusProxy();
-
-    /* Cache data */
-    brgList (true);
-    intList (true);
-    hoiList (true);
-
-    /* Creating Tab Pages */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    ulong count = qMin ((ULONG) 4, vbox.GetSystemProperties().GetNetworkAdapterCount());
-    for (ulong slot = 0; slot < count; ++ slot)
-    {
-        /* Get Adapter */
-        CNetworkAdapter adapter = aMachine.GetNetworkAdapter (slot);
-
-        /* Creating Adapter's page */
-        VBoxVMSettingsNetwork *page = new VBoxVMSettingsNetwork (this, mDisableStaticControls);
-
-        /* Loading Adapter's data into page */
-        page->getFromAdapter (adapter);
-
-        /* Attach Adapter's page to Tab Widget */
-        mTwAdapters->addTab (page, page->pageTitle());
-
-        /* Disable tab page if adapter is being configured dynamically */
-        if (mDisableStaticControls && !adapter.GetEnabled())
-            mTwAdapters->setTabEnabled(slot, false);
-
-        /* Setup validation */
-        page->setValidator (mValidator);
-
-        /* Setup tab order */
-        lastFocusWidget = page->setOrderAfter (lastFocusWidget);
-    }
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxVMSettingsNetworkPage::putBackTo()
-{
-    for (int i = 0; i < mTwAdapters->count(); ++ i)
-    {
-        VBoxVMSettingsNetwork *page =
-            qobject_cast <VBoxVMSettingsNetwork*> (mTwAdapters->widget (i));
-        Assert (page);
-        page->putBackToAdapter();
-    }
-}
-
-void VBoxVMSettingsNetworkPage::setValidator (QIWidgetValidator *aVal)
-{
-    mValidator = aVal;
-}
-
-bool VBoxVMSettingsNetworkPage::revalidate (QString &aWarning, QString &aTitle)
-{
-    bool valid = true;
-
-    for (int i = 0; i < mTwAdapters->count(); ++ i)
-    {
-        VBoxVMSettingsNetwork *page =
-            qobject_cast <VBoxVMSettingsNetwork*> (mTwAdapters->widget (i));
-        Assert (page);
-        valid = page->revalidate (aWarning, aTitle);
-        if (!valid) break;
-    }
-
-    return valid;
-}
-
-void VBoxVMSettingsNetworkPage::retranslateUi()
-{
-    for (int i = 0; i < mTwAdapters->count(); ++ i)
-    {
-        VBoxVMSettingsNetwork *page =
-            qobject_cast <VBoxVMSettingsNetwork*> (mTwAdapters->widget (i));
-        Assert (page);
-        mTwAdapters->setTabText (i, page->pageTitle());
-    }
-}
-
-void VBoxVMSettingsNetworkPage::updatePages()
-{
-    for (int i = 0; i < mTwAdapters->count(); ++ i)
-    {
-        /* Get the iterated page */
-        VBoxVMSettingsNetwork *page =
-            qobject_cast <VBoxVMSettingsNetwork*> (mTwAdapters->widget (i));
-        Assert (page);
-
-        /* Update the page if the attachment type is 'internal network' */
-        if (page->attachmentType() == KNetworkAttachmentType_Internal)
-            QTimer::singleShot (0, page, SLOT (updateAttachmentAlternative()));
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsParallel.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsParallel.cpp	(revision 25170)
+++ 	(revision )
@@ -1,261 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsParallel class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxVMSettingsParallel.h"
-#include "QIWidgetValidator.h"
-#include "VBoxGlobal.h"
-
-#include <QDir>
-
-/* VBoxVMSettingsParallel stuff */
-VBoxVMSettingsParallel::VBoxVMSettingsParallel()
-    : QIWithRetranslateUI<QWidget> (0)
-    , mValidator (0)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsParallel::setupUi (this);
-
-    /* Setup validation */
-    mLeIRQ->setValidator (new QIULongValidator (0, 255, this));
-    mLeIOPort->setValidator (new QIULongValidator (0, 0xFFFF, this));
-    mLePath->setValidator (new QRegExpValidator (QRegExp (".+"), this));
-
-    /* Setup constraints */
-    mLeIRQ->setFixedWidth (mLeIRQ->fontMetrics().width ("8888"));
-    mLeIOPort->setFixedWidth (mLeIOPort->fontMetrics().width ("8888888"));
-
-    /* Set initial values */
-    /* Note: If you change one of the following don't forget retranslateUi. */
-    mCbNumber->insertItem (0, vboxGlobal().toCOMPortName (0, 0));
-    mCbNumber->insertItems (0, vboxGlobal().COMPortNames());
-
-    /* Setup connections */
-    connect (mGbParallel, SIGNAL (toggled (bool)),
-             this, SLOT (mGbParallelToggled (bool)));
-    connect (mCbNumber, SIGNAL (activated (const QString &)),
-             this, SLOT (mCbNumberActivated (const QString &)));
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxVMSettingsParallel::getFromPort (const CParallelPort &aPort)
-{
-    mPort = aPort;
-
-    mGbParallel->setChecked (mPort.GetEnabled());
-    ulong IRQ = mPort.GetIRQ();
-    ulong IOBase = mPort.GetIOBase();
-    mCbNumber->setCurrentIndex (mCbNumber->
-        findText (vboxGlobal().toCOMPortName (IRQ, IOBase)));
-    mLeIRQ->setText (QString::number (IRQ));
-    mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
-    mLePath->setText (mPort.GetPath());
-
-    /* Ensure everything is up-to-date */
-    mGbParallelToggled (mGbParallel->isChecked());
-}
-
-void VBoxVMSettingsParallel::putBackToPort()
-{
-    mPort.SetEnabled (mGbParallel->isChecked());
-    mPort.SetIRQ (mLeIRQ->text().toULong (NULL, 0));
-    mPort.SetIOBase (mLeIOPort->text().toULong (NULL, 0));
-    mPort.SetPath (QDir::toNativeSeparators (mLePath->text()));
-}
-
-void VBoxVMSettingsParallel::setValidator (QIWidgetValidator *aVal)
-{
-    Assert (aVal);
-    mValidator = aVal;
-    connect (mLeIRQ, SIGNAL (textChanged (const QString &)),
-             mValidator, SLOT (revalidate()));
-    connect (mLeIOPort, SIGNAL (textChanged (const QString &)),
-             mValidator, SLOT (revalidate()));
-    connect (mLePath, SIGNAL (textChanged (const QString &)),
-             mValidator, SLOT (revalidate()));
-    mValidator->revalidate();
-}
-
-QWidget* VBoxVMSettingsParallel::setOrderAfter (QWidget *aAfter)
-{
-    setTabOrder (aAfter, mGbParallel);
-    setTabOrder (mGbParallel, mCbNumber);
-    setTabOrder (mCbNumber, mLeIRQ);
-    setTabOrder (mLeIRQ, mLeIOPort);
-    setTabOrder (mLeIOPort, mLePath);
-    return mLePath;
-}
-
-QString VBoxVMSettingsParallel::pageTitle() const
-{
-    QString pageTitle;
-    if (!mPort.isNull())
-        pageTitle = QString (tr ("Port %1", "parallel ports"))
-            .arg (QString ("&%1").arg (mPort.GetSlot() + 1));
-    return pageTitle;
-}
-
-bool VBoxVMSettingsParallel::isUserDefined()
-{
-    ulong a, b;
-    return !vboxGlobal().toCOMPortNumbers (mCbNumber->currentText(), a, b);
-}
-
-void VBoxVMSettingsParallel::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsParallel::retranslateUi (this);
-
-    mCbNumber->setItemText (mCbNumber->count() - 1, vboxGlobal().toCOMPortName (0, 0));
-}
-
-void VBoxVMSettingsParallel::mGbParallelToggled (bool aOn)
-{
-    if (aOn)
-        mCbNumberActivated (mCbNumber->currentText());
-    if (mValidator)
-        mValidator->revalidate();
-}
-
-void VBoxVMSettingsParallel::mCbNumberActivated (const QString &aText)
-{
-    ulong IRQ, IOBase;
-    bool std = vboxGlobal().toCOMPortNumbers (aText, IRQ, IOBase);
-
-    mLeIRQ->setEnabled (!std);
-    mLeIOPort->setEnabled (!std);
-    if (std)
-    {
-        mLeIRQ->setText (QString::number (IRQ));
-        mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
-    }
-}
-
-
-/* VBoxVMSettingsParallelPage stuff */
-VBoxVMSettingsParallelPage::VBoxVMSettingsParallelPage()
-    : mValidator (0)
-{
-    /* TabWidget creation */
-    mTabWidget = new QTabWidget (this);
-    QVBoxLayout *layout = new QVBoxLayout (this);
-    layout->setContentsMargins (0, 5, 0, 5);
-    layout->addWidget (mTabWidget);
-}
-
-void VBoxVMSettingsParallelPage::getFrom (const CMachine &aMachine)
-{
-    Assert (mFirstWidget);
-    setTabOrder (mFirstWidget, mTabWidget->focusProxy());
-    QWidget *lastFocusWidget = mTabWidget->focusProxy();
-
-    /* Tab pages loading */
-    ulong count = vboxGlobal().virtualBox().
-                  GetSystemProperties().GetParallelPortCount();
-    for (ulong slot = 0; slot < count; ++ slot)
-    {
-        CParallelPort port = aMachine.GetParallelPort (slot);
-        VBoxVMSettingsParallel *page = new VBoxVMSettingsParallel();
-        page->getFromPort (port);
-        mTabWidget->addTab (page, page->pageTitle());
-        Assert (mValidator);
-        page->setValidator (mValidator);
-        lastFocusWidget = page->setOrderAfter (lastFocusWidget);
-    }
-}
-
-void VBoxVMSettingsParallelPage::putBackTo()
-{
-    for (int index = 0; index < mTabWidget->count(); ++ index)
-    {
-        VBoxVMSettingsParallel *page =
-            (VBoxVMSettingsParallel*) mTabWidget->widget (index);
-        Assert (page);
-        page->putBackToPort();
-    }
-}
-
-void VBoxVMSettingsParallelPage::setValidator (QIWidgetValidator *aVal)
-{
-    mValidator = aVal;
-}
-
-bool VBoxVMSettingsParallelPage::revalidate (QString &aWarning, QString &aTitle)
-{
-    bool valid = true;
-    QStringList ports;
-    QStringList paths;
-
-    int index = 0;
-    for (; index < mTabWidget->count(); ++ index)
-    {
-        QWidget *tab = mTabWidget->widget (index);
-        VBoxVMSettingsParallel *page =
-            static_cast<VBoxVMSettingsParallel*> (tab);
-
-        /* Check the predefined port number unicity */
-        if (page->mGbParallel->isChecked() && !page->isUserDefined())
-        {
-            QString port = page->mCbNumber->currentText();
-            valid = !ports.contains (port);
-            if (!valid)
-            {
-                aWarning = tr ("Duplicate port number selected ");
-                aTitle += ": " +
-                    vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
-                break;
-            }
-            ports << port;
-        }
-
-        /* Check the port path emptiness & unicity */
-        if (page->mGbParallel->isChecked())
-        {
-            QString path = page->mLePath->text();
-            valid = !path.isEmpty() && !paths.contains (path);
-            if (!valid)
-            {
-                aWarning = path.isEmpty() ?
-                    tr ("Port path not specified ") :
-                    tr ("Duplicate port path entered ");
-                aTitle += ": " +
-                    vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
-                break;
-            }
-            paths << path;
-        }
-    }
-
-    return valid;
-}
-
-void VBoxVMSettingsParallelPage::retranslateUi()
-{
-    for (int i = 0; i < mTabWidget->count(); ++ i)
-    {
-        VBoxVMSettingsParallel *page =
-            static_cast<VBoxVMSettingsParallel*> (mTabWidget->widget (i));
-        mTabWidget->setTabText (i, page->pageTitle());
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSF.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSF.cpp	(revision 25170)
+++ 	(revision )
@@ -1,682 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsSF class implementation
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global includes */
-#include <QHeaderView>
-#include <QTimer>
-
-/* Local includes */
-#include "VBoxVMSettingsSF.h"
-#include "VBoxVMSettingsSFDetails.h"
-#include "VBoxGlobal.h"
-#include "VBoxProblemReporter.h"
-#include "VBoxUtils.h"
-
-class SFTreeViewItem : public QTreeWidgetItem
-{
-public:
-
-    enum { SFTreeViewItemType = QTreeWidgetItem::UserType + 1 };
-
-    enum FormatType
-    {
-        IncorrectFormat = 0,
-        EllipsisStart   = 1,
-        EllipsisMiddle  = 2,
-        EllipsisEnd     = 3,
-        EllipsisFile    = 4
-    };
-
-    /* Root Item */
-    SFTreeViewItem (QTreeWidget *aParent, const QStringList &aFields, FormatType aFormat)
-        : QTreeWidgetItem (aParent, aFields, SFTreeViewItemType), mFormat (aFormat)
-    {
-        setFirstColumnSpanned (true);
-        setFlags (flags() ^ Qt::ItemIsSelectable);
-    }
-
-    /* Child Item */
-    SFTreeViewItem (SFTreeViewItem *aParent, const QStringList &aFields, FormatType aFormat)
-        : QTreeWidgetItem (aParent, aFields, SFTreeViewItemType), mFormat (aFormat)
-    {
-        updateText (aFields);
-    }
-
-    bool operator< (const QTreeWidgetItem &aOther) const
-    {
-        /* Root items should always been sorted by id-field. */
-        return parent() ? text (0).toLower() < aOther.text (0).toLower() :
-                          text (1).toLower() < aOther.text (1).toLower();
-    }
-
-    SFTreeViewItem* child (int aIndex) const
-    {
-        QTreeWidgetItem *item = QTreeWidgetItem::child (aIndex);
-        return item && item->type() == SFTreeViewItemType ? static_cast <SFTreeViewItem*> (item) : 0;
-    }
-
-    QString getText (int aIndex) const
-    {
-        return aIndex >= 0 && aIndex < (int)mTextList.size() ? mTextList [aIndex] : QString::null;
-    }
-
-    void updateText (const QStringList &aFields)
-    {
-        mTextList.clear();
-        mTextList << aFields;
-        adjustText();
-    }
-
-    void adjustText()
-    {
-        for (int i = 0; i < treeWidget()->columnCount(); ++ i)
-            processColumn (i);
-    }
-
-private:
-
-    void processColumn (int aColumn)
-    {
-        QString oneString = getText (aColumn);
-        if (oneString.isNull())
-            return;
-        QFontMetrics fm = treeWidget()->fontMetrics();
-        int oldSize = fm.width (oneString);
-        int indentSize = fm.width (" ... ");
-        int itemIndent = parent() ? treeWidget()->indentation() * 2 : treeWidget()->indentation();
-        if (aColumn == 0)
-            indentSize += itemIndent;
-        int cWidth = treeWidget()->columnWidth (aColumn);
-
-        /* Compress text */
-        int start = 0;
-        int finish = 0;
-        int position = 0;
-        int textWidth = 0;
-        do
-        {
-            textWidth = fm.width (oneString);
-            if (textWidth + indentSize > cWidth)
-            {
-                start  = 0;
-                finish = oneString.length();
-
-                /* Selecting remove position */
-                switch (mFormat)
-                {
-                    case EllipsisStart:
-                        position = start;
-                        break;
-                    case EllipsisMiddle:
-                        position = (finish - start) / 2;
-                        break;
-                    case EllipsisEnd:
-                        position = finish - 1;
-                        break;
-                    case EllipsisFile:
-                    {
-                        QRegExp regExp ("([\\\\/][^\\\\^/]+[\\\\/]?$)");
-                        int newFinish = regExp.indexIn (oneString);
-                        if (newFinish != -1)
-                            finish = newFinish;
-                        position = (finish - start) / 2;
-                        break;
-                    }
-                    default:
-                        AssertMsgFailed (("Invalid format type\n"));
-                }
-
-                if (position == finish)
-                   break;
-
-                oneString.remove (position, 1);
-            }
-        }
-        while (textWidth + indentSize > cWidth);
-
-        if (position || mFormat == EllipsisFile) oneString.insert (position, "...");
-        int newSize = fm.width (oneString);
-        setText (aColumn, newSize < oldSize ? oneString : mTextList [aColumn]);
-        setToolTip (aColumn, text (aColumn) == getText (aColumn) ? QString::null : getText (aColumn));
-
-        /* Calculate item's size-hint */
-        setSizeHint (aColumn, QSize (fm.width (QString ("  %1  ").arg (getText (aColumn))), 100));
-    }
-
-    FormatType  mFormat;
-    QStringList mTextList;
-};
-
-VBoxVMSettingsSF::VBoxVMSettingsSF (int aType, QWidget *aParent)
-    : VBoxSettingsPage (aParent)
-    , mDialogType (aType)
-    , mIsListViewChanged (false)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsSF::setupUi (this);
-
-    /* Prepare actions */
-    mNewAction = new QAction (this);
-    mEdtAction = new QAction (this);
-    mDelAction = new QAction (this);
-
-    mNewAction->setShortcut (QKeySequence ("Ins"));
-    mEdtAction->setShortcut (QKeySequence ("Ctrl+Space"));
-    mDelAction->setShortcut (QKeySequence ("Del"));
-
-    mNewAction->setIcon (VBoxGlobal::iconSet (":/add_shared_folder_16px.png",
-                                              ":/add_shared_folder_disabled_16px.png"));
-    mEdtAction->setIcon (VBoxGlobal::iconSet (":/edit_shared_folder_16px.png",
-                                              ":/edit_shared_folder_disabled_16px.png"));
-    mDelAction->setIcon (VBoxGlobal::iconSet (":/revome_shared_folder_16px.png",
-                                              ":/revome_shared_folder_disabled_16px.png"));
-
-    /* Prepare toolbar */
-    mTbFolders->setUsesTextLabel (false);
-    mTbFolders->setIconSize (QSize (16, 16));
-    mTbFolders->setOrientation (Qt::Vertical);
-    mTbFolders->addAction (mNewAction);
-    mTbFolders->addAction (mEdtAction);
-    mTbFolders->addAction (mDelAction);
-
-    /* Setup connections */
-    mTwFolders->header()->setMovable (false);
-    connect (mNewAction, SIGNAL (triggered (bool)), this, SLOT (addTriggered()));
-    connect (mEdtAction, SIGNAL (triggered (bool)), this, SLOT (edtTriggered()));
-    connect (mDelAction, SIGNAL (triggered (bool)), this, SLOT (delTriggered()));
-    connect (mTwFolders, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)),
-             this, SLOT (processCurrentChanged (QTreeWidgetItem *)));
-    connect (mTwFolders, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),
-             this, SLOT (processDoubleClick (QTreeWidgetItem *)));
-    connect (mTwFolders, SIGNAL (customContextMenuRequested (const QPoint &)),
-             this, SLOT (showContextMenu (const QPoint &)));
-
-    /* Create mTwFolders root items */
-#if 0
-    if (aType == GlobalType)
-    {
-        QStringList fields;
-        fields << tr (" Global Folders") /* name */ << QString::number (GlobalType) /* key */;
-        new SFTreeViewItem (mTwFolders, fields, SFTreeViewItem::EllipsisEnd);
-    }
-#endif
-    if (aType & MachineType)
-    {
-        QStringList fields;
-        fields << tr (" Machine Folders") /* name */ << QString::number (MachineType) /* key */;
-        new SFTreeViewItem (mTwFolders, fields, SFTreeViewItem::EllipsisEnd);
-    }
-    if (aType & ConsoleType)
-    {
-        QStringList fields;
-        fields << tr (" Transient Folders") /* name */ << QString::number (ConsoleType) /* key */;
-        new SFTreeViewItem (mTwFolders, fields, SFTreeViewItem::EllipsisEnd);
-    }
-    mTwFolders->sortItems (0, Qt::AscendingOrder);
-
-    retranslateUi();
-}
-
-void VBoxVMSettingsSF::getFromGlobal()
-{
-    AssertMsgFailed (("Global shared folders are not supported now!\n"));
-#if 0
-    SFTreeViewItem *root = searchRoot (true, GlobalType);
-    root->setHidden (false);
-    getFrom (vboxGlobal().virtualBox().GetSharedFolders(), root);
-#endif
-}
-
-void VBoxVMSettingsSF::getFromMachine (const CMachine &aMachine)
-{
-    mMachine = aMachine;
-    SFTreeViewItem *root = searchRoot (true, MachineType);
-    root->setHidden (false);
-    getFrom (mMachine.GetSharedFolders(), root);
-}
-
-void VBoxVMSettingsSF::getFromConsole (const CConsole &aConsole)
-{
-    mConsole = aConsole;
-    SFTreeViewItem *root = searchRoot (true, ConsoleType);
-    root->setHidden (false);
-    getFrom (mConsole.GetSharedFolders(), root);
-}
-
-void VBoxVMSettingsSF::putBackToGlobal()
-{
-    AssertMsgFailed (("Global shared folders are not supported now!\n"));
-#if 0
-    if (!mIsListViewChanged)
-        return;
-    /* This function is only available for GlobalType dialog */
-    Assert (mDialogType == GlobalType);
-    /* Searching for GlobalType item's root */
-    SFTreeViewItem *root = searchRoot (true, GlobalType);
-    Assert (root);
-    CSharedFolderVector vec = vboxGlobal().virtualBox().GetSharedFolders();
-    putBackTo (vec, root);
-#endif
-}
-
-void VBoxVMSettingsSF::putBackToMachine()
-{
-    if (!mIsListViewChanged)
-        return;
-    /* This function is only available for MachineType dialog */
-    Assert (mDialogType & MachineType);
-    /* Searching for MachineType item's root */
-    SFTreeViewItem *root = searchRoot (true,  MachineType);
-    Assert (root);
-    CSharedFolderVector sfvec = mMachine.GetSharedFolders();
-    putBackTo (sfvec, root);
-}
-
-void VBoxVMSettingsSF::putBackToConsole()
-{
-    if (!mIsListViewChanged)
-        return;
-    /* This function is only available for ConsoleType dialog */
-    Assert (mDialogType & ConsoleType);
-    /* Searching for ConsoleType item's root */
-    SFTreeViewItem *root = searchRoot (true, ConsoleType);
-    Assert (root);
-    CSharedFolderVector sfvec = mConsole.GetSharedFolders();
-    putBackTo (sfvec, root);
-}
-
-int VBoxVMSettingsSF::dialogType() const
-{
-     return mDialogType;
-}
-
-void VBoxVMSettingsSF::getFrom (const CMachine &aMachine)
-{
-    getFromMachine (aMachine);
-}
-
-void VBoxVMSettingsSF::putBackTo()
-{
-    putBackToMachine();
-}
-
-void VBoxVMSettingsSF::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mTwFolders);
-}
-
-void VBoxVMSettingsSF::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsSF::retranslateUi (this);
-
-    mNewAction->setText (tr ("&Add Shared Folder"));
-    mEdtAction->setText (tr ("&Edit Shared Folder"));
-    mDelAction->setText (tr ("&Remove Shared Folder"));
-
-    mNewAction->setToolTip (mNewAction->text().remove ('&') +
-        QString (" (%1)").arg (mNewAction->shortcut().toString()));
-    mEdtAction->setToolTip (mEdtAction->text().remove ('&') +
-        QString (" (%1)").arg (mEdtAction->shortcut().toString()));
-    mDelAction->setToolTip (mDelAction->text().remove ('&') +
-        QString (" (%1)").arg (mDelAction->shortcut().toString()));
-
-    mNewAction->setWhatsThis (tr ("Adds a new shared folder definition."));
-    mEdtAction->setWhatsThis (tr ("Edits the selected shared folder definition."));
-    mDelAction->setWhatsThis (tr ("Removes the selected shared folder definition."));
-
-    mTrFull = tr ("Full");
-    mTrReadOnly = tr ("Read-only");
-}
-
-void VBoxVMSettingsSF::addTriggered()
-{
-    /* Invoke Add-Box Dialog */
-    VBoxVMSettingsSFDetails dlg (VBoxVMSettingsSFDetails::AddType, mDialogType & ConsoleType, usedList (true), this);
-    if (dlg.exec() == QDialog::Accepted)
-    {
-        QString name = dlg.name();
-        QString path = dlg.path();
-        bool isPermanent = dlg.isPermanent();
-        /* Shared folder's name & path could not be empty */
-        Assert (!name.isEmpty() && !path.isEmpty());
-        /* Searching root for the new listview item */
-        SFTreeViewItem *root = searchRoot (isPermanent);
-        Assert (root);
-        /* Appending a new listview item to the root */
-        QStringList fields;
-        fields << name /* name */ << path /* path */
-               << (dlg.isWriteable() ? mTrFull : mTrReadOnly /* writable? */)
-               << "edited" /* mark item as edited */;
-        SFTreeViewItem *item = new SFTreeViewItem (root, fields, SFTreeViewItem::EllipsisFile);
-        mTwFolders->sortItems (0, Qt::AscendingOrder);
-        mTwFolders->scrollToItem (item);
-        mTwFolders->setCurrentItem (item);
-        processCurrentChanged (item);
-        mTwFolders->setFocus();
-        adjustList();
-
-        mIsListViewChanged = true;
-    }
-}
-
-void VBoxVMSettingsSF::edtTriggered()
-{
-    /* Check selected item */
-    QTreeWidgetItem *selectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems() [0] : 0;
-    SFTreeViewItem *item = selectedItem && selectedItem->type() == SFTreeViewItem::SFTreeViewItemType ?
-                           static_cast <SFTreeViewItem*> (selectedItem) : 0;
-    Assert (item);
-    Assert (item->parent());
-
-    /* Invoke Edit-Box Dialog */
-    VBoxVMSettingsSFDetails dlg (VBoxVMSettingsSFDetails::EditType, mDialogType & ConsoleType, usedList (false), this);
-    dlg.setPath (item->getText (1));
-    dlg.setName (item->getText (0));
-    dlg.setPermanent ((SFDialogType)item->parent()->text (1).toInt() != ConsoleType);
-    dlg.setWriteable (item->getText (2) == mTrFull);
-    if (dlg.exec() == QDialog::Accepted)
-    {
-        QString name = dlg.name();
-        QString path = dlg.path();
-        bool isPermanent = dlg.isPermanent();
-        /* Shared folder's name & path could not be empty */
-        Assert (!name.isEmpty() && !path.isEmpty());
-        /* Searching new root for the selected listview item */
-        SFTreeViewItem *root = searchRoot (isPermanent);
-        Assert (root);
-        /* Updating an edited listview item */
-        QStringList fields;
-        fields << name /* name */ << path /* path */
-               << (dlg.isWriteable() ? mTrFull : mTrReadOnly /* writable? */)
-               << "edited" /* mark item as edited */;
-        item->updateText (fields);
-        mTwFolders->sortItems (0, Qt::AscendingOrder);
-        if (item->parent() != root)
-        {
-            /* Move the selected item into new location */
-            item->parent()->takeChild (item->parent()->indexOfChild (item));
-            root->insertChild (root->childCount(), item);
-            mTwFolders->scrollToItem (item);
-            mTwFolders->setCurrentItem (item);
-            processCurrentChanged (item);
-            mTwFolders->setFocus();
-        }
-        adjustList();
-
-        mIsListViewChanged = true;
-    }
-}
-
-void VBoxVMSettingsSF::delTriggered()
-{
-    QTreeWidgetItem *selectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems() [0] : 0;
-    Assert (selectedItem);
-    delete selectedItem;
-    adjustList();
-    mIsListViewChanged = true;
-}
-
-void VBoxVMSettingsSF::processCurrentChanged (QTreeWidgetItem *aCurrentItem)
-{
-    if (aCurrentItem && aCurrentItem->parent() && !aCurrentItem->isSelected())
-        aCurrentItem->setSelected (true);
-    QString key = !aCurrentItem ? QString::null : aCurrentItem->parent() ?
-                  aCurrentItem->parent()->text (1) : aCurrentItem->text (1);
-    bool addEnabled = aCurrentItem && isEditable (key);
-    bool removeEnabled = addEnabled && aCurrentItem->parent();
-    mNewAction->setEnabled (addEnabled);
-    mEdtAction->setEnabled (removeEnabled);
-    mDelAction->setEnabled (removeEnabled);
-}
-
-void VBoxVMSettingsSF::processDoubleClick (QTreeWidgetItem *aItem)
-{
-    bool editEnabled = aItem && aItem->parent() && isEditable (aItem->parent()->text (1));
-    if (editEnabled)
-        edtTriggered();
-}
-
-void VBoxVMSettingsSF::showContextMenu (const QPoint &aPos)
-{
-    QMenu menu;
-    QTreeWidgetItem *item = mTwFolders->itemAt (aPos);
-    if (item && item->flags() & Qt::ItemIsSelectable)
-    {
-        menu.addAction (mEdtAction);
-        menu.addAction (mDelAction);
-    }
-    else
-    {
-        menu.addAction (mNewAction);
-    }
-    menu.exec (mTwFolders->viewport()->mapToGlobal (aPos));
-}
-
-void VBoxVMSettingsSF::adjustList()
-{
-    /* Calculating required columns size & watching those columns (0 and 2) to feat 1/3 of total width. */
-    QAbstractItemView *itemView = mTwFolders;
-    QHeaderView *itemHeader = mTwFolders->header();
-    int total = mTwFolders->viewport()->width();
-    int mw0 = qMax (itemView->sizeHintForColumn (0), itemHeader->sectionSizeHint (0));
-    int mw2 = qMax (itemView->sizeHintForColumn (2), itemHeader->sectionSizeHint (2));
-    int w0 = mw0 < total / 3 ? mw0 : total / 3;
-    int w2 = mw2 < total / 3 ? mw2 : total / 3;
-
-    /* Giving 1st column all the available space. */
-    mTwFolders->setColumnWidth (0, w0);
-    mTwFolders->setColumnWidth (1, total - w0 - w2);
-    mTwFolders->setColumnWidth (2, w2);
-}
-
-void VBoxVMSettingsSF::adjustFields()
-{
-    QTreeWidgetItem *mainRoot = mTwFolders->invisibleRootItem();
-    for (int i = 0; i < mainRoot->childCount(); ++ i)
-    {
-        QTreeWidgetItem *subRoot = mainRoot->child (i);
-        for (int j = 0; j < subRoot->childCount(); ++ j)
-        {
-            SFTreeViewItem *item = subRoot->child (j) &&
-                                   subRoot->child (j)->type() == SFTreeViewItem::SFTreeViewItemType ?
-                                   static_cast <SFTreeViewItem*> (subRoot->child (j)) : 0;
-            if (item)
-                item->adjustText();
-        }
-    }
-}
-
-void VBoxVMSettingsSF::showEvent (QShowEvent *aEvent)
-{
-    QWidget::showEvent (aEvent);
-
-    /* Connect header-resize signal just before widget is shown after all the items properly loaded and initialized. */
-    connect (mTwFolders->header(), SIGNAL (sectionResized (int, int, int)), this, SLOT (adjustFields()));
-
-    /* Adjusting size after all pending show events are processed. */
-    QTimer::singleShot (0, this, SLOT (adjustList()));
-}
-
-void VBoxVMSettingsSF::createSharedFolder (const QString &aName, const QString &aPath, bool aWritable, SFDialogType aType)
-{
-    switch (aType)
-    {
-        case GlobalType:
-        {
-            /* This feature is not supported now */
-            AssertMsgFailed (("Global shared folders are not supported now!\n"));
-            break;
-        }
-        case MachineType:
-        {
-            Assert (!mMachine.isNull());
-            mMachine.CreateSharedFolder (aName, aPath, aWritable);
-            if (!mMachine.isOk())
-                vboxProblem().cannotCreateSharedFolder (this, mMachine, aName, aPath);
-            break;
-        }
-        case ConsoleType:
-        {
-            Assert (!mConsole.isNull());
-            mConsole.CreateSharedFolder (aName, aPath, aWritable);
-            if (!mConsole.isOk())
-                vboxProblem().cannotCreateSharedFolder (this, mConsole, aName, aPath);
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed (("Incorrect shared folder type\n"));
-        }
-    }
-}
-
-void VBoxVMSettingsSF::removeSharedFolder (const QString &aName, const QString &aPath, SFDialogType aType)
-{
-    switch (aType)
-    {
-        case GlobalType:
-        {
-            /* This feature is not supported now */
-            AssertMsgFailed (("Global shared folders are not supported now!\n"));
-            break;
-        }
-        case MachineType:
-        {
-            Assert (!mMachine.isNull());
-            mMachine.RemoveSharedFolder (aName);
-            if (!mMachine.isOk())
-                vboxProblem().cannotRemoveSharedFolder (this, mMachine, aName, aPath);
-            break;
-        }
-        case ConsoleType:
-        {
-            Assert (!mConsole.isNull());
-            mConsole.RemoveSharedFolder (aName);
-            if (!mConsole.isOk())
-                vboxProblem().cannotRemoveSharedFolder (this, mConsole, aName, aPath);
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed (("Incorrect shared folder type\n"));
-        }
-    }
-}
-
-void VBoxVMSettingsSF::getFrom (const CSharedFolderVector &aVec, SFTreeViewItem *aRoot)
-{
-    for (int i = 0; i < aVec.size(); ++ i)
-    {
-        CSharedFolder sf = aVec [i];
-        QStringList fields;
-        fields << sf.GetName() /* name */ << sf.GetHostPath() /* path */
-               << (sf.GetWritable() ? mTrFull : mTrReadOnly /* writable? */)
-               << "not edited" /* initially not edited */;
-        new SFTreeViewItem (aRoot, fields, SFTreeViewItem::EllipsisFile);
-    }
-    aRoot->setExpanded (true);
-    mTwFolders->sortItems (0, Qt::AscendingOrder);
-    mTwFolders->setCurrentItem (aRoot->childCount() ? aRoot->child (0) : aRoot);
-    processCurrentChanged (aRoot->childCount() ? aRoot->child (0) : aRoot);
-}
-
-void VBoxVMSettingsSF::putBackTo (CSharedFolderVector &aVec, SFTreeViewItem *aRoot)
-{
-    Assert (!aRoot->text (1).isNull());
-    SFDialogType type = (SFDialogType) aRoot->text (1).toInt();
-
-    /* Delete all changed folders from vm */
-    for (int idx = 0; idx < aVec.size(); ++ idx)
-    {
-        CSharedFolder sf = aVec [idx];
-
-        /* Iterate through this root's children */
-        int i = 0;
-        for (; i < aRoot->childCount(); ++ i)
-        {
-            SFTreeViewItem *item = aRoot->child (i);
-            if (item->getText (0) == sf.GetName() && item->getText (3) == "not edited")
-                break;
-        }
-
-        if (i == aRoot->childCount())
-            removeSharedFolder (sf.GetName(), sf.GetHostPath(), type);
-    }
-
-    /* Save all edited tree widget items as folders */
-    for (int i = 0; i < aRoot->childCount(); ++ i)
-    {
-        SFTreeViewItem *item = aRoot->child (i);
-
-        if (!item->getText (0).isNull() && !item->getText (1).isNull() && item->getText (3) == "edited")
-            createSharedFolder (item->getText (0), item->getText (1), item->getText (2) == mTrFull ? true : false, type);
-    }
-}
-
-SFTreeViewItem* VBoxVMSettingsSF::searchRoot (bool aIsPermanent, SFDialogType aType)
-{
-    QString type = aType != WrongType ? QString::number (aType) : !aIsPermanent ? QString::number (ConsoleType) :
-                   mDialogType & MachineType ? QString::number (MachineType) : QString::number (GlobalType);
-    QTreeWidgetItem *mainRoot = mTwFolders->invisibleRootItem();
-
-    int i = 0;
-    for (; i < mainRoot->childCount(); ++ i)
-    {
-        if (mainRoot->child (i)->text (1) == type)
-            break;
-    }
-
-    Assert (i < mainRoot->childCount());
-    return i < mainRoot->childCount() && mainRoot->child (i)->type() == SFTreeViewItem::SFTreeViewItemType ?
-           static_cast <SFTreeViewItem*> (mainRoot->child (i)) : 0;
-}
-
-bool VBoxVMSettingsSF::isEditable (const QString &aKey)
-{
-    /* mDialogType should be correct */
-    Assert (mDialogType);
-
-    SFDialogType type = (SFDialogType) aKey.toInt();
-    if (!type) return false;
-    return mDialogType & type;
-}
-
-SFoldersNameList VBoxVMSettingsSF::usedList (bool aIncludeSelected)
-{
-    /* Make the used names list: */
-    SFoldersNameList list;
-    QTreeWidgetItemIterator it (mTwFolders);
-    while (*it)
-    {
-        if ((*it)->parent() && (aIncludeSelected || !(*it)->isSelected()) &&
-            (*it)->type() == SFTreeViewItem::SFTreeViewItemType)
-        {
-            SFTreeViewItem *item = static_cast <SFTreeViewItem*> (*it);
-            SFDialogType type = (SFDialogType) item->parent()->text (1).toInt();
-            list << qMakePair (item->getText (0), type);
-        }
-        ++ it;
-    }
-    return list;
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSFDetails.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSFDetails.cpp	(revision 25170)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsSFDetails class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxVMSettingsSFDetails.h"
-#include "VBoxGlobal.h"
-
-/* Qt includes */
-#include <QDir>
-#include <QPushButton>
-
-VBoxVMSettingsSFDetails::VBoxVMSettingsSFDetails (DialogType aType,
-                                                  bool aEnableSelector, /* for "permanent" checkbox */
-                                                  const SFoldersNameList &aUsedNames,
-                                                  QWidget *aParent /* = NULL */)
-   : QIWithRetranslateUI2<QIDialog> (aParent)
-   , mType (aType)
-   , mUsePermanent (aEnableSelector)
-   , mUsedNames (aUsedNames)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsSFDetails::setupUi (this);
-
-    mCbPermanent->setHidden (!aEnableSelector);
-
-    /* No reset button */
-    mPsPath->setResetEnabled (false);
-    connect (mPsPath, SIGNAL (currentIndexChanged (int)),
-             this, SLOT (onSelectPath()));
-
-    connect (mLeName, SIGNAL (textChanged (const QString &)),
-             this, SLOT (validate()));
-
-    if (aEnableSelector)
-    {
-        connect (mCbPermanent, SIGNAL (toggled (bool)),
-                 this, SLOT (validate()));
-    }
-
-     /* Applying language settings */
-    retranslateUi();
-
-    /* Validate the initial fields */
-    validate();
-
-    adjustSize();
-
-#ifdef Q_WS_MAC
-    setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
-    setFixedSize (minimumSize());
-#endif /* Q_WS_MAC */
-}
-
-void VBoxVMSettingsSFDetails::setPath (const QString &aPath)
-{
-    mPsPath->setPath (aPath);
-}
-
-QString VBoxVMSettingsSFDetails::path() const
-{
-    return mPsPath->path();
-}
-
-void VBoxVMSettingsSFDetails::setName (const QString &aName)
-{
-    mLeName->setText (aName);
-}
-
-QString VBoxVMSettingsSFDetails::name() const
-{
-    return mLeName->text();
-}
-
-void VBoxVMSettingsSFDetails::setWriteable (bool aWritable)
-{
-    mCbReadonly->setChecked (!aWritable);
-}
-
-bool VBoxVMSettingsSFDetails::isWriteable() const
-{
-    return !mCbReadonly->isChecked();
-}
-
-void VBoxVMSettingsSFDetails::setPermanent (bool aPermanent)
-{
-    mCbPermanent->setChecked (aPermanent);
-}
-
-bool VBoxVMSettingsSFDetails::isPermanent() const
-{
-    return mUsePermanent ? mCbPermanent->isChecked() : true;
-}
-
-void VBoxVMSettingsSFDetails::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsSFDetails::retranslateUi (this);
-
-    switch (mType)
-    {
-        case AddType:
-            setWindowTitle (tr ("Add Share"));
-            break;
-        case EditType:
-            setWindowTitle (tr ("Edit Share"));
-            break;
-        default:
-            AssertMsgFailed (("Incorrect SF Dialog type\n"));
-    }
-}
-
-void VBoxVMSettingsSFDetails::validate()
-{
-    SFDialogType resultType =
-        mCbPermanent && !mCbPermanent->isChecked() ? ConsoleType :
-        mType & MachineType ? MachineType : GlobalType;
-    SFolderName pair = qMakePair (mLeName->text(), resultType);
-
-    mButtonBox->button (QDialogButtonBox::Ok)->setEnabled (!mPsPath->path().isEmpty() &&
-                                                           !mLeName->text().trimmed().isEmpty() &&
-                                                           !mLeName->text().contains(" ") &&
-                                                           !mUsedNames.contains (pair));
-}
-
-void VBoxVMSettingsSFDetails::onSelectPath()
-{
-    if (!mPsPath->isPathSelected())
-        return;
-
-    QString folderName (mPsPath->path());
-#if defined (Q_OS_WIN) || defined (Q_OS_OS2)
-    if (folderName[0].isLetter() && folderName[1] == ':' && folderName[2] == 0)
-    {
-        /* VBoxFilePathSelectorWidget returns root path as 'X:', which is invalid path.
-         * Append the trailing backslash to get a valid root path 'X:\'.
-         */
-        folderName += "\\";
-        mPsPath->setPath(folderName);
-    }
-#endif
-    QDir folder (folderName);
-    if (!folder.isRoot())
-        /* Processing non-root folder */
-        mLeName->setText (folder.dirName());
-    else
-    {
-        /* Processing root folder */
-#if defined (Q_OS_WIN) || defined (Q_OS_OS2)
-        mLeName->setText (folderName.toUpper()[0] + "_DRIVE");
-#elif defined (Q_OS_UNIX)
-        mLeName->setText ("ROOT");
-#endif
-    }
-    /* Validate the fields */
-    validate();
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSerial.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSerial.cpp	(revision 25170)
+++ 	(revision )
@@ -1,311 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsSerial class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxVMSettingsSerial.h"
-#include "QIWidgetValidator.h"
-#include "VBoxGlobal.h"
-
-#include <QDir>
-
-/* VBoxVMSettingsSerial stuff */
-VBoxVMSettingsSerial::VBoxVMSettingsSerial()
-    : QIWithRetranslateUI<QWidget> (0)
-    , mValidator (0)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsSerial::setupUi (this);
-
-    /* Setup validation */
-    mLeIRQ->setValidator (new QIULongValidator (0, 255, this));
-    mLeIOPort->setValidator (new QIULongValidator (0, 0xFFFF, this));
-    mLePath->setValidator (new QRegExpValidator (QRegExp (".+"), this));
-
-    /* Setup constraints */
-    mLeIRQ->setFixedWidth (mLeIRQ->fontMetrics().width ("8888"));
-    mLeIOPort->setFixedWidth (mLeIOPort->fontMetrics().width ("8888888"));
-
-    /* Set initial values */
-    /* Note: If you change one of the following don't forget retranslateUi. */
-    mCbNumber->insertItem (0, vboxGlobal().toCOMPortName (0, 0));
-    mCbNumber->insertItems (0, vboxGlobal().COMPortNames());
-
-    mCbMode->addItem (""); /* KPortMode_Disconnected */
-    mCbMode->addItem (""); /* KPortMode_HostPipe */
-    mCbMode->addItem (""); /* KPortMode_HostDevice */
-    mCbMode->addItem (""); /* KPortMode_RawFile */
-
-    /* Setup connections */
-    connect (mGbSerial, SIGNAL (toggled (bool)),
-             this, SLOT (mGbSerialToggled (bool)));
-    connect (mCbNumber, SIGNAL (activated (const QString &)),
-             this, SLOT (mCbNumberActivated (const QString &)));
-    connect (mCbMode, SIGNAL (activated (const QString &)),
-             this, SLOT (mCbModeActivated (const QString &)));
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxVMSettingsSerial::getFromPort (const CSerialPort &aPort)
-{
-    mPort = aPort;
-
-    mGbSerial->setChecked (mPort.GetEnabled());
-    ulong IRQ = mPort.GetIRQ();
-    ulong IOBase = mPort.GetIOBase();
-    mCbNumber->setCurrentIndex (mCbNumber->
-        findText (vboxGlobal().toCOMPortName (IRQ, IOBase)));
-    mLeIRQ->setText (QString::number (IRQ));
-    mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
-    mCbMode->setCurrentIndex (mCbMode->
-        findText (vboxGlobal().toString (mPort.GetHostMode())));
-    mCbPipe->setChecked (mPort.GetServer());
-    mLePath->setText (mPort.GetPath());
-
-    /* Ensure everything is up-to-date */
-    mGbSerialToggled (mGbSerial->isChecked());
-}
-
-void VBoxVMSettingsSerial::putBackToPort()
-{
-    mPort.SetEnabled (mGbSerial->isChecked());
-    mPort.SetIRQ (mLeIRQ->text().toULong (NULL, 0));
-    mPort.SetIOBase (mLeIOPort->text().toULong (NULL, 0));
-    mPort.SetServer (mCbPipe->isChecked());
-    mPort.SetPath (QDir::toNativeSeparators (mLePath->text()));
-    /* This *must* be last. The host mode will be changed to disconnected if
-     * some of the necessary settings above will not meet the requirements for
-     * the selected mode. */
-    mPort.SetHostMode (vboxGlobal().toPortMode (mCbMode->currentText()));
-}
-
-void VBoxVMSettingsSerial::setValidator (QIWidgetValidator *aVal)
-{
-    Assert (aVal);
-    mValidator = aVal;
-    connect (mLeIRQ, SIGNAL (textChanged (const QString &)),
-             mValidator, SLOT (revalidate()));
-    connect (mLeIOPort, SIGNAL (textChanged (const QString &)),
-             mValidator, SLOT (revalidate()));
-    connect (mLePath, SIGNAL (textChanged (const QString &)),
-             mValidator, SLOT (revalidate()));
-    mValidator->revalidate();
-}
-
-QWidget* VBoxVMSettingsSerial::setOrderAfter (QWidget *aAfter)
-{
-    setTabOrder (aAfter, mGbSerial);
-    setTabOrder (mGbSerial, mCbNumber);
-    setTabOrder (mCbNumber, mLeIRQ);
-    setTabOrder (mLeIRQ, mLeIOPort);
-    setTabOrder (mLeIOPort, mCbMode);
-    setTabOrder (mCbMode, mCbPipe);
-    setTabOrder (mCbPipe, mLePath);
-    return mLePath;
-}
-
-QString VBoxVMSettingsSerial::pageTitle() const
-{
-    QString pageTitle;
-    if (!mPort.isNull())
-    {
-        pageTitle = QString (tr ("Port %1", "serial ports"))
-            .arg (QString ("&%1").arg (mPort.GetSlot() + 1));
-    }
-    return pageTitle;
-}
-
-bool VBoxVMSettingsSerial::isUserDefined()
-{
-    ulong a, b;
-    return !vboxGlobal().toCOMPortNumbers (mCbNumber->currentText(), a, b);
-}
-
-void VBoxVMSettingsSerial::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsSerial::retranslateUi (this);
-
-    mCbNumber->setItemText (mCbNumber->count() - 1, vboxGlobal().toCOMPortName (0, 0));
-
-    mCbMode->setItemText (3, vboxGlobal().toString (KPortMode_RawFile));
-    mCbMode->setItemText (2, vboxGlobal().toString (KPortMode_HostDevice));
-    mCbMode->setItemText (1, vboxGlobal().toString (KPortMode_HostPipe));
-    mCbMode->setItemText (0, vboxGlobal().toString (KPortMode_Disconnected));
-}
-
-void VBoxVMSettingsSerial::mGbSerialToggled (bool aOn)
-{
-    if (aOn)
-    {
-        mCbNumberActivated (mCbNumber->currentText());
-        mCbModeActivated (mCbMode->currentText());
-    }
-    if (mValidator)
-        mValidator->revalidate();
-}
-
-void VBoxVMSettingsSerial::mCbNumberActivated (const QString &aText)
-{
-    ulong IRQ, IOBase;
-    bool std = vboxGlobal().toCOMPortNumbers (aText, IRQ, IOBase);
-
-    mLeIRQ->setEnabled (!std);
-    mLeIOPort->setEnabled (!std);
-    if (std)
-    {
-        mLeIRQ->setText (QString::number (IRQ));
-        mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
-    }
-}
-
-void VBoxVMSettingsSerial::mCbModeActivated (const QString &aText)
-{
-    KPortMode mode = vboxGlobal().toPortMode (aText);
-    mCbPipe->setEnabled (mode == KPortMode_HostPipe);
-    mLbPath->setEnabled (mode != KPortMode_Disconnected);
-    mLePath->setEnabled (mode != KPortMode_Disconnected);
-    if (mValidator)
-        mValidator->revalidate();
-}
-
-
-/* VBoxVMSettingsSerialPage stuff */
-VBoxVMSettingsSerialPage::VBoxVMSettingsSerialPage()
-    : mValidator (0)
-{
-    /* TabWidget creation */
-    mTabWidget = new QTabWidget (this);
-    QVBoxLayout *layout = new QVBoxLayout (this);
-    layout->setContentsMargins (0, 5, 0, 5);
-    layout->addWidget (mTabWidget);
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxVMSettingsSerialPage::getFrom (const CMachine &aMachine)
-{
-    Assert (mFirstWidget);
-    setTabOrder (mFirstWidget, mTabWidget->focusProxy());
-    QWidget *lastFocusWidget = mTabWidget->focusProxy();
-
-    /* Tab pages loading */
-    ulong count = vboxGlobal().virtualBox().
-                  GetSystemProperties().GetSerialPortCount();
-    for (ulong slot = 0; slot < count; ++ slot)
-    {
-        CSerialPort port = aMachine.GetSerialPort (slot);
-        VBoxVMSettingsSerial *page = new VBoxVMSettingsSerial();
-        page->getFromPort (port);
-        mTabWidget->addTab (page, page->pageTitle());
-        Assert (mValidator);
-        page->setValidator (mValidator);
-        lastFocusWidget = page->setOrderAfter (lastFocusWidget);
-    }
-}
-
-void VBoxVMSettingsSerialPage::putBackTo()
-{
-    for (int index = 0; index < mTabWidget->count(); ++ index)
-    {
-        VBoxVMSettingsSerial *page =
-            (VBoxVMSettingsSerial*) mTabWidget->widget (index);
-        Assert (page);
-        page->putBackToPort();
-    }
-}
-
-void VBoxVMSettingsSerialPage::setValidator (QIWidgetValidator * aVal)
-{
-    mValidator = aVal;
-}
-
-bool VBoxVMSettingsSerialPage::revalidate (QString &aWarning, QString &aTitle)
-{
-    bool valid = true;
-    QStringList ports;
-    QStringList paths;
-
-    int index = 0;
-    for (; index < mTabWidget->count(); ++ index)
-    {
-        QWidget *tab = mTabWidget->widget (index);
-        VBoxVMSettingsSerial *page =
-            static_cast<VBoxVMSettingsSerial*> (tab);
-
-        if (!page->mGbSerial->isChecked())
-            continue;
-
-        /* Check the predefined port number unicity */
-        if (!page->isUserDefined())
-        {
-            QString port = page->mCbNumber->currentText();
-            valid = !ports.contains (port);
-            if (!valid)
-            {
-                aWarning = tr ("Duplicate port number selected ");
-                aTitle += ": " +
-                    vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
-                break;
-            }
-            ports << port;
-        }
-
-        /* Check the port path emptiness & unicity */
-        KPortMode mode =
-            vboxGlobal().toPortMode (page->mCbMode->currentText());
-        if (mode != KPortMode_Disconnected)
-        {
-            QString path = page->mLePath->text();
-            valid = !path.isEmpty() && !paths.contains (path);
-            if (!valid)
-            {
-                if (!page->mGbSerial->isChecked())
-                    page->mCbMode->setCurrentIndex (KPortMode_Disconnected);
-                else
-                {
-                    aWarning = path.isEmpty() ?
-                        tr ("Port path not specified ") :
-                        tr ("Duplicate port path entered ");
-                    aTitle += ": " +
-                        vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
-                    break;
-                }
-            }
-            paths << path;
-        }
-    }
-
-    return valid;
-}
-
-void VBoxVMSettingsSerialPage::retranslateUi()
-{
-    for (int i = 0; i < mTabWidget->count(); ++ i)
-    {
-        VBoxVMSettingsSerial *page =
-            static_cast<VBoxVMSettingsSerial*> (mTabWidget->widget (i));
-        mTabWidget->setTabText (i, page->pageTitle());
-    }
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSystem.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsSystem.cpp	(revision 25170)
+++ 	(revision )
@@ -1,513 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsSystem class implementation
- */
-
-/*
- * Copyright (C) 2008-2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global includes */
-#include <QHeaderView>
-
-/* Local includes */
-#include "VBoxVMSettingsSystem.h"
-#include "VBoxGlobal.h"
-#include "QIWidgetValidator.h"
-#include <iprt/cdefs.h>
-
-#define ITEM_TYPE_ROLE Qt::UserRole + 1
-
-VBoxVMSettingsSystem::VBoxVMSettingsSystem()
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsSystem::setupUi (this);
-
-    /* Setup constants */
-    CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
-    uint hostCPUs = vboxGlobal().virtualBox().GetHost().GetProcessorCount();
-    mMinGuestCPU = sys.GetMinGuestCPUCount();
-    mMaxGuestCPU = RT_MIN (2 * hostCPUs, sys.GetMaxGuestCPUCount());
-
-    /* Setup validators */
-    mLeMemory->setValidator (new QIntValidator (mSlMemory->minRAM(), mSlMemory->maxRAM(), this));
-    mLeCPU->setValidator (new QIntValidator (mMinGuestCPU, mMaxGuestCPU, this));
-
-    /* Setup connections */
-    connect (mSlMemory, SIGNAL (valueChanged (int)),
-             this, SLOT (valueChangedRAM (int)));
-    connect (mLeMemory, SIGNAL (textChanged (const QString&)),
-             this, SLOT (textChangedRAM (const QString&)));
-
-    connect (mTbBootItemUp, SIGNAL (clicked()),
-             this, SLOT (moveBootItemUp()));
-    connect (mTbBootItemDown, SIGNAL (clicked()),
-             this, SLOT (moveBootItemDown()));
-    connect (mTwBootOrder, SIGNAL (moveItemUp()),
-             this, SLOT (moveBootItemUp()));
-    connect (mTwBootOrder, SIGNAL (moveItemDown()),
-             this, SLOT (moveBootItemDown()));
-    connect (mTwBootOrder, SIGNAL (itemToggled()),
-             this, SIGNAL (tableChanged()));
-    connect (mTwBootOrder, SIGNAL (currentItemChanged (QTreeWidgetItem*,
-                                                       QTreeWidgetItem*)),
-             this, SLOT (onCurrentBootItemChanged (QTreeWidgetItem*,
-                                                   QTreeWidgetItem*)));
-
-    connect (mSlCPU, SIGNAL (valueChanged (int)),
-             this, SLOT (valueChangedCPU (int)));
-    connect (mLeCPU, SIGNAL (textChanged (const QString&)),
-             this, SLOT (textChangedCPU (const QString&)));
-
-    /* Setup iconsets */
-    mTbBootItemUp->setIcon (VBoxGlobal::iconSet (":/list_moveup_16px.png",
-                                                 ":/list_moveup_disabled_16px.png"));
-    mTbBootItemDown->setIcon (VBoxGlobal::iconSet (":/list_movedown_16px.png",
-                                                   ":/list_movedown_disabled_16px.png"));
-
-#ifdef Q_WS_MAC
-    /* We need a little space for the focus rect. */
-    mLtBootOrder->setContentsMargins (3, 3, 3, 3);
-    mLtBootOrder->setSpacing (3);
-#endif /* Q_WS_MAC */
-
-    /* Limit min/max. size of QLineEdit */
-    mLeMemory->setFixedWidthByText (QString().fill ('8', 5));
-    /* Ensure mLeMemory value and validation is updated */
-    valueChangedRAM (mSlMemory->value());
-
-    /* Setup cpu slider */
-    mSlCPU->setPageStep (1);
-    mSlCPU->setSingleStep (1);
-    mSlCPU->setTickInterval (1);
-    /* Setup the scale so that ticks are at page step boundaries */
-    mSlCPU->setMinimum (mMinGuestCPU);
-    mSlCPU->setMaximum (mMaxGuestCPU);
-    mSlCPU->setOptimalHint (1, hostCPUs);
-    mSlCPU->setWarningHint (hostCPUs, mMaxGuestCPU);
-    /* Limit min/max. size of QLineEdit */
-    mLeCPU->setFixedWidthByText (QString().fill ('8', 3));
-    /* Ensure mLeMemory value and validation is updated */
-    valueChangedCPU (mSlCPU->value());
-
-    /* Install global event filter */
-    qApp->installEventFilter (this);
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-bool VBoxVMSettingsSystem::isHWVirtExEnabled() const
-{
-    return mCbVirt->isChecked();
-}
-
-int VBoxVMSettingsSystem::cpuCount() const
-{
-    return mSlCPU->value();
-}
-
-void VBoxVMSettingsSystem::getFrom (const CMachine &aMachine)
-{
-    mMachine = aMachine;
-    CBIOSSettings biosSettings = mMachine.GetBIOSSettings();
-
-    /* RAM size */
-    mSlMemory->setValue (aMachine.GetMemorySize());
-
-    /* Boot-order */
-    {
-        mTwBootOrder->clear();
-        /* Load boot-items of current VM */
-        QStringList uniqueList;
-        for (int i = 1; i <= 4; ++ i)
-        {
-            KDeviceType type = mMachine.GetBootOrder (i);
-            if (type != KDeviceType_Null)
-            {
-                QString name = vboxGlobal().toString (type);
-                QTreeWidgetItem *item =
-                    new QTreeWidgetItem (mTwBootOrder, QStringList (name));
-                QVariant vtype (type);
-                item->setData (0, ITEM_TYPE_ROLE, vtype);
-                item->setCheckState (0, Qt::Checked);
-                uniqueList << name;
-            }
-        }
-        /* Load other unique boot-items */
-        for (int i = KDeviceType_Floppy; i < KDeviceType_USB; ++ i)
-        {
-            QString name = vboxGlobal().toString ((KDeviceType) i);
-            if (!uniqueList.contains (name))
-            {
-                QTreeWidgetItem *item =
-                    new QTreeWidgetItem (mTwBootOrder, QStringList (name));
-                item->setData (0, ITEM_TYPE_ROLE, i);
-                item->setCheckState (0, Qt::Unchecked);
-                uniqueList << name;
-            }
-        }
-        adjustBootOrderTWSize();
-    }
-
-    /* IO APIC */
-    mCbApic->setChecked (biosSettings.GetIOAPICEnabled());
-
-    /* EFI */
-    mCbEFI->setChecked (mMachine.GetFirmwareType() >= KFirmwareType_EFI && mMachine.GetFirmwareType() <= KFirmwareType_EFIDUAL);
-
-    /* CPU count */
-    bool fVTxAMDVSupported = vboxGlobal().virtualBox().GetHost()
-                             .GetProcessorFeature (KProcessorFeature_HWVirtEx);
-    mSlCPU->setEnabled (fVTxAMDVSupported);
-    mLeCPU->setEnabled (fVTxAMDVSupported);
-    mSlCPU->setValue (fVTxAMDVSupported ? aMachine.GetCPUCount() : 1);
-
-    /* PAE/NX */
-    bool fPAESupported = vboxGlobal().virtualBox().GetHost()
-                         .GetProcessorFeature (KProcessorFeature_PAE);
-    mCbPae->setEnabled (fPAESupported);
-    mCbPae->setChecked (aMachine.GetCpuProperty(KCpuPropertyType_PAE));
-
-    /* VT-x/AMD-V */
-    mCbVirt->setEnabled (fVTxAMDVSupported);
-    mCbVirt->setChecked (aMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled));
-
-    /* Nested Paging */
-    mCbNestedPaging->setEnabled (fVTxAMDVSupported &&
-                                 aMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled));
-    mCbNestedPaging->setChecked (aMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging));
-
-    if (mValidator)
-        mValidator->revalidate();
-}
-
-void VBoxVMSettingsSystem::putBackTo()
-{
-    CBIOSSettings biosSettings = mMachine.GetBIOSSettings();
-
-    /* RAM size */
-    mMachine.SetMemorySize (mSlMemory->value());
-
-    /* Boot order */
-    {
-        /* Search for checked items */
-        int index = 1;
-
-        for (int i = 0; i < mTwBootOrder->topLevelItemCount(); ++ i)
-        {
-            QTreeWidgetItem *item = mTwBootOrder->topLevelItem (i);
-            if (item->checkState (0) == Qt::Checked)
-            {
-                KDeviceType type = vboxGlobal().toDeviceType (item->text (0));
-                mMachine.SetBootOrder (index ++, type);
-            }
-        }
-
-        /* Search for non-checked items */
-        for (int i = 0; i < mTwBootOrder->topLevelItemCount(); ++ i)
-        {
-            QTreeWidgetItem *item = mTwBootOrder->topLevelItem (i);
-            if (item->checkState (0) != Qt::Checked)
-                mMachine.SetBootOrder (index ++, KDeviceType_Null);
-        }
-    }
-
-    /* IO APIC */
-    biosSettings.SetIOAPICEnabled (mCbApic->isChecked() ||
-                                   mSlCPU->value() > 1);
-
-    /* EFI */
-    mMachine.SetFirmwareType (mCbEFI->isChecked() ? KFirmwareType_EFI : KFirmwareType_BIOS);
-
-    /* RAM size */
-    mMachine.SetCPUCount (mSlCPU->value());
-
-    /* PAE/NX */
-    mMachine.SetCpuProperty(KCpuPropertyType_PAE, mCbPae->isChecked());
-
-    /* VT-x/AMD-V */
-    mMachine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled,
-                                 mCbVirt->checkState() == Qt::Checked || mSlCPU->value() > 1);
-
-    /* Nested Paging */
-    mMachine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, mCbNestedPaging->isChecked());
-}
-
-void VBoxVMSettingsSystem::setValidator (QIWidgetValidator *aVal)
-{
-    mValidator = aVal;
-    connect (mCbApic, SIGNAL (stateChanged (int)), mValidator, SLOT (revalidate()));
-    connect (mCbVirt, SIGNAL (stateChanged (int)), mValidator, SLOT (revalidate()));
-}
-
-bool VBoxVMSettingsSystem::revalidate (QString &aWarning, QString & /* aTitle */)
-{
-    ulong fullSize = vboxGlobal().virtualBox().GetHost().GetMemorySize();
-    if (mSlMemory->value() > (int)mSlMemory->maxRAMAlw())
-    {
-        aWarning = tr (
-            "you have assigned more than <b>%1%</b> of your computer's memory "
-            "(<b>%2</b>) to the virtual machine. Not enough memory is left "
-            "for your host operating system. Please select a smaller amount.")
-            .arg ((unsigned)qRound ((double)mSlMemory->maxRAMAlw() / fullSize * 100.0))
-            .arg (vboxGlobal().formatSize ((uint64_t)fullSize * _1M));
-        return false;
-    }
-    if (mSlMemory->value() > (int)mSlMemory->maxRAMOpt())
-    {
-        aWarning = tr (
-            "you have assigned more than <b>%1%</b> of your computer's memory "
-            "(<b>%2</b>) to the virtual machine. There might not be enough memory "
-            "left for your host operating system. Continue at your own risk.")
-            .arg ((unsigned)qRound ((double)mSlMemory->maxRAMOpt() / fullSize * 100.0))
-            .arg (vboxGlobal().formatSize ((uint64_t)fullSize * _1M));
-        return true;
-    }
-
-    /* VCPU amount test */
-    int totalCPUs = vboxGlobal().virtualBox().GetHost().GetProcessorOnlineCount();
-    if (mSlCPU->value() > 2 * totalCPUs)
-    {
-        aWarning = tr (
-            "for performance reasons, the number of virtual CPUs attached to the "
-            "virtual machine may not be more than twice the number of physical "
-            "CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.")
-            .arg (totalCPUs);
-        return false;
-    }
-    if (mSlCPU->value() > totalCPUs)
-    {
-        aWarning = tr (
-            "you have assigned more virtual CPUs to the virtual machine than "
-            "the number of physical CPUs on your host system (<b>%1</b>). "
-            "This is likely to degrade the performance of your virtual machine. "
-            "Please consider reducing the number of virtual CPUs.")
-            .arg (totalCPUs);
-        return true;
-    }
-
-    /* VCPU IO-APIC test */
-    if (mSlCPU->value() > 1 && !mCbApic->isChecked())
-    {
-        aWarning = tr (
-            "you have assigned more than one virtual CPU to this VM. "
-            "This will not work unless the IO-APIC feature is also enabled. "
-            "This will be done automatically when you accept the VM Settings "
-            "by pressing the OK button.");
-        return true;
-    }
-
-    /* VCPU VT-x/AMD-V test */
-    if (mSlCPU->value() > 1 && !mCbVirt->isChecked())
-    {
-        aWarning = tr (
-            "you have assigned more than one virtual CPU to this VM. "
-            "This will not work unless hardware virtualization (VT-x/AMD-V) is also enabled. "
-            "This will be done automatically when you accept the VM Settings "
-            "by pressing the OK button.");
-        return true;
-    }
-
-    return true;
-}
-
-void VBoxVMSettingsSystem::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mTwSystem->focusProxy());
-    setTabOrder (mTwSystem->focusProxy(), mSlMemory);
-    setTabOrder (mSlMemory, mLeMemory);
-    setTabOrder (mLeMemory, mTwBootOrder);
-    setTabOrder (mTwBootOrder, mTbBootItemUp);
-    setTabOrder (mTbBootItemUp, mTbBootItemDown);
-    setTabOrder (mTbBootItemDown, mCbApic);
-    setTabOrder (mCbApic, mCbEFI);
-
-    setTabOrder (mCbEFI, mSlCPU);
-    setTabOrder (mSlCPU, mLeCPU);
-    setTabOrder (mLeCPU, mCbPae);
-
-    setTabOrder (mCbPae, mCbVirt);
-    setTabOrder (mCbVirt, mCbNestedPaging);
-}
-
-void VBoxVMSettingsSystem::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsSystem::retranslateUi (this);
-
-    /* Adjust the boot order tree widget */
-    mTwBootOrder->header()->setResizeMode (QHeaderView::ResizeToContents);
-    mTwBootOrder->resizeColumnToContents (0);
-    mTwBootOrder->updateGeometry();
-    /* Retranslate the boot order items */
-    QTreeWidgetItemIterator it (mTwBootOrder);
-    while (*it)
-    {
-        QTreeWidgetItem *item = (*it);
-        item->setText (0, vboxGlobal().toString (
-             static_cast <KDeviceType> (item->data (0, ITEM_TYPE_ROLE).toInt())));
-        ++ it;
-    }
-    /* Readjust the tree widget items size */
-    adjustBootOrderTWSize();
-
-    CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
-
-    /* Retranslate the memory slider legend */
-    mLbMemoryMin->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (mSlMemory->minRAM()));
-    mLbMemoryMax->setText (tr ("<qt>%1&nbsp;MB</qt>").arg (mSlMemory->maxRAM()));
-
-    /* Retranslate the cpu slider legend */
-    mLbCPUMin->setText (tr ("<qt>%1&nbsp;CPU</qt>", "%1 is 1 for now").arg (mMinGuestCPU));
-    mLbCPUMax->setText (tr ("<qt>%1&nbsp;CPUs</qt>", "%1 is host cpu count * 2 for now").arg (mMaxGuestCPU));
-}
-
-void VBoxVMSettingsSystem::valueChangedRAM (int aVal)
-{
-    mLeMemory->setText (QString().setNum (aVal));
-}
-
-void VBoxVMSettingsSystem::textChangedRAM (const QString &aText)
-{
-    mSlMemory->setValue (aText.toInt());
-}
-
-void VBoxVMSettingsSystem::moveBootItemUp()
-{
-    QTreeWidgetItem *item = mTwBootOrder->currentItem();
-    Assert (item);
-    if (!mTwBootOrder->itemAbove (item))
-        return;
-
-    int index = mTwBootOrder->indexOfTopLevelItem (item);
-    QTreeWidgetItem *takenItem = mTwBootOrder->takeTopLevelItem (index);
-    Assert (takenItem == item);
-
-    mTwBootOrder->insertTopLevelItem (index - 1, takenItem);
-    mTwBootOrder->setCurrentItem (item);
-
-    emit tableChanged();
-}
-
-void VBoxVMSettingsSystem::moveBootItemDown()
-{
-    QTreeWidgetItem *item = mTwBootOrder->currentItem();
-    Assert (item);
-    if (!mTwBootOrder->itemBelow (item))
-        return;
-
-    int index = mTwBootOrder->indexOfTopLevelItem (item);
-    QTreeWidgetItem *takenItem = mTwBootOrder->takeTopLevelItem (index);
-    Assert (takenItem == item);
-
-    mTwBootOrder->insertTopLevelItem (index + 1, takenItem);
-    mTwBootOrder->setCurrentItem (item);
-
-    emit tableChanged();
-}
-
-void VBoxVMSettingsSystem::onCurrentBootItemChanged (QTreeWidgetItem *aItem,
-                                                     QTreeWidgetItem *)
-{
-    bool upEnabled   = aItem && mTwBootOrder->itemAbove (aItem);
-    bool downEnabled = aItem && mTwBootOrder->itemBelow (aItem);
-    if ((mTbBootItemUp->hasFocus() && !upEnabled) ||
-        (mTbBootItemDown->hasFocus() && !downEnabled))
-        mTwBootOrder->setFocus();
-    mTbBootItemUp->setEnabled (upEnabled);
-    mTbBootItemDown->setEnabled (downEnabled);
-}
-
-void VBoxVMSettingsSystem::adjustBootOrderTWSize()
-{
-    /* Calculate the optimal size of the tree widget & set it as fixed
-     * size. */
-
-    QAbstractItemView *iv = qobject_cast <QAbstractItemView*> (mTwBootOrder);
-
-    int h = 2 * mTwBootOrder->frameWidth();
-    int w = h;
-#ifdef Q_WS_MAC
-    int left, top, right, bottom;
-    mTwBootOrder->getContentsMargins (&left, &top, &right, &bottom);
-    h += top + bottom;
-    w += left + right;
-#else /* Q_WS_MAC */
-    w += 4;
-#endif /* Q_WS_MAC */
-    mTwBootOrder->setFixedSize (
-        iv->sizeHintForColumn (0) + w,
-        iv->sizeHintForRow (0) * mTwBootOrder->topLevelItemCount() + h);
-
-    /* Update the layout system */
-    if (mTabMotherboard->layout())
-    {
-        mTabMotherboard->layout()->activate();
-        mTabMotherboard->layout()->update();
-    }
-}
-
-void VBoxVMSettingsSystem::valueChangedCPU (int aVal)
-{
-    mLeCPU->setText (QString().setNum (aVal));
-}
-
-void VBoxVMSettingsSystem::textChangedCPU (const QString &aText)
-{
-    mSlCPU->setValue (aText.toInt());
-}
-
-bool VBoxVMSettingsSystem::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    if (!aObject->isWidgetType())
-        return QWidget::eventFilter (aObject, aEvent);
-
-    QWidget *widget = static_cast<QWidget*> (aObject);
-    if (widget->window() != window())
-        return QWidget::eventFilter (aObject, aEvent);
-
-    switch (aEvent->type())
-    {
-        case QEvent::FocusIn:
-        {
-            /* Boot Table */
-            if (widget == mTwBootOrder)
-            {
-                if (!mTwBootOrder->currentItem())
-                    mTwBootOrder->setCurrentItem (mTwBootOrder->topLevelItem (0));
-                else
-                    onCurrentBootItemChanged (mTwBootOrder->currentItem());
-                mTwBootOrder->currentItem()->setSelected (true);
-            }
-            else if (widget != mTbBootItemUp && widget != mTbBootItemDown)
-            {
-                if (mTwBootOrder->currentItem())
-                {
-                    mTwBootOrder->currentItem()->setSelected (false);
-                    mTbBootItemUp->setEnabled (false);
-                    mTbBootItemDown->setEnabled (false);
-                }
-            }
-            break;
-        }
-        default:
-            break;
-    }
-
-    return QWidget::eventFilter (aObject, aEvent);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsUSB.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsUSB.cpp	(revision 25170)
+++ 	(revision )
@@ -1,577 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsUSB class implementation
- */
-
-/*
- * Copyright (C) 2006-2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxVMSettingsUSB.h"
-#include "VBoxVMSettingsUSBFilterDetails.h"
-#include "QIWidgetValidator.h"
-#include "VBoxToolBar.h"
-#include "VBoxGlobal.h"
-
-#include <QHeaderView>
-
-inline static QString emptyToNull (const QString &str)
-{
-    return str.isEmpty() ? QString::null : str;
-}
-
-VBoxVMSettingsUSB::VBoxVMSettingsUSB (FilterType aType)
-    : mValidator (0)
-    , mType (aType)
-    , mUSBFilterListModified (false)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsUSB::setupUi (this);
-
-    /* Prepare actions */
-    mNewAction = new QAction (mTwFilters);
-    mAddAction = new QAction (mTwFilters);
-    mEdtAction = new QAction (mTwFilters);
-    mDelAction = new QAction (mTwFilters);
-    mMupAction = new QAction (mTwFilters);
-    mMdnAction = new QAction (mTwFilters);
-
-    mNewAction->setShortcut (QKeySequence ("Ins"));
-    mAddAction->setShortcut (QKeySequence ("Alt+Ins"));
-    mEdtAction->setShortcut (QKeySequence ("Ctrl+Return"));
-    mDelAction->setShortcut (QKeySequence ("Del"));
-    mMupAction->setShortcut (QKeySequence ("Ctrl+Up"));
-    mMdnAction->setShortcut (QKeySequence ("Ctrl+Down"));
-
-    mNewAction->setIcon (VBoxGlobal::iconSet (":/usb_new_16px.png",
-                                              ":/usb_new_disabled_16px.png"));
-    mAddAction->setIcon (VBoxGlobal::iconSet (":/usb_add_16px.png",
-                                              ":/usb_add_disabled_16px.png"));
-    mEdtAction->setIcon (VBoxGlobal::iconSet (":/usb_filter_edit_16px.png",
-                                              ":/usb_filter_edit_disabled_16px.png"));
-    mDelAction->setIcon (VBoxGlobal::iconSet (":/usb_remove_16px.png",
-                                              ":/usb_remove_disabled_16px.png"));
-    mMupAction->setIcon (VBoxGlobal::iconSet (":/usb_moveup_16px.png",
-                                              ":/usb_moveup_disabled_16px.png"));
-    mMdnAction->setIcon (VBoxGlobal::iconSet (":/usb_movedown_16px.png",
-                                              ":/usb_movedown_disabled_16px.png"));
-
-    /* Prepare menu and toolbar */
-    mMenu = new QMenu (mTwFilters);
-    mMenu->addAction (mNewAction);
-    mMenu->addAction (mAddAction);
-    mMenu->addSeparator();
-    mMenu->addAction (mEdtAction);
-    mMenu->addSeparator();
-    mMenu->addAction (mDelAction);
-    mMenu->addSeparator();
-    mMenu->addAction (mMupAction);
-    mMenu->addAction (mMdnAction);
-
-    /* Prepare toolbar */
-    VBoxToolBar *toolBar = new VBoxToolBar (mWtFilterHandler);
-    toolBar->setUsesTextLabel (false);
-    toolBar->setIconSize (QSize (16, 16));
-    toolBar->setOrientation (Qt::Vertical);
-    toolBar->addAction (mNewAction);
-    toolBar->addAction (mAddAction);
-    toolBar->addAction (mEdtAction);
-    toolBar->addAction (mDelAction);
-    toolBar->addAction (mMupAction);
-    toolBar->addAction (mMdnAction);
-    toolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
-    toolBar->updateGeometry();
-    toolBar->setMinimumHeight (toolBar->sizeHint().height());
-    mWtFilterHandler->layout()->addWidget (toolBar);
-
-    /* Setup connections */
-    connect (mGbUSB, SIGNAL (toggled (bool)),
-             this, SLOT (usbAdapterToggled (bool)));
-    connect (mTwFilters, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
-             this, SLOT (currentChanged (QTreeWidgetItem*, QTreeWidgetItem*)));
-    connect (mTwFilters, SIGNAL (customContextMenuRequested (const QPoint &)),
-             this, SLOT (showContextMenu (const QPoint &)));
-    connect (mTwFilters, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),
-             this, SLOT (edtClicked()));
-    connect (mTwFilters, SIGNAL (itemChanged (QTreeWidgetItem *, int)),
-             this, SLOT (markSettingsChanged()));
-
-    mUSBDevicesMenu = new VBoxUSBMenu (this);
-    connect (mUSBDevicesMenu, SIGNAL (triggered (QAction*)),
-             this, SLOT (addConfirmed (QAction *)));
-    connect (mNewAction, SIGNAL (triggered (bool)),
-             this, SLOT (newClicked()));
-    connect (mAddAction, SIGNAL (triggered (bool)),
-             this, SLOT (addClicked()));
-    connect (mEdtAction, SIGNAL (triggered (bool)),
-             this, SLOT (edtClicked()));
-    connect (mDelAction, SIGNAL (triggered (bool)),
-             this, SLOT (delClicked()));
-    connect (mMupAction, SIGNAL (triggered (bool)),
-             this, SLOT (mupClicked()));
-    connect (mMdnAction, SIGNAL (triggered (bool)),
-             this, SLOT (mdnClicked()));
-
-    /* Setup dialog */
-    mTwFilters->header()->hide();
-
-    /* Applying language settings */
-    retranslateUi();
-}
-
-void VBoxVMSettingsUSB::getFrom (const CSystemProperties &, const VBoxGlobalSettings &)
-{
-    mGbUSB->setVisible (false);
-
-    CHostUSBDeviceFilterVector filtvec = vboxGlobal().virtualBox().GetHost()
-                                        .GetUSBDeviceFilters();
-    for (int i = 0; i < filtvec.size(); ++i)
-    {
-        CHostUSBDeviceFilter hostFilter = filtvec[i];
-        CUSBDeviceFilter filter (hostFilter);
-        addUSBFilter (filter, false /* isNew */);
-    }
-
-    mTwFilters->setCurrentItem (mTwFilters->topLevelItem (0));
-    currentChanged (mTwFilters->currentItem());
-
-    mUSBFilterListModified = false;
-}
-
-void VBoxVMSettingsUSB::putBackTo (CSystemProperties &, VBoxGlobalSettings &)
-{
-    CHost host = vboxGlobal().virtualBox().GetHost();
-
-    if (mUSBFilterListModified)
-    {
-        /* First, remove all old filters */
-        for (ulong count = host.GetUSBDeviceFilters().size(); count; -- count)
-            host.RemoveUSBDeviceFilter (0);
-
-        /* Then add all new filters */
-        for (int i = 0; i < mFilters.size(); ++ i)
-        {
-            CUSBDeviceFilter filter = mFilters [i];
-            filter.SetActive (mTwFilters->topLevelItem (i)->
-                checkState (0) == Qt::Checked);
-            CHostUSBDeviceFilter insertedFilter (filter);
-            host.InsertUSBDeviceFilter (host.GetUSBDeviceFilters().size(),
-                                        insertedFilter);
-        }
-    }
-
-    mUSBFilterListModified = false;
-}
-
-void VBoxVMSettingsUSB::getFrom (const CMachine &aMachine)
-{
-    mMachine = aMachine;
-
-    CUSBController ctl = aMachine.GetUSBController();
-    mGbUSB->setChecked (!ctl.isNull() && ctl.GetEnabled());
-    mCbUSB2->setChecked (!ctl.isNull() && ctl.GetEnabledEhci());
-    usbAdapterToggled (mGbUSB->isChecked());
-
-    if (!ctl.isNull())
-    {
-        CUSBDeviceFilterVector filtvec = ctl.GetDeviceFilters();
-        for (int i = 0; i < filtvec.size(); ++i)
-            addUSBFilter (filtvec[i], false /* isNew */);
-    }
-
-    mTwFilters->setCurrentItem (mTwFilters->topLevelItem (0));
-    currentChanged (mTwFilters->currentItem());
-
-    mUSBFilterListModified = false;
-}
-
-void VBoxVMSettingsUSB::putBackTo()
-{
-    CUSBController ctl = mMachine.GetUSBController();
-    if (!ctl.isNull())
-    {
-        ctl.SetEnabled (mGbUSB->isChecked());
-        ctl.SetEnabledEhci (mCbUSB2->isChecked());
-
-        if (mUSBFilterListModified)
-        {
-            /* First, remove all old filters */
-            for (ulong count = ctl.GetDeviceFilters().size(); count; -- count)
-                ctl.RemoveDeviceFilter (0);
-
-            /* Then add all new filters */
-            for (int i = 0; i < mFilters.size(); ++ i)
-            {
-                CUSBDeviceFilter filter = mFilters [i];
-                filter.SetActive (mTwFilters->topLevelItem (i)->
-                    checkState (0) == Qt::Checked);
-                ctl.InsertDeviceFilter (~0, filter);
-            }
-        }
-    }
-    mUSBFilterListModified = false;
-}
-
-void VBoxVMSettingsUSB::setValidator (QIWidgetValidator *aVal)
-{
-    mValidator = aVal;
-}
-
-void VBoxVMSettingsUSB::setOrderAfter (QWidget *aWidget)
-{
-    setTabOrder (aWidget, mGbUSB);
-    setTabOrder (mGbUSB, mCbUSB2);
-    setTabOrder (mCbUSB2, mTwFilters);
-}
-
-void VBoxVMSettingsUSB::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsUSB::retranslateUi (this);
-
-    mNewAction->setText (tr ("&Add Empty Filter"));
-    mAddAction->setText (tr ("A&dd Filter From Device"));
-    mEdtAction->setText (tr ("&Edit Filter"));
-    mDelAction->setText (tr ("&Remove Filter"));
-    mMupAction->setText (tr ("&Move Filter Up"));
-    mMdnAction->setText (tr ("M&ove Filter Down"));
-
-    mNewAction->setToolTip (mNewAction->text().remove ('&') +
-        QString (" (%1)").arg (mNewAction->shortcut().toString()));
-    mAddAction->setToolTip (mAddAction->text().remove ('&') +
-        QString (" (%1)").arg (mAddAction->shortcut().toString()));
-    mEdtAction->setToolTip (mEdtAction->text().remove ('&') +
-        QString (" (%1)").arg (mEdtAction->shortcut().toString()));
-    mDelAction->setToolTip (mDelAction->text().remove ('&') +
-        QString (" (%1)").arg (mDelAction->shortcut().toString()));
-    mMupAction->setToolTip (mMupAction->text().remove ('&') +
-        QString (" (%1)").arg (mMupAction->shortcut().toString()));
-    mMdnAction->setToolTip (mMdnAction->text().remove ('&') +
-        QString (" (%1)").arg (mMdnAction->shortcut().toString()));
-
-    mNewAction->setWhatsThis (tr ("Adds a new USB filter with all fields "
-                                  "initially set to empty strings. Note "
-                                  "that such a filter will match any "
-                                  "attached USB device."));
-    mAddAction->setWhatsThis (tr ("Adds a new USB filter with all fields "
-                                  "set to the values of the selected USB "
-                                  "device attached to the host PC."));
-    mEdtAction->setWhatsThis (tr ("Edits the selected USB filter."));
-    mDelAction->setWhatsThis (tr ("Removes the selected USB filter."));
-    mMupAction->setWhatsThis (tr ("Moves the selected USB filter up."));
-    mMdnAction->setWhatsThis (tr ("Moves the selected USB filter down."));
-
-    mUSBFilterName = tr ("New Filter %1", "usb");
-}
-
-void VBoxVMSettingsUSB::usbAdapterToggled (bool aOn)
-{
-    mGbUSBFilters->setEnabled (aOn);
-}
-
-void VBoxVMSettingsUSB::currentChanged (QTreeWidgetItem *aItem,
-                                        QTreeWidgetItem *)
-{
-    /* Make sure only the current item if present => selected */
-    if (mTwFilters->selectedItems().count() != 1 ||
-        mTwFilters->selectedItems() [0] != aItem)
-    {
-        QList<QTreeWidgetItem*> list = mTwFilters->selectedItems();
-        for (int i = 0; i < list.size(); ++ i)
-            list [i]->setSelected (false);
-        if (aItem)
-            aItem->setSelected (true);
-    }
-
-    /* Enable/disable operational buttons */
-    mEdtAction->setEnabled (aItem);
-    mDelAction->setEnabled (aItem);
-    mMupAction->setEnabled (aItem && mTwFilters->itemAbove (aItem));
-    mMdnAction->setEnabled (aItem && mTwFilters->itemBelow (aItem));
-}
-
-void VBoxVMSettingsUSB::newClicked()
-{
-    /* Search for the max available filter index */
-    int maxFilterIndex = 0;
-    QRegExp regExp (QString ("^") + mUSBFilterName.arg ("([0-9]+)") + QString ("$"));
-    QTreeWidgetItemIterator iterator (mTwFilters);
-    while (*iterator)
-    {
-        QString filterName = (*iterator)->text (0);
-        int pos = regExp.indexIn (filterName);
-        if (pos != -1)
-            maxFilterIndex = regExp.cap (1).toInt() > maxFilterIndex ?
-                             regExp.cap (1).toInt() : maxFilterIndex;
-        ++ iterator;
-    }
-
-    /* Creating new usb filter */
-    CUSBDeviceFilter filter;
-
-    if (mType == HostType)
-    {
-        CHost host = vboxGlobal().virtualBox().GetHost();
-        CHostUSBDeviceFilter hostFilter = host
-            .CreateUSBDeviceFilter (mUSBFilterName.arg (maxFilterIndex + 1));
-        hostFilter.SetAction (KUSBDeviceFilterAction_Hold);
-        filter = hostFilter;
-    }
-    else if (mType == MachineType)
-    {
-        CUSBController ctl = mMachine.GetUSBController();
-        if (ctl.isNull())
-            return;
-        filter = ctl.CreateDeviceFilter (mUSBFilterName.arg (maxFilterIndex + 1));
-    }
-    else
-    {
-        AssertMsgFailed (("Invalid VBoxVMSettingsUSB type"));
-    }
-
-    filter.SetActive (true);
-    addUSBFilter (filter, true /* isNew */);
-
-    mUSBFilterListModified = true;
-}
-
-void VBoxVMSettingsUSB::addClicked()
-{
-    mUSBDevicesMenu->exec (QCursor::pos());
-}
-
-void VBoxVMSettingsUSB::addConfirmed (QAction *aAction)
-{
-    CUSBDevice usb = mUSBDevicesMenu->getUSB (aAction);
-    /* if null then some other item but a USB device is selected */
-    if (usb.isNull())
-        return;
-
-    /* Creating new usb filter */
-    CUSBDeviceFilter filter;
-
-    if (mType == HostType)
-    {
-        CHost host = vboxGlobal().virtualBox().GetHost();
-        CHostUSBDeviceFilter hostFilter = host
-            .CreateUSBDeviceFilter (vboxGlobal().details (usb));
-        hostFilter.SetAction (KUSBDeviceFilterAction_Hold);
-        filter = hostFilter;
-    }
-    else if (mType == MachineType)
-    {
-        CUSBController ctl = mMachine.GetUSBController();
-        if (ctl.isNull())
-            return;
-        filter = ctl.CreateDeviceFilter (vboxGlobal().details (usb));
-    }
-    else
-    {
-        AssertMsgFailed (("Invalid VBoxVMSettingsUSB type"));
-    }
-
-    filter.SetVendorId (QString().sprintf ("%04hX", usb.GetVendorId()));
-    filter.SetProductId (QString().sprintf ("%04hX", usb.GetProductId()));
-    filter.SetRevision (QString().sprintf ("%04hX", usb.GetRevision()));
-    /* The port property depends on the host computer rather than on the USB
-     * device itself; for this reason only a few people will want to use it
-     * in the filter since the same device plugged into a different socket
-     * will not match the filter in this case. */
-#if 0
-    /// @todo set it anyway if Alt is currently pressed
-    filter.SetPort (QString().sprintf ("%04hX", usb.GetPort()));
-#endif
-    filter.SetManufacturer (usb.GetManufacturer());
-    filter.SetProduct (usb.GetProduct());
-    filter.SetSerialNumber (usb.GetSerialNumber());
-    filter.SetRemote (usb.GetRemote() ? "yes" : "no");
-
-    filter.SetActive (true);
-    addUSBFilter (filter, true /* isNew */);
-
-    mUSBFilterListModified = true;
-}
-
-void VBoxVMSettingsUSB::edtClicked()
-{
-    QTreeWidgetItem *item = mTwFilters->currentItem();
-    Assert (item);
-
-    VBoxVMSettingsUSBFilterDetails fd (mType, this);
-
-    CUSBDeviceFilter filter =
-        mFilters [mTwFilters->indexOfTopLevelItem (item)];
-
-    fd.mLeName->setText (filter.isNull() ? QString::null : filter.GetName());
-    fd.mLeVendorID->setText (filter.isNull() ? QString::null : filter.GetVendorId());
-    fd.mLeProductID->setText (filter.isNull() ? QString::null : filter.GetProductId());
-    fd.mLeRevision->setText (filter.isNull() ? QString::null : filter.GetRevision());
-    fd.mLePort->setText (filter.isNull() ? QString::null : filter.GetPort());
-    fd.mLeManufacturer->setText (filter.isNull() ? QString::null : filter.GetManufacturer());
-    fd.mLeProduct->setText (filter.isNull() ? QString::null : filter.GetProduct());
-    fd.mLeSerialNo->setText (filter.isNull() ? QString::null : filter.GetSerialNumber());
-
-    switch (mType)
-    {
-        case MachineType:
-        {
-            QString remote = filter.isNull() ? QString::null : filter.GetRemote().toLower();
-            if (remote == "yes" || remote == "true" || remote == "1")
-                fd.mCbRemote->setCurrentIndex (ModeOn);
-            else if (remote == "no" || remote == "false" || remote == "0")
-                fd.mCbRemote->setCurrentIndex (ModeOff);
-            else
-                fd.mCbRemote->setCurrentIndex (ModeAny);
-            break;
-        }
-        case HostType:
-        {
-            CHostUSBDeviceFilter hostFilter (filter);
-            KUSBDeviceFilterAction action = hostFilter.isNull() ?
-                KUSBDeviceFilterAction_Ignore : hostFilter.GetAction();
-            if (action == KUSBDeviceFilterAction_Ignore)
-                fd.mCbAction->setCurrentIndex (0);
-            else if (action == KUSBDeviceFilterAction_Hold)
-                fd.mCbAction->setCurrentIndex (1);
-            else
-                AssertMsgFailed (("Invalid USBDeviceFilterAction type"));
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed (("Invalid VBoxVMSettingsUSB type"));
-            break;
-        }
-    }
-
-    if (fd.exec() == QDialog::Accepted)
-    {
-        filter.SetName (fd.mLeName->text().isEmpty() ? QString::null : fd.mLeName->text());
-        item->setText (0, fd.mLeName->text());
-        filter.SetVendorId (fd.mLeVendorID->text().isEmpty() ? QString::null : fd.mLeVendorID->text());
-        filter.SetProductId (fd.mLeProductID->text().isEmpty() ? QString::null : fd.mLeProductID->text());
-        filter.SetRevision (fd.mLeRevision->text().isEmpty() ? QString::null : fd.mLeRevision->text());
-        filter.SetManufacturer (fd.mLeManufacturer->text().isEmpty() ? QString::null : fd.mLeManufacturer->text());
-        filter.SetProduct (fd.mLeProduct->text().isEmpty() ? QString::null : fd.mLeProduct->text());
-        filter.SetSerialNumber (fd.mLeSerialNo->text().isEmpty() ? QString::null : fd.mLeSerialNo->text());
-        filter.SetPort (fd.mLePort->text().isEmpty() ? QString::null : fd.mLePort->text());
-        if (mType == MachineType)
-        {
-            switch (fd.mCbRemote->currentIndex())
-             {
-                 case ModeAny: filter.SetRemote (QString::null); break;
-                 case ModeOn:  filter.SetRemote ("yes"); break;
-                 case ModeOff: filter.SetRemote ("no"); break;
-                 default: AssertMsgFailed (("Invalid combo box index"));
-             }
-        }
-        else
-        if (mType == HostType)
-        {
-            CHostUSBDeviceFilter hostFilter (filter);
-            hostFilter.SetAction (vboxGlobal().toUSBDevFilterAction (fd.mCbAction->currentText()));
-        }
-        item->setToolTip (0, vboxGlobal().toolTip (filter));
-    }
-}
-
-void VBoxVMSettingsUSB::delClicked()
-{
-    QTreeWidgetItem *item = mTwFilters->currentItem();
-    Assert (item);
-    int index = mTwFilters->indexOfTopLevelItem (item);
-
-    delete item;
-    mFilters.removeAt (index);
-
-    /* Setup validators */
-    if (!mTwFilters->topLevelItemCount())
-    {
-        if (mValidator)
-        {
-            mValidator->rescan();
-            mValidator->revalidate();
-        }
-    }
-
-    currentChanged (mTwFilters->currentItem());
-    mUSBFilterListModified = true;
-}
-
-void VBoxVMSettingsUSB::mupClicked()
-{
-    QTreeWidgetItem *item = mTwFilters->currentItem();
-    Assert (item);
-
-    int index = mTwFilters->indexOfTopLevelItem (item);
-    QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem (index);
-    Assert (item == takenItem);
-    mTwFilters->insertTopLevelItem (index - 1, takenItem);
-    mFilters.swap (index, index - 1);
-
-    mTwFilters->setCurrentItem (takenItem);
-    mUSBFilterListModified = true;
-}
-
-void VBoxVMSettingsUSB::mdnClicked()
-{
-    QTreeWidgetItem *item = mTwFilters->currentItem();
-    Assert (item);
-
-    int index = mTwFilters->indexOfTopLevelItem (item);
-    QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem (index);
-    Assert (item == takenItem);
-    mTwFilters->insertTopLevelItem (index + 1, takenItem);
-    mFilters.swap (index, index + 1);
-
-    mTwFilters->setCurrentItem (takenItem);
-    mUSBFilterListModified = true;
-}
-
-void VBoxVMSettingsUSB::showContextMenu (const QPoint &aPos)
-{
-    mMenu->exec (mTwFilters->mapToGlobal (aPos));
-}
-
-void VBoxVMSettingsUSB::markSettingsChanged()
-{
-    mUSBFilterListModified = true;
-}
-
-void VBoxVMSettingsUSB::addUSBFilter (const CUSBDeviceFilter &aFilter,
-                                      bool isNew)
-{
-    QTreeWidgetItem *currentItem = isNew ?
-        mTwFilters->currentItem() :
-        mTwFilters->topLevelItem (mTwFilters->topLevelItemCount() - 1);
-
-    int pos = currentItem ? mTwFilters->indexOfTopLevelItem (currentItem) : -1;
-    mFilters.insert (pos + 1, aFilter);
-
-    QTreeWidgetItem *item = pos >= 0 ?
-        new QTreeWidgetItem (mTwFilters, mTwFilters->topLevelItem (pos)) :
-        new QTreeWidgetItem (mTwFilters);
-    item->setCheckState (0, aFilter.GetActive() ? Qt::Checked : Qt::Unchecked);
-    item->setText (0, aFilter.GetName());
-    item->setToolTip (0, vboxGlobal().toolTip (aFilter));
-
-    if (isNew)
-        mTwFilters->setCurrentItem (item);
-
-    if (mValidator)
-        mValidator->revalidate();
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsUSBFilterDetails.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsUSBFilterDetails.cpp	(revision 25170)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMSettingsUSBFilterDetails class implementation
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxVMSettingsUSBFilterDetails.h"
-#include "VBoxGlobal.h"
-
-VBoxVMSettingsUSBFilterDetails::VBoxVMSettingsUSBFilterDetails (VBoxVMSettingsUSB::FilterType aType, QWidget *aParent /* = NULL */)
-    : QIWithRetranslateUI2<QIDialog> (aParent, Qt::Sheet)
-    , mType (aType)
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMSettingsUSBFilterDetails::setupUi (this);
-
-    mCbRemote->insertItem (VBoxVMSettingsUSB::ModeAny, ""); /* Any */
-    mCbRemote->insertItem (VBoxVMSettingsUSB::ModeOn,  ""); /* Yes */
-    mCbRemote->insertItem (VBoxVMSettingsUSB::ModeOff, ""); /* No */
-    mLbRemote->setHidden (mType != VBoxVMSettingsUSB::MachineType);
-    mCbRemote->setHidden (mType != VBoxVMSettingsUSB::MachineType);
-
-    mCbAction->insertItem (0, ""); /* KUSBDeviceFilterAction_Ignore */
-    mCbAction->insertItem (1, ""); /* KUSBDeviceFilterAction_Hold */
-    mLbAction->setHidden (mType != VBoxVMSettingsUSB::HostType);
-    mCbAction->setHidden (mType != VBoxVMSettingsUSB::HostType);
-
-    mLeName->setValidator (new QRegExpValidator (QRegExp (".+"), this));
-    mLeVendorID->setValidator (new QRegExpValidator (QRegExp ("[0-9a-fA-F]{0,4}"), this));
-    mLeProductID->setValidator (new QRegExpValidator (QRegExp ("[0-9a-fA-F]{0,4}"), this));
-    mLeRevision->setValidator (new QRegExpValidator (QRegExp ("[0-9]{0,4}"), this));
-    mLePort->setValidator (new QRegExpValidator (QRegExp ("[0-9]*"), this));
-
-    /* Applying language settings */
-    retranslateUi();
-
-    resize (minimumSize());
-    setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
-}
-
-void VBoxVMSettingsUSBFilterDetails::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMSettingsUSBFilterDetails::retranslateUi (this);
-
-    mCbRemote->setItemText (VBoxVMSettingsUSB::ModeAny, tr ("Any", "remote"));
-    mCbRemote->setItemText (VBoxVMSettingsUSB::ModeOn,  tr ("Yes", "remote"));
-    mCbRemote->setItemText (VBoxVMSettingsUSB::ModeOff, tr ("No",  "remote"));
-
-    mCbAction->setItemText (0,
-        vboxGlobal().toString (KUSBDeviceFilterAction_Ignore));
-    mCbAction->setItemText (1,
-        vboxGlobal().toString (KUSBDeviceFilterAction_Hold));
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxWarningPane.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxWarningPane.cpp	(revision 25170)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxWarningPane class implementation
- */
-
-/*
- * Copyright (C) 2009 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-/* Global includes */
-#include <QHBoxLayout>
-
-/* Local includes */
-#include "VBoxWarningPane.h"
-#include "VBoxGlobal.h"
-
-VBoxWarningPane::VBoxWarningPane(QWidget *pParent)
-    : QWidget(pParent)
-{
-    QHBoxLayout *pLayout = new QHBoxLayout(this);
-    VBoxGlobal::setLayoutMargin(pLayout, 0);
-    pLayout->addWidget(&m_icon);
-    pLayout->addWidget(&m_label);
-    setVisible(false);
-}
-
-void VBoxWarningPane::setWarningPixmap(const QPixmap &imgPixmap)
-{
-    m_icon.setPixmap (imgPixmap);
-}
-
-void VBoxWarningPane::setWarningText(const QString &strText)
-{
-    m_label.setText (strText);
-}
-
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxX11Helper.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxX11Helper.cpp	(revision 25170)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * X11 helpers.
- */
-
-/*
- * Copyright (C) 2008 Sun Microsystems, Inc.
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
- * Clara, CA 95054 USA or visit http://www.sun.com if you need
- * additional information or have any questions.
- */
-
-#include "VBoxX11Helper.h"
-
-#include <iprt/cdefs.h>
-#include <QX11Info>
-
-/* rhel3 build hack */
-RT_C_DECLS_BEGIN
-#include <X11/Xlib.h>
-#include <X11/extensions/dpms.h>
-RT_C_DECLS_END
-
-static int  gX11ScreenSaverTimeout;
-static BOOL gX11ScreenSaverDpmsAvailable;
-static BOOL gX11DpmsState;
-
-/**
- * Init the screen saver save/restore mechanism.
- */
-void X11ScreenSaverSettingsInit()
-{
-    int     dummy;
-    Display *display = QX11Info::display();
-    gX11ScreenSaverDpmsAvailable =
-        DPMSQueryExtension(display, &dummy, &dummy);
-}
-
-/**
- * Actually this is a big mess. By default the libSDL disables the screen
- * saver during the SDL_InitSubSystem() call and restores the saved settings
- * during the SDL_QuitSubSystem() call. This mechanism can be disabled by
- * setting the environment variable SDL_VIDEO_ALLOW_SCREENSAVER to 1. However,
- * there is a known bug in the Debian libSDL: If this environment variable is
- * set, the screen saver is still disabled but the old state is not restored
- * during SDL_QuitSubSystem()! So the only solution to overcome this problem
- * is to save and restore the state prior and after each of these function
- * calls.
- */
-void X11ScreenSaverSettingsSave()
-{
-    int     dummy;
-    CARD16  dummy2;
-    Display *display = QX11Info::display();
-
-    XGetScreenSaver(display, &gX11ScreenSaverTimeout, &dummy, &dummy, &dummy);
-    if (gX11ScreenSaverDpmsAvailable)
-        DPMSInfo(display, &dummy2, &gX11DpmsState);
-}
-
-/**
- * Restore previously saved screen saver settings.
- */
-void X11ScreenSaverSettingsRestore()
-{
-    int     timeout, interval, preferBlank, allowExp;
-    Display *display = QX11Info::display();
-
-    XGetScreenSaver(display, &timeout, &interval, &preferBlank, &allowExp);
-    timeout = gX11ScreenSaverTimeout;
-    XSetScreenSaver(display, timeout, interval, preferBlank, allowExp);
-
-    if (gX11DpmsState && gX11ScreenSaverDpmsAvailable)
-        DPMSEnable(display);
-}
Index: trunk/src/VBox/Frontends/VirtualBox/src/X11/VBoxX11Helper.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/X11/VBoxX11Helper.cpp	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/X11/VBoxX11Helper.cpp	(revision 25171)
@@ -0,0 +1,85 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * X11 helpers.
+ */
+
+/*
+ * Copyright (C) 2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#include "VBoxX11Helper.h"
+
+#include <iprt/cdefs.h>
+#include <QX11Info>
+
+/* rhel3 build hack */
+RT_C_DECLS_BEGIN
+#include <X11/Xlib.h>
+#include <X11/extensions/dpms.h>
+RT_C_DECLS_END
+
+static int  gX11ScreenSaverTimeout;
+static BOOL gX11ScreenSaverDpmsAvailable;
+static BOOL gX11DpmsState;
+
+/**
+ * Init the screen saver save/restore mechanism.
+ */
+void X11ScreenSaverSettingsInit()
+{
+    int     dummy;
+    Display *display = QX11Info::display();
+    gX11ScreenSaverDpmsAvailable =
+        DPMSQueryExtension(display, &dummy, &dummy);
+}
+
+/**
+ * Actually this is a big mess. By default the libSDL disables the screen
+ * saver during the SDL_InitSubSystem() call and restores the saved settings
+ * during the SDL_QuitSubSystem() call. This mechanism can be disabled by
+ * setting the environment variable SDL_VIDEO_ALLOW_SCREENSAVER to 1. However,
+ * there is a known bug in the Debian libSDL: If this environment variable is
+ * set, the screen saver is still disabled but the old state is not restored
+ * during SDL_QuitSubSystem()! So the only solution to overcome this problem
+ * is to save and restore the state prior and after each of these function
+ * calls.
+ */
+void X11ScreenSaverSettingsSave()
+{
+    int     dummy;
+    CARD16  dummy2;
+    Display *display = QX11Info::display();
+
+    XGetScreenSaver(display, &gX11ScreenSaverTimeout, &dummy, &dummy, &dummy);
+    if (gX11ScreenSaverDpmsAvailable)
+        DPMSInfo(display, &dummy2, &gX11DpmsState);
+}
+
+/**
+ * Restore previously saved screen saver settings.
+ */
+void X11ScreenSaverSettingsRestore()
+{
+    int     timeout, interval, preferBlank, allowExp;
+    Display *display = QX11Info::display();
+
+    XGetScreenSaver(display, &timeout, &interval, &preferBlank, &allowExp);
+    timeout = gX11ScreenSaverTimeout;
+    XSetScreenSaver(display, timeout, interval, preferBlank, allowExp);
+
+    if (gX11DpmsState && gX11ScreenSaverDpmsAvailable)
+        DPMSEnable(display);
+}
Index: trunk/src/VBox/Frontends/VirtualBox/src/X11/VBoxX11Helper.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/X11/VBoxX11Helper.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/X11/VBoxX11Helper.h	(revision 25171)
@@ -0,0 +1,30 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBox X11 helper functions
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBoxX11Helpers_h__
+#define __VBoxX11Helpers_h__
+
+void X11ScreenSaverSettingsInit();
+void X11ScreenSaverSettingsSave();
+void X11ScreenSaverSettingsRestore();
+
+#endif
Index: trunk/src/VBox/Frontends/VirtualBox/src/X11/XKeyboard.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/X11/XKeyboard.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/X11/XKeyboard.h	(revision 25171)
@@ -0,0 +1,38 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Declarations of Linux-specific keyboard functions
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __XKeyboard_h__
+#define __XKeyboard_h__
+
+#include <QString>
+
+// initialize the X keyboard subsystem
+void initMappedX11Keyboard(Display *pDisplay, QString remapScancodes);
+// our custom keyboard handler
+unsigned handleXKeyEvent(XEvent *event);
+// returns the number of keysyms per keycode (only valid after initXKeyboard())
+int getKeysymsPerKeycode();
+// Called after release logging is started, in case initXKeyboard wishes to log
+// anything
+void doXKeyboardLogging(Display *dpy);
+
+#endif // __XKeyboard_h__
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/AbstractDockIconPreview.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/AbstractDockIconPreview.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/AbstractDockIconPreview.h	(revision 25171)
@@ -0,0 +1,82 @@
+/* $Id$ */
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Abstract class for the dock icon preview
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___AbstractVBoxDockIconPreview_h___
+#define ___AbstractVBoxDockIconPreview_h___
+
+/* System includes */
+#include <ApplicationServices/ApplicationServices.h>
+
+/* VBox includes */
+#include "VBoxUtils-darwin.h"
+
+class VBoxConsoleWnd;
+class VBoxFrameBuffer;
+
+class QPixmap;
+
+class AbstractDockIconPreview
+{
+public:
+    AbstractDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);
+    virtual ~AbstractDockIconPreview() {};
+
+    virtual void updateDockOverlay() = 0;
+    virtual void updateDockPreview (CGImageRef aVMImage) = 0;
+    virtual void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);
+
+    virtual void setOriginalSize (int /* aWidth */, int /* aHeight */) {}
+};
+
+class AbstractDockIconPreviewHelper
+{
+public:
+    AbstractDockIconPreviewHelper (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);
+    virtual ~AbstractDockIconPreviewHelper();
+    void initPreviewImages();
+    inline CGImageRef stateImage() const;
+    void drawOverlayIcons (CGContextRef aContext);
+
+    /* Flipping is necessary cause the drawing context in Carbon is flipped by 180 degree */
+    inline CGRect flipRect (CGRect aRect) const { return ::darwinFlipCGRect (aRect, mDockIconRect); }
+    inline CGRect centerRect (CGRect aRect) const { return ::darwinCenterRectTo (aRect, mDockIconRect); }
+    inline CGRect centerRectTo (CGRect aRect, const CGRect& aToRect) const { return ::darwinCenterRectTo (aRect, aToRect); }
+
+    /* Private member vars */
+    VBoxConsoleWnd *mMainWnd;
+    const CGRect mDockIconRect;
+
+    CGImageRef mOverlayImage;
+    CGImageRef mDockMonitor;
+    CGImageRef mDockMonitorGlossy;
+
+    CGImageRef mStatePaused;
+    CGImageRef mStateSaving;
+    CGImageRef mStateRestoring;
+
+    CGRect mUpdateRect;
+    CGRect mMonitorRect;
+};
+
+#endif /* ___AbstractVBoxDockIconPreview_h___ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/CarbonDockIconPreview.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/CarbonDockIconPreview.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/CarbonDockIconPreview.h	(revision 25171)
@@ -0,0 +1,48 @@
+/* $Id$ */
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * CarbonDockIconPreview class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___CarbonDockIconPreview_h___
+#define ___CarbonDockIconPreview_h___
+
+/* VBox includes */
+#include "AbstractDockIconPreview.h"
+
+class CarbonDockIconPreview: public AbstractDockIconPreview, protected AbstractDockIconPreviewHelper
+{
+public:
+    CarbonDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);
+    ~CarbonDockIconPreview();
+
+    virtual void updateDockOverlay();
+    virtual void updateDockPreview (CGImageRef aVMImage);
+    virtual void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);
+
+private:
+    inline void initOverlayData (int aBitmapByteCount);
+    void updateDockPreviewImpl (CGContextRef aContext, CGImageRef aVMImage);
+
+    void *mBitmapData;
+};
+
+#endif /* ___CarbonDockIconPreview_h___ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/CocoaDockIconPreview.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/CocoaDockIconPreview.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/CocoaDockIconPreview.h	(revision 25171)
@@ -0,0 +1,49 @@
+/* $Id$ */
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * CocoaDockIconPreview class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___CocoaDockIconPreview_h___
+#define ___CocoaDockIconPreview_h___
+
+/* Qt includes */
+#include "AbstractDockIconPreview.h"
+
+class CocoaDockIconPreviewPrivate;
+
+class CocoaDockIconPreview: public AbstractDockIconPreview
+{
+public:
+    CocoaDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);
+    ~CocoaDockIconPreview();
+
+    virtual void updateDockOverlay();
+    virtual void updateDockPreview (CGImageRef aVMImage);
+    virtual void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);
+
+    virtual void setOriginalSize (int aWidth, int aHeight);
+
+private:
+    CocoaDockIconPreviewPrivate *d;
+};
+
+#endif /* ___CocoaDockIconPreview_h___ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/DarwinKeyboard.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/DarwinKeyboard.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/DarwinKeyboard.h	(revision 25171)
@@ -0,0 +1,56 @@
+/** @file
+ * Common GUI Library - Darwin Keyboard routines.
+ *
+ * @todo Move this up somewhere so that the two SDL GUIs can use this code too.
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+
+#ifndef ___DarwinKeyboard_h___
+#define ___DarwinKeyboard_h___
+
+#include <iprt/cdefs.h>
+#include <CoreFoundation/CFBase.h>
+
+RT_C_DECLS_BEGIN
+
+/** Private hack for missing rightCmdKey enum. */
+#define kEventKeyModifierRightCmdKeyMask (1<<27)
+
+/** The scancode mask. */
+#define VBOXKEY_SCANCODE_MASK       0x007f
+/** Extended key. */
+#define VBOXKEY_EXTENDED            0x0080
+/** Modifier key. */
+#define VBOXKEY_MODIFIER            0x0400
+/** Lock key (like num lock and caps lock). */
+#define VBOXKEY_LOCK                0x0800
+
+unsigned DarwinKeycodeToSet1Scancode(unsigned uKeyCode);
+UInt32   DarwinAdjustModifierMask(UInt32 fModifiers, const void *pvCocoaEvent);
+unsigned DarwinModifierMaskToSet1Scancode(UInt32 fModifiers);
+unsigned DarwinModifierMaskToDarwinKeycode(UInt32 fModifiers);
+UInt32   DarwinKeyCodeToDarwinModifierMask(unsigned uKeyCode);
+void     DarwinDisableGlobalHotKeys(bool fDisable);
+void     DarwinGrabKeyboard(bool fGlobalHotkeys);
+void     DarwinReleaseKeyboard(void);
+
+RT_C_DECLS_END
+
+#endif
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/DockIconPreview.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/DockIconPreview.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/DockIconPreview.h	(revision 25171)
@@ -0,0 +1,50 @@
+/* $Id$ */
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxDockIconPreview class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___VBoxDockIconPreview_h___
+#define ___VBoxDockIconPreview_h___
+
+#ifdef QT_MAC_USE_COCOA
+
+#include "CocoaDockIconPreview.h"
+class VBoxDockIconPreview: public CocoaDockIconPreview
+{
+public:
+    VBoxDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage)
+      : CocoaDockIconPreview (aMainWnd, aOverlayImage) {}
+};
+
+#else /* QT_MAC_USE_COCOA */
+
+#include "CarbonDockIconPreview.h"
+class VBoxDockIconPreview: public CarbonDockIconPreview
+{
+public:
+    VBoxDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage)
+      : CarbonDockIconPreview (aMainWnd, aOverlayImage) {}
+};
+
+#endif /* QT_MAC_USE_COCOA */
+
+#endif /* !___VBoxDockIconPreview_h___ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxAquaStyle.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxAquaStyle.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxAquaStyle.h	(revision 25171)
@@ -0,0 +1,92 @@
+/** $Id: $ */
+/** @file
+ * Qt GUI - VBox Variation on the QAquaStyle.
+ */
+
+/*
+ * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+
+#ifndef ___VBoxAquaStyle_h___
+#define ___VBoxAquaStyle_h___
+
+#include <qstyle.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <Q3PopupMenu>
+
+/**
+ * The VirtualBox QAquaStyle overrider.
+ *
+ * The purpose of this class is to make some small adjustments to
+ * the QAquaStyle so it looks and works better.
+ *
+ * Since the QAquaStyle class isn't exported we have to do all the
+ * virtual method work our selves. This also means we doesn't have
+ * access to any protected or QAquaStyle methods, too bad.
+ */
+class VBoxAquaStyle : public QStyle //QAquaStyle - not exported, sigh.
+{
+public:
+    VBoxAquaStyle(QStyle *parent);
+    VBoxAquaStyle(QStyle &parent);
+    virtual ~VBoxAquaStyle();
+    static VBoxAquaStyle &instance();
+
+    // The QStyle implementation.
+    virtual void polish( QWidget *w );
+    virtual void unPolish( QWidget *w );
+    virtual void polish( QApplication *app );
+    virtual void unPolish( QApplication *app );
+    virtual void polish( QPalette &p );
+    virtual void polishPopupMenu( Q3PopupMenu *m );
+    virtual QRect itemRect( QPainter *p, const QRect &r, int flags, bool enabled, const QPixmap *pixmap,
+                            const QString &text, int len = -1 ) const;
+    virtual void drawItem( QPainter *p, const QRect &r, int flags, const QColorGroup &g, bool enabled,
+                           const QPixmap *pixmap, const QString &text, int len = -1, const QColor *penColor = 0 ) const;
+    virtual void drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg,
+                                SFlags flags = Style_Default, const QStyleOption &foo = QStyleOption::Default ) const;
+    virtual void drawControl( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg,
+                              SFlags how = Style_Default, const QStyleOption &foo = QStyleOption::Default ) const;
+    virtual void drawControlMask( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r,
+                                  const QStyleOption &foo = QStyleOption::Default ) const;
+    virtual QRect subRect( SubRect r, const QWidget *widget ) const;
+    virtual int pixelMetric( PixelMetric metric, const QWidget *widget = 0 ) const;
+    virtual QSize sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentsSize,
+                                    const QStyleOption &foo = QStyleOption::Default ) const;
+    virtual int styleHint( StyleHint stylehint, const QWidget *widget = 0, const QStyleOption &foo = QStyleOption::Default,
+                           QStyleHintReturn* returnData = 0 ) const;
+    virtual QPixmap stylePixmap( StylePixmap stylepixmap, const QWidget *widget = 0, const QStyleOption &foo = QStyleOption::Default ) const;
+    virtual void drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r,
+                                     const QColorGroup &cg, SFlags how = Style_Default, SCFlags sub = (uint)SC_All,
+                                     SCFlags subActive = SC_None, const QStyleOption &foo = QStyleOption::Default ) const;
+    virtual void drawComplexControlMask( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r,
+                                         const QStyleOption &foo = QStyleOption::Default ) const;
+    virtual QRect querySubControlMetrics( ComplexControl control, const QWidget *widget, SubControl sc,
+                                          const QStyleOption &foo = QStyleOption::Default ) const;
+    virtual SubControl querySubControl( ComplexControl control, const QWidget *widget, const QPoint &pos,
+                                        const QStyleOption &foo = QStyleOption::Default ) const;
+
+protected:
+    /** The style we're overloading. */
+    QStyle *mparent;
+
+    /** The global instance. */
+    static VBoxAquaStyle *sInstance;
+};
+
+#endif
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaHelper.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaHelper.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaHelper.h	(revision 25171)
@@ -0,0 +1,103 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxCocoa Helper
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___darwin_VBoxCocoaHelper_h
+#define ___darwin_VBoxCocoaHelper_h
+
+/* Macro which add a typedef of the given Cocoa class in an appropriate form
+ * for the current context. This means void* in the C/CPP context and
+ * NSWhatever* in the ObjC/ObjCPP context. Use NativeNSWhateverRef when you
+ * reference the Cocoa type somewhere. The use of this prevents extensive
+ * casting of void* to the right type in the Cocoa context. */
+#ifdef __OBJC__
+#define ADD_COCOA_NATIVE_REF(CocoaClass) \
+@class CocoaClass; \
+typedef CocoaClass *Native##CocoaClass##Ref
+#else /* __OBJC__ */
+#define ADD_COCOA_NATIVE_REF(CocoaClass) typedef void *Native##CocoaClass##Ref
+#endif /* __OBJC__ */
+
+#ifdef __OBJC__
+
+/* System includes */
+#import <AppKit/NSImage.h>
+#import <Foundation/NSAutoreleasePool.h>
+#import <CoreFoundation/CFString.h>
+
+/* Qt includes */
+#include <QString>
+#include <QVarLengthArray>
+
+inline NSString *darwinQStringToNSString (const QString &aString)
+{
+    return [reinterpret_cast<const NSString *>(CFStringCreateWithCharacters (0, reinterpret_cast<const UniChar *> (aString.unicode()),
+                                                                             aString.length())) autorelease];
+}
+
+inline QString darwinNSStringToQString (const NSString *aString)
+{
+    CFStringRef str = reinterpret_cast<const CFStringRef> (aString);
+    if(!str)
+        return QString();
+    CFIndex length = CFStringGetLength (str);
+    const UniChar *chars = CFStringGetCharactersPtr (str);
+    if (chars)
+        return QString (reinterpret_cast<const QChar *> (chars), length);
+
+    QVarLengthArray<UniChar> buffer (length);
+    CFStringGetCharacters (str, CFRangeMake (0, length), buffer.data());
+    return QString (reinterpret_cast<const QChar *> (buffer.constData()), length);
+}
+
+inline NSImage *darwinCGImageToNSImage (const CGImageRef aImage)
+{
+    /* Create a bitmap rep from the image. */
+    NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:aImage];
+    /* Create an NSImage and add the bitmap rep to it */
+    NSImage *image = [[NSImage alloc] init];
+    [image addRepresentation:bitmapRep];
+    [bitmapRep release];
+    return image;
+}
+
+/* Helper class for automatic creation & destroying of a cocoa auto release
+   pool. */
+class CocoaAutoreleasePool
+{
+public:
+    inline CocoaAutoreleasePool()
+    {
+         mPool = [[NSAutoreleasePool alloc] init];
+    }
+    inline ~CocoaAutoreleasePool()
+    {
+        [mPool release];
+    }
+
+private:
+    NSAutoreleasePool *mPool;
+};
+
+#endif /* __OBJC__ */
+
+#endif /* ___darwin_VBoxCocoaHelper_h */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaSpecialControls.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaSpecialControls.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaSpecialControls.h	(revision 25171)
@@ -0,0 +1,117 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxCocoaSpecialControls class declaration
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___darwin_VBoxCocoaSpecialControls_h__
+#define ___darwin_VBoxCocoaSpecialControls_h__
+
+/* VBox includes */
+#include "VBoxCocoaHelper.h"
+
+/* Qt includes */
+#include <QMacCocoaViewContainer>
+
+/* Add typedefs for Cocoa types */
+ADD_COCOA_NATIVE_REF (NSButton);
+ADD_COCOA_NATIVE_REF (NSSegmentedControl);
+ADD_COCOA_NATIVE_REF (NSSearchField);
+
+class VBoxCocoaButton: public QMacCocoaViewContainer
+{
+    Q_OBJECT;
+
+public:
+    enum CocoaButtonType
+    {
+        HelpButton,
+        CancelButton
+    };
+
+    VBoxCocoaButton (CocoaButtonType aType, QWidget *aParent = 0);
+    QSize sizeHint() const;
+
+    void setText (const QString& aText);
+    void setToolTip (const QString& aTip);
+
+    void onClicked();
+
+signals:
+    void clicked (bool checked = false);
+
+private:
+    /* Private member vars */
+    NativeNSButtonRef mNativeRef;
+};
+
+class VBoxCocoaSegmentedButton: public QMacCocoaViewContainer
+{
+    Q_OBJECT;
+
+public:
+    VBoxCocoaSegmentedButton (int aCount, QWidget *aParent = 0);
+    QSize sizeHint() const;
+
+    void setTitle (int aSegment, const QString &aTitle);
+
+    void setToolTip (int aSegment, const QString &aTip);
+
+    void setEnabled (int aSegment, bool fEnabled);
+
+    void animateClick (int aSegment);
+
+    void onClicked (int aSegment);
+
+signals:
+    void clicked (int aSegment, bool aChecked = false);
+
+private:
+    /* Private member vars */
+    NativeNSSegmentedControlRef mNativeRef;
+};
+
+class VBoxCocoaSearchField: public QMacCocoaViewContainer
+{
+    Q_OBJECT;
+
+public:
+    VBoxCocoaSearchField (QWidget* aParent = 0);
+    QSize sizeHint() const;
+
+    QString text() const;
+    void insert (const QString &aText);
+    void setToolTip (const QString &aTip);
+    void selectAll();
+
+    void markError();
+    void unmarkError();
+
+    void onTextChanged (const QString &aText);
+
+signals:
+    void textChanged (const QString& aText);
+
+private:
+    /* Private member vars */
+    NativeNSSearchFieldRef mNativeRef;
+};
+
+#endif /* ___darwin_VBoxCocoaSpecialControls_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxIChatTheaterWrapper.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxIChatTheaterWrapper.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxIChatTheaterWrapper.h	(revision 25171)
@@ -0,0 +1,39 @@
+/* $Id$ */
+/** @file
+ * Qt GUI - iChat Theater cocoa wrapper.
+ */
+
+/*
+ * Copyright (C) 2008 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___VBoxIChatTheaterWrapper_h
+#define ___VBoxIChatTheaterWrapper_h
+
+#if defined (Q_WS_MAC) && defined (VBOX_WITH_ICHAT_THEATER)
+
+# include <ApplicationServices/ApplicationServices.h>
+
+RT_C_DECLS_BEGIN
+
+void initSharedAVManager();
+void setImageRef (CGImageRef aImage);
+
+RT_C_DECLS_END
+
+#endif
+
+#endif
+
Index: trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.h	(revision 25171)
+++ trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.h	(revision 25171)
@@ -0,0 +1,259 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Declarations of utility classes and functions for handling Darwin specific
+ * tasks
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef ___VBoxUtils_darwin_h
+#define ___VBoxUtils_darwin_h
+
+/*
+ * Here is some really magic in. The "OS System native" methods are implemented
+ * in the current OS specific way. This means either Carbon
+ * (VBoxUtils-darwin-carbon.cpp) or Cocoa (VBoxUtils-darwin-cocoa.m). The Qt
+ * wrapper methods handle the conversion from Q* data types to the native one
+ * (VBoxUtils-darwin.cpp).
+ */
+
+#ifdef __OBJC__
+#import <AppKit/NSWindow.h>
+
+typedef NSWindow *NativeWindowRef;
+typedef NSView *NativeViewRef;
+#else
+
+# include <qglobal.h> /* for QT_MAC_USE_COCOA */
+
+# include <ApplicationServices/ApplicationServices.h>
+
+class QWidget;
+class QToolBar;
+class QPixmap;
+class QImage;
+
+# ifdef QT_MAC_USE_COCOA
+/* Cast this to void, cause Cocoa classes aren't usable in the C++ context. */
+typedef void *NativeWindowRef;
+typedef void *NativeViewRef;
+# else /* QT_MAC_USE_COCOA */
+#  include <Carbon/Carbon.h>
+typedef WindowRef NativeWindowRef;
+typedef HIViewRef NativeViewRef;
+# endif /* QT_MAC_USE_COCOA */
+#endif /* __OBJC__ */
+
+#include <iprt/cdefs.h> /* for RT_C_DECLS_BEGIN/RT_C_DECLS_END & stuff */
+#include <QRect>
+
+RT_C_DECLS_BEGIN
+
+/********************************************************************************
+ *
+ * Window/View management (OS System native)
+ *
+ ********************************************************************************/
+NativeWindowRef darwinToNativeWindowImpl (NativeViewRef aView);
+NativeViewRef darwinToNativeViewImpl (NativeWindowRef aWindow);
+
+/********************************************************************************
+ *
+ * Simple setter methods (OS System native)
+ *
+ ********************************************************************************/
+void darwinSetShowsToolbarButtonImpl (NativeWindowRef aWindow, bool aEnabled);
+void darwinSetShowsResizeIndicatorImpl (NativeWindowRef aWindow, bool aEnabled);
+void darwinSetHidesAllTitleButtonsImpl (NativeWindowRef aWindow);
+void darwinSetShowsWindowTransparentImpl (NativeWindowRef aWindow, bool aEnabled);
+void darwinSetMouseCoalescingEnabled (bool aEnabled);
+
+/********************************************************************************
+ *
+ * Simple helper methods (OS System native)
+ *
+ ********************************************************************************/
+void darwinWindowAnimateResizeImpl (NativeWindowRef aWindow, int x, int y, int width, int height);
+void darwinWindowInvalidateShapeImpl (NativeWindowRef aWindow);
+void darwinWindowInvalidateShadowImpl (NativeWindowRef aWindow);
+int  darwinWindowToolBarHeight (NativeWindowRef aWindow);
+float darwinSmallFontSize();
+
+RT_C_DECLS_END
+
+DECLINLINE(CGRect) darwinToCGRect (const QRect& aRect) { return CGRectMake (aRect.x(), aRect.y(), aRect.width(), aRect.height()); }
+DECLINLINE(CGRect) darwinFlipCGRect (CGRect aRect, int aTargetHeight) { aRect.origin.y = aTargetHeight - aRect.origin.y - aRect.size.height; return aRect; }
+DECLINLINE(CGRect) darwinFlipCGRect (CGRect aRect, const CGRect &aTarget) { return darwinFlipCGRect (aRect, aTarget.size.height); }
+DECLINLINE(CGRect) darwinCenterRectTo (CGRect aRect, const CGRect& aToRect)
+{
+    aRect.origin.x = aToRect.origin.x + (aToRect.size.width  - aRect.size.width)  / 2.0;
+    aRect.origin.y = aToRect.origin.y + (aToRect.size.height - aRect.size.height) / 2.0;
+    return aRect;
+}
+
+
+#ifndef __OBJC__
+/********************************************************************************
+ *
+ * Window/View management (Qt Wrapper)
+ *
+ ********************************************************************************/
+
+/**
+ * Returns a reference to the native View of the QWidget.
+ *
+ * @returns either HIViewRef or NSView* of the QWidget.
+ * @param   aWidget   Pointer to the QWidget
+ */
+NativeViewRef darwinToNativeView (QWidget *aWidget);
+
+/**
+ * Returns a reference to the native Window of the QWidget.
+ *
+ * @returns either WindowRef or NSWindow* of the QWidget.
+ * @param   aWidget   Pointer to the QWidget
+ */
+NativeWindowRef darwinToNativeWindow (QWidget *aWidget);
+
+/* This is necessary because of the C calling convention. Its a simple wrapper
+   for darwinToNativeWindowImpl to allow operator overloading which isn't
+   allowed in C. */
+/**
+ * Returns a reference to the native Window of the View..
+ *
+ * @returns either WindowRef or NSWindow* of the View.
+ * @param   aWidget   Pointer to the native View
+ */
+NativeWindowRef darwinToNativeWindow (NativeViewRef aView);
+
+/**
+ * Returns a reference to the native View of the Window.
+ *
+ * @returns either HIViewRef or NSView* of the Window.
+ * @param   aWidget   Pointer to the native Window
+ */
+NativeViewRef darwinToNativeView (NativeWindowRef aWindow);
+
+/********************************************************************************
+ *
+ * Simple setter methods (Qt Wrapper)
+ *
+ ********************************************************************************/
+void darwinSetShowsToolbarButton (QToolBar *aToolBar, bool aEnabled);
+void darwinSetShowsResizeIndicator (QWidget *aWidget, bool aEnabled);
+void darwinSetHidesAllTitleButtons (QWidget *aWidget);
+void darwinSetShowsWindowTransparent (QWidget *aWidget, bool aEnabled);
+void darwinDisableIconsInMenus (void);
+
+/********************************************************************************
+ *
+ * Simple helper methods (Qt Wrapper)
+ *
+ ********************************************************************************/
+void darwinWindowAnimateResize (QWidget *aWidget, const QRect &aTarget);
+void darwinWindowInvalidateShape (QWidget *aWidget);
+void darwinWindowInvalidateShadow (QWidget *aWidget);
+int  darwinWindowToolBarHeight (QWidget *aWidget);
+QString darwinSystemLanguage (void);
+QPixmap darwinCreateDragPixmap (const QPixmap& aPixmap, const QString &aText);
+
+
+/********************************************************************************
+ *
+ * Graphics stuff (Qt Wrapper)
+ *
+ ********************************************************************************/
+/**
+ * Returns a reference to the CGContext of the QWidget.
+ *
+ * @returns CGContextRef of the QWidget.
+ * @param   aWidget      Pointer to the QWidget
+ */
+CGContextRef darwinToCGContextRef (QWidget *aWidget);
+
+CGImageRef darwinToCGImageRef (const QImage *aImage);
+CGImageRef darwinToCGImageRef (const QPixmap *aPixmap);
+CGImageRef darwinToCGImageRef (const char *aSource);
+
+
+
+
+
+/********************************************************************************
+ *
+ * Old carbon stuff. Have to be converted soon!
+ *
+ ********************************************************************************/
+
+#include <QWidget>
+
+# ifndef QT_MAC_USE_COCOA
+
+/* Asserts if a != noErr and prints the error code */
+#  ifdef RT_STRICT
+#   define AssertCarbonOSStatus(a) AssertMsg ((a) == noErr, ("Carbon OSStatus: %d\n", static_cast<int> (a)))
+#  else
+#   define AssertCarbonOSStatus(a) do { NOREF(a); } while (0)
+#  endif
+
+
+/**
+ * Converts a QRect to a HIRect.
+ *
+ * @returns HIRect for the converted QRect.
+ * @param   aRect  the QRect to convert
+ */
+DECLINLINE(HIRect) darwinToHIRect (const QRect &aRect)
+{
+    return CGRectMake (aRect.x(), aRect.y(), aRect.width(), aRect.height());
+}
+
+/* Experimental region handler for the seamless mode */
+OSStatus darwinRegionHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData);
+
+/* Handler for the OpenGL overlay window stuff & the possible messages. */
+enum
+{
+    /* Event classes */
+    kEventClassVBox         = 'vbox',
+    /* Event kinds */
+    kEventVBoxShowWindow    = 'swin',
+    kEventVBoxHideWindow    = 'hwin',
+    kEventVBoxMoveWindow    = 'mwin',
+    kEventVBoxResizeWindow  = 'rwin',
+    kEventVBoxDisposeWindow = 'dwin',
+    kEventVBoxUpdateDock    = 'udck',
+    kEventVBoxUpdateContext = 'uctx',
+    kEventVBoxBoundsChanged = 'bchg'
+};
+
+void PostBoundsChanged (const QRect& rect);
+OSStatus darwinOverlayWindowHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData);
+
+bool darwinIsMenuOpen (void);
+
+# endif /* !QT_MAC_USE_COCOA */
+
+# ifdef DEBUG
+void darwinDebugPrintEvent (const char *aPrefix, EventRef aEvent);
+# endif
+
+#endif /* !__OBJC__ */
+
+#endif /* !___VBoxUtils_darwin_h */
+
