VirtualBox

Ignore:
Timestamp:
Jul 10, 2008 1:16:45 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: Added an interface class for the settings selector. Implemented the
classical tree view approach.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
2 added
8 edited

Legend:

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

    r10462 r10468  
    573573        include/VBoxSettingsDialog.h \
    574574        include/VBoxSettingsDialogSpecific.h \
    575         include/VBoxSettingsPage.h
     575        include/VBoxSettingsPage.h \
     576        include/VBoxSettingsSelector.h
    576577
    577578# Sources containing local definitions of classes that use the Q_OBJECT macro.
     
    641642        src/VBoxGLSettingsLanguage.cpp \
    642643        src/VBoxSettingsDialog.cpp \
    643         src/VBoxSettingsDialogSpecific.cpp
     644        src/VBoxSettingsDialogSpecific.cpp \
     645        src/VBoxSettingsSelector.cpp
    644646
    645647ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsDialog.h

    r10212 r10468  
    3030class VBoxWarnIconLabel;
    3131class QIWidgetValidator;
     32class VBoxSettingsSelector;
    3233class QTimer;
    3334class QStackedWidget;
     
    4445public:
    4546
    46     VBoxSettingsDialog (QWidget *aParent);
     47    VBoxSettingsDialog (QWidget *aParent = NULL);
    4748
    4849    virtual void getFrom() = 0;
     
    5253
    5354    virtual void revalidate (QIWidgetValidator * /* aWval */) {}
    54     void settingsGroupChanged (QTreeWidgetItem *aItem,
    55                                QTreeWidgetItem *aPrev = 0);
    5655
    5756protected:
    5857
    59     static QTreeWidgetItem* findItem (QTreeWidget *aView,
    60                                       const QString &aMatch,
    61                                       int aColumn);
    62 
    6358    virtual void retranslateUi();
    6459
    65     QString pagePath (QWidget *aPage);
    6660    void setWarning (const QString &aWarning);
    6761
     62    VBoxSettingsSelector *mSelector;
    6863    QStackedWidget *mStack;
    6964
     
    7368    void updateWhatsThis (bool aGotFocus = false);
    7469    void whatsThisCandidateDestroyed (QObject *aObj = 0);
     70
     71    void categoryChanged (int aId);
    7572
    7673private:
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsDialogSpecific.h

    r10212 r10468  
    4040public:
    4141
     42    enum GLSettingsPageIds
     43    {
     44        GeneralId = 0,
     45        InputId,
     46        LanguageId,
     47        USBId
     48    };
     49
    4250    VBoxGLSettingsDlg (QWidget *aParent);
    4351
     
    6472
    6573public:
     74
     75    enum VMSettingsPageIds
     76    {
     77        GeneralId = 0,
     78        HDId,
     79        CDId,
     80        FDId,
     81        AudioId,
     82        NetworkId,
     83        SerialId,
     84        ParallelId,
     85        USBId,
     86        SFId,
     87        VRDPId
     88    };
    6689
    6790    VBoxVMSettingsDlg (QWidget *aParent, const CMachine &aMachine,
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsPage.h

    r10212 r10468  
    6262    QWidget *mFirstWidget;
    6363};
     64
    6465#endif // __VBoxSettingsPage_h__
    6566
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsUtils.h

    r10167 r10468  
    2626#include <VBoxGlobal.h>
    2727
     28/* Qt includes */
    2829#ifdef Q_WS_WIN
    2930#include <QDialog>
     
    4041enum
    4142{
    42     /* mTwSelector column numbers */
    43     treeWidget_Category = 0,
    44     treeWidget_Id = 1,
    45     treeWidget_Link = 2,
    46 
    4743    /* mTwUSBFilters column numbers */
    4844    twUSBFilters_Name = 0,
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSettingsDialog.cpp

    r10376 r10468  
    66
    77/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2626#include "VBoxProblemReporter.h"
    2727#include "QIWidgetValidator.h"
     28#include "VBoxSettingsSelector.h"
    2829
    2930#ifdef Q_WS_MAC
     
    3637#include <QStackedWidget>
    3738
    38 /* Returns the path to the item in the form of 'grandparent > parent > item'
    39  * using the text of the first column of every item. */
    40 static QString path (QTreeWidgetItem *aItem)
    41 {
    42     static QString sep = ": ";
    43     QString p;
    44     QTreeWidgetItem *cur = aItem;
    45     while (cur)
    46     {
    47         if (!p.isNull())
    48             p = sep + p;
    49         p = cur->text (treeWidget_Category).simplified() + p;
    50         cur = cur->parent();
    51     }
    52     return p;
    53 }
    54 
    55 VBoxSettingsDialog::VBoxSettingsDialog (QWidget *aParent)
     39VBoxSettingsDialog::VBoxSettingsDialog (QWidget *aParent /* = NULL */)
    5640    : QIWithRetranslateUI<QIMainDialog> (aParent)
    5741    , mPolished (false)
     
    7761    mLbTitle->setFont (f);
    7862
    79     /* Hide unnecessary columns and header */
    80     mTwSelector->header()->hide();
    81     mTwSelector->hideColumn (treeWidget_Id);
    82     mTwSelector->hideColumn (treeWidget_Link);
    83 
    84     /* Crating stack of pages */
     63    /* Create the classical tree view selector */
     64    mSelector = new VBoxSettingsTreeSelector (mAllWidget);
     65    QGridLayout *mainLayout = static_cast<QGridLayout*> (mAllWidget->layout());
     66    mainLayout->addWidget (mSelector->widget(), 0, 0, 3, 1);
     67    mSelector->widget()->setFocus();
     68
     69    /* Creating stack of pages */
    8570    mStack = new QStackedWidget (mWtStackHandler);
    8671    QVBoxLayout *layout = new QVBoxLayout (mWtStackHandler);
     
    10994    connect (mButtonBox, SIGNAL (rejected()), this, SLOT (reject()));
    11095    connect (mButtonBox, SIGNAL (helpRequested()), &vboxProblem(), SLOT (showHelpHelpDialog()));
    111     connect (mTwSelector, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
    112              this, SLOT (settingsGroupChanged (QTreeWidgetItem *, QTreeWidgetItem*)));
     96    connect (mSelector, SIGNAL (categoryChanged (int)),
     97             this, SLOT (categoryChanged (int)));
    11398
    11499    /* Applying language settings */
     
    120105    /* Translate uic generated strings */
    121106    Ui::VBoxSettingsDialog::retranslateUi (this);
    122 
    123     /* Adjust selector list */
    124     mTwSelector->setFixedWidth (static_cast<QAbstractItemView*> (mTwSelector)
    125         ->sizeHintForColumn (treeWidget_Category) + 2 * mTwSelector->frameWidth());
    126 
    127     /* Sort selector by the id column */
    128     mTwSelector->sortItems (treeWidget_Id, Qt::AscendingOrder);
    129     mTwSelector->resizeColumnToContents (treeWidget_Category);
    130 
    131     mWarnIconLabel->setWarningText (tr ("Invalid settings detected"));
    132     mButtonBox->button (QDialogButtonBox::Ok)
    133         ->setWhatsThis (tr ("Accepts (saves) changes and closes the dialog."));
    134     mButtonBox->button (QDialogButtonBox::Cancel)
    135         ->setWhatsThis (tr ("Cancels changes and closes the dialog."));
    136     mButtonBox->button (QDialogButtonBox::Help)
    137         ->setWhatsThis (tr ("Displays the dialog help."));
    138107
    139108    /* Revalidate all pages to retranslate the warning messages also. */
     
    142111        if (!wval->isValid())
    143112            revalidate (wval);
    144 
    145     /* Add some margin to every item in the tree */
    146     mTwSelector->addTopBottomMarginToItems (12);
    147 }
    148 
    149 /**
    150  *  Returns a path to the given page of this settings dialog. See ::path() for
    151  *  details.
    152  */
    153 QString VBoxSettingsDialog::pagePath (QWidget *aPage)
    154 {
    155     QTreeWidgetItem *li =
    156         findItem (mTwSelector,
    157                   QString ("%1")
    158                       .arg (mStack->indexOf (aPage), 2, 10, QChar ('0')),
    159                   treeWidget_Id);
    160     return ::path (li);
    161113}
    162114
     
    213165}
    214166
    215 void VBoxSettingsDialog::settingsGroupChanged (QTreeWidgetItem *aItem,
    216                                                QTreeWidgetItem *)
    217 {
    218     if (aItem)
    219     {
    220         int id = aItem->text (treeWidget_Id).toInt();
    221         Assert (id >= 0);
    222 
     167void VBoxSettingsDialog::categoryChanged (int aId)
     168{
    223169//#ifndef Q_WS_MAC
    224170#if 1
    225         mLbTitle->setText (::path (aItem));
    226         mStack->setCurrentIndex (id);
     171        mLbTitle->setText (mSelector->itemText (aId));
     172        mStack->setCurrentIndex (aId);
    227173#else /* Q_WS_MAC */
    228174        /* We will update at once later */
     
    248194        setFixedSize (minimumSizeHint());
    249195#endif /* !Q_WS_MAC */
    250     }
    251 }
    252 
    253 /* Returns first item of 'aView' matching required 'aMatch' value
    254  * searching the 'aColumn' column. */
    255 QTreeWidgetItem* VBoxSettingsDialog::findItem (QTreeWidget *aView,
    256                                                const QString &aMatch,
    257                                                int aColumn)
    258 {
    259     QList<QTreeWidgetItem*> list =
    260         aView->findItems (aMatch, Qt::MatchExactly, aColumn);
    261 
    262     return list.count() ? list [0] : 0;
    263196}
    264197
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSettingsDialogSpecific.cpp

    r10332 r10468  
    2727#include "VBoxProblemReporter.h"
    2828#include "QIWidgetValidator.h"
     29#include "VBoxSettingsSelector.h"
    2930
    3031#include "VBoxGLSettingsGeneral.h"
     
    4748#include <QStackedWidget>
    4849
    49 
    5050VBoxGLSettingsDlg::VBoxGLSettingsDlg (QWidget *aParent)
    5151    : VBoxSettingsDialog (aParent)
     
    5959
    6060    /* Creating settings pages */
    61     attachPage ((VBoxSettingsPage*) new VBoxGLSettingsGeneral());
    62 
    63     attachPage ((VBoxSettingsPage*) new VBoxGLSettingsInput());
    64 
    65     attachPage ((VBoxSettingsPage*) new VBoxGLSettingsLanguage());
     61    attachPage (new VBoxGLSettingsGeneral());
     62
     63    attachPage (new VBoxGLSettingsInput());
     64
     65    attachPage (new VBoxGLSettingsLanguage());
    6666
    6767#ifdef ENABLE_GLOBAL_USB
    68     attachPage ((VBoxSettingsPage*) new VBoxVMSettingsUSB (VBoxVMSettingsUSB::HostType));
     68    attachPage (new VBoxVMSettingsUSB (VBoxVMSettingsUSB::HostType));
    6969#endif
    7070
    71     /* Update QTreeWidget with available items */
     71    /* Update Selector with available items */
    7272    updateAvailability();
    7373}
     
    110110
    111111    /* Remember old index */
    112     int ci = mTwSelector->indexOfTopLevelItem (mTwSelector->currentItem());
    113 
    114     mTwSelector->clear();
    115 
    116     /* Populate selector list */
    117     QTreeWidgetItem *item = 0;
     112    int cid = mSelector->currentId();
     113    /* Remove all items */
     114    mSelector->clear();
    118115
    119116    /* General page */
    120     item = new QTreeWidgetItem (mTwSelector, QStringList() << " General "
    121                                              << "00" << "#general");
    122     item->setIcon (treeWidget_Category,
    123                    VBoxGlobal::iconSet (":/machine_16px.png"));
     117    mSelector->addItem (VBoxGlobal::iconSet (":/machine_16px.png"),
     118                        tr ("General"), GeneralId, "#general");
    124119
    125120    /* Input page */
    126     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Input "
    127                                              << "01" << "#input");
    128     item->setIcon (treeWidget_Category,
    129                    VBoxGlobal::iconSet (":/hostkey_16px.png"));
     121    mSelector->addItem (VBoxGlobal::iconSet (":/hostkey_16px.png"),
     122                        tr ("Input"), InputId, "#input");
    130123
    131124    /* Language page */
    132     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Language "
    133                                              << "02" << "#language");
    134     item->setIcon (treeWidget_Category,
    135                    VBoxGlobal::iconSet (":/site_16px.png"));
     125    mSelector->addItem (VBoxGlobal::iconSet (":/site_16px.png"),
     126                        tr ("Language"), LanguageId, "#language");
    136127
    137128#ifdef ENABLE_GLOBAL_USB
    138129    /* USB page */
    139     item = new QTreeWidgetItem (mTwSelector, QStringList() << " USB "
    140                                              << "03" << "#usb");
    141     item->setIcon (treeWidget_Category,
    142                    VBoxGlobal::iconSet (":/usb_16px.png"));
     130    mSelector->addItem (VBoxGlobal::iconSet (":/usb_16px.png"),
     131                        tr ("USB"), USBId, "#usb");
    143132#endif
    144133
     134    /* Translate the selector */
     135    mSelector->retranslateUi();
     136   
    145137    VBoxSettingsDialog::retranslateUi();
    146138
    147     /* Set the old index */
    148     mTwSelector->setCurrentItem (mTwSelector->topLevelItem (ci == -1 ? 0 : ci));
    149 
    150     /* Update QTreeWidget with available items */
     139    /* Select old remembered category */
     140    mSelector->selectById (cid == -1 ? 0 : cid);
     141
     142    /* Update Selector with available items */
    151143    updateAvailability();
    152144}
     
    156148    mStack->addWidget (aPage);
    157149
    158     aPage->setOrderAfter (mTwSelector);
     150    aPage->setOrderAfter (mSelector->widget());
    159151
    160152    return aPage;
     
    175167        /* Disable the USB controller category if the USB controller is
    176168         * not available (i.e. in VirtualBox OSE) */
    177         QTreeWidgetItem *usbItem = findItem (mTwSelector, "#usb",
    178                                              treeWidget_Link);
    179         if (usbItem)
     169        mSelector->setVisibleById (USBId, false);
     170        int index = mSelector->idToIndex (USBId);
     171        if (index > -1)
    180172        {
    181             usbItem->setHidden (true);
    182             int index = mTwSelector->indexOfTopLevelItem (usbItem);
    183173            if (mStack->widget (index))
    184174                mStack->widget (index)->setEnabled (false);
     
    238228    if (!aCategory.isNull())
    239229    {
    240         /* Search for a list view item corresponding to the category */
    241         if (QTreeWidgetItem *item = findItem (mTwSelector, aCategory, treeWidget_Link))
     230        mSelector->selectByLink (aCategory);
     231        /* Search for a widget with the given name */
     232        if (!aControl.isNull())
    242233        {
    243             mTwSelector->setCurrentItem (item);
    244             /* Search for a widget with the given name */
    245             if (!aControl.isNull())
     234            if (QWidget *w = mStack->currentWidget()->findChild<QWidget*> (aControl))
    246235            {
    247                 if (QWidget *w = mStack->currentWidget()->findChild<QWidget*> (aControl))
     236                QList<QWidget*> parents;
     237                QWidget *p = w;
     238                while ((p = p->parentWidget()) != NULL)
    248239                {
    249                     QList<QWidget*> parents;
    250                     QWidget *p = w;
    251                     while ((p = p->parentWidget()) != NULL)
     240                    if (QTabWidget *tb = qobject_cast<QTabWidget*> (p))
    252241                    {
    253                         if (QTabWidget *tb = qobject_cast<QTabWidget*> (p))
    254                         {
    255                             /* The tab contents widget is two steps down
    256                              * (QTabWidget -> QStackedWidget -> QWidget) */
    257                             QWidget *c = parents [parents.count() - 1];
    258                             if (c)
    259                                 c = parents [parents.count() - 2];
    260                             if (c)
    261                                 tb->setCurrentWidget (c);
    262                         }
    263                         parents.append (p);
     242                        /* The tab contents widget is two steps down
     243                         * (QTabWidget -> QStackedWidget -> QWidget) */
     244                        QWidget *c = parents [parents.count() - 1];
     245                        if (c)
     246                            c = parents [parents.count() - 2];
     247                        if (c)
     248                            tb->setCurrentWidget (c);
    264249                    }
    265 
    266                     w->setFocus();
     250                    parents.append (p);
    267251                }
     252
     253                w->setFocus();
    268254            }
    269255        }
     
    278264
    279265    QString warningText;
    280     QString pageTitle = pagePath (pg);
     266
     267    QString pageTitle = mSelector->itemTextByIndex (mStack->indexOf (pg));
    281268
    282269    VBoxSettingsPage *page = static_cast<VBoxSettingsPage*> (pg);
     
    319306    setWindowTitle (dialogTitle());
    320307
    321     /* Remember old index */
    322     int ci = mTwSelector->indexOfTopLevelItem (mTwSelector->currentItem());
    323 
    324     mTwSelector->clear();
    325 
    326308    /* We have to make sure that the Serial & Network subpages are retranslated
    327309     * before they are revalidated. Cause: They do string comparing within
     
    330312
    331313    /* Populate selector list */
    332     QTreeWidgetItem *item = 0;
    333314    QWidget *curpage = 0;
    334315
     316    /* Remember old index */
     317    int cid = mSelector->currentId();
     318    /* Remove all items */
     319    mSelector->clear();
     320
    335321    /* General page */
    336     item = new QTreeWidgetItem (mTwSelector, QStringList() << " General "
    337                                              << "00" << "#general");
    338     item->setIcon (treeWidget_Category,
    339                    VBoxGlobal::iconSet (":/machine_16px.png"));
     322    mSelector->addItem (VBoxGlobal::iconSet (":/machine_16px.png"),
     323                        tr ("General"), GeneralId, "#general");
    340324
    341325    /* HD page */
    342     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Hard Disks "
    343                                              << "01" << "#hdds");
    344     item->setIcon (treeWidget_Category,
    345                    VBoxGlobal::iconSet (":/hd_16px.png"));
     326    mSelector->addItem (VBoxGlobal::iconSet (":/hd_16px.png"),
     327                        tr ("Hard Disks"), HDId, "#hdds");
    346328
    347329    /* CD page */
    348     item = new QTreeWidgetItem (mTwSelector, QStringList() << " CD/DVD-ROM "
    349                                              << "02" << "#dvd");
    350     item->setIcon (treeWidget_Category,
    351                    VBoxGlobal::iconSet (":/cd_16px.png"));
     330    mSelector->addItem (VBoxGlobal::iconSet (":/cd_16px.png"),
     331                        tr ("CD/DVD-ROM"), CDId, "#dvd");
    352332
    353333    /* FD page */
    354     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Floppy "
    355                                              << "03" << "#floppy");
    356     item->setIcon (treeWidget_Category,
    357                    VBoxGlobal::iconSet (":/fd_16px.png"));
     334    mSelector->addItem (VBoxGlobal::iconSet (":/fd_16px.png"),
     335                        tr ("Floppy"), FDId, "#floppy");
    358336
    359337    /* Audio page */
    360     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Audio "
    361                                              << "04" << "#audio");
    362     item->setIcon (treeWidget_Category,
    363                    VBoxGlobal::iconSet (":/sound_16px.png"));
     338    mSelector->addItem (VBoxGlobal::iconSet (":/sound_16px.png"),
     339                        tr ("Audio"), AudioId, "#audio");
    364340
    365341    /* Network page */
    366     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Network "
    367                                              << "05" << "#network");
    368     item->setIcon (treeWidget_Category,
    369                    VBoxGlobal::iconSet (":/nw_16px.png"));
    370     curpage = mStack->widget (mTwSelector->indexOfTopLevelItem (item));
     342    mSelector->addItem (VBoxGlobal::iconSet (":/nw_16px.png"),
     343                        tr ("Network"), NetworkId, "#network");
     344
     345    curpage = mStack->widget (mSelector->idToIndex (NetworkId));
    371346    if (curpage)
    372347        qApp->sendEvent (curpage, &event);
    373348
    374349    /* Serial page */
    375     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Serial Ports "
    376                                              << "06" << "#serialPorts");
    377     item->setIcon (treeWidget_Category,
    378                    VBoxGlobal::iconSet (":/serial_port_16px.png"));
    379     curpage = mStack->widget (mTwSelector->indexOfTopLevelItem (item));
     350    mSelector->addItem (VBoxGlobal::iconSet (":/serial_port_16px.png"),
     351                        tr ("Serial Ports"), SerialId, "#serialPorts");
     352
     353    curpage = mStack->widget (mSelector->idToIndex (SerialId));
    380354    if (curpage)
    381355        qApp->sendEvent (curpage, &event);
    382356
    383357    /* Parallel page */
    384     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Parallel Ports "
    385                                              << "07" << "#parallelPorts");
    386     item->setIcon (treeWidget_Category,
    387                    VBoxGlobal::iconSet (":/parallel_port_16px.png"));
    388     curpage = mStack->widget (mTwSelector->indexOfTopLevelItem (item));
     358    mSelector->addItem (VBoxGlobal::iconSet (":/parallel_port_16px.png"),
     359                        tr ("Parallel Ports"), ParallelId, "#parallelPorts");
     360
     361    curpage = mStack->widget (mSelector->idToIndex (ParallelId));
    389362    if (curpage)
    390363        qApp->sendEvent (curpage, &event);
    391364
    392365    /* USB page */
    393     item = new QTreeWidgetItem (mTwSelector, QStringList() << " USB "
    394                                              << "08" << "#usb");
    395     item->setIcon (treeWidget_Category,
    396                    VBoxGlobal::iconSet (":/usb_16px.png"));
     366    mSelector->addItem (VBoxGlobal::iconSet (":/usb_16px.png"),
     367                        tr ("USB"), USBId, "#usb");
    397368
    398369    /* SFolders page */
    399     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Shared Folders "
    400                                              << "09" << "#sfolders");
    401     item->setIcon (treeWidget_Category,
    402                    VBoxGlobal::iconSet (":/shared_folder_16px.png"));
     370    mSelector->addItem (VBoxGlobal::iconSet (":/shared_folder_16px.png"),
     371                        tr ("Shared Folders"), SFId, "#sfolders");
    403372
    404373    /* VRDP page */
    405     item = new QTreeWidgetItem (mTwSelector, QStringList() << " Remote Display "
    406                                              << "10" << "#vrdp");
    407     item->setIcon (treeWidget_Category,
    408                    VBoxGlobal::iconSet (":/vrdp_16px.png"));
    409 
     374    mSelector->addItem (VBoxGlobal::iconSet (":/vrdp_16px.png"),
     375                        tr ("Remote Display"), VRDPId, "#vrdp");
     376
     377    /* Translate the selector */
     378    mSelector->retranslateUi();
     379   
    410380    VBoxSettingsDialog::retranslateUi();
    411381
    412     /* Set the old index */
    413     mTwSelector->setCurrentItem (mTwSelector->topLevelItem (ci == -1 ? 0 : ci));
     382    /* Select old remembered category */
     383    mSelector->selectById (cid == -1 ? 0 : cid);
    414384
    415385    /* Update QTreeWidget with available items */
     
    438408    mStack->addWidget (aPage);
    439409
    440     QIWidgetValidator *wval = new QIWidgetValidator (pagePath (aPage),
     410    QIWidgetValidator *wval = new QIWidgetValidator (mSelector->itemTextByIndex (mStack->indexOf (aPage)),
    441411                                                     aPage, this);
    442412    connect (wval, SIGNAL (validityChanged (const QIWidgetValidator*)),
     
    446416
    447417    aPage->setValidator (wval);
    448     aPage->setOrderAfter (mTwSelector);
     418    aPage->setOrderAfter (mSelector->widget());
    449419
    450420    return aPage;
     
    465435
    466436    /* Parallel Port Page (currently disabled) */
    467     QTreeWidgetItem *parallelItem =
    468         findItem (mTwSelector, "#parallelPorts", treeWidget_Link);
    469     Assert (parallelItem);
    470     if (parallelItem)
    471     {
    472         parallelItem->setHidden (true);
    473         int index = mTwSelector->indexOfTopLevelItem (parallelItem);
     437    mSelector->setVisibleById (ParallelId, false);
     438    int index = mSelector->idToIndex (ParallelId);
     439    if (index > -1)
     440    {
    474441        if (mStack->widget (index))
    475442            mStack->widget (index)->setEnabled (false);
     
    487454        /* Disable the USB controller category if the USB controller is
    488455         * not available (i.e. in VirtualBox OSE) */
    489         QTreeWidgetItem *usbItem =
    490             findItem (mTwSelector, "#usb", treeWidget_Link);
    491         Assert (usbItem);
    492         if (usbItem)
     456        mSelector->setVisibleById (USBId, false);
     457        int index = mSelector->idToIndex (USBId);
     458        if (index > -1)
    493459        {
    494             usbItem->setHidden (true);
    495             int index = mTwSelector->indexOfTopLevelItem (usbItem);
    496460            if (mStack->widget (index))
    497461                mStack->widget (index)->setEnabled (false);
     
    505469        /* Disable the VRDP category if VRDP is
    506470         * not available (i.e. in VirtualBox OSE) */
    507         QTreeWidgetItem *vrdpItem =
    508             findItem (mTwSelector, "#vrdp", treeWidget_Link);
    509         Assert (vrdpItem);
    510         if (vrdpItem)
     471        mSelector->setVisibleById (VRDPId, false);
     472        int index = mSelector->idToIndex (VRDPId);
     473        if (index > -1)
    511474        {
    512             vrdpItem->setHidden (true);
    513             int index = mTwSelector->indexOfTopLevelItem (vrdpItem);
    514475            if (mStack->widget (index))
    515476                mStack->widget (index)->setEnabled (false);
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxSettingsDialog.ui

    r10376 r10468  
    4444        <number>0</number>
    4545       </property>
    46        <item rowspan="3" row="0" column="0" >
    47         <widget class="QITreeWidget" name="mTwSelector" >
    48          <property name="sizePolicy" >
    49           <sizepolicy vsizetype="Expanding" hsizetype="Minimum" >
    50            <horstretch>0</horstretch>
    51            <verstretch>0</verstretch>
    52           </sizepolicy>
    53          </property>
    54          <property name="verticalScrollBarPolicy" >
    55           <enum>Qt::ScrollBarAlwaysOff</enum>
    56          </property>
    57          <property name="horizontalScrollBarPolicy" >
    58           <enum>Qt::ScrollBarAlwaysOff</enum>
    59          </property>
    60          <property name="rootIsDecorated" >
    61           <bool>false</bool>
    62          </property>
    63          <property name="uniformRowHeights" >
    64           <bool>true</bool>
    65          </property>
    66          <column>
    67           <property name="text" >
    68            <string>Category</string>
    69           </property>
    70          </column>
    71          <column>
    72           <property name="text" >
    73            <string>[id]</string>
    74           </property>
    75          </column>
    76          <column>
    77           <property name="text" >
    78            <string>[link]</string>
    79           </property>
    80          </column>
    81         </widget>
    82        </item>
    8346       <item row="0" column="1" >
    8447        <widget class="QLabel" name="mLbTitle" >
     
    204167   <header>QILabel.h</header>
    205168  </customwidget>
    206   <customwidget>
    207    <class>QITreeWidget</class>
    208    <extends>QTreeWidget</extends>
    209    <header>QITreeWidget.h</header>
    210   </customwidget>
    211169 </customwidgets>
    212170 <resources>
Note: See TracChangeset for help on using the changeset viewer.

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