Index: trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp	(revision 25211)
+++ trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp	(revision 25213)
@@ -1101,9 +1101,5 @@
         {
             rc = pCmd->rc;
-#ifdef DEBUG_misha
-            AssertMsg(RT_SUCCESS(rc), ("%Rrc\n", rc));
-#else
             AssertMsg(RT_SUCCESS(rc) || rc == VERR_NOT_IMPLEMENTED, ("%Rrc\n", rc));
-#endif
             if(rc == VERR_NOT_IMPLEMENTED)
             {
@@ -1133,9 +1129,5 @@
         {
             rc = pCmd->rc;
-#ifdef DEBUG_misha
-            AssertMsg(RT_SUCCESS(rc), ("%Rrc\n", rc));
-#else
             AssertMsg(RT_SUCCESS(rc) || rc == VERR_NOT_IMPLEMENTED, ("%Rrc\n", rc));
-#endif
             if (rc == VERR_NOT_IMPLEMENTED)
                 rc = VINF_SUCCESS;
Index: trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 25211)
+++ trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 25213)
@@ -241,4 +241,9 @@
  endif
 endif
+
+if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_GUI_USE_QGL)
+ VirtualBox_LDFLAGS.win += /DelayLoad:QtOpenGLVBox4.dll /DelayLoad:OPENGL32.dll
+endif
+
 # r=bird: what is -lz doing here? it belongs in LIBS.
 VirtualBox_LDFLAGS.darwin = -lz \
Index: trunk/src/VBox/Frontends/VirtualBox/include/AbstractDockIconPreview.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/AbstractDockIconPreview.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/AbstractDockIconPreview.h	(revision 25213)
@@ -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/include/CIShared.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/CIShared.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/CIShared.h	(revision 25213)
@@ -0,0 +1,412 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Common VirtualBox classes: CIShared 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 __CIShared_h__
+#define __CIShared_h__
+
+#ifdef VBOX_CHECK_STATE
+#include <stdio.h>
+#endif
+
+template< class D >
+class CIShared
+{
+    /** @internal
+     *
+     *  A class that derives the data structure managed by the CIShared template
+     *  (passed as a template parameter) for some internal purposes, such as the
+     *  reference count, etc. There is no need to use this class directly.
+     */
+    class Data : public D
+    {
+        enum { Orig = 0x01, Null = 0x02 };
+
+        Data() : cnt( 1 ), state( Orig ) {}
+        Data( const Data &d ) : D( d ), cnt( 1 ), state( d.state & (~Orig) ) {}
+        Data &operator=( const Data &d ) {
+            D::operator=( d );
+            state &= ~Orig;
+            return *this;
+        }
+        // a special constructor to create a null value
+        Data( void* ) : cnt( 1 ), state( Null ) {}
+#ifdef VBOX_CHECK_STATE
+        virtual ~Data();
+        void ref();
+        bool deref();
+#else
+        virtual ~Data() {}
+        void ref() { cnt++; }
+        bool deref() { return !--cnt; }
+#endif // VBOX_CHECK_STATE
+
+        int cnt;
+        int state;
+
+        friend class CIShared<D>;
+    };
+
+public:
+    CIShared( bool null = true ) : d( null ? Null.d->ref(), Null.d : new Data() ) {}
+    CIShared( const CIShared &that ) : d( that.d ) { d->ref(); }
+    CIShared &operator=( const CIShared &that ) {
+        that.d->ref();
+        if ( d->deref() ) delete d;
+        d = that.d;
+        return *this;
+    }
+    virtual ~CIShared() { if ( d->deref() ) delete d; }
+
+    bool isOriginal() const { return (d->state != 0); }
+    bool isNull() const { return ((d->state & Data::Null) != 0); }
+
+    bool detach();
+    bool detachOriginal();
+
+    CIShared copy() const {
+        return isNull() ? CIShared( Null ) : CIShared( new Data( *d ) );
+    }
+
+    const D *data() const { return d; }
+    inline D *mData();
+
+    bool operator==( const CIShared &that ) const {
+        return (d == that.d) || (*d == *(that.d));
+    }
+
+    // convenience operators
+    const D *operator->() const { return data(); }
+    bool operator!() const { return isNull(); }
+
+private:
+    CIShared( Data *aData ) : d( aData ) {}
+    Data *d;
+
+    static CIShared Null;
+};
+
+/** @class CIShared
+ *
+ *  This template allows to implement the implicit sharing
+ *  semantics for user-defined data structures.
+ *
+ *  The template argument is a structure (or a class) whose objects
+ *  need to be implicitly shared by different pieces of code. A class
+ *  generated from this template acts as a wrapper for that structure
+ *  and provides a safe access (from the shared usage point of view) to its
+ *  members. Note that simple C++ types (such as int) cannot be used as
+ *  template arguments.
+ *
+ *  Implicit sharing means that instances of the generated class point to the
+ *  same data object of the managed structure until any one of them tries
+ *  to change it. When it happens that instane makes a deep copy of the object
+ *  (through its copy constructor) and does the actual change on that copy,
+ *  keeping the original data unchanged. This technique is also called
+ *  "copy on write". Also, any instance can excplicitly stop sharing the data
+ *  it references at any time by calling the detach() method directly, which
+ *  makes a copy if the data is referenced by more than one instance.
+ *
+ *  The read-only access to the managed data can be obtained using the
+ *  data() method that returns a pointer to the constant data of the type
+ *  used as a template argument. The pointer to the non-constant data
+ *  is returned by the mData() method, that automatically detaches the
+ *  instance if necessary. This method should be used with care, and only
+ *  when it is really necessary to change the data -- if you will use it for
+ *  the read-only access the implicit sharing will not work because every
+ *  instance will have its data detached.
+ *
+ *  To be able to be used with the VShared template the structure/class
+ *  must have public (or protected) constructors and a destructor. If it
+ *  doesn't contain pointers as its members then the two constructors
+ *  (the default and the copy constructor) and the destructor automatically
+ *  generated by the compiler are enough, there's no need to define them
+ *  explicitly. If the destructor is defined explicitly it must be
+ *  virtual.
+ *
+ *  The default constructor implemented by this template (it is actually
+ *  a constructor with one bool argument that defaults to false) creates
+ *  a null instance (i.e. its isNull() method returns false). All null
+ *  instances share the same internal data object (created by the default
+ *  constructor of the managed structure) and provide only a read-only access
+ *  to its members. This means that the mData() method of such an instance
+ *  will always return a null pointer and an attempt to access its members
+ *  through that pointer will most likely cause a memory access violation
+ *  exception. The template doesn't provide any other constructors (except
+ *  the copy constructor) because it doesn't know how to initialize the
+ *  object of the managed structure, so the only way to create a non-null
+ *  instance is to pass true to the constructor mentioned above.
+ *
+ *  It's a good practice not to use instantiations of this template directly
+ *  but derive them instead. This gives an opportunity to define necessary
+ *  constructors with arguments that initialize the managed structure, as
+ *  well as to define convenient methods to access structure members (instead
+ *  of defining them in the structure itself). For example:
+ *
+ *  @code
+ *
+ *  // a data structure
+ *  struct ACardData {
+ *      string name;
+ *      // commented out -- not so convenient:
+ *      // void setName( const string &n ) { name = n; }
+ *  }
+ *
+ *  // a wrapper
+ *  class ACard : publc CIShared< ACardData > {
+ *      ACardData() {}  // the default constructor should be visible
+ *      ACardData( const string &name ) :
+ *          CIShared< ACardData >( false ) // make non-null
+ *      {
+ *          mData()->name = name;
+ *      }
+ *      string name() const { return data()->name; }
+ *      void setName( const string &name ) { mData()->name = name; }
+ *  }
+ *
+ *  // ...
+ *  ACard c( "John" );
+ *  // ...
+ *  c.setName( "Ivan" );
+ *  // the above is shorter than c.data()->name or c.mData()->setName()
+ *
+ *  @endcode
+ *
+ *  If some members of the structure need to be private (and therefore
+ *  unaccessible through the pointers returned by data() and vData()) you can
+ *  simply declare the wrapper class (the ACard class in the example above)
+ *  as a friend of the structure and still use the above approach.
+ *
+ *  For public members of the original structure it's also possible to use
+ *  the overloaded operator->(), which is the equivalent of calling the data()
+ *  method, i.e.:
+ *
+ *  @code
+ *  // ...
+ *  cout << c->name;
+ *  @endcode
+ *
+ *  The operator!() is overloaded for convenience and is equivalent to the
+ *  isNull() method.
+ *
+ *  The operator==() makes a comparison of two instances.
+ *
+ *  @todo put the "original" state definition here...
+ */
+
+/** @internal
+ *
+ *  A special null value for internal usage. All null instances created
+ *  with the default constructor share the data object it contains.
+ */
+template< class D > CIShared<D> CIShared<D>::Null = CIShared( new Data( 0 ) );
+
+/** @fn CIShared::CIShared( bool null = true )
+ *
+ *  Creates a new instance. If the argument is true (which is the default)
+ *  a null instance is created. All null instances share the same data
+ *  object created using the default constructor of the managed structure
+ *  (i.e. specified as template argument when instantiating).
+ *
+ *  If the argument is false an empty instance is created. The empty instance
+ *  differs from the null instance such that the created data object is
+ *  initially non-shared and the mData() method returns a valid pointer
+ *  suitable for modifying the data.
+ *
+ *  The instance created by this constructor is initially original.
+ *
+ *  @see isNull, isOriginal
+ */
+
+/** @fn CIShared::CIShared( const CIShared & )
+ *
+ *  Creates a new instance and initializes it by a reference to the same data
+ *  object as managed by the argument. No copies of the data are created.
+ *  The created instance becomes null and/or original if the argument is null
+ *  and/or original, respectively.
+ *
+ *  @see isNull, isOriginal
+ */
+
+/** @fn CIShared::operator=( const CIShared & )
+ *
+ *  Assigns a new value to this instance by instructing it to refer to the
+ *  same data as managed by the argument. No copies of the data are created.
+ *  The previous data is automatically deleted if there are no more references
+ *  to it. The instance becomes null and/or original if the argument is null
+ *  and/or original, respectively.
+ */
+
+/** @fn CIShared::copy() const
+ *
+ *  Returns a "deep" copy of the instance. The returned instance always
+ *  contains its own (not yet shared) copy of the managed data, even if the
+ *  data wasn't shared before this call. The new copy becomes not original
+ *  if it is not null, otherwise it remains null.
+ *
+ *  @see isNull, isOriginal
+ */
+
+/** @fn CIShared::data() const
+ *
+ *  Returns a pointer to the object of the managed structure that is suitable
+ *  for a read-only access. Does <b>not</b> do an implicit detach(), the
+ *  data remains shared.
+ *
+ *  @see mData()
+ */
+
+/** @fn CIShared::operator==( const CIShared & ) const
+ *
+ *  Compares this instance and the argument. Two instances are considered
+ *  to be equal if they share the same data object or if data objects they
+ *  share are equal. Data objects are compared using the comparison operator
+ *  of the managed structure.
+ */
+
+/**
+ *  Detaches this instance from other instances it shares the data with by
+ *  making the copy of the data. This instance becomes "non-original". The
+ *  method does nothing and returns false if this instance is null or its
+ *  data is not shared among (referenced by) other instances.
+ *
+ *  @return true if it does a real detach and false otherwise.
+ *
+ *  @see isOriginal, isNull
+ */
+template< class D > bool CIShared<D>::detach() {
+    if ( !(d->state & Data::Null) && d->cnt > 1 ) {
+        d->deref();
+        d = new Data( *d );
+        return true;
+    }
+    return false;
+}
+
+/**
+ *  Detaches this instance from other instances it shares the data with by
+ *  making the copy of the data. This instance becomes "original" (even if
+ *  it wasn't original before a detach), all other instances that previously
+ *  shared the same data will become "non-original". The method does nothing
+ *  and returns false if this instance is null. If its data is not shared
+ *  among (referenced by) other instances it marks it as original and
+ *  also returns false.
+ *
+ *  @return true if it does a real detach and false otherwise.
+ *
+ *  @see isOriginal, isNull
+ */
+template< class D > bool CIShared<D>::detachOriginal() {
+    if ( !(d->state & Data::Null) ) {
+        if ( d->cnt > 1 ) {
+            d->deref();
+            d->state &= ~Data::Orig;
+            d = new Data( *d );
+            d->state |= Data::Orig;
+            return true;
+        }
+        d->state |= Data::Orig;
+    }
+    return false;
+}
+
+/** @fn CIShared::isOriginal() const
+ *
+ *  Returns true if the data is the original data and false otherwise.
+ *  The data is considered to be original until it is changed through the
+ *  mData() member or directly detached by detach(). Also, the data can be
+ *  made original at any time using the detachOriginal() method.
+ *
+ *  Note, that this method always returns true for null instances.
+ *
+ *  @see detachOriginal, isNull
+ */
+
+/** @fn CIShared::isNull() const
+ *
+ *  Returns true if this instance is a special null value. All null values
+ *  share the same data object created by the default constructor of
+ *  the managed structure. A null instance gives a read-only access to the
+ *  managed data.
+ *
+ *  @see vData
+ */
+
+/**
+ *  Returns a pointer to the object of the managed structure that is suitable
+ *  for modifying data. Does an implicit detach() if this data object is
+ *  referenced by more than one instance, making this instance non-original.
+ *
+ *  This method should be called only when it's really necessary to change
+ *  the data object, read-only access should be obtained using the data()
+ *  member. Otherwise there all data objects will be detached and non-shared.
+ *
+ *  @warning This method returns a null pointer for instances that are
+ *  null. Accessing data through that pointer will most likely cause a
+ *  memory access violation exception.
+ *
+ *  @see data, isNull, isOriginal
+ */
+template< class D > inline D *CIShared<D>::mData() {
+    if ( d->state & Data::Null ) {
+#ifdef VBOX_CHECK_STATE
+        printf( "CIShared::mData(): a null instance, returning a null pointer!" );
+#endif
+        return 0;
+    }
+    if ( d->cnt > 1 )
+        detach();
+    return d;
+}
+
+// CIShared<D>::Data debug methods
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef VBOX_CHECK_STATE
+
+template< class D > CIShared<D>::Data::~Data() {
+    if ( cnt )
+        printf( "~Data(): ref count is %d, but must be zero!\n", cnt );
+}
+
+template< class D > void CIShared<D>::Data::ref() {
+    if ( cnt <= 0 )
+        printf(
+            "Data::ref() ref count was %d, "
+            "but must be greater than zero!\n",
+            cnt
+        );
+    cnt++;
+}
+
+template< class D > bool CIShared<D>::Data::deref() {
+    if ( cnt <= 0 )
+        printf(
+            "Data::ref() ref count was %d, "
+            "but must be greater than zero!\n",
+            cnt
+        );
+    return !--cnt;
+}
+
+#endif // VBOX_CHECK_STATE
+
+#endif // __CIShared_h__
Index: trunk/src/VBox/Frontends/VirtualBox/include/COMDefs.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/COMDefs.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/COMDefs.h	(revision 25213)
@@ -0,0 +1,826 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Various COM definitions and COM wrapper class declarations
+ *
+ * This header is used in conjunction with the header generated from
+ * XIDL expressed interface definitions to provide cross-platform Qt-based
+ * interface wrapper classes.
+ */
+
+/*
+ * 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 __COMDefs_h__
+#define __COMDefs_h__
+
+/** @defgroup   grp_QT_COM  Qt-COM Support Layer
+ * @{
+ *
+ * The Qt-COM support layer provides a set of definitions and smart classes for
+ * writing simple, clean and platform-independent code to access COM/XPCOM
+ * components through exposed COM interfaces. This layer is based on the
+ * COM/XPCOM Abstraction Layer library (the VBoxCOM glue library defined in
+ * include/VBox/com and implemented in src/VBox/Main/glue).
+ *
+ * ...
+ *
+ * @defgroup   grp_QT_COM_arrays    Arrays
+ * @{
+ *
+ * COM/XPCOM arrays are mapped to QVector objects. QVector templates declared
+ * with a type that corresponds to the COM type of elements in the array using
+ * normal Qt-COM type mapping rules. Here is a code example that demonstrates
+ * how to call interface methods that take and return arrays (this example is
+ * based on examples given in @ref grp_COM_arrays):
+ * @code
+
+    CSomething component;
+
+    // ...
+
+    QVector <LONG> in (3);
+    in [0] = -1;
+    in [1] = -2;
+    in [2] = -3;
+
+    QVector <LONG> out;
+    QVector <LONG> ret;
+
+    ret = component.TestArrays (in, out);
+
+    for (size_t i = 0; i < ret.size(); ++ i)
+        LogFlow (("*** ret[%u]=%d\n", i, ret [i]));
+
+ * @endcode
+ * @}
+ */
+
+/* Both VBox/com/assert.h and qglobal.h contain a definition of ASSERT.
+ * Either of them can be already included here, so try to shut them up.  */
+#undef ASSERT
+
+#include <VBox/com/com.h>
+#include <VBox/com/array.h>
+#include <VBox/com/assert.h>
+
+#undef ASSERT
+
+/* Qt includes */
+#include <QString>
+#include <QUuid>
+#include <QVector>
+#include <QMetaType>
+
+#include <iprt/memory> // for auto_copy_ptr
+
+/*
+ * Additional COM / XPCOM defines and includes
+ */
+
+#if !defined (VBOX_WITH_XPCOM)
+
+#else /* !defined (VBOX_WITH_XPCOM) */
+
+#include <nsXPCOM.h>
+#include <nsMemory.h>
+#include <nsIComponentManager.h>
+
+class XPCOMEventQSocketListener;
+
+#endif /* !defined (VBOX_WITH_XPCOM) */
+
+
+/* VirtualBox interfaces declarations */
+#if !defined (VBOX_WITH_XPCOM)
+    #include <VirtualBox.h>
+#else /* !defined (VBOX_WITH_XPCOM) */
+    #include <VirtualBox_XPCOM.h>
+#endif /* !defined (VBOX_WITH_XPCOM) */
+
+#include "VBoxDefs.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+class CVirtualBoxErrorInfo;
+
+/** Represents extended error information */
+class COMErrorInfo
+{
+public:
+
+    COMErrorInfo()
+        : mIsNull (true)
+        , mIsBasicAvailable (false), mIsFullAvailable (false)
+        , mResultCode (S_OK) {}
+
+    COMErrorInfo (const CVirtualBoxErrorInfo &info) { init (info); }
+
+    /* the default copy ctor and assignment op are ok */
+
+    bool isNull() const { return mIsNull; }
+
+    bool isBasicAvailable() const { return mIsBasicAvailable; }
+    bool isFullAvailable() const { return mIsFullAvailable; }
+
+    HRESULT resultCode() const { return mResultCode; }
+    QUuid interfaceID() const { return mInterfaceID; }
+    QString component() const { return mComponent; }
+    QString text() const { return mText; }
+
+    const COMErrorInfo *next() const { return mNext.get(); }
+
+    QString interfaceName() const { return mInterfaceName; }
+    QUuid calleeIID() const { return mCalleeIID; }
+    QString calleeName() const { return mCalleeName; }
+
+private:
+
+    void init (const CVirtualBoxErrorInfo &info);
+    void fetchFromCurrentThread (IUnknown *callee, const GUID *calleeIID);
+
+    static QString getInterfaceNameFromIID (const QUuid &id);
+
+    bool mIsNull : 1;
+    bool mIsBasicAvailable : 1;
+    bool mIsFullAvailable : 1;
+
+    HRESULT mResultCode;
+    QUuid mInterfaceID;
+    QString mComponent;
+    QString mText;
+
+    cppx::auto_copy_ptr <COMErrorInfo> mNext;
+
+    QString mInterfaceName;
+    QUuid mCalleeIID;
+    QString mCalleeName;
+
+    friend class COMBaseWithEI;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Base COM class the CInterface template and all wrapper classes are derived
+ * from. Provides common functionality for all COM wrappers.
+ */
+class COMBase
+{
+public:
+
+    static HRESULT InitializeCOM();
+    static HRESULT CleanupCOM();
+
+    /**
+     * Returns the result code of the last interface method called by the
+     * wrapper instance or the result of CInterface::createInstance()
+     * operation.
+     */
+    HRESULT lastRC() const { return mRC; }
+
+#if !defined (VBOX_WITH_XPCOM)
+
+    /** Converts a GUID value to QUuid */
+    static QUuid ToQUuid (const GUID &id)
+    {
+        return QUuid (id.Data1, id.Data2, id.Data3,
+                      id.Data4[0], id.Data4[1], id.Data4[2], id.Data4[3],
+                      id.Data4[4], id.Data4[5], id.Data4[6], id.Data4[7]);
+    }
+
+#else /* !defined (VBOX_WITH_XPCOM) */
+
+    /** Converts a GUID value to QUuid */
+    static QUuid ToQUuid (const nsID &id)
+    {
+        return QUuid (id.m0, id.m1, id.m2,
+                      id.m3[0], id.m3[1], id.m3[2], id.m3[3],
+                      id.m3[4], id.m3[5], id.m3[6], id.m3[7]);
+    }
+
+#endif /* !defined (VBOX_WITH_XPCOM) */
+
+    /* Arrays of arbitrary types */
+
+    template <typename QT, typename CT>
+    static void ToSafeArray (const QVector <QT> &aVec, com::SafeArray <CT> &aArr)
+    {
+        aArr.reset (aVec.size());
+        for (int i = 0; i < aVec.size(); ++i)
+            aArr [i] = static_cast<CT> (aVec.at (i));
+    }
+
+    template <typename CT, typename QT>
+    static void FromSafeArray (const com::SafeArray <CT> &aArr, QVector <QT> &aVec)
+    {
+        aVec.resize (static_cast<int> (aArr.size()));
+        for (int i = 0; i < aVec.size(); ++i)
+            aVec [i] = static_cast<QT> (aArr [i]);
+    }
+
+    template <typename QT, typename CT>
+    static void ToSafeArray (const QVector <QT *> &aVec, com::SafeArray <CT *> &aArr)
+    {
+        Q_UNUSED (aVec);
+        Q_UNUSED (aArr);
+        AssertMsgFailedReturnVoid (("No conversion!\n"));
+    }
+
+    template <typename CT, typename QT>
+    static void FromSafeArray (const com::SafeArray <CT *> &aArr, QVector <QT *> &aVec)
+    {
+        Q_UNUSED (aArr);
+        Q_UNUSED (aVec);
+        AssertMsgFailedReturnVoid (("No conversion!\n"));
+    }
+
+    /* Arrays of equal types */
+
+    template <typename T>
+    static void ToSafeArray (const QVector <T> &aVec, com::SafeArray <T> &aArr)
+    {
+        aArr.reset (aVec.size());
+        for (int i = 0; i < aVec.size(); ++i)
+            aArr [i] = aVec.at (i);
+    }
+
+    template <typename T>
+    static void FromSafeArray (const com::SafeArray <T> &aArr, QVector <T> &aVec)
+    {
+        aVec.resize (static_cast<int> (aArr.size()));
+        for (int i = 0; i < aVec.size(); ++i)
+            aVec [i] = aArr [i];
+    }
+
+    /* Arrays of strings */
+
+    static void ToSafeArray (const QVector <QString> &aVec,
+                             com::SafeArray <BSTR> &aArr);
+    static void FromSafeArray (const com::SafeArray <BSTR> &aArr,
+                               QVector <QString> &aVec);
+
+    /* Arrays of GUID */
+
+    static void ToSafeArray (const QVector <QUuid> &aVec,
+                             com::SafeGUIDArray &aArr);
+    static void FromSafeArray (const com::SafeGUIDArray &aArr,
+                               QVector <QUuid> &aVec);
+
+    /* Arrays of enums. Does a cast similar to what ENUMOut does. */
+
+    template <typename QE, typename CE>
+    static void ToSafeArray (const QVector <QE> &aVec,
+                             com::SafeIfaceArray <CE> &aArr)
+    {
+        aArr.reset (static_cast <int> (aVec.size()));
+        for (int i = 0; i < aVec.size(); ++i)
+            aArr [i] = static_cast <CE> (aVec.at (i));
+    }
+
+    template <typename CE, typename QE>
+    static void FromSafeArray (const com::SafeIfaceArray <CE> &aArr,
+                               QVector <QE> &aVec)
+    {
+        aVec.resize (static_cast <int> (aArr.size()));
+        for (int i = 0; i < aVec.size(); ++i)
+            aVec [i] = static_cast <QE> (aArr [i]);
+    }
+
+    /* Arrays of interface pointers. Note: we need a separate pair of names
+     * only because the MSVC8 template matching algorithm is poor and tries to
+     * instantiate a com::SafeIfaceArray <BSTR> (!!!) template otherwise for
+     * *no* reason and fails. Note that it's also not possible to choose the
+     * correct function by specifying template arguments explicitly because then
+     * it starts to try to instantiate the com::SafeArray <I> template for
+     * *no* reason again and fails too. Definitely, broken. Works in GCC like a
+     * charm. */
+
+    template <class CI, class I>
+    static void ToSafeIfaceArray (const QVector <CI> &aVec,
+                                  com::SafeIfaceArray <I> &aArr)
+    {
+        aArr.reset (static_cast<int> (aVec.size()));
+        for (int i = 0; i < aVec.size(); ++i)
+        {
+            aArr [i] = aVec.at (i).raw();
+            if (aArr [i])
+                aArr [i]->AddRef();
+        }
+    }
+
+    template <class I, class CI>
+    static void FromSafeIfaceArray (const com::SafeIfaceArray <I> &aArr,
+                                    QVector <CI> &aVec)
+    {
+        aVec.resize (static_cast<int> (aArr.size()));
+        for (int i = 0; i < aVec.size(); ++i)
+            aVec [i].attach (aArr [i]);
+    }
+
+protected:
+
+    /* no arbitrary instance creations */
+    COMBase() : mRC (S_OK) {};
+
+#if defined (VBOX_WITH_XPCOM)
+    static XPCOMEventQSocketListener *sSocketListener;
+#endif
+
+    /** Adapter to pass QString as input BSTR params */
+    class BSTRIn
+    {
+    public:
+
+        BSTRIn (const QString &s) : bstr (SysAllocString ((const OLECHAR *)
+            (s.isNull() ? 0 : s.utf16()))) {}
+
+        ~BSTRIn()
+        {
+            if (bstr)
+                SysFreeString (bstr);
+        }
+
+        operator BSTR() const { return bstr; }
+
+    private:
+
+        BSTR bstr;
+    };
+
+    /** Adapter to pass QString as output BSTR params */
+    class BSTROut
+    {
+    public:
+
+        BSTROut (QString &s) : str (s), bstr (0) {}
+
+        ~BSTROut()
+        {
+            if (bstr) {
+                str = QString::fromUtf16 (bstr);
+                SysFreeString (bstr);
+            }
+        }
+
+        operator BSTR *() { return &bstr; }
+
+    private:
+
+        QString &str;
+        BSTR bstr;
+    };
+
+    /**
+     * Adapter to pass K* enums as output COM enum params (*_T).
+     *
+     * @param QE    K* enum.
+     * @param CE    COM enum.
+     */
+    template <typename QE, typename CE>
+    class ENUMOut
+    {
+    public:
+
+        ENUMOut (QE &e) : qe (e), ce ((CE) 0) {}
+        ~ENUMOut() { qe = (QE) ce; }
+        operator CE *() { return &ce; }
+
+    private:
+
+        QE &qe;
+        CE ce;
+    };
+
+#if !defined (VBOX_WITH_XPCOM)
+
+    /** Adapter to pass QUuid as input GUID params */
+    static GUID GUIDIn (const QUuid &uuid) { return uuid; }
+
+    /** Adapter to pass QUuid as output GUID params */
+    class GUIDOut
+    {
+    public:
+
+        GUIDOut (QUuid &id) : uuid (id)
+        {
+            ::memset (&guid, 0, sizeof (GUID));
+        }
+
+        ~GUIDOut()
+        {
+            uuid = QUuid (
+                guid.Data1, guid.Data2, guid.Data3,
+                guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
+                guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
+        }
+
+        operator GUID *() { return &guid; }
+
+    private:
+
+        QUuid &uuid;
+        GUID guid;
+    };
+
+#else /* !defined (VBOX_WITH_XPCOM) */
+
+    /** Adapter to pass QUuid as input GUID params */
+    static const nsID &GUIDIn (const QUuid &uuid)
+    {
+        return *(const nsID *) &uuid;
+    }
+
+    /** Adapter to pass QUuid as output GUID params */
+    class GUIDOut
+    {
+    public:
+
+        GUIDOut (QUuid &id) : uuid (id), nsid (0) {}
+
+        ~GUIDOut()
+        {
+            if (nsid)
+            {
+                uuid = QUuid (
+                    nsid->m0, nsid->m1, nsid->m2,
+                    nsid->m3[0], nsid->m3[1], nsid->m3[2], nsid->m3[3],
+                    nsid->m3[4], nsid->m3[5], nsid->m3[6], nsid->m3[7]);
+                nsMemory::Free (nsid);
+            }
+        }
+
+        operator nsID **() { return &nsid; }
+
+    private:
+
+        QUuid &uuid;
+        nsID *nsid;
+    };
+
+#endif /* !defined (VBOX_WITH_XPCOM) */
+
+    static void addref (IUnknown *aIface) { if (aIface) aIface->AddRef(); }
+    static void release (IUnknown *aIface) { if (aIface) aIface->Release(); }
+
+protected:
+
+    mutable HRESULT mRC;
+
+    friend class COMErrorInfo;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Alternative base class for the CInterface template that adds the errorInfo()
+ * method for providing extended error info about unsuccessful invocation of the
+ * last called interface method.
+ */
+class COMBaseWithEI : public COMBase
+{
+public:
+
+    /**
+     * Returns error info set by the last unsuccessfully invoked interface
+     * method. Returned error info is useful only if CInterface::lastRC()
+     * represents a failure or a warning (i.e. CInterface::isReallyOk() is
+     * false).
+     */
+    const COMErrorInfo &errorInfo() const { return mErrInfo; }
+
+protected:
+
+    /* no arbitrary instance creation */
+    COMBaseWithEI() : COMBase () {};
+
+    void setErrorInfo (const COMErrorInfo &aErrInfo) { mErrInfo = aErrInfo; }
+
+    void fetchErrorInfo (IUnknown *aCallee, const GUID *aCalleeIID) const
+    {
+        mErrInfo.fetchFromCurrentThread (aCallee, aCalleeIID);
+    }
+
+    mutable COMErrorInfo mErrInfo;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Simple class that encapsulates the result code and COMErrorInfo.
+ */
+class COMResult
+{
+public:
+
+    COMResult() : mRC (S_OK) {}
+
+    /**
+     * Queries the current result code from the given component.
+     */
+    explicit COMResult (const COMBase &aComponent)
+        : mRC (aComponent.lastRC()) {}
+
+    /**
+     * Queries the current result code and error info from the given component.
+     */
+    COMResult (const COMBaseWithEI &aComponent)
+        : mRC (aComponent.lastRC())
+        , mErrInfo (aComponent.errorInfo()) {}
+
+    /**
+     * Queries the current result code from the given component.
+     */
+    COMResult &operator= (const COMBase &aComponent)
+    {
+        mRC = aComponent.lastRC();
+        return *this;
+    }
+
+    /**
+     * Queries the current result code and error info from the given component.
+     */
+    COMResult &operator= (const COMBaseWithEI &aComponent)
+    {
+        mRC = aComponent.lastRC();
+        mErrInfo = aComponent.errorInfo();
+        return *this;
+    }
+
+    bool isNull() const { return mErrInfo.isNull(); }
+
+    /**
+     * Returns @c true if the result code represents success (with or without
+     * warnings).
+     */
+    bool isOk() const { return SUCCEEDED (mRC); }
+
+    /**
+     * Returns @c true if the result code represents success with one or more
+     * warnings.
+     */
+    bool isWarning() const { return SUCCEEDED_WARNING (mRC); }
+
+    /**
+     * Returns @c true if the result code represents success with no warnings.
+     */
+    bool isReallyOk() const { return mRC == S_OK; }
+
+    COMErrorInfo errorInfo() const { return mErrInfo; }
+    HRESULT rc() const { return mRC; }
+
+private:
+
+    HRESULT mRC;
+    COMErrorInfo mErrInfo;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Wrapper template class for all interfaces.
+ *
+ * All interface methods named as they are in the original, i.e. starting
+ * with the capital letter. All utility non-interface methods are named
+ * starting with the small letter. Utility methods should be not normally
+ * called by the end-user client application.
+ *
+ * @param  I    Interface class (i.e. IUnknown/nsISupports derivant).
+ * @param  B    Base class, either COMBase (by default) or COMBaseWithEI.
+ */
+template <class I, class B = COMBase>
+class CInterface : public B
+{
+public:
+
+    typedef B Base;
+    typedef I Iface;
+
+    // constructors & destructor
+
+    CInterface() : mIface (NULL) {}
+
+    CInterface (const CInterface &that) : B (that), mIface (that.mIface)
+    {
+        addref (mIface);
+    }
+
+    CInterface (I *aIface) : mIface (aIface) { addref (mIface); }
+
+    virtual ~CInterface() { release (mIface); }
+
+    // utility methods
+
+    void createInstance (const CLSID &aClsId)
+    {
+        AssertMsg (!mIface, ("Instance is already non-NULL\n"));
+        if (!mIface)
+        {
+#if !defined (VBOX_WITH_XPCOM)
+
+            B::mRC = CoCreateInstance (aClsId, NULL, CLSCTX_ALL,
+                                       _ATL_IIDOF (I), (void **) &mIface);
+
+#else /* !defined (VBOX_WITH_XPCOM) */
+
+            nsCOMPtr <nsIComponentManager> manager;
+            B::mRC = NS_GetComponentManager (getter_AddRefs (manager));
+            if (SUCCEEDED (B::mRC))
+                B::mRC = manager->CreateInstance (aClsId, nsnull, NS_GET_IID (I),
+                                                  (void **) &mIface);
+
+#endif /* !defined (VBOX_WITH_XPCOM) */
+
+            /* fetch error info, but don't assert if it's missing -- many other
+             * reasons can lead to an error (w/o providing error info), not only
+             * the instance initialization code (that should always provide it) */
+            B::fetchErrorInfo (NULL, NULL);
+        }
+    }
+
+    /**
+     * Attaches to the given foreign interface pointer by querying the own
+     * interface on it. The operation may fail.
+     */
+    template <class OI>
+    void attach (OI *aIface)
+    {
+        /* be aware of self assignment */
+        addref (aIface);
+        release (mIface);
+        if (aIface)
+        {
+            mIface = NULL;
+#if !defined (VBOX_WITH_XPCOM)
+            B::mRC = aIface->QueryInterface (_ATL_IIDOF (I), (void **) &mIface);
+#else /* !defined (VBOX_WITH_XPCOM) */
+            B::mRC = aIface->QueryInterface (NS_GET_IID (I), (void **) &mIface);
+#endif /* !defined (VBOX_WITH_XPCOM) */
+        }
+        else
+        {
+            mIface = NULL;
+            B::mRC = S_OK;
+        }
+    };
+
+    /** Specialization of attach() for our own interface I. Never fails. */
+    void attach (I *aIface)
+    {
+        /* be aware of self assignment */
+        addref (aIface);
+        release (mIface);
+        mIface = aIface;
+        B::mRC = S_OK;
+    };
+
+    /** Detaches from the underlying interface pointer. */
+    void detach() { release (mIface); mIface = NULL; }
+
+    /** Returns @c true if not attached to any interface pointer. */
+    bool isNull() const { return mIface == NULL; }
+
+    /**
+     * Returns @c true if the result code represents success (with or without
+     * warnings).
+     */
+    bool isOk() const { return !isNull() && SUCCEEDED (B::mRC); }
+
+    /**
+     * Returns @c true if the result code represents success with one or more
+     * warnings.
+     */
+    bool isWarning() const { return !isNull() && SUCCEEDED_WARNING (B::mRC); }
+
+    /**
+     * Returns @c true if the result code represents success with no warnings.
+     */
+    bool isReallyOk() const { return !isNull() && B::mRC == S_OK; }
+
+    // utility operators
+
+    CInterface &operator= (const CInterface &that)
+    {
+        attach (that.mIface);
+        B::operator= (that);
+        return *this;
+    }
+
+    CInterface &operator= (I *aIface)
+    {
+        attach (aIface);
+        return *this;
+    }
+
+    /**
+     * Returns the raw interface pointer. Not intended to be used for anything
+     * else but in generated wrappers and for debugging. You've been warned.
+     */
+    I *raw() const { return mIface; }
+
+    bool operator== (const CInterface &that) const { return mIface == that.mIface; }
+    bool operator!= (const CInterface &that) const { return mIface != that.mIface; }
+
+protected:
+
+    mutable I *mIface;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+class CUnknown : public CInterface <IUnknown, COMBaseWithEI>
+{
+public:
+
+    typedef CInterface <IUnknown, COMBaseWithEI> Base;
+
+    CUnknown() {}
+
+    /** Creates an instance given another CInterface-based instance. */
+    template <class OI, class OB>
+    explicit CUnknown (const CInterface <OI, OB> &that)
+    {
+        attach (that.mIface);
+        if (SUCCEEDED (mRC))
+        {
+            /* preserve old error info if any */
+            mRC = that.lastRC();
+            setErrorInfo (that.errorInfo());
+        }
+    }
+
+    /** Constructor specialization for IUnknown. */
+    CUnknown (const CUnknown &that) : Base (that) {}
+
+    /** Creates an instance given a foreign interface pointer. */
+    template <class OI>
+    explicit CUnknown (OI *aIface)
+    {
+        attach (aIface);
+    }
+
+    /** Constructor specialization for IUnknown. */
+    explicit CUnknown (IUnknown *aIface) : Base (aIface) {}
+
+    /** Assigns from another CInterface-based instance. */
+    template <class OI, class OB>
+    CUnknown &operator= (const CInterface <OI, OB> &that)
+    {
+        attach (that.mIface);
+        if (SUCCEEDED (mRC))
+        {
+            /* preserve old error info if any */
+            mRC = that.lastRC();
+            setErrorInfo (that.errorInfo());
+        }
+        return *this;
+    }
+
+    /** Assignment specialization for CUnknown. */
+    CUnknown &operator= (const CUnknown &that)
+    {
+        Base::operator= (that);
+        return *this;
+    }
+
+    /** Assigns from a foreign interface pointer. */
+    template <class OI>
+    CUnknown &operator= (OI *aIface)
+    {
+        attach (aIface);
+        return *this;
+    }
+
+    /** Assignment specialization for IUnknown. */
+    CUnknown &operator= (IUnknown *aIface)
+    {
+        Base::operator= (aIface);
+        return *this;
+    }
+
+    /* @internal Used in generated wrappers. Never use directly. */
+    IUnknown *&rawRef() { return mIface; };
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+/* include the generated header containing concrete wrapper definitions */
+#include "COMWrappers.h"
+
+/** @} */
+
+#endif // __COMDefs_h__
Index: trunk/src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl	(revision 25213)
@@ -0,0 +1,1695 @@
+<?xml version="1.0"?>
+
+<!--
+/*
+ *  A template to generate wrapper classes for [XP]COM interfaces (defined
+ *  in XIDL) to use them in the main Qt-based GUI in platform-independent
+ *  script-like manner.
+ *
+ *  The generated header requires COMDefs.h and must be included from there.
+ */
+
+/*
+     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.
+ */
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text"/>
+
+<xsl:strip-space elements="*"/>
+
+
+<!--
+//  helper definitions
+/////////////////////////////////////////////////////////////////////////////
+-->
+
+<!--
+ *  capitalizes the first letter
+-->
+<xsl:template name="capitalize">
+  <xsl:param name="str" select="."/>
+  <xsl:value-of select="
+    concat(
+      translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
+      substring($str,2)
+    )
+  "/>
+</xsl:template>
+
+<!--
+ *  uncapitalizes the first letter only if the second one is not capital
+ *  otherwise leaves the string unchanged
+-->
+<xsl:template name="uncapitalize">
+  <xsl:param name="str" select="."/>
+  <xsl:choose>
+    <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
+      <xsl:value-of select="
+        concat(
+          translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
+          substring($str,2)
+        )
+      "/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="string($str)"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!--
+ *  translates the string to uppercase
+-->
+<xsl:template name="uppercase">
+  <xsl:param name="str" select="."/>
+  <xsl:value-of select="
+    translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
+  "/>
+</xsl:template>
+
+
+<!--
+//  templates
+/////////////////////////////////////////////////////////////////////////////
+-->
+
+
+<!--
+ *  shut down all implicit templates
+-->
+<xsl:template match="*"/>
+<xsl:template match="*|/" mode="declare"/>
+<xsl:template match="*|/" mode="define"/>
+<xsl:template match="*|/" mode="end"/>
+<xsl:template match="*|/" mode="begin"/>
+
+
+<!--
+ *  header
+-->
+<xsl:template match="/idl">
+
+<xsl:text>
+/*
+ *  DO NOT EDIT! This is a generated file.
+ *
+ *  Qt-based wrapper classes for VirtualBox Main API (COM interfaces)
+ *  generated from XIDL (XML interface definition).
+ *
+ *  Source    : src/VBox/Main/idl/VirtualBox.xidl
+ *  Generator : src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl
+ *
+ *  Note: this header must be included from COMDefs.h, never directly.
+ */
+</xsl:text>
+
+<!-- all enum declarations -->
+<xsl:text>
+// all enums
+
+</xsl:text>
+  <xsl:for-each select="*/enum">
+    <xsl:text>enum </xsl:text>
+    <xsl:value-of select="concat('K',@name)"/>
+    <xsl:text>&#x0A;{&#x0A;</xsl:text>
+    <xsl:for-each select="const">
+      <xsl:text>    </xsl:text>
+      <xsl:value-of select="concat('K',../@name,'_',@name)"/>
+      <xsl:text> = ::</xsl:text>
+      <xsl:value-of select="concat(../@name,'_',@name)"/>
+      <xsl:text>,&#x0A;</xsl:text>
+    </xsl:for-each>
+    <xsl:text>};&#x0A;&#x0A;Q_DECLARE_METATYPE(</xsl:text>
+    <xsl:value-of select="concat('K',@name)"/>
+    <xsl:text>)&#x0A;&#x0A;</xsl:text>
+  </xsl:for-each>
+  <xsl:text>&#x0A;&#x0A;</xsl:text>
+
+  <xsl:apply-templates/>
+
+</xsl:template>
+
+
+<!--
+ *  encloses |if| element's contents (unconditionally expanded by
+ *  <apply-templates mode="define"/>) with #ifdef / #endif.
+ *
+ *  @note this can produce an empty #if/#endif block if |if|'s children
+ *  expand to nothing (such as |cpp|). I see no need to handle this situation
+ *  specially.
+-->
+<xsl:template match="if" mode="define">
+  <xsl:if test="(@target='xpidl') or (@target='midl')">
+    <xsl:apply-templates select="." mode="begin"/>
+    <xsl:apply-templates mode="define"/>
+    <xsl:apply-templates select="." mode="end"/>
+    <xsl:text>&#x0A;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+
+<!--
+ *  encloses |if| element's contents (unconditionally expanded by
+ *  <apply-templates mode="declare"/>) with #ifdef / #endif.
+ *
+ *  @note this can produce an empty #if/#endif block if |if|'s children
+ *  expand to nothing (such as |cpp|). I see no need to handle this situation
+ *  specially.
+-->
+<xsl:template match="if" mode="declare">
+  <xsl:if test="(@target='xpidl') or (@target='midl')">
+    <xsl:apply-templates select="." mode="begin"/>
+    <xsl:apply-templates mode="declare"/>
+    <xsl:apply-templates select="." mode="end"/>
+    <xsl:text>&#x0A;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+
+<!--
+ *  |<if target="...">| element): begin and end.
+-->
+<xsl:template match="if" mode="begin">
+  <xsl:if test="@target='xpidl'">
+    <xsl:text>#if !defined (Q_WS_WIN32)&#x0A;</xsl:text>
+  </xsl:if>
+  <xsl:if test="@target='midl'">
+    <xsl:text>#if defined (Q_WS_WIN32)&#x0A;</xsl:text>
+  </xsl:if>
+</xsl:template>
+<xsl:template match="if" mode="end">
+  <xsl:if test="(@target='xpidl') or (@target='midl')">
+    <xsl:text>#endif&#x0A;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+
+<!--
+ *  cpp_quote
+-->
+<xsl:template match="cpp"/>
+
+
+<!--
+ *  #ifdef statement (@if attribute): begin and end
+-->
+<xsl:template match="@if" mode="begin">
+  <xsl:text>#if </xsl:text>
+  <xsl:value-of select="."/>
+  <xsl:text>&#x0A;</xsl:text>
+</xsl:template>
+<xsl:template match="@if" mode="end">
+  <xsl:text>#endif&#x0A;</xsl:text>
+</xsl:template>
+
+
+<!--
+ *  libraries
+-->
+<xsl:template match="library">
+  <!-- forward declarations -->
+  <xsl:text>// forward declarations&#x0A;&#x0A;</xsl:text>
+  <xsl:for-each select="interface">
+    <xsl:text>class C</xsl:text>
+    <xsl:value-of select="substring(@name,2)"/>
+    <xsl:text>;&#x0A;</xsl:text>
+  </xsl:for-each>
+  <xsl:text>&#x0A;</xsl:text>
+  <!-- array typedefs -->
+  <xsl:text>// array typedefs&#x0A;&#x0A;</xsl:text>
+  <xsl:for-each select="interface[not(@internal='yes')]">
+    <xsl:if test="
+      (//attribute[@safearray='yes' and not(@internal='yes') and @type=current()/@name])
+      or
+      (//param[@safearray='yes' and not(../@internal='yes') and @type=current()/@name])
+    ">
+      <xsl:text>typedef QVector &lt;C</xsl:text>
+      <xsl:value-of select="substring(@name,2)"/>
+      <xsl:text>&gt; C</xsl:text>
+      <xsl:value-of select="substring(@name,2)"/>
+      <xsl:text>Vector;&#x0A;</xsl:text>
+    </xsl:if>
+  </xsl:for-each>
+  <xsl:text>&#x0A;</xsl:text>
+  <!-- wrapper declarations -->
+  <xsl:text>// wrapper declarations&#x0A;&#x0A;</xsl:text>
+  <xsl:apply-templates select="
+      if |
+      interface[not(@internal='yes')]
+    "
+    mode="declare"
+  />
+  <!-- wrapper definitions -->
+  <xsl:text>// wrapper definitions&#x0A;&#x0A;</xsl:text>
+  <xsl:apply-templates select="
+      if |
+      interface[not(@internal='yes')]
+    "
+    mode="define"
+  />
+</xsl:template>
+
+
+<!--
+ *  interface declarations
+-->
+<xsl:template match="interface" mode="declare">
+
+  <xsl:text>// </xsl:text>
+  <xsl:value-of select="@name"/>
+  <xsl:text> wrapper&#x0A;&#x0A;class C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> : public CInterface &lt;</xsl:text>
+  <xsl:value-of select="@name"/>
+  <!-- use the correct base if supportsErrorInfo -->
+  <xsl:call-template name="tryComposeFetchErrorInfo">
+    <xsl:with-param name="mode" select="'getBaseClassName'"/>
+  </xsl:call-template>
+  <xsl:text>&gt;&#x0A;{&#x0A;public:&#x0A;&#x0A;</xsl:text>
+
+  <!-- generate the Base typedef-->
+  <xsl:text>    typedef CInterface &lt;</xsl:text>
+  <xsl:value-of select="@name"/>
+  <!-- Use the correct base if supportsErrorInfo -->
+  <xsl:call-template name="tryComposeFetchErrorInfo">
+    <xsl:with-param name="mode" select="'getBaseClassName'"/>
+  </xsl:call-template>
+  <xsl:text>&gt; Base;&#x0A;&#x0A;</xsl:text>
+
+  <xsl:if test="name()='interface'">
+    <xsl:call-template name="declareMembers"/>
+  </xsl:if>
+
+  <xsl:text>};&#x0A;&#x0A;</xsl:text>
+
+</xsl:template>
+
+<xsl:template name="declareAttributes">
+
+  <xsl:param name="iface"/>
+
+  <xsl:apply-templates select="$iface//attribute[not(@internal='yes')]" mode="declare"/>
+  <xsl:if test="$iface//attribute[not(@internal='yes')]">
+    <xsl:text>&#x0A;</xsl:text>
+  </xsl:if>
+  <!-- go to the base interface -->
+  <xsl:if test="$iface/@extends and $iface/@extends!='$unknown'">
+    <xsl:choose>
+      <!-- interfaces within library/if -->
+      <xsl:when test="name(..)='if'">
+        <xsl:call-template name="declareAttributes">
+          <xsl:with-param name="iface" select="
+            preceding-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            following-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            ../preceding-sibling::if[@target=../@target]/
+              *[self::interface and @name=$iface/@extends] |
+            ../following-sibling::if[@target=../@target]/
+              *[self::interface and @name=$iface/@extends]
+          "/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- interfaces within library -->
+      <xsl:otherwise>
+        <xsl:call-template name="declareAttributes">
+          <xsl:with-param name="iface" select="
+            preceding-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            following-sibling::
+              *[self::interface and @name=$iface/@extends]
+          "/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+
+</xsl:template>
+
+<xsl:template name="declareMethods">
+
+  <xsl:param name="iface"/>
+
+  <xsl:apply-templates select="$iface//method[not(@internal='yes')]" mode="declare"/>
+  <xsl:if test="$iface//method[not(@internal='yes')]">
+    <xsl:text>&#x0A;</xsl:text>
+  </xsl:if>
+  <!-- go to the base interface -->
+  <xsl:if test="$iface/@extends and $iface/@extends!='$unknown'">
+    <xsl:choose>
+      <!-- interfaces within library/if -->
+      <xsl:when test="name(..)='if'">
+        <xsl:call-template name="declareMethods">
+          <xsl:with-param name="iface" select="
+            preceding-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            following-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            ../preceding-sibling::if[@target=../@target]/
+              *[self::interface and @name=$iface/@extends] |
+            ../following-sibling::if[@target=../@target]/
+              *[self::interface and @name=$iface/@extends]
+          "/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- interfaces within library -->
+      <xsl:otherwise>
+        <xsl:call-template name="declareMethods">
+          <xsl:with-param name="iface" select="
+            preceding-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            following-sibling::
+              *[self::interface and @name=$iface/@extends]
+          "/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+
+</xsl:template>
+
+<xsl:template name="declareMembers">
+
+  <xsl:text>    // constructors and assignments taking CUnknown and </xsl:text>
+  <xsl:text>raw iface pointer&#x0A;&#x0A;</xsl:text>
+  <!-- default constructor -->
+  <xsl:text>    C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> () {}&#x0A;&#x0A;</xsl:text>
+  <!-- constructor taking CWhatever -->
+  <xsl:text>    template &lt;class OI, class OB&gt; explicit C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+<xsl:text> (const CInterface &lt;OI, OB&gt; &amp; that)
+    {
+        attach (that.raw());
+        if (SUCCEEDED (mRC))
+        {
+            mRC = that.lastRC();
+            setErrorInfo (that.errorInfo());
+        }
+    }
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+  <!-- specialization for ourselves (copy constructor) -->
+  <xsl:text>    C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> (const C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> &amp; that) : Base (that) {}&#x0A;&#x0A;</xsl:text>
+  <!-- constructor taking a raw iface pointer -->
+  <xsl:text>    template &lt;class OI&gt; explicit C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> (OI * aIface) { attach (aIface); }&#x0A;&#x0A;</xsl:text>
+  <!-- specialization for ourselves -->
+  <xsl:text>    explicit C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> (</xsl:text>
+  <xsl:value-of select="@name"/>
+  <xsl:text> * aIface) : Base (aIface) {}&#x0A;&#x0A;</xsl:text>
+  <!-- assignment taking CWhatever -->
+  <xsl:text>    template &lt;class OI, class OB&gt; C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+<xsl:text> &amp; operator = (const CInterface &lt;OI, OB&gt; &amp; that)
+    {
+        attach (that.raw());
+        if (SUCCEEDED (mRC))
+        {
+            mRC = that.lastRC();
+            setErrorInfo (that.errorInfo());
+        }
+        return *this;
+    }
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+  <!-- specialization for ourselves -->
+  <xsl:text>    C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> &amp; operator = (const C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+<xsl:text> &amp; that)
+    {
+        Base::operator= (that);
+        return *this;
+    }
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+  <!-- assignment taking a raw iface pointer -->
+  <xsl:text>    template &lt;class OI&gt; C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+<xsl:text> &amp; operator = (OI * aIface)
+    {
+        attach (aIface);
+        return *this;
+    }
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+  <!-- specialization for ourselves -->
+  <xsl:text>    C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> &amp; operator = (</xsl:text>
+  <xsl:value-of select="@name"/>
+<xsl:text> * aIface)
+    {
+        Base::operator= (aIface);
+        return *this;
+    }
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+
+  <xsl:text>    // attributes (properties)&#x0A;&#x0A;</xsl:text>
+  <xsl:call-template name="declareAttributes">
+    <xsl:with-param name="iface" select="."/>
+  </xsl:call-template>
+
+  <xsl:text>    // methods&#x0A;&#x0A;</xsl:text>
+  <xsl:call-template name="declareMethods">
+    <xsl:with-param name="iface" select="."/>
+  </xsl:call-template>
+
+  <xsl:text>    // friend wrappers&#x0A;&#x0A;</xsl:text>
+  <xsl:text>    friend class CUnknown;&#x0A;</xsl:text>
+  <xsl:variable name="name" select="@name"/>
+  <xsl:variable name="parent" select=".."/>
+  <!-- for definitions inside <if> -->
+  <xsl:if test="name(..)='if'">
+    <xsl:for-each select="
+      preceding-sibling::*[self::interface] |
+      following-sibling::*[self::interface] |
+      ../preceding-sibling::*[self::interface] |
+      ../following-sibling::*[self::interface] |
+      ../preceding-sibling::if[@target=$parent/@target]/*[self::interface] |
+      ../following-sibling::if[@target=$parent/@target]/*[self::interface]
+    ">
+      <xsl:if test="
+        ((name()='interface')
+         and
+         ((name(..)!='if' and (if[@target=$parent/@target]/method/param[@type=$name]
+                               or
+                               if[@target=$parent/@target]/attribute[@type=$name]))
+          or
+          (.//method/param[@type=$name] or attribute[@type=$name])))
+      ">
+        <xsl:text>    friend class C</xsl:text>
+        <xsl:value-of select="substring(@name,2)"/>
+        <xsl:text>;&#x0A;</xsl:text>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:if>
+  <!-- for definitions outside <if> (i.e. inside <library>) -->
+  <xsl:if test="name(..)!='if'">
+    <xsl:for-each select="
+      preceding-sibling::*[self::interface] |
+      following-sibling::*[self::interface] |
+      preceding-sibling::if/*[self::interface] |
+      following-sibling::if/*[self::interface]
+    ">
+      <xsl:if test="
+        name()='interface' and (.//method/param[@type=$name] or attribute[@type=$name])
+      ">
+        <xsl:text>    friend class C</xsl:text>
+        <xsl:value-of select="substring(@name,2)"/>
+        <xsl:text>;&#x0A;</xsl:text>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:if>
+
+</xsl:template>
+
+<!-- attribute declarations -->
+<xsl:template match="interface//attribute" mode="declare">
+  <xsl:apply-templates select="parent::node()" mode="begin"/>
+  <xsl:apply-templates select="@if" mode="begin"/>
+  <xsl:call-template name="composeMethod">
+    <xsl:with-param name="return" select="."/>
+  </xsl:call-template>
+  <xsl:if test="not(@readonly='yes')">
+    <xsl:call-template name="composeMethod">
+      <xsl:with-param name="return" select="''"/>
+    </xsl:call-template>
+  </xsl:if>
+  <xsl:apply-templates select="@if" mode="end"/>
+  <xsl:apply-templates select="parent::node()" mode="end"/>
+</xsl:template>
+
+<!-- method declarations -->
+<xsl:template match="interface//method" mode="declare">
+  <xsl:apply-templates select="parent::node()" mode="begin"/>
+  <xsl:apply-templates select="@if" mode="begin"/>
+  <xsl:call-template name="composeMethod"/>
+  <xsl:apply-templates select="@if" mode="end"/>
+  <xsl:apply-templates select="parent::node()" mode="end"/>
+</xsl:template>
+
+
+<!--
+ *  interface definitions
+-->
+<xsl:template match="interface" mode="define">
+
+  <xsl:text>// </xsl:text>
+  <xsl:value-of select="@name"/>
+  <xsl:text> wrapper&#x0A;&#x0A;</xsl:text>
+
+  <xsl:if test="name()='interface'">
+    <xsl:call-template name="defineMembers"/>
+  </xsl:if>
+
+</xsl:template>
+
+<xsl:template name="defineAttributes">
+
+  <xsl:param name="iface"/>
+
+  <xsl:apply-templates select="$iface//attribute[not(@internal='yes')]" mode="define">
+    <xsl:with-param name="namespace" select="."/>
+  </xsl:apply-templates>
+
+  <!-- go to the base interface -->
+  <xsl:if test="$iface/@extends and $iface/@extends!='$unknown'">
+    <xsl:choose>
+      <!-- interfaces within library/if -->
+      <xsl:when test="name(..)='if'">
+        <xsl:call-template name="defineAttributes">
+          <xsl:with-param name="iface" select="
+            preceding-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            following-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            ../preceding-sibling::if[@target=../@target]/
+              *[self::interface and @name=$iface/@extends] |
+            ../following-sibling::if[@target=../@target]/
+              *[self::interface and @name=$iface/@extends]
+          "/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- interfaces within library -->
+      <xsl:otherwise>
+        <xsl:call-template name="defineAttributes">
+          <xsl:with-param name="iface" select="
+            preceding-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            following-sibling::
+              *[self::interface and @name=$iface/@extends]
+          "/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+
+</xsl:template>
+
+<xsl:template name="defineMethods">
+
+  <xsl:param name="iface"/>
+
+  <xsl:apply-templates select="$iface//method[not(@internal='yes')]" mode="define">
+    <xsl:with-param name="namespace" select="."/>
+  </xsl:apply-templates>
+
+  <!-- go to the base interface -->
+  <xsl:if test="$iface/@extends and $iface/@extends!='$unknown'">
+    <xsl:choose>
+      <!-- interfaces within library/if -->
+      <xsl:when test="name(..)='if'">
+        <xsl:call-template name="defineMethods">
+          <xsl:with-param name="iface" select="
+            preceding-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            following-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            ../preceding-sibling::if[@target=../@target]/
+              *[self::interface and @name=$iface/@extends] |
+            ../following-sibling::if[@target=../@target]/
+              *[self::interface and @name=$iface/@extends]
+          "/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- interfaces within library -->
+      <xsl:otherwise>
+        <xsl:call-template name="defineMethods">
+          <xsl:with-param name="iface" select="
+            preceding-sibling::
+              *[self::interface and @name=$iface/@extends] |
+            following-sibling::
+              *[self::interface and @name=$iface/@extends]
+          "/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+
+</xsl:template>
+
+<xsl:template name="defineMembers">
+  <xsl:call-template name="defineAttributes">
+    <xsl:with-param name="iface" select="."/>
+  </xsl:call-template>
+  <xsl:call-template name="defineMethods">
+    <xsl:with-param name="iface" select="."/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- attribute definitions -->
+<xsl:template match="interface//attribute" mode="define">
+
+  <xsl:param name="namespace" select="ancestor::interface[1]"/>
+
+  <xsl:apply-templates select="parent::node()" mode="begin"/>
+  <xsl:apply-templates select="@if" mode="begin"/>
+  <xsl:call-template name="composeMethod">
+    <xsl:with-param name="return" select="."/>
+    <xsl:with-param name="define" select="'yes'"/>
+    <xsl:with-param name="namespace" select="$namespace"/>
+  </xsl:call-template>
+  <xsl:if test="not(@readonly='yes')">
+    <xsl:call-template name="composeMethod">
+      <xsl:with-param name="return" select="''"/>
+      <xsl:with-param name="define" select="'yes'"/>
+      <xsl:with-param name="namespace" select="$namespace"/>
+    </xsl:call-template>
+  </xsl:if>
+  <xsl:apply-templates select="@if" mode="end"/>
+  <xsl:apply-templates select="parent::node()" mode="end"/>
+  <xsl:text>&#x0A;</xsl:text>
+
+</xsl:template>
+
+<!-- method definitions -->
+<xsl:template match="interface//method" mode="define">
+
+  <xsl:param name="namespace" select="ancestor::interface[1]"/>
+
+  <xsl:apply-templates select="parent::node()" mode="begin"/>
+  <xsl:apply-templates select="@if" mode="begin"/>
+  <xsl:call-template name="composeMethod">
+    <xsl:with-param name="define" select="'yes'"/>
+    <xsl:with-param name="namespace" select="$namespace"/>
+  </xsl:call-template>
+  <xsl:apply-templates select="@if" mode="end"/>
+  <xsl:apply-templates select="parent::node()" mode="end"/>
+  <xsl:text>&#x0A;</xsl:text>
+
+</xsl:template>
+
+
+<!--
+ *  co-classes
+-->
+<xsl:template match="module/class"/>
+
+
+<!--
+ *  enums
+-->
+<xsl:template match="enum"/>
+
+
+<!--
+ *  base template to produce interface methods
+ *
+ *  @param return
+ *      - in <attribute> context, must be '.' for getters and
+ *        '' for setters
+ *      - in <method> context, must not be specified (the default value
+ *        will apply)
+ *  @param define
+ *      'yes' to procuce inlined definition outside the class
+ *      declaration, or
+ *      empty string to produce method declaration only (w/o body)
+ *  @param namespace
+ *      actual interface node for which this method is being defined
+ *      (necessary to properly set a class name for inherited methods).
+ *      If not specified, will default to the parent interface
+ *      node of the method being defined.
+-->
+<xsl:template name="composeMethod">
+  <xsl:param name="return" select="param[@dir='return']"/>
+  <xsl:param name="define" select="''"/>
+  <xsl:param name="namespace" select="ancestor::interface[1]"/>
+  <xsl:choose>
+    <!-- no return value -->
+    <xsl:when test="not($return)">
+      <xsl:choose>
+        <xsl:when test="$define">
+          <xsl:text>inline </xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>    </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text>void </xsl:text>
+      <xsl:if test="$define">
+        <xsl:text>C</xsl:text>
+        <xsl:value-of select="substring($namespace/@name,2)"/>
+        <xsl:text>::</xsl:text>
+      </xsl:if>
+      <xsl:call-template name="composeMethodDecl">
+        <xsl:with-param name="isSetter" select="'yes'"/>
+      </xsl:call-template>
+      <xsl:if test="$define">
+        <xsl:text>&#x0A;{&#x0A;</xsl:text>
+        <!-- iface assertion -->
+        <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
+        <xsl:text>    if (!mIface)&#x0A;        return;&#x0A;</xsl:text>
+        <!-- method call -->
+        <xsl:call-template name="composeMethodCall">
+          <xsl:with-param name="isSetter" select="'yes'"/>
+        </xsl:call-template>
+        <xsl:text>}&#x0A;</xsl:text>
+      </xsl:if>
+      <xsl:if test="not($define)">
+        <xsl:text>;&#x0A;</xsl:text>
+      </xsl:if>
+    </xsl:when>
+    <!-- has a return value -->
+    <xsl:when test="count($return) = 1">
+      <xsl:choose>
+        <xsl:when test="$define">
+          <xsl:text>inline </xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>    </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:apply-templates select="$return/@type"/>
+      <xsl:text> </xsl:text>
+      <xsl:if test="$define">
+        <xsl:text>C</xsl:text>
+        <xsl:value-of select="substring($namespace/@name,2)"/>
+        <xsl:text>::</xsl:text>
+      </xsl:if>
+      <xsl:call-template name="composeMethodDecl"/>
+      <xsl:if test="$define">
+        <xsl:text>&#x0A;{&#x0A;    </xsl:text>
+        <xsl:apply-templates select="$return/@type"/>
+        <xsl:text> a</xsl:text>
+        <xsl:call-template name="capitalize">
+          <xsl:with-param name="str" select="$return/@name"/>
+        </xsl:call-template>
+        <xsl:apply-templates select="$return/@type" mode="initializer"/>
+        <xsl:text>;&#x0A;</xsl:text>
+        <!-- iface assertion -->
+        <xsl:text>    Assert (mIface);&#x0A;</xsl:text>
+        <xsl:text>    if (!mIface)&#x0A;        return a</xsl:text>
+        <xsl:call-template name="capitalize">
+          <xsl:with-param name="str" select="$return/@name"/>
+        </xsl:call-template>
+        <xsl:text>;&#x0A;</xsl:text>
+        <!-- method call -->
+        <xsl:call-template name="composeMethodCall"/>
+        <!-- return statement -->
+        <xsl:text>    return a</xsl:text>
+        <xsl:call-template name="capitalize">
+          <xsl:with-param name="str" select="$return/@name"/>
+        </xsl:call-template>
+        <xsl:text>;&#x0A;}&#x0A;</xsl:text>
+      </xsl:if>
+      <xsl:if test="not($define)">
+        <xsl:text>;&#x0A;</xsl:text>
+      </xsl:if>
+    </xsl:when>
+    <!-- otherwise error -->
+    <xsl:otherwise>
+      <xsl:message terminate="yes">
+        <xsl:text>More than one return value in method: </xsl:text>
+        <xsl:value-of select="$namespace/@name"/>
+        <xsl:text>::</xsl:text>
+        <xsl:value-of select="@name"/>
+      </xsl:message>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="composeMethodDecl">
+  <xsl:param name="isSetter" select="''"/>
+  <xsl:choose>
+    <!-- attribute method call -->
+    <xsl:when test="name()='attribute'">
+      <xsl:choose>
+        <xsl:when test="$isSetter">
+          <!-- name -->
+          <xsl:text>Set</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+          <xsl:text> (</xsl:text>
+          <!-- parameter -->
+          <xsl:apply-templates select="@type" mode="param"/>
+          <xsl:text> a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- name -->
+          <xsl:text>Get</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+          <xsl:text> (</xsl:text>
+          <!-- const method -->
+          <xsl:text>) const</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <!-- regular method call -->
+    <xsl:when test="name()='method'">
+      <!-- name -->
+      <xsl:call-template name="capitalize">
+        <xsl:with-param name="str" select="@name"/>
+      </xsl:call-template>
+      <xsl:text> (</xsl:text>
+      <!-- parameters -->
+      <xsl:for-each select="param[@dir!='return']">
+        <xsl:apply-templates select="@type" mode="param"/>
+        <xsl:text> a</xsl:text>
+        <xsl:call-template name="capitalize">
+          <xsl:with-param name="str" select="@name"/>
+        </xsl:call-template>
+        <xsl:if test="position() != last()">
+          <xsl:text>, </xsl:text>
+        </xsl:if>
+      </xsl:for-each>
+      <xsl:text>)</xsl:text>
+      <!-- const method -->
+      <xsl:if test="@const='yes'"> const</xsl:if>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="composeMethodCall">
+  <xsl:param name="isSetter" select="''"/>
+  <!-- apply 'pre-call' hooks -->
+  <xsl:choose>
+    <xsl:when test="name()='attribute'">
+      <xsl:call-template name="hooks">
+        <xsl:with-param name="when" select="'pre-call'"/>
+        <xsl:with-param name="isSetter" select="$isSetter"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="name()='method'">
+      <xsl:for-each select="param">
+        <xsl:call-template name="hooks">
+          <xsl:with-param name="when" select="'pre-call'"/>
+        </xsl:call-template>
+      </xsl:for-each>
+    </xsl:when>
+  </xsl:choose>
+  <!-- start the call -->
+  <xsl:text>    mRC = mIface-></xsl:text>
+  <xsl:choose>
+    <!-- attribute method call -->
+    <xsl:when test="name()='attribute'">
+      <!-- method name -->
+      <xsl:choose>
+        <xsl:when test="$isSetter">
+          <xsl:text>COMSETTER(</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>COMGETTER(</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:call-template name="capitalize">
+        <xsl:with-param name="str" select="@name"/>
+      </xsl:call-template>
+      <xsl:text>) (</xsl:text>
+      <!-- parameter -->
+      <xsl:call-template name="composeMethodCallParam">
+        <xsl:with-param name="isIn" select="$isSetter"/>
+        <xsl:with-param name="isOut" select="not($isSetter)"/>
+      </xsl:call-template>
+    </xsl:when>
+    <!-- regular method call -->
+    <xsl:when test="name()='method'">
+      <!-- method name -->
+      <xsl:call-template name="capitalize">
+        <xsl:with-param name="str" select="@name"/>
+      </xsl:call-template>
+      <xsl:text> (</xsl:text>
+      <!-- parameters -->
+      <xsl:for-each select="param">
+        <xsl:call-template name="composeMethodCallParam"/>
+        <xsl:if test="position() != last()">
+          <xsl:text>, </xsl:text>
+        </xsl:if>
+      </xsl:for-each>
+    </xsl:when>
+  </xsl:choose>
+  <xsl:text>);&#x0A;</xsl:text>
+  <!-- apply 'post-call' hooks -->
+  <xsl:choose>
+    <xsl:when test="name()='attribute'">
+      <xsl:call-template name="hooks">
+        <xsl:with-param name="when" select="'post-call'"/>
+        <xsl:with-param name="isSetter" select="$isSetter"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="name()='method'">
+      <xsl:for-each select="param">
+        <xsl:call-template name="hooks">
+          <xsl:with-param name="when" select="'post-call'"/>
+        </xsl:call-template>
+      </xsl:for-each>
+    </xsl:when>
+  </xsl:choose>
+  <!-- -->
+  <xsl:call-template name="tryComposeFetchErrorInfo"/>
+</xsl:template>
+
+<!--
+ *  Composes a 'fetch error info' call or returns the name of the
+ *  appropriate base class name that provides error info functionality
+ *  (depending on the mode parameter). Does nothing if the current
+ *  interface does not support error info.
+ *
+ *  @param mode
+ *      - 'getBaseClassName': expands to the base class name
+ *      - any other value: composes a 'fetch error info' method call
+-->
+<xsl:template name="tryComposeFetchErrorInfo">
+  <xsl:param name="mode" select="''"/>
+  <xsl:variable name="ifaceSupportsErrorInfo" select="
+    ancestor-or-self::interface[1]/@supportsErrorInfo
+  "/>
+  <xsl:variable name="librarySupportsErrorInfo" select="ancestor::library/@supportsErrorInfo"/>
+  <xsl:choose>
+    <xsl:when test="$ifaceSupportsErrorInfo">
+      <xsl:call-template name="composeFetchErrorInfo">
+        <xsl:with-param name="supports" select="string($ifaceSupportsErrorInfo)"/>
+        <xsl:with-param name="mode" select="$mode"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$librarySupportsErrorInfo">
+      <xsl:call-template name="composeFetchErrorInfo">
+        <xsl:with-param name="supports" select="string($librarySupportsErrorInfo)"/>
+        <xsl:with-param name="mode" select="$mode"/>
+      </xsl:call-template>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="composeFetchErrorInfo">
+  <xsl:param name="supports" select="''"/>
+  <xsl:param name="mode" select="''"/>
+  <xsl:choose>
+    <xsl:when test="$mode='getBaseClassName'">
+      <xsl:if test="$supports='strict' or $supports='yes'">
+        <xsl:text>, COMBaseWithEI</xsl:text>
+      </xsl:if>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:if test="$supports='strict' or $supports='yes'">
+        <xsl:text>    if (mRC != S_OK)&#x0A;    {&#x0A;</xsl:text>
+        <xsl:text>        fetchErrorInfo (mIface, &amp;COM_IIDOF (Base::Iface));&#x0A;</xsl:text>
+        <xsl:if test="$supports='strict'">
+          <xsl:text>        AssertMsg (errInfo.isFullAvailable(), </xsl:text>
+          <xsl:text>("for RC=0x%08X\n", mRC));&#x0A;</xsl:text>
+        </xsl:if>
+        <xsl:text>    }&#x0A;</xsl:text>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="composeMethodCallParam">
+
+  <xsl:param name="isIn" select="@dir='in'"/>
+  <xsl:param name="isOut" select="@dir='out' or @dir='return'"/>
+
+  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
+
+  <xsl:choose>
+    <!-- safearrays -->
+    <xsl:when test="@safearray='yes'">
+      <xsl:choose>
+        <xsl:when test="$isIn">
+          <xsl:text>ComSafeArrayAsInParam (</xsl:text>
+          <xsl:value-of select="@name"/>
+          <xsl:text>)</xsl:text>
+        </xsl:when>
+        <xsl:when test="$isOut">
+          <xsl:text>ComSafeArrayAsOutParam (</xsl:text>
+          <xsl:value-of select="@name"/>
+          <xsl:text>)</xsl:text>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:when>
+    <!-- string types -->
+    <xsl:when test="@type = 'wstring' or @type = 'uuid'">
+      <xsl:choose>
+        <xsl:when test="$isIn">
+          <xsl:text>BSTRIn (a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:when>
+        <xsl:when test="$isOut">
+          <xsl:text>BSTROut (a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:when>
+    <!-- enum types -->
+    <xsl:when test="
+      (ancestor::library/enum[@name=current()/@type]) or
+      (ancestor::library/if[@target=$self_target]/enum[@name=current()/@type])
+    ">
+      <xsl:choose>
+        <xsl:when test="$isIn">
+          <xsl:text>(</xsl:text>
+          <xsl:value-of select="@type"/>
+          <xsl:text>_T) a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$isOut">
+          <xsl:text>ENUMOut &lt;K</xsl:text>
+          <xsl:value-of select="@type"/>
+          <xsl:text>, </xsl:text>
+          <xsl:value-of select="@type"/>
+          <xsl:text>_T&gt; (a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+          <xsl:text>)</xsl:text>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:when>
+    <!-- interface types -->
+    <xsl:when test="
+      @type='$unknown' or
+      ((ancestor::library/interface[@name=current()/@type]) or
+       (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type])
+      )
+    ">
+      <xsl:choose>
+        <xsl:when test="$isIn">
+          <xsl:text>a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+          <xsl:choose>
+            <xsl:when test="@type='$unknown'">
+              <xsl:text>.raw()</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>.mIface</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:when test="$isOut">
+          <xsl:text>&amp;a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+          <xsl:choose>
+            <xsl:when test="@type='$unknown'">
+              <xsl:text>.rawRef()</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>.mIface</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:when>
+    <!-- currently unsupported types -->
+    <xsl:when test="@type = 'string'">
+      <xsl:message terminate="yes">
+        <xsl:text>Parameter type </xsl:text>
+        <xsl:value-of select="@type"/>
+        <xsl:text>is not currently supported</xsl:text>
+      </xsl:message>
+    </xsl:when>
+    <!-- assuming scalar types -->
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$isIn">
+          <xsl:text>a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$isOut">
+          <xsl:text>&amp;a</xsl:text>
+          <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="@name"/>
+          </xsl:call-template>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<!--
+ *  attribute/parameter type conversion (returns plain Qt type name)
+-->
+<xsl:template match="attribute/@type | param/@type">
+  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
+
+  <xsl:choose>
+    <!-- modifiers -->
+    <xsl:when test="name(current())='type' and ../@mod">
+      <xsl:if test="../@safearray and ../@mod='ptr'">
+        <xsl:message terminate="yes">
+          <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+          <xsl:text>either 'safearray' or 'mod' attribute is allowed, but not both!</xsl:text>
+        </xsl:message>
+      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="../@mod='ptr'">
+          <xsl:choose>
+            <!-- standard types -->
+            <!--xsl:when test=".='result'">??</xsl:when-->
+            <xsl:when test=".='boolean'">BOOL *</xsl:when>
+            <xsl:when test=".='octet'">BYTE *</xsl:when>
+            <xsl:when test=".='short'">SHORT *</xsl:when>
+            <xsl:when test=".='unsigned short'">USHORT *</xsl:when>
+            <xsl:when test=".='long'">LONG *</xsl:when>
+            <xsl:when test=".='long long'">LONG64 *</xsl:when>
+            <xsl:when test=".='unsigned long'">ULONG *</xsl:when>
+            <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+                <xsl:text>attribute 'mod=</xsl:text>
+                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
+                <xsl:text>' cannot be used with type </xsl:text>
+                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:when test="../@mod='string'">
+          <xsl:if test="../@safearray">
+            <xsl:text>QVector &lt;</xsl:text>
+          </xsl:if>
+          <xsl:choose>
+            <!-- standard types -->
+            <!--xsl:when test=".='result'">??</xsl:when-->
+            <xsl:when test=".='uuid'">QString</xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+                <xsl:text>attribute 'mod=</xsl:text>
+                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
+                <xsl:text>' cannot be used with type </xsl:text>
+                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:if test="../@safearray">
+            <xsl:text>&gt;</xsl:text>
+          </xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message terminate="yes">
+            <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+            <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
+            <xsl:text>of attribute 'mod' is invalid!</xsl:text>
+          </xsl:message>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <!-- no modifiers -->
+    <xsl:otherwise>
+      <xsl:if test="../@safearray">
+        <xsl:text>QVector &lt;</xsl:text>
+      </xsl:if>
+      <xsl:choose>
+        <!-- standard types -->
+        <xsl:when test=".='result'">HRESULT</xsl:when>
+        <xsl:when test=".='boolean'">BOOL</xsl:when>
+        <xsl:when test=".='octet'">BYTE</xsl:when>
+        <xsl:when test=".='short'">SHORT</xsl:when>
+        <xsl:when test=".='unsigned short'">USHORT</xsl:when>
+        <xsl:when test=".='long'">LONG</xsl:when>
+        <xsl:when test=".='long long'">LONG64</xsl:when>
+        <xsl:when test=".='unsigned long'">ULONG</xsl:when>
+        <xsl:when test=".='unsigned long long'">ULONG64</xsl:when>
+        <xsl:when test=".='char'">CHAR</xsl:when>
+        <xsl:when test=".='string'">CHAR *</xsl:when>
+        <xsl:when test=".='wchar'">OLECHAR</xsl:when>
+        <xsl:when test=".='wstring'">QString</xsl:when>
+        <!-- UUID type -->
+        <xsl:when test=".='uuid'">QUuid</xsl:when>
+        <!-- system interface types -->
+        <xsl:when test=".='$unknown'">CUnknown</xsl:when>
+        <xsl:otherwise>
+          <xsl:choose>
+            <!-- enum types -->
+            <xsl:when test="
+              (ancestor::library/enum[@name=current()]) or
+              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
+            ">
+              <xsl:value-of select="concat('K',string(.))"/>
+            </xsl:when>
+            <!-- custom interface types -->
+            <xsl:when test="
+              ((ancestor::library/interface[@name=current()]) or
+               (ancestor::library/if[@target=$self_target]/interface[@name=current()])
+              )
+            ">
+              <xsl:value-of select="concat('C',substring(.,2))"/>
+            </xsl:when>
+            <!-- other types -->
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:text>Unknown parameter type: </xsl:text>
+                <xsl:value-of select="."/>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:if test="../@safearray">
+        <xsl:text>&gt;</xsl:text>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<!--
+ *  generates a null initializer for all scalar types (such as bool or long)
+ *  and enum types in the form of ' = <null_initializer>', or nothing for other
+ *  types.
+-->
+<xsl:template match="attribute/@type | param/@type" mode="initializer">
+
+  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
+
+  <xsl:choose>
+    <!-- safearrays don't need initializers -->
+    <xsl:when test="../@safearray">
+    </xsl:when>
+    <!-- modifiers -->
+    <xsl:when test="name(current())='type' and ../@mod">
+      <xsl:choose>
+        <xsl:when test="../@mod='ptr'">
+          <xsl:choose>
+            <!-- standard types -->
+            <!--xsl:when test=".='result'">??</xsl:when-->
+            <xsl:when test=".='boolean'"> = NULL</xsl:when>
+            <xsl:when test=".='octet'"> = NULL</xsl:when>
+            <xsl:when test=".='short'"> = NULL</xsl:when>
+            <xsl:when test=".='unsigned short'"> = NULL</xsl:when>
+            <xsl:when test=".='long'"> = NULL</xsl:when>
+            <xsl:when test=".='long long'"> = NULL</xsl:when>
+            <xsl:when test=".='unsigned long'"> = NULL</xsl:when>
+            <xsl:when test=".='unsigned long long'"> = NULL</xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+                <xsl:text>attribute 'mod=</xsl:text>
+                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
+                <xsl:text>' cannot be used with type </xsl:text>
+                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:when test="../@mod='string'">
+          <xsl:choose>
+            <!-- standard types -->
+            <!--xsl:when test=".='result'">??</xsl:when-->
+            <xsl:when test=".='uuid'"></xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+                <xsl:text>attribute 'mod=</xsl:text>
+                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
+                <xsl:text>' cannot be used with type </xsl:text>
+                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message terminate="yes">
+            <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+            <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
+            <xsl:text>of attribute 'mod' is invalid!</xsl:text>
+          </xsl:message>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <!-- no modifiers -->
+    <xsl:otherwise>
+      <xsl:choose>
+        <!-- standard types that need a zero initializer -->
+        <xsl:when test=".='result'"> = S_OK</xsl:when>
+        <xsl:when test=".='boolean'"> = FALSE</xsl:when>
+        <xsl:when test=".='octet'"> = 0</xsl:when>
+        <xsl:when test=".='short'"> = 0</xsl:when>
+        <xsl:when test=".='unsigned short'"> = 0</xsl:when>
+        <xsl:when test=".='long'"> = 0</xsl:when>
+        <xsl:when test=".='long long'"> = 0</xsl:when>
+        <xsl:when test=".='unsigned long'"> = 0</xsl:when>
+        <xsl:when test=".='unsigned long long'"> = 0</xsl:when>
+        <xsl:when test=".='char'"> = 0</xsl:when>
+        <xsl:when test=".='string'"> = NULL</xsl:when>
+        <xsl:when test=".='wchar'"> = 0</xsl:when>
+        <xsl:otherwise>
+          <xsl:choose>
+            <!-- enum types initialized with 0 -->
+            <xsl:when test="
+              (ancestor::library/enum[@name=current()]) or
+              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
+            ">
+              <xsl:value-of select="concat(' = (K',string(.),') 0')"/>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<!--
+ *  attribute/parameter type conversion (for method declaration)
+-->
+<xsl:template match="attribute/@type | param/@type" mode="param">
+
+  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
+
+  <xsl:choose>
+    <!-- class types -->
+    <xsl:when test="
+      .='string' or
+      .='wstring' or
+      ../@safearray='yes' or
+      ((ancestor::library/enum[@name=current()]) or
+       (ancestor::library/if[@target=$self_target]/enum[@name=current()])
+      ) or
+      .='$unknown' or
+      ((ancestor::library/interface[@name=current()]) or
+       (ancestor::library/if[@target=$self_target]/interface[@name=current()])
+      )
+    ">
+      <xsl:choose>
+        <!-- <attribute> context -->
+        <xsl:when test="name(..)='attribute'">
+          <xsl:text>const </xsl:text>
+          <xsl:apply-templates select="."/>
+          <xsl:text> &amp;</xsl:text>
+        </xsl:when>
+        <!-- <param> context -->
+        <xsl:when test="name(..)='param'">
+          <xsl:choose>
+            <xsl:when test="../@dir='in'">
+              <xsl:text>const </xsl:text>
+              <xsl:apply-templates select="."/>
+              <xsl:text> &amp;</xsl:text>
+            </xsl:when>
+            <xsl:when test="../@dir='out'">
+              <xsl:apply-templates select="."/>
+              <xsl:text> &amp;</xsl:text>
+            </xsl:when>
+            <xsl:when test="../@dir='return'">
+              <xsl:apply-templates select="."/>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:when>
+    <!-- assume scalar types -->
+    <xsl:otherwise>
+      <xsl:choose>
+        <!-- <attribute> context -->
+        <xsl:when test="name(..)='attribute'">
+          <xsl:apply-templates select="."/>
+        </xsl:when>
+        <!-- <param> context -->
+        <xsl:when test="name(..)='param'">
+          <xsl:apply-templates select="."/>
+          <xsl:if test="../@dir='out'">
+            <xsl:text> &amp;</xsl:text>
+          </xsl:if>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<!--
+ *  attribute/parameter type conversion (returns plain COM type name)
+ *  (basically, copied from midl.xsl)
+-->
+<xsl:template match="attribute/@type | param/@type" mode="com">
+
+  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
+
+  <xsl:choose>
+    <!-- modifiers -->
+    <xsl:when test="name(current())='type' and ../@mod">
+      <xsl:choose>
+        <xsl:when test="../@mod='ptr'">
+          <xsl:choose>
+            <!-- standard types -->
+            <!--xsl:when test=".='result'">??</xsl:when-->
+            <xsl:when test=".='boolean'">BOOL *</xsl:when>
+            <xsl:when test=".='octet'">BYTE *</xsl:when>
+            <xsl:when test=".='short'">SHORT *</xsl:when>
+            <xsl:when test=".='unsigned short'">USHORT *</xsl:when>
+            <xsl:when test=".='long'">LONG *</xsl:when>
+            <xsl:when test=".='long long'">LONG64 *</xsl:when>
+            <xsl:when test=".='unsigned long'">ULONG *</xsl:when>
+            <xsl:when test=".='unsigned long long'">ULONG64 *</xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+                <xsl:text>attribute 'mod=</xsl:text>
+                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
+                <xsl:text>' cannot be used with type </xsl:text>
+                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:when test="../@mod='string'">
+          <xsl:choose>
+            <!-- standard types -->
+            <!--xsl:when test=".='result'">??</xsl:when-->
+            <xsl:when test=".='uuid'">BSTR</xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+                <xsl:text>attribute 'mod=</xsl:text>
+                <xsl:value-of select="concat('&quot;',../@mod,'&quot;')"/>
+                <xsl:text>' cannot be used with type </xsl:text>
+                <xsl:value-of select="concat('&quot;',current(),'&quot;!')"/>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message terminate="yes">
+            <xsl:value-of select="concat(../../../@name,'::',../../@name,'::',../@name,': ')"/>
+            <xsl:value-of select="concat('value &quot;',../@mod,'&quot; ')"/>
+            <xsl:text>of attribute 'mod' is invalid!</xsl:text>
+          </xsl:message>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <!-- no modifiers -->
+    <xsl:otherwise>
+      <xsl:choose>
+        <!-- standard types -->
+        <xsl:when test=".='result'">HRESULT</xsl:when>
+        <xsl:when test=".='boolean'">BOOL</xsl:when>
+        <xsl:when test=".='octet'">BYTE</xsl:when>
+        <xsl:when test=".='short'">SHORT</xsl:when>
+        <xsl:when test=".='unsigned short'">USHORT</xsl:when>
+        <xsl:when test=".='long'">LONG</xsl:when>
+        <xsl:when test=".='long long'">LONG64</xsl:when>
+        <xsl:when test=".='unsigned long'">ULONG</xsl:when>
+        <xsl:when test=".='unsigned long long'">ULONG64</xsl:when>
+        <xsl:when test=".='char'">CHAR</xsl:when>
+        <xsl:when test=".='string'">CHAR *</xsl:when>
+        <xsl:when test=".='wchar'">OLECHAR</xsl:when>
+        <xsl:when test=".='wstring'">BSTR</xsl:when>
+        <!-- UUID type -->
+        <xsl:when test=".='uuid'">GUID</xsl:when>
+        <!-- system interface types -->
+        <xsl:when test=".='$unknown'">IUnknown *</xsl:when>
+        <xsl:otherwise>
+          <xsl:choose>
+            <!-- enum types -->
+            <xsl:when test="
+              (ancestor::library/enum[@name=current()]) or
+              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
+            ">
+              <xsl:value-of select="."/>
+            </xsl:when>
+            <!-- custom interface types -->
+            <xsl:when test="
+              ((ancestor::library/interface[@name=current()]) or
+               (ancestor::library/if[@target=$self_target]/interface[@name=current()])
+              )
+            ">
+              <xsl:value-of select="."/><xsl:text> *</xsl:text>
+            </xsl:when>
+            <!-- other types -->
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:text>Unknown parameter type: </xsl:text>
+                <xsl:value-of select="."/>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<!--
+ *  attribute/parameter type additional hooks.
+ *
+ *  Called in the context of <attribute> or <param> elements.
+ *
+ *  @param when     When the hook is being called:
+ *                  'pre-call'  - right before the method call
+ *                  'post-call' - right after the method call
+ *  @param isSetter Non-empty if called in the cotext of the attribute setter
+ *                  call.
+-->
+<xsl:template name="hooks">
+
+  <xsl:param name="when" select="''"/>
+  <xsl:param name="isSetter" select="''"/>
+
+  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
+
+  <xsl:variable name="is_iface" select="(
+    ((ancestor::library/interface[@name=current()/@type]) or
+     (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type])
+    )
+  )"/>
+
+  <xsl:variable name="is_enum" select="(
+    (ancestor::library/enum[@name=current()/@type]) or
+    (ancestor::library/if[@target=$self_target]/enum[@name=current()/@type])
+  )"/>
+
+  <xsl:choose>
+    <xsl:when test="$when='pre-call'">
+      <xsl:choose>
+        <xsl:when test="@safearray='yes'">
+          <!-- declare a SafeArray variable -->
+          <xsl:choose>
+            <!-- interface types need special treatment here -->
+            <xsl:when test="@type='$unknown'">
+              <xsl:text>    com::SafeIfaceArray &lt;IUnknown&gt; </xsl:text>
+            </xsl:when>
+            <xsl:when test="$is_iface">
+              <xsl:text>    com::SafeIfaceArray &lt;</xsl:text>
+              <xsl:value-of select="@type"/>
+              <xsl:text>&gt; </xsl:text>
+            </xsl:when>
+            <!-- enums need the _T prefix -->
+            <xsl:when test="$is_enum">
+              <xsl:text>    com::SafeArray &lt;</xsl:text>
+              <xsl:value-of select="@type"/>
+              <xsl:text>_T&gt; </xsl:text>
+            </xsl:when>
+            <!-- GUID is special too -->
+            <xsl:when test="@type='uuid' and @mod!='string'">
+              <xsl:text>    com::SafeGUIDArray </xsl:text>
+            </xsl:when>
+            <!-- everything else is not -->
+            <xsl:otherwise>
+              <xsl:text>    com::SafeArray &lt;</xsl:text>
+              <xsl:apply-templates select="@type" mode="com"/>
+              <xsl:text>&gt; </xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:value-of select="@name"/>
+          <xsl:text>;&#x0A;</xsl:text>
+          <xsl:if test="(name()='attribute' and $isSetter) or
+                        (name()='param' and @dir='in')">
+            <!-- convert QVector to SafeArray -->
+            <xsl:choose>
+              <!-- interface types need special treatment here -->
+              <xsl:when test="@type='$unknown' or $is_iface">
+                <xsl:text>    ToSafeIfaceArray (</xsl:text>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:text>    ToSafeArray (</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+            <xsl:text>a</xsl:text>
+            <xsl:call-template name="capitalize">
+              <xsl:with-param name="str" select="@name"/>
+            </xsl:call-template>
+            <xsl:text>, </xsl:text>
+            <xsl:value-of select="@name"/>
+            <xsl:text>);&#x0A;</xsl:text>
+          </xsl:if>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="$when='post-call'">
+      <xsl:choose>
+        <xsl:when test="@safearray='yes'">
+          <xsl:if test="(name()='attribute' and not($isSetter)) or
+                        (name()='param' and (@dir='out' or @dir='return'))">
+            <!-- convert SafeArray to QVector -->
+            <xsl:choose>
+              <!-- interface types need special treatment here -->
+              <xsl:when test="@type='$unknown' or $is_iface">
+                <xsl:text>    FromSafeIfaceArray (</xsl:text>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:text>    FromSafeArray (</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+            <xsl:value-of select="@name"/>
+            <xsl:text>, </xsl:text>
+            <xsl:text>a</xsl:text>
+            <xsl:call-template name="capitalize">
+              <xsl:with-param name="str" select="@name"/>
+            </xsl:call-template>
+            <xsl:text>);&#x0A;</xsl:text>
+          </xsl:if>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message terminate="yes">
+        <xsl:text>Invalid when value: </xsl:text>
+        <xsl:value-of select="$when"/>
+      </xsl:message>
+    </xsl:otherwise>
+  </xsl:choose>
+
+</xsl:template>
+
+
+</xsl:stylesheet>
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/CarbonDockIconPreview.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/CarbonDockIconPreview.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/CarbonDockIconPreview.h	(revision 25213)
@@ -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/include/CocoaDockIconPreview.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/CocoaDockIconPreview.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/CocoaDockIconPreview.h	(revision 25213)
@@ -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/include/DarwinKeyboard.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/DarwinKeyboard.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/DarwinKeyboard.h	(revision 25213)
@@ -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/include/DockIconPreview.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/DockIconPreview.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/DockIconPreview.h	(revision 25213)
@@ -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/include/QIAbstractWizard.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIAbstractWizard.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIAbstractWizard.h	(revision 25213)
@@ -0,0 +1,119 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * QIAbstractWizard 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 __QIAbstractWizard_h__
+#define __QIAbstractWizard_h__
+
+/* Qt includes */
+#include <QTextEdit>
+#include <QLabel>
+#include <QDialog>
+
+class QStackedWidget;
+
+/**
+ *  QTextEdit reimplementation used as summary viewer in different wizards:
+ *  1. Enforces parent layout to ignore viewer if there is no text.
+ *  2. Updates sizeHint() & geometry after setting new text for getting
+ *     more compact layout.
+ *  3. Tries to take into account horizontal scrollbar if present to avoid
+ *     vertical scrollbar appearing.
+ *  4. Makes the paper color similar to the background color.
+ */
+class QITextEdit : public QTextEdit
+{
+    Q_OBJECT;
+
+public:
+
+    QITextEdit (QWidget *aParent);
+
+    QSize sizeHint() const;
+    QSize minimumSizeHint() const;
+    void updateSizeHint();
+
+public slots:
+
+    void setText (const QString &aText);
+
+private:
+
+    QSize mOwnSizeHint;
+};
+
+/**
+ *  QLabel reimplementation used as text viewers in different wizards:
+ *  1. Updates sizeHint() on request to feat some minimum width
+ *     for getting more compact layout.
+ *  2. Tries to take into account horizontal scrollbar if present to avoid
+ *     vertical scrollbar appearing.
+ *
+ * --> uses now global QILabel
+ */
+
+/**
+ *  QDialog reimplementation used as abstract interface in different wizards:
+ *  1. Performs most of initializations for inherited wizards including
+ *     next, back, cancel, finish buttons, icons and text labels.
+ *  2. Handles show event common for all wizards.
+ */
+class QIAbstractWizard : public QDialog
+{
+    Q_OBJECT;
+
+public:
+
+    QIAbstractWizard (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
+
+protected:
+
+    void initializeWizardHdr();
+    void initializeWizardFtr();
+
+    QPushButton* nextButton (QWidget *aOfPage = 0);
+    QPushButton* backButton (QWidget *aOfPage = 0);
+    QPushButton* cancelButton (QWidget *aOfPage = 0);
+    QPushButton* finishButton();
+
+    void showEvent (QShowEvent *aEvent);
+
+protected slots:
+
+    virtual void showNextPage();
+    virtual void showBackPage();
+    virtual void onPageShow() = 0;
+
+private:
+
+    int nextButtonIndex (QPushButton *aNextButton);
+    int backButtonIndex (QPushButton *aBackButton);
+    QPushButton* getButton (QWidget *aOfPage, const QString &aRegExp);
+
+    QStackedWidget      *mStackedWidget;
+    QList<QPushButton*>  mNextButtons;
+    QList<QPushButton*>  mBackButtons;
+    QList<QPushButton*>  mCancelButtons;
+    QPushButton         *mFinishButton;
+};
+
+#endif // __QIAbstractWizard_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIAdvancedSlider.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIAdvancedSlider.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIAdvancedSlider.h	(revision 25213)
@@ -0,0 +1,96 @@
+/** @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.
+ */
+
+#ifndef __QIAdvancedSlider_h__
+#define __QIAdvancedSlider_h__
+
+/* Qt includes */
+#include <QSlider>
+
+class CPrivateSlider;
+
+class QIAdvancedSlider: public QWidget
+{
+    Q_OBJECT;
+
+public:
+    QIAdvancedSlider (QWidget *aParent = 0);
+    QIAdvancedSlider (Qt::Orientation aOrientation, QWidget *aParent = 0);
+
+    int value() const;
+
+    void setRange (int aMinV, int aMaxV);
+
+    void setMaximum (int aVal);
+    int maximum() const;
+
+    void setMinimum (int aVal);
+    int minimum() const;
+
+    void setPageStep (int aVal);
+    int pageStep() const;
+
+    void setSingleStep (int aVal);
+    int singelStep() const;
+
+    void setTickInterval (int aVal);
+    int tickInterval() const;
+
+    void setTickPosition (QSlider::TickPosition aPos);
+    QSlider::TickPosition tickPosition() const;
+
+    Qt::Orientation orientation() const;
+
+    void setSnappingEnabled (bool aOn);
+    bool isSnappingEnabled() const;
+
+    void setOptimalHint (int aMin, int aMax);
+    void setWarningHint (int aMin, int aMax);
+    void setErrorHint (int aMin, int aMax);
+
+public slots:
+
+    void setOrientation (Qt::Orientation aOrientation);
+    void setValue (int aVal);
+
+signals:
+    void valueChanged (int);
+    void sliderMoved (int);
+    void sliderPressed();
+    void sliderReleased();
+
+private slots:
+
+    void prvSliderMoved (int val);
+
+private:
+
+    void init (Qt::Orientation aOrientation = Qt::Horizontal);
+    int snapValue(int val);
+
+    /* Private member vars */
+    CPrivateSlider *mSlider;
+    bool mSnappingEnabled;
+};
+
+#endif /* __QIAdvancedSlider__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIApplication.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIApplication.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIApplication.h	(revision 25213)
@@ -0,0 +1,85 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIApplication 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 __QIApplication_h__
+#define __QIApplication_h__
+
+/* Qt includes */
+#include <QApplication>
+
+typedef bool (*QIFilterCallback)(EventRef inEvent, void *inUserArg);
+
+
+/** Sligtly modified QApplication class.
+ *
+ *  The sole purpose of this class (ATM) is to hook the macEventFilter
+ *  in order to intercept Command-Q, Command-H and similar menu hot-keys
+ *  before the HI Manager translate them into (menu) command events and
+ *  start blinking menus in the menu bar.
+ *
+ * @remark
+ *  A special hack in qeventloop_mac.cpp is required for this
+ *  to work. Overloading QEventLoop::processEvents isn't feasable
+ *  unfortunately, thus the horrible hacks. Qt 4 does seem to provide
+ *  an interface similar to the one we create here.
+ *
+ *  Btw. is QI* the right right way to do this? Or should it perhapse
+ *  be called VBoxQApplication or something?
+ */
+class QIApplication : public QApplication
+{
+public:
+    QIApplication (int &argc, char **argv)
+        : QApplication (argc, argv)
+#ifdef Q_WS_MAC
+        , m_callback (NULL)
+        , m_callbackUserArg (NULL)
+#endif
+    {
+    }
+
+#ifdef Q_WS_MAC
+    bool macEventFilter (EventHandlerCallRef, EventRef inEvent)
+    {
+        if (    m_callback
+            &&  m_callback (inEvent, m_callbackUserArg))
+            return true;
+        return false;
+    }
+
+    void setEventFilter (QIFilterCallback callback, void *inUserArg)
+    {
+        m_callback = callback;
+        m_callbackUserArg = inUserArg;
+    }
+
+protected:
+    QIFilterCallback m_callback;
+    void *m_callbackUserArg;
+
+public:
+#endif
+};
+
+
+#endif // __QIApplication_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIArrowButtonPress.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIArrowButtonPress.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIArrowButtonPress.h	(revision 25213)
@@ -0,0 +1,57 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIArrowButtonPress 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 __QIArrowButtonPress_h__
+#define __QIArrowButtonPress_h__
+
+/* VBox includes */
+#include "QIRichToolButton.h"
+
+/* VBox forwards */
+class QIRichToolButton;
+
+/** @class QIArrowButtonPress
+ *
+ *  The QIArrowButtonPress class is an arrow tool-botton with text-label,
+ *  used as back/next buttons in QIMessageBox class.
+ *
+ */
+class QIArrowButtonPress : public QIRichToolButton
+{
+    Q_OBJECT;
+
+public:
+
+    QIArrowButtonPress (QWidget *aParent = 0);
+    QIArrowButtonPress (bool aNext, const QString &aName, QWidget *aParent = 0);
+
+    void setNext (bool aNext) { mNext = aNext; }
+
+private:
+
+    void updateIcon();
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+    bool mNext;
+};
+
+#endif
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIArrowButtonSwitch.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIArrowButtonSwitch.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIArrowButtonSwitch.h	(revision 25213)
@@ -0,0 +1,62 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIArrowButtonSwitch 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 __QIArrowButtonSwitch_h__
+#define __QIArrowButtonSwitch_h__
+
+/* VBox includes */
+#include "QIRichToolButton.h"
+
+/* VBox forwards */
+class QIRichToolButton;
+
+
+/** @class QIArrowButtonSwitch
+ *
+ *  The QIArrowButtonSwitch class is an arrow tool-botton with text-label,
+ *  used as collaps/expand switch in QIMessageBox class.
+ *
+ */
+class QIArrowButtonSwitch : public QIRichToolButton
+{
+    Q_OBJECT;
+
+public:
+
+    QIArrowButtonSwitch (QWidget *aParent = 0);
+    QIArrowButtonSwitch (const QString &aName, QWidget *aParent = 0);
+
+    bool isExpanded() const { return mIsExpanded; }
+
+private slots:
+
+    void buttonClicked();
+
+private:
+
+    void updateIcon();
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+    bool mIsExpanded;
+};
+
+#endif
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIArrowSplitter.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIArrowSplitter.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIArrowSplitter.h	(revision 25213)
@@ -0,0 +1,82 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIArrowSplitter 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 __QIArrowSplitter_h__
+#define __QIArrowSplitter_h__
+
+/* VBox includes */
+#include "QIArrowButtonPress.h"
+#include "QIArrowButtonSwitch.h"
+
+/* Qt includes */
+#include <QWidget>
+#include <QHBoxLayout>
+
+/* VBox forwards */
+class QIArrowButtonPress;
+class QIArrowButtonSwitch;
+
+/* Qt forwards */
+class QVBoxLayout;
+
+/** @class QIArrowSplitter
+ *
+ *  The QIArrowSplitter class is a folding widget placeholder.
+ *
+ */
+class QIArrowSplitter : public QWidget
+{
+    Q_OBJECT;
+
+public:
+
+    QIArrowSplitter (QWidget *aChild, QWidget *aParent = 0);
+
+    void setMultiPaging (bool aMultiPage);
+
+    void setButtonEnabled (bool aNext, bool aEnabled);
+
+    void setName (const QString &aName);
+
+public slots:
+
+    void toggleWidget();
+
+signals:
+
+    void showBackDetails();
+    void showNextDetails();
+
+private:
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+    void relayout();
+
+    QVBoxLayout *mMainLayout;
+    QIArrowButtonSwitch *mSwitchButton;
+    QIArrowButtonPress *mBackButton;
+    QIArrowButtonPress *mNextButton;
+    QWidget *mChild;
+};
+
+#endif
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIDialog.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIDialog.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIDialog.h	(revision 25213)
@@ -0,0 +1,53 @@
+/** @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.
+ */
+
+#ifndef __QIDialog_h__
+#define __QIDialog_h__
+
+/* Qt includes */
+#include <QDialog>
+
+/* Qt forwards declarations */
+class QEventLoop;
+
+class QIDialog: public QDialog
+{
+    Q_OBJECT;
+
+public:
+    QIDialog (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
+    void setVisible (bool aVisible);
+
+public slots:
+    int exec (bool aShow = true);
+
+protected:
+    void showEvent (QShowEvent *aEvent);
+
+private:
+    /* Private member vars */
+    bool mPolished;
+    QEventLoop *mEventLoop;
+};
+
+#endif /* __QIDialog_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIDialogButtonBox.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIDialogButtonBox.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIDialogButtonBox.h	(revision 25213)
@@ -0,0 +1,66 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIDialogButtonBox class declaration
+ */
+
+/*
+ * 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 __QIDialogButtonBox_h__
+#define __QIDialogButtonBox_h__
+
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QDialogButtonBox>
+#include <QPointer>
+
+class QBoxLayout;
+
+class VBoxHelpButton;
+
+class QIDialogButtonBox: public QIWithRetranslateUI<QDialogButtonBox>
+{
+public:
+    QIDialogButtonBox (QWidget *aParent = 0) :QIWithRetranslateUI<QDialogButtonBox> (aParent) {}
+    QIDialogButtonBox (Qt::Orientation aOrientation, QWidget *aParent = 0) :QIWithRetranslateUI<QDialogButtonBox> (aParent) { setOrientation (aOrientation); }
+    QIDialogButtonBox (StandardButtons aButtons, Qt::Orientation aOrientation = Qt::Horizontal, QWidget *aParent = 0);
+
+    QPushButton *button (StandardButton aWhich) const;
+
+    QPushButton *addButton (const QString &aText, ButtonRole aRole);
+    QPushButton *addButton (StandardButton aButton);
+
+    void setStandardButtons (StandardButtons aButtons);
+
+    void addExtraWidget (QWidget *aWidget);
+    void addExtraLayout (QLayout *aLayout);
+
+protected:
+
+    QBoxLayout *boxLayout() const;
+    int findEmptySpace (QBoxLayout *aLayout) const;
+
+    void retranslateUi();
+
+private:
+
+    QPointer<VBoxHelpButton> mHelpButton;
+};
+
+#endif /* __QIDialogButtonBox_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIFileDialog.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIFileDialog.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIFileDialog.h	(revision 25213)
@@ -0,0 +1,59 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Qt extensions: QIFileDialog class 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 __QIFileDialog_h__
+#define __QIFileDialog_h__
+
+/* Qt includes */
+#include <QFileDialog>
+
+class QIFileDialog : public QFileDialog
+{
+    Q_OBJECT;
+
+public:
+
+    QIFileDialog (QWidget *aParent, Qt::WindowFlags aFlags);
+
+    static QString getExistingDirectory (const QString &aDir, QWidget *aParent,
+                                         const QString &aCaption = QString::null,
+                                         bool aDirOnly = TRUE,
+                                         bool resolveSymlinks = TRUE);
+
+    static QString getSaveFileName (const QString &aStartWith, const QString &aFilters, QWidget *aParent,
+                                    const QString &aCaption, QString *aSelectedFilter = 0,
+                                    bool aResolveSymLinks = true);
+
+    static QString getOpenFileName (const QString &aStartWith, const QString &aFilters, QWidget *aParent,
+                                    const QString &aCaption, QString *aSelectedFilter = 0,
+                                    bool aResolveSymLinks = true);
+
+    static QStringList getOpenFileNames (const QString &aStartWith, const QString &aFilters, QWidget *aParent,
+                                         const QString &aCaption, QString *aSelectedFilter = 0,
+                                         bool aResolveSymLinks = true,
+                                         bool aSingleFile = false);
+
+    static QString getFirstExistingDir (const QString &aStartDir);
+};
+
+#endif /* __QIFileDialog_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIHotKeyEdit.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIHotKeyEdit.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIHotKeyEdit.h	(revision 25213)
@@ -0,0 +1,129 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIHotKeyEdit 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 ___QIHotKeyEdit_h___
+#define ___QIHotKeyEdit_h___
+
+#include <QLabel>
+#if defined (Q_WS_X11)
+#include <QMap>
+#endif
+#if defined (Q_WS_MAC)
+# include <Carbon/Carbon.h>
+/* Carbon.h includes AssertMacros.h which defines the macro "check". In
+ * QItemDelegate a class method is called check also. As we not used the macro
+ * undefine it here. */
+# undef check
+#endif
+
+#if defined (Q_WS_PM)
+/* Extra virtual keys returned by QIHotKeyEdit::virtualKey() */
+#define VK_LSHIFT   VK_USERFIRST + 0
+#define VK_LCTRL    VK_USERFIRST + 1
+#define VK_LWIN     VK_USERFIRST + 2
+#define VK_RWIN     VK_USERFIRST + 3
+#define VK_WINMENU  VK_USERFIRST + 4
+#define VK_FORWARD  VK_USERFIRST + 5
+#define VK_BACKWARD VK_USERFIRST + 6
+#endif
+
+class QIHotKeyEdit : public QLabel
+{
+    Q_OBJECT
+
+public:
+
+    QIHotKeyEdit (QWidget *aParent);
+    virtual ~QIHotKeyEdit();
+
+    void setKey (int aKeyVal);
+    int key() const { return mKeyVal; }
+
+    QString symbolicName() const { return mSymbName; }
+
+    QSize sizeHint() const;
+    QSize minimumSizeHint() const;
+
+#if defined (Q_WS_PM)
+    static int virtualKey (QMSG *aMsg);
+#endif
+
+#if defined (Q_WS_PM) || defined (Q_WS_X11)
+    static void retranslateUi();
+#endif
+    static QString keyName (int aKeyVal);
+    static bool isValidKey (int aKeyVal);
+
+public slots:
+
+    void clear();
+
+protected:
+
+#if defined (Q_WS_WIN32)
+    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)
+# ifdef QT_MAC_USE_COCOA
+    static bool darwinEventHandlerProc (const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser);
+# else
+    static pascal OSStatus darwinEventHandlerProc (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData);
+# endif
+    bool darwinKeyboardEvent (const void *pvCocoaEvent, EventRef inEvent);
+#endif
+
+    void focusInEvent (QFocusEvent *);
+    void focusOutEvent (QFocusEvent *);
+
+    void paintEvent (QPaintEvent *);
+
+private:
+
+    void updateText();
+
+    int mKeyVal;
+    QString mSymbName;
+
+#if defined (Q_WS_PM)
+    static QMap <int, QString> sKeyNames;
+#elif defined (Q_WS_X11)
+    static QMap <QString, QString> sKeyNames;
+#endif
+
+#if defined (Q_WS_MAC)
+# ifndef 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;
+#endif
+
+    static const char *kNoneSymbName;
+};
+
+#endif // !___QIHotKeyEdit_h___
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIHttp.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIHttp.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIHttp.h	(revision 25213)
@@ -0,0 +1,167 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * QIHttp class declaration & 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.
+ */
+
+#ifndef __QIHttp_h__
+#define __QIHttp_h__
+
+/* Qt includes */
+#include <QHttp>
+#include <QTimer>
+
+/* Time to auto-disconnect if no network answer received. */
+static const int MaxWaitTime = 20000;
+
+/* This is QHttp extension to unite different happens errors
+ * into one already present error processing mechanism. */
+class QIHttp : public QHttp
+{
+    Q_OBJECT;
+
+public:
+
+    /* Additional error codes */
+    enum AdvancedError
+    {
+        /* Basic QHttp errors */
+        NoError                          = QHttp::NoError,
+        UnknownError                     = QHttp::UnknownError,
+        HostNotFound                     = QHttp::HostNotFound,
+        ConnectionRefused                = QHttp::ConnectionRefused,
+        UnexpectedClose                  = QHttp::UnexpectedClose,
+        InvalidResponseHeader            = QHttp::InvalidResponseHeader,
+        WrongContentLength               = QHttp::WrongContentLength,
+        Aborted                          = QHttp::Aborted,
+        AuthenticationRequiredError      = QHttp::AuthenticationRequiredError,
+        ProxyAuthenticationRequiredError = QHttp::ProxyAuthenticationRequiredError,
+
+        /* Advanced QHttp errors */
+        TimeoutError,          /* MaxWaitTime time passed with no response */
+        PageNotFoundError,     /* Corresponds to 404 == not found header */
+        MovedPermanentlyError, /* Corresponds to 301 == moved permanently response */
+        MovedTemporarilyError  /* Corresponds to 302 == moved temporarily response */
+    };
+
+    QIHttp (QObject *aParent, const QString &aHostName, quint16 aPort = 80)
+        : QHttp (aHostName, aPort, aParent)
+        , mStatusCode (0)
+        , mErrorCode (NoError)
+    {
+        mTimeoutTimer.setSingleShot (true);
+        mTimeoutTimer.setInterval (MaxWaitTime);
+        connect (&mTimeoutTimer, SIGNAL (timeout()),
+                 this, SLOT (timeouted()));
+        connect (this, SIGNAL (dataReadProgress (int, int)),
+                 &mTimeoutTimer, SLOT (start()));
+        connect (this, SIGNAL (dataSendProgress (int, int)),
+                 &mTimeoutTimer, SLOT (start()));
+        connect (this, SIGNAL (done (bool)),
+                 &mTimeoutTimer, SLOT (stop()));
+
+        connect (this, SIGNAL (responseHeaderReceived (const QHttpResponseHeader &)),
+                 this, SLOT (processResponseHeader (const QHttpResponseHeader &)));
+        connect (this, SIGNAL (done (bool)), this, SLOT (processDone (bool)));
+    }
+
+    AdvancedError errorCode() const { return mErrorCode; }
+
+    QString errorString() const
+    {
+        switch (mErrorCode)
+        {
+            case TimeoutError:
+                return tr ("Connection timed out");
+            case PageNotFoundError:
+                return tr ("Could not locate the file on "
+                           "the server (response: %1)").arg (mStatusCode);
+            case MovedPermanentlyError:
+            case MovedTemporarilyError:
+                return QString::null; /* should be redirected anyway */
+            default:
+                return QHttp::errorString();
+        }
+    }
+
+    int get (const QString &aPath)
+    {
+        mTimeoutTimer.start();
+        return QHttp::get (aPath, 0);
+    }
+
+    int post (const QString &aPath)
+    {
+        mTimeoutTimer.start();
+        return QHttp::post (aPath, 0);
+    }
+
+    int request (const QHttpRequestHeader &aHeader)
+    {
+        mTimeoutTimer.start();
+        return QHttp::request (aHeader);
+    }
+
+signals:
+
+    void allIsDone (bool aError);
+
+private slots:
+
+    void timeouted()
+    {
+        mErrorCode = TimeoutError;
+        abort();
+    }
+
+    void processResponseHeader (const QHttpResponseHeader &aResponse)
+    {
+        mStatusCode = aResponse.statusCode();
+        switch (mStatusCode)
+        {
+            case 301:
+                mErrorCode = MovedPermanentlyError;
+                return abort();
+            case 302:
+                mErrorCode = MovedTemporarilyError;
+                return abort();
+            case 404:
+                mErrorCode = PageNotFoundError;
+                return abort();
+            default:
+                mErrorCode = (AdvancedError) QHttp::error();
+        }
+    }
+
+    void processDone (bool aError)
+    {
+        if (mErrorCode == NoError)
+            mErrorCode = (AdvancedError) QHttp::error();
+        emit allIsDone (aError);
+    }
+
+private:
+
+    QTimer mTimeoutTimer;
+    int mStatusCode;
+    AdvancedError mErrorCode;
+};
+
+#endif // __QIHttp_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QILabel.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QILabel.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QILabel.h	(revision 25213)
@@ -0,0 +1,94 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QILabel 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.
+ */
+
+/*
+ * This class is based on the original QLabel implementation.
+ */
+
+#ifndef __QILabel_h__
+#define __QILabel_h__
+
+/* Global includes */
+#include <QLabel>
+
+class QILabel: public QLabel
+{
+    Q_OBJECT;
+
+public:
+
+    QILabel (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
+    QILabel (const QString &aText, QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
+
+    /* Focusing extensions */
+    bool fullSizeSelection() const;
+    void setFullSizeSelection (bool aEnabled);
+
+    /* Size-Hint extensions */
+    void useSizeHintForWidth (int aWidthHint) const;
+    QSize sizeHint() const;
+    QSize minimumSizeHint() const;
+
+    /* Default QLabel methods */
+    QString text() const;
+
+public slots:
+
+    void clear();
+    void setText (const QString &aText);
+    void copy();
+
+protected:
+
+    void resizeEvent (QResizeEvent *aEvent);
+    void mousePressEvent (QMouseEvent *aEvent);
+    void mouseReleaseEvent (QMouseEvent *aEvent);
+    void mouseMoveEvent (QMouseEvent *aEvent);
+    void contextMenuEvent (QContextMenuEvent *aEvent);
+    void focusInEvent (QFocusEvent *aEvent);
+    void focusOutEvent (QFocusEvent *aEvent);
+    void paintEvent (QPaintEvent *aEvent);
+
+private:
+
+    void init();
+
+    void updateSizeHint() const;
+    void setFullText (const QString &aText);
+    void updateText();
+    QString removeHtmlTags (QString aText) const;
+    Qt::TextElideMode toTextElideMode (const QString& aStr) const;
+    QString compressText (const QString &aText) const;
+
+    QString mText;
+    bool mFullSizeSelection;
+    static const QRegExp mCopyRegExp;
+    static QRegExp mElideRegExp;
+    mutable bool mIsHintValid;
+    mutable int mWidthHint;
+    mutable QSize mOwnSizeHint;
+    bool mStartDragging;
+    QAction *mCopyAction;
+};
+
+#endif // __QILabel_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QILabelSeparator.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QILabelSeparator.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QILabelSeparator.h	(revision 25213)
@@ -0,0 +1,57 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QILabelSeparator class declaration
+ */
+
+/*
+ * 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 __QILabelSeparator_h__
+#define __QILabelSeparator_h__
+
+/* Global includes */
+#include <QWidget>
+
+/* Global forwards */
+class QLabel;
+
+class QILabelSeparator: public QWidget
+{
+    Q_OBJECT;
+
+public:
+
+    QILabelSeparator (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
+    QILabelSeparator (const QString &aText, QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
+
+    QString text() const;
+    void setBuddy (QWidget *aBuddy);
+
+public slots:
+
+    void clear();
+    void setText (const QString &aText);
+
+protected:
+
+    virtual void init();
+
+    QLabel *mLabel;
+};
+
+#endif // __QILabelSeparator_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QILineEdit.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QILineEdit.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QILineEdit.h	(revision 25213)
@@ -0,0 +1,47 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * QILineEdit class declarations
+ */
+
+/*
+ * 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 __QILineEdit_h__
+#define __QILineEdit_h__
+
+/* Qt includes */
+#include <QLineEdit>
+
+class QILineEdit: public QLineEdit
+{
+public:
+
+    QILineEdit (QWidget *aParent = 0)
+        :QLineEdit (aParent) {}
+    QILineEdit (const QString &aContents, QWidget *aParent = 0)
+        :QLineEdit (aContents, aParent) {}
+
+    void setMinimumWidthByText (const QString &aText);
+    void setFixedWidthByText (const QString &aText);
+
+private:
+
+    QSize featTextWidth (const QString &aText) const;
+};
+
+#endif /* __QILineEdit_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIListView.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIListView.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIListView.h	(revision 25213)
@@ -0,0 +1,53 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * QIListView, QIItemDelegate 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 __QIListView_h__
+#define __QIListView_h__
+
+/* Qt includes */
+#include <QListView>
+#include <QItemDelegate>
+
+class QIListView: public QListView
+{
+    Q_OBJECT;
+
+public:
+    QIListView (QWidget *aParent = 0);
+
+protected slots:
+    void focusChanged (QWidget *aOld, QWidget *aNow);
+}; 
+
+class QIItemDelegate: public QItemDelegate
+{
+public:
+    QIItemDelegate (QObject *aParent = 0)
+        : QItemDelegate (aParent) {}
+
+protected:
+    void drawBackground (QPainter *aPainter, const QStyleOptionViewItem &aOption, 
+                         const QModelIndex &aIndex) const;
+};
+
+#endif /* __QIListView_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIMainDialog.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIMainDialog.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIMainDialog.h	(revision 25213)
@@ -0,0 +1,95 @@
+/** @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.
+ */
+
+#ifndef __QIMainDialog_h__
+#define __QIMainDialog_h__
+
+/* Qt includes */
+#include <QMainWindow>
+#include <QDialog>
+#include <QPointer>
+
+class QEventLoop;
+class QSizeGrip;
+
+class QIMainDialog: public QMainWindow
+{
+    Q_OBJECT;
+
+public:
+
+    QIMainDialog (QWidget *aParent = 0, Qt::WindowFlags aFlags = Qt::Dialog);
+
+    QDialog::DialogCode exec();
+    QDialog::DialogCode result() const;
+
+    void setFileForProxyIcon (const QString &aFile);
+    QString fileForProxyIcon () const;
+
+    void setSizeGripEnabled (bool aEnabled);
+    bool isSizeGripEnabled () const;
+
+    void setDefaultButton (QPushButton *aButton);
+    QPushButton* defaultButton () const;
+
+public slots:
+
+    virtual void setVisible (bool aVisible);
+
+protected:
+
+    virtual bool event (QEvent *aEvent);
+    virtual void showEvent (QShowEvent *aEvent);
+    virtual void resizeEvent (QResizeEvent *aEvent);
+    virtual bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+    QPushButton* searchDefaultButton() const;
+
+    void centerAccording (QWidget *aWidget) { mCenterWidget = aWidget; }
+
+protected slots:
+
+    void accept();
+    void reject();
+    void done (QDialog::DialogCode aRescode);
+
+    void setResult (QDialog::DialogCode aRescode);
+
+    void openAction (QAction *aAction);
+
+private:
+
+    /* Private member vars */
+    QDialog::DialogCode mRescode;
+    QPointer<QEventLoop> mEventLoop;
+
+    QString mFileForProxyIcon;
+
+    QPointer<QSizeGrip> mSizeGrip;
+    QPointer<QPushButton> mDefaultButton;
+
+    bool mPolished;
+    QWidget *mCenterWidget;
+};
+
+#endif /* __QIMainDialog_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIMessageBox.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIMessageBox.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIMessageBox.h	(revision 25213)
@@ -0,0 +1,138 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIMessageBox 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 __QIMessageBox_h__
+#define __QIMessageBox_h__
+
+/* VBox includes */
+#include "QIDialog.h"
+#include "QIArrowSplitter.h"
+
+/* Qt includes */
+#include <QCheckBox>
+#include <QMessageBox>
+#include <QTextEdit>
+
+/* VBox forwards */
+class QIArrowSplitter;
+class QIDialogButtonBox;
+class QILabel;
+
+/* Qt forwards */
+class QCloseEvent;
+class QLabel;
+class QPushButton;
+class QSpacerItem;
+
+/** @class QIMessageBox
+ *
+ *  The QIMessageBox class is a message box similar to QMessageBox.
+ *  It partly implements the QMessageBox interface and adds some enhanced
+ *  functionality.
+ */
+class QIMessageBox : public QIDialog
+{
+    Q_OBJECT;
+
+public:
+
+    // for compatibility with QMessageBox
+    enum Icon
+    {
+        NoIcon = QMessageBox::NoIcon,
+        Information = QMessageBox::Information,
+        Warning = QMessageBox::Warning,
+        Critical = QMessageBox::Critical,
+        Question = QMessageBox::Question,
+        GuruMeditation,
+    };
+
+    enum
+    {
+        NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
+        Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9,
+        ButtonMask = 0xFF,
+
+        Default = 0x100, Escape = 0x200,
+        FlagMask = 0x300
+    };
+
+    QIMessageBox (const QString &aCaption, const QString &aText,
+                  Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
+                  QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE);
+
+    QString buttonText (int aButton) const;
+    void setButtonText (int aButton, const QString &aText);
+
+    QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; }
+    void setFlagText (const QString &aText);
+
+    bool isFlagChecked() const { return mFlagCB->isChecked(); }
+    void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
+
+    QString detailsText () const { return mDetailsText->toHtml(); }
+    void setDetailsText (const QString &aText);
+
+    QPixmap standardPixmap (QIMessageBox::Icon aIcon);
+
+private:
+
+    QPushButton *createButton (int aButton);
+
+    void closeEvent (QCloseEvent *e);
+    void showEvent (QShowEvent *e);
+
+    void refreshDetails();
+    void setDetailsShown (bool aShown);
+
+private slots:
+
+    void detailsBack();
+    void detailsNext();
+
+    void done0() { mWasDone = true; done (mButton0 & ButtonMask); }
+    void done1() { mWasDone = true; done (mButton1 & ButtonMask); }
+    void done2() { mWasDone = true; done (mButton2 & ButtonMask); }
+
+    void reject();
+
+private:
+
+    int mButton0, mButton1, mButton2, mButtonEsc;
+    QLabel *mIconLabel;
+    QILabel *mTextLabel;
+    QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
+    QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
+    QWidget *mDetailsVBox;
+    QIArrowSplitter *mDetailsSplitter;
+    QTextEdit *mDetailsText;
+    QSpacerItem *mSpacer;
+    QIDialogButtonBox *mButtonBox;
+    QString mText;
+    QList < QPair <QString, QString> > mDetailsList;
+    int mDetailsIndex;
+    bool mWasDone : 1;
+    bool mWasPolished : 1;
+};
+
+#endif
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIRichToolButton.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIRichToolButton.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIRichToolButton.h	(revision 25213)
@@ -0,0 +1,67 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIRichToolButton 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 __QIRichToolButton_h__
+#define __QIRichToolButton_h__
+
+/* Qt includes */
+#include <QLabel>
+#include <QWidget>
+#include <QToolButton>
+
+/** @class QIRichToolButton
+ *
+ *  The QIRichToolButton class is a tool-botton with separate text-label.
+ *
+ */
+class QIRichToolButton : public QWidget
+{
+    Q_OBJECT;
+
+public:
+
+    QIRichToolButton (QWidget *aParent = 0);
+    QIRichToolButton (const QString &aName, QWidget *aParent = 0);
+
+    void animateClick() { mButton->animateClick(); }
+    void setText (const QString &aName) { mLabel->setText (aName); }
+    QString text() const { return mLabel->text(); }
+
+signals:
+
+    void clicked();
+
+protected slots:
+
+    virtual void buttonClicked() { emit clicked(); }
+
+protected:
+
+    void init();
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+    void paintEvent (QPaintEvent *aEvent);
+
+    QToolButton *mButton;
+    QLabel *mLabel;
+};
+
+#endif
Index: trunk/src/VBox/Frontends/VirtualBox/include/QISplitter.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QISplitter.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QISplitter.h	(revision 25213)
@@ -0,0 +1,66 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QISplitter 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 _QISplitter_h_
+#define _QISplitter_h_
+
+/* Global includes */
+#include <QSplitter>
+
+/* Global forwardes */
+class SplitterHandle;
+
+class QISplitter : public QSplitter
+{
+    Q_OBJECT;
+
+public:
+
+    QISplitter (QWidget *aParent);
+
+private:
+
+    bool eventFilter (QObject *aWatched, QEvent *aEvent);
+    void showEvent (QShowEvent *aEvent);
+
+    QSplitterHandle* createHandle();
+
+    QByteArray mBaseState;
+
+    bool mPolished;
+};
+
+class QISplitterHandle : public QSplitterHandle
+{
+    Q_OBJECT;
+
+public:
+
+    QISplitterHandle (Qt::Orientation aOrientation, QISplitter *aParent);
+
+private:
+
+    void paintEvent (QPaintEvent *aEvent);
+};
+
+#endif /* _QISplitter_h_ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIStateIndicator.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIStateIndicator.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIStateIndicator.h	(revision 25213)
@@ -0,0 +1,91 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIStateIndicator 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 __QIStateIndicator_h__
+#define __QIStateIndicator_h__
+
+/* Qt includes */
+#include <QFrame>
+#include <QHash>
+
+class QIStateIndicator : public QFrame
+{
+    Q_OBJECT;
+
+public:
+
+    QIStateIndicator (int aState);
+    ~QIStateIndicator();
+
+    virtual QSize sizeHint() const;
+
+    int state () const { return mState; }
+
+    QPixmap stateIcon (int aState) const;
+    void setStateIcon (int aState, const QPixmap &aPixmap);
+
+public slots:
+
+    void setState (int aState);
+    void setState (bool aState) { setState ((int) aState); }
+
+signals:
+
+    void mouseDoubleClicked (QIStateIndicator *aIndicator,
+                             QMouseEvent *aEv);
+    void contextMenuRequested (QIStateIndicator *aIndicator,
+                               QContextMenuEvent *aEv);
+
+protected:
+
+    virtual void paintEvent (QPaintEvent *aEv);
+    virtual void drawContents (QPainter *aPainter);
+
+#ifdef Q_WS_MAC
+    virtual void mousePressEvent (QMouseEvent *aEv);
+#endif
+    virtual void mouseDoubleClickEvent (QMouseEvent *aEv);
+    virtual void contextMenuEvent (QContextMenuEvent *aEv);
+
+private:
+
+    int mState;
+    QSize mSize;
+
+    struct Icon
+    {
+        Icon (const QPixmap &aPixmap)
+            : pixmap (aPixmap)
+            , bgPixmap (NULL) {}
+
+        QPixmap pixmap;
+        QPixmap cached;
+        QColor bgColor;
+        const QPixmap *bgPixmap;
+        QPoint bgOff;
+    };
+
+    QHash <int, Icon *> mStateIcons;
+};
+
+#endif // __QIStateIndicator_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIStatusBar.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIStatusBar.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIStatusBar.h	(revision 25213)
@@ -0,0 +1,51 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIStatusBar 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 __QIStatusBar_h__
+#define __QIStatusBar_h__
+
+/* Qt includes */
+#include <QStatusBar>
+
+/**
+ *  The QIStatusBar class is a replacement of QStatusBar with disabling
+ *  drawing of sunken borders around every widget on the status bar.
+ */
+class QIStatusBar : public QStatusBar
+{
+    Q_OBJECT;
+
+public:
+
+    QIStatusBar (QWidget *aParent = 0);
+
+protected slots:
+
+    void rememberLastMessage (const QString &aMsg) { mMessage = aMsg; }
+
+protected:
+
+    QString mMessage;
+};
+
+#endif // __QIStatusBar_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIToolButton.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIToolButton.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIToolButton.h	(revision 25213)
@@ -0,0 +1,44 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIToolButton 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 __QIToolButton_h__
+#define __QIToolButton_h__
+
+/* Qt includes */
+#include <QToolButton>
+
+class QIToolButton: public QToolButton
+{
+    Q_OBJECT;
+
+public:
+    QIToolButton (QWidget *aParent = 0)
+      : QToolButton (aParent)
+    {
+#ifdef Q_WS_MAC
+        setStyleSheet ("QToolButton { border: 0px none black; }");
+#endif /* Q_WS_MAC */
+    }
+};
+
+#endif /* __QIToolButton_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QITreeView.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QITreeView.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QITreeView.h	(revision 25213)
@@ -0,0 +1,61 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QITreeView 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 __QITreeView_h__
+#define __QITreeView_h__
+
+/* Global includes */
+#include <QTreeView>
+
+/*
+ * QITreeView class which extends standard QITreeView's functionality.
+ */
+class QITreeView: public QTreeView
+{
+    Q_OBJECT;
+
+public:
+
+    QITreeView (QWidget *aParent = 0);
+
+signals:
+
+    void currentItemChanged (const QModelIndex &aCurrent, const QModelIndex &aPrevious);
+    void drawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex) const;
+    void mouseMoved (QMouseEvent *aEvent);
+    void mousePressed (QMouseEvent *aEvent);
+    void mouseDoubleClicked (QMouseEvent *aEvent);
+
+protected slots:
+
+    void currentChanged (const QModelIndex &aCurrent, const QModelIndex &aPrevious);
+
+protected:
+
+    void drawBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex) const;
+    void mouseMoveEvent (QMouseEvent *aEvent);
+    void mousePressEvent (QMouseEvent *aEvent);
+    void mouseDoubleClickEvent (QMouseEvent *aEvent);
+};
+
+#endif /* __QITreeView_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QITreeWidget.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QITreeWidget.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QITreeWidget.h	(revision 25213)
@@ -0,0 +1,54 @@
+/** @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.
+ */
+
+#ifndef __QITreeWidget_h__
+#define __QITreeWidget_h__
+
+/* Global includes */
+#include <QTreeWidget>
+
+/*
+ * QTreeWidget class which extends standard QTreeWidget's functionality.
+ */
+class QITreeWidget: public QTreeWidget
+{
+    Q_OBJECT;
+
+public:
+
+    QITreeWidget (QWidget *aParent = 0);
+
+    void addTopBottomMarginToItems (int aMargin);
+
+signals:
+
+    void painted (QTreeWidgetItem *aItem, QPainter *aPainter);
+    void resized (const QSize &aSize, const QSize &aOldSize);
+
+protected:
+
+    void paintEvent (QPaintEvent *aEvent);
+    void resizeEvent (QResizeEvent *aEvent);
+};
+
+#endif /* __QITreeWidget_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIWidgetValidator.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIWidgetValidator.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIWidgetValidator.h	(revision 25213)
@@ -0,0 +1,123 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: QIWidgetValidator 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 __QIWidgetValidator_h__
+#define __QIWidgetValidator_h__
+
+#include <limits.h>
+
+/* Qt includes */
+#include <QObject>
+#include <QValidator>
+#include <QList>
+
+class QIWidgetValidator : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    QIWidgetValidator (QWidget *aWidget, QObject *aParent = 0);
+    QIWidgetValidator (const QString &aCaption,
+                       QWidget *aWidget, QObject *aParent = 0);
+    ~QIWidgetValidator();
+
+    QWidget *widget() const { return mWidget; }
+    bool isValid() const;
+    void rescan();
+
+    void setCaption (const QString& aCaption) { mCaption = aCaption; }
+    QString caption() const { return mCaption; }
+
+    QString warningText() const;
+
+    QString lastWarning() const { return mLastWarning; }
+    void setLastWarning (const QString &aLastWarning) { mLastWarning = aLastWarning; }
+
+    void setOtherValid (bool aValid) { mOtherValid = aValid; }
+    bool isOtherValid() const { return mOtherValid; }
+
+signals:
+
+    void validityChanged (const QIWidgetValidator *aValidator);
+    void isValidRequested (QIWidgetValidator *aValidator);
+
+public slots:
+
+    void revalidate() { doRevalidate(); }
+
+private:
+
+    QString mLastWarning;
+    QString mCaption;
+    QWidget *mWidget;
+    bool mOtherValid;
+
+    struct Watched
+    {
+        Watched()
+            : widget (NULL), buddy (NULL)
+            , state (QValidator::Acceptable) {}
+
+        QWidget *widget;
+        QWidget *buddy;
+        QValidator::State state;
+    };
+
+    QList <Watched> mWatched;
+    Watched mLastInvalid;
+
+private slots:
+
+    void doRevalidate() { emit validityChanged (this); }
+};
+
+class QIULongValidator : public QValidator
+{
+public:
+
+    QIULongValidator (QObject *aParent)
+        : QValidator (aParent)
+        , mBottom (0), mTop (ULONG_MAX) {}
+
+    QIULongValidator (ulong aMinimum, ulong aMaximum,
+                      QObject *aParent)
+        : QValidator (aParent)
+        , mBottom (aMinimum), mTop (aMaximum) {}
+
+    ~QIULongValidator() {}
+
+    State validate (QString &aInput, int &aPos) const;
+    void setBottom (ulong aBottom) { setRange (aBottom, mTop); }
+    void setTop (ulong aTop) { setRange (mBottom, aTop); }
+    void setRange (ulong aBottom, ulong aTop) { mBottom = aBottom; mTop = aTop; }
+    ulong bottom() const { return mBottom; }
+    ulong top() const { return mTop; }
+
+private:
+
+    ulong mBottom;
+    ulong mTop;
+};
+
+#endif // __QIWidgetValidator_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/QIWithRetranslateUI.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/QIWithRetranslateUI.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/QIWithRetranslateUI.h	(revision 25213)
@@ -0,0 +1,88 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Declarations of utility classes and functions
+ * VirtualBox Qt extensions: QIWithRetranslateUI class declaration
+ */
+
+/*
+ * 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 __QIWithRetranslateUI_h
+#define __QIWithRetranslateUI_h
+
+/* Qt includes */
+#include <QObject>
+#include <QEvent>
+
+template <class Base>
+class QIWithRetranslateUI: public Base
+{
+public:
+
+    QIWithRetranslateUI (QWidget *aParent = 0) : Base (aParent) {}
+
+protected:
+
+    virtual void changeEvent (QEvent *aEvent)
+    {
+        Base::changeEvent (aEvent);
+        switch (aEvent->type())
+        {
+            case QEvent::LanguageChange:
+            {
+                retranslateUi();
+                aEvent->accept();
+                break;
+            }
+            default: 
+                break;
+        }
+    }
+
+    virtual void retranslateUi() = 0;
+};
+
+template <class Base>
+class QIWithRetranslateUI2: public Base
+{
+public:
+
+    QIWithRetranslateUI2 (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0) : Base (aParent, aFlags) {}
+    
+protected:
+
+    virtual void changeEvent (QEvent *aEvent)
+    {
+        Base::changeEvent (aEvent);
+        switch (aEvent->type())
+        {
+            case QEvent::LanguageChange:
+            {
+                retranslateUi();
+                aEvent->accept();
+                break;
+            }
+            default: 
+                break;
+        }
+    }
+
+    virtual void retranslateUi() = 0;
+};
+
+#endif /* __QIWithRetranslateUI_h */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxAboutDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxAboutDlg.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxAboutDlg.h	(revision 25213)
@@ -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/include/VBoxApplianceEditorWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxApplianceEditorWgt.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxApplianceEditorWgt.h	(revision 25213)
@@ -0,0 +1,281 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxApplianceEditorWgt 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 __VBoxApplianceEditorWgt_h__
+#define __VBoxApplianceEditorWgt_h__
+
+/* VBox includes */
+#include "COMDefs.h"
+#include "VBoxApplianceEditorWgt.gen.h"
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QSortFilterProxyModel>
+#include <QItemDelegate>
+
+/* VBox forward declarations */
+class ModelItem;
+
+////////////////////////////////////////////////////////////////////////////////
+// Globals
+
+enum TreeViewSection { DescriptionSection = 0, OriginalValueSection, ConfigValueSection };
+
+////////////////////////////////////////////////////////////////////////////////
+// ModelItem
+
+enum ModelItemType { RootType, VirtualSystemType, HardwareType };
+
+/* 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. */
+class ModelItem
+{
+public:
+    ModelItem (int aNumber, ModelItemType aType, ModelItem *aParent = NULL);
+
+    ~ModelItem();
+
+    ModelItem *parent() const { return mParentItem; }
+
+    void appendChild (ModelItem *aChild);
+    ModelItem * child (int aRow) const;
+
+    int row() const;
+
+    int childCount() const;
+    int columnCount() const { return 3; }
+
+    virtual Qt::ItemFlags itemFlags (int /* aColumn */) const { return 0; }
+    virtual bool setData (int /* aColumn */, const QVariant & /* aValue */, int /* aRole */) { return false; }
+    virtual QVariant data (int /* aColumn */, int /* aRole */) const { return QVariant(); }
+    virtual QWidget * createEditor (QWidget * /* aParent */, const QStyleOptionViewItem & /* aOption */, const QModelIndex & /* aIndex */) const { return NULL; }
+    virtual bool setEditorData (QWidget * /* aEditor */, const QModelIndex & /* aIndex */) const { return false; }
+    virtual bool setModelData (QWidget * /* aEditor */, QAbstractItemModel * /* aModel */, const QModelIndex & /* aIndex */) { return false; }
+
+    virtual void restoreDefaults() {}
+    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
+
+    ModelItemType type() const { return mType; }
+
+protected:
+    /* Protected member vars */
+    int mNumber;
+    ModelItemType mType;
+
+    ModelItem *mParentItem;
+    QList<ModelItem*> mChildItems;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemItem
+
+/* This class represent a Virtual System with an index. */
+class VirtualSystemItem: public ModelItem
+{
+public:
+    VirtualSystemItem (int aNumber, CVirtualSystemDescription aDesc, ModelItem *aParent);
+
+    virtual QVariant data (int aColumn, int aRole) const;
+
+    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
+
+private:
+    CVirtualSystemDescription mDesc;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// HardwareItem
+
+/* This class represent an hardware item of a Virtual System. All values of
+   KVirtualSystemDescriptionType are supported & handled differently. */
+class HardwareItem: public ModelItem
+{
+    friend class VirtualSystemSortProxyModel;
+public:
+
+    HardwareItem (int aNumber,
+                  KVirtualSystemDescriptionType aType,
+                  const QString &aRef,
+                  const QString &aOrigValue,
+                  const QString &aConfigValue,
+                  const QString &aExtraConfigValue,
+                  ModelItem *aParent);
+
+    virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
+
+    virtual bool setData (int aColumn, const QVariant &aValue, int aRole);
+    virtual QVariant data (int aColumn, int aRole) const;
+
+    virtual Qt::ItemFlags itemFlags (int aColumn) const;
+
+    virtual QWidget * createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
+    virtual bool setEditorData (QWidget *aEditor, const QModelIndex &aIndex) const;
+
+    virtual bool setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex &aIndex);
+
+    virtual void restoreDefaults()
+    {
+        mConfigValue = mConfigDefaultValue;
+        mCheckState = Qt::Checked;
+    }
+
+private:
+
+    /* Private member vars */
+    KVirtualSystemDescriptionType mType;
+    QString mRef;
+    QString mOrigValue;
+    QString mConfigValue;
+    QString mConfigDefaultValue;
+    QString mExtraConfigValue;
+    Qt::CheckState mCheckState;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemModel
+
+class VirtualSystemModel: public QAbstractItemModel
+{
+
+public:
+    VirtualSystemModel (QVector<CVirtualSystemDescription>& aVSDs, QObject *aParent = NULL);
+
+    QModelIndex index (int aRow, int aColumn, const QModelIndex &aParent = QModelIndex()) const;
+    QModelIndex parent (const QModelIndex &aIndex) const;
+    int rowCount (const QModelIndex &aParent = QModelIndex()) const;
+    int columnCount (const QModelIndex &aParent = QModelIndex()) const;
+    bool setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole);
+    QVariant data (const QModelIndex &aIndex, int aRole = Qt::DisplayRole) const;
+    Qt::ItemFlags flags (const QModelIndex &aIndex) const;
+    QVariant headerData (int aSection, Qt::Orientation aOrientation, int aRole) const;
+
+    QModelIndex buddy (const QModelIndex &aIndex) const;
+
+    void restoreDefaults (const QModelIndex& aParent = QModelIndex());
+    void putBack();
+
+private:
+    /* Private member vars */
+    ModelItem *mRootItem;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// 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. */
+class VirtualSystemDelegate: public QItemDelegate
+{
+public:
+    VirtualSystemDelegate (QAbstractProxyModel *aProxy, QObject *aParent = NULL);
+
+    QWidget * createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
+    void setEditorData (QWidget *aEditor, const QModelIndex &aIndex) const;
+    void setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex &aIndex) const;
+    void updateEditorGeometry (QWidget *aEditor, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
+
+    QSize sizeHint (const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const
+    {
+        QSize size = QItemDelegate::sizeHint (aOption, aIndex);
+#ifdef Q_WS_MAC
+        int h = 28;
+#else /* Q_WS_MAC */
+        int h = 24;
+#endif /* Q_WS_MAC */
+        size.setHeight (RT_MAX (h, size.height()));
+        return size;
+    }
+
+protected:
+#ifdef QT_MAC_USE_COCOA
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+#endif /* QT_MAC_USE_COCOA */
+
+private:
+    /* Private member vars */
+    QAbstractProxyModel *mProxy;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VirtualSystemSortProxyModel
+
+class VirtualSystemSortProxyModel: public QSortFilterProxyModel
+{
+public:
+    VirtualSystemSortProxyModel (QObject *aParent = NULL);
+
+protected:
+    bool filterAcceptsRow (int aSourceRow, const QModelIndex & aSourceParent) const;
+    bool lessThan (const QModelIndex &aLeft, const QModelIndex &aRight) const;
+
+    static KVirtualSystemDescriptionType mSortList[];
+
+    QList<KVirtualSystemDescriptionType> mFilterList;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxApplianceEditorWgt
+
+class VBoxApplianceEditorWgt : public QIWithRetranslateUI<QWidget>,
+                               public Ui::VBoxApplianceEditorWgt
+{
+    Q_OBJECT;
+
+public:
+    VBoxApplianceEditorWgt (QWidget *aParent = NULL);
+
+    bool isValid() const { return mAppliance != NULL; }
+    CAppliance* appliance() const { return mAppliance; }
+
+    static int minGuestRAM() { return mMinGuestRAM; }
+    static int maxGuestRAM() { return mMaxGuestRAM; }
+    static int minGuestCPUCount() { return mMinGuestCPUCount; }
+    static int maxGuestCPUCount() { return mMaxGuestCPUCount; }
+
+public slots:
+    void restoreDefaults();
+
+protected:
+    virtual void retranslateUi();
+
+    /* Protected member vars */
+    CAppliance *mAppliance;
+    VirtualSystemModel *mModel;
+
+private:
+    static void initSystemSettings();
+
+    /* Private member vars */
+    static int mMinGuestRAM;
+    static int mMaxGuestRAM;
+    static int mMinGuestCPUCount;
+    static int mMaxGuestCPUCount;
+};
+
+#endif /* __VBoxApplianceEditorWgt_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxAquaStyle.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxAquaStyle.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxAquaStyle.h	(revision 25213)
@@ -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/include/VBoxBootTable.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxBootTable.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxBootTable.h	(revision 25213)
@@ -0,0 +1,60 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxBootTable 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 __VBoxBootTable_h__
+#define __VBoxBootTable_h__
+
+/* Global includes */
+#include <QTreeWidget>
+
+/**
+ *  QTreeWidget class reimplementation to use as boot items table.
+ *  It has one unsorted column without header.
+ *  Keymapping handlers for ctrl-up & ctrl-down are translated into
+ *  boot-items up/down moving signals.
+ *  Emits itemToggled() signal when the item changed.
+ */
+class VBoxBootTable : public QTreeWidget
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxBootTable(QWidget *pParent);
+
+signals:
+
+    void moveItemUp();
+    void moveItemDown();
+    void itemToggled();
+
+protected:
+
+    void keyPressEvent(QKeyEvent *pEvent);
+
+private slots:
+
+    void onItemChanged();
+};
+
+#endif // __VBoxBootTable_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxCloseVMDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxCloseVMDlg.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxCloseVMDlg.h	(revision 25213)
@@ -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/include/VBoxCocoaHelper.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxCocoaHelper.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxCocoaHelper.h	(revision 25213)
@@ -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/include/VBoxCocoaSpecialControls.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxCocoaSpecialControls.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxCocoaSpecialControls.h	(revision 25213)
@@ -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/include/VBoxConsoleView.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h	(revision 25213)
@@ -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/include/VBoxConsoleWnd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h	(revision 25213)
@@ -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/include/VBoxDefs.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h	(revision 25213)
@@ -0,0 +1,187 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Header with common definitions and global functions
+ */
+
+/*
+ * 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 __VBoxDefs_h__
+#define __VBoxDefs_h__
+
+/* Qt includes */
+#include <QEvent>
+#include <QUuid>
+
+#define LOG_GROUP LOG_GROUP_GUI
+#include <VBox/log.h>
+#include <iprt/assert.h>
+#include <iprt/alloc.h>
+
+#ifdef DEBUG
+
+#define AssertWrapperOk(w)      \
+    AssertMsg (w.isOk(), (#w " is not okay (RC=0x%08X)", w.lastRC()))
+#define AssertWrapperOkMsg(w, m)      \
+    AssertMsg (w.isOk(), (#w ": " m " (RC=0x%08X)", w.lastRC()))
+
+#else /* #ifdef DEBUG */
+
+#define AssertWrapperOk(w)          do {} while (0)
+#define AssertWrapperOkMsg(w, m)    do {} while (0)
+
+#endif /* #ifdef DEBUG */
+
+#ifndef SIZEOF_ARRAY
+#define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
+#endif
+
+#if defined (VBOX_GUI_USE_QIMAGE) || \
+    defined (VBOX_GUI_USE_SDL) || \
+    defined (VBOX_GUI_USE_DDRAW)
+  #if !defined (VBOX_GUI_USE_EXT_FRAMEBUFFER)
+    #define VBOX_GUI_USE_EXT_FRAMEBUFFER
+  #endif
+#else
+  #if defined (VBOX_GUI_USE_EXT_FRAMEBUFFER)
+    #undef VBOX_GUI_USE_EXT_FRAMEBUFFER
+  #endif
+#endif
+
+/** Null UUID constant to be used as a default value for reference parameters */
+extern const QUuid QUuid_null;
+
+/** Common namespace for all enums */
+struct VBoxDefs
+{
+    /** Medium type. */
+    enum MediumType
+    {
+        MediumType_Invalid,
+        MediumType_HardDisk,
+        MediumType_DVD,
+        MediumType_Floppy,
+        MediumType_All
+    };
+
+    /** VM display rendering mode. */
+    enum RenderMode
+    {
+        InvalidRenderMode, TimerMode, QImageMode, SDLMode, DDRAWMode, Quartz2DMode
+#ifdef VBOX_GUI_USE_QGL
+        , QGLMode
+#endif
+    };
+
+    /** Additional Qt event types. */
+    enum
+    {
+        AsyncEventType = QEvent::User + 100,
+        ResizeEventType,
+        RepaintEventType,
+        SetRegionEventType,
+        MouseCapabilityEventType,
+        MousePointerChangeEventType,
+        MachineStateChangeEventType,
+        AdditionsStateChangeEventType,
+        MediaDriveChangeEventType,
+        MachineDataChangeEventType,
+        MachineRegisteredEventType,
+        SessionStateChangeEventType,
+        SnapshotEventType,
+        CanShowRegDlgEventType,
+        CanShowUpdDlgEventType,
+        NetworkAdapterChangeEventType,
+        USBCtlStateChangeEventType,
+        USBDeviceStateChangeEventType,
+        SharedFolderChangeEventType,
+        RuntimeErrorEventType,
+        ModifierKeyChangeEventType,
+        MediaEnumEventType,
+#if defined (Q_WS_WIN)
+        ShellExecuteEventType,
+#endif
+        ActivateMenuEventType,
+#if defined (Q_WS_MAC)
+        ShowWindowEventType,
+#endif
+        ChangeGUILanguageEventType,
+#if defined (VBOX_GUI_WITH_SYSTRAY)
+        CanShowTrayIconEventType,
+        ShowTrayIconEventType,
+        TrayIconChangeEventType,
+        MainWindowCountChangeEventType,
+#endif
+        AddVDMUrlsEventType,
+        ChangeDockIconUpdateEventType
+#ifdef VBOX_GUI_USE_QGL
+        ,
+        VHWACommandProcessType
+#endif
+    };
+
+    /** Size formatting types. */
+    enum FormatSize
+    {
+        FormatSize_Round,
+        FormatSize_RoundDown,
+        FormatSize_RoundUp
+    };
+
+    static const char* GUI_LastWindowPosition;
+    static const char* GUI_LastWindowPosition_Max;
+    static const char* GUI_Fullscreen;
+    static const char* GUI_Seamless;
+    static const char* GUI_AutoresizeGuest;
+    static const char* GUI_FirstRun;
+    static const char* GUI_SaveMountedAtRuntime;
+    static const char* GUI_ShowMiniToolBar;
+    static const char* GUI_MiniToolBarAlignment;
+    static const char* GUI_MiniToolBarAutoHide;
+    static const char* GUI_LastCloseAction;
+    static const char* GUI_SuppressMessages;
+    static const char* GUI_PermanentSharedFoldersAtRuntime;
+#ifdef Q_WS_X11
+    static const char* GUI_LicenseKey;
+#endif
+    static const char* GUI_RegistrationDlgWinID;
+    static const char* GUI_RegistrationData;
+    static const char* GUI_UpdateDlgWinID;
+    static const char* GUI_UpdateDate;
+    static const char* GUI_UpdateCheckCount;
+    static const char* GUI_LastVMSelected;
+    static const char* GUI_InfoDlgState;
+    static const char* GUI_RenderMode;
+#ifdef VBOX_GUI_WITH_SYSTRAY
+    static const char* GUI_TrayIconWinID;
+    static const char* GUI_MainWindowCount;
+#endif
+#ifdef Q_WS_MAC
+    static const char* GUI_RealtimeDockIconUpdateEnabled;
+#endif /* Q_WS_MAC */
+    static const char* GUI_PassCAD;
+    static const char* GUI_Export_StorageType;
+    static const char* GUI_Export_Username;
+    static const char* GUI_Export_Hostname;
+    static const char* GUI_Export_Bucket;
+    static const char* GUI_PreventBetaWarning;
+};
+
+#define MAC_LEOPARD_STYLE defined(Q_WS_MAC) && (QT_VERSION >= 0x040300)
+
+#endif // __VBoxDefs_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxDownloaderWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxDownloaderWgt.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxDownloaderWgt.h	(revision 25213)
@@ -0,0 +1,93 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxDownloaderWgt 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 __VBoxDownloaderWgt_h__
+#define __VBoxDownloaderWgt_h__
+
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QUrl>
+#include <QWidget>
+
+class QIHttp;
+class QHttpResponseHeader;
+class QProgressBar;
+class QToolButton;
+
+/**
+ * The VBoxDownloaderWgt class is QWidget class re-implementation which embeds
+ * into the Dialog's status-bar and allows background http downloading.
+ * This class is not supposed to be used itself and made for sub-classing only.
+ *
+ * This class has two parts:
+ * 1. Acknowledging (getting information about target presence and size).
+ * 2. Downloading (starting and handling file downloading process).
+ * Every subclass can determine using or not those two parts and handling
+ * the result of those parts itself.
+ */
+class VBoxDownloaderWgt : public QIWithRetranslateUI <QWidget>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxDownloaderWgt (const QString &aSource, const QString &aTarget);
+
+    virtual void start();
+
+protected slots:
+
+    /* Acknowledging part */
+    virtual void acknowledgeStart();
+    virtual void acknowledgeProcess (const QHttpResponseHeader &aResponse);
+    virtual void acknowledgeFinished (bool aError);
+
+    /* Downloading part */
+    virtual void downloadStart();
+    virtual void downloadProcess (int aDone, int aTotal);
+    virtual void downloadFinished (bool aError);
+
+    /* Common slots */
+    virtual void cancelDownloading();
+    virtual void abortDownload (const QString &aError);
+    virtual void suicide();
+
+protected:
+
+    /* In sub-class this function will show the user downloading object size
+     * and ask him about downloading confirmation. Returns user response. */
+    virtual bool confirmDownload() = 0;
+
+    /* In sub-class this function will show the user which error happens
+     * in context of downloading file and executing his request. */
+    virtual void warnAboutError (const QString &aError) = 0;
+
+    QUrl mSource;
+    QString mTarget;
+    QIHttp *mHttp;
+    QProgressBar *mProgressBar;
+    QToolButton *mCancelButton;
+};
+
+#endif // __VBoxDownloaderWgt_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWgt.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWgt.h	(revision 25213)
@@ -0,0 +1,40 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxExportApplianceWgt 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 __VBoxExportApplianceWgt_h__
+#define __VBoxExportApplianceWgt_h__
+
+#include "VBoxApplianceEditorWgt.h"
+
+class VBoxExportApplianceWgt : public VBoxApplianceEditorWgt
+{
+public:
+    VBoxExportApplianceWgt (QWidget *aParent = NULL);
+
+    CAppliance* init();
+
+    void populate();
+    void prepareExport();
+};
+
+#endif /* __VBoxExportApplianceWgt_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWzd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWzd.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxExportApplianceWzd.h	(revision 25213)
@@ -0,0 +1,83 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxExportApplianceWzd 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 __VBoxExportApplianceWzd_h__
+#define __VBoxExportApplianceWzd_h__
+
+#include "VBoxExportApplianceWzd.gen.h"
+#include "QIAbstractWizard.h"
+#include "QIWithRetranslateUI.h"
+
+class QIWidgetValidator;
+class CAppliance;
+
+class VBoxExportApplianceWzd : public QIWithRetranslateUI<QIAbstractWizard>,
+                               public Ui::VBoxExportApplianceWzd
+{
+    Q_OBJECT;
+
+    enum StorageType
+    {
+        Filesystem,
+        SunCloud,
+        S3
+    };
+
+
+public:
+    VBoxExportApplianceWzd (QWidget* aParent = NULL, const QString& aSelectName = QString::null);
+
+protected:
+    void retranslateUi();
+
+private slots:
+    void revalidate (QIWidgetValidator *aWval);
+    void enableNext (const QIWidgetValidator *aWval);
+
+    void accept();
+
+    void showNextPage();
+    void onPageShow();
+
+private:
+    void addListViewVMItems (const QString& aSelectName);
+    bool prepareSettingsWidget();
+    bool exportVMs (CAppliance &aAppliance);
+    QString uri() const;
+    StorageType currentStorageType() const;
+    void setCurrentStorageType(VBoxExportApplianceWzd::StorageType aType);
+
+    void storageTypeChanged();
+
+    /* Private member vars */
+    QString mDefaultApplianceName;
+
+    QIWidgetValidator *mWValVMSelector;
+    QIWidgetValidator *mWValFileSelector;
+
+    QString mExportToFileSystemDesc;
+    QString mExportToSunCloudDesc;
+    QString mExportToS3Desc;
+};
+
+#endif /* __VBoxExportApplianceWzd_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h	(revision 25213)
@@ -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/include/VBoxFBOverlayCommon.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlayCommon.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlayCommon.h	(revision 25213)
@@ -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/include/VBoxFilePathSelectorWidget.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxFilePathSelectorWidget.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxFilePathSelectorWidget.h	(revision 25213)
@@ -0,0 +1,209 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VirtualBox Qt extensions: VBoxFilePathSelectorWidget class declaration
+ */
+
+/*
+ * 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 __VBoxFilePathSelectorWidget_h__
+#define __VBoxFilePathSelectorWidget_h__
+
+/* VBox includes */
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QComboBox>
+
+/* VBox forward declarations */
+class QILabel;
+class QILineEdit;
+
+/* Qt forward declarations */
+class QHBoxLayout;
+class QFileIconProvider;
+class QAction;
+class QPushButton;
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxFilePathSelectorWidget
+
+class VBoxFilePathSelectorWidget: public QIWithRetranslateUI<QComboBox>
+{
+    Q_OBJECT;
+
+public:
+
+    enum Mode
+    {
+        Mode_Folder = 0,
+        Mode_File_Open,
+        Mode_File_Save
+    };
+
+    VBoxFilePathSelectorWidget (QWidget *aParent);
+   ~VBoxFilePathSelectorWidget();
+
+    void setMode (Mode aMode);
+    Mode mode() const;
+
+    void setEditable (bool aOn);
+    bool isEditable() const;
+
+    void setResetEnabled (bool aEnabled);
+    bool isResetEnabled () const;
+
+    void setFileDialogTitle (const QString& aTitle);
+    QString fileDialogTitle() const;
+
+    void setFileFilters (const QString& aFilters);
+    QString fileFilters() const;
+
+    void setDefaultSaveExt (const QString &aExt);
+    QString defaultSaveExt() const;
+
+    void resetModified();
+    bool isModified() const;
+    bool isPathSelected() const;
+
+    QString path() const;
+
+signals:
+    void pathChanged (const QString &);
+
+public slots:
+
+    void setPath (const QString &aPath, bool aRefreshText = true);
+    void setHomeDir (const QString &aHomeDir);
+
+protected:
+
+    void resizeEvent (QResizeEvent *aEvent);
+    void focusInEvent (QFocusEvent *aEvent);
+    void focusOutEvent (QFocusEvent *aEvent);
+    bool eventFilter (QObject *aObj, QEvent *aEv);
+    void retranslateUi();
+
+private slots:
+
+    void onActivated (int aIndex);
+    void onTextEdited (const QString &aPath);
+    void copyToClipboard();
+    void refreshText();
+
+private:
+
+    void changePath (const QString &aPath, bool aRefreshText = true);
+    void selectPath();
+    QIcon defaultIcon() const;
+    QString fullPath (bool aAbsolute = true) const;
+    QString shrinkText (int aWidth) const;
+
+    /* Private member vars */
+    QFileIconProvider *mIconProvider;
+    QAction *mCopyAction;
+    Mode mMode;
+    QString mPath;
+    QString mHomeDir;
+    QString mFileFilters;
+    QString mDefaultSaveExt;
+    QString mFileDialogTitle;
+    QString mNoneStr;
+    QString mNoneTip;
+    bool mIsEditable;
+    bool mIsEditableMode;
+    bool mIsMouseAwaited;
+
+    bool mModified;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxEmptyFileSelector
+
+class VBoxEmptyFileSelector: public QIWithRetranslateUI<QWidget>
+{
+    Q_OBJECT;
+
+public:
+    enum ButtonPosition
+    {
+        LeftPosition,
+        RightPosition
+    };
+
+    VBoxEmptyFileSelector (QWidget *aParent = NULL);
+
+    void setMode (VBoxFilePathSelectorWidget::Mode aMode);
+    VBoxFilePathSelectorWidget::Mode mode() const;
+
+    void setButtonPosition (ButtonPosition aPos);
+    ButtonPosition buttonPosition() const;
+
+    void setEditable (bool aOn);
+    bool isEditable() const;
+
+    void setChooserVisible (bool aOn);
+    bool isChooserVisible() const;
+
+    QString path() const;
+
+    void setDefaultSaveExt (const QString &aExt);
+    QString defaultSaveExt() const;
+
+    bool isModified () const { return mIsModified; }
+    void resetModified () { mIsModified = false; }
+
+    void setFileDialogTitle (const QString& aTitle);
+    QString fileDialogTitle() const;
+
+    void setFileFilters (const QString& aFilters);
+    QString fileFilters() const;
+
+    void setHomeDir (const QString& aDir);
+    QString homeDir() const;
+
+signals:
+    void pathChanged (QString);
+
+public slots:
+    void setPath (const QString& aPath);
+
+protected:
+    void retranslateUi();
+
+private slots:
+    void choose();
+    void textChanged (const QString& aPath);
+
+private:
+    /* Private member vars */
+    QHBoxLayout *mMainLayout;
+    QWidget *mPathWgt;
+    QILabel *mLabel;
+    VBoxFilePathSelectorWidget::Mode mMode;
+    QILineEdit *mLineEdit;
+    QPushButton *mSelectButton;
+    QString mFileDialogTitle;
+    QString mFileFilters;
+    QString mDefaultSaveExt;
+    QString mHomeDir;
+    bool mIsModified;
+    QString mPath;
+};
+
+#endif /* __VBoxFilePathSelectorWidget_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h	(revision 25213)
@@ -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/include/VBoxGLSettingsGeneral.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsGeneral.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsGeneral.h	(revision 25213)
@@ -0,0 +1,51 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxGLSettingsGeneral 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 __VBoxGLSettingsGeneral_h__
+#define __VBoxGLSettingsGeneral_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxGLSettingsGeneral.gen.h"
+
+class VBoxGLSettingsGeneral : public VBoxSettingsPage,
+                              public Ui::VBoxGLSettingsGeneral
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxGLSettingsGeneral();
+
+protected:
+
+    void getFrom (const CSystemProperties &aProps,
+                  const VBoxGlobalSettings &aGs);
+    void putBackTo (CSystemProperties &aProps,
+                    VBoxGlobalSettings &aGs);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+};
+
+#endif // __VBoxGLSettingsGeneral_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsInput.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsInput.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsInput.h	(revision 25213)
@@ -0,0 +1,51 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxGLSettingsInput 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 __VBoxGLSettingsInput_h__
+#define __VBoxGLSettingsInput_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxGLSettingsInput.gen.h"
+
+class VBoxGLSettingsInput : public VBoxSettingsPage,
+                            public Ui::VBoxGLSettingsInput
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxGLSettingsInput();
+
+protected:
+
+    void getFrom (const CSystemProperties &aProps,
+                  const VBoxGlobalSettings &aGs);
+    void putBackTo (CSystemProperties &aProps,
+                    VBoxGlobalSettings &aGs);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+};
+
+#endif // __VBoxGLSettingsInput_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsLanguage.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsLanguage.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsLanguage.h	(revision 25213)
@@ -0,0 +1,62 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxGLSettingsLanguage 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 __VBoxGLSettingsLanguage_h__
+#define __VBoxGLSettingsLanguage_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxGLSettingsLanguage.gen.h"
+
+class VBoxGLSettingsLanguage : public VBoxSettingsPage,
+                               public Ui::VBoxGLSettingsLanguage
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxGLSettingsLanguage();
+
+protected:
+
+    void getFrom (const CSystemProperties &aProps,
+                  const VBoxGlobalSettings &aGs);
+    void putBackTo (CSystemProperties &aProps,
+                    VBoxGlobalSettings &aGs);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void reload (const QString &aLangId);
+
+    void retranslateUi();
+
+private slots:
+
+    void mTwItemPainted (QTreeWidgetItem *aItem, QPainter *aPainter);
+    void mTwLanguageChanged (QTreeWidgetItem *aItem);
+
+private:
+
+    bool mLanguageChanged;
+};
+
+#endif // __VBoxGLSettingsLanguage_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsNetwork.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsNetwork.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsNetwork.h	(revision 25213)
@@ -0,0 +1,141 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxGLSettingsNetwork 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 __VBoxGLSettingsNetwork_h__
+#define __VBoxGLSettingsNetwork_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxGLSettingsNetwork.gen.h"
+
+class NetworkItem : public QTreeWidgetItem
+{
+public:
+
+    NetworkItem();
+
+    void getFromInterface (const CHostNetworkInterface &aInterface);
+    void putBackToInterface();
+
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    QString updateInfo();
+
+    /* Common getters */
+    bool isChanged() const { return mChanged; }
+
+    /* Common setters */
+    void setChanged (bool aChanged) { mChanged = aChanged; }
+
+    /* Page getters */
+    QString name() const { return mName; }
+    bool isDhcpClientEnabled() const { return mDhcpClientEnabled; }
+    QString interfaceAddress() const { return mInterfaceAddress; }
+    QString interfaceMask() const { return mInterfaceMask; }
+    bool isIpv6Supported() const { return mIpv6Supported; }
+    QString interfaceAddress6() const { return mInterfaceAddress6; }
+    QString interfaceMaskLength6() const { return mInterfaceMaskLength6; }
+
+    bool isDhcpServerEnabled() const { return mDhcpServerEnabled; }
+    QString dhcpServerAddress() const { return mDhcpServerAddress; }
+    QString dhcpServerMask() const { return mDhcpServerMask; }
+    QString dhcpLowerAddress() const { return mDhcpLowerAddress; }
+    QString dhcpUpperAddress() const { return mDhcpUpperAddress; }
+
+    /* Page setters */
+    void setDhcpClientEnabled (bool aEnabled) { mDhcpClientEnabled = aEnabled; }
+    void setInterfaceAddress (const QString &aValue) { mInterfaceAddress = aValue; }
+    void setInterfaceMask (const QString &aValue) { mInterfaceMask = aValue; }
+    void setIp6Supported (bool aSupported) { mIpv6Supported = aSupported; }
+    void setInterfaceAddress6 (const QString &aValue) { mInterfaceAddress6 = aValue; }
+    void setInterfaceMaskLength6 (const QString &aValue) { mInterfaceMaskLength6 = aValue; }
+
+    void setDhcpServerEnabled (bool aEnabled) { mDhcpServerEnabled = aEnabled; }
+    void setDhcpServerAddress (const QString &aValue) { mDhcpServerAddress = aValue; }
+    void setDhcpServerMask (const QString &aValue) { mDhcpServerMask = aValue; }
+    void setDhcpLowerAddress (const QString &aValue) { mDhcpLowerAddress = aValue; }
+    void setDhcpUpperAddress (const QString &aValue) { mDhcpUpperAddress = aValue; }
+
+private:
+
+    /* Common */
+    CHostNetworkInterface mInterface;
+    bool mChanged;
+
+    /* Host-only Interface */
+    QString mName;
+    bool mDhcpClientEnabled;
+    QString mInterfaceAddress;
+    QString mInterfaceMask;
+    bool mIpv6Supported;
+    QString mInterfaceAddress6;
+    QString mInterfaceMaskLength6;
+
+    /* DHCP Server */
+    bool mDhcpServerEnabled;
+    QString mDhcpServerAddress;
+    QString mDhcpServerMask;
+    QString mDhcpLowerAddress;
+    QString mDhcpUpperAddress;
+};
+
+class VBoxGLSettingsNetwork : public VBoxSettingsPage,
+                              public Ui::VBoxGLSettingsNetwork
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxGLSettingsNetwork();
+
+protected:
+
+    void getFrom (const CSystemProperties &aProps,
+                  const VBoxGlobalSettings &aGs);
+    void putBackTo (CSystemProperties &aProps,
+                    VBoxGlobalSettings &aGs);
+
+    void setValidator (QIWidgetValidator *aVal);
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+
+private slots:
+
+    void addInterface();
+    void remInterface();
+    void editInterface();
+    void updateCurrentItem();
+    void showContextMenu (const QPoint &aPos);
+
+private:
+
+    QAction *mAddInterface;
+    QAction *mRemInterface;
+    QAction *mEditInterface;
+
+    QIWidgetValidator *mValidator;
+};
+
+#endif // __VBoxGLSettingsNetwork_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsNetworkDetails.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsNetworkDetails.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsNetworkDetails.h	(revision 25213)
@@ -0,0 +1,61 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxGLSettingsNetworkDetails 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 __VBoxGLSettingsNetworkDetails_h__
+#define __VBoxGLSettingsNetworkDetails_h__
+
+/* VBox includes */
+#include "QIDialog.h"
+#include "QIWithRetranslateUI.h"
+#include "VBoxGLSettingsNetworkDetails.gen.h"
+
+/* VBox forwards */
+class NetworkItem;
+
+class VBoxGLSettingsNetworkDetails : public QIWithRetranslateUI2 <QIDialog>,
+                                     public Ui::VBoxGLSettingsNetworkDetails
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxGLSettingsNetworkDetails (QWidget *aParent);
+
+    void getFromItem (NetworkItem *aItem);
+    void putBackToItem();
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void dhcpClientStatusChanged();
+    void dhcpServerStatusChanged();
+
+private:
+
+    NetworkItem *mItem;
+};
+
+#endif // __VBoxGLSettingsNetworkDetails_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsUpdate.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsUpdate.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGLSettingsUpdate.h	(revision 25213)
@@ -0,0 +1,68 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxGLSettingsUpdate 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 __VBoxGLSettingsUpdate_h__
+#define __VBoxGLSettingsUpdate_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxGLSettingsUpdate.gen.h"
+#include "VBoxUpdateDlg.h"
+
+class VBoxGLSettingsUpdate : public VBoxSettingsPage,
+                             public Ui::VBoxGLSettingsUpdate
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxGLSettingsUpdate();
+
+protected:
+
+    void getFrom (const CSystemProperties &aProps,
+                  const VBoxGlobalSettings &aGs);
+    void putBackTo (CSystemProperties &aProps,
+                    VBoxGlobalSettings &aGs);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+
+private slots:
+
+    void toggleUpdater (bool aOn);
+    void activatedPeriod (int aIndex);
+    void toggledBranch();
+
+private:
+
+    void showEvent (QShowEvent *aEvent);
+
+    VBoxUpdateData::PeriodType periodType() const;
+    VBoxUpdateData::BranchType branchType() const;
+
+    bool mSettingsChanged;
+    QRadioButton *mLastChosen;
+};
+
+#endif // __VBoxGLSettingsUpdate_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h	(revision 25213)
@@ -0,0 +1,1067 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxGlobal 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 __VBoxGlobal_h__
+#define __VBoxGlobal_h__
+
+#include "COMDefs.h"
+#include "VBox/com/Guid.h"
+
+#include "VBoxGlobalSettings.h"
+#include "VBoxMedium.h"
+
+/* Qt includes */
+#include <QApplication>
+#include <QLayout>
+#include <QMenu>
+#include <QStyle>
+#include <QProcess>
+#include <QHash>
+
+#ifdef Q_WS_X11
+# include <sys/wait.h>
+#endif
+
+class QAction;
+class QLabel;
+class QToolButton;
+
+// VirtualBox callback events
+////////////////////////////////////////////////////////////////////////////////
+
+class VBoxMachineStateChangeEvent : public QEvent
+{
+public:
+    VBoxMachineStateChangeEvent (const QString &aId, KMachineState aState)
+        : QEvent ((QEvent::Type) VBoxDefs::MachineStateChangeEventType)
+        , id (aId), state (aState)
+        {}
+
+    const QString id;
+    const KMachineState state;
+};
+
+class VBoxMachineDataChangeEvent : public QEvent
+{
+public:
+    VBoxMachineDataChangeEvent (const QString &aId)
+        : QEvent ((QEvent::Type) VBoxDefs::MachineDataChangeEventType)
+        , id (aId)
+        {}
+
+    const QString id;
+};
+
+class VBoxMachineRegisteredEvent : public QEvent
+{
+public:
+    VBoxMachineRegisteredEvent (const QString &aId, bool aRegistered)
+        : QEvent ((QEvent::Type) VBoxDefs::MachineRegisteredEventType)
+        , id (aId), registered (aRegistered)
+        {}
+
+    const QString id;
+    const bool registered;
+};
+
+class VBoxSessionStateChangeEvent : public QEvent
+{
+public:
+    VBoxSessionStateChangeEvent (const QString &aId, KSessionState aState)
+        : QEvent ((QEvent::Type) VBoxDefs::SessionStateChangeEventType)
+        , id (aId), state (aState)
+        {}
+
+    const QString id;
+    const KSessionState state;
+};
+
+class VBoxSnapshotEvent : public QEvent
+{
+public:
+
+    enum What { Taken, Discarded, Changed };
+
+    VBoxSnapshotEvent (const QString &aMachineId, const QString &aSnapshotId,
+                       What aWhat)
+        : QEvent ((QEvent::Type) VBoxDefs::SnapshotEventType)
+        , what (aWhat)
+        , machineId (aMachineId), snapshotId (aSnapshotId)
+        {}
+
+    const What what;
+
+    const QString machineId;
+    const QString snapshotId;
+};
+
+class VBoxCanShowRegDlgEvent : public QEvent
+{
+public:
+    VBoxCanShowRegDlgEvent (bool aCanShow)
+        : QEvent ((QEvent::Type) VBoxDefs::CanShowRegDlgEventType)
+        , mCanShow (aCanShow)
+        {}
+
+    const bool mCanShow;
+};
+
+class VBoxCanShowUpdDlgEvent : public QEvent
+{
+public:
+    VBoxCanShowUpdDlgEvent (bool aCanShow)
+        : QEvent ((QEvent::Type) VBoxDefs::CanShowUpdDlgEventType)
+        , mCanShow (aCanShow)
+        {}
+
+    const bool mCanShow;
+};
+
+class VBoxChangeGUILanguageEvent : public QEvent
+{
+public:
+    VBoxChangeGUILanguageEvent (QString aLangId)
+        : QEvent ((QEvent::Type) VBoxDefs::ChangeGUILanguageEventType)
+        , mLangId (aLangId)
+        {}
+
+    const QString mLangId;
+};
+
+#ifdef VBOX_GUI_WITH_SYSTRAY
+class VBoxMainWindowCountChangeEvent : public QEvent
+{
+public:
+    VBoxMainWindowCountChangeEvent (int aCount)
+        : QEvent ((QEvent::Type) VBoxDefs::MainWindowCountChangeEventType)
+        , mCount (aCount)
+        {}
+
+    const int mCount;
+};
+
+class VBoxCanShowTrayIconEvent : public QEvent
+{
+public:
+    VBoxCanShowTrayIconEvent (bool aCanShow)
+        : QEvent ((QEvent::Type) VBoxDefs::CanShowTrayIconEventType)
+        , mCanShow (aCanShow)
+        {}
+
+    const bool mCanShow;
+};
+
+class VBoxShowTrayIconEvent : public QEvent
+{
+public:
+    VBoxShowTrayIconEvent (bool aShow)
+        : QEvent ((QEvent::Type) VBoxDefs::ShowTrayIconEventType)
+        , mShow (aShow)
+        {}
+
+    const bool mShow;
+};
+
+class VBoxChangeTrayIconEvent : public QEvent
+{
+public:
+    VBoxChangeTrayIconEvent (bool aChanged)
+        : QEvent ((QEvent::Type) VBoxDefs::TrayIconChangeEventType)
+        , mChanged (aChanged)
+        {}
+
+    const bool mChanged;
+};
+#endif
+
+class VBoxChangeDockIconUpdateEvent : public QEvent
+{
+public:
+    VBoxChangeDockIconUpdateEvent (bool aChanged)
+        : QEvent ((QEvent::Type) VBoxDefs::ChangeDockIconUpdateEventType)
+        , mChanged (aChanged)
+        {}
+
+    const bool mChanged;
+};
+
+class Process : public QProcess
+{
+    Q_OBJECT;
+
+public:
+
+    static QByteArray singleShot (const QString &aProcessName,
+                                  int aTimeout = 5000
+                                  /* wait for data maximum 5 seconds */)
+    {
+        /* Why is it really needed is because of Qt4.3 bug with QProcess.
+         * This bug is about QProcess sometimes (~70%) do not receive
+         * notification about process was finished, so this makes
+         * 'bool QProcess::waitForFinished (int)' block the GUI thread and
+         * never dismissed with 'true' result even if process was really
+         * started&finished. So we just waiting for some information
+         * on process output and destroy the process with force. Due to
+         * QProcess::~QProcess() has the same 'waitForFinished (int)' blocker
+         * we have to change process state to QProcess::NotRunning. */
+
+        QByteArray result;
+        Process process;
+        process.start (aProcessName);
+        bool firstShotReady = process.waitForReadyRead (aTimeout);
+        if (firstShotReady)
+            result = process.readAllStandardOutput();
+        process.setProcessState (QProcess::NotRunning);
+#ifdef Q_WS_X11
+        int status;
+        if (process.pid() > 0)
+            waitpid(process.pid(), &status, 0);
+#endif
+        return result;
+    }
+
+protected:
+
+    Process (QWidget *aParent = 0) : QProcess (aParent) {}
+};
+
+struct StorageSlot
+{
+    StorageSlot() : bus (KStorageBus_Null), port (0), device (0) {}
+    StorageSlot (const StorageSlot &aOther) : bus (aOther.bus), port (aOther.port), device (aOther.device) {}
+    StorageSlot (KStorageBus aBus, LONG aPort, LONG aDevice) : bus (aBus), port (aPort), device (aDevice) {}
+    StorageSlot& operator= (const StorageSlot &aOther) { bus = aOther.bus; port = aOther.port; device = aOther.device; return *this; }
+    bool operator== (const StorageSlot &aOther) const { return bus == aOther.bus && port == aOther.port && device == aOther.device; }
+    bool operator!= (const StorageSlot &aOther) const { return bus != aOther.bus || port != aOther.port || device != aOther.device; }
+    bool isNull() { return bus == KStorageBus_Null; }
+    KStorageBus bus; LONG port; LONG device;
+};
+Q_DECLARE_METATYPE (StorageSlot);
+
+// VBoxGlobal class
+////////////////////////////////////////////////////////////////////////////////
+
+class VBoxSelectorWnd;
+class VBoxConsoleWnd;
+class VBoxRegistrationDlg;
+class VBoxUpdateDlg;
+
+class VBoxGlobal : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    typedef QHash <ulong, QString> QULongStringHash;
+    typedef QHash <long, QString> QLongStringHash;
+
+    static VBoxGlobal &instance();
+
+    bool isValid() { return mValid; }
+
+    static QString qtRTVersionString();
+    static uint qtRTVersion();
+    static QString qtCTVersionString();
+    static uint qtCTVersion();
+
+    QString versionString() { return mVerString; }
+
+    CVirtualBox virtualBox() const { return mVBox; }
+
+    const VBoxGlobalSettings &settings() const { return gset; }
+    bool setSettings (const VBoxGlobalSettings &gs);
+
+    VBoxSelectorWnd &selectorWnd();
+    VBoxConsoleWnd &consoleWnd();
+
+    /* main window handle storage */
+    void setMainWindow (QWidget *aMainWindow) { mMainWindow = aMainWindow; }
+    QWidget *mainWindow() const { return mMainWindow; }
+
+    /* branding */
+    bool brandingIsActive (bool aForce = false);
+    QString brandingGetKey (QString aKey);
+
+    bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
+#ifdef VBOX_GUI_WITH_SYSTRAY
+    bool isTrayMenu() const;
+    void setTrayMenu(bool aIsTrayMenu);
+    void trayIconShowSelector();
+    bool trayIconInstall();
+#endif
+    QString managedVMUuid() const { return vmUuid; }
+
+    VBoxDefs::RenderMode vmRenderMode() const { return vm_render_mode; }
+    const char *vmRenderModeStr() const { return vm_render_mode_str; }
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    bool isDebuggerEnabled() const { return mDbgEnabled; }
+    bool isDebuggerAutoShowEnabled() const { return mDbgAutoShow; }
+    bool isDebuggerAutoShowCommandLineEnabled() const { return mDbgAutoShowCommandLine; }
+    bool isDebuggerAutoShowStatisticsEnabled() const { return mDbgAutoShowStatistics; }
+    RTLDRMOD getDebuggerModule() const { return mhVBoxDbg; }
+
+    bool isStartPausedEnabled() const { return mStartPaused; }
+#else
+    bool isDebuggerAutoShowEnabled() const { return false; }
+    bool isDebuggerAutoShowCommandLineEnabled() const { return false; }
+    bool isDebuggerAutoShowStatisticsEnabled() const { return false; }
+
+    bool isStartPausedEnabled() const { return false; }
+#endif
+
+    /* VBox enum to/from string/icon/color convertors */
+
+    QList <CGuestOSType> vmGuestOSFamilyList() const;
+    QList <CGuestOSType> vmGuestOSTypeList (const QString &aFamilyId) const;
+    QPixmap vmGuestOSTypeIcon (const QString &aTypeId) const;
+    CGuestOSType vmGuestOSType (const QString &aTypeId,
+                                const QString &aFamilyId = QString::null) const;
+    QString vmGuestOSTypeDescription (const QString &aTypeId) const;
+
+    QPixmap toIcon (KMachineState s) const
+    {
+        QPixmap *pm = mVMStateIcons.value (s);
+        AssertMsg (pm, ("Icon for VM state %d must be defined", s));
+        return pm ? *pm : QPixmap();
+    }
+
+    static inline QString yearsToString (uint32_t cVal)
+    {
+        return tr("%n year(s)", "", cVal);
+    }
+
+    static inline QString monthsToString (uint32_t cVal)
+    {
+        return tr("%n month(s)", "", cVal);
+    }
+
+    static inline QString daysToString (uint32_t cVal)
+    {
+        return tr("%n day(s)", "", cVal);
+    }
+
+    static inline QString hoursToString (uint32_t cVal)
+    {
+        return tr("%n hour(s)", "", cVal);
+    }
+
+    static inline QString minutesToString (uint32_t cVal)
+    {
+        return tr("%n minute(s)", "", cVal);
+    }
+
+    static inline QString secondsToString (uint32_t cVal)
+    {
+        return tr("%n second(s)", "", cVal);
+    }
+
+    const QColor &toColor (KMachineState s) const
+    {
+        static const QColor none;
+        AssertMsg (mVMStateColors.value (s), ("No color for %d", s));
+        return mVMStateColors.value (s) ? *mVMStateColors.value (s) : none;
+    }
+
+    QString toString (KMachineState s) const
+    {
+        AssertMsg (!mMachineStates.value (s).isNull(), ("No text for %d", s));
+        return mMachineStates.value (s);
+    }
+
+    QString toString (KSessionState s) const
+    {
+        AssertMsg (!mSessionStates.value (s).isNull(), ("No text for %d", s));
+        return mSessionStates.value (s);
+    }
+
+    /**
+     * Returns a string representation of the given KStorageBus enum value.
+     * Complementary to #toStorageBusType (const QString &) const.
+     */
+    QString toString (KStorageBus aBus) const
+    {
+        AssertMsg (!mStorageBuses.value (aBus).isNull(), ("No text for %d", aBus));
+        return mStorageBuses [aBus];
+    }
+
+    /**
+     * Returns a KStorageBus enum value corresponding to the given string
+     * representation. Complementary to #toString (KStorageBus) const.
+     */
+    KStorageBus toStorageBusType (const QString &aBus) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mStorageBuses.begin(), mStorageBuses.end(), aBus);
+        AssertMsg (it != mStorageBuses.end(), ("No value for {%s}",
+                                               aBus.toLatin1().constData()));
+        return KStorageBus (it.key());
+    }
+
+    KStorageBus toStorageBusType (KStorageControllerType aControllerType) const
+    {
+        KStorageBus sb = KStorageBus_Null;
+        switch (aControllerType)
+        {
+            case KStorageControllerType_Null: sb = KStorageBus_Null; break;
+            case KStorageControllerType_PIIX3:
+            case KStorageControllerType_PIIX4:
+            case KStorageControllerType_ICH6: sb = KStorageBus_IDE; break;
+            case KStorageControllerType_IntelAhci: sb = KStorageBus_SATA; break;
+            case KStorageControllerType_LsiLogic:
+            case KStorageControllerType_BusLogic: sb = KStorageBus_SCSI; break;
+            case KStorageControllerType_I82078: sb = KStorageBus_Floppy; break;
+            default:
+              AssertMsgFailed (("toStorageBusType: %d not handled\n", aControllerType)); break;
+        }
+        return sb;
+    }
+
+    QString toString (KStorageBus aBus, LONG aChannel) const;
+    LONG toStorageChannel (KStorageBus aBus, const QString &aChannel) const;
+
+    QString toString (KStorageBus aBus, LONG aChannel, LONG aDevice) const;
+    LONG toStorageDevice (KStorageBus aBus, LONG aChannel, const QString &aDevice) const;
+
+    QString toString (StorageSlot aSlot) const;
+    StorageSlot toStorageSlot (const QString &aSlot) const;
+
+    QString toString (KMediumType t) const
+    {
+        AssertMsg (!mDiskTypes.value (t).isNull(), ("No text for %d", t));
+        return mDiskTypes.value (t);
+    }
+
+    /**
+     * Similar to toString (KMediumType), but returns 'Differencing' for
+     * normal hard disks that have a parent.
+     */
+    QString mediumTypeString (const CMedium &aHD) const
+    {
+        if (!aHD.GetParent().isNull())
+        {
+            Assert (aHD.GetType() == KMediumType_Normal);
+            return mDiskTypes_Differencing;
+        }
+        return toString (aHD.GetType());
+    }
+
+    QString toString (KVRDPAuthType t) const
+    {
+        AssertMsg (!mVRDPAuthTypes.value (t).isNull(), ("No text for %d", t));
+        return mVRDPAuthTypes.value (t);
+    }
+
+    QString toString (KPortMode t) const
+    {
+        AssertMsg (!mPortModeTypes.value (t).isNull(), ("No text for %d", t));
+        return mPortModeTypes.value (t);
+    }
+
+    QString toString (KUSBDeviceFilterAction t) const
+    {
+        AssertMsg (!mUSBFilterActionTypes.value (t).isNull(), ("No text for %d", t));
+        return mUSBFilterActionTypes.value (t);
+    }
+
+    QString toString (KClipboardMode t) const
+    {
+        AssertMsg (!mClipboardTypes.value (t).isNull(), ("No text for %d", t));
+        return mClipboardTypes.value (t);
+    }
+
+    KClipboardMode toClipboardModeType (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mClipboardTypes.begin(), mClipboardTypes.end(), s);
+        AssertMsg (it != mClipboardTypes.end(), ("No value for {%s}",
+                                                 s.toLatin1().constData()));
+        return KClipboardMode (it.key());
+    }
+
+    QString toString (KStorageControllerType t) const
+    {
+        AssertMsg (!mStorageControllerTypes.value (t).isNull(), ("No text for %d", t));
+        return mStorageControllerTypes.value (t);
+    }
+
+    KStorageControllerType toControllerType (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mStorageControllerTypes.begin(), mStorageControllerTypes.end(), s);
+        AssertMsg (it != mStorageControllerTypes.end(), ("No value for {%s}",
+                                                         s.toLatin1().constData()));
+        return KStorageControllerType (it.key());
+    }
+
+    KVRDPAuthType toVRDPAuthType (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mVRDPAuthTypes.begin(), mVRDPAuthTypes.end(), s);
+        AssertMsg (it != mVRDPAuthTypes.end(), ("No value for {%s}",
+                                                s.toLatin1().constData()));
+        return KVRDPAuthType (it.key());
+    }
+
+    KPortMode toPortMode (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mPortModeTypes.begin(), mPortModeTypes.end(), s);
+        AssertMsg (it != mPortModeTypes.end(), ("No value for {%s}",
+                                                s.toLatin1().constData()));
+        return KPortMode (it.key());
+    }
+
+    KUSBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mUSBFilterActionTypes.begin(), mUSBFilterActionTypes.end(), s);
+        AssertMsg (it != mUSBFilterActionTypes.end(), ("No value for {%s}",
+                                                       s.toLatin1().constData()));
+        return KUSBDeviceFilterAction (it.key());
+    }
+
+    QString toString (KDeviceType t) const
+    {
+        AssertMsg (!mDeviceTypes.value (t).isNull(), ("No text for %d", t));
+        return mDeviceTypes.value (t);
+    }
+
+    KDeviceType toDeviceType (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mDeviceTypes.begin(), mDeviceTypes.end(), s);
+        AssertMsg (it != mDeviceTypes.end(), ("No value for {%s}",
+                                              s.toLatin1().constData()));
+        return KDeviceType (it.key());
+    }
+
+    QStringList deviceTypeStrings() const;
+
+    QString toString (KAudioDriverType t) const
+    {
+        AssertMsg (!mAudioDriverTypes.value (t).isNull(), ("No text for %d", t));
+        return mAudioDriverTypes.value (t);
+    }
+
+    KAudioDriverType toAudioDriverType (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mAudioDriverTypes.begin(), mAudioDriverTypes.end(), s);
+        AssertMsg (it != mAudioDriverTypes.end(), ("No value for {%s}",
+                                                   s.toLatin1().constData()));
+        return KAudioDriverType (it.key());
+    }
+
+    QString toString (KAudioControllerType t) const
+    {
+        AssertMsg (!mAudioControllerTypes.value (t).isNull(), ("No text for %d", t));
+        return mAudioControllerTypes.value (t);
+    }
+
+    KAudioControllerType toAudioControllerType (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mAudioControllerTypes.begin(), mAudioControllerTypes.end(), s);
+        AssertMsg (it != mAudioControllerTypes.end(), ("No value for {%s}",
+                                                       s.toLatin1().constData()));
+        return KAudioControllerType (it.key());
+    }
+
+    QString toString (KNetworkAdapterType t) const
+    {
+        AssertMsg (!mNetworkAdapterTypes.value (t).isNull(), ("No text for %d", t));
+        return mNetworkAdapterTypes.value (t);
+    }
+
+    KNetworkAdapterType toNetworkAdapterType (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mNetworkAdapterTypes.begin(), mNetworkAdapterTypes.end(), s);
+        AssertMsg (it != mNetworkAdapterTypes.end(), ("No value for {%s}",
+                                                      s.toLatin1().constData()));
+        return KNetworkAdapterType (it.key());
+    }
+
+    QString toString (KNetworkAttachmentType t) const
+    {
+        AssertMsg (!mNetworkAttachmentTypes.value (t).isNull(), ("No text for %d", t));
+        return mNetworkAttachmentTypes.value (t);
+    }
+
+    KNetworkAttachmentType toNetworkAttachmentType (const QString &s) const
+    {
+        QULongStringHash::const_iterator it =
+            qFind (mNetworkAttachmentTypes.begin(), mNetworkAttachmentTypes.end(), s);
+        AssertMsg (it != mNetworkAttachmentTypes.end(), ("No value for {%s}",
+                                                         s.toLatin1().constData()));
+        return KNetworkAttachmentType (it.key());
+    }
+
+    QString toString (KUSBDeviceState aState) const
+    {
+        AssertMsg (!mUSBDeviceStates.value (aState).isNull(), ("No text for %d", aState));
+        return mUSBDeviceStates.value (aState);
+    }
+
+    QStringList COMPortNames() const;
+    QString toCOMPortName (ulong aIRQ, ulong aIOBase) const;
+    bool toCOMPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
+
+    QStringList LPTPortNames() const;
+    QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;
+    bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
+
+    QPixmap snapshotIcon (bool online) const
+    {
+        return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;
+    }
+
+    QPixmap warningIcon() const { return mWarningIcon; }
+    QPixmap errorIcon() const { return mErrorIcon; }
+
+    /* details generators */
+
+    QString details (const CMedium &aHD, bool aPredictDiff);
+
+    QString details (const CUSBDevice &aDevice) const;
+    QString toolTip (const CUSBDevice &aDevice) const;
+    QString toolTip (const CUSBDeviceFilter &aFilter) const;
+
+    QString detailsReport (const CMachine &aMachine, bool aWithLinks);
+
+    QString platformInfo();
+
+    /* VirtualBox helpers */
+
+#if defined(Q_WS_X11) && !defined(VBOX_OSE)
+    double findLicenseFile (const QStringList &aFilesList, QRegExp aPattern, QString &aLicenseFile) const;
+    bool showVirtualBoxLicense();
+#endif
+
+    CSession openSession (const QString &aId, bool aExisting = false);
+
+    /** Shortcut to openSession (aId, true). */
+    CSession openExistingSession (const QString &aId) { return openSession (aId, true); }
+
+    bool startMachine (const QString &id);
+
+    void startEnumeratingMedia();
+
+    /**
+     * Returns a list of all currently registered media. This list is used to
+     * globally track the accessiblity state of all media on a dedicated thread.
+     *
+     * Note that the media list is initially empty (i.e. before the enumeration
+     * process is started for the first time using #startEnumeratingMedia()).
+     * See #startEnumeratingMedia() for more information about how meida are
+     * sorted in the returned list.
+     */
+    const VBoxMediaList &currentMediaList() const { return mMediaList; }
+
+    /** Returns true if the media enumeration is in progress. */
+    bool isMediaEnumerationStarted() const { return mMediaEnumThread != NULL; }
+
+    void addMedium (const VBoxMedium &);
+    void updateMedium (const VBoxMedium &);
+    void removeMedium (VBoxDefs::MediumType, const QString &);
+
+    bool findMedium (const CMedium &, VBoxMedium &) const;
+    VBoxMedium findMedium (const QString &aMediumId) const;
+
+    /** Compact version of #findMediumTo(). Asserts if not found. */
+    VBoxMedium getMedium (const CMedium &aObj) const
+    {
+        VBoxMedium medium;
+        if (!findMedium (aObj, medium))
+            AssertFailed();
+        return medium;
+    }
+
+    /* Returns the number of current running Fe/Qt4 main windows. */
+    int mainWindowCount();
+
+    /* various helpers */
+
+    QString languageName() const;
+    QString languageCountry() const;
+    QString languageNameEnglish() const;
+    QString languageCountryEnglish() const;
+    QString languageTranslators() const;
+
+    void retranslateUi();
+
+    /** @internal made public for internal purposes */
+    void cleanup();
+
+    /* public static stuff */
+
+    static bool isDOSType (const QString &aOSTypeId);
+
+    static void adoptLabelPixmap (QLabel *);
+
+    static QString languageId();
+    static void loadLanguage (const QString &aLangId = QString::null);
+    QString helpFile() const;
+
+    static QIcon iconSet (const QPixmap &aNormal,
+                          const QPixmap &aDisabled = QPixmap(),
+                          const QPixmap &aActive = QPixmap());
+    static QIcon iconSet (const char *aNormal,
+                          const char *aDisabled = NULL,
+                          const char *aActive = NULL);
+    static QIcon iconSetOnOff (const char *aNormal, const char *aNormalOff,
+                               const char *aDisabled = NULL,
+                               const char *aDisabledOff = NULL,
+                               const char *aActive = NULL,
+                               const char *aActiveOff = NULL);
+    static QIcon 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);
+
+    static QIcon standardIcon (QStyle::StandardPixmap aStandard, QWidget *aWidget = NULL);
+
+    static void setTextLabel (QToolButton *aToolButton, const QString &aTextLabel);
+
+    static QRect normalizeGeometry (const QRect &aRectangle, const QRegion &aBoundRegion,
+                                    bool aCanResize = true);
+    static QRect getNormalized (const QRect &aRectangle, const QRegion &aBoundRegion,
+                                bool aCanResize = true);
+    static QRegion flip (const QRegion &aRegion);
+
+    static void centerWidget (QWidget *aWidget, QWidget *aRelative,
+                              bool aCanResize = true);
+
+    static QChar decimalSep();
+    static QString sizeRegexp();
+
+    static quint64 parseSize (const QString &);
+    static QString formatSize (quint64 aSize, uint aDecimal = 2,
+                               VBoxDefs::FormatSize aMode = VBoxDefs::FormatSize_Round);
+
+    static quint64 requiredVideoMemory (CMachine *aMachine = 0);
+
+    static QString locationForHTML (const QString &aFileName);
+
+    static QString highlight (const QString &aStr, bool aToolTip = false);
+
+    static QString emphasize (const QString &aStr);
+
+    static QString systemLanguageId();
+
+    static bool activateWindow (WId aWId, bool aSwitchDesktop = true);
+
+    static QString removeAccelMark (const QString &aText);
+
+    static QString insertKeyToActionText (const QString &aText, const QString &aKey);
+    static QString extractKeyFromActionText (const QString &aText);
+
+    static QPixmap joinPixmaps (const QPixmap &aPM1, const QPixmap &aPM2);
+
+    static QWidget *findWidget (QWidget *aParent, const char *aName,
+                                const char *aClassName = NULL,
+                                bool aRecursive = false);
+
+    static QList <QPair <QString, QString> > HDDBackends();
+
+    /* Qt 4.2.0 support function */
+    static inline void setLayoutMargin (QLayout *aLayout, int aMargin)
+    {
+#if QT_VERSION < 0x040300
+        /* Deprecated since > 4.2 */
+        aLayout->setMargin (aMargin);
+#else
+        /* New since > 4.2 */
+        aLayout->setContentsMargins (aMargin, aMargin, aMargin, aMargin);
+#endif
+    }
+
+    static QString documentsPath();
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    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();
+#endif
+
+signals:
+
+    /**
+     * Emitted at the beginning of the enumeration process started by
+     * #startEnumeratingMedia().
+     */
+    void mediumEnumStarted();
+
+    /**
+     * Emitted when a new medium item from the list has updated its
+     * accessibility state.
+     */
+    void mediumEnumerated (const VBoxMedium &aMedum);
+
+    /**
+     * Emitted at the end of the enumeration process started by
+     * #startEnumeratingMedia(). The @a aList argument is passed for
+     * convenience, it is exactly the same as returned by #currentMediaList().
+     */
+    void mediumEnumFinished (const VBoxMediaList &aList);
+
+    /** Emitted when a new media is added using #addMedia(). */
+    void mediumAdded (const VBoxMedium &);
+
+    /** Emitted when the media is updated using #updateMedia(). */
+    void mediumUpdated (const VBoxMedium &);
+
+    /** Emitted when the media is removed using #removeMedia(). */
+    void mediumRemoved (VBoxDefs::MediumType, const QString &);
+
+    /* signals emitted when the VirtualBox callback is called by the server
+     * (note that currently these signals are emitted only when the application
+     * is the in the VM selector mode) */
+
+    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 &e);
+    void trayIconCanShow (const VBoxCanShowTrayIconEvent &e);
+    void trayIconShow (const VBoxShowTrayIconEvent &e);
+    void trayIconChanged (const VBoxChangeTrayIconEvent &e);
+#endif
+    void dockIconUpdateChanged (const VBoxChangeDockIconUpdateEvent &e);
+
+    void canShowRegDlg (bool aCanShow);
+    void canShowUpdDlg (bool aCanShow);
+
+public slots:
+
+    bool openURL (const QString &aURL);
+
+    void showRegistrationDialog (bool aForce = true);
+    void showUpdateDialog (bool aForce = true);
+    void perDayNewVersionNotifier();
+
+protected:
+
+    bool event (QEvent *e);
+    bool eventFilter (QObject *, QEvent *);
+
+private:
+
+    VBoxGlobal();
+    ~VBoxGlobal();
+
+    void init();
+
+    bool mValid;
+
+    CVirtualBox mVBox;
+
+    VBoxGlobalSettings gset;
+
+    VBoxSelectorWnd *mSelectorWnd;
+    VBoxConsoleWnd *mConsoleWnd;
+    QWidget* mMainWindow;
+
+#ifdef VBOX_WITH_REGISTRATION
+    VBoxRegistrationDlg *mRegDlg;
+#endif
+    VBoxUpdateDlg *mUpdDlg;
+
+    QString vmUuid;
+
+#ifdef VBOX_GUI_WITH_SYSTRAY
+    bool mIsTrayMenu : 1; /*< Tray icon active/desired? */
+    bool mIncreasedWindowCounter : 1;
+#endif
+
+    QThread *mMediaEnumThread;
+    VBoxMediaList mMediaList;
+
+    VBoxDefs::RenderMode vm_render_mode;
+    const char * vm_render_mode_str;
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** Whether the debugger should be accessible or not.
+     * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED, --debug or the env.var.
+     * VBOX_GUI_DBG_AUTO_SHOW to enable. */
+    bool mDbgEnabled;
+    /** Whether to show the debugger automatically with the console.
+     * Use --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
+    bool mDbgAutoShow;
+    /** Whether to show the command line window when mDbgAutoShow is set. */
+    bool mDbgAutoShowCommandLine;
+    /** Whether to show the statistics window when mDbgAutoShow is set. */
+    bool mDbgAutoShowStatistics;
+    /** VBoxDbg module handle. */
+    RTLDRMOD mhVBoxDbg;
+
+    /** Whether to start the VM in paused state or not. */
+    bool mStartPaused;
+#endif
+
+#if defined (Q_WS_WIN32)
+    DWORD dwHTMLHelpCookie;
+#endif
+
+    CVirtualBoxCallback callback;
+
+    QString mVerString;
+    QString mBrandingConfig;
+
+    QList <QString> mFamilyIDs;
+    QList <QList <CGuestOSType> > mTypes;
+    QHash <QString, QPixmap *> mOsTypeIcons;
+
+    QHash <ulong, QPixmap *> mVMStateIcons;
+    QHash <ulong, QColor *> mVMStateColors;
+
+    QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
+
+    QULongStringHash mMachineStates;
+    QULongStringHash mSessionStates;
+    QULongStringHash mDeviceTypes;
+
+    QULongStringHash mStorageBuses;
+    QLongStringHash mStorageBusChannels;
+    QLongStringHash mStorageBusDevices;
+    QULongStringHash mSlotTemplates;
+
+    QULongStringHash mDiskTypes;
+    QString mDiskTypes_Differencing;
+
+    QULongStringHash mVRDPAuthTypes;
+    QULongStringHash mPortModeTypes;
+    QULongStringHash mUSBFilterActionTypes;
+    QULongStringHash mAudioDriverTypes;
+    QULongStringHash mAudioControllerTypes;
+    QULongStringHash mNetworkAdapterTypes;
+    QULongStringHash mNetworkAttachmentTypes;
+    QULongStringHash mClipboardTypes;
+    QULongStringHash mStorageControllerTypes;
+    QULongStringHash mUSBDeviceStates;
+
+    QString mUserDefinedPortName;
+
+    QPixmap mWarningIcon, mErrorIcon;
+
+    friend VBoxGlobal &vboxGlobal();
+    friend class VBoxCallback;
+};
+
+inline VBoxGlobal &vboxGlobal() { return VBoxGlobal::instance(); }
+
+// Helper classes
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  Generic asyncronous event.
+ *
+ *  This abstract class is intended to provide a conveinent way to execute
+ *  code on the main GUI thread asynchronously to the calling party. This is
+ *  done by putting necessary actions to the #handle() function in a subclass
+ *  and then posting an instance of the subclass using #post(). The instance
+ *  must be allocated on the heap using the <tt>new</tt> operation and will be
+ *  automatically deleted after processing. Note that if you don't call #post()
+ *  on the created instance, you have to delete it yourself.
+ */
+class VBoxAsyncEvent : public QEvent
+{
+public:
+
+    VBoxAsyncEvent() : QEvent ((QEvent::Type) VBoxDefs::AsyncEventType) {}
+
+    /**
+     *  Worker function. Gets executed on the GUI thread when the posted event
+     *  is processed by the main event loop.
+     */
+    virtual void handle() = 0;
+
+    /**
+     *  Posts this event to the main event loop.
+     *  The caller loses ownership of this object after this method returns
+     *  and must not delete the object.
+     */
+    void post()
+    {
+        QApplication::postEvent (&vboxGlobal(), this);
+    }
+};
+
+/**
+ *  USB Popup Menu class.
+ *  This class provides the list of USB devices attached to the host.
+ */
+class VBoxUSBMenu : public QMenu
+{
+    Q_OBJECT
+
+public:
+
+    VBoxUSBMenu (QWidget *);
+
+    const CUSBDevice& getUSB (QAction *aAction);
+
+    void setConsole (const CConsole &);
+
+private slots:
+
+    void processAboutToShow();
+
+private:
+    bool event(QEvent *aEvent);
+
+    QMap <QAction *, CUSBDevice> mUSBDevicesMap;
+    CConsole mConsole;
+};
+
+/**
+ *  Enable/Disable Menu class.
+ *  This class provides enable/disable menu items.
+ */
+class VBoxSwitchMenu : public QMenu
+{
+    Q_OBJECT
+
+public:
+
+    VBoxSwitchMenu (QWidget *, QAction *, bool aInverted = false);
+
+    void setToolTip (const QString &);
+
+private slots:
+
+    void processAboutToShow();
+
+private:
+
+    QAction *mAction;
+    bool     mInverted;
+};
+
+#endif /* __VBoxGlobal_h__ */
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobalSettings.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobalSettings.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobalSettings.h	(revision 25213)
@@ -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/include/VBoxGuestRAMSlider.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGuestRAMSlider.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGuestRAMSlider.h	(revision 25213)
@@ -0,0 +1,54 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxGuestRAMSlider 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 __VBoxGuestRAMSlider_h__
+#define __VBoxGuestRAMSlider_h__
+
+/* VBox includes */
+#include "QIAdvancedSlider.h"
+
+class VBoxGuestRAMSlider: public QIAdvancedSlider
+{
+public:
+    VBoxGuestRAMSlider (QWidget *aParent = 0);
+    VBoxGuestRAMSlider (Qt::Orientation aOrientation, QWidget *aParent = 0);
+
+    uint minRAM() const;
+    uint maxRAMOpt() const;
+    uint maxRAMAlw() const;
+    uint maxRAM() const;
+
+private:
+    /* Private methods */
+    void init();
+    int calcPageStep (int aMax) const;
+
+    /* Private member vars */
+    uint mMinRAM;
+    uint mMaxRAMOpt;
+    uint mMaxRAMAlw;
+    uint mMaxRAM;
+};
+
+#endif /* __VBoxGuestRAMSlider_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxHelpActions.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxHelpActions.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxHelpActions.h	(revision 25213)
@@ -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/include/VBoxIChatTheaterWrapper.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxIChatTheaterWrapper.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxIChatTheaterWrapper.h	(revision 25213)
@@ -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/include/VBoxImportApplianceWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWgt.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWgt.h	(revision 25213)
@@ -0,0 +1,44 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxImportApplianceWgt 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 __VBoxImportApplianceWgt_h__
+#define __VBoxImportApplianceWgt_h__
+
+/* VBox includes */
+#include "VBoxApplianceEditorWgt.h"
+
+class VBoxImportApplianceWgt : public VBoxApplianceEditorWgt
+{
+    Q_OBJECT;
+
+public:
+    VBoxImportApplianceWgt (QWidget *aParent);
+
+    bool setFile (const QString& aFile);
+    void prepareImport();
+    bool import();
+
+    QList < QPair <QString, QString> > licenseAgreements() const;
+};
+
+#endif /* __VBoxImportApplianceWgt_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWzd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWzd.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWzd.h	(revision 25213)
@@ -0,0 +1,87 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxImportApplianceWzd 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 __VBoxImportApplianceWzd_h__
+#define __VBoxImportApplianceWzd_h__
+
+#include "VBoxImportApplianceWzd.gen.h"
+#include "QIAbstractWizard.h"
+#include "QIWithRetranslateUI.h"
+#include "QIDialog.h"
+
+class QIWidgetValidator;
+
+class QDialogButtonBox;
+
+class VBoxImportLicenseViewer: public QIDialog
+{
+    Q_OBJECT;
+
+public:
+    VBoxImportLicenseViewer (QWidget *aParent = NULL);
+
+    void setContent (const QString &aName, const QString &aText);
+
+protected:
+    void retranslateUi();
+
+private slots:
+    void print();
+    void save();
+
+private:
+    QLabel *mCaption;
+    QTextEdit *mLicenseText;
+    QDialogButtonBox *mButtonBox;
+    QPushButton *mPrintBtn;
+    QPushButton *mSaveBtn;
+    QString mName;
+    QString mText;
+};
+
+class VBoxImportApplianceWzd : public QIWithRetranslateUI<QIAbstractWizard>,
+                               public Ui::VBoxImportApplianceWzd
+{
+    Q_OBJECT;
+
+public:
+    VBoxImportApplianceWzd (QWidget* aParent = NULL);
+
+protected:
+    void retranslateUi();
+
+private slots:
+    void revalidate (QIWidgetValidator *aWval);
+    void enableNext (const QIWidgetValidator *aWval);
+
+    void accept();
+
+    void showNextPage();
+    void onPageShow();
+
+private:
+    /* Private member vars */
+    QIWidgetValidator *mWValFileSelector;
+};
+
+#endif /* __VBoxImportApplianceWzd_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxLineTextEdit.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxLineTextEdit.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxLineTextEdit.h	(revision 25213)
@@ -0,0 +1,88 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxLineTextEdit 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 __VBoxLineTextEdit_h__
+#define __VBoxLineTextEdit_h__
+
+/* VBox includes */
+#include "QIDialog.h"
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QPushButton>
+
+/* Qt forward declarations */
+class QTextEdit;
+class QDialogButtonBox;
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxTextEditor
+
+class VBoxTextEditor: public QIWithRetranslateUI<QIDialog>
+{
+    Q_OBJECT;
+
+public:
+    VBoxTextEditor (QWidget *aParent = NULL);
+
+    void setText (const QString& aText);
+    QString text() const;
+
+protected:
+    void retranslateUi();
+
+private slots:
+    void open();
+
+private:
+    /* Private member vars */
+    QTextEdit *mTextEdit;
+    QDialogButtonBox *mButtonBox;
+    QPushButton *mOpenBtn;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// VBoxLineTextEdit
+
+class VBoxLineTextEdit: public QIWithRetranslateUI<QPushButton>
+{
+    Q_OBJECT;
+
+public:
+    VBoxLineTextEdit (QWidget *aParent = NULL);
+
+    void setText (const QString& aText) { mText = aText; }
+    QString text() const { return mText; }
+
+protected:
+    void retranslateUi();
+
+private slots:
+    void edit();
+
+private:
+    /* Private member vars */
+    QString mText;
+};
+
+#endif /* __VBoxLineTextEdit_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h	(revision 25213)
@@ -0,0 +1,105 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxMediaComboBox 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 __VBoxMediaComboBox_h__
+#define __VBoxMediaComboBox_h__
+
+#include "VBoxGlobal.h"
+
+#include <QComboBox>
+#include <QPixmap>
+
+class VBoxMediaComboBox : public QComboBox
+{
+    Q_OBJECT
+
+public:
+
+    typedef QMap <QString, QString> BaseToDiffMap;
+
+    VBoxMediaComboBox (QWidget *aParent);
+
+    void refresh();
+    void repopulate();
+
+    QString id (int = -1) const;
+    QString location (int = -1) const;
+    VBoxDefs::MediumType type() const { return mType; }
+
+    void setCurrentItem (const QString &aItemId);
+    void setType (VBoxDefs::MediumType aMediumType);
+    void setMachineId (const QString &aMachineId = QString::null);
+    void setNullItemPresent (bool aNullItemPresent);
+
+    void setShowDiffs (bool aShowDiffs);
+    bool showDiffs() const { return mShowDiffs; }
+
+protected slots:
+
+    void mediumEnumStarted();
+    void mediumEnumerated (const VBoxMedium &);
+
+    void mediumAdded (const VBoxMedium &);
+    void mediumUpdated (const VBoxMedium &);
+    void mediumRemoved (VBoxDefs::MediumType, const QString &);
+
+    void processActivated (int aIndex);
+//    void processIndexChanged (int aIndex);
+
+    void processOnItem (const QModelIndex &aIndex);
+
+protected:
+
+    void updateToolTip (int);
+
+    void appendItem (const VBoxMedium &);
+    void replaceItem (int, const VBoxMedium &);
+
+    bool findMediaIndex (const QString &aId, int &aIndex);
+
+    VBoxDefs::MediumType mType;
+
+    /** Obtruncated VBoxMedium structure. */
+    struct Medium
+    {
+        Medium() {}
+        Medium (const QString &aId, const QString &aLocation,
+                const QString aToolTip)
+            : id (aId), location (aLocation), toolTip (aToolTip) {}
+
+        QString id;
+        QString location;
+        QString toolTip;
+    };
+
+    typedef QVector <Medium> Media;
+    Media mMedia;
+
+    QString mLastId;
+
+    bool mShowDiffs : 1;
+    bool mShowNullItem : 1;
+
+    QString mMachineId;
+};
+
+#endif /* __VBoxMediaComboBox_h__ */
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaManagerDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaManagerDlg.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaManagerDlg.h	(revision 25213)
@@ -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/include/VBoxMedium.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxMedium.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxMedium.h	(revision 25213)
@@ -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/include/VBoxMiniToolBar.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxMiniToolBar.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxMiniToolBar.h	(revision 25213)
@@ -0,0 +1,130 @@
+/** @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.
+ */
+
+#ifndef __VBoxMiniToolBar_h__
+#define __VBoxMiniToolBar_h__
+
+/* VBox includes */
+#include <VBoxToolBar.h>
+
+/* Qt includes */
+#include <QBasicTimer>
+
+class QLabel;
+class QMenu;
+
+/**
+ *  The VBoxMiniToolBar class is a toolbar shown inside full screen mode or seamless mode.
+ *  It supports auto hiding and animated sliding up/down.
+ */
+class VBoxMiniToolBar : public VBoxToolBar
+{
+    Q_OBJECT;
+
+public:
+
+    enum Alignment
+    {
+        AlignTop,
+        AlignBottom
+    };
+
+    VBoxMiniToolBar (QWidget *aParent, Alignment aAlignment, bool aIsActive, bool aAutoHide);
+
+    VBoxMiniToolBar& operator<< (QList <QMenu*> aMenus);
+
+    void setSeamlessMode (bool aIsSeamless);
+    void setDisplayText (const QString &aText);
+
+    bool isAutoHide() const;
+
+    void updateDisplay (bool aShow, bool aSetHideFlag);
+
+signals:
+
+    void exitAction();
+    void closeAction();
+    void geometryUpdated();
+
+protected:
+
+    void mouseMoveEvent (QMouseEvent *aEvent);
+    void timerEvent (QTimerEvent *aEvent);
+    void showEvent (QShowEvent *aEvent);
+    void paintEvent (QPaintEvent *aEvent);
+
+private slots:
+
+    void togglePushpin (bool aOn);
+
+private:
+
+    void initialize();
+    void recreateMask();
+    void moveToBase();
+    QPoint mapFromScreen (const QPoint &aPoint);
+
+    QAction *mAutoHideAct;
+    QLabel *mDisplayLabel;
+
+    QBasicTimer mScrollTimer;
+    QBasicTimer mAutoScrollTimer;
+
+    bool mActive;
+    bool mPolished;
+    bool mSeamless;
+    bool mAutoHide;
+    bool mSlideToScreen;
+    bool mHideAfterSlide;
+
+    int mAutoHideCounter;
+    int mPositionX;
+    int mPositionY;
+
+    /* Lists of used spacers */
+    QList <QWidget*> mMargins;
+    QList <QWidget*> mSpacings;
+    QList <QWidget*> mLabelMargins;
+
+    /* Menu insert position */
+    QAction *mInsertPosition;
+
+    /* Tool-bar alignment */
+    Alignment mAlignment;
+
+    /* Wether to animate showing/hiding the toolbar */
+    bool mAnimated;
+
+    /* Interval (in milli seconds) for scrolling the toolbar, default is 20 msec */
+    int mScrollDelay;
+
+    /* The wait time while the cursor is not over the window after this amount of time (in msec),
+     * the toolbar will auto hide if autohide is on. The default is 100msec. */
+    int mAutoScrollDelay;
+
+    /* Number of total steps before hiding. If it is 10 then wait 10 (steps) * 100ms (mAutoScrollDelay) = 1000ms delay.
+     * The default is 10. */
+    int mAutoHideTotalCounter;
+};
+
+#endif // __VBoxMiniToolBar_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewHDWzd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewHDWzd.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewHDWzd.h	(revision 25213)
@@ -0,0 +1,75 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxNewHDWzd 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 __VBoxNewHDWzd_h__
+#define __VBoxNewHDWzd_h__
+
+#include "QIAbstractWizard.h"
+#include "VBoxNewHDWzd.gen.h"
+#include "COMDefs.h"
+#include "QIWidgetValidator.h"
+#include "QIWithRetranslateUI.h"
+
+class VBoxNewHDWzd : public QIWithRetranslateUI<QIAbstractWizard>,
+                     public Ui::VBoxNewHDWzd
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxNewHDWzd (QWidget *aParent = 0);
+
+    CMedium hardDisk() { return mHD; }
+    void setRecommendedFileName (const QString &aName);
+    void setRecommendedSize (quint64 aSize);
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void accept();
+    void slSizeValueChanged (int aVal);
+    void leSizeTextChanged (const QString &aText);
+    void tbNameSelectClicked();
+    void revalidate (QIWidgetValidator *aWval);
+    void enableNext (const QIWidgetValidator *aWval);
+    void onPageShow();
+    void showNextPage();
+
+private:
+
+    QString location();
+    bool isDynamicStorage();
+    void updateSizeToolTip (quint64 aSizeB);
+    bool createHardDisk();
+
+    QIWidgetValidator *mWValNameAndSize;
+    CMedium            mHD;
+    int                mSliderScale;
+    quint64            mMaxVDISize;
+    quint64            mCurrentSize;
+};
+
+#endif // __VBoxNewHDWzd_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewVMWzd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewVMWzd.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewVMWzd.h	(revision 25213)
@@ -0,0 +1,76 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxNewVMWzd 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 __VBoxNewVMWzd_h__
+#define __VBoxNewVMWzd_h__
+
+#include "QIAbstractWizard.h"
+#include "VBoxNewVMWzd.gen.h"
+#include "COMDefs.h"
+#include "QIWidgetValidator.h"
+#include "QIWithRetranslateUI.h"
+
+class VBoxNewVMWzd : public QIWithRetranslateUI<QIAbstractWizard>,
+                     public Ui::VBoxNewVMWzd
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxNewVMWzd (QWidget *aParent = 0);
+   ~VBoxNewVMWzd();
+
+    const CMachine& machine() const;
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void accept();
+    void showMediaManager();
+    void onOSTypeChanged();
+    void slRAMValueChanged (int aValue);
+    void leRAMTextChanged (const QString &aTtext);
+    void hdTypeChanged();
+    void revalidate (QIWidgetValidator *aWval);
+    void enableNext (const QIWidgetValidator *aWval);
+    void onPageShow();
+    void showBackPage();
+    void showNextPage();
+
+private:
+
+    bool showNewHDWizard();
+    bool constructMachine();
+    void ensureNewHardDiskDeleted();
+
+    QIWidgetValidator *mWvalNameAndOS;
+    QIWidgetValidator *mWvalMemory;
+    QIWidgetValidator *mWvalHDD;
+    CMedium mHardDisk;
+    CMachine mMachine;
+};
+
+#endif // __VBoxNewVMWzd_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxOSTypeSelectorButton.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxOSTypeSelectorButton.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxOSTypeSelectorButton.h	(revision 25213)
@@ -0,0 +1,59 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxOSTypeSelectorButton 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 __VBoxOSTypeSelectorButton_h__
+#define __VBoxOSTypeSelectorButton_h__
+
+/* VBox includes */
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QPushButton>
+
+class QSignalMapper;
+
+class VBoxOSTypeSelectorButton: public QIWithRetranslateUI<QPushButton>
+{
+    Q_OBJECT;
+
+public:
+    VBoxOSTypeSelectorButton (QWidget *aParent);
+    QString osTypeId() const { return mOSTypeId; }
+
+    bool isMenuShown() const;
+
+    void retranslateUi();
+
+public slots:
+    void setOSTypeId (const QString& aOSTypeId);
+
+private:
+    void populateMenu();
+
+    /* Private member vars */
+    QString mOSTypeId;
+    QMenu *mMainMenu;
+    QSignalMapper *mSignalMapper;
+};
+
+#endif /* __VBoxOSTypeSelectorButton_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxOSTypeSelectorWidget.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxOSTypeSelectorWidget.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxOSTypeSelectorWidget.h	(revision 25213)
@@ -0,0 +1,78 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxOSTypeSelectorWidget class declaration
+ */
+
+/*
+ * 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 __VBoxOSTypeSelectorWidget_h__
+#define __VBoxOSTypeSelectorWidget_h__
+
+#include "QIWithRetranslateUI.h"
+#include "VBoxGlobal.h"
+
+#include <QWidget>
+
+class QComboBox;
+class CGuestOSType;
+class QLabel;
+
+class VBoxOSTypeSelectorWidget : public QIWithRetranslateUI <QWidget>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxOSTypeSelectorWidget (QWidget *aParent);
+
+    void setType (const CGuestOSType &aType);
+    CGuestOSType type() const;
+
+    void setLayoutPosition (int aPos);
+
+signals:
+
+    void osTypeChanged();
+
+protected:
+
+    void retranslateUi();
+    void showEvent (QShowEvent *aEvent);
+
+private slots:
+
+    void onFamilyChanged (int aIndex);
+    void onTypeChanged (int aIndex);
+
+private:
+
+    QLabel *mTxFamilyName;
+    QLabel *mTxTypeName;
+    QLabel *mPxTypeIcon;
+    QComboBox *mCbFamily;
+    QComboBox *mCbType;
+
+    CGuestOSType mType;
+    QMap <QString, QString> mCurrentIds;
+
+    bool mPolished;
+    int mLayoutPosition;
+};
+
+#endif /* __VBoxOSTypeSelectorWidget_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h	(revision 25213)
@@ -0,0 +1,404 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxProblemReporter 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 __VBoxProblemReporter_h__
+#define __VBoxProblemReporter_h__
+
+#include "COMDefs.h"
+#include "QIMessageBox.h"
+
+/* Qt icludes */
+#include <QObject>
+
+class VBoxMedium;
+
+// VBoxProblemReporter class
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * The VBoxProblemReporter class is a central place to handle all problem/error
+ * situations that happen during application runtime and require the user's
+ * attention.
+ *
+ * The role of this class is to describe the problem and/or the cause of the
+ * error to the user and give him the opportunity to select an action (when
+ * appropriate).
+ *
+ * Every problem sutiation has its own (correspondingly named) method in this
+ * class that takes a list of arguments necessary to describe the situation and
+ * to provide the appropriate actions. The method then returns the choice to the
+ * caller.
+ */
+class VBoxProblemReporter : public QObject
+{
+    Q_OBJECT;
+
+public:
+
+    enum Type
+    {
+        Info = 1,
+        Question,
+        Warning,
+        Error,
+        Critical,
+        GuruMeditation
+    };
+
+    enum
+    {
+        AutoConfirmed = 0x8000
+    };
+
+    static VBoxProblemReporter &instance();
+
+    bool isValid() const;
+
+    // helpers
+
+    int 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;
+
+    int message (QWidget *aParent, Type aType, const QString &aMessage,
+                 const char *aAutoConfirmId,
+                 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
+    {
+        return message (aParent, aType, aMessage, QString::null, aAutoConfirmId,
+                        aButton1, aButton2, aButton3, aText1, aText2, aText3);
+    }
+
+    bool messageYesNo (QWidget *aParent, Type aType, const QString &aMessage,
+                       const QString &aDetails = QString::null,
+                       const char *aAutoConfirmId = 0,
+                       const QString &aYesText = QString::null,
+                       const QString &aNoText = QString::null) const
+    {
+        return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,
+                         QIMessageBox::Yes | QIMessageBox::Default,
+                         QIMessageBox::No | QIMessageBox::Escape,
+                         0,
+                         aYesText, aNoText, QString::null) &
+                QIMessageBox::ButtonMask) == QIMessageBox::Yes;
+    }
+
+    bool messageYesNo (QWidget *aParent, Type aType, const QString &aMessage,
+                       const char *aAutoConfirmId,
+                       const QString &aYesText = QString::null,
+                       const QString &aNoText = QString::null) const
+    {
+        return messageYesNo (aParent, aType, aMessage, QString::null,
+                             aAutoConfirmId, aYesText, aNoText);
+    }
+
+    bool messageOkCancel (QWidget *aParent, Type aType, const QString &aMessage,
+                          const QString &aDetails = QString::null,
+                          const char *aAutoConfirmId = 0,
+                          const QString &aOkText = QString::null,
+                          const QString &aCancelText = QString::null) const
+    {
+        return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,
+                         QIMessageBox::Ok | QIMessageBox::Default,
+                         QIMessageBox::Cancel | QIMessageBox::Escape,
+                         0,
+                         aOkText, aCancelText, QString::null) &
+                QIMessageBox::ButtonMask) == QIMessageBox::Ok;
+    }
+
+    bool messageOkCancel (QWidget *aParent, Type aType, const QString &aMessage,
+                          const char *aAutoConfirmId,
+                          const QString &aOkText = QString::null,
+                          const QString &aCancelText = QString::null) const
+    {
+        return messageOkCancel (aParent, aType, aMessage, QString::null,
+                                aAutoConfirmId, aOkText, aCancelText); }
+
+    bool showModalProgressDialog (CProgress &aProgress, const QString &aTitle,
+                                  QWidget *aParent, int aMinDuration = 2000);
+
+    QWidget *mainWindowShown() const;
+
+    /* Generic problem handlers */
+    bool askForOverridingFile (const QString& aPath, QWidget *aParent  = NULL) const;
+    bool askForOverridingFiles (const QVector<QString>& aPaths, QWidget *aParent = NULL) const;
+    bool askForOverridingFileIfExists (const QString& path, QWidget *aParent = NULL) const;
+    bool askForOverridingFilesIfExists (const QVector<QString>& aPaths, QWidget *aParent = NULL) const;
+
+    void cannotDeleteFile (const QString& path, QWidget *aParent = NULL) const;
+
+    void checkForMountedWrongUSB() const;
+
+    /* Special problem handlers */
+    void showBETAWarning();
+    void showBEBWarning();
+
+#ifdef Q_WS_X11
+    void cannotFindLicenseFiles (const QString &aPath);
+    void cannotOpenLicenseFile (QWidget *aParent, const QString &aPath);
+#endif
+
+    void cannotOpenURL (const QString &aURL);
+    void cannotCopyFile (const QString &aSrc, const QString &aDst, int aVRC);
+
+    void cannotFindLanguage (const QString &aLangID, const QString &aNlsPath);
+    void cannotLoadLanguage (const QString &aLangFile);
+
+    void cannotInitCOM (HRESULT rc);
+    void cannotCreateVirtualBox (const CVirtualBox &vbox);
+
+    void cannotSaveGlobalSettings (const CVirtualBox &vbox,
+                                   QWidget *parent = 0);
+
+    void cannotLoadGlobalConfig (const CVirtualBox &vbox, const QString &error);
+    void cannotSaveGlobalConfig (const CVirtualBox &vbox);
+    void cannotSetSystemProperties (const CSystemProperties &props);
+    void cannotAccessUSB (const COMBaseWithEI &aObj);
+
+    void cannotCreateMachine (const CVirtualBox &vbox,
+                              QWidget *parent = 0);
+    void cannotCreateMachine (const CVirtualBox &vbox, const CMachine &machine,
+                              QWidget *parent = 0);
+    void cannotApplyMachineSettings (const CMachine &machine, const COMResult &res);
+    void cannotSaveMachineSettings (const CMachine &machine,
+                                    QWidget *parent = 0);
+    void cannotLoadMachineSettings (const CMachine &machine,
+                                    bool strict = true,
+                                    QWidget *parent = 0);
+
+    void cannotStartMachine (const CConsole &console);
+    void cannotStartMachine (const CProgress &progress);
+    void cannotPauseMachine (const CConsole &console);
+    void cannotResumeMachine (const CConsole &console);
+    void cannotACPIShutdownMachine (const CConsole &console);
+    void cannotSaveMachineState (const CConsole &console);
+    void cannotSaveMachineState (const CProgress &progress);
+    void cannotTakeSnapshot (const CConsole &console);
+    void cannotTakeSnapshot (const CProgress &progress);
+    void cannotStopMachine (const CConsole &console);
+    void cannotStopMachine (const CProgress &progress);
+    void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);
+    void cannotDiscardSavedState (const CConsole &console);
+
+    void cannotSendACPIToMachine();
+    bool warnAboutVirtNotEnabled64BitsGuest();
+    bool warnAboutVirtNotEnabledGuestRequired();
+
+    void cannotSetSnapshotFolder (const CMachine &aMachine, const QString &aPath);
+
+    bool askAboutSnapshotRestoring (const QString &aSnapshotName);
+    bool askAboutSnapshotDeleting (const QString &aSnapshotName);
+    void cannotRestoreSnapshot (const CConsole &aConsole, const QString &aSnapshotName);
+    void cannotRestoreSnapshot (const CProgress &aProgress, const QString &aSnapshotName);
+    void cannotDeleteSnapshot (const CConsole &aConsole, const QString &aSnapshotName);
+    void cannotDeleteSnapshot (const CProgress &aProgress, const QString &aSnapshotName);
+
+    void cannotFindMachineByName (const CVirtualBox &vbox, const QString &name);
+
+    void cannotEnterSeamlessMode (ULONG aWidth, ULONG aHeight,
+                                  ULONG aBpp, ULONG64 aMinVRAM);
+    int cannotEnterFullscreenMode (ULONG aWidth, ULONG aHeight,
+                                   ULONG aBpp, ULONG64 aMinVRAM);
+
+    bool confirmMachineDeletion (const CMachine &machine);
+    bool confirmDiscardSavedState (const CMachine &machine);
+
+    bool confirmReleaseMedium (QWidget *aParent, const VBoxMedium &aMedium,
+                               const QString &aUsage);
+
+    bool confirmRemoveMedium (QWidget *aParent, const VBoxMedium &aMedium);
+
+    void sayCannotOverwriteHardDiskStorage (QWidget *aParent,
+                                            const QString &aLocation);
+    int confirmDeleteHardDiskStorage (QWidget *aParent,
+                                      const QString &aLocation);
+    void cannotDeleteHardDiskStorage (QWidget *aParent, const CMedium &aHD,
+                                      const CProgress &aProgress);
+
+    int confirmDetachAddControllerSlots (QWidget *aParent) const;
+    int confirmChangeAddControllerSlots (QWidget *aParent) const;
+    int confirmRunNewHDWzdOrVDM (KDeviceType aDeviceType);
+
+    int confirmRemovingOfLastDVDDevice() const;
+
+    void cannotCreateHardDiskStorage (QWidget *aParent, const CVirtualBox &aVBox,
+                                      const QString &aLocaiton,
+                                      const CMedium &aHD,
+                                      const CProgress &aProgress);
+    void cannotAttachDevice (QWidget *aParent, const CMachine &aMachine,
+                             VBoxDefs::MediumType aType, const QString &aLocation,
+                             KStorageBus aBus, LONG aChannel, LONG aDevice);
+    void cannotDetachDevice (QWidget *aParent, const CMachine &aMachine,
+                             VBoxDefs::MediumType aType, const QString &aLocation,
+                             KStorageBus aBus, LONG aChannel, LONG aDevice);
+
+    int cannotRemountMedium (QWidget *aParent, const CMachine &aMachine, const VBoxMedium &aMedium, bool aMount, bool aRetry);
+    void cannotOpenMedium (QWidget *aParent, const CVirtualBox &aVBox,
+                           VBoxDefs::MediumType aType, const QString &aLocation);
+    void cannotCloseMedium (QWidget *aParent, const VBoxMedium &aMedium,
+                            const COMResult &aResult);
+    void cannotEjectDrive();
+
+    void cannotOpenSession (const CSession &session);
+    void cannotOpenSession (const CVirtualBox &vbox, const CMachine &machine,
+                            const CProgress &progress = CProgress());
+
+    void cannotGetMediaAccessibility (const VBoxMedium &aMedium);
+
+    int confirmDeletingHostInterface (const QString &aName, QWidget *aParent = 0);
+    void cannotCreateHostInterface (const CHost &aHost, QWidget *aParent = 0);
+    void cannotCreateHostInterface (const CProgress &aProgress, QWidget *aParent = 0);
+    void cannotRemoveHostInterface (const CHost &aHost,
+                                    const CHostNetworkInterface &aIface,
+                                    QWidget *aParent = 0);
+    void cannotRemoveHostInterface (const CProgress &aProgress,
+                                    const CHostNetworkInterface &aIface,
+                                    QWidget *aParent = 0);
+
+    void cannotAttachUSBDevice (const CConsole &console, const QString &device);
+    void cannotAttachUSBDevice (const CConsole &console, const QString &device,
+                                const CVirtualBoxErrorInfo &error);
+    void cannotDetachUSBDevice (const CConsole &console, const QString &device);
+    void cannotDetachUSBDevice (const CConsole &console, const QString &device,
+                                const CVirtualBoxErrorInfo &error);
+
+    void cannotCreateSharedFolder (QWidget *, const CMachine &,
+                                   const QString &, const QString &);
+    void cannotRemoveSharedFolder (QWidget *, const CMachine &,
+                                   const QString &, const QString &);
+    void cannotCreateSharedFolder (QWidget *, const CConsole &,
+                                   const QString &, const QString &);
+    void cannotRemoveSharedFolder (QWidget *, const CConsole &,
+                                   const QString &, const QString &);
+
+    int cannotFindGuestAdditions (const QString &aSrc1, const QString &aSrc2);
+    void cannotDownloadGuestAdditions (const QString &aURL, const QString &aReason);
+    void cannotMountGuestAdditions (const QString &aMachineName);
+    bool confirmDownloadAdditions (const QString &aURL, ulong aSize);
+    bool confirmMountAdditions (const QString &aURL, const QString &aSrc);
+    void warnAboutTooOldAdditions (QWidget *, const QString &, const QString &);
+    void warnAboutOldAdditions (QWidget *, const QString &, const QString &);
+    void warnAboutNewAdditions (QWidget *, const QString &, const QString &);
+
+    void cannotConnectRegister (QWidget *aParent,
+                                const QString &aURL,
+                                const QString &aReason);
+    void showRegisterResult (QWidget *aParent,
+                             const QString &aResult);
+
+    void showUpdateSuccess (QWidget *aParent,
+                            const QString &aVersion,
+                            const QString &aLink);
+    void showUpdateFailure (QWidget *aParent,
+                            const QString &aReason);
+    void showUpdateNotFound (QWidget *aParent);
+
+    bool confirmInputCapture (bool *aAutoConfirmed = NULL);
+    void remindAboutAutoCapture();
+    void remindAboutMouseIntegration (bool aSupportsAbsolute);
+    bool remindAboutPausedVMInput();
+
+    int warnAboutSettingsAutoConversion (const QString &aFileList, bool aAfterRefresh);
+
+    bool remindAboutInaccessibleMedia();
+
+    bool confirmGoingFullscreen (const QString &aHotKey);
+    bool confirmGoingSeamless (const QString &aHotKey);
+
+    void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP);
+
+    bool remindAboutGuruMeditation (const CConsole &aConsole,
+                                    const QString &aLogFolder);
+
+    bool confirmVMReset (QWidget *aParent);
+
+    bool confirmHardDisklessMachine (QWidget *aParent);
+
+    void cannotRunInSelectorMode();
+
+    void cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL) const;
+    void cannotImportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const;
+
+    void cannotCheckFiles (const CProgress &aProgress, QWidget *aParent = NULL) const;
+    void cannotRemoveFiles (const CProgress &aProgress, QWidget *aParent = NULL) const;
+
+    void cannotExportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL) const;
+    void cannotExportAppliance (const CMachine &aMachine, CAppliance *aAppliance, QWidget *aParent = NULL) const;
+    void cannotExportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const;
+
+    void showRuntimeError (const CConsole &console, bool fatal,
+                           const QString &errorID,
+                           const QString &errorMsg) const;
+
+    static QString mediumToAccusative (VBoxDefs::MediumType aType, bool aIsHostDrive = false);
+    static QString deviceToAccusative (VBoxDefs::MediumType aType);
+
+    static QString formatRC (HRESULT aRC);
+
+    static QString formatErrorInfo (const COMErrorInfo &aInfo,
+                                    HRESULT aWrapperRC = S_OK);
+
+    static QString formatErrorInfo (const CVirtualBoxErrorInfo &aInfo)
+    {
+        return formatErrorInfo (COMErrorInfo (aInfo));
+    }
+
+    static QString formatErrorInfo (const COMBaseWithEI &aWrapper)
+    {
+        Assert (aWrapper.lastRC() != S_OK);
+        return formatErrorInfo (aWrapper.errorInfo(), aWrapper.lastRC());
+    }
+
+    static QString formatErrorInfo (const COMResult &aRC)
+    {
+        Assert (aRC.rc() != S_OK);
+        return formatErrorInfo (aRC.errorInfo(), aRC.rc());
+    }
+
+public slots:
+
+    void showHelpWebDialog();
+    void showHelpAboutDialog();
+    void showHelpHelpDialog();
+    void resetSuppressedMessages();
+
+private:
+
+    friend VBoxProblemReporter &vboxProblem();
+
+    static QString doFormatErrorInfo (const COMErrorInfo &aInfo,
+                                      HRESULT aWrapperRC = S_OK);
+};
+
+/**
+ * Shortcut to the static VBoxProblemReporter::instance() method, for
+ * convenience.
+ */
+inline VBoxProblemReporter &vboxProblem() { return VBoxProblemReporter::instance(); }
+
+#endif // __VBoxProblemReporter_h__
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxProgressDialog.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxProgressDialog.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxProgressDialog.h	(revision 25213)
@@ -0,0 +1,90 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxProgressDialog 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 __VBoxProgressDialog_h__
+#define __VBoxProgressDialog_h__
+
+/* Qt includes */
+#include "QIDialog.h"
+
+/* VBox forward declarations */
+class CProgress;
+class QILabel;
+class VBoxMiniCancelButton;
+
+/* Qt forward declarations */
+class QProgressBar;
+
+/**
+ * A QProgressDialog enhancement that allows to:
+ *
+ * 1) prevent closing the dialog when it has no cancel button;
+ * 2) effectively track the IProgress object completion (w/o using
+ *    IProgress::waitForCompletion() and w/o blocking the UI thread in any other
+ *    way for too long).
+ *
+ * @note The CProgress instance is passed as a non-const reference to the
+ *       constructor (to memorize COM errors if they happen), and therefore must
+ *       not be destroyed before the created VBoxProgressDialog instance is
+ *       destroyed.
+ */
+class VBoxProgressDialog: protected QIDialog
+{
+    Q_OBJECT;
+
+public:
+    VBoxProgressDialog (CProgress &aProgress, const QString &aTitle,
+                        int aMinDuration = 2000, QWidget *aParent = 0);
+
+    int run (int aRefreshInterval);
+    bool cancelEnabled() const { return mCancelEnabled; }
+
+protected:
+    virtual void retranslateUi();
+
+    virtual void reject();
+
+    virtual void timerEvent (QTimerEvent *aEvent);
+    virtual void closeEvent (QCloseEvent *aEvent);
+
+private slots:
+    void showDialog();
+    void cancelOperation();
+
+private:
+    /* Private member vars */
+    CProgress &mProgress;
+    QILabel *mLabel;
+    QILabel *mETA;
+    QString mCancelText;
+    QProgressBar *mProgressBar;
+    VBoxMiniCancelButton *mCancelBtn;
+    bool mCancelEnabled;
+    const ulong mOpCount;
+    ulong mCurOp;
+    bool mEnded;
+
+    static const char *sOpDescTpl;
+};
+
+#endif /* __VBoxProgressDialog_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxRegistrationDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxRegistrationDlg.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxRegistrationDlg.h	(revision 25213)
@@ -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/include/VBoxSelectorWnd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h	(revision 25213)
@@ -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/include/VBoxSettingsDialog.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsDialog.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsDialog.h	(revision 25213)
@@ -0,0 +1,120 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxSettingsDialog 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 __VBoxSettingsDialog_h__
+#define __VBoxSettingsDialog_h__
+
+/* VBox includes */
+#include "QIMainDialog.h"
+#include "QIWithRetranslateUI.h"
+#include "VBoxSettingsDialog.gen.h"
+
+/* Qt forwards */
+class QIWidgetValidator;
+class QStackedWidget;
+class QTimer;
+
+/* VBox forwards*/
+class VBoxWarningPane;
+class VBoxSettingsSelector;
+class VBoxSettingsPage;
+
+/*
+ * Base dialog class for both Global & VM settings which
+ * encapsulates most of their similar functionalities.
+ */
+class VBoxSettingsDialog : public QIWithRetranslateUI<QIMainDialog>,
+                           public Ui::VBoxSettingsDialog
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSettingsDialog (QWidget *aParent = NULL);
+    ~VBoxSettingsDialog();
+
+    virtual void getFrom() = 0;
+    virtual void putBackTo() = 0;
+
+protected slots:
+
+    virtual void revalidate (QIWidgetValidator *aWval);
+    void categoryChanged (int aId);
+
+protected:
+
+    virtual void retranslateUi();
+
+    virtual QString dialogTitle() const = 0;
+    QString titleExtension() const;
+
+    void setError (const QString &aError);
+    void setWarning (const QString &aWarning);
+
+    void addItem (const QString &aBigIcon, const QString &aBigIconDisabled,
+                  const QString &aSmallIcon, const QString &aSmallIconDisabled,
+                  int aId, const QString &aLink,
+                  VBoxSettingsPage* aPrefPage = NULL, int aParentId = -1);
+
+    virtual bool correlate (QWidget *aPage, QString &aWarning);
+
+    VBoxSettingsSelector *mSelector;
+    QStackedWidget *mStack;
+
+private slots:
+
+    void enableOk (const QIWidgetValidator *aWval);
+    void updateWhatsThis (bool aGotFocus = false);
+    void whatsThisCandidateDestroyed (QObject *aObj = 0);
+
+private:
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+    void showEvent (QShowEvent *aEvent);
+
+    VBoxSettingsPage* attachValidator (VBoxSettingsPage *aPage);
+
+    /* Flags */
+    bool mPolished;
+
+    /* Error & Warning stuff */
+    bool mValid;
+    bool mSilent;
+    QString mErrorHint;
+    QString mWarnHint;
+    QString mErrorString;
+    QString mWarnString;
+    QPixmap mErrorIcon;
+    QPixmap mWarnIcon;
+    VBoxWarningPane *mIconLabel;
+
+    /* WhatsThis Stuff */
+    QTimer *mWhatsThisTimer;
+    QWidget *mWhatsThisCandidate;
+
+#ifdef Q_WS_MAC
+    QList<QSize> mSizeList;
+#endif /* Q_WS_MAC */
+};
+
+#endif // __VBoxSettingsDialog_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsDialogSpecific.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsDialogSpecific.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsDialogSpecific.h	(revision 25213)
@@ -0,0 +1,122 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxSettingsDialogSpecific 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 __VBoxSettingsDialogSpecific_h__
+#define __VBoxSettingsDialogSpecific_h__
+
+#include "COMDefs.h"
+#include "VBoxSettingsDialog.h"
+
+/*
+ * Dialog which encapsulate all the specific funtionalities of the
+ * Global Settings.
+ */
+class VBoxGLSettingsDlg : public VBoxSettingsDialog
+{
+    Q_OBJECT;
+
+public:
+
+    enum GLSettingsPageIds
+    {
+        GeneralId = 0,
+        InputId,
+        UpdateId,
+        LanguageId,
+        USBId,
+        NetworkId
+    };
+
+    VBoxGLSettingsDlg (QWidget *aParent);
+
+protected:
+
+    void getFrom();
+    void putBackTo();
+
+    void retranslateUi();
+
+    QString dialogTitle() const;
+
+private:
+
+    bool isAvailable (GLSettingsPageIds aId);
+};
+
+/*
+ * Dialog which encapsulate all the specific funtionalities of the
+ * Virtual Machine Settings.
+ */
+class VBoxVMSettingsDlg : public VBoxSettingsDialog
+{
+    Q_OBJECT;
+
+public:
+
+    enum VMSettingsPageIds
+    {
+        GeneralId = 0,
+        SystemId,
+        DisplayId,
+        StorageId,
+        HDId,
+        CDId,
+        FDId,
+        AudioId,
+        NetworkId,
+        PortsId,
+        SerialId,
+        ParallelId,
+        USBId,
+        SFId
+    };
+
+    VBoxVMSettingsDlg (QWidget *aParent, const CMachine &aMachine,
+                       const QString &aCategory, const QString &aControl);
+
+protected:
+
+    void getFrom();
+    void putBackTo();
+
+    void retranslateUi();
+
+    QString dialogTitle() const;
+
+    bool correlate (QWidget *aPage, QString &aWarning);
+
+private slots:
+
+    void onMediaEnumerationDone();
+    void resetFirstRunFlag();
+
+private:
+
+    bool isAvailable (VMSettingsPageIds aId);
+
+    CMachine mMachine;
+    bool mAllowResetFirstRunFlag;
+    bool mResetFirstRunFlag;
+};
+
+#endif // __VBoxSettingsDialogSpecific_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsPage.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsPage.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsPage.h	(revision 25213)
@@ -0,0 +1,66 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxSettingsPage 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 __VBoxSettingsPage_h__
+#define __VBoxSettingsPage_h__
+
+#include "QIWithRetranslateUI.h"
+#include "COMDefs.h"
+
+#include <QWidget>
+
+class VBoxGlobalSettings;
+class QIWidgetValidator;
+
+class VBoxSettingsPage : public QIWithRetranslateUI<QWidget>
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSettingsPage (QWidget *aParent = 0)
+        : QIWithRetranslateUI<QWidget> (aParent)
+        , mFirstWidget (0) {}
+
+    /* Global settings set/get stuff */
+    virtual void getFrom (const CSystemProperties & /* aProps */,
+                          const VBoxGlobalSettings & /* aGs */) {}
+    virtual void putBackTo (CSystemProperties & /* aProps */,
+                            VBoxGlobalSettings & /* aGs */) {}
+
+    /* VM settings set/get stuff */
+    virtual void getFrom (const CMachine & /* aMachine */) {}
+    virtual void putBackTo() {}
+
+    virtual void setValidator (QIWidgetValidator * /* aVal */) {}
+    virtual bool revalidate (QString & /* aWarnText */, QString & /* aTitle */)
+        { return true; }
+
+    virtual void setOrderAfter (QWidget *aWidget) { mFirstWidget = aWidget; }
+
+protected:
+
+    QWidget *mFirstWidget;
+};
+
+#endif // __VBoxSettingsPage_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsSelector.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsSelector.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsSelector.h	(revision 25213)
@@ -0,0 +1,178 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxSettingsSelector class declaration
+ */
+
+/*
+ * 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 __VBoxSettingsSelector_h__
+#define __VBoxSettingsSelector_h__
+
+/* Qt includes */
+#include <QObject>
+
+class QITreeWidget;
+class VBoxToolBar;
+class VBoxSettingsPage;
+class SelectorItem;
+class SelectorActionItem;
+
+class QTreeWidget;
+class QTreeWidgetItem;
+class QIcon;
+class QAction;
+class QActionGroup;
+template <class Key, class T> class QMap;
+class QTabWidget;
+
+class VBoxSettingsSelector: public QObject
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSettingsSelector (QWidget *aParent = NULL);
+    ~VBoxSettingsSelector();
+
+    virtual QWidget *widget() const = 0;
+
+    virtual QWidget *addItem (const QString &aBigIcon, const QString &aBigIconDisabled, const QString &aSmallIcon, const QString &aSmallIconDisabled, int aId, const QString &aLink, VBoxSettingsPage* aPage = NULL, int aParentId = -1) = 0;
+
+    virtual void setItemText (int aId, const QString &aText);
+    virtual QString itemText (int aId) const = 0;
+    virtual QString itemTextByPage (VBoxSettingsPage *aPage) const;
+
+    virtual int currentId () const = 0;
+    virtual int linkToId (const QString &aLink) const = 0;
+
+    virtual QWidget *idToPage (int aId) const;
+    virtual QWidget *rootPage (int aId) const { return idToPage (aId); }
+
+    virtual void selectById (int aId) = 0;
+    virtual void selectByLink (const QString &aLink) { selectById (linkToId (aLink)); }
+
+    virtual void setVisibleById (int aId, bool aShow) = 0;
+
+    virtual QList<VBoxSettingsPage*> settingPages() const;
+    virtual QList<QWidget*> rootPages() const;
+
+    virtual void polish() {};
+
+    virtual int minWidth () const { return 0; }
+
+signals:
+
+    void categoryChanged (int);
+
+protected:
+
+    virtual void clear() = 0;
+
+    SelectorItem* findItem (int aId) const;
+    SelectorItem* findItemByLink (const QString &aLink) const;
+    SelectorItem* findItemByPage (VBoxSettingsPage* aPage) const;
+
+    QList<SelectorItem*> mItemList;
+};
+
+class VBoxSettingsTreeViewSelector: public VBoxSettingsSelector
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSettingsTreeViewSelector (QWidget *aParent = NULL);
+
+    virtual QWidget *widget() const;
+
+    virtual QWidget *addItem (const QString &aBigIcon, const QString &aBigIconDisabled, const QString &aSmallIcon, const QString &aSmallIconDisabled, int aId, const QString &aLink, VBoxSettingsPage* aPage = NULL, int aParentId = -1);
+    virtual void setItemText (int aId, const QString &aText);
+    virtual QString itemText (int aId) const;
+
+    virtual int currentId() const;
+    virtual int linkToId (const QString &aLink) const;
+
+    virtual void selectById (int aId);
+
+    virtual void setVisibleById (int aId, bool aShow);
+
+    virtual void polish();
+
+private slots:
+
+    void settingsGroupChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrevItem);
+
+private:
+
+    virtual void clear();
+
+    QString pagePath (const QString &aMatch) const;
+    QTreeWidgetItem* findItem (QTreeWidget *aView, const QString &aMatch, int aColumn) const;
+    QString idToString (int aId) const;
+
+    /* Private member vars */
+    QITreeWidget *mTwSelector;
+};
+
+class VBoxSettingsToolBarSelector: public VBoxSettingsSelector
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxSettingsToolBarSelector (QWidget *aParent = NULL);
+    ~VBoxSettingsToolBarSelector();
+
+    virtual QWidget *widget() const;
+
+    virtual QWidget *addItem (const QString &aBigIcon, const QString &aBigIconDisabled, const QString &aSmallIcon, const QString &aSmallIconDisabled, int aId, const QString &aLink, VBoxSettingsPage* aPage = NULL, int aParentId = -1);
+    virtual void setItemText (int aId, const QString &aText);
+    virtual QString itemText (int aId) const;
+
+    virtual int currentId() const;
+    virtual int linkToId (const QString &aLink) const;
+
+    virtual QWidget *idToPage (int aId) const;
+    virtual QWidget *rootPage (int aId) const;
+
+    virtual void selectById (int aId);
+
+    virtual void setVisibleById (int aId, bool aShow);
+
+    virtual int minWidth() const;
+
+    virtual QList<QWidget*> rootPages() const;
+private slots:
+
+    void settingsGroupChanged (QAction *aAction);
+    void settingsGroupChanged (int aIndex);
+
+private:
+
+    virtual void clear();
+
+    SelectorActionItem *findActionItem (int aId) const;
+    SelectorActionItem *findActionItemByAction (QAction *aAction) const;
+    SelectorActionItem *findActionItemByTabWidget (QTabWidget* aTabWidget, int aIndex) const;
+
+    /* Private member vars */
+    VBoxToolBar *mTbSelector;
+    QActionGroup *mActionGroup;
+};
+
+#endif /* __VBoxSettingsSelector_h__ */
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxSnapshotDetailsDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxSnapshotDetailsDlg.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxSnapshotDetailsDlg.h	(revision 25213)
@@ -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/include/VBoxSnapshotsWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxSnapshotsWgt.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxSnapshotsWgt.h	(revision 25213)
@@ -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/include/VBoxSpecialControls.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxSpecialControls.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxSpecialControls.h	(revision 25213)
@@ -0,0 +1,231 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxSpecialButtons 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 ___VBoxSpecialControls_h__
+#define ___VBoxSpecialControls_h__
+
+/* VBox includes */
+#include "QIWithRetranslateUI.h"
+
+/* Qt includes */
+#include <QPushButton>
+
+#ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
+
+/* VBox includes */
+#include "VBoxCocoaSpecialControls.h"
+
+/********************************************************************************
+ *
+ * A mini cancel button in the native Cocoa version.
+ *
+ ********************************************************************************/
+class VBoxMiniCancelButton: public QAbstractButton
+{
+    Q_OBJECT;
+
+public:
+    VBoxMiniCancelButton (QWidget *aParent = 0);
+
+    void setText (const QString &aText) { mButton->setText (aText); }
+    void setToolTip (const QString &aTip) { mButton->setToolTip (aTip); }
+
+protected:
+    void paintEvent (QPaintEvent * /* aEvent */) {}
+
+private:
+    VBoxCocoaButton *mButton;
+};
+
+/********************************************************************************
+ *
+ * A help button in the native Cocoa version.
+ *
+ ********************************************************************************/
+class VBoxHelpButton: public QPushButton
+{
+    Q_OBJECT;
+
+public:
+    VBoxHelpButton (QWidget *aParent = 0);
+
+    void setToolTip (const QString &aTip) { mButton->setToolTip (aTip); }
+
+    void initFrom (QPushButton * /* aOther */) {}
+
+protected:
+    void paintEvent (QPaintEvent * /* aEvent */) {}
+
+private:
+    VBoxCocoaButton *mButton;
+};
+
+/********************************************************************************
+ *
+ * A segmented button in the native Cocoa version.
+ *
+ ********************************************************************************/
+class VBoxSegmentedButton: public VBoxCocoaSegmentedButton
+{
+    Q_OBJECT;
+
+public:
+    VBoxSegmentedButton (int aCount, QWidget *aParent = 0);
+
+    void setIcon (int /* aSegment */, const QIcon & /* aIcon */) {}
+};
+
+/********************************************************************************
+ *
+ * A search field in the native Cocoa version.
+ *
+ ********************************************************************************/
+class VBoxSearchField: public VBoxCocoaSearchField
+{
+    Q_OBJECT;
+
+public:
+    VBoxSearchField (QWidget *aParent = 0);
+};
+
+#else /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
+
+/* VBox includes */
+#include "QIToolButton.h"
+
+/* Qt includes */
+#include <QLineEdit>
+
+/* Qt forward declarations */
+class QSignalMapper;
+
+/********************************************************************************
+ *
+ * A mini cancel button for the other OS's.
+ *
+ ********************************************************************************/
+class VBoxMiniCancelButton: public QIWithRetranslateUI<QIToolButton>
+{
+    Q_OBJECT;
+
+public:
+    VBoxMiniCancelButton (QWidget *aParent = 0);
+
+protected:
+    void retranslateUi() {};
+};
+
+/********************************************************************************
+ *
+ * A help button for the other OS's.
+ *
+ ********************************************************************************/
+class VBoxHelpButton: public QIWithRetranslateUI<QPushButton>
+{
+    Q_OBJECT;
+
+public:
+    VBoxHelpButton (QWidget *aParent = 0);
+#ifdef Q_WS_MAC
+    ~VBoxHelpButton();
+    QSize sizeHint() const;
+#endif /* Q_WS_MAC */
+
+    void initFrom (QPushButton *aOther);
+
+protected:
+    void retranslateUi();
+
+#ifdef Q_WS_MAC
+    void paintEvent (QPaintEvent *aEvent);
+
+    bool hitButton (const QPoint &pos) const;
+
+    void mousePressEvent (QMouseEvent *aEvent);
+    void mouseReleaseEvent (QMouseEvent *aEvent);
+    void leaveEvent (QEvent *aEvent);
+
+private:
+    /* Private member vars */
+    bool mButtonPressed;
+
+    QSize mSize;
+    QPixmap *mNormalPixmap;
+    QPixmap *mPressedPixmap;
+    QImage *mMask;
+    QRect mBRect;
+#endif /* Q_WS_MAC */
+};
+
+/********************************************************************************
+ *
+ * A segmented button for the other OS's.
+ *
+ ********************************************************************************/
+class VBoxSegmentedButton: public QWidget
+{
+    Q_OBJECT;
+
+public:
+    VBoxSegmentedButton (int aCount, QWidget *aParent = 0);
+    ~VBoxSegmentedButton();
+
+    void setTitle (int aSegment, const QString &aTitle);
+    void setToolTip (int aSegment, const QString &aTip);
+    void setIcon (int aSegment, const QIcon &aIcon);
+    void setEnabled (int aSegment, bool fEnabled);
+
+    void animateClick (int aSegment);
+
+signals:
+    void clicked (int aSegment);
+
+private:
+    /* Private member vars */
+    QList<QIToolButton*> mButtons;
+    QSignalMapper *mSignalMapper;
+};
+
+/********************************************************************************
+ *
+ * A search field  for the other OS's.
+ *
+ ********************************************************************************/
+class VBoxSearchField: public QLineEdit
+{
+    Q_OBJECT;
+
+public:
+    VBoxSearchField (QWidget *aParent = 0);
+
+    void markError();
+    void unmarkError();
+
+private:
+    /* Private member vars */
+    QBrush mBaseBrush;
+};
+
+#endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
+
+#endif /* ___VBoxSpecialControls_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxTakeSnapshotDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxTakeSnapshotDlg.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxTakeSnapshotDlg.h	(revision 25213)
@@ -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/include/VBoxToolBar.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxToolBar.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxToolBar.h	(revision 25213)
@@ -0,0 +1,137 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * VBoxToolBar class declaration & 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.
+ */
+
+#ifndef ___VBoxToolBar_h___
+#define ___VBoxToolBar_h___
+
+#include <QGlobalStatic> /* for Q_WS_MAC */
+#ifdef Q_WS_MAC
+#include "VBoxUtils.h"
+#endif
+
+/* Qt includes */
+#include <QLayout>
+#include <QMainWindow>
+#include <QToolBar>
+
+/* Note: This styles are available on _all_ platforms. */
+#include <QCleanlooksStyle>
+#include <QWindowsStyle>
+
+/**
+ *  The VBoxToolBar class is a simple QToolBar reimplementation to disable
+ *  its built-in context menu and add some default behavior we need.
+ */
+class VBoxToolBar : public QToolBar
+{
+
+public:
+
+    VBoxToolBar (QWidget *aParent)
+        : QToolBar (aParent)
+        , mMainWindow (qobject_cast <QMainWindow*> (aParent))
+    {
+        setFloatable (false);
+        setMovable (false);
+
+        /* Remove that ugly frame panel around the toolbar.
+         * Doing that currently for Cleanlooks & Windows styles. */
+        if (qobject_cast <QCleanlooksStyle*> (QToolBar::style()) ||
+            qobject_cast <QWindowsStyle*> (QToolBar::style()))
+            setStyleSheet ("QToolBar { border: 0px none black; }");
+
+        if (layout())
+            layout()->setContentsMargins (0, 0, 0, 0);;
+
+        setContextMenuPolicy (Qt::NoContextMenu);
+    }
+
+#ifdef Q_WS_MAC
+    void setMacToolbar()
+    {
+        if (mMainWindow)
+        {
+            mMainWindow->setUnifiedTitleAndToolBarOnMac (true);
+#ifndef QT_MAC_USE_COCOA
+            WindowRef window = ::darwinToNativeWindow (this);
+            EventHandlerUPP eventHandler = ::NewEventHandlerUPP (VBoxToolBar::macEventFilter);
+            EventTypeSpec eventTypes[2];
+            eventTypes[0].eventClass = kEventClassMouse;
+            eventTypes[0].eventKind  = kEventMouseDown;
+            eventTypes[1].eventClass = kEventClassMouse;
+            eventTypes[1].eventKind  = kEventMouseUp;
+            InstallWindowEventHandler (window, eventHandler,
+                                       RT_ELEMENTS (eventTypes), eventTypes,
+                                       NULL, NULL);
+#endif /* !QT_MAC_USE_COCOA */
+        }
+    }
+
+#ifndef QT_MAC_USE_COCOA
+    static pascal OSStatus macEventFilter (EventHandlerCallRef aNextHandler,
+                                           EventRef aEvent, void * /* aUserData */)
+    {
+        UInt32 eclass = GetEventClass (aEvent);
+        if (eclass == kEventClassMouse)
+        {
+            WindowPartCode partCode;
+            GetEventParameter (aEvent, kEventParamWindowPartCode, typeWindowPartCode, NULL, sizeof (WindowPartCode), NULL, &partCode);
+            UInt32 ekind = GetEventKind (aEvent);
+            if (partCode == 15 ||
+                partCode == 4)
+                if(ekind == kEventMouseDown || ekind == kEventMouseUp)
+                {
+                    EventMouseButton button = 0;
+                    GetEventParameter (aEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof (button), NULL, &button);
+                    if (button != kEventMouseButtonPrimary)
+                        return noErr;
+                }
+        }
+        return CallNextEventHandler (aNextHandler, aEvent);
+    }
+#endif /* !QT_MAC_USE_COCOA */
+
+    void setShowToolBarButton (bool aShow)
+    {
+        ::darwinSetShowsToolbarButton (this, aShow);
+    }
+#endif /* Q_WS_MAC */
+
+    void setUsesTextLabel (bool aEnable)
+    {
+        Qt::ToolButtonStyle tbs = Qt::ToolButtonTextUnderIcon;
+        if (!aEnable)
+            tbs = Qt::ToolButtonIconOnly;
+
+        if (mMainWindow)
+            mMainWindow->setToolButtonStyle (tbs);
+        else
+            setToolButtonStyle (tbs);
+    }
+
+private:
+
+    QMainWindow *mMainWindow;
+};
+
+#endif // !___VBoxToolBar_h___
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxUpdateDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxUpdateDlg.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxUpdateDlg.h	(revision 25213)
@@ -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/include/VBoxUtils-darwin.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils-darwin.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils-darwin.h	(revision 25213)
@@ -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 */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h	(revision 25213)
@@ -0,0 +1,134 @@
+/** @file
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * Declarations of utility classes and functions
+ */
+
+/*
+ * 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 ___VBoxUtils_h___
+#define ___VBoxUtils_h___
+
+#include <iprt/types.h>
+
+/* Qt includes */
+#include <QMouseEvent>
+#include <QWidget>
+#include <QTextBrowser>
+
+/**
+ *  Simple class that filters out all key presses and releases
+ *  got while the Alt key is pressed. For some very strange reason,
+ *  QLineEdit accepts those combinations that are not used as accelerators,
+ *  and inserts the corresponding characters to the entry field.
+ */
+class QIAltKeyFilter : protected QObject
+{
+    Q_OBJECT;
+
+public:
+
+    QIAltKeyFilter (QObject *aParent) :QObject (aParent) {}
+
+    void watchOn (QObject *aObject) { aObject->installEventFilter (this); }
+
+protected:
+
+    bool eventFilter (QObject * /* aObject */, QEvent *aEvent)
+    {
+        if (aEvent->type() == QEvent::KeyPress || aEvent->type() == QEvent::KeyRelease)
+        {
+            QKeyEvent *pEvent = static_cast<QKeyEvent *> (aEvent);
+            if (pEvent->modifiers() & Qt::AltModifier)
+                return true;
+        }
+        return false;
+    }
+};
+
+/**
+ *  Simple class which simulates focus-proxy rule redirecting widget
+ *  assigned shortcut to desired widget.
+ */
+class QIFocusProxy : protected QObject
+{
+    Q_OBJECT;
+
+public:
+
+    QIFocusProxy (QWidget *aFrom, QWidget *aTo)
+        : QObject (aFrom), mFrom (aFrom), mTo (aTo)
+    {
+        mFrom->installEventFilter (this);
+    }
+
+protected:
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent)
+    {
+        if (aObject == mFrom && aEvent->type() == QEvent::Shortcut)
+        {
+            mTo->setFocus();
+            return true;
+        }
+        return QObject::eventFilter (aObject, aEvent);
+    }
+
+    QWidget *mFrom;
+    QWidget *mTo;
+};
+
+/**
+ *  QTextEdit reimplementation to feat some extended requirements.
+ */
+class QRichTextEdit : public QTextEdit
+{
+    Q_OBJECT;
+
+public:
+
+    QRichTextEdit (QWidget *aParent) : QTextEdit (aParent) {}
+
+    void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom)
+    {
+        QTextEdit::setViewportMargins (aLeft, aTop, aRight, aBottom);
+    }
+};
+
+/**
+ *  QTextBrowser reimplementation to feat some extended requirements.
+ */
+class QRichTextBrowser : public QTextBrowser
+{
+    Q_OBJECT;
+
+public:
+
+    QRichTextBrowser (QWidget *aParent) : QTextBrowser (aParent) {}
+
+    void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom)
+    {
+        QTextBrowser::setViewportMargins (aLeft, aTop, aRight, aBottom);
+    }
+};
+
+#ifdef Q_WS_MAC
+# include "VBoxUtils-darwin.h"
+#endif /* Q_WS_MAC */
+
+#endif // !___VBoxUtils_h___
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMFirstRunWzd.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMFirstRunWzd.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMFirstRunWzd.h	(revision 25213)
@@ -0,0 +1,64 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMFirstRunWzd 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 __VBoxVMFirstRunWzd_h__
+#define __VBoxVMFirstRunWzd_h__
+
+/* Local includes */
+#include "QIAbstractWizard.h"
+#include "VBoxVMFirstRunWzd.gen.h"
+#include "COMDefs.h"
+#include "QIWithRetranslateUI.h"
+
+/* Local forwardes */
+class QIWidgetValidator;
+
+class VBoxVMFirstRunWzd : public QIWithRetranslateUI <QIAbstractWizard>,
+                          public Ui::VBoxVMFirstRunWzd
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMFirstRunWzd (const CMachine &aMachine, QWidget *aParent = 0);
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void accept();
+    void revalidate (QIWidgetValidator *aValidator);
+    void mediaTypeChanged();
+    void openMediaManager();
+    void enableNext (const QIWidgetValidator *aValidator);
+    void onPageShow();
+
+private:
+
+    QIWidgetValidator *mValidator;
+    CMachine           mMachine;
+};
+
+#endif // __VBoxVMFirstRunWzd_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMInformationDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMInformationDlg.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMInformationDlg.h	(revision 25213)
@@ -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/include/VBoxVMListView.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMListView.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMListView.h	(revision 25213)
@@ -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/include/VBoxVMLogViewer.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMLogViewer.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMLogViewer.h	(revision 25213)
@@ -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/include/VBoxVMSettingsAudio.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsAudio.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsAudio.h	(revision 25213)
@@ -0,0 +1,56 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsAudio 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 __VBoxVMSettingsAudio_h__
+#define __VBoxVMSettingsAudio_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsAudio.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsAudio : public VBoxSettingsPage,
+                            public Ui::VBoxVMSettingsAudio
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsAudio();
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+
+private:
+
+    void prepareComboboxes();
+
+    CMachine mMachine;
+};
+
+#endif // __VBoxVMSettingsAudio_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsDisplay.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsDisplay.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsDisplay.h	(revision 25213)
@@ -0,0 +1,67 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsDisplay 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 __VBoxVMSettingsDisplay_h__
+#define __VBoxVMSettingsDisplay_h__
+
+#include "COMDefs.h"
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsDisplay.gen.h"
+
+class VBoxVMSettingsDisplay : public VBoxSettingsPage,
+                              public Ui::VBoxVMSettingsDisplay
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsDisplay();
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    bool isAcceleration2DVideoSelected() const;
+#endif
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setValidator (QIWidgetValidator *aVal);
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+
+private slots:
+
+    void valueChangedVRAM (int aVal);
+    void textChangedVRAM (const QString &aText);
+
+private:
+
+    CMachine mMachine;
+    QIWidgetValidator *mValidator;
+};
+
+#endif // __VBoxVMSettingsDisplay_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsGeneral.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsGeneral.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsGeneral.h	(revision 25213)
@@ -0,0 +1,65 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsGeneral 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 __VBoxVMSettingsGeneral_h__
+#define __VBoxVMSettingsGeneral_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsGeneral.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsGeneral : public VBoxSettingsPage,
+                              public Ui::VBoxVMSettingsGeneral
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsGeneral();
+
+    bool is64BitOSTypeSelected() const;
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    bool isWindowsOSTypeSelected() const;
+#endif
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setValidator (QIWidgetValidator *aVal);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+
+private:
+
+    void showEvent (QShowEvent *aEvent);
+
+    CMachine mMachine;
+    QIWidgetValidator *mValidator;
+};
+
+#endif // __VBoxVMSettingsGeneral_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h	(revision 25213)
@@ -0,0 +1,609 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsHD 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 __VBoxVMSettingsHD_h__
+#define __VBoxVMSettingsHD_h__
+
+/* Global includes */
+#include <QItemDelegate>
+#include <QPointer>
+
+/* Local includes */
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsHD.gen.h"
+#include "COMDefs.h"
+
+/* Local forwardes */
+class AttachmentItem;
+class ControllerItem;
+
+/* Internal Types */
+typedef QList <StorageSlot> SlotsList;
+typedef QList <KDeviceType> DeviceTypeList;
+typedef QList <KStorageControllerType> ControllerTypeList;
+Q_DECLARE_METATYPE (SlotsList);
+Q_DECLARE_METATYPE (DeviceTypeList);
+Q_DECLARE_METATYPE (ControllerTypeList);
+
+enum ItemState
+{
+    State_DefaultItem   = 0,
+    State_CollapsedItem = 1,
+    State_ExpandedItem  = 2,
+    State_MAX
+};
+
+/* Pixmap Storage Pool */
+class PixmapPool : public QObject
+{
+    Q_OBJECT;
+
+public:
+
+    enum PixmapType
+    {
+        InvalidPixmap            = -1,
+
+        ControllerAddEn          =  0,
+        ControllerAddDis         =  1,
+        ControllerDelEn          =  2,
+        ControllerDelDis         =  3,
+
+        AttachmentAddEn          =  4,
+        AttachmentAddDis         =  5,
+        AttachmentDelEn          =  6,
+        AttachmentDelDis         =  7,
+
+        IDEControllerNormal      =  8,
+        IDEControllerExpand      =  9,
+        IDEControllerCollapse    = 10,
+        SATAControllerNormal     = 11,
+        SATAControllerExpand     = 12,
+        SATAControllerCollapse   = 13,
+        SCSIControllerNormal     = 14,
+        SCSIControllerExpand     = 15,
+        SCSIControllerCollapse   = 16,
+        FloppyControllerNormal   = 17,
+        FloppyControllerExpand   = 18,
+        FloppyControllerCollapse = 19,
+
+        IDEControllerAddEn       = 20,
+        IDEControllerAddDis      = 21,
+        SATAControllerAddEn      = 22,
+        SATAControllerAddDis     = 23,
+        SCSIControllerAddEn      = 24,
+        SCSIControllerAddDis     = 25,
+        FloppyControllerAddEn    = 26,
+        FloppyControllerAddDis   = 27,
+
+        HDAttachmentNormal       = 28,
+        CDAttachmentNormal       = 29,
+        FDAttachmentNormal       = 30,
+
+        HDAttachmentAddEn        = 31,
+        HDAttachmentAddDis       = 32,
+        CDAttachmentAddEn        = 33,
+        CDAttachmentAddDis       = 34,
+        FDAttachmentAddEn        = 35,
+        FDAttachmentAddDis       = 36,
+
+        VMMEn                    = 37,
+        VMMDis                   = 38,
+
+        MaxIndex
+    };
+
+    static PixmapPool* pool (QObject *aParent = 0);
+
+    QPixmap pixmap (PixmapType aType) const;
+
+protected:
+
+    PixmapPool (QObject *aParent);
+
+    static QPointer <PixmapPool> mThis;
+
+private:
+
+    QVector <QPixmap> mPool;
+};
+
+/* Abstract Controller Type */
+class AbstractControllerType
+{
+public:
+
+    AbstractControllerType (KStorageBus aBusType, KStorageControllerType aCtrType);
+    virtual ~AbstractControllerType() {}
+
+    KStorageBus busType() const;
+    KStorageControllerType ctrType() const;
+    ControllerTypeList ctrTypes() const;
+    PixmapPool::PixmapType pixmap (ItemState aState) const;
+
+    void setCtrType (KStorageControllerType aCtrType);
+
+    DeviceTypeList deviceTypeList() const;
+
+protected:
+
+    virtual KStorageControllerType first() const = 0;
+    virtual uint size() const = 0;
+
+    KStorageBus mBusType;
+    KStorageControllerType mCtrType;
+    QList <PixmapPool::PixmapType> mPixmaps;
+};
+
+/* IDE Controller Type */
+class IDEControllerType : public AbstractControllerType
+{
+public:
+
+    IDEControllerType (KStorageControllerType aSubType);
+
+private:
+
+    KStorageControllerType first() const;
+    uint size() const;
+};
+
+/* SATA Controller Type */
+class SATAControllerType : public AbstractControllerType
+{
+public:
+
+    SATAControllerType (KStorageControllerType aSubType);
+
+private:
+
+    KStorageControllerType first() const;
+    uint size() const;
+};
+
+/* SCSI Controller Type */
+class SCSIControllerType : public AbstractControllerType
+{
+public:
+
+    SCSIControllerType (KStorageControllerType aSubType);
+
+private:
+
+    KStorageControllerType first() const;
+    uint size() const;
+};
+
+/* Floppy Controller Type */
+class FloppyControllerType : public AbstractControllerType
+{
+public:
+
+    FloppyControllerType (KStorageControllerType aSubType);
+
+private:
+
+    KStorageControllerType first() const;
+    uint size() const;
+};
+
+/* Abstract Item */
+class AbstractItem
+{
+public:
+
+    enum ItemType
+    {
+        Type_InvalidItem    = 0,
+        Type_RootItem       = 1,
+        Type_ControllerItem = 2,
+        Type_AttachmentItem = 3
+    };
+
+    AbstractItem (AbstractItem *aParent = 0);
+    virtual ~AbstractItem();
+
+    AbstractItem* parent() const;
+    QUuid id() const;
+    QString machineId() const;
+
+    void setMachineId (const QString &aMchineId);
+
+    virtual ItemType rtti() const = 0;
+    virtual AbstractItem* childByPos (int aIndex) = 0;
+    virtual AbstractItem* childById (const QUuid &aId) = 0;
+    virtual int posOfChild (AbstractItem *aItem) const = 0;
+    virtual int childCount() const = 0;
+    virtual QString text() const = 0;
+    virtual QString tip() const = 0;
+    virtual QPixmap pixmap (ItemState aState = State_DefaultItem) = 0;
+
+protected:
+
+    virtual void addChild (AbstractItem *aItem) = 0;
+    virtual void delChild (AbstractItem *aItem) = 0;
+
+    AbstractItem *mParent;
+    QUuid         mId;
+    QString       mMachineId;
+};
+Q_DECLARE_METATYPE (AbstractItem::ItemType);
+
+/* Root Item */
+class RootItem : public AbstractItem
+{
+public:
+
+    RootItem();
+   ~RootItem();
+
+    ULONG childCount (KStorageBus aBus) const;
+
+private:
+
+    ItemType rtti() const;
+    AbstractItem* childByPos (int aIndex);
+    AbstractItem* childById (const QUuid &aId);
+    int posOfChild (AbstractItem *aItem) const;
+    int childCount() const;
+    QString text() const;
+    QString tip() const;
+    QPixmap pixmap (ItemState aState);
+    void addChild (AbstractItem *aItem);
+    void delChild (AbstractItem *aItem);
+
+    QList <AbstractItem*> mControllers;
+};
+
+/* Controller Item */
+class ControllerItem : public AbstractItem
+{
+public:
+
+    ControllerItem (AbstractItem *aParent, const QString &aName, KStorageBus aBusType,
+                    KStorageControllerType aControllerType);
+   ~ControllerItem();
+
+    KStorageBus ctrBusType() const;
+    QString ctrName() const;
+    KStorageControllerType ctrType() const;
+    ControllerTypeList ctrTypes() const;
+
+    void setCtrName (const QString &aCtrName);
+    void setCtrType (KStorageControllerType aCtrType);
+
+    SlotsList ctrAllSlots() const;
+    SlotsList ctrUsedSlots() const;
+    DeviceTypeList ctrDeviceTypeList() const;
+    QStringList ctrAllMediumIds (bool aShowDiffs) const;
+    QStringList ctrUsedMediumIds() const;
+
+private:
+
+    ItemType rtti() const;
+    AbstractItem* childByPos (int aIndex);
+    AbstractItem* childById (const QUuid &aId);
+    int posOfChild (AbstractItem *aItem) const;
+    int childCount() const;
+    QString text() const;
+    QString tip() const;
+    QPixmap pixmap (ItemState aState);
+    void addChild (AbstractItem *aItem);
+    void delChild (AbstractItem *aItem);
+
+    QString mCtrName;
+    AbstractControllerType *mCtrType;
+    QList <AbstractItem*> mAttachments;
+};
+
+/* Attachment Item */
+class AttachmentItem : public AbstractItem
+{
+public:
+
+    AttachmentItem (AbstractItem *aParent, KDeviceType aDeviceType, bool aVerbose);
+
+    StorageSlot attSlot() const;
+    SlotsList attSlots() const;
+    KDeviceType attDeviceType() const;
+    DeviceTypeList attDeviceTypes() const;
+    QString attMediumId() const;
+    QStringList attMediumIds (bool aFilter = true) const;
+    bool attIsShowDiffs() const;
+    bool attIsHostDrive() const;
+    bool attIsPassthrough() const;
+
+    void setAttSlot (const StorageSlot &aAttSlot);
+    void setAttDevice (KDeviceType aAttDeviceType);
+    void setAttMediumId (const QString &aAttMediumId);
+    void setAttIsShowDiffs (bool aAttIsShowDiffs);
+    void setAttIsPassthrough (bool aPassthrough);
+
+    QString attSize() const;
+    QString attLogicalSize() const;
+    QString attLocation() const;
+    QString attFormat() const;
+    QString attUsage() const;
+
+private:
+
+    void cache();
+
+    ItemType rtti() const;
+    AbstractItem* childByPos (int aIndex);
+    AbstractItem* childById (const QUuid &aId);
+    int posOfChild (AbstractItem *aItem) const;
+    int childCount() const;
+    QString text() const;
+    QString tip() const;
+    QPixmap pixmap (ItemState aState);
+    void addChild (AbstractItem *aItem);
+    void delChild (AbstractItem *aItem);
+
+    KDeviceType mAttDeviceType;
+
+    StorageSlot mAttSlot;
+    QString mAttMediumId;
+    bool mAttIsShowDiffs;
+    bool mAttIsHostDrive;
+    bool mAttIsPassthrough;
+
+    QString mAttName;
+    QString mAttTip;
+    QPixmap mAttPixmap;
+
+    QString mAttSize;
+    QString mAttLogicalSize;
+    QString mAttLocation;
+    QString mAttFormat;
+    QString mAttUsage;
+};
+
+/* Storage Model */
+class StorageModel : public QAbstractItemModel
+{
+    Q_OBJECT;
+
+public:
+
+    enum DataRole
+    {
+        R_ItemId = Qt::UserRole + 1,
+        R_ItemPixmap,
+        R_ItemPixmapRect,
+        R_ItemName,
+        R_ItemNamePoint,
+        R_ItemType,
+        R_IsController,
+        R_IsAttachment,
+
+        R_ToolTipType,
+        R_IsMoreIDEControllersPossible,
+        R_IsMoreSATAControllersPossible,
+        R_IsMoreSCSIControllersPossible,
+        R_IsMoreFloppyControllersPossible,
+        R_IsMoreAttachmentsPossible,
+
+        R_CtrName,
+        R_CtrType,
+        R_CtrTypes,
+        R_CtrDevices,
+        R_CtrBusType,
+
+        R_AttSlot,
+        R_AttSlots,
+        R_AttDevice,
+        R_AttMediumId,
+        R_AttIsShowDiffs,
+        R_AttIsHostDrive,
+        R_AttIsPassthrough,
+        R_AttSize,
+        R_AttLogicalSize,
+        R_AttLocation,
+        R_AttFormat,
+        R_AttUsage,
+
+        R_Margin,
+        R_Spacing,
+        R_IconSize,
+
+        R_HDPixmapEn,
+        R_CDPixmapEn,
+        R_FDPixmapEn,
+
+        R_HDPixmapAddEn,
+        R_HDPixmapAddDis,
+        R_CDPixmapAddEn,
+        R_CDPixmapAddDis,
+        R_FDPixmapAddEn,
+        R_FDPixmapAddDis,
+        R_HDPixmapRect,
+        R_CDPixmapRect,
+        R_FDPixmapRect
+    };
+
+    enum ToolTipType
+    {
+        DefaultToolTip  = 0,
+        ExpanderToolTip = 1,
+        HDAdderToolTip  = 2,
+        CDAdderToolTip  = 3,
+        FDAdderToolTip  = 4
+    };
+
+    StorageModel (QObject *aParent);
+   ~StorageModel();
+
+    int rowCount (const QModelIndex &aParent = QModelIndex()) const;
+    int columnCount (const QModelIndex &aParent = QModelIndex()) const;
+
+    QModelIndex root() const;
+    QModelIndex index (int aRow, int aColumn, const QModelIndex &aParent = QModelIndex()) const;
+    QModelIndex parent (const QModelIndex &aIndex) const;
+
+    QVariant data (const QModelIndex &aIndex, int aRole) const;
+    bool setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole);
+
+    QModelIndex addController (const QString &aCtrName, KStorageBus aBusType, KStorageControllerType aCtrType);
+    void delController (const QUuid &aCtrId);
+
+    QModelIndex addAttachment (const QUuid &aCtrId, KDeviceType aDeviceType, bool aVerbose);
+    void delAttachment (const QUuid &aCtrId, const QUuid &aAttId);
+
+    void setMachineId (const QString &aMachineId);
+
+private:
+
+    Qt::ItemFlags flags (const QModelIndex &aIndex) const;
+
+    AbstractItem *mRootItem;
+
+    QPixmap mPlusPixmapEn;
+    QPixmap mPlusPixmapDis;
+
+    QPixmap mMinusPixmapEn;
+    QPixmap mMinusPixmapDis;
+
+    ToolTipType mToolTipType;
+};
+Q_DECLARE_METATYPE (StorageModel::ToolTipType);
+
+/* Storage Delegate */
+class StorageDelegate : public QItemDelegate
+{
+    Q_OBJECT;
+
+public:
+
+    StorageDelegate (QObject *aParent);
+
+private:
+
+    void paint (QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
+
+    bool mDisableStaticControls;
+};
+
+/**
+ * QWidget class reimplementation.
+ * Used as HD Settings widget.
+ */
+class VBoxVMSettingsHD : public VBoxSettingsPage,
+                         public Ui::VBoxVMSettingsHD
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsHD();
+
+signals:
+
+    void storageChanged();
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setValidator (QIWidgetValidator *aVal);
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    void retranslateUi();
+
+    void showEvent (QShowEvent *aEvent);
+
+private slots:
+
+    void mediumUpdated (const VBoxMedium &aMedium);
+    void mediumRemoved (VBoxDefs::MediumType aType, const QString &aMediumId);
+
+    void addController();
+    void addIDEController();
+    void addSATAController();
+    void addSCSIController();
+    void addFloppyController();
+    void delController();
+
+    void addAttachment();
+    void addHDAttachment();
+    void addCDAttachment();
+    void addFDAttachment();
+    void delAttachment();
+
+    void getInformation();
+    void setInformation();
+
+    void onVmmInvoked();
+
+    void updateActionsState();
+
+    void onRowInserted (const QModelIndex &aParent, int aIndex);
+    void onRowRemoved();
+
+    void onCurrentItemChanged();
+
+    void onContextMenuRequested (const QPoint &aPosition);
+
+    void onDrawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex);
+
+    void onMouseMoved (QMouseEvent *aEvent);
+    void onMouseClicked (QMouseEvent *aEvent);
+
+private:
+
+    void addControllerWrapper (const QString &aName, KStorageBus aBus, KStorageControllerType aType);
+    void addAttachmentWrapper (KDeviceType aDevice);
+
+    QString getWithNewHDWizard();
+    QString getWithMediaManager (VBoxDefs::MediumType aMediumType);
+
+    void updateAdditionalObjects (KDeviceType aType);
+
+    QString generateUniqueName (const QString &aTemplate) const;
+
+    uint32_t deviceCount (KDeviceType aType) const;
+
+    CMachine mMachine;
+    QIWidgetValidator *mValidator;
+
+    StorageModel *mStorageModel;
+
+    QAction *mAddCtrAction;
+    QAction *mAddIDECtrAction;
+    QAction *mAddSATACtrAction;
+    QAction *mAddSCSICtrAction;
+    QAction *mAddFloppyCtrAction;
+    QAction *mDelCtrAction;
+    QAction *mAddAttAction;
+    QAction *mAddHDAttAction;
+    QAction *mAddCDAttAction;
+    QAction *mAddFDAttAction;
+    QAction *mDelAttAction;
+
+    bool mIsLoadingInProgress;
+    bool mIsPolished;
+    bool mDisableStaticControls;
+};
+
+#endif // __VBoxVMSettingsHD_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetwork.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetwork.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetwork.h	(revision 25213)
@@ -0,0 +1,123 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsNetwork class declaration
+ */
+
+/*
+ * 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 __VBoxVMSettingsNetwork_h__
+#define __VBoxVMSettingsNetwork_h__
+
+/* VBox Includes */
+#include "COMDefs.h"
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsNetwork.gen.h"
+
+/* VBox Forwardes */
+class VBoxVMSettingsNetworkPage;
+
+class VBoxVMSettingsNetwork : public QIWithRetranslateUI <QWidget>,
+                              public Ui::VBoxVMSettingsNetwork
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsNetwork (VBoxVMSettingsNetworkPage *aParent, bool aDisableStaticControls = false);
+
+    void getFromAdapter (const CNetworkAdapter &aAdapter);
+    void putBackToAdapter();
+
+    void setValidator (QIWidgetValidator *aValidator);
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    QWidget* setOrderAfter (QWidget *aAfter);
+
+    QString pageTitle() const;
+    KNetworkAttachmentType attachmentType() const;
+    QString alternativeName (int aType = -1) const;
+
+protected:
+
+    void showEvent (QShowEvent *aEvent);
+
+    void retranslateUi();
+
+private slots:
+
+    void updateAttachmentAlternative();
+    void updateAlternativeName();
+    void toggleAdvanced();
+    void generateMac();
+
+private:
+
+    void populateComboboxes();
+
+    VBoxVMSettingsNetworkPage *mParent;
+    CNetworkAdapter mAdapter;
+    QIWidgetValidator *mValidator;
+
+    QString mBrgName;
+    QString mIntName;
+    QString mHoiName;
+
+    bool mPolished;
+    bool mDisableStaticControls;
+};
+
+class VBoxVMSettingsNetworkPage : public VBoxSettingsPage
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsNetworkPage (bool aDisableStaticControls = false);
+
+    QStringList brgList (bool aRefresh = false);
+    QStringList intList (bool aRefresh = false);
+    QStringList hoiList (bool aRefresh = false);
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setValidator (QIWidgetValidator *aValidator);
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    void retranslateUi();
+
+private slots:
+
+    void updatePages();
+
+private:
+
+    QIWidgetValidator *mValidator;
+    QTabWidget *mTwAdapters;
+
+    QStringList mBrgList;
+    QStringList mIntList;
+    QStringList mHoiList;
+
+    bool mDisableStaticControls;
+};
+
+#endif // __VBoxVMSettingsNetwork_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsParallel.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsParallel.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsParallel.h	(revision 25213)
@@ -0,0 +1,89 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsParallel 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 __VBoxVMSettingsParallel_h__
+#define __VBoxVMSettingsParallel_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsParallel.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsParallel : public QIWithRetranslateUI<QWidget>,
+                               public Ui::VBoxVMSettingsParallel
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsParallel();
+
+    void getFromPort (const CParallelPort &aPort);
+    void putBackToPort();
+
+    void setValidator (QIWidgetValidator *aVal);
+
+    QWidget* setOrderAfter (QWidget *aAfter);
+
+    QString pageTitle() const;
+    bool isUserDefined();
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void mGbParallelToggled (bool aOn);
+    void mCbNumberActivated (const QString &aText);
+
+private:
+
+    QIWidgetValidator *mValidator;
+    CParallelPort mPort;
+};
+
+class VBoxVMSettingsParallelPage : public VBoxSettingsPage
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsParallelPage();
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setValidator (QIWidgetValidator *aVal);
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    void retranslateUi();
+
+private:
+
+    QIWidgetValidator *mValidator;
+    QTabWidget *mTabWidget;
+};
+
+#endif // __VBoxVMSettingsParallel_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSF.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSF.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSF.h	(revision 25213)
@@ -0,0 +1,108 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsSF 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 __VBoxVMSettingsSF_h__
+#define __VBoxVMSettingsSF_h__
+
+/* Local includes */
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsSF.gen.h"
+
+/* Local forwards */
+class SFTreeViewItem;
+
+enum SFDialogType
+{
+    WrongType   = 0x00,
+    GlobalType  = 0x01,
+    MachineType = 0x02,
+    ConsoleType = 0x04
+};
+typedef QPair <QString, SFDialogType> SFolderName;
+typedef QList <SFolderName> SFoldersNameList;
+
+class VBoxVMSettingsSF : public VBoxSettingsPage, public Ui::VBoxVMSettingsSF
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsSF (int aType = WrongType, QWidget *aParent = 0);
+
+    void getFromGlobal();
+    void getFromMachine (const CMachine &aMachine);
+    void getFromConsole (const CConsole &aConsole);
+
+    void putBackToGlobal();
+    void putBackToMachine();
+    void putBackToConsole();
+
+    int dialogType() const;
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+
+private slots:
+
+    void addTriggered();
+    void edtTriggered();
+    void delTriggered();
+
+    void processCurrentChanged (QTreeWidgetItem *aCurrentItem);
+    void processDoubleClick (QTreeWidgetItem *aItem);
+    void showContextMenu (const QPoint &aPos);
+
+    void adjustList();
+    void adjustFields();
+
+private:
+
+    void showEvent (QShowEvent *aEvent);
+
+    void createSharedFolder (const QString &aName, const QString &aPath, bool aWritable, SFDialogType aType);
+    void removeSharedFolder (const QString &aName, const QString &aPath, SFDialogType aType);
+
+    void getFrom (const CSharedFolderVector &aVec, SFTreeViewItem *aItem);
+    void putBackTo (CSharedFolderVector &aVec, SFTreeViewItem *aItem);
+
+    SFTreeViewItem* searchRoot (bool aIsPermanent, SFDialogType aType = WrongType);
+    bool isEditable (const QString &aKey);
+    SFoldersNameList usedList (bool aIncludeSelected);
+
+    int       mDialogType;
+    QAction  *mNewAction;
+    QAction  *mEdtAction;
+    QAction  *mDelAction;
+    bool      mIsListViewChanged;
+    CMachine  mMachine;
+    CConsole  mConsole;
+    QString   mTrFull;
+    QString   mTrReadOnly;
+};
+
+#endif // __VBoxVMSettingsSF_h__
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSFDetails.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSFDetails.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSFDetails.h	(revision 25213)
@@ -0,0 +1,79 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsSFDetails class declaration
+ */
+
+/*
+ * 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 __VBoxVMSettingsSFDetails_h__
+#define __VBoxVMSettingsSFDetails_h__
+
+#include "VBoxVMSettingsSFDetails.gen.h"
+#include "QIDialog.h"
+#include "QIWithRetranslateUI.h"
+#include "VBoxVMSettingsSF.h"
+
+class VBoxVMSettingsSFDetails : public QIWithRetranslateUI2<QIDialog>,
+                                public Ui::VBoxVMSettingsSFDetails
+{
+    Q_OBJECT;
+
+public:
+
+    enum DialogType
+    {
+        AddType,
+        EditType
+    };
+
+    VBoxVMSettingsSFDetails (DialogType aType,
+                             bool aEnableSelector, /* for "permanent" checkbox */
+                             const SFoldersNameList &aUsedNames,
+                             QWidget *aParent = NULL);
+
+    void setPath (const QString &aPath);
+    QString path() const;
+
+    void setName (const QString &aName);
+    QString name() const;
+
+    void setWriteable (bool aWriteable);
+    bool isWriteable() const;
+
+    void setPermanent (bool aPermanent);
+    bool isPermanent() const;
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void onSelectPath();
+    void validate();
+
+private:
+
+    /* Private member vars */
+    DialogType       mType;
+    bool             mUsePermanent;
+    SFoldersNameList mUsedNames;
+};
+
+#endif // __VBoxVMSettingsSFDetails_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSerial.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSerial.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSerial.h	(revision 25213)
@@ -0,0 +1,90 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsSerial 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 __VBoxVMSettingsSerial_h__
+#define __VBoxVMSettingsSerial_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsSerial.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsSerial : public QIWithRetranslateUI<QWidget>,
+                             public Ui::VBoxVMSettingsSerial
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsSerial();
+
+    void getFromPort (const CSerialPort &aPort);
+    void putBackToPort();
+
+    void setValidator (QIWidgetValidator *aVal);
+
+    QWidget* setOrderAfter (QWidget *aAfter);
+
+    QString pageTitle() const;
+    bool isUserDefined();
+
+protected:
+
+    void retranslateUi();
+
+private slots:
+
+    void mGbSerialToggled (bool aOn);
+    void mCbNumberActivated (const QString &aText);
+    void mCbModeActivated (const QString &aText);
+
+private:
+
+    QIWidgetValidator *mValidator;
+    CSerialPort mPort;
+};
+
+class VBoxVMSettingsSerialPage : public VBoxSettingsPage
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsSerialPage();
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setValidator (QIWidgetValidator *aVal);
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    void retranslateUi();
+
+private:
+
+    QIWidgetValidator *mValidator;
+    QTabWidget *mTabWidget;
+};
+
+#endif // __VBoxVMSettingsSerial_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSystem.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSystem.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsSystem.h	(revision 25213)
@@ -0,0 +1,85 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsSystem 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 __VBoxVMSettingsSystem_h__
+#define __VBoxVMSettingsSystem_h__
+
+#include "COMDefs.h"
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsSystem.gen.h"
+
+class VBoxVMSettingsSystem : public VBoxSettingsPage,
+                             public Ui::VBoxVMSettingsSystem
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsSystem();
+
+    bool isHWVirtExEnabled() const;
+    int cpuCount() const;
+
+signals:
+
+    void tableChanged();
+
+protected:
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setValidator (QIWidgetValidator *aVal);
+    bool revalidate (QString &aWarning, QString &aTitle);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+
+private slots:
+
+    void valueChangedRAM (int aVal);
+    void textChangedRAM (const QString &aText);
+
+    void moveBootItemUp();
+    void moveBootItemDown();
+    void onCurrentBootItemChanged (QTreeWidgetItem *aItem,
+                                   QTreeWidgetItem *aPrev = 0);
+
+    void valueChangedCPU (int aVal);
+    void textChangedCPU (const QString &aText);
+
+private:
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+    void adjustBootOrderTWSize();
+
+    CMachine mMachine;
+    QIWidgetValidator *mValidator;
+
+    uint mMinGuestCPU;
+    uint mMaxGuestCPU;
+};
+
+#endif // __VBoxVMSettingsSystem_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsUSB.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsUSB.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsUSB.h	(revision 25213)
@@ -0,0 +1,109 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsUSB 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 __VBoxVMSettingsUSB_h__
+#define __VBoxVMSettingsUSB_h__
+
+#include "VBoxSettingsPage.h"
+#include "VBoxVMSettingsUSB.gen.h"
+#include "COMDefs.h"
+
+class VBoxUSBMenu;
+
+class VBoxVMSettingsUSB : public VBoxSettingsPage,
+                          public Ui::VBoxVMSettingsUSB
+{
+    Q_OBJECT;
+
+public:
+
+    enum FilterType
+    {
+        WrongType = 0,
+        HostType = 1,
+        MachineType = 2
+    };
+
+    enum RemoteMode 
+    {
+        ModeAny = 0,
+        ModeOn,
+        ModeOff
+    };
+
+    VBoxVMSettingsUSB (FilterType aType);
+
+protected:
+
+    void getFrom (const CSystemProperties &aProps,
+                  const VBoxGlobalSettings &aGs);
+    void putBackTo (CSystemProperties &aProps,
+                    VBoxGlobalSettings &aGs);
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+    void setValidator (QIWidgetValidator *aVal);
+
+    void setOrderAfter (QWidget *aWidget);
+
+    void retranslateUi();
+
+private slots:
+
+    void usbAdapterToggled (bool aOn);
+    void currentChanged (QTreeWidgetItem *aItem = 0,
+                         QTreeWidgetItem *aPrev = 0);
+
+    void newClicked();
+    void addClicked();
+    void edtClicked();
+    void addConfirmed (QAction *aAction);
+    void delClicked();
+    void mupClicked();
+    void mdnClicked();
+    void showContextMenu (const QPoint &aPos);
+    void markSettingsChanged();
+
+private:
+
+    void addUSBFilter (const CUSBDeviceFilter &aFilter, bool isNew);
+
+    CMachine mMachine;
+    QIWidgetValidator *mValidator;
+    FilterType mType;
+    QAction *mNewAction;
+    QAction *mAddAction;
+    QAction *mEdtAction;
+    QAction *mDelAction;
+    QAction *mMupAction;
+    QAction *mMdnAction;
+    QMenu *mMenu;
+    VBoxUSBMenu *mUSBDevicesMenu;
+    bool mUSBFilterListModified;
+    QList<CUSBDeviceFilter> mFilters;
+
+    QString mUSBFilterName;
+};
+
+#endif // __VBoxVMSettingsUSB_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsUSBFilterDetails.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsUSBFilterDetails.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsUSBFilterDetails.h	(revision 25213)
@@ -0,0 +1,51 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsUSBFilterDetails class declaration
+ */
+
+/*
+ * 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 __VBoxVMSettingsUSBFilterDetails_h__
+#define __VBoxVMSettingsUSBFilterDetails_h__
+
+#include "VBoxVMSettingsUSBFilterDetails.gen.h"
+#include "QIWithRetranslateUI.h"
+#include "QIDialog.h"
+#include "VBoxVMSettingsUSB.h"
+
+class VBoxVMSettingsUSBFilterDetails : public QIWithRetranslateUI2<QIDialog>,
+                                       public Ui::VBoxVMSettingsUSBFilterDetails
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsUSBFilterDetails (VBoxVMSettingsUSB::FilterType aType, QWidget *aParent = NULL);
+
+protected:
+
+    void retranslateUi();
+
+private:
+
+    /* Private member vars */
+    VBoxVMSettingsUSB::FilterType mType;
+};
+
+#endif /* __VBoxVMSettingsUSBFilterDetails_h__ */
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxWarningPane.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxWarningPane.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxWarningPane.h	(revision 25213)
@@ -0,0 +1,48 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxWarningPane 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 __VBoxWarningPane_h__
+#define __VBoxWarningPane_h__
+
+/* Global includes */
+#include <QWidget>
+#include <QLabel>
+
+class VBoxWarningPane: public QWidget
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxWarningPane(QWidget *pParent = 0);
+
+    void setWarningPixmap(const QPixmap &imgPixmap);
+    void setWarningText(const QString &strText);
+
+private:
+
+    QLabel m_icon;
+    QLabel m_label;
+};
+
+#endif // __VBoxWarningPane_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxX11Helper.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxX11Helper.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxX11Helper.h	(revision 25213)
@@ -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/include/XKeyboard.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/XKeyboard.h	(revision 25213)
+++ trunk/src/VBox/Frontends/VirtualBox/include/XKeyboard.h	(revision 25213)
@@ -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__
