Changeset 50871 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 25, 2014 5:29:10 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp
r50845 r50871 34 34 #include "UIIconPool.h" 35 35 #include "UIConverter.h" 36 #include "VBoxGlobal.h" 36 37 37 38 UIGDetailsElement::UIGDetailsElement(UIGDetailsSet *pParent, DetailsElementType type, bool fOpened) … … 133 134 } 134 135 136 void UIGDetailsElement::sltHandleAnchorClicked(const QString &strAnchor) 137 { 138 /* Current anchor role: */ 139 QString strRole = strAnchor.section(',', 0, 0); 140 141 /* Handle known roles: */ 142 if (strRole == "#choose") 143 handleAnchorClickedRoleChoose(strAnchor.section(',', 1)); 144 } 145 146 void UIGDetailsElement::sltMountStorageMedium() 147 { 148 /* Sender action: */ 149 QAction *pAction = qobject_cast<QAction*>(sender()); 150 AssertMsgReturnVoid(pAction, ("This slot should only be called by menu action!\n")); 151 152 /* Current mount-target: */ 153 const UIMediumTarget target = pAction->data().value<UIMediumTarget>(); 154 155 /* Update current machine mount-target: */ 156 vboxGlobal().updateMachineStorage(machine(), target); 157 } 158 135 159 void UIGDetailsElement::resizeEvent(QGraphicsSceneResizeEvent*) 136 160 { … … 392 416 m_pTextPane = new UIGraphicsTextPane(this, model()->paintDevice()); 393 417 connect(m_pTextPane, SIGNAL(sigGeometryChanged()), this, SLOT(sltUpdateGeometry())); 418 connect(m_pTextPane, SIGNAL(sigAnchorClicked(const QString&)), this, SLOT(sltHandleAnchorClicked(const QString&))); 394 419 } 395 420 … … 625 650 } 626 651 652 void UIGDetailsElement::handleAnchorClickedRoleChoose(const QString &strData) 653 { 654 /* Prepare storage-menu: */ 655 QMenu menu; 656 657 /* Storage-controller name: */ 658 QString strControllerName = strData.section(',', 0, 0); 659 /* Storage-slot: */ 660 StorageSlot storageSlot = gpConverter->fromString<StorageSlot>(strData.section(',', 1)); 661 662 /* Fill storage-menu: */ 663 vboxGlobal().prepareStorageMenu(menu, this, SLOT(sltMountStorageMedium()), 664 machine(), strControllerName, storageSlot); 665 666 /* Exec menu: */ 667 menu.exec(QCursor::pos()); 668 } 669 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h
r50845 r50871 96 96 void sltUpdateGeometry() { updateGeometry(); } 97 97 98 /** Handles children anchor clicks. */ 99 void sltHandleAnchorClicked(const QString &strAnchor); 100 101 /** Handles mount storage medium requests. */ 102 void sltMountStorageMedium(); 103 98 104 protected: 99 105 … … 181 187 /* Helper: Animation stuff: */ 182 188 void updateAnimationParameters(); 189 190 /** Handle clicked anchor with role '#choose'. */ 191 void handleAnchorClickedRoleChoose(const QString &strData); 183 192 184 193 /* Variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
r50843 r50871 507 507 } // hack 508 508 /* Append 'device slot name' with 'device type name' for CD/DVD devices only: */ 509 QString strDeviceType = attachment.GetType() == KDeviceType_DVD ? 509 KDeviceType deviceType = attachment.GetType(); 510 QString strDeviceType = deviceType == KDeviceType_DVD ? 510 511 QApplication::translate("UIGDetails", "[CD/DVD]", "details (storage)") : QString(); 511 512 if (!strDeviceType.isNull()) … … 513 514 /* Insert that attachment information into the map: */ 514 515 if (!strAttachmentInfo.isNull()) 515 attachmentsMap.insert(attachmentSlot, strDeviceType + strAttachmentInfo); 516 { 517 /* Hovering anchors for dvd/floppy stuff: */ 518 if (deviceType == KDeviceType_DVD || deviceType == KDeviceType_Floppy) 519 attachmentsMap.insert(attachmentSlot, 520 QString("<a href=#choose,%1,%2>%3</a>") 521 .arg(controller.GetName(), 522 gpConverter->toString(attachmentSlot), 523 strDeviceType + strAttachmentInfo)); 524 /* Usual stuff for hard-drives: */ 525 else 526 attachmentsMap.insert(attachmentSlot, strDeviceType + strAttachmentInfo); 527 } 516 528 } 517 529 /* Iterate over the sorted map: */
Note:
See TracChangeset
for help on using the changeset viewer.