Changeset 24167 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 29, 2009 4:09:25 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 54106
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r24151 r24167 327 327 if (aSelf) 328 328 *aSelf = this; 329 330 /* Enumerate mediums to work with cached data */331 vboxGlobal().startEnumeratingMedia();332 329 333 330 #if !(defined (Q_WS_WIN) || defined (Q_WS_MAC)) … … 2183 2180 else attachmentMenu = menu; 2184 2181 2185 /* Related VBoxMedium item */2186 VBoxMedium vboxMediumCurrent;2187 vboxGlobal().findMedium (attachment.GetMedium(), vboxMediumCurrent);2188 2189 2182 /* Mount Medium actions */ 2190 2183 int addedIntoList = 0; 2191 const VBoxMediaList &vboxMediums = vboxGlobal().currentMediaList();2192 foreach (const VBoxMedium &vboxMedium, vboxMediums)2184 CMediumVector mediums; 2185 switch (mediumType) 2193 2186 { 2194 if (vboxMedium.type() == mediumType) 2187 case VBoxDefs::MediumType_DVD: 2188 mediums += vboxGlobal().virtualBox().GetHost().GetDVDDrives(); 2189 mediums += vboxGlobal().virtualBox().GetDVDImages(); 2190 break; 2191 case VBoxDefs::MediumType_Floppy: 2192 mediums += vboxGlobal().virtualBox().GetHost().GetFloppyDrives(); 2193 mediums += vboxGlobal().virtualBox().GetFloppyImages(); 2194 break; 2195 default: 2196 break; 2197 } 2198 2199 foreach (const CMedium &medium, mediums) 2200 { 2201 bool isMediumUsed = false; 2202 foreach (const CMediumAttachment &otherAttachment, attachments) 2195 2203 { 2196 bool isMediumUsed = false; 2197 foreach (const CMediumAttachment &otherAttachment, attachments) 2204 if (otherAttachment != attachment) 2198 2205 { 2199 if (otherAttachment != attachment) 2206 CMedium otherMedium = otherAttachment.GetMedium(); 2207 if (!otherMedium.isNull() && otherMedium.GetId() == medium.GetId()) 2200 2208 { 2201 CMedium otherMedium = otherAttachment.GetMedium(); 2202 if (!otherMedium.isNull() && otherMedium.GetId() == vboxMedium.id()) 2203 { 2204 isMediumUsed = true; 2205 break; 2206 } 2209 isMediumUsed = true; 2210 break; 2207 2211 } 2208 2212 } 2209 if (!isMediumUsed)2210 {2211 QAction *mountMediumAction = new QAction (vboxMedium.name(), attachmentMenu);2212 mountMediumAction->setCheckable (true);2213 mountMediumAction->setChecked (vboxMedium.id() == vboxMediumCurrent.id());2214 mountMediumAction->setData (QVariant::fromValue (MountTarget (attachment.GetController().GetName(),2215 attachment.GetPort(),2216 attachment.GetDevice(),2217 vboxMedium.id())));2218 connect (mountMediumAction, SIGNAL (triggered (bool)), this, SLOT (mountMedium()));2219 attachmentMenu->addAction (mountMediumAction);2220 ++ addedIntoList;2221 if (addedIntoList == 5)2222 break;2223 }2213 } 2214 if (!isMediumUsed) 2215 { 2216 QAction *mountMediumAction = new QAction (VBoxMedium (medium, mediumType).name(), attachmentMenu); 2217 mountMediumAction->setCheckable (true); 2218 mountMediumAction->setChecked (medium.GetId() == attachment.GetMedium().GetId()); 2219 mountMediumAction->setData (QVariant::fromValue (MountTarget (attachment.GetController().GetName(), 2220 attachment.GetPort(), 2221 attachment.GetDevice(), 2222 medium.GetId()))); 2223 connect (mountMediumAction, SIGNAL (triggered (bool)), this, SLOT (mountMedium())); 2224 attachmentMenu->addAction (mountMediumAction); 2225 ++ addedIntoList; 2226 if (addedIntoList == 5) 2227 break; 2224 2228 } 2225 2229 } … … 2241 2245 /* Unmount Medium action */ 2242 2246 QAction *unmountMediumAction = new QAction (attachmentMenu); 2243 unmountMediumAction->setEnabled (! vboxMediumCurrent.isNull());2247 unmountMediumAction->setEnabled (!attachment.GetMedium().isNull()); 2244 2248 unmountMediumAction->setData (QVariant::fromValue (MountTarget (attachment.GetController().GetName(), 2245 2249 attachment.GetPort(), … … 2249 2253 2250 2254 /* Switch CD/FD naming */ 2251 switch ( deviceType)2255 switch (mediumType) 2252 2256 { 2253 case KDeviceType_DVD:2257 case VBoxDefs::MediumType_DVD: 2254 2258 callVMMAction->setText (tr ("More CD/DVD Images...")); 2255 2259 unmountMediumAction->setText (tr ("Unmount CD/DVD Device")); … … 2257 2261 ":/cd_unmount_dis_16px.png")); 2258 2262 break; 2259 case KDeviceType_Floppy:2263 case VBoxDefs::MediumType_Floppy: 2260 2264 callVMMAction->setText (tr ("More Floppy Images...")); 2261 2265 unmountMediumAction->setText (tr ("Unmount Floppy Device")); … … 2275 2279 QAction *emptyMenuAction = new QAction (menu); 2276 2280 emptyMenuAction->setEnabled (false); 2277 switch ( deviceType)2278 { 2279 case KDeviceType_DVD:2281 switch (mediumType) 2282 { 2283 case VBoxDefs::MediumType_DVD: 2280 2284 emptyMenuAction->setText (tr ("No CD/DVD Devices Attached")); 2281 2285 break; 2282 case KDeviceType_Floppy:2286 case VBoxDefs::MediumType_Floppy: 2283 2287 emptyMenuAction->setText (tr ("No Floppy Devices Attached")); 2284 2288 break; … … 2325 2329 /* Open VMM Dialog */ 2326 2330 VBoxMediaManagerDlg dlg (this); 2327 dlg.setup (target.type, true /* do select? */, false /* do refresh? */,2331 dlg.setup (target.type, true /* do select? */, true /* do refresh? */, 2328 2332 mSession.GetMachine(), QString(), true, usedImages); 2329 2333 if (dlg.exec() == QDialog::Accepted) … … 2801 2805 attData += QString ("<br> <nobr>%1: %2</nobr>") 2802 2806 .arg (vboxGlobal().toString (StorageSlot (controller.GetBus(), attachment.GetPort(), attachment.GetDevice()))) 2803 .arg ( vboxGlobal().findMedium (attachment.GetMedium().GetId()).location());2807 .arg (VBoxMedium (attachment.GetMedium(), VBoxDefs::MediumType_HardDisk).location()); 2804 2808 attachmentsPresent = true; 2805 2809 } … … 2830 2834 if (attachment.GetType() != KDeviceType_DVD) 2831 2835 continue; 2832 QString id (attachment.GetMedium().isNull() ? QString() : attachment.GetMedium().GetId()); 2833 VBoxMedium vboxMedium = vboxGlobal().findMedium (id); 2836 VBoxMedium vboxMedium (attachment.GetMedium(), VBoxDefs::MediumType_DVD); 2834 2837 attData += QString ("<br> <nobr>%1: %2</nobr>") 2835 2838 .arg (vboxGlobal().toString (StorageSlot (controller.GetBus(), attachment.GetPort(), attachment.GetDevice()))) … … 2865 2868 if (attachment.GetType() != KDeviceType_Floppy) 2866 2869 continue; 2867 QString id (attachment.GetMedium().isNull() ? QString() : attachment.GetMedium().GetId()); 2868 VBoxMedium vboxMedium = vboxGlobal().findMedium (id); 2870 VBoxMedium vboxMedium (attachment.GetMedium(), VBoxDefs::MediumType_Floppy); 2869 2871 attData += QString ("<br> <nobr>%1: %2</nobr>") 2870 2872 .arg (vboxGlobal().toString (StorageSlot (controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
Note:
See TracChangeset
for help on using the changeset viewer.