VirtualBox

Changeset 868 in vbox


Ignore:
Timestamp:
Feb 13, 2007 1:26:58 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18575
Message:

Fixed freeze during add/remove/add/remove sequence in clean MediaComboBox.
Fixed settings shortcuts update during removing all elements from MediaComboBox.
Some other minor update-bugs fixed.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h

    r548 r868  
    5151    void mediaEnumStarted();
    5252    void mediaEnumerated (const VBoxMedia &, int);
    53     void mediaEnumFinished (const VBoxMediaList &);
    5453    void mediaAdded (const VBoxMedia &);
    5554    void mediaUpdated (const VBoxMedia &);
     
    6160
    6261    void updateToolTip (int);
    63     void setCurrentItem (int);
    6462    void processMedia (const VBoxMedia &);
    6563    void processHdMedia (const VBoxMedia &);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp

    r548 r868  
    4242    connect (&vboxGlobal(), SIGNAL (mediaEnumerated (const VBoxMedia &, int)),
    4343             this, SLOT (mediaEnumerated (const VBoxMedia &, int)));
    44     connect (&vboxGlobal(), SIGNAL (mediaEnumFinished (const VBoxMediaList &)),
    45              this, SLOT (mediaEnumFinished (const VBoxMediaList &)));
    4644
    4745    /* setup update handlers */
     
    7270        mPmError.convertFromImage (img);
    7371    }
    74 
    75     /* media shortcuts creating */
    76     refresh();
    7772}
    7873
     
    8479    if (mUseEmptyItem)
    8580        appendItem (tr ("<no hard disk>"), QUuid(), tr ("No hard disk"), 0);
    86     updateToolTip (currentItem());
    8781    /* load current media list */
    8882    VBoxMediaList list = vboxGlobal().currentMediaList();
     
    9084    for (it = list.begin(); it != list.end(); ++ it)
    9185        mediaEnumerated (*it, 0);
     86    /* activate item selected during current list loading */
     87    processActivated (currentItem());
    9288}
    9389
     
    10399}
    104100
    105 void VBoxMediaComboBox::mediaEnumFinished (const VBoxMediaList &/*aList*/)
    106 {
    107     emit activated (currentItem());
    108 }
    109 
    110101
    111102void VBoxMediaComboBox::mediaAdded (const VBoxMedia &aMedia)
     
    120111
    121112void VBoxMediaComboBox::mediaRemoved (VBoxDefs::DiskType aType,
    122                                      const QUuid &aId)
     113                                      const QUuid &aId)
    123114{
    124115    if (!(aType & mType))
     
    132123        mUuidList.remove (mUuidList.at (index));
    133124        mTipList.remove (mTipList.at (index));
    134         updateToolTip (currentItem());
     125        /* emit signal to ensure parent dialog process selection changes */
     126        emit activated (currentItem());
    135127    }
    136128}
     
    217209        replaceItem (index, name, aTip, pixmap);
    218210
     211    /* activate required item if it was updated */
    219212    if (aId == mRequiredId)
    220     {
    221         int activatedItem = index == -1 ? count() - 1 : index;
    222         setCurrentItem (activatedItem);
    223     }
     213        setCurrentItem (aId);
     214    /* select last added item if there is no item selected */
     215    else if (currentText().isEmpty())
     216        QComboBox::setCurrentItem (index == -1 ? count() - 1 : index);
    224217}
    225218
    226219void VBoxMediaComboBox::processActivated (int aItem)
    227220{
    228     mRequiredId = QUuid (mUuidList [aItem]);
     221    mRequiredId = mUuidList.isEmpty() || aItem < 0 ? QUuid() : QUuid (mUuidList [aItem]);
    229222    updateToolTip (aItem);
    230223}
     
    234227    /* combobox tooltip attaching */
    235228    QToolTip::remove (this);
    236     if (!mTipList.isEmpty())
     229    if (!mTipList.isEmpty() && aItem >= 0)
    237230        QToolTip::add (this, mTipList [aItem]);
    238231}
     
    285278}
    286279
    287 void VBoxMediaComboBox::setCurrentItem (int aIndex)
    288 {
    289     QComboBox::setCurrentItem (aIndex);
    290     emit activated (aIndex);
    291 }
    292 
    293280void VBoxMediaComboBox::setCurrentItem (const QUuid &aId)
    294281{
     
    296283    int index = mUuidList.findIndex (mRequiredId);
    297284    if (index != -1)
    298         setCurrentItem (index);
    299 }
     285    {
     286        QComboBox::setCurrentItem (index);
     287        emit activated (index);
     288    }
     289}
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui.h

    r580 r868  
    105105    connect (mediaCombo, SIGNAL (activated (int)),
    106106             this, SLOT (currentMediaChanged (int)));
    107     vboxGlobal().startEnumeratingMedia();
     107    if (!vboxGlobal().isMediaEnumerationStarted())
     108        vboxGlobal().startEnumeratingMedia();
     109    else
     110        mediaCombo->refresh();
    108111
    109112    /// @todo (dmik) remove?
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