Changeset 868 in vbox
- Timestamp:
- Feb 13, 2007 1:26:58 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18575
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxMediaComboBox.h
r548 r868 51 51 void mediaEnumStarted(); 52 52 void mediaEnumerated (const VBoxMedia &, int); 53 void mediaEnumFinished (const VBoxMediaList &);54 53 void mediaAdded (const VBoxMedia &); 55 54 void mediaUpdated (const VBoxMedia &); … … 61 60 62 61 void updateToolTip (int); 63 void setCurrentItem (int);64 62 void processMedia (const VBoxMedia &); 65 63 void processHdMedia (const VBoxMedia &); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp
r548 r868 42 42 connect (&vboxGlobal(), SIGNAL (mediaEnumerated (const VBoxMedia &, int)), 43 43 this, SLOT (mediaEnumerated (const VBoxMedia &, int))); 44 connect (&vboxGlobal(), SIGNAL (mediaEnumFinished (const VBoxMediaList &)),45 this, SLOT (mediaEnumFinished (const VBoxMediaList &)));46 44 47 45 /* setup update handlers */ … … 72 70 mPmError.convertFromImage (img); 73 71 } 74 75 /* media shortcuts creating */76 refresh();77 72 } 78 73 … … 84 79 if (mUseEmptyItem) 85 80 appendItem (tr ("<no hard disk>"), QUuid(), tr ("No hard disk"), 0); 86 updateToolTip (currentItem());87 81 /* load current media list */ 88 82 VBoxMediaList list = vboxGlobal().currentMediaList(); … … 90 84 for (it = list.begin(); it != list.end(); ++ it) 91 85 mediaEnumerated (*it, 0); 86 /* activate item selected during current list loading */ 87 processActivated (currentItem()); 92 88 } 93 89 … … 103 99 } 104 100 105 void VBoxMediaComboBox::mediaEnumFinished (const VBoxMediaList &/*aList*/)106 {107 emit activated (currentItem());108 }109 110 101 111 102 void VBoxMediaComboBox::mediaAdded (const VBoxMedia &aMedia) … … 120 111 121 112 void VBoxMediaComboBox::mediaRemoved (VBoxDefs::DiskType aType, 122 const QUuid &aId)113 const QUuid &aId) 123 114 { 124 115 if (!(aType & mType)) … … 132 123 mUuidList.remove (mUuidList.at (index)); 133 124 mTipList.remove (mTipList.at (index)); 134 updateToolTip (currentItem()); 125 /* emit signal to ensure parent dialog process selection changes */ 126 emit activated (currentItem()); 135 127 } 136 128 } … … 217 209 replaceItem (index, name, aTip, pixmap); 218 210 211 /* activate required item if it was updated */ 219 212 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); 224 217 } 225 218 226 219 void VBoxMediaComboBox::processActivated (int aItem) 227 220 { 228 mRequiredId = QUuid (mUuidList [aItem]);221 mRequiredId = mUuidList.isEmpty() || aItem < 0 ? QUuid() : QUuid (mUuidList [aItem]); 229 222 updateToolTip (aItem); 230 223 } … … 234 227 /* combobox tooltip attaching */ 235 228 QToolTip::remove (this); 236 if (!mTipList.isEmpty() )229 if (!mTipList.isEmpty() && aItem >= 0) 237 230 QToolTip::add (this, mTipList [aItem]); 238 231 } … … 285 278 } 286 279 287 void VBoxMediaComboBox::setCurrentItem (int aIndex)288 {289 QComboBox::setCurrentItem (aIndex);290 emit activated (aIndex);291 }292 293 280 void VBoxMediaComboBox::setCurrentItem (const QUuid &aId) 294 281 { … … 296 283 int index = mUuidList.findIndex (mRequiredId); 297 284 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 105 105 connect (mediaCombo, SIGNAL (activated (int)), 106 106 this, SLOT (currentMediaChanged (int))); 107 vboxGlobal().startEnumeratingMedia(); 107 if (!vboxGlobal().isMediaEnumerationStarted()) 108 vboxGlobal().startEnumeratingMedia(); 109 else 110 mediaCombo->refresh(); 108 111 109 112 /// @todo (dmik) remove?
Note:
See TracChangeset
for help on using the changeset viewer.