Changeset 48265 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 4, 2013 1:44:43 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
r48264 r48265 173 173 UIMedium medium = vboxGlobal().medium(strMediumID); 174 174 175 if (medium.isNull() || medium.type() == mType) 176 { 177 if (!mShowDiffs && medium.type() == UIMediumType_HardDisk) 178 { 179 if (medium.parent() != NULL) 180 { 181 /* In !mShowDiffs mode, we ignore all diffs except ones that are 182 * directly attached to the related VM in the current state */ 183 if (!medium.isAttachedInCurStateTo (mMachineId)) 184 return; 185 } 186 } 187 188 appendItem(medium); 189 190 /* Activate the required item if there is any: */ 191 if (medium.id() == mLastId) 192 setCurrentItem(medium.id()); 193 /* Select last added item if there is no item selected: */ 194 else if (currentText().isEmpty()) 195 QComboBox::setCurrentIndex(count() - 1); 196 } 175 /* Add only 1. NULL medium and 2. mediums of required type: */ 176 if (!medium.isNull() && medium.type() != mType) 177 return; 178 179 /* In !mShowDiffs mode, we ignore all diffs: */ 180 if (!mShowDiffs && medium.type() == UIMediumType_HardDisk && medium.parent()) 181 return; 182 183 /* Append medium into combo-box: */ 184 appendItem(medium); 185 186 /* Activate the required item if any: */ 187 if (medium.id() == mLastId) 188 setCurrentItem(medium.id()); 189 /* Select last added item if there is no item selected: */ 190 else if (currentText().isEmpty()) 191 QComboBox::setCurrentIndex(count() - 1); 197 192 } 198 193 … … 202 197 UIMedium medium = vboxGlobal().medium(strMediumID); 203 198 204 if (medium.isNull() || medium.type() == mType) 205 { 206 int index; 207 if (!findMediaIndex(medium.id(), index)) 208 return; 209 210 replaceItem(index, medium); 211 212 /* Emit the signal to ensure the parent dialog handles the change of 213 * the selected item's data: */ 214 emit activated(currentIndex()); 215 } 199 /* Add only 1. NULL medium and 2. mediums of required type: */ 200 if (!medium.isNull() && medium.type() != mType) 201 return; 202 203 /* Search for corresponding item index: */ 204 int index; 205 if (!findMediaIndex(medium.id(), index)) 206 return; 207 208 /* Replace medium in combo-box: */ 209 replaceItem(index, medium); 210 211 /* Emit the signal to ensure the parent dialog handles the change of 212 * the selected item's data: */ 213 emit activated(currentIndex()); 216 214 } 217 215 218 216 void VBoxMediaComboBox::sltHandleMediumDeleted(const QString &strMediumID) 219 217 { 218 /* Search for corresponding item index: */ 220 219 int index; 221 220 if (!findMediaIndex(strMediumID, index)) 222 221 return; 223 222 223 /* Replace medium from combo-box: */ 224 224 removeItem(index); 225 225 mMedia.erase(mMedia.begin() + index);
Note:
See TracChangeset
for help on using the changeset viewer.