Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsAudio.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsAudio.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsAudio.h	(revision 9654)
@@ -0,0 +1,52 @@
+/** @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 "VBoxVMSettingsAudio.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsAudio : public QWidget, public Ui::VBoxVMSettingsAudio
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsAudio (QWidget *aParent);
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage);
+    static void putBackToMachine();
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+private:
+
+    static VBoxVMSettingsAudio *mSettings;
+
+    CMachine mMachine;
+};
+
+#endif // __VBoxVMSettingsAudio_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsCD.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsCD.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsCD.h	(revision 9654)
@@ -0,0 +1,74 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsCD 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 __VBoxVMSettingsCD_h__
+#define __VBoxVMSettingsCD_h__
+
+#include "VBoxVMSettingsCD.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsDlg;
+class QIWidgetValidator;
+
+class VBoxVMSettingsCD : public QWidget, 
+                         public Ui::VBoxVMSettingsCD
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsCD (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
+                      const QString &aPath);
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+    static void putBackToMachine();
+    static bool revalidate (QString &aWarning);
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+    bool validate (QString &aWarning);
+
+signals:
+
+    void cdChanged();
+
+private slots:
+
+    void onMediaChanged();
+    void showImageManager();
+
+private:
+
+    static VBoxVMSettingsCD *mSettings;
+
+    CMachine mMachine;
+    QIWidgetValidator *mValidator;
+    QVector<CHostDVDDrive> mHostCDs;
+    QUuid mUuidIsoCD;
+    QRadioButton *mLastSelected;
+};
+
+#endif // __VBoxVMSettingsCD_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsDlg.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsDlg.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsDlg.h	(revision 9654)
@@ -0,0 +1,108 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsDlg 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 __VBoxVMSettingsDlg_h__
+#define __VBoxVMSettingsDlg_h__
+
+#include "VBoxVMSettingsDlg.gen.h"
+#include "COMDefs.h"
+
+class QIWidgetValidator;
+class VBoxMediaComboBox;
+class QTimer;
+class QWidgetStack;
+
+/**
+ *  QObject live pointer class to make alive link of some pointer to
+ *  some object. It will be nulled in case of object in destroyed.
+ */
+class QLivePointer : public QObject
+{
+    Q_OBJECT;
+
+public:
+
+    static void link (QWidget *aParent, QWidget **aPointer);
+    static void kill();
+
+protected:
+
+    QLivePointer() {}
+   ~QLivePointer();
+
+private:
+
+    void setPointer (QWidget **aPointer);
+
+    static QLivePointer *mThis;
+
+    QWidget **mPointer;
+};
+
+class VBoxVMSettingsDlg : public QDialog, 
+                          public Ui::VBoxVMSettingsDlg
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsDlg (QWidget *aParent, const QString &aCategory,
+                                         const QString &aControl);
+
+    void getFromMachine (const CMachine &aMachine);
+    COMResult putBackToMachine();
+
+private slots:
+
+    void enableOk (const QIWidgetValidator*);
+    void revalidate (QIWidgetValidator *aWval);
+    void onMediaEnumerationDone();
+    void settingsGroupChanged (QTreeWidgetItem *aItem, QTreeWidgetItem *aPrev);
+    void updateWhatsThis (bool gotFocus = false);
+    void resetFirstRunFlag();
+
+private:
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+    void showEvent (QShowEvent *aEvent);
+
+    QString pagePath (QWidget *aPage);
+    void setWarning (const QString &aWarning);
+    void updateMediaShortcuts();
+
+    /* Common */
+    CMachine mMachine;
+    QString  mWarnString;
+
+    /* Flags */
+    bool mPolished;
+    bool mAllowResetFirstRunFlag;
+    bool mResetFirstRunFlag;
+    bool mValid;
+
+    /* WhatsThis Stuff */
+    QTimer  *mWhatsThisTimer;
+    QWidget *mWhatsThisCandidate;
+};
+
+#endif // __VBoxVMSettingsDlg_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsFD.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsFD.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsFD.h	(revision 9654)
@@ -0,0 +1,74 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsFD 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 __VBoxVMSettingsFD_h__
+#define __VBoxVMSettingsFD_h__
+
+#include "VBoxVMSettingsFD.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsDlg;
+class QIWidgetValidator;
+
+class VBoxVMSettingsFD : public QWidget, 
+                         public Ui::VBoxVMSettingsFD
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsFD (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
+                      const QString &aPath);
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+    static void putBackToMachine();
+    static bool revalidate (QString &aWarning);
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+    bool validate (QString &aWarning);
+
+signals:
+
+    void fdChanged();
+
+private slots:
+
+    void onMediaChanged();
+    void showImageManager();
+
+private:
+
+    static VBoxVMSettingsFD *mSettings;
+
+    CMachine mMachine;
+    QIWidgetValidator *mValidator;
+    QVector<CHostFloppyDrive> mHostFDs;
+    QUuid mUuidIsoFD;
+    QRadioButton *mLastSelected;
+};
+
+#endif // __VBoxVMSettingsFD_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsGeneral.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsGeneral.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsGeneral.h	(revision 9654)
@@ -0,0 +1,82 @@
+/** @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 "VBoxVMSettingsGeneral.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsDlg;
+class QIWidgetValidator;
+
+class VBoxVMSettingsGeneral : public QWidget, 
+                              public Ui::VBoxVMSettingsGeneral
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsGeneral (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
+                           const QString &aPath);
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+    static void putBackToMachine();
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+signals:
+
+    void tableChanged();
+
+private slots:
+
+    void valueChangedRAM (int aVal);
+    void textChangedRAM (const QString &aText);
+
+    void valueChangedVRAM (int aVal);
+    void textChangedVRAM (const QString &aText);
+
+    void moveBootItemUp();
+    void moveBootItemDown();
+    void onCurrentBootItemChanged (QTreeWidgetItem *aItem,
+                                   QTreeWidgetItem *aPrev = 0);
+
+    void selectSnapshotFolder();
+    void resetSnapshotFolder();
+
+private:
+
+    static VBoxVMSettingsGeneral *mSettings;
+
+    bool eventFilter (QObject *aObject, QEvent *aEvent);
+
+    QIWidgetValidator *mValidator;
+    CMachine mMachine;
+};
+
+#endif // __VBoxVMSettingsGeneral_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsHD.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsHD.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsHD.h	(revision 9654)
@@ -0,0 +1,333 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsHD 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 __VBoxVMSettingsHD_h__
+#define __VBoxVMSettingsHD_h__
+
+#include "VBoxVMSettingsHD.gen.h"
+#include "COMDefs.h"
+#include "VBoxMediaComboBox.h"
+
+/* Qt includes */
+#include <QComboBox>
+
+class VBoxVMSettingsDlg;
+class QIWidgetValidator;
+
+/** Register type to store slot data */
+class HDSltValue
+{
+public:
+    HDSltValue()
+        : name (QString::null), bus (KStorageBus_Null)
+        , channel (0), device (0) {}
+    HDSltValue (const QString &aName, KStorageBus aBus,
+                LONG aChannel, LONG aDevice)
+        : name (aName), bus (aBus)
+        , channel (aChannel), device (aDevice) {}
+    HDSltValue (const HDSltValue &aOther)
+        : name (aOther.name), bus (aOther.bus)
+        , channel (aOther.channel), device (aOther.device) {}
+
+    HDSltValue& operator= (const HDSltValue &aOther)
+    {
+        name    = aOther.name;
+        bus     = aOther.bus;
+        channel = aOther.channel;
+        device  = aOther.device;
+        return *this;
+    }
+
+    bool operator== (const HDSltValue &aOther)
+    {
+        return name    == aOther.name &&
+               bus     == aOther.bus &&
+               channel == aOther.channel &&
+               device  == aOther.device;
+    }
+
+    bool operator!= (const HDSltValue &aOther)
+    {
+        return ! (*this == aOther);
+    }
+
+    QString     name;
+    KStorageBus bus;
+    LONG        channel;
+    LONG        device;
+};
+Q_DECLARE_METATYPE (HDSltValue);
+
+/** Register type to store vdi data */
+class HDVdiValue
+{
+public:
+    HDVdiValue()
+        : name (QString::null), id (QUuid()) {}
+    HDVdiValue (const QString &aName, const QUuid &aId)
+        : name (aName), id (aId) {}
+    HDVdiValue (const HDVdiValue &aOther)
+        : name (aOther.name), id (aOther.id) {}
+
+    HDVdiValue& operator= (const HDVdiValue &aOther)
+    {
+        name = aOther.name;
+        id   = aOther.id;
+        return *this;
+    }
+
+    bool operator== (const HDVdiValue &aOther)
+    {
+        return name == aOther.name &&
+               id   == aOther.id;
+    }
+
+    bool operator!= (const HDVdiValue &aOther)
+    {
+        return ! (*this == aOther);
+    }
+
+    QString name;
+    QUuid   id;
+};
+Q_DECLARE_METATYPE (HDVdiValue);
+
+/** Declare type to store both slt&vdi data */
+class HDValue
+{
+public:
+    HDValue (HDSltValue aSlt, HDVdiValue aVdi)
+        : slt (aSlt), vdi (aVdi) {}
+
+    /* Define sorting rules */
+    bool operator< (const HDValue &aOther) const
+    {
+        return slt.bus <  aOther.slt.bus ||
+               slt.bus == aOther.slt.bus && slt.channel <  aOther.slt.channel ||
+               slt.bus == aOther.slt.bus && slt.channel == aOther.slt.channel && slt.device <  aOther.slt.device;
+    }
+
+    HDSltValue slt;
+    HDVdiValue vdi;
+};
+
+/** QAbstractTableModel class reimplementation to feat slot/vdi
+  * selection mechanism */
+class HDItemsModel : public QAbstractTableModel
+{
+    Q_OBJECT;
+
+public:
+
+    HDItemsModel (QObject *aParent, int aSltId, int aVdiId)
+        : QAbstractTableModel (aParent)
+        , mSltId (aSltId), mVdiId (aVdiId) {}
+
+    int columnCount (const QModelIndex &aParent = QModelIndex()) const
+        { NOREF (aParent); return 2; }
+    int rowCount (const QModelIndex &aParent = QModelIndex()) const
+        { NOREF (aParent); return mSltList.count() + 1; }
+    Qt::ItemFlags flags (const QModelIndex &aIndex) const;
+
+    QVariant data (const QModelIndex &aIndex,
+                   int aRole = Qt::DisplayRole) const;
+    bool setData (const QModelIndex &aIndex,
+                  const QVariant &aValue,
+                  int aRole = Qt::EditRole);
+    QVariant headerData (int aSection,
+                         Qt::Orientation aOrientation,
+                         int aRole = Qt::DisplayRole) const;
+
+    void addItem (const HDSltValue &aSlt = HDSltValue(),
+                  const HDVdiValue &aVdi = HDVdiValue());
+    void delItem (int aIndex);
+
+    const QList<HDSltValue>& slotsList() { return mSltList; }
+    const QList<HDVdiValue>& vdiList() { return mVdiList; }
+    QList<HDValue> fullList (bool aSorted = true);
+
+    void removeSata();
+
+private:
+
+    QList<HDSltValue> mSltList;
+    QList<HDVdiValue> mVdiList;
+    int mSltId;
+    int mVdiId;
+};
+
+/** QComboBox class reimplementation used as editor for hd slot */
+class HDSltEditor : public QComboBox
+{
+    Q_OBJECT;
+    Q_PROPERTY (QVariant slot READ slot WRITE setSlot USER true);
+
+public:
+
+    HDSltEditor (QWidget *aParent);
+
+    QVariant slot() const;
+    void setSlot (QVariant aSlot);
+
+signals:
+
+    void readyToCommit (QWidget *aThis);
+
+private slots:
+
+    void onActivate();
+
+private:
+
+    void populate (const HDSltValue &aIncluding);
+
+    QList<HDSltValue> mList;
+};
+
+/** VBoxMediaComboBox class reimplementation used as editor for hd vdi */
+class HDVdiEditor : public VBoxMediaComboBox
+{
+    Q_OBJECT;
+    Q_PROPERTY (QVariant vdi READ vdi WRITE setVdi USER true);
+
+public:
+
+    HDVdiEditor (QWidget *aParent);
+   ~HDVdiEditor();
+
+    QVariant vdi() const;
+    void setVdi (QVariant aVdi);
+
+    void tryToChooseUniqueVdi (QList<HDVdiValue> &aList);
+
+    static HDVdiEditor* activeEditor();
+
+signals:
+
+    void readyToCommit (QWidget *aThis);
+
+private slots:
+
+    void onActivate();
+
+private:
+
+    static HDVdiEditor *mInstance;
+};
+
+/** Singleton QObject class reimplementation to use for making
+  * selected IDE & SATA slots unique */
+class HDSlotUniquizer : public QObject
+{
+    Q_OBJECT;
+
+public:
+
+    static HDSlotUniquizer* instance (QWidget *aParent = 0,
+                                      HDItemsModel *aWatched = 0);
+
+    QList<HDSltValue> list (const HDSltValue &aIncluding, bool aFilter = true);
+
+    int sataCount() { return mSataCount; }
+    void setSataCount (int aSataCount)
+    {
+        mSataCount = aSataCount;
+        makeSATAList();
+    }
+
+protected:
+
+    HDSlotUniquizer (QWidget *aParent, HDItemsModel *aWatched);
+    virtual ~HDSlotUniquizer();
+
+private:
+
+    void makeIDEList();
+    void makeSATAList();
+
+    static HDSlotUniquizer *mInstance;
+
+    int mSataCount;
+    HDItemsModel *mModel;
+    QList<HDSltValue> mIDEList;
+    QList<HDSltValue> mSATAList;
+};
+
+/** QWidget class reimplementation used as hard disks settings */
+class VBoxVMSettingsHD : public QWidget, 
+                         public Ui::VBoxVMSettingsHD
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsHD (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
+                      const QString &aPath);
+   ~VBoxVMSettingsHD();
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+    static void putBackToMachine();
+    static bool revalidate (QString &aWarning);
+
+    bool eventFilter (QObject *aObj, QEvent *aEvent);
+
+    static CMachine mMachine;
+
+signals:
+
+    void hdChanged();
+
+protected:
+
+    void getFrom();
+    void putBackTo();
+    bool validate (QString &aWarning);
+
+private slots:
+
+    void newClicked();
+    void delClicked();
+    void vdmClicked();
+
+    void onCurrentChanged (const QModelIndex &aIndex);
+    void cbSATAToggled (int);
+    void onMediaRemoved (VBoxDefs::DiskType, const QUuid &);
+
+private:
+
+    int maxNameLength() const;
+    void showEvent (QShowEvent *aEvent);
+
+    static VBoxVMSettingsHD *mSettings;
+
+    QIWidgetValidator *mValidator;
+    HDItemsModel *mModel;
+    QAction *mNewAction;
+    QAction *mDelAction;
+    QAction *mVdmAction;
+};
+
+#endif // __VBoxVMSettingsHD_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsNetwork.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsNetwork.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsNetwork.h	(revision 9654)
@@ -0,0 +1,109 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsNetwork 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 __VBoxVMSettingsNetwork_h__
+#define __VBoxVMSettingsNetwork_h__
+
+#include "VBoxVMSettingsNetwork.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsDlg;
+class QIWidgetValidator;
+
+class VBoxVMSettingsNetwork : public QWidget, 
+                              public Ui::VBoxVMSettingsNetwork
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsNetwork();
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+    static void putBackToMachine();
+    static bool revalidate (QString &aWarning, QString &aTitle);
+
+    void loadListNetworks (const QStringList &aList);
+
+    void getFromAdapter (const CNetworkAdapter &aAdapter);
+    void putBackToAdapter();
+
+    void setValidator (QIWidgetValidator *aValidator);
+
+private slots:
+
+    static void updateListNetworks();
+// #ifdef Q_WS_WIN
+//     static void addHostInterface();
+//     static void delHostInterface();
+// #endif
+
+    void adapterToggled (bool aOn);
+    void naTypeChanged (const QString &aString);
+    void genMACClicked();
+#ifdef Q_WS_X11
+    void tapSetupClicked();
+    void tapTerminateClicked();
+#endif
+
+private:
+
+    static void prepareListNetworks();
+// #ifdef Q_WS_WIN
+//     static void prepareListInterfaces();
+// #endif
+
+    /* Widgets */
+    static QTabWidget *mTwAdapters;
+// #ifdef Q_WS_WIN
+//     static QGroupBox *mGbInterfaces;
+//     static QListWidget *mLwInterfaces;
+// #endif
+
+    /* Actions */
+// #ifdef Q_WS_WIN
+//     static QAction *mAddAction;
+//     static QAction *mDelAction;
+// #endif
+
+    /* Flags */
+    static bool mLockNetworkListUpdate;
+
+    /* Lists */
+    static QStringList mListNetworks;
+// #ifdef Q_WS_WIN
+//     static QStringList mListInterface;
+//     static QString mNoInterfaces;
+// #endif
+
+    QIWidgetValidator *mValidator;
+    CNetworkAdapter mAdapter;
+// #ifdef Q_WS_WIN
+//     QString mInterface_win;
+// #endif
+};
+
+#endif // __VBoxVMSettingsNetwork_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsParallel.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsParallel.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsParallel.h	(revision 9654)
@@ -0,0 +1,66 @@
+/** @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 "VBoxVMSettingsParallel.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsDlg;
+
+class VBoxVMSettingsParallel : public QWidget, 
+                               public Ui::VBoxVMSettingsParallel
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsParallel();
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+
+    static void putBackToMachine();
+
+    static bool revalidate (QString &aWarning, QString &aTitle);
+
+private slots:
+
+    void mGbParallelToggled (bool aOn);
+    void mCbNumberActivated (const QString &aText);
+
+private:
+
+    void getFromPort (const CParallelPort &aPort);
+    void putBackToPort();
+    bool isUserDefined();
+
+    static QTabWidget *mTabWidget;
+
+    CParallelPort mPort;
+};
+
+#endif // __VBoxVMSettingsParallel_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSF.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSF.h	(revision 9627)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSF.h	(revision 9654)
@@ -27,4 +27,5 @@
 #include "QIWithRetranslateUI.h"
 
+/* Qt includes */
 #include <QDialog>
 
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSerial.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSerial.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSerial.h	(revision 9654)
@@ -0,0 +1,67 @@
+/** @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 "VBoxVMSettingsSerial.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsDlg;
+
+class VBoxVMSettingsSerial : public QWidget, 
+                             public Ui::VBoxVMSettingsSerial
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsSerial();
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+
+    static void putBackToMachine();
+
+    static bool revalidate (QString &aWarning, QString &aTitle);
+
+private slots:
+
+    void mGbSerialToggled (bool aOn);
+    void mCbNumberActivated (const QString &aText);
+    void mCbModeActivated (const QString &aText);
+
+private:
+
+    void getFromPort (const CSerialPort &aPort);
+    void putBackToPort();
+    bool isUserDefined();
+
+    static QTabWidget *mTabWidget;
+
+    CSerialPort mPort;
+};
+
+#endif // __VBoxVMSettingsSerial_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsUSB.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsUSB.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsUSB.h	(revision 9654)
@@ -0,0 +1,96 @@
+/** @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 "VBoxVMSettingsUSB.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsDlg;
+class QIWidgetValidator;
+class VBoxUSBMenu;
+
+class VBoxVMSettingsUSB : public QWidget, 
+                          public Ui::VBoxVMSettingsUSB
+{
+    Q_OBJECT;
+
+public:
+
+    enum FilterType
+    {
+        WrongType = 0,
+        HostType = 1,
+        MachineType = 2
+    };
+
+    VBoxVMSettingsUSB (QWidget *aParent,
+                       FilterType aType,
+                       VBoxVMSettingsDlg *aDlg,
+                       const QString &aPath);
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+    static void putBackToMachine();
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+private slots:
+
+    void usbAdapterToggled (bool aOn);
+    void currentChanged (QTreeWidgetItem *aItem = 0,
+                         QTreeWidgetItem *aPrev = 0);
+    void setCurrentText (const QString &aText);
+    void newClicked();
+    void addClicked();
+    void addConfirmed (QAction *aAction);
+    void delClicked();
+    void mupClicked();
+    void mdnClicked();
+    void showContextMenu (const QPoint &aPos);
+
+private:
+
+    void addUSBFilter (const CUSBDeviceFilter &aFilter, bool isNew);
+
+    static VBoxVMSettingsUSB *mSettings;
+
+    CMachine mMachine;
+    FilterType mType;
+    QIWidgetValidator *mValidator;
+    QAction *mNewAction;
+    QAction *mAddAction;
+    QAction *mDelAction;
+    QAction *mMupAction;
+    QAction *mMdnAction;
+    QMenu *mMenu;
+    VBoxUSBMenu *mUSBDevicesMenu;
+    bool mUSBFilterListModified;
+    QList<CUSBDeviceFilter> mFilters;
+};
+
+#endif // __VBoxVMSettingsUSB_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsUtils.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsUtils.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsUtils.h	(revision 9654)
@@ -0,0 +1,224 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsUtils 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 __VBoxVMSettingsUtils_h__
+#define __VBoxVMSettingsUtils_h__
+
+/* Qt includes */
+//#include <QDialog>
+//#include <QHBoxLayout>
+//#include <QLineEdit>
+//#include <QPushButton>
+//#include <QLabel>
+#include <QTreeWidget>
+#include <QHeaderView>
+#include <QKeyEvent>
+#include <QTableView>
+
+enum
+{
+    /* mTwSelector column numbers */
+    listView_Category = 0,
+    listView_Id = 1,
+    listView_Link = 2,
+    /* mTwUSBFilters column numbers */
+    lvUSBFilters_Name = 0,
+};
+
+/**
+ *  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 BootItemsTable : public QTreeWidget
+{
+    Q_OBJECT;
+
+public:
+
+    BootItemsTable (QWidget *aParent) : QTreeWidget (aParent)
+    {
+        header()->hide();
+        connect (this, SIGNAL (itemChanged (QTreeWidgetItem *, int)),
+                 this, SLOT (onItemChanged()));
+    }
+
+   ~BootItemsTable() {}
+
+signals:
+
+    void moveItemUp();
+    void moveItemDown();
+    void itemToggled();
+
+private slots:
+
+    void onItemChanged()
+    {
+        emit itemToggled();
+    }
+
+    void keyPressEvent (QKeyEvent *aEvent)
+    {
+        if (aEvent->QInputEvent::modifiers () == Qt::ControlButton)
+        {
+            switch (aEvent->key())
+            {
+                case Qt::Key_Up:
+                    emit moveItemUp();
+                    return;
+                case Qt::Key_Down:
+                    emit moveItemDown();
+                    return;
+                default:
+                    break;
+            }
+        }
+        QTreeWidget::keyPressEvent (aEvent);
+    }
+};
+
+// #ifdef Q_WS_WIN
+// /**
+//  *  QDialog class reimplementation to use for adding network interface.
+//  *  It has one line-edit field for entering network interface's name and
+//  *  common dialog's ok/cancel buttons.
+//  */
+// class VBoxAddNIDialog : public QDialog
+// {
+//     Q_OBJECT
+//
+// public:
+//
+//     VBoxAddNIDialog (QWidget *aParent, const QString &aIfaceName) :
+//         QDialog (aParent),
+//         mLeName (0)
+//     {
+//         setWindowTitle (tr ("Add Host Interface"));
+//         QVBoxLayout *mainLayout = new QVBoxLayout (this);
+//
+//         /* Setup Input layout */
+//         QHBoxLayout *inputLayout = new QHBoxLayout();
+//         QLabel *lbName = new QLabel (tr ("Interface Name"), this);
+//         mLeName = new QLineEdit (aIfaceName, this);
+//         mLeName->setWhatsThis (tr ("Descriptive name of the new "
+//                                    "network interface"));
+//         inputLayout->addWidget (lbName);
+//         inputLayout->addWidget (mLeName);
+//         connect (mLeName, SIGNAL (textChanged (const QString &)),
+//                  this, SLOT (validate()));
+//         mainLayout->addLayout (inputLayout);
+//
+//         /* Setup Button layout */
+//         QHBoxLayout *buttonLayout = new QHBoxLayout();
+//         mBtOk = new QPushButton (tr ("&OK"), this);
+//         QPushButton *btCancel = new QPushButton (tr ("Cancel"), this);
+//         connect (mBtOk, SIGNAL (clicked()), this, SLOT (accept()));
+//         connect (btCancel, SIGNAL (clicked()), this, SLOT (reject()));
+//         buttonLayout->addWidget (mBtOk);
+//         buttonLayout->addStretch();
+//         buttonLayout->addWidget (btCancel);
+//         mainLayout->addLayout (buttonLayout);
+//
+//         /* resize to fit the aIfaceName in one string */
+//         int requiredWidth = mLeName->fontMetrics().width (aIfaceName) +
+//                             inputLayout->spacing() +
+//                             lbName->fontMetrics().width (lbName->text()) +
+//                             lbName->frameWidth() * 2 +
+//                             lbName->lineWidth() * 2 +
+//                             mainLayout->margin() * 2;
+//         resize (requiredWidth, minimumHeight());
+//
+//         /* Validate interface name field */
+//         validate();
+//     }
+//
+//     ~VBoxAddNIDialog() {}
+//
+//     QString getName() { return mLeName->text(); }
+//
+// private slots:
+//
+//     void validate()
+//     {
+//         mBtOk->setEnabled (!mLeName->text().isEmpty());
+//     }
+//
+// private:
+//
+//     void showEvent (QShowEvent *aEvent)
+//     {
+//         setFixedHeight (height());
+//         QDialog::showEvent (aEvent);
+//     }
+//
+//     QPushButton *mBtOk;
+//     QLineEdit   *mLeName;
+// };
+// #endif
+
+class USBListItem : public QTreeWidgetItem
+{
+public:
+
+    enum { USBListItemType = 1002 };
+
+    USBListItem (QTreeWidget *aParent)
+        : QTreeWidgetItem (aParent, QStringList (QString::null), USBListItemType)
+        , mId (-1) {}
+
+    USBListItem (QTreeWidget *aParent, QTreeWidgetItem *aPreceding)
+        : QTreeWidgetItem (aParent, aPreceding, USBListItemType)
+        , mId (-1) {}
+
+    int mId;
+};
+
+/**
+ *  Table-View class reimplementation to extend standard QTableView.
+ */
+class QITableView : public QTableView
+{
+    Q_OBJECT;
+
+public:
+
+    QITableView (QWidget *aParent) : QTableView (aParent) {}
+
+signals:
+
+    void currentChanged (const QModelIndex &aCurrent);
+
+protected:
+
+    void currentChanged (const QModelIndex &aCurrent,
+                         const QModelIndex &aPrevious)
+    {
+        QTableView::currentChanged (aCurrent, aPrevious);
+        emit currentChanged (aCurrent);
+    }
+};
+
+#endif // __VBoxVMSettingsUtils_h__
+
Index: trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsVRDP.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsVRDP.h	(revision 9654)
+++ trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsVRDP.h	(revision 9654)
@@ -0,0 +1,60 @@
+/** @file
+ *
+ * VBox frontends: Qt4 GUI ("VirtualBox"):
+ * VBoxVMSettingsVRDP 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 __VBoxVMSettingsVRDP_h__
+#define __VBoxVMSettingsVRDP_h__
+
+#include "VBoxVMSettingsVRDP.gen.h"
+#include "COMDefs.h"
+
+class VBoxVMSettingsDlg;
+class QIWidgetValidator;
+
+class VBoxVMSettingsVRDP : public QWidget, 
+                           public Ui::VBoxVMSettingsVRDP
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxVMSettingsVRDP (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
+                        const QString &aPath);
+
+    static void getFromMachine (const CMachine &aMachine,
+                                QWidget *aPage,
+                                VBoxVMSettingsDlg *aDlg,
+                                const QString &aPath);
+    static void putBackToMachine();
+
+    void getFrom (const CMachine &aMachine);
+    void putBackTo();
+
+private:
+
+    static VBoxVMSettingsVRDP *mSettings;
+
+    CMachine mMachine;
+    QIWidgetValidator *mValidator;
+};
+
+#endif // __VBoxVMSettingsVRDP_h__
+
