VirtualBox

Changeset 10167 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 3, 2008 5:09:23 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
32709
Message:

Fe/Qt4: New VM&Global settings api based on one default class (+ui).
One interface for both Settings dialog & one interface for settings pages.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
15 deleted
37 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk

    r10160 r10167  
    8787VBOX_PATH_QT4_SHARE      ?= $(VBOX_PATH_QT4)
    8888
    89 VBOX_MODULE_QT4     = QtCore QtGui 
    90 VBOX_DEFS_QT4       = QT_CORE_LIB QT_GUI_LIB 
     89VBOX_MODULE_QT4     = QtCore QtGui
     90VBOX_DEFS_QT4       = QT_CORE_LIB QT_GUI_LIB
    9191
    9292ifeq ($(KBUILD_TARGET),darwin)
     
    449449        include/QIMainDialog.h \
    450450        include/QIHelpButton.h \
     451        include/VBoxUtils.h \
    451452        include/VBoxGlobalSettings.h \
    452453        include/VBoxGlobal.h \
     
    471472        include/VBoxVMLogViewer.h \
    472473        include/VBoxDiskImageManagerDlg.h \
    473         include/VBoxVMSettingsUtils.h \
     474        include/VBoxSettingsUtils.h \
    474475        include/VBoxVMSettingsGeneral.h \
    475476        include/VBoxVMSettingsHD.h \
     
    483484        include/VBoxVMSettingsSF.h \
    484485        include/VBoxVMSettingsVRDP.h \
    485         include/VBoxVMSettingsDlg.h \
    486         include/VBoxGlobalSettingsGeneral.h \
    487         include/VBoxGlobalSettingsInput.h \
    488         include/VBoxGlobalSettingsLanguage.h \
    489         include/VBoxGlobalSettingsDlg.h
     486        include/VBoxGLSettingsGeneral.h \
     487        include/VBoxGLSettingsInput.h \
     488        include/VBoxGLSettingsLanguage.h \
     489        include/VBoxSettingsDialog.h \
     490        include/VBoxSettingsDialogSpecific.h \
     491        include/VBoxSettingsPage.h
    490492
    491493# Sources containing local definitions of classes that use the Q_OBJECT macro
     
    565567        src/VBoxVMSettingsSF.cpp \
    566568        src/VBoxVMSettingsVRDP.cpp \
    567         src/VBoxVMSettingsDlg.cpp \
    568         src/VBoxGlobalSettingsGeneral.cpp \
    569         src/VBoxGlobalSettingsInput.cpp \
    570         src/VBoxGlobalSettingsLanguage.cpp \
    571         src/VBoxGlobalSettingsDlg.cpp
     569        src/VBoxGLSettingsGeneral.cpp \
     570        src/VBoxGLSettingsInput.cpp \
     571        src/VBoxGLSettingsLanguage.cpp \
     572        src/VBoxSettingsDialog.cpp \
     573        src/VBoxSettingsDialogSpecific.cpp
    572574
    573575ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
  • trunk/src/VBox/Frontends/VirtualBox4/VBoxUI.pro

    r10102 r10167  
    2828    ui/VBoxCloseVMDlg.ui \
    2929    ui/VBoxDiskImageManagerDlg.ui \
    30     ui/VBoxGlobalSettingsDlg.ui \
     30    ui/VBoxSettingsDialog.ui \
    3131    ui/VBoxGlobalSettingsGeneral.ui \
    3232    ui/VBoxGlobalSettingsInput.ui \
     
    4343    ui/VBoxVMSettingsAudio.ui \
    4444    ui/VBoxVMSettingsCD.ui \
    45     ui/VBoxVMSettingsDlg.ui \
    4645    ui/VBoxVMSettingsFD.ui \
    4746    ui/VBoxVMSettingsGeneral.ui \
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsUtils.h

    r10148 r10167  
    22 *
    33 * VBox frontends: Qt4 GUI ("VirtualBox"):
    4  * VBoxVMSettingsUtils class declaration
     4 * VBoxSettingsUtils class declaration
    55 */
    66
     
    2121 */
    2222
    23 #ifndef __VBoxVMSettingsUtils_h__
    24 #define __VBoxVMSettingsUtils_h__
     23#ifndef __VBoxSettingsUtils_h__
     24#define __VBoxSettingsUtils_h__
    2525
    2626#include <VBoxGlobal.h>
     
    4141{
    4242    /* mTwSelector column numbers */
    43     listView_Category = 0,
    44     listView_Id = 1,
    45     listView_Link = 2,
     43    treeWidget_Category = 0,
     44    treeWidget_Id = 1,
     45    treeWidget_Link = 2,
     46
    4647    /* mTwUSBFilters column numbers */
    47     lvUSBFilters_Name = 0,
     48    twUSBFilters_Name = 0,
    4849};
    4950
     
    237238        layout->addWidget (&mIcon);
    238239        layout->addWidget (&mLabel);
     240        setVisible (false);
    239241    }
    240242
     
    248250};
    249251
    250 #endif // __VBoxVMSettingsUtils_h__
    251 
     252#endif // __VBoxSettingsUtils_h__
     253
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsAudio.h

    r9751 r10167  
    2424#define __VBoxVMSettingsAudio_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsAudio.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    2929
    30 class VBoxVMSettingsAudio : public QIWithRetranslateUI<QWidget>,
     30class VBoxVMSettingsAudio : public VBoxSettingsPage,
    3131                            public Ui::VBoxVMSettingsAudio
    3232{
     
    3535public:
    3636
    37     VBoxVMSettingsAudio (QWidget *aParent);
     37    VBoxVMSettingsAudio();
    3838
    39     static void getFromMachine (const CMachine &aMachine,
    40                                 QWidget *aPage);
    41     static void putBackToMachine();
     39protected:
    4240
    4341    void getFrom (const CMachine &aMachine);
    4442    void putBackTo();
    4543
    46 protected:
     44    void setOrderAfter (QWidget *aWidget);
    4745
    4846    void retranslateUi();
     
    5250    void prepareComboboxes();
    5351
    54     /* Private member vars */
    55     static VBoxVMSettingsAudio *mSettings;
    56 
    5752    CMachine mMachine;
    5853};
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsCD.h

    r9751 r10167  
    2424#define __VBoxVMSettingsCD_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsCD.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    2929
    30 class VBoxVMSettingsDlg;
    31 class QIWidgetValidator;
    32 
    33 class VBoxVMSettingsCD : public QIWithRetranslateUI<QWidget>,
     30class VBoxVMSettingsCD : public VBoxSettingsPage,
    3431                         public Ui::VBoxVMSettingsCD
    3532{
     
    3835public:
    3936
    40     VBoxVMSettingsCD (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
    41                       const QString &aPath);
    42 
    43     static void getFromMachine (const CMachine &aMachine,
    44                                 QWidget *aPage,
    45                                 VBoxVMSettingsDlg *aDlg,
    46                                 const QString &aPath);
    47     static void putBackToMachine();
    48     static bool revalidate (QString &aWarning);
    49 
    50     void getFrom (const CMachine &aMachine);
    51     void putBackTo();
    52     bool validate (QString &aWarning);
     37    VBoxVMSettingsCD();
    5338
    5439signals:
     
    5843protected:
    5944
     45    void getFrom (const CMachine &aMachine);
     46    void putBackTo();
     47
     48    void setValidator (QIWidgetValidator *aVal);
     49    bool revalidate (QString &aWarning, QString &aTitle);
     50
     51    void setOrderAfter (QWidget *aWidget);
     52
    6053    void retranslateUi();
    6154
    6255private slots:
    6356
    64     void onMediaChanged();
     57    void onGbChange (bool aSwitchedOn);
     58    void onRbChange();
     59    void onCbChange();
    6560    void showImageManager();
    6661
    6762private:
    68 
    69     static VBoxVMSettingsCD *mSettings;
    7063
    7164    CMachine mMachine;
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsFD.h

    r9751 r10167  
    2424#define __VBoxVMSettingsFD_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsFD.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    2929
    30 class VBoxVMSettingsDlg;
    31 class QIWidgetValidator;
    32 
    33 class VBoxVMSettingsFD : public QIWithRetranslateUI<QWidget>,
     30class VBoxVMSettingsFD : public VBoxSettingsPage,
    3431                         public Ui::VBoxVMSettingsFD
    3532{
     
    3835public:
    3936
    40     VBoxVMSettingsFD (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
    41                       const QString &aPath);
    42 
    43     static void getFromMachine (const CMachine &aMachine,
    44                                 QWidget *aPage,
    45                                 VBoxVMSettingsDlg *aDlg,
    46                                 const QString &aPath);
    47     static void putBackToMachine();
    48     static bool revalidate (QString &aWarning);
    49 
    50     void getFrom (const CMachine &aMachine);
    51     void putBackTo();
    52     bool validate (QString &aWarning);
     37    VBoxVMSettingsFD();
    5338
    5439signals:
     
    5843protected:
    5944
     45    void getFrom (const CMachine &aMachine);
     46    void putBackTo();
     47
     48    void setValidator (QIWidgetValidator *aVal);
     49    bool revalidate (QString &aWarning, QString &aTitle);
     50
     51    void setOrderAfter (QWidget *aWidget);
     52
    6053    void retranslateUi();
    6154
    6255private slots:
    6356
    64     void onMediaChanged();
     57    void onGbChange (bool aSwitchedOn);
     58    void onRbChange();
     59    void onCbChange();
    6560    void showImageManager();
    6661
    6762private:
    68 
    69     static VBoxVMSettingsFD *mSettings;
    7063
    7164    CMachine mMachine;
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsGeneral.h

    r9751 r10167  
    2424#define __VBoxVMSettingsGeneral_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsGeneral.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    2929
    30 class VBoxVMSettingsDlg;
    31 class QIWidgetValidator;
    32 
    33 class VBoxVMSettingsGeneral : public QIWithRetranslateUI<QWidget>,
     30class VBoxVMSettingsGeneral : public VBoxSettingsPage,
    3431                              public Ui::VBoxVMSettingsGeneral
    3532{
     
    3835public:
    3936
    40     VBoxVMSettingsGeneral (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
    41                            const QString &aPath);
    42 
    43     static void getFromMachine (const CMachine &aMachine,
    44                                 QWidget *aPage,
    45                                 VBoxVMSettingsDlg *aDlg,
    46                                 const QString &aPath);
    47     static void putBackToMachine();
    48 
    49     void getFrom (const CMachine &aMachine);
    50     void putBackTo();
     37    VBoxVMSettingsGeneral();
    5138
    5239signals:
     
    5542
    5643protected:
     44
     45    void getFrom (const CMachine &aMachine);
     46    void putBackTo();
     47
     48    void setOrderAfter (QWidget *aWidget);
    5749
    5850    void retranslateUi();
     
    7870    void adjustBootOrderTWSize ();
    7971
    80     static VBoxVMSettingsGeneral *mSettings;
     72    bool eventFilter (QObject *aObject, QEvent *aEvent);
     73    void showEvent (QShowEvent *aEvent);
    8174
    82     bool eventFilter (QObject *aObject, QEvent *aEvent);
    83 
    84     QIWidgetValidator *mValidator;
    8575    CMachine mMachine;
    8676};
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsHD.h

    r9751 r10167  
    2424#define __VBoxVMSettingsHD_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsHD.gen.h"
    2728#include "COMDefs.h"
    28 #include "QIWithRetranslateUI.h"
    2929#include "VBoxMediaComboBox.h"
    3030
    31 /* Qt includes */
    3231#include <QComboBox>
    33 
    34 class VBoxVMSettingsDlg;
    35 class QIWidgetValidator;
    3632
    3733/** Register type to store slot data */
     
    245241
    246242    static HDSlotUniquizer* instance (QWidget *aParent = 0,
    247                                       HDItemsModel *aWatched = 0);
     243                                      HDItemsModel *aWatched = 0,
     244                                      const CMachine &aMachine = CMachine());
    248245
    249246    QList<HDSltValue> list (const HDSltValue &aIncluding, bool aFilter = true);
     
    256253    }
    257254
     255    const CMachine& machine() const { return mMachine; }
     256
    258257protected:
    259258
    260     HDSlotUniquizer (QWidget *aParent, HDItemsModel *aWatched);
     259    HDSlotUniquizer (QWidget *aParent, HDItemsModel *aWatched,
     260                     const CMachine &aMachine);
    261261    virtual ~HDSlotUniquizer();
    262262
     
    272272    QList<HDSltValue> mIDEList;
    273273    QList<HDSltValue> mSATAList;
     274    const CMachine &mMachine;
    274275};
    275276
    276277/** QWidget class reimplementation used as hard disks settings */
    277 class VBoxVMSettingsHD : public QIWithRetranslateUI<QWidget>,
     278class VBoxVMSettingsHD : public VBoxSettingsPage,
    278279                         public Ui::VBoxVMSettingsHD
    279280{
     
    282283public:
    283284
    284     VBoxVMSettingsHD (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
    285                       const QString &aPath);
    286    ~VBoxVMSettingsHD();
    287 
    288     static void getFromMachine (const CMachine &aMachine,
    289                                 QWidget *aPage,
    290                                 VBoxVMSettingsDlg *aDlg,
    291                                 const QString &aPath);
    292     static void putBackToMachine();
    293     static bool revalidate (QString &aWarning);
    294 
    295     bool eventFilter (QObject *aObj, QEvent *aEvent);
    296 
    297     static CMachine mMachine;
     285    VBoxVMSettingsHD();
    298286
    299287signals:
     
    303291protected:
    304292
     293    void getFrom (const CMachine &aMachine);
     294    void putBackTo();
     295
     296    void setValidator (QIWidgetValidator *aVal);
     297    bool revalidate (QString &aWarning, QString &aTitle);
     298
     299    void setOrderAfter (QWidget *aWidget);
     300
    305301    void retranslateUi();
    306 
    307     void getFrom();
    308     void putBackTo();
    309     bool validate (QString &aWarning);
    310302
    311303private slots:
     
    321313private:
    322314
     315    bool eventFilter (QObject *aObj, QEvent *aEvent);
     316
    323317    int maxNameLength() const;
    324318    void showEvent (QShowEvent *aEvent);
    325319
    326     static VBoxVMSettingsHD *mSettings;
    327 
     320    CMachine mMachine;
    328321    QIWidgetValidator *mValidator;
    329322    HDItemsModel *mModel;
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsNetwork.h

    r9951 r10167  
    2424#define __VBoxVMSettingsNetwork_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsNetwork.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    2929
    30 class QIWidgetValidator;
    31 class VBoxVMSettingsDlg;
    3230#ifdef Q_WS_WIN
    3331class QTreeWidget;
     
    5452
    5553    void setValidator (QIWidgetValidator *aValidator);
     54
     55    QWidget* setOrderAfter (QWidget *aAfter);
     56
    5657    void setNetworksList (const QStringList &aList);
    5758
     
    133134 * QWidget sub-class which represents network settings page itself.
    134135 */
    135 class VBoxVMSettingsNetworkPage : public QIWithRetranslateUI<QWidget>
     136class VBoxVMSettingsNetworkPage : public VBoxSettingsPage
    136137{
    137138    Q_OBJECT;
     
    139140public:
    140141
    141     static void getFromMachine (const CMachine &aMachine,
    142                                 QWidget *aPage,
    143                                 VBoxVMSettingsDlg *aDlg,
    144                                 const QString &aPath);
    145     static void putBackToMachine();
    146     static bool revalidate (QString &aWarning, QString &aTitle);
     142    VBoxVMSettingsNetworkPage();
    147143
    148 protected slots:
     144protected:
     145
     146    void getFrom (const CMachine &aMachine);
     147    void putBackTo();
     148
     149    void setValidator (QIWidgetValidator *aVal);
     150    bool revalidate (QString &aWarning, QString &aTitle);
     151
     152    void retranslateUi();
     153
     154private slots:
    149155
    150156    void updateNetworksList();
     
    154160#endif
    155161
    156 protected:
    157 
    158     VBoxVMSettingsNetworkPage (QWidget *aParent);
    159 
    160     void getFrom (const CMachine &aMachine,
    161                   VBoxVMSettingsDlg *aDlg,
    162                   const QString &aPath);
    163     void putBackTo();
    164     bool validate (QString &aWarning, QString &aTitle);
    165 
    166     void retranslateUi();
     162private:
    167163
    168164    void populateNetworksList();
    169 
    170     static VBoxVMSettingsNetworkPage *mSettings;
    171165
    172166    /* Widgets */
     
    175169    VBoxNIList *mNIList;
    176170#endif
     171
     172    /* Widget Validator*/
     173    QIWidgetValidator *mValidator;
    177174
    178175    /* Lists */
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsParallel.h

    r9751 r10167  
    2424#define __VBoxVMSettingsParallel_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsParallel.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    29 
    30 class VBoxVMSettingsDlg;
    3129
    3230class VBoxVMSettingsParallel : public QIWithRetranslateUI<QWidget>,
     
    3735public:
    3836
    39     VBoxVMSettingsParallel (QWidget *aParent = NULL);
     37    VBoxVMSettingsParallel();
    4038
    41     static void getFromMachine (const CMachine &aMachine,
    42                                 QWidget *aPage,
    43                                 VBoxVMSettingsDlg *aDlg,
    44                                 const QString &aPath);
     39    void getFromPort (const CParallelPort &aPort);
     40    void putBackToPort();
    4541
    46     static void putBackToMachine();
     42    void setValidator (QIWidgetValidator *aVal);
    4743
    48     static bool revalidate (QString &aWarning, QString &aTitle);
     44    QWidget* setOrderAfter (QWidget *aAfter);
     45
     46    QString pageTitle() const;
     47    bool isUserDefined();
    4948
    5049protected:
     
    5958private:
    6059
    61     void getFromPort (const CParallelPort &aPort);
    62     void putBackToPort();
    63     bool isUserDefined();
     60    QIWidgetValidator *mValidator;
     61    CParallelPort mPort;
     62};
    6463
    65     QString pageTitle() const;
     64class VBoxVMSettingsParallelPage : public VBoxSettingsPage
     65{
     66    Q_OBJECT;
    6667
    67     static QTabWidget *mTabWidget;
     68public:
    6869
    69     CParallelPort mPort;
     70    VBoxVMSettingsParallelPage();
     71
     72protected:
     73
     74    void getFrom (const CMachine &aMachine);
     75    void putBackTo();
     76
     77    void setValidator (QIWidgetValidator *aVal);
     78    bool revalidate (QString &aWarning, QString &aTitle);
     79
     80    void retranslateUi();
     81
     82private:
     83
     84    QIWidgetValidator *mValidator;
     85    QTabWidget *mTabWidget;
    7086};
    7187
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSF.h

    r9729 r10167  
    2424#define __VBoxVMSettingsSF_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsSF.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828
    29 /* Qt includes */
    3029#include <QDialog>
    3130
    32 class VBoxVMSettingsDlg;
    3331class SFTreeViewItem;
    3432class QIDialogButtonBox;
     
    4846typedef QList<SFolderName> SFoldersNameList;
    4947
    50 class VBoxVMSettingsSF : public QIWithRetranslateUI<QWidget>,
     48class VBoxVMSettingsSF : public VBoxSettingsPage,
    5149                         public Ui::VBoxVMSettingsSF
    5250{
     
    5553public:
    5654
    57     VBoxVMSettingsSF (QWidget *aParent = 0, int aType = WrongType);
    58 
    59     static void getFromMachineEx (const CMachine &aMachine,
    60                                   QWidget *aParent,
    61                                   VBoxVMSettingsDlg *aDlg);
    62     static void putBackToMachineEx();
    63 
    64     int dialogType() { return mDialogType; }
     55    VBoxVMSettingsSF (int aType = WrongType, QWidget *aParent = 0);
    6556
    6657    void getFromGlobal();
     
    7263    void putBackToConsole();
    7364
     65    int dialogType() { return mDialogType; }
     66
    7467protected:
     68
     69    void getFrom (const CMachine &aMachine);
     70    void putBackTo();
     71
     72    void setOrderAfter (QWidget *aWidget);
    7573
    7674    void retranslateUi();
     
    108106    SFoldersNameList usedList (bool aIncludeSelected);
    109107
    110     static VBoxVMSettingsSF *mSettings;
    111 
    112108    int       mDialogType;
    113109    QMenu    *mMenu;
     
    138134                     bool aEnableSelector /* for "permanent" checkbox */,
    139135                     const SFoldersNameList &aUsedNames);
    140     ~VBoxAddSFDialog() {}
     136   ~VBoxAddSFDialog() {}
    141137
    142138    QString getPath();
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSerial.h

    r9751 r10167  
    2424#define __VBoxVMSettingsSerial_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsSerial.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    29 
    30 class VBoxVMSettingsDlg;
    3129
    3230class VBoxVMSettingsSerial : public QIWithRetranslateUI<QWidget>,
     
    3533    Q_OBJECT;
    3634
     35public:
    3736
    38 public:
    39     VBoxVMSettingsSerial (QWidget* aParent = NULL);
     37    VBoxVMSettingsSerial();
    4038
    41     static void getFromMachine (const CMachine &aMachine,
    42                                 QWidget *aPage,
    43                                 VBoxVMSettingsDlg *aDlg,
    44                                 const QString &aPath);
     39    void getFromPort (const CSerialPort &aPort);
     40    void putBackToPort();
    4541
    46     static void putBackToMachine();
     42    void setValidator (QIWidgetValidator *aVal);
    4743
    48     static bool revalidate (QString &aWarning, QString &aTitle);
     44    QWidget* setOrderAfter (QWidget *aAfter);
     45
     46    QString pageTitle() const;
     47    bool isUserDefined();
    4948
    5049protected:
     
    6059private:
    6160
    62     QString pageTitle() const;
     61    QIWidgetValidator *mValidator;
     62    CSerialPort mPort;
     63};
    6364
    64     void getFromPort (const CSerialPort &aPort);
    65     void putBackToPort();
    66     bool isUserDefined();
     65class VBoxVMSettingsSerialPage : public VBoxSettingsPage
     66{
     67    Q_OBJECT;
    6768
    68     static QTabWidget *mTabWidget;
     69public:
    6970
    70     CSerialPort mPort;
     71    VBoxVMSettingsSerialPage();
     72
     73protected:
     74
     75    void getFrom (const CMachine &aMachine);
     76    void putBackTo();
     77
     78    void setValidator (QIWidgetValidator *aVal);
     79    bool revalidate (QString &aWarning, QString &aTitle);
     80
     81    void retranslateUi();
     82
     83private:
     84
     85    QIWidgetValidator *mValidator;
     86    QTabWidget *mTabWidget;
    7187};
    7288
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsUSB.h

    r9889 r10167  
    2424#define __VBoxVMSettingsUSB_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsUSB.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    2929
    30 class VBoxGlobalSettingsDlg;
    31 class VBoxVMSettingsDlg;
    32 class QIWidgetValidator;
    3330class VBoxUSBMenu;
    3431
    35 class VBoxVMSettingsUSB : public QIWithRetranslateUI<QWidget>,
     32class VBoxVMSettingsUSB : public VBoxSettingsPage,
    3633                          public Ui::VBoxVMSettingsUSB
    3734{
     
    4744    };
    4845
    49     static void getFrom (QWidget *aPage,
    50                          VBoxGlobalSettingsDlg *aDlg,
    51                          const QString &aPath);
    52     static void getFrom (const CMachine &aMachine,
    53                          QWidget *aPage,
    54                          VBoxVMSettingsDlg *aDlg,
    55                          const QString &aPath);
    56     static void putBackTo();
     46    VBoxVMSettingsUSB (FilterType aType);
    5747
    5848protected:
    5949
    60     VBoxVMSettingsUSB (QWidget *aParent,
    61                        FilterType aType,
    62                        QWidget *aDlg,
    63                        const QString &aPath);
     50    void getFrom (const CSystemProperties &aProps,
     51                  const VBoxGlobalSettings &aGs);
     52    void putBackTo (CSystemProperties &aProps,
     53                    VBoxGlobalSettings &aGs);
    6454
    65    ~VBoxVMSettingsUSB();
     55    void getFrom (const CMachine &aMachine);
     56    void putBackTo();
    6657
    67     void getFromHost();
    68     void putBackToHost();
     58    void setValidator (QIWidgetValidator *aVal);
    6959
    70     void getFromMachine (const CMachine &aMachine);
    71     void putBackToMachine();
     60    void setOrderAfter (QWidget *aWidget);
    7261
    7362    void retranslateUi();
    74 
    75     FilterType mType;
    7663
    7764private slots:
     
    9380    void addUSBFilter (const CUSBDeviceFilter &aFilter, bool isNew);
    9481
    95     static VBoxVMSettingsUSB *mSettings;
    96 
    9782    CMachine mMachine;
    9883    QIWidgetValidator *mValidator;
     84    FilterType mType;
    9985    QAction *mNewAction;
    10086    QAction *mAddAction;
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsVRDP.h

    r9751 r10167  
    2424#define __VBoxVMSettingsVRDP_h__
    2525
     26#include "VBoxSettingsPage.h"
    2627#include "VBoxVMSettingsVRDP.gen.h"
    27 #include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
    2929
    30 class VBoxVMSettingsDlg;
    31 class QIWidgetValidator;
    32 
    33 class VBoxVMSettingsVRDP : public QIWithRetranslateUI<QWidget>,
     30class VBoxVMSettingsVRDP : public VBoxSettingsPage,
    3431                           public Ui::VBoxVMSettingsVRDP
    3532{
     
    3835public:
    3936
    40     VBoxVMSettingsVRDP (QWidget *aParent, VBoxVMSettingsDlg *aDlg,
    41                         const QString &aPath);
     37    VBoxVMSettingsVRDP();
    4238
    43     static void getFromMachine (const CMachine &aMachine,
    44                                 QWidget *aPage,
    45                                 VBoxVMSettingsDlg *aDlg,
    46                                 const QString &aPath);
    47     static void putBackToMachine();
     39protected:
    4840
    4941    void getFrom (const CMachine &aMachine);
    5042    void putBackTo();
    5143
    52 protected:
     44    void setValidator (QIWidgetValidator *aVal);
     45
     46    void setOrderAfter (QWidget *aWidget);
    5347
    5448    void retranslateUi();
    5549
    5650private:
    57 
    58     static VBoxVMSettingsVRDP *mSettings;
    5951
    6052    CMachine mMachine;
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r10166 r10167  
    35183518
    35193519    /* Setup settings layout */
    3520     mSettings = new VBoxVMSettingsSF (this, MachineType | ConsoleType);
     3520    mSettings = new VBoxVMSettingsSF (MachineType | ConsoleType, this);
    35213521    mSettings->getFromConsole (aSession.GetConsole());
    35223522    mSettings->getFromMachine (aSession.GetMachine());
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r10149 r10167  
    15341534        CSystemProperties props = vboxGlobal().virtualBox().GetSystemProperties();
    15351535        QString virt = m.GetHWVirtExEnabled() == KTSBool_True ?
    1536                        tr ("Enabled", "details report (VT-x/AMD-V)") :
    1537                        m.GetHWVirtExEnabled() == KTSBool_False ?
    1538                        tr ("Disabled", "details report (VT-x/AMD-V)") :
    1539                        props.GetHWVirtExEnabled() ?
    15401536                       tr ("Enabled", "details report (VT-x/AMD-V)") :
    15411537                       tr ("Disabled", "details report (VT-x/AMD-V)");
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r10146 r10167  
    3030#include "VBoxNewVMWzd.h"
    3131#include "VBoxDiskImageManagerDlg.h"
    32 #include "VBoxVMSettingsDlg.h"
    33 #include "VBoxGlobalSettingsDlg.h"
     32#include "VBoxSettingsDialogSpecific.h"
    3433#include "VBoxVMLogViewer.h"
    3534#include "VBoxGlobal.h"
     
    742741    CSystemProperties props = vboxGlobal().virtualBox().GetSystemProperties();
    743742
    744     VBoxGlobalSettingsDlg dlg (this);
    745     dlg.getFrom (props, settings);
    746 
    747     if (dlg.exec() == QDialog::Accepted)
    748     {
    749         VBoxGlobalSettings s = settings;
    750         dlg.putBackTo (props, s);
    751         if (!props.isOk())
    752             vboxProblem().cannotSetSystemProperties (props);
    753         else
    754         {
    755             // see whether the user has changed something or not
    756             if (!(settings == s))
    757                 vboxGlobal().setSettings (s);
    758         }
    759     }
     743    VBoxSettingsDialog *dlg = new VBoxGLSettingsDlg (this);
     744    dlg->getFrom();
     745
     746    if (dlg->exec() == QDialog::Accepted)
     747        dlg->putBackTo();
     748
     749    delete dlg;
    760750}
    761751
     
    785775/**
    786776 *  Opens the VM settings dialog.
    787  *
    788  *  @param  aCategory   Category to select in the settings dialog. See
    789  *                      VBoxVMSettingsDlg::setup().
    790  *  @param  aControl    Widget name to select in the settings dialog. See
    791  *                      VBoxVMSettingsDlg::setup().
    792777 */
    793778void VBoxSelectorWnd::vmSettings (const QString &aCategory, const QString &aControl)
     
    813798    AssertMsgReturn (!m.isNull(), ("Machine must not be null"), (void) 0);
    814799
    815     VBoxVMSettingsDlg dlg (this, aCategory, aControl);
    816     dlg.getFromMachine (m);
    817 
    818     if (dlg.exec() == QDialog::Accepted)
     800    VBoxSettingsDialog *dlg = new VBoxVMSettingsDlg (this, m, aCategory, aControl);
     801    dlg->getFrom();
     802
     803    if (dlg->exec() == QDialog::Accepted)
    819804    {
    820805        QString oldName = m.GetName();
    821         COMResult res = dlg.putBackToMachine();
    822         if (res.isOk())
    823         {
    824             m.SaveSettings();
    825             if (m.isOk())
    826             {
    827                 if (oldName.compare (m.GetName()))
    828                     mVMModel->sort();
    829             }
    830             else
    831             {
    832                 vboxProblem().cannotSaveMachineSettings (m);
    833             }
     806        dlg->putBackTo();
     807
     808        m.SaveSettings();
     809        if (m.isOk())
     810        {
     811            if (oldName.compare (m.GetName()))
     812                mVMModel->sort();
    834813        }
    835814        else
    836         {
    837             vboxProblem().cannotApplyMachineSettings (m, res);
    838         }
    839     }
     815            vboxProblem().cannotSaveMachineSettings (m);
     816
     817        /* To check use the result in future
     818         * vboxProblem().cannotApplyMachineSettings (m, res); */
     819    }
     820
     821    delete dlg;
    840822
    841823    mVMListView->setFocus();
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsAudio.cpp

    r9751 r10167  
    2424#include "VBoxGlobal.h"
    2525
    26 VBoxVMSettingsAudio* VBoxVMSettingsAudio::mSettings = 0;
    27 
    28 VBoxVMSettingsAudio::VBoxVMSettingsAudio (QWidget *aParent)
    29     : QIWithRetranslateUI<QWidget> (aParent)
     26VBoxVMSettingsAudio::VBoxVMSettingsAudio()
    3027{
    3128    /* Apply UI decorations */
     
    3330    /* Applying language settings */
    3431    retranslateUi();
    35 }
    36 
    37 void VBoxVMSettingsAudio::getFromMachine (const CMachine &aMachine,
    38                                           QWidget *aPage)
    39 {
    40     mSettings = new VBoxVMSettingsAudio (aPage);
    41     QVBoxLayout *layout = new QVBoxLayout (aPage);
    42     layout->setContentsMargins (0, 0, 0, 0);
    43     layout->addWidget (mSettings);
    44     mSettings->getFrom (aMachine);
    45 }
    46 
    47 void VBoxVMSettingsAudio::putBackToMachine()
    48 {
    49     mSettings->putBackTo();
    5032}
    5133
     
    7153}
    7254
     55void VBoxVMSettingsAudio::setOrderAfter (QWidget *aWidget)
     56{
     57    setTabOrder (aWidget, mGbAudio);
     58    setTabOrder (mGbAudio, mCbAudioDriver);
     59    setTabOrder (mCbAudioDriver, mCbAudioController);
     60}
    7361
    7462void VBoxVMSettingsAudio::retranslateUi()
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsCD.cpp

    r9751 r10167  
    2222
    2323#include "VBoxVMSettingsCD.h"
    24 #include "VBoxVMSettingsDlg.h"
    2524#include "VBoxGlobal.h"
    26 #include "VBoxProblemReporter.h"
    2725#include "QIWidgetValidator.h"
    2826#include "VBoxDiskImageManagerDlg.h"
    2927
    30 /* Qt includes */
    3128#include <QFileInfo>
    3229
    33 VBoxVMSettingsCD* VBoxVMSettingsCD::mSettings = 0;
    34 
    35 VBoxVMSettingsCD::VBoxVMSettingsCD (QWidget *aParent,
    36                                     VBoxVMSettingsDlg *aDlg,
    37                                     const QString &aPath)
    38     : QIWithRetranslateUI<QWidget> (aParent)
     30VBoxVMSettingsCD::VBoxVMSettingsCD()
     31    : mValidator (0)
    3932    , mLastSelected (0)
    4033{
     
    4235    Ui::VBoxVMSettingsCD::setupUi (this);
    4336
    44     /* Setup validation */
    45     mValidator = new QIWidgetValidator (aPath, aParent, this);
    46     connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator*)),
    47              aDlg, SLOT (enableOk (const QIWidgetValidator*)));
    48     connect (mValidator, SIGNAL (isValidRequested (QIWidgetValidator*)),
    49              aDlg, SLOT (revalidate (QIWidgetValidator*)));
    50 
    5137    /* Setup connections */
    52     connect (mGbCD, SIGNAL (toggled (bool)), this, SLOT (onMediaChanged()));
    53     connect (mCbIsoCD, SIGNAL (activated (int)), this, SLOT (onMediaChanged()));
     38    connect (mGbCD, SIGNAL (toggled (bool)), this, SLOT (onGbChange (bool)));
     39    connect (mRbHostCD, SIGNAL (toggled (bool)), this, SLOT (onRbChange()));
     40    connect (mRbIsoCD, SIGNAL (toggled (bool)), this, SLOT (onRbChange()));
     41    connect (mCbIsoCD, SIGNAL (activated (int)), this, SLOT (onCbChange()));
    5442    connect (mTbIsoCD, SIGNAL (clicked()), this, SLOT (showImageManager()));
    55     connect (mRbHostCD, SIGNAL (toggled (bool)), mValidator, SLOT (revalidate()));
    56     connect (mRbIsoCD, SIGNAL (toggled (bool)), mValidator, SLOT (revalidate()));
    5743
    5844    /* Setup iconsets */
     
    6248    /* Setup dialog */
    6349    mCbIsoCD->setType (VBoxDefs::CD);
    64 
    6550    mLastSelected = mRbHostCD;
     51
    6652    /* Applying language settings */
    6753    retranslateUi();
    68 }
    69 
    70 void VBoxVMSettingsCD::getFromMachine (const CMachine &aMachine,
    71                                        QWidget *aPage,
    72                                        VBoxVMSettingsDlg *aDlg,
    73                                        const QString &aPath)
    74 {
    75     mSettings = new VBoxVMSettingsCD (aPage, aDlg, aPath);
    76     QVBoxLayout *layout = new QVBoxLayout (aPage);
    77     layout->setContentsMargins (0, 0, 0, 0);
    78     layout->addWidget (mSettings);
    79     connect (mSettings, SIGNAL (cdChanged()), aDlg, SLOT (resetFirstRunFlag()));
    80     mSettings->getFrom (aMachine);
    81 }
    82 
    83 void VBoxVMSettingsCD::putBackToMachine()
    84 {
    85     mSettings->putBackTo();
    86 }
    87 
    88 bool VBoxVMSettingsCD::revalidate (QString &aWarning)
    89 {
    90     return mSettings->validate (aWarning);
    9154}
    9255
     
    167130        mCbIsoCD->refresh();
    168131
    169     mValidator->revalidate();
     132    if (mValidator)
     133        mValidator->revalidate();
    170134}
    171135
     
    194158}
    195159
    196 bool VBoxVMSettingsCD::validate (QString &aWarning)
     160void VBoxVMSettingsCD::setValidator (QIWidgetValidator *aVal)
     161{
     162    mValidator = aVal;
     163}
     164
     165bool VBoxVMSettingsCD::revalidate (QString &aWarning, QString &)
     166{
     167    if (mRbHostCD->isChecked() && mCbHostCD->currentText().isNull())
     168        aWarning = tr ("Host CD/DVD drive is not selected");
     169    else if (mRbIsoCD->isChecked() && mUuidIsoCD.isNull())
     170        aWarning = tr ("CD/DVD image file is not selected");
     171
     172    return aWarning.isNull();
     173}
     174
     175void VBoxVMSettingsCD::setOrderAfter (QWidget *aWidget)
     176{
     177    setTabOrder (aWidget, mGbCD);
     178    setTabOrder (mGbCD, mRbHostCD);
     179    setTabOrder (mRbHostCD, mCbHostCD);
     180    setTabOrder (mCbHostCD, mCbPassthrough);
     181    setTabOrder (mCbPassthrough, mRbIsoCD);
     182    setTabOrder (mRbIsoCD, mCbIsoCD);
     183    setTabOrder (mCbIsoCD, mTbIsoCD);
     184}
     185
     186void VBoxVMSettingsCD::retranslateUi()
     187{
     188    /* Translate uic generated strings */
     189    Ui::VBoxVMSettingsCD::retranslateUi (this);
     190}
     191
     192void VBoxVMSettingsCD::onGbChange (bool aSwitchedOn)
    197193{
    198194    /* Toggle auto-exclusiveness on/off to let the buttons be
    199195     * unchecked both in case of group-box is not checked and
    200196     * exclusively checked in case of group-box is checked. */
    201     mRbHostCD->setAutoExclusive (mGbCD->isChecked());
    202     mRbIsoCD->setAutoExclusive (mGbCD->isChecked());
     197    mRbHostCD->setAutoExclusive (aSwitchedOn);
     198    mRbIsoCD->setAutoExclusive (aSwitchedOn);
    203199
    204200    /* Toggle both buttons off when the group box unchecked. */
    205     if (!mGbCD->isChecked())
     201    if (!aSwitchedOn)
    206202    {
    207203        mLastSelected = mRbIsoCD->isChecked() ? mRbIsoCD : mRbHostCD;
     
    222218    }
    223219
     220    onCbChange();
     221}
     222
     223void VBoxVMSettingsCD::onRbChange()
     224{
    224225    /* Check the 'host' group. */
    225226    mCbHostCD->setEnabled (mRbHostCD->isChecked());
     
    230231    mTbIsoCD->setEnabled (mRbIsoCD->isChecked());
    231232
    232     /* Compose the error string. */
    233     if (mRbHostCD->isChecked() && mCbHostCD->currentText().isNull())
    234         aWarning = tr ("Host CD/DVD drive is not selected");
    235     else if (mRbIsoCD->isChecked() && mUuidIsoCD.isNull())
    236         aWarning = tr ("CD/DVD image file is not selected");
    237 
    238     return aWarning.isNull();
    239 }
    240 
    241 
    242 void VBoxVMSettingsCD::retranslateUi()
    243 {
    244     /* Translate uic generated strings */
    245     Ui::VBoxVMSettingsCD::retranslateUi (this);
    246 }
    247 
    248 
    249 void VBoxVMSettingsCD::onMediaChanged()
     233    onCbChange();
     234}
     235
     236void VBoxVMSettingsCD::onCbChange()
    250237{
    251238    mUuidIsoCD = mGbCD->isChecked() ? mCbIsoCD->getId() : QUuid();
    252     mValidator->revalidate();
    253239    emit cdChanged();
     240    if (mValidator)
     241        mValidator->revalidate();
    254242}
    255243
     
    272260
    273261    mCbIsoCD->setFocus();
    274     mValidator->revalidate();
    275 }
    276 
     262    if (mValidator)
     263        mValidator->revalidate();
     264}
     265
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsFD.cpp

    r9751 r10167  
    2222
    2323#include "VBoxVMSettingsFD.h"
    24 #include "VBoxVMSettingsDlg.h"
    2524#include "VBoxGlobal.h"
    2625#include "VBoxProblemReporter.h"
     
    2827#include "VBoxDiskImageManagerDlg.h"
    2928
    30 /* Qt includes */
    3129#include <QFileInfo>
    3230
    33 VBoxVMSettingsFD* VBoxVMSettingsFD::mSettings = 0;
    34 
    35 VBoxVMSettingsFD::VBoxVMSettingsFD (QWidget *aParent,
    36                                     VBoxVMSettingsDlg *aDlg,
    37                                     const QString &aPath)
    38     : QIWithRetranslateUI<QWidget> (aParent)
     31VBoxVMSettingsFD::VBoxVMSettingsFD()
     32    : mValidator (0)
    3933    , mLastSelected (0)
    4034{
     
    4236    Ui::VBoxVMSettingsFD::setupUi (this);
    4337
    44     /* Setup validation */
    45     mValidator = new QIWidgetValidator (aPath, aParent, this);
    46     connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator*)),
    47              aDlg, SLOT (enableOk (const QIWidgetValidator*)));
    48     connect (mValidator, SIGNAL (isValidRequested (QIWidgetValidator*)),
    49              aDlg, SLOT (revalidate (QIWidgetValidator*)));
    50 
    5138    /* Setup connections */
    52     connect (mGbFD, SIGNAL (toggled (bool)), this, SLOT (onMediaChanged()));
    53     connect (mCbIsoFD, SIGNAL (activated (int)), this, SLOT (onMediaChanged()));
     39    connect (mGbFD, SIGNAL (toggled (bool)), this, SLOT (onGbChange (bool)));
     40    connect (mRbHostFD, SIGNAL (toggled (bool)), this, SLOT (onRbChange()));
     41    connect (mRbIsoFD, SIGNAL (toggled (bool)), this, SLOT (onRbChange()));
     42    connect (mCbIsoFD, SIGNAL (activated (int)), this, SLOT (onCbChange()));
    5443    connect (mTbIsoFD, SIGNAL (clicked()), this, SLOT (showImageManager()));
    55     connect (mRbHostFD, SIGNAL (toggled (bool)), mValidator, SLOT (revalidate()));
    56     connect (mRbIsoFD, SIGNAL (toggled (bool)), mValidator, SLOT (revalidate()));
    5744
    5845    /* Setup iconsets */
     
    6653    /* Applying language settings */
    6754    retranslateUi();
    68 }
    69 
    70 void VBoxVMSettingsFD::getFromMachine (const CMachine &aMachine,
    71                                        QWidget *aPage,
    72                                        VBoxVMSettingsDlg *aDlg,
    73                                        const QString &aPath)
    74 {
    75     mSettings = new VBoxVMSettingsFD (aPage, aDlg, aPath);
    76     QVBoxLayout *layout = new QVBoxLayout (aPage);
    77     layout->setContentsMargins (0, 0, 0, 0);
    78     layout->addWidget (mSettings);
    79     connect (mSettings, SIGNAL (fdChanged()), aDlg, SLOT (resetFirstRunFlag()));
    80     mSettings->getFrom (aMachine);
    81 }
    82 
    83 void VBoxVMSettingsFD::putBackToMachine()
    84 {
    85     mSettings->putBackTo();
    86 }
    87 
    88 bool VBoxVMSettingsFD::revalidate (QString &aWarning)
    89 {
    90     return mSettings->validate (aWarning);
    9155}
    9256
     
    167131        mCbIsoFD->refresh();
    168132
    169     mValidator->revalidate();
     133    if (mValidator)
     134        mValidator->revalidate();
    170135}
    171136
     
    191156}
    192157
    193 bool VBoxVMSettingsFD::validate (QString &aWarning)
     158void VBoxVMSettingsFD::setValidator (QIWidgetValidator *aVal)
     159{
     160    mValidator = aVal;
     161}
     162
     163bool VBoxVMSettingsFD::revalidate (QString &aWarning, QString &)
     164{
     165    if (mRbHostFD->isChecked() && mCbHostFD->currentText().isNull())
     166        aWarning = tr ("Host floppy drive is not selected");
     167    else if (mRbIsoFD->isChecked() && mUuidIsoFD.isNull())
     168        aWarning = tr ("Floppy image file is not selected");
     169
     170    return aWarning.isNull();
     171}
     172
     173void VBoxVMSettingsFD::setOrderAfter (QWidget *aWidget)
     174{
     175    setTabOrder (aWidget, mGbFD);
     176    setTabOrder (mGbFD, mRbHostFD);
     177    setTabOrder (mRbHostFD, mCbHostFD);
     178    setTabOrder (mCbHostFD, mRbIsoFD);
     179    setTabOrder (mRbIsoFD, mCbIsoFD);
     180    setTabOrder (mCbIsoFD, mTbIsoFD);
     181}
     182
     183void VBoxVMSettingsFD::retranslateUi()
     184{
     185    /* Translate uic generated strings */
     186    Ui::VBoxVMSettingsFD::retranslateUi (this);
     187}
     188
     189void VBoxVMSettingsFD::onGbChange (bool aSwitchedOn)
    194190{
    195191    /* Toggle auto-exclusiveness on/off to let the buttons be unchecked both in
    196192     * case of group-box is not checked and exclusively checked in case of
    197193     * group-box is checked. */
    198     mRbHostFD->setAutoExclusive (mGbFD->isChecked());
    199     mRbIsoFD->setAutoExclusive (mGbFD->isChecked());
     194    mRbHostFD->setAutoExclusive (aSwitchedOn);
     195    mRbIsoFD->setAutoExclusive (aSwitchedOn);
    200196
    201197    /* Toggle both buttons off when the group box unchecked. */
    202     if (!mGbFD->isChecked())
     198    if (!aSwitchedOn)
    203199    {
    204200        mLastSelected = mRbIsoFD->isChecked() ? mRbIsoFD : mRbHostFD;
     
    219215    }
    220216
     217    onCbChange();
     218}
     219
     220void VBoxVMSettingsFD::onRbChange()
     221{
    221222    /* Check the 'host' group. */
    222223    mCbHostFD->setEnabled (mRbHostFD->isChecked());
     
    226227    mTbIsoFD->setEnabled (mRbIsoFD->isChecked());
    227228
    228     /* Compose the error string. */
    229     if (mRbHostFD->isChecked() && mCbHostFD->currentText().isNull())
    230         aWarning = tr ("Host floppy drive is not selected");
    231     else if (mRbIsoFD->isChecked() && mUuidIsoFD.isNull())
    232         aWarning = tr ("Floppy image file is not selected");
    233 
    234     return aWarning.isNull();
    235 }
    236 
    237 
    238 void VBoxVMSettingsFD::retranslateUi()
    239 {
    240     /* Translate uic generated strings */
    241     Ui::VBoxVMSettingsFD::retranslateUi (this);
    242 }
    243 
    244 
    245 void VBoxVMSettingsFD::onMediaChanged()
     229    onCbChange();
     230}
     231
     232void VBoxVMSettingsFD::onCbChange()
    246233{
    247234    mUuidIsoFD = mGbFD->isChecked() ? mCbIsoFD->getId() : QUuid();
    248     mValidator->revalidate();
    249235    emit fdChanged();
     236    if (mValidator)
     237        mValidator->revalidate();
    250238}
    251239
     
    268256
    269257    mCbIsoFD->setFocus();
    270     mValidator->revalidate();
    271 }
    272 
     258    if (mValidator)
     259        mValidator->revalidate();
     260}
     261
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsGeneral.cpp

    r9948 r10167  
    2222
    2323#include "VBoxVMSettingsGeneral.h"
    24 #include "VBoxVMSettingsDlg.h"
    2524#include "VBoxGlobal.h"
    2625#include "VBoxProblemReporter.h"
    27 #include "QIWidgetValidator.h"
    28 
    29 /* Qt includes */
     26
    3027#include <QDir>
    3128
    3229#define ITEM_TYPE_ROLE Qt::UserRole + 1
    33 
    34 VBoxVMSettingsGeneral* VBoxVMSettingsGeneral::mSettings = 0;
    3530
    3631/**
     
    5449}
    5550
    56 VBoxVMSettingsGeneral::VBoxVMSettingsGeneral (QWidget *aParent,
    57                                               VBoxVMSettingsDlg *aDlg,
    58                                               const QString &aPath)
    59     : QIWithRetranslateUI<QWidget> (aParent)
     51VBoxVMSettingsGeneral::VBoxVMSettingsGeneral()
    6052{
    6153    /* Apply UI decorations */
    6254    Ui::VBoxVMSettingsGeneral::setupUi (this);
    6355
    64     /* Setup validators */
     56    /* Setup constants */
    6557    CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
    6658    const uint MinRAM = sys.GetMinGuestRAM();
     
    6961    const uint MaxVRAM = sys.GetMaxGuestVRAM();
    7062
    71     mLeName->setValidator (new QRegExpValidator (QRegExp (".+"), aDlg));
    72     mLeRam->setValidator (new QIntValidator (MinRAM, MaxRAM, aDlg));
    73     mLeVideo->setValidator (new QIntValidator (MinVRAM, MaxVRAM, aDlg));
    74 
    75     mValidator = new QIWidgetValidator (aPath, aParent, aDlg);
    76     connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator *)),
    77              aDlg, SLOT (enableOk (const QIWidgetValidator *)));
     63    /* Setup validators */
     64    mLeName->setValidator (new QRegExpValidator (QRegExp (".+"), this));
     65    mLeRam->setValidator (new QIntValidator (MinRAM, MaxRAM, this));
     66    mLeVideo->setValidator (new QIntValidator (MinVRAM, MaxVRAM, this));
    7867
    7968    /* Setup connections */
     
    152141
    153142    qApp->installEventFilter (this);
     143
    154144    /* Applying language settings */
    155145    retranslateUi();
    156 }
    157 
    158 void VBoxVMSettingsGeneral::getFromMachine (const CMachine &aMachine,
    159                                             QWidget *aPage,
    160                                             VBoxVMSettingsDlg *aDlg,
    161                                             const QString &aPath)
    162 {
    163     mSettings = new VBoxVMSettingsGeneral (aPage, aDlg, aPath);
    164     QVBoxLayout *layout = new QVBoxLayout (aPage);
    165     layout->setContentsMargins (0, 0, 0, 0);
    166     layout->addWidget (mSettings);
    167     connect (mSettings, SIGNAL (tableChanged()), aDlg, SLOT (resetFirstRunFlag()));
    168     mSettings->getFrom (aMachine);
    169 }
    170 
    171 void VBoxVMSettingsGeneral::putBackToMachine()
    172 {
    173     mSettings->putBackTo();
    174146}
    175147
     
    224196            }
    225197        }
    226         adjustBootOrderTWSize ();
     198        adjustBootOrderTWSize();
    227199    }
    228200
     
    234206
    235207    /* VT-x/AMD-V */
    236     aMachine.GetHWVirtExEnabled() == KTSBool_False ?
    237         mCbVirt->setCheckState (Qt::Unchecked) :
    238208    aMachine.GetHWVirtExEnabled() == KTSBool_True ?
    239209        mCbVirt->setCheckState (Qt::Checked) :
    240         mCbVirt->setCheckState (Qt::PartiallyChecked);
     210        mCbVirt->setCheckState (Qt::Unchecked);
    241211
    242212    /* PAE/NX */
     
    311281    /* VT-x/AMD-V */
    312282    mMachine.SetHWVirtExEnabled (
    313         mCbVirt->checkState() == Qt::Unchecked ? KTSBool_False :
    314         mCbVirt->checkState() == Qt::Checked ? KTSBool_True : KTSBool_Default);
     283        mCbVirt->checkState() == Qt::Checked ? KTSBool_True : KTSBool_False);
    315284
    316285    /* PAE/NX */
     
    342311}
    343312
     313void VBoxVMSettingsGeneral::setOrderAfter (QWidget *aWidget)
     314{
     315    /* Setup Tab order */
     316    setTabOrder (aWidget, mTabGeneral->focusProxy());
     317    setTabOrder (mTabGeneral->focusProxy(), mLeName);
     318    setTabOrder (mLeName, mCbOsType);
     319    setTabOrder (mCbOsType, mSlRam);
     320    setTabOrder (mSlRam, mLeRam);
     321    setTabOrder (mLeRam, mSlVideo);
     322    setTabOrder (mSlVideo, mLeVideo);
     323
     324    setTabOrder (mLeVideo, mTwBootOrder);
     325    setTabOrder (mTwBootOrder, mTbBootItemUp);
     326    setTabOrder (mTbBootItemUp, mTbBootItemDown);
     327    setTabOrder (mTbBootItemDown, mCbAcpi);
     328    setTabOrder (mCbAcpi, mCbPae);
     329    setTabOrder (mCbPae, mCbApic);
     330    setTabOrder (mCbApic, mCbVirt);
     331    setTabOrder (mCbVirt, mCbClipboard);
     332    setTabOrder (mCbClipboard, mCbIDEController);
     333    setTabOrder (mCbIDEController, mLeSnapshot);
     334    setTabOrder (mLeSnapshot, mTbSelectSnapshot);
     335    setTabOrder (mTbSelectSnapshot, mTbResetSnapshot);
     336
     337    setTabOrder (mTbResetSnapshot, mTeDescription);
     338
     339    setTabOrder (mTeDescription, mCbSaveMounted);
     340}
    344341
    345342void VBoxVMSettingsGeneral::retranslateUi()
     
    367364    }
    368365    /* Readjust the tree widget size */
    369     adjustBootOrderTWSize ();
     366    adjustBootOrderTWSize();
    370367
    371368    /* Shared Clipboard mode */
     
    473470    mLeSnapshot->selectAll();
    474471    mLeSnapshot->del();
     472}
     473
     474void VBoxVMSettingsGeneral::adjustBootOrderTWSize()
     475{
     476    /* Calculate the optimal size of the tree widget & set it as fixed
     477     * size. */
     478    mTwBootOrder->setFixedSize (
     479        static_cast<QAbstractItemView*> (mTwBootOrder)
     480        ->sizeHintForColumn (0) + 2 * mTwBootOrder->frameWidth(),
     481        static_cast<QAbstractItemView*> (mTwBootOrder)
     482        ->sizeHintForRow (0) * mTwBootOrder->topLevelItemCount() +
     483        2 * mTwBootOrder->frameWidth());
     484
     485    /* Update the layout system */
     486    mWBootContainer->layout()->activate();
     487    mTabAdvanced->layout()->activate();
     488    mTabAdvanced->layout()->update();
    475489}
    476490
     
    515529}
    516530
    517 void VBoxVMSettingsGeneral::adjustBootOrderTWSize ()
    518 {
    519     if (mTwBootOrder)
    520     {
    521         /* Calculate the optimal size of the tree widget & set it as fixed
    522          * size. */
    523         mTwBootOrder->setFixedSize (static_cast<QAbstractItemView*> (mTwBootOrder)->sizeHintForColumn (0) + 2 * mTwBootOrder->frameWidth(),
    524                                     static_cast<QAbstractItemView*> (mTwBootOrder)->sizeHintForRow (0) * mTwBootOrder->topLevelItemCount() + 2 * mTwBootOrder->frameWidth());
    525     }
    526 }
     531void VBoxVMSettingsGeneral::showEvent (QShowEvent *aEvent)
     532{
     533    QCoreApplication::sendPostedEvents();
     534    VBoxSettingsPage::showEvent (aEvent);
     535}
     536
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsHD.cpp

    r9751 r10167  
    2222
    2323#include "VBoxVMSettingsHD.h"
    24 #include "VBoxVMSettingsDlg.h"
    2524#include "VBoxGlobal.h"
    2625#include "VBoxProblemReporter.h"
     
    3029#include "VBoxNewHDWzd.h"
    3130
    32 /* Qt includes */
    3331#include <QHeaderView>
    3432#include <QItemEditorFactory>
     
    262260    : VBoxMediaComboBox (aParent, VBoxDefs::HD)
    263261{
    264     setBelongsTo (VBoxVMSettingsHD::mMachine.GetId());
     262    setBelongsTo (HDSlotUniquizer::instance()->machine().GetId());
    265263    connect (this, SIGNAL (currentIndexChanged (int)), this, SLOT (onActivate()));
    266264    connect (this, SIGNAL (readyToCommit (QWidget *)),
     
    320318HDSlotUniquizer* HDSlotUniquizer::mInstance = 0;
    321319HDSlotUniquizer* HDSlotUniquizer::instance (QWidget *aParent,
    322                                             HDItemsModel *aWatched)
     320                                            HDItemsModel *aWatched,
     321                                            const CMachine &aMachine)
    323322{
    324323    if (!mInstance)
    325324    {
    326         Assert (aParent && aWatched);
    327         mInstance = new HDSlotUniquizer (aParent, aWatched);
     325        Assert (aParent && aWatched && !aMachine.isNull());
     326        mInstance = new HDSlotUniquizer (aParent, aWatched, aMachine);
    328327    }
    329328    return mInstance;
    330329}
    331330
    332 HDSlotUniquizer::HDSlotUniquizer (QWidget *aParent, HDItemsModel *aWatched)
     331HDSlotUniquizer::HDSlotUniquizer (QWidget *aParent, HDItemsModel *aWatched,
     332                                  const CMachine &aMachine)
    333333    : QObject (aParent)
    334334    , mSataCount (SATAPortsCount)
    335335    , mModel (aWatched)
     336    , mMachine (aMachine)
    336337{
    337338    makeIDEList();
     
    390391}
    391392
    392 VBoxVMSettingsHD* VBoxVMSettingsHD::mSettings = 0;
    393 CMachine VBoxVMSettingsHD::mMachine = CMachine();
    394 
    395 VBoxVMSettingsHD::VBoxVMSettingsHD (QWidget *aParent,
    396                                     VBoxVMSettingsDlg *aDlg,
    397                                     const QString &aPath)
    398     : QIWithRetranslateUI<QWidget> (aParent)
     393
     394VBoxVMSettingsHD::VBoxVMSettingsHD()
     395    : mValidator (0)
    399396{
    400397    /* Apply UI decorations */
    401398    Ui::VBoxVMSettingsHD::setupUi (this);
    402 
    403     /* Setup validation */
    404     mValidator = new QIWidgetValidator (aPath, aParent, aDlg);
    405     connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator*)),
    406              aDlg, SLOT (enableOk (const QIWidgetValidator*)));
    407     connect (mValidator, SIGNAL (isValidRequested (QIWidgetValidator*)),
    408              aDlg, SLOT (revalidate (QIWidgetValidator*)));
    409399
    410400    /* Setup model/view factory */
     
    423413    mModel = new HDItemsModel (this, idHDSlt, idHDVdi);
    424414    connect (mModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
    425              mValidator, SLOT (revalidate()));
    426     connect (mModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
    427415             this, SIGNAL (hdChanged()));
    428 
    429     /* Setup slot uniquizer */
    430     HDSlotUniquizer::instance (mTwAts, mModel);
    431416
    432417    /* Setup table-view */
     
    487472    qApp->installEventFilter (this);
    488473
    489     /* Fixing tab-order */
    490     setTabOrder (aDlg->mTwSelector, mCbSATA);
    491     setTabOrder (mCbSATA, mTwAts);
    492474    /* Applying language settings */
    493475    retranslateUi();
    494476}
    495477
    496 VBoxVMSettingsHD::~VBoxVMSettingsHD()
    497 {
    498     mMachine = CMachine();
    499 }
    500 
    501 void VBoxVMSettingsHD::getFromMachine (const CMachine &aMachine,
    502                                        QWidget *aPage,
    503                                        VBoxVMSettingsDlg *aDlg,
    504                                        const QString &aPath)
     478void VBoxVMSettingsHD::getFrom (const CMachine &aMachine)
    505479{
    506480    mMachine = aMachine;
    507     mSettings = new VBoxVMSettingsHD (aPage, aDlg, aPath);
    508     QVBoxLayout *layout = new QVBoxLayout (aPage);
    509     layout->setContentsMargins (0, 0, 0, 0);
    510     layout->addWidget (mSettings);
    511     connect (mSettings, SIGNAL (hdChanged()), aDlg, SLOT (resetFirstRunFlag()));
    512     mSettings->getFrom();
    513 }
    514 
    515 void VBoxVMSettingsHD::putBackToMachine()
    516 {
    517     mSettings->putBackTo();
    518 }
    519 
    520 bool VBoxVMSettingsHD::revalidate (QString &aWarning)
    521 {
    522     return mSettings->validate (aWarning);
     481
     482    /* Setup slot uniquizer */
     483    HDSlotUniquizer::instance (mTwAts, mModel, mMachine);
     484
     485    CSATAController ctl = mMachine.GetSATAController();
     486    /* Hide the SATA check box if the SATA controller is not available
     487     * (i.e. in VirtualBox OSE) */
     488    if (ctl.isNull())
     489        mCbSATA->setHidden (true);
     490    else
     491        mCbSATA->setChecked (ctl.GetEnabled());
     492    cbSATAToggled (mCbSATA->checkState());
     493
     494    CHardDiskAttachmentEnumerator en =
     495        mMachine.GetHardDiskAttachments().Enumerate();
     496    while (en.HasMore())
     497    {
     498        CHardDiskAttachment hda = en.GetNext();
     499        HDSltValue slt (vboxGlobal().toFullString (hda.GetBus(),
     500                                                   hda.GetChannel(),
     501                                                   hda.GetDevice()),
     502                        hda.GetBus(), hda.GetChannel(), hda.GetDevice());
     503        HDVdiValue vdi (VBoxMediaComboBox::fullItemName (hda.GetHardDisk()
     504                                                         .GetLocation()),
     505                        hda.GetHardDisk().GetRoot().GetId());
     506        mModel->addItem (slt, vdi);
     507    }
     508
     509    mTwAts->setCurrentIndex (mModel->index (0, 1));
     510    onCurrentChanged (mTwAts->currentIndex());
     511
     512    if (mValidator)
     513        mValidator->revalidate();
     514}
     515
     516void VBoxVMSettingsHD::putBackTo()
     517{
     518    CSATAController ctl = mMachine.GetSATAController();
     519    if (!ctl.isNull())
     520    {
     521        ctl.SetEnabled (mCbSATA->isChecked());
     522    }
     523
     524    /* Detach all attached Hard Disks */
     525    CHardDiskAttachmentEnumerator en =
     526        mMachine.GetHardDiskAttachments().Enumerate();
     527    while (en.HasMore())
     528    {
     529        CHardDiskAttachment hda = en.GetNext();
     530        mMachine.DetachHardDisk (hda.GetBus(), hda.GetChannel(), hda.GetDevice());
     531        if (!mMachine.isOk())
     532            vboxProblem().cannotDetachHardDisk (this, mMachine,
     533                hda.GetBus(), hda.GetChannel(), hda.GetDevice());
     534    }
     535
     536    /* Attach all listed Hard Disks */
     537    LONG maxSATAPort = 1;
     538    QList<HDValue> list (mModel->fullList());
     539    for (int i = 0; i < list.size(); ++ i)
     540    {
     541        if (list [i].slt.bus == KStorageBus_SATA)
     542            maxSATAPort = maxSATAPort < (list [i].slt.channel + 1) ?
     543                          (list [i].slt.channel + 1) : maxSATAPort;
     544        mMachine.AttachHardDisk (list [i].vdi.id,
     545            list [i].slt.bus, list [i].slt.channel, list [i].slt.device);
     546        if (!mMachine.isOk())
     547            vboxProblem().cannotAttachHardDisk (this, mMachine, list [i].vdi.id,
     548                list [i].slt.bus, list [i].slt.channel, list [i].slt.device);
     549    }
     550
     551    if (!ctl.isNull())
     552    {
     553        mMachine.GetSATAController().SetPortCount (maxSATAPort);
     554    }
     555}
     556
     557void VBoxVMSettingsHD::setValidator (QIWidgetValidator *aVal)
     558{
     559    mValidator = aVal;
     560    connect (mModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
     561             mValidator, SLOT (revalidate()));
     562}
     563
     564bool VBoxVMSettingsHD::revalidate (QString &aWarning, QString &)
     565{
     566    QList<HDSltValue> sltList (mModel->slotsList());
     567    QList<HDVdiValue> vdiList (mModel->vdiList());
     568    for (int i = 0; i < vdiList.size(); ++ i)
     569    {
     570        /* Check for emptiness */
     571        if (vdiList [i].name.isNull())
     572        {
     573            aWarning = tr ("No hard disk is selected for <i>%1</i>")
     574                           .arg (sltList [i].name);
     575            break;
     576        }
     577
     578        /* Check for coincidence */
     579        if (vdiList.count (vdiList [i]) > 1)
     580        {
     581            int first = vdiList.indexOf (vdiList [i]);
     582            int second = vdiList.indexOf (vdiList [i], first + 1);
     583            Assert (first != -1 && second != -1);
     584            aWarning = tr ("<i>%1</i> uses the hard disk that is "
     585                           "already attached to <i>%2</i>")
     586                           .arg (sltList [second].name,
     587                                 sltList [first].name);
     588            break;
     589        }
     590    }
     591
     592    return aWarning.isNull();
     593}
     594
     595void VBoxVMSettingsHD::setOrderAfter (QWidget *aWidget)
     596{
     597    setTabOrder (aWidget, mCbSATA);
     598    setTabOrder (mCbSATA, mTwAts);
     599}
     600
     601void VBoxVMSettingsHD::retranslateUi()
     602{
     603    /* Translate uic generated strings */
     604    Ui::VBoxVMSettingsHD::retranslateUi (this);
     605
     606    mNewAction->setText (tr ("&Add Attachment"));
     607    mDelAction->setText (tr ("&Remove Attachment"));
     608    mVdmAction->setText (tr ("&Select Hard Disk"));
     609
     610    mNewAction->setToolTip (mNewAction->text().remove ('&') +
     611        QString (" (%1)").arg (mNewAction->shortcut().toString()));
     612    mDelAction->setToolTip (mDelAction->text().remove ('&') +
     613        QString (" (%1)").arg (mDelAction->shortcut().toString()));
     614    mVdmAction->setToolTip (mVdmAction->text().remove ('&') +
     615        QString (" (%1)").arg (mVdmAction->shortcut().toString()));
     616
     617    mNewAction->setWhatsThis (tr ("Adds a new hard disk attachment."));
     618    mDelAction->setWhatsThis (tr ("Removes the highlighted hard disk attachment."));
     619    mVdmAction->setWhatsThis (tr ("Invokes the Virtual Disk Manager to select "
     620                                  "a hard disk to attach to the currently "
     621                                  "highlighted slot."));
     622}
     623
     624void VBoxVMSettingsHD::newClicked()
     625{
     626    /* Remember the current vdis list */
     627    QList<HDVdiValue> vdis (mModel->vdiList());
     628
     629    /* Add new index */
     630    mModel->addItem();
     631
     632    /* Set the default data into the new index for column #1 */
     633    mTwAts->setCurrentIndex (mModel->index (mModel->rowCount() - 2, 1));
     634    /* Set the default data into the new index for column #0 */
     635    mTwAts->setCurrentIndex (mModel->index (mModel->rowCount() - 2, 0));
     636
     637    /* Set column #1 of new index to be the current */
     638    mTwAts->setCurrentIndex (mModel->index (mModel->rowCount() - 2, 1));
     639
     640    HDVdiEditor *editor = HDVdiEditor::activeEditor();
     641    if (editor)
     642    {
     643        /* Try to select unique vdi */
     644        editor->tryToChooseUniqueVdi (vdis);
     645
     646        /* Ask the user for method to add new vdi */
     647        int result = mModel->rowCount() - 1 > editor->count() ?
     648            vboxProblem().confirmRunNewHDWzdOrVDM (this) :
     649            QIMessageBox::Cancel;
     650        if (result == QIMessageBox::Yes)
     651        {
     652            mTwAts->closePersistentEditor (mTwAts->currentIndex());
     653            VBoxNewHDWzd dlg (this);
     654            if (dlg.exec() == QDialog::Accepted)
     655            {
     656                CHardDisk hd = dlg.hardDisk();
     657                QVariant result;
     658                HDVdiValue val (VBoxMediaComboBox::fullItemName (hd.GetLocation()),
     659                                hd.GetId());
     660                result.setValue (val);
     661                mModel->setData (mTwAts->currentIndex(), result);
     662                vboxGlobal().startEnumeratingMedia();
     663            }
     664        }
     665        else if (result == QIMessageBox::No)
     666            vdmClicked();
     667    }
     668}
     669
     670void VBoxVMSettingsHD::delClicked()
     671{
     672    QModelIndex current = mTwAts->currentIndex();
     673    if (current.isValid())
     674    {
     675        /* Storing current attributes */
     676        int row = current.row();
     677        int col = current.column();
     678
     679        /* Erase current index */
     680        mTwAts->setCurrentIndex (QModelIndex());
     681
     682        /* Calculate new current index */
     683        int newRow = row < mModel->rowCount() - 2 ? row :
     684                     row > 0 ? row - 1 : -1;
     685        QModelIndex next = newRow == -1 ? mModel->index (0, col) :
     686                                          mModel->index (newRow, col);
     687
     688        /* Delete current index */
     689        mModel->delItem (current.row());
     690
     691        /* Set the new index to be the current */
     692        mTwAts->setCurrentIndex (next);
     693        onCurrentChanged (next);
     694
     695        if (mValidator)
     696            mValidator->revalidate();
     697        emit hdChanged();
     698    }
     699}
     700
     701void VBoxVMSettingsHD::vdmClicked()
     702{
     703    Assert (mTwAts->currentIndex().isValid());
     704
     705    VBoxDiskImageManagerDlg dlg (this);
     706    QUuid machineId = mMachine.GetId();
     707    HDVdiValue vdiInfo (mModel->data (mTwAts->currentIndex(), Qt::EditRole)
     708                        .value<HDVdiValue>());
     709    QUuid hdId = vdiInfo.id;
     710    dlg.setup (VBoxDefs::HD, true, &machineId, true, mMachine, hdId);
     711
     712    if (dlg.exec() == QDialog::Accepted)
     713    {
     714        QVariant result;
     715        HDVdiValue val (VBoxMediaComboBox::fullItemName (dlg.selectedPath()),
     716                        dlg.selectedUuid());
     717        result.setValue (val);
     718        mModel->setData (mTwAts->currentIndex(), result);
     719    }
     720
     721    vboxGlobal().startEnumeratingMedia();
     722}
     723
     724void VBoxVMSettingsHD::onCurrentChanged (const QModelIndex &aIndex)
     725{
     726    mNewAction->setEnabled (mModel->rowCount() - 1 <
     727        HDSlotUniquizer::instance()->list (HDSltValue(), false).count());
     728    mDelAction->setEnabled (mTwAts->currentIndex().row() != mModel->rowCount() - 1);
     729    mVdmAction->setEnabled (aIndex.isValid() && aIndex.column() == 1);
     730}
     731
     732void VBoxVMSettingsHD::cbSATAToggled (int aState)
     733{
     734    if (aState == Qt::Unchecked)
     735    {
     736        /* Search the list for at least one SATA port in */
     737        QList<HDSltValue> list (mModel->slotsList());
     738        int firstSataPort = 0;
     739        for (; firstSataPort < list.size(); ++ firstSataPort)
     740            if (list [firstSataPort].bus == KStorageBus_SATA)
     741                break;
     742
     743        /* If list contains at least one SATA port */
     744        if (firstSataPort < list.size())
     745        {
     746            int rc = vboxProblem().confirmDetachSATASlots (this);
     747            if (rc != QIMessageBox::Ok)
     748            {
     749                /* Switch check-box back to "Qt::Checked" */
     750                mCbSATA->blockSignals (true);
     751                mCbSATA->setCheckState (Qt::Checked);
     752                mCbSATA->blockSignals (false);
     753                return;
     754            }
     755            else
     756            {
     757                /* Delete SATA items */
     758                mModel->removeSata();
     759                if (mValidator)
     760                    mValidator->revalidate();
     761            }
     762        }
     763    }
     764
     765    int newSataCount = aState == Qt::Checked ? SATAPortsCount : 0;
     766    if (HDSlotUniquizer::instance()->sataCount() != newSataCount)
     767        HDSlotUniquizer::instance()->setSataCount (newSataCount);
     768    onCurrentChanged (mTwAts->currentIndex());
     769}
     770
     771void VBoxVMSettingsHD::onMediaRemoved (VBoxDefs::DiskType aType, const QUuid &aId)
     772{
     773    /* Check if it is necessary to update data-model if
     774     * some media was removed */
     775    if (aType == VBoxDefs::HD)
     776    {
     777        QList<HDVdiValue> vdis (mModel->vdiList());
     778        for (int i = 0; i < vdis.size(); ++ i)
     779        {
     780            if (vdis [i].id == aId)
     781            {
     782                QVariant emptyVal;
     783                emptyVal.setValue (HDVdiValue());
     784                mModel->setData (mModel->index (i, 1), emptyVal);
     785            }
     786        }
     787    }
    523788}
    524789
     
    592857}
    593858
    594 
    595 void VBoxVMSettingsHD::retranslateUi()
    596 {
    597     /* Translate uic generated strings */
    598     Ui::VBoxVMSettingsHD::retranslateUi (this);
    599 
    600     mNewAction->setText (tr ("&Add Attachment"));
    601     mDelAction->setText (tr ("&Remove Attachment"));
    602     mVdmAction->setText (tr ("&Select Hard Disk"));
    603 
    604     mNewAction->setToolTip (mNewAction->text().remove ('&') +
    605         QString (" (%1)").arg (mNewAction->shortcut().toString()));
    606     mDelAction->setToolTip (mDelAction->text().remove ('&') +
    607         QString (" (%1)").arg (mDelAction->shortcut().toString()));
    608     mVdmAction->setToolTip (mVdmAction->text().remove ('&') +
    609         QString (" (%1)").arg (mVdmAction->shortcut().toString()));
    610 
    611     mNewAction->setWhatsThis (tr ("Adds a new hard disk attachment."));
    612     mDelAction->setWhatsThis (tr ("Removes the highlighted hard disk attachment."));
    613     mVdmAction->setWhatsThis (tr ("Invokes the Virtual Disk Manager to select "
    614                                   "a hard disk to attach to the currently "
    615                                   "highlighted slot."));
    616 }
    617 
    618 void VBoxVMSettingsHD::getFrom()
    619 {
    620     CSATAController ctl = mMachine.GetSATAController();
    621     /* Hide the SATA check box if the SATA controller is not available
    622      * (i.e. in VirtualBox OSE) */
    623     if (ctl.isNull())
    624         mCbSATA->setHidden (true);
    625     else
    626         mCbSATA->setChecked (ctl.GetEnabled());
    627     cbSATAToggled (mCbSATA->checkState());
    628 
    629     CHardDiskAttachmentEnumerator en =
    630         mMachine.GetHardDiskAttachments().Enumerate();
    631     while (en.HasMore())
    632     {
    633         CHardDiskAttachment hda = en.GetNext();
    634         HDSltValue slt (vboxGlobal().toFullString (hda.GetBus(),
    635                                                    hda.GetChannel(),
    636                                                    hda.GetDevice()),
    637                         hda.GetBus(), hda.GetChannel(), hda.GetDevice());
    638         HDVdiValue vdi (VBoxMediaComboBox::fullItemName (hda.GetHardDisk()
    639                                                          .GetLocation()),
    640                         hda.GetHardDisk().GetRoot().GetId());
    641         mModel->addItem (slt, vdi);
    642     }
    643 
    644     mTwAts->setCurrentIndex (mModel->index (0, 1));
    645     onCurrentChanged (mTwAts->currentIndex());
    646 
    647     mValidator->revalidate();
    648 }
    649 
    650 void VBoxVMSettingsHD::putBackTo()
    651 {
    652     CSATAController ctl = mMachine.GetSATAController();
    653     if (!ctl.isNull())
    654     {
    655         ctl.SetEnabled (mCbSATA->isChecked());
    656     }
    657 
    658     /* Detach all attached Hard Disks */
    659     CHardDiskAttachmentEnumerator en =
    660         mMachine.GetHardDiskAttachments().Enumerate();
    661     while (en.HasMore())
    662     {
    663         CHardDiskAttachment hda = en.GetNext();
    664         mMachine.DetachHardDisk (hda.GetBus(), hda.GetChannel(), hda.GetDevice());
    665         if (!mMachine.isOk())
    666             vboxProblem().cannotDetachHardDisk (this, mMachine,
    667                 hda.GetBus(), hda.GetChannel(), hda.GetDevice());
    668     }
    669 
    670     /* Attach all listed Hard Disks */
    671     LONG maxSATAPort = 1;
    672     QList<HDValue> list (mModel->fullList());
    673     for (int i = 0; i < list.size(); ++ i)
    674     {
    675         if (list [i].slt.bus == KStorageBus_SATA)
    676             maxSATAPort = maxSATAPort < (list [i].slt.channel + 1) ?
    677                           (list [i].slt.channel + 1) : maxSATAPort;
    678         mMachine.AttachHardDisk (list [i].vdi.id,
    679             list [i].slt.bus, list [i].slt.channel, list [i].slt.device);
    680         if (!mMachine.isOk())
    681             vboxProblem().cannotAttachHardDisk (this, mMachine, list [i].vdi.id,
    682                 list [i].slt.bus, list [i].slt.channel, list [i].slt.device);
    683     }
    684 
    685     if (!ctl.isNull())
    686     {
    687         mMachine.GetSATAController().SetPortCount (maxSATAPort);
    688     }
    689 }
    690 
    691 bool VBoxVMSettingsHD::validate (QString &aWarning)
    692 {
    693     QList<HDSltValue> sltList (mModel->slotsList());
    694     QList<HDVdiValue> vdiList (mModel->vdiList());
    695     for (int i = 0; i < vdiList.size(); ++ i)
    696     {
    697         /* Check for emptiness */
    698         if (vdiList [i].name.isNull())
    699         {
    700             aWarning = tr ("No hard disk is selected for <i>%1</i>")
    701                            .arg (sltList [i].name);
    702             break;
    703         }
    704 
    705         /* Check for coincidence */
    706         if (vdiList.count (vdiList [i]) > 1)
    707         {
    708             int first = vdiList.indexOf (vdiList [i]);
    709             int second = vdiList.indexOf (vdiList [i], first + 1);
    710             Assert (first != -1 && second != -1);
    711             aWarning = tr ("<i>%1</i> uses the hard disk that is "
    712                            "already attached to <i>%2</i>")
    713                            .arg (sltList [second].name,
    714                                  sltList [first].name);
    715             break;
    716         }
    717     }
    718 
    719     return aWarning.isNull();
    720 }
    721 
    722 void VBoxVMSettingsHD::newClicked()
    723 {
    724     /* Remember the current vdis list */
    725     QList<HDVdiValue> vdis (mModel->vdiList());
    726 
    727     /* Add new index */
    728     mModel->addItem();
    729 
    730     /* Set the default data into the new index for column #1 */
    731     mTwAts->setCurrentIndex (mModel->index (mModel->rowCount() - 2, 1));
    732     /* Set the default data into the new index for column #0 */
    733     mTwAts->setCurrentIndex (mModel->index (mModel->rowCount() - 2, 0));
    734 
    735     /* Set column #1 of new index to be the current */
    736     mTwAts->setCurrentIndex (mModel->index (mModel->rowCount() - 2, 1));
    737 
    738     HDVdiEditor *editor = HDVdiEditor::activeEditor();
    739     if (editor)
    740     {
    741         /* Try to select unique vdi */
    742         editor->tryToChooseUniqueVdi (vdis);
    743 
    744         /* Ask the user for method to add new vdi */
    745         int result = mModel->rowCount() - 1 > editor->count() ?
    746             vboxProblem().confirmRunNewHDWzdOrVDM (this) :
    747             QIMessageBox::Cancel;
    748         if (result == QIMessageBox::Yes)
    749         {
    750             mTwAts->closePersistentEditor (mTwAts->currentIndex());
    751             VBoxNewHDWzd dlg (this);
    752             if (dlg.exec() == QDialog::Accepted)
    753             {
    754                 CHardDisk hd = dlg.hardDisk();
    755                 QVariant result;
    756                 HDVdiValue val (VBoxMediaComboBox::fullItemName (hd.GetLocation()),
    757                                 hd.GetId());
    758                 result.setValue (val);
    759                 mModel->setData (mTwAts->currentIndex(), result);
    760                 vboxGlobal().startEnumeratingMedia();
    761             }
    762         }
    763         else if (result == QIMessageBox::No)
    764             vdmClicked();
    765     }
    766 }
    767 
    768 void VBoxVMSettingsHD::delClicked()
    769 {
    770     QModelIndex current = mTwAts->currentIndex();
    771     if (current.isValid())
    772     {
    773         /* Storing current attributes */
    774         int row = current.row();
    775         int col = current.column();
    776 
    777         /* Erase current index */
    778         mTwAts->setCurrentIndex (QModelIndex());
    779 
    780         /* Calculate new current index */
    781         int newRow = row < mModel->rowCount() - 2 ? row :
    782                      row > 0 ? row - 1 : -1;
    783         QModelIndex next = newRow == -1 ? mModel->index (0, col) :
    784                                           mModel->index (newRow, col);
    785 
    786         /* Delete current index */
    787         mModel->delItem (current.row());
    788 
    789         /* Set the new index to be the current */
    790         mTwAts->setCurrentIndex (next);
    791         onCurrentChanged (next);
    792 
    793         mValidator->revalidate();
    794         emit hdChanged();
    795     }
    796 }
    797 
    798 void VBoxVMSettingsHD::vdmClicked()
    799 {
    800     Assert (mTwAts->currentIndex().isValid());
    801 
    802     VBoxDiskImageManagerDlg dlg (this);
    803     QUuid machineId = mMachine.GetId();
    804     HDVdiValue vdiInfo (mModel->data (mTwAts->currentIndex(), Qt::EditRole)
    805                         .value<HDVdiValue>());
    806     QUuid hdId = vdiInfo.id;
    807     dlg.setup (VBoxDefs::HD, true, &machineId, true, mMachine, hdId);
    808 
    809     if (dlg.exec() == QDialog::Accepted)
    810     {
    811         QVariant result;
    812         HDVdiValue val (VBoxMediaComboBox::fullItemName (dlg.selectedPath()),
    813                         dlg.selectedUuid());
    814         result.setValue (val);
    815         mModel->setData (mTwAts->currentIndex(), result);
    816     }
    817 
    818     vboxGlobal().startEnumeratingMedia();
    819 }
    820 
    821 void VBoxVMSettingsHD::onCurrentChanged (const QModelIndex &aIndex)
    822 {
    823     mNewAction->setEnabled (mModel->rowCount() - 1 <
    824         HDSlotUniquizer::instance()->list (HDSltValue(), false).count());
    825     mDelAction->setEnabled (mTwAts->currentIndex().row() != mModel->rowCount() - 1);
    826     mVdmAction->setEnabled (aIndex.isValid() && aIndex.column() == 1);
    827 }
    828 
    829 void VBoxVMSettingsHD::cbSATAToggled (int aState)
    830 {
    831     if (aState == Qt::Unchecked)
    832     {
    833         /* Search the list for at least one SATA port in */
    834         QList<HDSltValue> list (mModel->slotsList());
    835         int firstSataPort = 0;
    836         for (; firstSataPort < list.size(); ++ firstSataPort)
    837             if (list [firstSataPort].bus == KStorageBus_SATA)
    838                 break;
    839 
    840         /* If list contains at least one SATA port */
    841         if (firstSataPort < list.size())
    842         {
    843             int rc = vboxProblem().confirmDetachSATASlots (this);
    844             if (rc != QIMessageBox::Ok)
    845             {
    846                 /* Switch check-box back to "Qt::Checked" */
    847                 mCbSATA->blockSignals (true);
    848                 mCbSATA->setCheckState (Qt::Checked);
    849                 mCbSATA->blockSignals (false);
    850                 return;
    851             }
    852             else
    853             {
    854                 /* Delete SATA items */
    855                 mModel->removeSata();
    856                 mValidator->revalidate();
    857             }
    858         }
    859     }
    860 
    861     int newSataCount = aState == Qt::Checked ? SATAPortsCount : 0;
    862     if (HDSlotUniquizer::instance()->sataCount() != newSataCount)
    863         HDSlotUniquizer::instance()->setSataCount (newSataCount);
    864     onCurrentChanged (mTwAts->currentIndex());
    865 }
    866 
    867 void VBoxVMSettingsHD::onMediaRemoved (VBoxDefs::DiskType aType, const QUuid &aId)
    868 {
    869     /* Check if it is necessary to update data-model if
    870      * some media was removed */
    871     if (aType == VBoxDefs::HD)
    872     {
    873         QList<HDVdiValue> vdis (mModel->vdiList());
    874         for (int i = 0; i < vdis.size(); ++ i)
    875         {
    876             if (vdis [i].id == aId)
    877             {
    878                 QVariant emptyVal;
    879                 emptyVal.setValue (HDVdiValue());
    880                 mModel->setData (mModel->index (i, 1), emptyVal);
    881             }
    882         }
    883     }
    884 }
    885 
    886859int VBoxVMSettingsHD::maxNameLength() const
    887860{
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsNetwork.cpp

    r10101 r10167  
    2323/* Common Includes */
    2424#include "VBoxVMSettingsNetwork.h"
    25 #include "VBoxVMSettingsDlg.h"
    2625#include "QIWidgetValidator.h"
    2726#include "VBoxGlobal.h"
    2827#ifdef Q_WS_WIN
    2928#include "VBoxToolBar.h"
    30 #include "VBoxVMSettingsUtils.h"
     29#include "VBoxSettingsUtils.h"
    3130#include "VBoxProblemReporter.h"
    3231#endif
     
    197196}
    198197
     198QWidget* VBoxVMSettingsNetwork::setOrderAfter (QWidget *aAfter)
     199{
     200    setTabOrder (aAfter, mGbAdapter);
     201    setTabOrder (mGbAdapter, mCbAType);
     202    setTabOrder (mCbAType, mCbNAType);
     203    setTabOrder (mCbNAType, mCbNetwork);
     204    setTabOrder (mCbNetwork, mLeMAC);
     205    setTabOrder (mLeMAC, mPbMAC);
     206    setTabOrder (mPbMAC, mCbCable);
     207    setTabOrder (mCbCable, mLeInterface_x11);
     208    setTabOrder (mLeInterface_x11, mLeSetup_x11);
     209    setTabOrder (mLeSetup_x11, mTbSetup_x11);
     210    setTabOrder (mTbSetup_x11, mLeTerminate_x11);
     211    setTabOrder (mLeTerminate_x11, mTbTerminate_x11);
     212    return mTbTerminate_x11;
     213}
     214
    199215void VBoxVMSettingsNetwork::setNetworksList (const QStringList &aList)
    200216{
     
    600616
    601617/* VBoxVMSettingsNetworkPage Stuff */
    602 VBoxVMSettingsNetworkPage* VBoxVMSettingsNetworkPage::mSettings = 0;
    603 
    604 void VBoxVMSettingsNetworkPage::getFromMachine (const CMachine &aMachine,
    605                                                 QWidget *aPage,
    606                                                 VBoxVMSettingsDlg *aDlg,
    607                                                 const QString &aPath)
    608 {
    609     mSettings = new VBoxVMSettingsNetworkPage (aPage);
    610     QVBoxLayout *layout = new QVBoxLayout (aPage);
    611     layout->setContentsMargins (0, 5, 0, 0);
    612     layout->addWidget (mSettings);
    613     mSettings->getFrom (aMachine, aDlg, aPath);
    614 }
    615 
    616 void VBoxVMSettingsNetworkPage::putBackToMachine()
    617 {
    618     mSettings->putBackTo();
    619 }
    620 
    621 bool VBoxVMSettingsNetworkPage::revalidate (QString &aWarning,
    622                                             QString &aTitle)
    623 {
    624     return mSettings->validate (aWarning, aTitle);
    625 }
    626 
    627 VBoxVMSettingsNetworkPage::VBoxVMSettingsNetworkPage (QWidget *aParent)
    628     : QIWithRetranslateUI<QWidget> (aParent)
     618VBoxVMSettingsNetworkPage::VBoxVMSettingsNetworkPage()
     619    : mValidator (0)
    629620    , mLockNetworkListUpdate (true)
    630621{
    631622    QVBoxLayout *layout = new QVBoxLayout (this);
    632     layout->setContentsMargins (0, 0, 0, 0);
     623    layout->setContentsMargins (0, 5, 0, 5);
    633624
    634625    /* Creating Tab Widget */
    635     mTwAdapters = new QTabWidget (aParent);
     626    mTwAdapters = new QTabWidget (this);
    636627    layout->addWidget (mTwAdapters);
    637628    /* Prepare Networks Lists */
     
    640631#ifdef Q_WS_WIN
    641632    /* Creating Interfaces List */
    642     mNIList = new VBoxNIList (aParent);
     633    mNIList = new VBoxNIList (this);
    643634    layout->addWidget (mNIList);
    644635#else
     
    647638}
    648639
    649 void VBoxVMSettingsNetworkPage::getFrom (const CMachine &aMachine,
    650                                          VBoxVMSettingsDlg *aDlg,
    651                                          const QString &aPath)
    652 {
     640void VBoxVMSettingsNetworkPage::getFrom (const CMachine &aMachine)
     641{
     642    Assert (mFirstWidget);
     643    setTabOrder (mFirstWidget, mTwAdapters->focusProxy());
     644    QWidget *lastFocusWidget = mTwAdapters->focusProxy();
     645
    653646    /* Creating Tab Pages */
    654647    CVirtualBox vbox = vboxGlobal().virtualBox();
     
    670663
    671664        /* Setup validation */
    672         QIWidgetValidator *wval =
    673             new QIWidgetValidator (QString ("%1: %2").arg (aPath, page->pageTitle()),
    674                                    (QWidget*)parent(), aDlg);
    675         connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)),
    676                  aDlg, SLOT (enableOk (const QIWidgetValidator*)));
    677         connect (wval, SIGNAL (isValidRequested (QIWidgetValidator *)),
    678                  aDlg, SLOT (revalidate (QIWidgetValidator*)));
     665        page->setValidator (mValidator);
     666
     667        /* Setup tab order */
     668        lastFocusWidget = page->setOrderAfter (lastFocusWidget);
     669
     670        /* Setup connections */
    679671        connect (page->mCbNetwork, SIGNAL (editTextChanged (const QString&)),
    680672                 this, SLOT (updateNetworksList()));
    681 #ifdef Q_WS_WIN
    682         connect (mNIList, SIGNAL (listChanged()), wval, SLOT (revalidate()));
    683 #endif
    684         page->setValidator (wval);
    685     }
    686 
    687 #ifdef Q_WS_WIN
     673    }
     674
     675#ifdef Q_WS_WIN
     676    setTabOrder (lastFocusWidget, mNIList);
    688677    connect (mTwAdapters, SIGNAL (currentChanged (int)),
    689678             this, SLOT (onCurrentPageChanged (int)));
     
    708697}
    709698
    710 bool VBoxVMSettingsNetworkPage::validate (QString &aWarning,
    711                                           QString &aTitle)
     699void VBoxVMSettingsNetworkPage::setValidator (QIWidgetValidator *aVal)
     700{
     701    mValidator = aVal;
     702#ifdef Q_WS_WIN
     703    connect (mNIList, SIGNAL (listChanged()), mValidator, SLOT (revalidate()));
     704#endif
     705}
     706
     707bool VBoxVMSettingsNetworkPage::revalidate (QString &aWarning,
     708                                            QString &aTitle)
    712709{
    713710    bool valid = true;
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsParallel.cpp

    r9889 r10167  
    2222
    2323#include "VBoxVMSettingsParallel.h"
    24 #include "VBoxVMSettingsDlg.h"
    2524#include "QIWidgetValidator.h"
    2625#include "VBoxGlobal.h"
    2726
    28 /* Qt includes */
    2927#include <QDir>
    3028
    31 QTabWidget* VBoxVMSettingsParallel::mTabWidget = 0;
    32 
    33 VBoxVMSettingsParallel::VBoxVMSettingsParallel(QWidget* aParent /* = NULL */)
    34     : QIWithRetranslateUI<QWidget> (aParent)
     29/* VBoxVMSettingsParallel stuff */
     30VBoxVMSettingsParallel::VBoxVMSettingsParallel()
     31    : QIWithRetranslateUI<QWidget> (0)
     32    , mValidator (0)
    3533{
    3634    /* Apply UI decorations */
     
    5856    connect (mCbNumber, SIGNAL (activated (const QString &)),
    5957             this, SLOT (mCbNumberActivated (const QString &)));
     58
    6059    /* Applying language settings */
    6160    retranslateUi();
    6261}
    6362
    64 void VBoxVMSettingsParallel::getFromMachine (const CMachine &aMachine,
    65                                              QWidget *aPage,
    66                                              VBoxVMSettingsDlg *aDlg,
    67                                              const QString &aPath)
     63void VBoxVMSettingsParallel::getFromPort (const CParallelPort &aPort)
     64{
     65    mPort = aPort;
     66
     67    mGbParallel->setChecked (mPort.GetEnabled());
     68    ulong IRQ = mPort.GetIRQ();
     69    ulong IOBase = mPort.GetIOBase();
     70    mCbNumber->setCurrentIndex (mCbNumber->
     71        findText (vboxGlobal().toCOMPortName (IRQ, IOBase)));
     72    mLeIRQ->setText (QString::number (IRQ));
     73    mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
     74    mLePath->setText (mPort.GetPath());
     75
     76    /* Ensure everything is up-to-date */
     77    mGbParallelToggled (mGbParallel->isChecked());
     78}
     79
     80void VBoxVMSettingsParallel::putBackToPort()
     81{
     82    mPort.SetEnabled (mGbParallel->isChecked());
     83    mPort.SetIRQ (mLeIRQ->text().toULong (NULL, 0));
     84    mPort.SetIOBase (mLeIOPort->text().toULong (NULL, 0));
     85    mPort.SetPath (QDir::convertSeparators (mLePath->text()));
     86}
     87
     88void VBoxVMSettingsParallel::setValidator (QIWidgetValidator *aVal)
     89{
     90    Assert (aVal);
     91    mValidator = aVal;
     92    connect (mLeIRQ, SIGNAL (textChanged (const QString &)),
     93             mValidator, SLOT (revalidate()));
     94    connect (mLeIOPort, SIGNAL (textChanged (const QString &)),
     95             mValidator, SLOT (revalidate()));
     96    connect (mLePath, SIGNAL (textChanged (const QString &)),
     97             mValidator, SLOT (revalidate()));
     98    mValidator->revalidate();
     99}
     100
     101QWidget* VBoxVMSettingsParallel::setOrderAfter (QWidget *aAfter)
     102{
     103    setTabOrder (aAfter, mGbParallel);
     104    setTabOrder (mGbParallel, mCbNumber);
     105    setTabOrder (mCbNumber, mLeIRQ);
     106    setTabOrder (mLeIRQ, mLeIOPort);
     107    setTabOrder (mLeIOPort, mLePath);
     108    return mLePath;
     109}
     110
     111QString VBoxVMSettingsParallel::pageTitle() const
     112{
     113    QString pageTitle;
     114    if (!mPort.isNull())
     115        pageTitle = QString (tr ("Port %1", "parallel ports"))
     116            .arg (mPort.GetSlot());
     117    return pageTitle;
     118}
     119
     120bool VBoxVMSettingsParallel::isUserDefined()
     121{
     122    ulong a, b;
     123    return !vboxGlobal().toCOMPortNumbers (mCbNumber->currentText(), a, b);
     124}
     125
     126void VBoxVMSettingsParallel::retranslateUi()
     127{
     128    /* Translate uic generated strings */
     129    Ui::VBoxVMSettingsParallel::retranslateUi (this);
     130
     131    mCbNumber->setItemText (mCbNumber->count() - 1, vboxGlobal().toCOMPortName (0, 0));
     132}
     133
     134void VBoxVMSettingsParallel::mGbParallelToggled (bool aOn)
     135{
     136    if (aOn)
     137        mCbNumberActivated (mCbNumber->currentText());
     138    if (mValidator)
     139        mValidator->revalidate();
     140}
     141
     142void VBoxVMSettingsParallel::mCbNumberActivated (const QString &aText)
     143{
     144    ulong IRQ, IOBase;
     145    bool std = vboxGlobal().toCOMPortNumbers (aText, IRQ, IOBase);
     146
     147    mLeIRQ->setEnabled (!std);
     148    mLeIOPort->setEnabled (!std);
     149    if (std)
     150    {
     151        mLeIRQ->setText (QString::number (IRQ));
     152        mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
     153    }
     154}
     155
     156
     157/* VBoxVMSettingsParallelPage stuff */
     158VBoxVMSettingsParallelPage::VBoxVMSettingsParallelPage()
     159    : mValidator (0)
    68160{
    69161    /* TabWidget creation */
    70     mTabWidget = new QTabWidget (aPage);
     162    mTabWidget = new QTabWidget (this);
    71163    mTabWidget->setSizePolicy (QSizePolicy::Expanding,
    72164                               QSizePolicy::Fixed);
    73     QVBoxLayout *layout = new QVBoxLayout (aPage);
    74     layout->setContentsMargins (0, 5, 0, 0);
     165    QVBoxLayout *layout = new QVBoxLayout (this);
     166    layout->setContentsMargins (0, 5, 0, 5);
    75167    layout->addWidget (mTabWidget);
    76168    layout->addStretch();
     169}
     170
     171void VBoxVMSettingsParallelPage::getFrom (const CMachine &aMachine)
     172{
     173    Assert (mFirstWidget);
     174    setTabOrder (mFirstWidget, mTabWidget->focusProxy());
     175    QWidget *lastFocusWidget = mTabWidget->focusProxy();
    77176
    78177    /* Tab pages loading */
     
    85184        page->getFromPort (port);
    86185        mTabWidget->addTab (page, page->pageTitle());
    87 
    88         /* Setup validation. */
    89         QIWidgetValidator *wval =
    90             new QIWidgetValidator (QString ("%1: %2").arg (aPath, page->pageTitle()),
    91                                    aPage, mTabWidget);
    92         connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)),
    93                  aDlg, SLOT (enableOk (const QIWidgetValidator *)));
    94         connect (wval, SIGNAL (isValidRequested (QIWidgetValidator *)),
    95                  aDlg, SLOT (revalidate (QIWidgetValidator *)));
    96 
    97         connect (page->mGbParallel, SIGNAL (toggled (bool)),
    98                  wval, SLOT (revalidate()));
    99         connect (page->mLeIRQ, SIGNAL (textChanged (const QString &)),
    100                  wval, SLOT (revalidate()));
    101         connect (page->mLeIOPort, SIGNAL (textChanged (const QString &)),
    102                  wval, SLOT (revalidate()));
    103 
    104         wval->revalidate();
    105     }
    106 }
    107 
    108 void VBoxVMSettingsParallel::putBackToMachine()
    109 {
    110     if (mTabWidget)
    111         for (int index = 0; index < mTabWidget->count(); ++ index)
    112         {
    113             VBoxVMSettingsParallel *page =
    114                 (VBoxVMSettingsParallel*) mTabWidget->widget (index);
    115             Assert (page);
    116             page->putBackToPort();
    117         }
    118 }
    119 
    120 bool VBoxVMSettingsParallel::revalidate (QString &aWarning, QString &aTitle)
     186        Assert (mValidator);
     187        page->setValidator (mValidator);
     188        lastFocusWidget = page->setOrderAfter (lastFocusWidget);
     189    }
     190}
     191
     192void VBoxVMSettingsParallelPage::putBackTo()
     193{
     194    for (int index = 0; index < mTabWidget->count(); ++ index)
     195    {
     196        VBoxVMSettingsParallel *page =
     197            (VBoxVMSettingsParallel*) mTabWidget->widget (index);
     198        Assert (page);
     199        page->putBackToPort();
     200    }
     201}
     202
     203void VBoxVMSettingsParallelPage::setValidator (QIWidgetValidator *aVal)
     204{
     205    mValidator = aVal;
     206}
     207
     208bool VBoxVMSettingsParallelPage::revalidate (QString &aWarning, QString &aTitle)
    121209{
    122210    bool valid = true;
     
    167255}
    168256
    169 
    170 void VBoxVMSettingsParallel::retranslateUi()
    171 {
    172     /* Translate uic generated strings */
    173     Ui::VBoxVMSettingsParallel::retranslateUi (this);
    174 
    175     mTabWidget->setTabText (mTabWidget->indexOf (this), pageTitle());
    176 
    177     mCbNumber->setItemText (mCbNumber->count() - 1, vboxGlobal().toCOMPortName (0, 0));
    178 }
    179 
    180 
    181 void VBoxVMSettingsParallel::mGbParallelToggled (bool aOn)
    182 {
    183     if (aOn)
    184         mCbNumberActivated (mCbNumber->currentText());
    185 }
    186 
    187 void VBoxVMSettingsParallel::mCbNumberActivated (const QString &aText)
    188 {
    189     ulong IRQ, IOBase;
    190     bool std = vboxGlobal().toCOMPortNumbers (aText, IRQ, IOBase);
    191 
    192     mLeIRQ->setEnabled (!std);
    193     mLeIOPort->setEnabled (!std);
    194     if (std)
    195     {
    196         mLeIRQ->setText (QString::number (IRQ));
    197         mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
    198     }
    199 }
    200 
    201 void VBoxVMSettingsParallel::getFromPort (const CParallelPort &aPort)
    202 {
    203     mPort = aPort;
    204 
    205     mGbParallel->setChecked (mPort.GetEnabled());
    206     ulong IRQ = mPort.GetIRQ();
    207     ulong IOBase = mPort.GetIOBase();
    208     mCbNumber->setCurrentIndex (mCbNumber->
    209         findText (vboxGlobal().toCOMPortName (IRQ, IOBase)));
    210     mLeIRQ->setText (QString::number (IRQ));
    211     mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
    212     mLePath->setText (mPort.GetPath());
    213 
    214     /* Ensure everything is up-to-date */
    215     mGbParallelToggled (mGbParallel->isChecked());
    216 }
    217 
    218 void VBoxVMSettingsParallel::putBackToPort()
    219 {
    220     mPort.SetEnabled (mGbParallel->isChecked());
    221     mPort.SetIRQ (mLeIRQ->text().toULong (NULL, 0));
    222     mPort.SetIOBase (mLeIOPort->text().toULong (NULL, 0));
    223     mPort.SetPath (QDir::convertSeparators (mLePath->text()));
    224 }
    225 
    226 bool VBoxVMSettingsParallel::isUserDefined()
    227 {
    228     ulong a, b;
    229     return !vboxGlobal().toCOMPortNumbers (mCbNumber->currentText(), a, b);
    230 }
    231 
    232 QString VBoxVMSettingsParallel::pageTitle() const
    233 {
    234     QString pageTitle;
    235     if (!mPort.isNull())
    236         pageTitle = QString (tr ("Port %1", "parallel ports"))
    237             .arg (mPort.GetSlot());
    238     return pageTitle;
    239 }
    240 
     257void VBoxVMSettingsParallelPage::retranslateUi()
     258{
     259    for (int i = 0; i < mTabWidget->count(); ++ i)
     260    {
     261        VBoxVMSettingsParallel *page =
     262            static_cast<VBoxVMSettingsParallel*> (mTabWidget->widget (i));
     263        mTabWidget->setTabText (i, page->pageTitle());
     264    }
     265}
     266
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsSF.cpp

    r10112 r10167  
    2222
    2323#include "VBoxVMSettingsSF.h"
    24 #include "VBoxVMSettingsDlg.h"
    2524#include "VBoxGlobal.h"
    2625#include "VBoxProblemReporter.h"
     
    2928#include "VBoxToolBar.h"
    3029
    31 /* Qt includes */
    3230#include <QLineEdit>
    3331#include <QToolButton>
     
    174172
    175173
    176 VBoxVMSettingsSF* VBoxVMSettingsSF::mSettings = 0;
    177 
    178 VBoxVMSettingsSF::VBoxVMSettingsSF (QWidget *aParent, int aType)
    179     : QIWithRetranslateUI<QWidget> (aParent)
     174VBoxVMSettingsSF::VBoxVMSettingsSF (int aType, QWidget *aParent)
     175    : VBoxSettingsPage (aParent)
    180176    , mDialogType (aType)
    181177    , mIsListViewChanged (false)
     
    277273
    278274
    279 void VBoxVMSettingsSF::getFromMachineEx (const CMachine &aMachine,
    280                                          QWidget *aPage,
    281                                          VBoxVMSettingsDlg *aDlg)
    282 {
    283     mSettings = new VBoxVMSettingsSF (aPage, MachineType);
    284     QVBoxLayout *layout = new QVBoxLayout (aPage);
    285     layout->setContentsMargins (0, 0, 0, 0);
    286     layout->addWidget (mSettings);
    287     mSettings->getFromMachine (aMachine);
    288 
    289     /* Fixing Tab Order */
    290     setTabOrder (aDlg->mTwSelector, mSettings->mTreeView);
    291 }
    292 
    293 void VBoxVMSettingsSF::putBackToMachineEx()
    294 {
    295     mSettings->putBackToMachine();
    296 }
    297 
    298 
    299275void VBoxVMSettingsSF::getFromGlobal()
    300276{
     
    366342}
    367343
     344
     345void VBoxVMSettingsSF::getFrom (const CMachine &aMachine)
     346{
     347    getFromMachine (aMachine);
     348}
     349
     350void VBoxVMSettingsSF::putBackTo()
     351{
     352    putBackToMachine();
     353}
     354
     355void VBoxVMSettingsSF::setOrderAfter (QWidget *aWidget)
     356{
     357    setTabOrder (aWidget, mTreeView);
     358}
     359
    368360void VBoxVMSettingsSF::retranslateUi()
    369361{
     
    374366    mTrReadOnly = tr ("Read-only");
    375367}
     368
    376369
    377370void VBoxVMSettingsSF::addTriggered()
     
    487480
    488481void VBoxVMSettingsSF::processDoubleClick (QTreeWidgetItem *aItem,
    489                                                     int /* aColumn */)
     482                                           int /* aColumn */)
    490483{
    491484    bool editEnabled = aItem && aItem->parent() &&
     
    551544
    552545void VBoxVMSettingsSF::removeSharedFolder (const QString & aName,
    553                                                     const QString & aPath,
    554                                                     SFDialogType aType)
     546                                           const QString & aPath,
     547                                           SFDialogType aType)
    555548{
    556549    switch (aType)
     
    588581
    589582void VBoxVMSettingsSF::createSharedFolder (const QString & aName,
    590                                                     const QString & aPath,
    591                                                     bool aWritable,
    592                                                     SFDialogType aType)
     583                                           const QString & aPath,
     584                                           bool aWritable,
     585                                           SFDialogType aType)
    593586{
    594587    switch (aType)
     
    627620
    628621void VBoxVMSettingsSF::getFrom (const CSharedFolderEnumerator &aEn,
    629                                          SFTreeViewItem *aRoot)
     622                                SFTreeViewItem *aRoot)
    630623{
    631624    while (aEn.HasMore())
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsSerial.cpp

    r9751 r10167  
    2222
    2323#include "VBoxVMSettingsSerial.h"
    24 #include "VBoxVMSettingsDlg.h"
    2524#include "QIWidgetValidator.h"
    2625#include "VBoxGlobal.h"
    2726
    28 /* Qt includes */
    2927#include <QDir>
    3028
    31 QTabWidget* VBoxVMSettingsSerial::mTabWidget = 0;
    32 
    33 VBoxVMSettingsSerial::VBoxVMSettingsSerial(QWidget* aParent /* = NULL */)
    34     : QIWithRetranslateUI<QWidget> (aParent)
     29/* VBoxVMSettingsSerial stuff */
     30VBoxVMSettingsSerial::VBoxVMSettingsSerial()
     31    : QIWithRetranslateUI<QWidget> (0)
     32    , mValidator (0)
    3533{
    3634    /* Apply UI decorations */
     
    6462    connect (mCbMode, SIGNAL (activated (const QString &)),
    6563             this, SLOT (mCbModeActivated (const QString &)));
     64
    6665    /* Applying language settings */
    6766    retranslateUi();
    68 }
    69 
    70 void VBoxVMSettingsSerial::getFromMachine (const CMachine &aMachine,
    71                                            QWidget *aPage,
    72                                            VBoxVMSettingsDlg *aDlg,
    73                                            const QString &aPath)
    74 {
    75     /* TabWidget creation */
    76     mTabWidget = new QTabWidget (aPage);
    77     mTabWidget->setSizePolicy (QSizePolicy::Expanding,
    78                                QSizePolicy::Fixed);
    79     QVBoxLayout *layout = new QVBoxLayout (aPage);
    80     layout->setContentsMargins (0, 5, 0, 0);
    81     layout->addWidget (mTabWidget);
    82     layout->addStretch();
    83 
    84     /* Tab pages loading */
    85     ulong count = vboxGlobal().virtualBox().
    86                   GetSystemProperties().GetSerialPortCount();
    87     for (ulong slot = 0; slot < count; ++ slot)
    88     {
    89         CSerialPort port = aMachine.GetSerialPort (slot);
    90         VBoxVMSettingsSerial *page = new VBoxVMSettingsSerial();
    91         page->getFromPort (port);
    92         mTabWidget->addTab (page, page->pageTitle());
    93 
    94         /* Setup validation. */
    95         QIWidgetValidator *wval =
    96             new QIWidgetValidator (QString ("%1: %2").arg (aPath, page->pageTitle()),
    97                                    aPage, mTabWidget);
    98         connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)),
    99                  aDlg, SLOT (enableOk (const QIWidgetValidator *)));
    100         connect (wval, SIGNAL (isValidRequested (QIWidgetValidator *)),
    101                  aDlg, SLOT (revalidate (QIWidgetValidator *)));
    102 
    103         connect (page->mGbSerial, SIGNAL (toggled (bool)),
    104                  wval, SLOT (revalidate()));
    105         connect (page->mLeIRQ, SIGNAL (textChanged (const QString &)),
    106                  wval, SLOT (revalidate()));
    107         connect (page->mLeIOPort, SIGNAL (textChanged (const QString &)),
    108                  wval, SLOT (revalidate()));
    109         connect (page->mCbMode, SIGNAL (activated (const QString &)),
    110                  wval, SLOT (revalidate()));
    111 
    112         wval->revalidate();
    113     }
    114 }
    115 
    116 void VBoxVMSettingsSerial::putBackToMachine()
    117 {
    118     for (int index = 0; index < mTabWidget->count(); ++ index)
    119     {
    120         VBoxVMSettingsSerial *page =
    121             (VBoxVMSettingsSerial*) mTabWidget->widget (index);
    122         Assert (page);
    123         page->putBackToPort();
    124     }
    125 }
    126 
    127 void VBoxVMSettingsSerial::mGbSerialToggled (bool aOn)
    128 {
    129     if (aOn)
    130     {
    131         mCbNumberActivated (mCbNumber->currentText());
    132         mCbModeActivated (mCbMode->currentText());
    133     }
    134 }
    135 
    136 void VBoxVMSettingsSerial::mCbNumberActivated (const QString &aText)
    137 {
    138     ulong IRQ, IOBase;
    139     bool std = vboxGlobal().toCOMPortNumbers (aText, IRQ, IOBase);
    140 
    141     mLeIRQ->setEnabled (!std);
    142     mLeIOPort->setEnabled (!std);
    143     if (std)
    144     {
    145         mLeIRQ->setText (QString::number (IRQ));
    146         mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
    147     }
    148 }
    149 
    150 void VBoxVMSettingsSerial::mCbModeActivated (const QString &aText)
    151 {
    152     KPortMode mode = vboxGlobal().toPortMode (aText);
    153     mCbPipe->setEnabled (mode == KPortMode_HostPipe);
    154     mLePath->setEnabled (mode != KPortMode_Disconnected);
    155 }
    156 
    157 QString VBoxVMSettingsSerial::pageTitle() const
    158 {
    159     QString pageTitle;
    160     if (!mPort.isNull())
    161     {
    162         pageTitle = QString (tr ("Port %1", "serial ports"))
    163             .arg (mPort.GetSlot());
    164     }
    165     return pageTitle;
    16667}
    16768
     
    19697}
    19798
     99void VBoxVMSettingsSerial::setValidator (QIWidgetValidator *aVal)
     100{
     101    Assert (aVal);
     102    mValidator = aVal;
     103    connect (mLeIRQ, SIGNAL (textChanged (const QString &)),
     104             mValidator, SLOT (revalidate()));
     105    connect (mLeIOPort, SIGNAL (textChanged (const QString &)),
     106             mValidator, SLOT (revalidate()));
     107    connect (mLePath, SIGNAL (textChanged (const QString &)),
     108             mValidator, SLOT (revalidate()));
     109    mValidator->revalidate();
     110}
     111
     112QWidget* VBoxVMSettingsSerial::setOrderAfter (QWidget *aAfter)
     113{
     114    setTabOrder (aAfter, mGbSerial);
     115    setTabOrder (mGbSerial, mCbNumber);
     116    setTabOrder (mCbNumber, mLeIRQ);
     117    setTabOrder (mLeIRQ, mLeIOPort);
     118    setTabOrder (mLeIOPort, mCbMode);
     119    setTabOrder (mCbMode, mCbPipe);
     120    setTabOrder (mCbPipe, mLePath);
     121    return mLePath;
     122}
     123
     124QString VBoxVMSettingsSerial::pageTitle() const
     125{
     126    QString pageTitle;
     127    if (!mPort.isNull())
     128    {
     129        pageTitle = QString (tr ("Port %1", "serial ports"))
     130            .arg (mPort.GetSlot());
     131    }
     132    return pageTitle;
     133}
     134
    198135bool VBoxVMSettingsSerial::isUserDefined()
    199136{
     
    202139}
    203140
    204 
    205141void VBoxVMSettingsSerial::retranslateUi()
    206142{
    207143    /* Translate uic generated strings */
    208144    Ui::VBoxVMSettingsSerial::retranslateUi (this);
    209 
    210     mTabWidget->setTabText (mTabWidget->indexOf (this), pageTitle());
    211145
    212146    mCbNumber->setItemText (mCbNumber->count() - 1, vboxGlobal().toCOMPortName (0, 0));
     
    217151}
    218152
    219 
    220 bool VBoxVMSettingsSerial::revalidate (QString &aWarning, QString &aTitle)
     153void VBoxVMSettingsSerial::mGbSerialToggled (bool aOn)
     154{
     155    if (aOn)
     156    {
     157        mCbNumberActivated (mCbNumber->currentText());
     158        mCbModeActivated (mCbMode->currentText());
     159    }
     160    if (mValidator)
     161        mValidator->revalidate();
     162}
     163
     164void VBoxVMSettingsSerial::mCbNumberActivated (const QString &aText)
     165{
     166    ulong IRQ, IOBase;
     167    bool std = vboxGlobal().toCOMPortNumbers (aText, IRQ, IOBase);
     168
     169    mLeIRQ->setEnabled (!std);
     170    mLeIOPort->setEnabled (!std);
     171    if (std)
     172    {
     173        mLeIRQ->setText (QString::number (IRQ));
     174        mLeIOPort->setText ("0x" + QString::number (IOBase, 16).toUpper());
     175    }
     176}
     177
     178void VBoxVMSettingsSerial::mCbModeActivated (const QString &aText)
     179{
     180    KPortMode mode = vboxGlobal().toPortMode (aText);
     181    mCbPipe->setEnabled (mode == KPortMode_HostPipe);
     182    mLePath->setEnabled (mode != KPortMode_Disconnected);
     183    if (mValidator)
     184        mValidator->revalidate();
     185}
     186
     187
     188/* VBoxVMSettingsSerialPage stuff */
     189VBoxVMSettingsSerialPage::VBoxVMSettingsSerialPage()
     190    : mValidator (0)
     191{
     192    /* TabWidget creation */
     193    mTabWidget = new QTabWidget (this);
     194    mTabWidget->setSizePolicy (QSizePolicy::Expanding,
     195                               QSizePolicy::Fixed);
     196    QVBoxLayout *layout = new QVBoxLayout (this);
     197    layout->setContentsMargins (0, 5, 0, 5);
     198    layout->addWidget (mTabWidget);
     199    layout->addStretch();
     200
     201    /* Applying language settings */
     202    retranslateUi();
     203}
     204
     205void VBoxVMSettingsSerialPage::getFrom (const CMachine &aMachine)
     206{
     207    Assert (mFirstWidget);
     208    setTabOrder (mFirstWidget, mTabWidget->focusProxy());
     209    QWidget *lastFocusWidget = mTabWidget->focusProxy();
     210
     211    /* Tab pages loading */
     212    ulong count = vboxGlobal().virtualBox().
     213                  GetSystemProperties().GetSerialPortCount();
     214    for (ulong slot = 0; slot < count; ++ slot)
     215    {
     216        CSerialPort port = aMachine.GetSerialPort (slot);
     217        VBoxVMSettingsSerial *page = new VBoxVMSettingsSerial();
     218        page->getFromPort (port);
     219        mTabWidget->addTab (page, page->pageTitle());
     220        Assert (mValidator);
     221        page->setValidator (mValidator);
     222        lastFocusWidget = page->setOrderAfter (lastFocusWidget);
     223    }
     224}
     225
     226void VBoxVMSettingsSerialPage::putBackTo()
     227{
     228    for (int index = 0; index < mTabWidget->count(); ++ index)
     229    {
     230        VBoxVMSettingsSerial *page =
     231            (VBoxVMSettingsSerial*) mTabWidget->widget (index);
     232        Assert (page);
     233        page->putBackToPort();
     234    }
     235}
     236
     237void VBoxVMSettingsSerialPage::setValidator (QIWidgetValidator * aVal)
     238{
     239    mValidator = aVal;
     240}
     241
     242bool VBoxVMSettingsSerialPage::revalidate (QString &aWarning, QString &aTitle)
    221243{
    222244    bool valid = true;
     
    269291}
    270292
     293void VBoxVMSettingsSerialPage::retranslateUi()
     294{
     295    for (int i = 0; i < mTabWidget->count(); ++ i)
     296    {
     297        VBoxVMSettingsSerial *page =
     298            static_cast<VBoxVMSettingsSerial*> (mTabWidget->widget (i));
     299        mTabWidget->setTabText (i, page->pageTitle());
     300    }
     301}
     302
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsUSB.cpp

    r9889 r10167  
    2222
    2323#include "VBoxVMSettingsUSB.h"
    24 #include "VBoxGlobalSettingsDlg.h"
    25 #include "VBoxVMSettingsDlg.h"
    26 #include "VBoxVMSettingsUtils.h"
     24#include "VBoxSettingsUtils.h"
    2725#include "QIWidgetValidator.h"
    2826#include "VBoxToolBar.h"
    2927#include "VBoxGlobal.h"
    30 #include "VBoxProblemReporter.h"
     28
     29#include <QHeaderView>
    3130
    3231inline static QString emptyToNull (const QString &str)
     
    3534}
    3635
    37 VBoxVMSettingsUSB* VBoxVMSettingsUSB::mSettings = 0;
    38 
    39 void VBoxVMSettingsUSB::getFrom (QWidget *aPage,
    40                                  VBoxGlobalSettingsDlg *aDlg,
    41                                  const QString &aPath)
    42 {
    43     mSettings = new VBoxVMSettingsUSB (aPage, HostType, aDlg, aPath);
    44     QVBoxLayout *layout = new QVBoxLayout (aPage);
    45     layout->setContentsMargins (0, 0, 0, 0);
    46     layout->addWidget (mSettings);
    47 
    48     mSettings->getFromHost();
    49 
    50     /* Fixing tab-order */
    51     setTabOrder (aDlg->mTwSelector, mSettings->mTwFilters);
    52     setTabOrder (mSettings->mTwFilters, mSettings->mLeName);
    53     setTabOrder (mSettings->mLeName, mSettings->mLeVendorID);
    54     setTabOrder (mSettings->mLeVendorID, mSettings->mLeManufacturer);
    55     setTabOrder (mSettings->mLeManufacturer, mSettings->mLeProductID);
    56     setTabOrder (mSettings->mLeProductID, mSettings->mLeProduct);
    57     setTabOrder (mSettings->mLeProduct, mSettings->mLeRevision);
    58     setTabOrder (mSettings->mLeRevision, mSettings->mLeSerialNo);
    59     setTabOrder (mSettings->mLeSerialNo, mSettings->mLePort);
    60     setTabOrder (mSettings->mLePort, mSettings->mCbAction);
    61 }
    62 
    63 void VBoxVMSettingsUSB::getFrom (const CMachine &aMachine,
    64                                  QWidget *aPage,
    65                                  VBoxVMSettingsDlg *aDlg,
    66                                  const QString &aPath)
    67 {
    68     mSettings = new VBoxVMSettingsUSB (aPage, MachineType, aDlg, aPath);
    69     QVBoxLayout *layout = new QVBoxLayout (aPage);
    70     layout->setContentsMargins (0, 0, 0, 0);
    71     layout->addWidget (mSettings);
    72 
    73     mSettings->getFromMachine (aMachine);
    74 
    75     /* Fixing tab-order */
    76     setTabOrder (aDlg->mTwSelector, mSettings->mGbUSB);
    77     setTabOrder (mSettings->mGbUSB, mSettings->mCbUSB2);
    78     setTabOrder (mSettings->mCbUSB2, mSettings->mTwFilters);
    79     setTabOrder (mSettings->mTwFilters, mSettings->mLeName);
    80     setTabOrder (mSettings->mLeName, mSettings->mLeVendorID);
    81     setTabOrder (mSettings->mLeVendorID, mSettings->mLeManufacturer);
    82     setTabOrder (mSettings->mLeManufacturer, mSettings->mLeProductID);
    83     setTabOrder (mSettings->mLeProductID, mSettings->mLeProduct);
    84     setTabOrder (mSettings->mLeProduct, mSettings->mLeRevision);
    85     setTabOrder (mSettings->mLeRevision, mSettings->mLeSerialNo);
    86     setTabOrder (mSettings->mLeSerialNo, mSettings->mLePort);
    87     setTabOrder (mSettings->mLePort, mSettings->mCbRemote);
    88 }
    89 
    90 void VBoxVMSettingsUSB::putBackTo()
    91 {
    92     if (mSettings)
    93         mSettings->mType == MachineType ? mSettings->putBackToMachine() :
    94                                           mSettings->putBackToHost();
    95 }
    96 
    97 
    98 VBoxVMSettingsUSB::VBoxVMSettingsUSB (QWidget *aParent,
    99                                       FilterType aType,
    100                                       QWidget *aDlg,
    101                                       const QString &aPath)
    102     : QIWithRetranslateUI<QWidget> (aParent)
     36VBoxVMSettingsUSB::VBoxVMSettingsUSB (FilterType aType)
     37    : mValidator (0)
    10338    , mType (aType)
    10439{
    10540    /* Apply UI decorations */
    10641    Ui::VBoxVMSettingsUSB::setupUi (this);
    107 
    108     /* Setup validation */
    109     mValidator = new QIWidgetValidator (aPath, aParent, aDlg);
    110     connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator *)),
    111              aDlg, SLOT (enableOk (const QIWidgetValidator *)));
    11242
    11343    /* Prepare actions */
     
    14676
    14777    /* Prepare toolbar */
    148     VBoxToolBar *toolBar = new VBoxToolBar (mGbUSBFilters);
     78    VBoxToolBar *toolBar = new VBoxToolBar (mWtFilterHandler);
    14979    toolBar->setUsesTextLabel (false);
    15080    toolBar->setUsesBigPixmaps (false);
     
    15686    toolBar->addAction (mMdnAction);
    15787    toolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
    158     mGbUSBFilters->layout()->addWidget (toolBar);
     88    mWtFilterHandler->layout()->addWidget (toolBar);
    15989
    16090    /* Setup connections */
     
    16696             this, SLOT (showContextMenu (const QPoint &)));
    16797
    168     mUSBDevicesMenu = new VBoxUSBMenu (aParent);
     98    mUSBDevicesMenu = new VBoxUSBMenu (this);
    16999    connect (mUSBDevicesMenu, SIGNAL (triggered (QAction*)),
    170100             this, SLOT (addConfirmed (QAction *)));
     
    219149}
    220150
    221 VBoxVMSettingsUSB::~VBoxVMSettingsUSB()
    222 {
    223     mSettings = 0;
    224 }
    225 
    226 void VBoxVMSettingsUSB::getFromHost()
     151void VBoxVMSettingsUSB::getFrom (const CSystemProperties &, const VBoxGlobalSettings &)
    227152{
    228153    mGbUSB->setVisible (false);
     
    241166}
    242167
    243 void VBoxVMSettingsUSB::putBackToHost()
     168void VBoxVMSettingsUSB::putBackTo (CSystemProperties &, VBoxGlobalSettings &)
    244169{
    245170    CHost host = vboxGlobal().virtualBox().GetHost();
     
    266191}
    267192
    268 void VBoxVMSettingsUSB::getFromMachine (const CMachine &aMachine)
     193void VBoxVMSettingsUSB::getFrom (const CMachine &aMachine)
    269194{
    270195    mMachine = aMachine;
     
    283208}
    284209
    285 void VBoxVMSettingsUSB::putBackToMachine()
     210void VBoxVMSettingsUSB::putBackTo()
    286211{
    287212    CUSBController ctl = mMachine.GetUSBController();
     
    309234}
    310235
     236void VBoxVMSettingsUSB::setValidator (QIWidgetValidator *aVal)
     237{
     238    mValidator = aVal;
     239}
     240
     241void VBoxVMSettingsUSB::setOrderAfter (QWidget *aWidget)
     242{
     243    setTabOrder (aWidget, mGbUSB);
     244    setTabOrder (mGbUSB, mCbUSB2);
     245    setTabOrder (mCbUSB2, mTwFilters);
     246    setTabOrder (mTwFilters, mLeName);
     247    setTabOrder (mLeName, mLeVendorID);
     248    setTabOrder (mLeVendorID, mLeManufacturer);
     249    setTabOrder (mLeManufacturer, mLeProductID);
     250    setTabOrder (mLeProductID, mLeProduct);
     251    setTabOrder (mLeProduct, mLeRevision);
     252    setTabOrder (mLeRevision, mLeSerialNo);
     253    setTabOrder (mLeSerialNo, mLePort);
     254    setTabOrder (mLePort, mCbRemote);
     255    setTabOrder (mCbRemote, mCbAction);
     256}
    311257
    312258void VBoxVMSettingsUSB::retranslateUi()
     
    354300    mUSBFilterName = tr ("New Filter %1", "usb");
    355301}
    356 
    357302
    358303void VBoxVMSettingsUSB::usbAdapterToggled (bool aOn)
     
    443388    {
    444389        filter.SetName (aText);
    445         item->setText (lvUSBFilters_Name, aText);
     390        item->setText (twUSBFilters_Name, aText);
    446391    } else
    447392    if (sdr == mLeVendorID)
     
    493438    while (*iterator)
    494439    {
    495         QString filterName = (*iterator)->text (lvUSBFilters_Name);
     440        QString filterName = (*iterator)->text (twUSBFilters_Name);
    496441        int pos = regExp.indexIn (filterName);
    497442        if (pos != -1)
     
    600545        mLeRevision->setValidator (0);
    601546        mLePort->setValidator (0);
    602         mValidator->rescan();
    603         mValidator->revalidate();
     547        if (mValidator)
     548        {
     549            mValidator->rescan();
     550            mValidator->revalidate();
     551        }
    604552    }
    605553
     
    657605        new QTreeWidgetItem (mTwFilters);
    658606    item->setCheckState (0, aFilter.GetActive() ? Qt::Checked : Qt::Unchecked);
    659     item->setText (lvUSBFilters_Name, aFilter.GetName());
     607    item->setText (twUSBFilters_Name, aFilter.GetName());
    660608
    661609    /* Setup validators */
     
    667615        mLeRevision->setValidator (new QRegExpValidator (QRegExp ("[0-9]{0,4}"), this));
    668616        mLePort->setValidator (new QRegExpValidator (QRegExp ("[0-9]*"), this));
    669         mValidator->rescan();
     617        if (mValidator)
     618            mValidator->rescan();
    670619    }
    671620
     
    676625    }
    677626
    678     mValidator->revalidate();
    679 }
    680 
     627    if (mValidator)
     628        mValidator->revalidate();
     629}
     630
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsVRDP.cpp

    r9889 r10167  
    2222
    2323#include "VBoxVMSettingsVRDP.h"
    24 #include "VBoxVMSettingsDlg.h"
    25 #include "VBoxVMSettingsUtils.h"
    2624#include "VBoxGlobal.h"
    27 #include "VBoxProblemReporter.h"
    2825#include "QIWidgetValidator.h"
    2926
    30 VBoxVMSettingsVRDP* VBoxVMSettingsVRDP::mSettings = 0;
    31 
    32 VBoxVMSettingsVRDP::VBoxVMSettingsVRDP (QWidget *aParent,
    33                                         VBoxVMSettingsDlg *aDlg,
    34                                         const QString &aPath)
    35     : QIWithRetranslateUI<QWidget> (aParent)
     27VBoxVMSettingsVRDP::VBoxVMSettingsVRDP()
    3628{
    3729    /* Apply UI decorations */
     
    3931
    4032    /* Setup validation */
    41     mLeVRDPPort->setValidator (new QIntValidator (0, 0xFFFF, aDlg));
    42     mLeVRDPTimeout->setValidator (new QIntValidator (aDlg));
    43 
    44     mValidator = new QIWidgetValidator (aPath, aParent, aDlg);
    45     connect (mValidator, SIGNAL (validityChanged (const QIWidgetValidator*)),
    46              aDlg, SLOT (enableOk (const QIWidgetValidator*)));
    47     connect (mValidator, SIGNAL (isValidRequested (QIWidgetValidator*)),
    48              aDlg, SLOT (revalidate (QIWidgetValidator*)));
    49 
    50     /* Setup connections */
    51     connect (mGbVRDP, SIGNAL (toggled (bool)),
    52              mValidator, SLOT (revalidate()));
    53     connect (mLeVRDPPort, SIGNAL (textChanged (const QString&)),
    54              mValidator, SLOT (revalidate()));
    55     connect (mLeVRDPTimeout, SIGNAL (textChanged (const QString&)),
    56              mValidator, SLOT (revalidate()));
     33    mLeVRDPPort->setValidator (new QIntValidator (0, 0xFFFF, this));
     34    mLeVRDPTimeout->setValidator (new QIntValidator (this));
    5735
    5836    /* Setup dialog */
     
    6341    /* Applying language settings */
    6442    retranslateUi();
    65 }
    66 
    67 void VBoxVMSettingsVRDP::getFromMachine (const CMachine &aMachine,
    68                                          QWidget *aPage,
    69                                          VBoxVMSettingsDlg *aDlg,
    70                                          const QString &aPath)
    71 {
    72     mSettings = new VBoxVMSettingsVRDP (aPage, aDlg, aPath);
    73     QVBoxLayout *layout = new QVBoxLayout (aPage);
    74     layout->setContentsMargins (0, 0, 0, 0);
    75     layout->addWidget (mSettings);
    76 
    77     mSettings->getFrom (aMachine);
    78 
    79     /* Fixing Tab Order */
    80     setTabOrder (aDlg->mTwSelector, mSettings->mGbVRDP);
    81     setTabOrder (mSettings->mGbVRDP, mSettings->mLeVRDPPort);
    82     setTabOrder (mSettings->mLeVRDPPort, mSettings->mCbVRDPMethod);
    83     setTabOrder (mSettings->mCbVRDPMethod, mSettings->mLeVRDPTimeout);
    84 }
    85 
    86 void VBoxVMSettingsVRDP::putBackToMachine()
    87 {
    88     if (mSettings)
    89         mSettings->putBackTo();
    9043}
    9144
     
    11164}
    11265
     66void VBoxVMSettingsVRDP::setValidator (QIWidgetValidator *aVal)
     67{
     68    mValidator = aVal;
     69    connect (mGbVRDP, SIGNAL (toggled (bool)),
     70             mValidator, SLOT (revalidate()));
     71    connect (mLeVRDPPort, SIGNAL (textChanged (const QString&)),
     72             mValidator, SLOT (revalidate()));
     73    connect (mLeVRDPTimeout, SIGNAL (textChanged (const QString&)),
     74             mValidator, SLOT (revalidate()));
     75}
     76
     77void VBoxVMSettingsVRDP::setOrderAfter (QWidget *aWidget)
     78{
     79    setTabOrder (aWidget, mGbVRDP);
     80    setTabOrder (mGbVRDP, mLeVRDPPort);
     81    setTabOrder (mLeVRDPPort, mCbVRDPMethod);
     82    setTabOrder (mCbVRDPMethod, mLeVRDPTimeout);
     83}
    11384
    11485void VBoxVMSettingsVRDP::retranslateUi()
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsAudio.ui

    r9654 r10167  
    3838   </property>
    3939   <property name="bottomMargin" >
    40     <number>0</number>
     40    <number>5</number>
    4141   </property>
    4242   <item>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsCD.ui

    r9654 r10167  
    3838   </property>
    3939   <property name="bottomMargin" >
    40     <number>0</number>
     40    <number>5</number>
    4141   </property>
    4242   <item>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsFD.ui

    r9654 r10167  
    3838   </property>
    3939   <property name="bottomMargin" >
    40     <number>0</number>
     40    <number>5</number>
    4141   </property>
    4242   <item>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsGeneral.ui

    r9751 r10167  
    2323    <x>0</x>
    2424    <y>0</y>
    25     <width>647</width>
    26     <height>548</height>
     25    <width>624</width>
     26    <height>420</height>
    2727   </rect>
    2828  </property>
     
    3838   </property>
    3939   <property name="bottomMargin" >
    40     <number>0</number>
     40    <number>5</number>
    4141   </property>
    4242   <item>
     
    935935   <class>BootItemsTable</class>
    936936   <extends>QTreeWidget</extends>
    937    <header>VBoxVMSettingsUtils.h</header>
     937   <header>VBoxSettingsUtils.h</header>
    938938  </customwidget>
    939939 </customwidgets>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsHD.ui

    r9781 r10167  
    3838   </property>
    3939   <property name="bottomMargin" >
    40     <number>0</number>
     40    <number>5</number>
    4141   </property>
    4242   <item>
     
    7474           </property>
    7575           <property name="whatsThis" >
    76             <string>Lists all hard disks attached to this machine. Use a mouse click or the &lt;tt>F2&lt;/tt> key on the highlighted item to activate the drop-down list and choose the desired value. Use the context menu or buttons to the right to add or remove hard disk attachments.</string>
     76            <string>Lists all hard disks attached to this machine. Use a mouse click or the F2 key on the highlighted item to activate the drop-down list and choose the desired value. Use the context menu or buttons to the right to add or remove hard disk attachments.</string>
    7777           </property>
    7878           <property name="horizontalScrollBarPolicy" >
     
    111111   <class>QITableView</class>
    112112   <extends>QTableView</extends>
    113    <header>VBoxVMSettingsUtils.h</header>
     113   <header>VBoxSettingsUtils.h</header>
    114114  </customwidget>
    115115 </customwidgets>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsParallel.ui

    r9781 r10167  
    2323    <x>0</x>
    2424    <y>0</y>
    25     <width>353</width>
     25    <width>378</width>
    2626    <height>163</height>
    2727   </rect>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsSF.ui

    r9970 r10167  
    4444   </property>
    4545   <property name="bottomMargin" >
    46     <number>0</number>
     46    <number>5</number>
    4747   </property>
    4848   <item>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsSerial.ui

    r9781 r10167  
    2323    <x>0</x>
    2424    <y>0</y>
    25     <width>352</width>
     25    <width>379</width>
    2626    <height>163</height>
    2727   </rect>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsUSB.ui

    r9827 r10167  
    2323    <x>0</x>
    2424    <y>0</y>
    25     <width>402</width>
     25    <width>392</width>
    2626    <height>424</height>
    2727   </rect>
     
    3838   </property>
    3939   <property name="bottomMargin" >
    40     <number>0</number>
     40    <number>5</number>
    4141   </property>
    4242   <item>
     
    7676      <string>USB Device &amp;Filters</string>
    7777     </property>
    78      <layout class="QHBoxLayout" >
     78     <layout class="QVBoxLayout" >
    7979      <property name="topMargin" >
    8080       <number>5</number>
    8181      </property>
    8282      <item>
    83        <widget class="QTreeWidget" name="mTwFilters" >
    84         <property name="contextMenuPolicy" >
    85          <enum>Qt::CustomContextMenu</enum>
    86         </property>
    87         <property name="whatsThis" >
    88          <string>Lists all USB filters of this machine. The checkbox to the left defines whether the particular filter is enabled or not. Use the context menu or buttons to the right to add or remove USB filters.</string>
    89         </property>
    90         <property name="rootIsDecorated" >
    91          <bool>false</bool>
    92         </property>
    93         <column>
    94          <property name="text" >
    95           <string>[filter]</string>
    96          </property>
    97         </column>
     83       <widget class="QWidget" native="1" name="mWtFilterHandler" >
     84        <layout class="QHBoxLayout" >
     85         <property name="leftMargin" >
     86          <number>0</number>
     87         </property>
     88         <property name="topMargin" >
     89          <number>0</number>
     90         </property>
     91         <property name="rightMargin" >
     92          <number>0</number>
     93         </property>
     94         <property name="bottomMargin" >
     95          <number>0</number>
     96         </property>
     97         <item>
     98          <widget class="QTreeWidget" name="mTwFilters" >
     99           <property name="contextMenuPolicy" >
     100            <enum>Qt::CustomContextMenu</enum>
     101           </property>
     102           <property name="whatsThis" >
     103            <string>Lists all USB filters of this machine. The checkbox to the left defines whether the particular filter is enabled or not. Use the context menu or buttons to the right to add or remove USB filters.</string>
     104           </property>
     105           <property name="rootIsDecorated" >
     106            <bool>false</bool>
     107           </property>
     108           <column>
     109            <property name="text" >
     110             <string>[filter]</string>
     111            </property>
     112           </column>
     113          </widget>
     114         </item>
     115        </layout>
    98116       </widget>
    99117      </item>
    100      </layout>
    101     </widget>
    102    </item>
    103    <item>
    104     <widget class="QWidget" native="1" name="mWtProperties" >
    105      <layout class="QVBoxLayout" >
    106       <property name="leftMargin" >
    107        <number>0</number>
    108       </property>
    109       <property name="topMargin" >
    110        <number>0</number>
    111       </property>
    112       <property name="rightMargin" >
    113        <number>0</number>
    114       </property>
    115       <property name="bottomMargin" >
    116        <number>0</number>
    117       </property>
    118118      <item>
    119        <layout class="QHBoxLayout" >
    120         <item>
    121          <widget class="QLabel" name="mLbName" >
    122           <property name="text" >
    123            <string>&amp;Name</string>
    124           </property>
    125           <property name="buddy" >
    126            <cstring>mLeName</cstring>
    127           </property>
    128          </widget>
    129         </item>
    130         <item>
    131          <widget class="QLineEdit" name="mLeName" >
    132           <property name="whatsThis" >
    133            <string>Displays the filter name.</string>
    134           </property>
    135          </widget>
    136         </item>
    137        </layout>
    138       </item>
    139       <item>
    140        <layout class="QGridLayout" >
    141         <item row="0" column="0" >
    142          <widget class="QLabel" name="mLbVendorID" >
    143           <property name="text" >
    144            <string>&amp;Vendor ID</string>
    145           </property>
    146           <property name="buddy" >
    147            <cstring>mLeVendorID</cstring>
    148           </property>
    149          </widget>
    150         </item>
    151         <item row="0" column="1" >
    152          <widget class="QLineEdit" name="mLeVendorID" >
    153           <property name="whatsThis" >
    154            <string>Defines the vendor ID filter. The &lt;i>exact match&lt;/i> string format is &lt;tt>XXXX&lt;/tt> where &lt;tt>X&lt;/tt> is a hexadecimal digit. An empty string will match any value.</string>
    155           </property>
    156          </widget>
    157         </item>
    158         <item row="0" column="2" >
    159          <widget class="QLabel" name="mLbManufacturer" >
    160           <property name="text" >
    161            <string>&amp;Manufacturer</string>
    162           </property>
    163           <property name="buddy" >
    164            <cstring>mLeManufacturer</cstring>
    165           </property>
    166          </widget>
    167         </item>
    168         <item row="0" column="3" >
    169          <widget class="QLineEdit" name="mLeManufacturer" >
    170           <property name="whatsThis" >
    171            <string>Defines the manufacturer filter as an &lt;i>exact match&lt;/i> string. An empty string will match any value.</string>
    172           </property>
    173          </widget>
    174         </item>
    175         <item row="1" column="0" >
    176          <widget class="QLabel" name="mLbProductID" >
    177           <property name="text" >
    178            <string>&amp;Product ID</string>
    179           </property>
    180           <property name="buddy" >
    181            <cstring>mLeProductID</cstring>
    182           </property>
    183          </widget>
    184         </item>
    185         <item row="1" column="1" >
    186          <widget class="QLineEdit" name="mLeProductID" >
    187           <property name="whatsThis" >
    188            <string>Defines the product ID filter. The &lt;i>exact match&lt;/i> string format is &lt;tt>XXXX&lt;/tt> where &lt;tt>X&lt;/tt> is a hexadecimal digit. An empty string will match any value.</string>
    189           </property>
    190          </widget>
    191         </item>
    192         <item row="1" column="2" >
    193          <widget class="QLabel" name="mLbProduct" >
    194           <property name="text" >
    195            <string>Pro&amp;duct</string>
    196           </property>
    197           <property name="buddy" >
    198            <cstring>mLeProduct</cstring>
    199           </property>
    200          </widget>
    201         </item>
    202         <item row="1" column="3" >
    203          <widget class="QLineEdit" name="mLeProduct" >
    204           <property name="whatsThis" >
    205            <string>Defines the product name filter as an &lt;i>exact match&lt;/i> string. An empty string will match any value.</string>
    206           </property>
    207          </widget>
    208         </item>
    209         <item row="2" column="0" >
    210          <widget class="QLabel" name="mLbRevision" >
    211           <property name="text" >
    212            <string>&amp;Revision</string>
    213           </property>
    214           <property name="buddy" >
    215            <cstring>mLeRevision</cstring>
    216           </property>
    217          </widget>
    218         </item>
    219         <item row="2" column="1" >
    220          <widget class="QLineEdit" name="mLeRevision" >
    221           <property name="whatsThis" >
    222            <string>Defines the revision number filter. The &lt;i>exact match&lt;/i> string format is &lt;tt>IIFF&lt;/tt> where &lt;tt>I&lt;/tt> is a decimal digit of the integer part and &lt;tt>F&lt;/tt> is a decimal digit of the fractional part. An empty string will match any value.</string>
    223           </property>
    224          </widget>
    225         </item>
    226         <item row="2" column="2" >
    227          <widget class="QLabel" name="mLbSerialNo" >
    228           <property name="text" >
    229            <string>&amp;Serial No.</string>
    230           </property>
    231           <property name="buddy" >
    232            <cstring>mLeSerialNo</cstring>
    233           </property>
    234          </widget>
    235         </item>
    236         <item row="2" column="3" >
    237          <widget class="QLineEdit" name="mLeSerialNo" >
    238           <property name="whatsThis" >
    239            <string>Defines the serial number filter as an &lt;i>exact match&lt;/i> string. An empty string will match any value.</string>
    240           </property>
    241          </widget>
    242         </item>
    243         <item row="3" column="0" >
    244          <widget class="QLabel" name="mLbPort" >
    245           <property name="text" >
    246            <string>Por&amp;t</string>
    247           </property>
    248           <property name="buddy" >
    249            <cstring>mLePort</cstring>
    250           </property>
    251          </widget>
    252         </item>
    253         <item row="3" column="1" >
    254          <widget class="QLineEdit" name="mLePort" >
    255           <property name="whatsThis" >
    256            <string>Defines the host USB port filter as an &lt;i>exact match&lt;/i> string. An empty string will match any value.</string>
    257           </property>
    258          </widget>
    259         </item>
    260         <item row="3" column="2" >
    261          <layout class="QVBoxLayout" >
    262           <item>
    263            <widget class="QLabel" name="mLbRemote" >
    264             <property name="text" >
    265              <string>R&amp;emote</string>
    266             </property>
    267             <property name="buddy" >
    268              <cstring>mCbRemote</cstring>
    269             </property>
    270            </widget>
    271           </item>
    272           <item>
    273            <widget class="QLabel" name="mLbAction" >
    274             <property name="text" >
    275              <string>&amp;Action</string>
    276             </property>
    277             <property name="buddy" >
    278              <cstring>mCbAction</cstring>
    279             </property>
    280            </widget>
    281           </item>
    282          </layout>
    283         </item>
    284         <item row="3" column="3" >
    285          <layout class="QVBoxLayout" >
    286           <item>
    287            <widget class="QComboBox" name="mCbRemote" >
    288             <property name="sizePolicy" >
    289              <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
    290               <horstretch>0</horstretch>
    291               <verstretch>0</verstretch>
    292              </sizepolicy>
    293             </property>
    294             <property name="whatsThis" >
    295              <string>Defines whether this filter applies to USB devices attached locally to the host computer (&lt;i>No&lt;/i>), to a VRDP client's computer (&lt;i>Yes&lt;/i>), or both (&lt;i>Any&lt;/i>).</string>
    296             </property>
    297            </widget>
    298           </item>
    299           <item>
    300            <widget class="QComboBox" name="mCbAction" >
    301             <property name="sizePolicy" >
    302              <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
    303               <horstretch>0</horstretch>
    304               <verstretch>0</verstretch>
    305              </sizepolicy>
    306             </property>
    307             <property name="whatsThis" >
    308              <string>Defines an action performed by the host computer when a matching device is attached: give it up to the host OS (&lt;i>Ignore&lt;/i>) or grab it for later usage by virtual machines (&lt;i>Hold&lt;/i>).</string>
    309             </property>
    310            </widget>
    311           </item>
    312          </layout>
    313         </item>
    314        </layout>
     119       <widget class="QWidget" native="1" name="mWtProperties" >
     120        <layout class="QVBoxLayout" >
     121         <property name="leftMargin" >
     122          <number>0</number>
     123         </property>
     124         <property name="topMargin" >
     125          <number>0</number>
     126         </property>
     127         <property name="rightMargin" >
     128          <number>0</number>
     129         </property>
     130         <property name="bottomMargin" >
     131          <number>0</number>
     132         </property>
     133         <item>
     134          <layout class="QHBoxLayout" >
     135           <item>
     136            <widget class="QLabel" name="mLbName" >
     137             <property name="text" >
     138              <string>&amp;Name</string>
     139             </property>
     140             <property name="buddy" >
     141              <cstring>mLeName</cstring>
     142             </property>
     143            </widget>
     144           </item>
     145           <item>
     146            <widget class="QLineEdit" name="mLeName" >
     147             <property name="whatsThis" >
     148              <string>Displays the filter name.</string>
     149             </property>
     150            </widget>
     151           </item>
     152          </layout>
     153         </item>
     154         <item>
     155          <layout class="QGridLayout" >
     156           <item row="0" column="0" >
     157            <widget class="QLabel" name="mLbVendorID" >
     158             <property name="text" >
     159              <string>&amp;Vendor ID</string>
     160             </property>
     161             <property name="buddy" >
     162              <cstring>mLeVendorID</cstring>
     163             </property>
     164            </widget>
     165           </item>
     166           <item row="0" column="1" >
     167            <widget class="QLineEdit" name="mLeVendorID" >
     168             <property name="whatsThis" >
     169              <string>Defines the vendor ID filter. The &lt;i>exact match&lt;/i> string format is &lt;tt>XXXX&lt;/tt> where &lt;tt>X&lt;/tt> is a hexadecimal digit. An empty string will match any value.</string>
     170             </property>
     171            </widget>
     172           </item>
     173           <item row="0" column="2" >
     174            <widget class="QLabel" name="mLbManufacturer" >
     175             <property name="text" >
     176              <string>&amp;Manufacturer</string>
     177             </property>
     178             <property name="buddy" >
     179              <cstring>mLeManufacturer</cstring>
     180             </property>
     181            </widget>
     182           </item>
     183           <item row="0" column="3" >
     184            <widget class="QLineEdit" name="mLeManufacturer" >
     185             <property name="whatsThis" >
     186              <string>Defines the manufacturer filter as an &lt;i>exact match&lt;/i> string. An empty string will match any value.</string>
     187             </property>
     188            </widget>
     189           </item>
     190           <item row="1" column="0" >
     191            <widget class="QLabel" name="mLbProductID" >
     192             <property name="text" >
     193              <string>&amp;Product ID</string>
     194             </property>
     195             <property name="buddy" >
     196              <cstring>mLeProductID</cstring>
     197             </property>
     198            </widget>
     199           </item>
     200           <item row="1" column="1" >
     201            <widget class="QLineEdit" name="mLeProductID" >
     202             <property name="whatsThis" >
     203              <string>Defines the product ID filter. The &lt;i>exact match&lt;/i> string format is &lt;tt>XXXX&lt;/tt> where &lt;tt>X&lt;/tt> is a hexadecimal digit. An empty string will match any value.</string>
     204             </property>
     205            </widget>
     206           </item>
     207           <item row="1" column="2" >
     208            <widget class="QLabel" name="mLbProduct" >
     209             <property name="text" >
     210              <string>Pro&amp;duct</string>
     211             </property>
     212             <property name="buddy" >
     213              <cstring>mLeProduct</cstring>
     214             </property>
     215            </widget>
     216           </item>
     217           <item row="1" column="3" >
     218            <widget class="QLineEdit" name="mLeProduct" >
     219             <property name="whatsThis" >
     220              <string>Defines the product name filter as an &lt;i>exact match&lt;/i> string. An empty string will match any value.</string>
     221             </property>
     222            </widget>
     223           </item>
     224           <item row="2" column="0" >
     225            <widget class="QLabel" name="mLbRevision" >
     226             <property name="text" >
     227              <string>&amp;Revision</string>
     228             </property>
     229             <property name="buddy" >
     230              <cstring>mLeRevision</cstring>
     231             </property>
     232            </widget>
     233           </item>
     234           <item row="2" column="1" >
     235            <widget class="QLineEdit" name="mLeRevision" >
     236             <property name="whatsThis" >
     237              <string>Defines the revision number filter. The &lt;i>exact match&lt;/i> string format is &lt;tt>IIFF&lt;/tt> where &lt;tt>I&lt;/tt> is a decimal digit of the integer part and &lt;tt>F&lt;/tt> is a decimal digit of the fractional part. An empty string will match any value.</string>
     238             </property>
     239            </widget>
     240           </item>
     241           <item row="2" column="2" >
     242            <widget class="QLabel" name="mLbSerialNo" >
     243             <property name="text" >
     244              <string>&amp;Serial No.</string>
     245             </property>
     246             <property name="buddy" >
     247              <cstring>mLeSerialNo</cstring>
     248             </property>
     249            </widget>
     250           </item>
     251           <item row="2" column="3" >
     252            <widget class="QLineEdit" name="mLeSerialNo" >
     253             <property name="whatsThis" >
     254              <string>Defines the serial number filter as an &lt;i>exact match&lt;/i> string. An empty string will match any value.</string>
     255             </property>
     256            </widget>
     257           </item>
     258           <item row="3" column="0" >
     259            <widget class="QLabel" name="mLbPort" >
     260             <property name="text" >
     261              <string>Por&amp;t</string>
     262             </property>
     263             <property name="buddy" >
     264              <cstring>mLePort</cstring>
     265             </property>
     266            </widget>
     267           </item>
     268           <item row="3" column="1" >
     269            <widget class="QLineEdit" name="mLePort" >
     270             <property name="whatsThis" >
     271              <string>Defines the host USB port filter as an &lt;i>exact match&lt;/i> string. An empty string will match any value.</string>
     272             </property>
     273            </widget>
     274           </item>
     275           <item row="3" column="2" >
     276            <layout class="QVBoxLayout" >
     277             <item>
     278              <widget class="QLabel" name="mLbRemote" >
     279               <property name="text" >
     280                <string>R&amp;emote</string>
     281               </property>
     282               <property name="buddy" >
     283                <cstring>mCbRemote</cstring>
     284               </property>
     285              </widget>
     286             </item>
     287             <item>
     288              <widget class="QLabel" name="mLbAction" >
     289               <property name="text" >
     290                <string>&amp;Action</string>
     291               </property>
     292               <property name="buddy" >
     293                <cstring>mCbAction</cstring>
     294               </property>
     295              </widget>
     296             </item>
     297            </layout>
     298           </item>
     299           <item row="3" column="3" >
     300            <layout class="QVBoxLayout" >
     301             <item>
     302              <widget class="QComboBox" name="mCbRemote" >
     303               <property name="sizePolicy" >
     304                <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
     305                 <horstretch>0</horstretch>
     306                 <verstretch>0</verstretch>
     307                </sizepolicy>
     308               </property>
     309               <property name="whatsThis" >
     310                <string>Defines whether this filter applies to USB devices attached locally to the host computer (&lt;i>No&lt;/i>), to a VRDP client's computer (&lt;i>Yes&lt;/i>), or both (&lt;i>Any&lt;/i>).</string>
     311               </property>
     312              </widget>
     313             </item>
     314             <item>
     315              <widget class="QComboBox" name="mCbAction" >
     316               <property name="sizePolicy" >
     317                <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
     318                 <horstretch>0</horstretch>
     319                 <verstretch>0</verstretch>
     320                </sizepolicy>
     321               </property>
     322               <property name="whatsThis" >
     323                <string>Defines an action performed by the host computer when a matching device is attached: give it up to the host OS (&lt;i>Ignore&lt;/i>) or grab it for later usage by virtual machines (&lt;i>Hold&lt;/i>).</string>
     324               </property>
     325              </widget>
     326             </item>
     327            </layout>
     328           </item>
     329          </layout>
     330         </item>
     331        </layout>
     332       </widget>
    315333      </item>
    316334     </layout>
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsVRDP.ui

    r9654 r10167  
    3838   </property>
    3939   <property name="bottomMargin" >
    40     <number>0</number>
     40    <number>5</number>
    4141   </property>
    4242   <item>
Note: See TracChangeset for help on using the changeset viewer.

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