Changeset 100348 in vbox
- Timestamp:
- Jul 3, 2023 2:03:27 PM (17 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r100323 r100348 2646 2646 setStatusTip(QApplication::translate("UIActionPool", "Import ISO into the VISO content.")); 2647 2647 setToolTip(QApplication::translate("UIActionPool", "Import Selected ISO(s) into the VISO content.") 2648 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2649 } 2650 }; 2651 2652 2653 class UIActionMenuVISOCreatorRemoveISO : public UIActionSimple 2654 { 2655 Q_OBJECT; 2656 2657 public: 2658 /** Constructs action passing @a pParent to the base-class. */ 2659 UIActionMenuVISOCreatorRemoveISO(UIActionPool *pParent) 2660 : UIActionSimple(pParent, 2661 ":/cd_remove_16px.png", ":/cd_remove_32px.png", ":/cd_remove_disabled_16px.png", ":/cd_remove_disabled_32px.png") 2662 { 2663 setShortcutContext(Qt::WidgetWithChildrenShortcut); 2664 } 2665 2666 protected: 2667 2668 /** Returns shortcut extra-data ID. */ 2669 virtual QString shortcutExtraDataID() const RT_OVERRIDE 2670 { 2671 return QString("ISORemove"); 2672 } 2673 2674 /** Handles translation event. */ 2675 virtual void retranslateUi() RT_OVERRIDE 2676 { 2677 setName(QApplication::translate("UIActionPool", "ISORemove")); 2678 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator")); 2679 setStatusTip(QApplication::translate("UIActionPool", "Remove ISO into the VISO content.")); 2680 setToolTip(QApplication::translate("UIActionPool", "Remove Selected ISO(s) into the VISO content.") 2648 2681 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2649 2682 } … … 3465 3498 m_pool[UIActionIndex_M_VISOCreator_Open] = new UIActionMenuVISOCreatorOpen(this); 3466 3499 m_pool[UIActionIndex_M_VISOCreator_ImportISO] = new UIActionMenuVISOCreatorImportISO(this); 3500 m_pool[UIActionIndex_M_VISOCreator_RemoveISO] = new UIActionMenuVISOCreatorRemoveISO(this); 3467 3501 3468 3502 m_pool[UIActionIndex_M_VISOCreator_VisoContent_GoHome] = new UIActionMenuVISOCreatorGoHome(this); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r100323 r100348 163 163 UIActionIndex_M_VISOCreator_Open, 164 164 UIActionIndex_M_VISOCreator_ImportISO, 165 UIActionIndex_M_VISOCreator_RemoveISO, 165 166 UIActionIndex_M_VISOCreator_VisoContent_GoHome, 166 167 UIActionIndex_M_VISOCreator_VisoContent_GoUp, -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r100345 r100348 267 267 const QString &strDirPath /* = QString() */) 268 268 { 269 /* We can import only a ISO file into VISO:*/ 270 if (!importedISOPath().isEmpty()) 271 return; 269 272 if (!pParentItem) 270 pParentItem = rootItem()->children()[0]; 273 { 274 pParentItem = startItem(); 275 setTableRootIndex(m_pModel->index(pParentItem)); 276 } 271 277 if (!m_pTableView || !pParentItem) 272 278 return; … … 312 318 if (m_pTableProxyModel) 313 319 m_pTableProxyModel->invalidate(); 314 } 315 320 emit sigISOContentImportedOrRemoved(true /* imported*/); 321 } 322 323 void UIVisoContentBrowser::removeISOContentFromViso() 324 { 325 UICustomFileSystemItem* pParentItem = startItem(); 326 AssertReturnVoid(pParentItem); 327 AssertReturnVoid(m_pModel); 328 329 QList<UICustomFileSystemItem*> itemsToDelete; 330 /* Delete all children of startItem that were imported from an ISO: */ 331 for (int i = 0; i < pParentItem->childCount(); ++i) 332 { 333 UICustomFileSystemItem* pItem = pParentItem->child(i); 334 if (!pItem || pItem->data(UICustomFileSystemModelData_ISOFilePath).toString().isEmpty()) 335 continue; 336 itemsToDelete << pItem; 337 } 338 339 foreach (UICustomFileSystemItem *pItem, itemsToDelete) 340 m_pModel->deleteItem(pItem); 341 if (m_pTableProxyModel) 342 m_pTableProxyModel->invalidate(); 343 344 setImportedISOPath(); 345 emit sigISOContentImportedOrRemoved(false /* imported*/); 346 } 316 347 317 348 void UIVisoContentBrowser::addObjectsToViso(const QStringList &pathList) … … 545 576 m_pTableView->hideColumn(UICustomFileSystemModelData_Size); 546 577 m_pTableView->hideColumn(UICustomFileSystemModelData_ChangeTime); 578 m_pTableView->hideColumn(UICustomFileSystemModelData_ISOFilePath); 547 579 548 580 m_pTableView->setSortingEnabled(true); … … 606 638 } 607 639 608 void UIVisoContentBrowser::setImportedISOPath(const QString &strPath )640 void UIVisoContentBrowser::setImportedISOPath(const QString &strPath /* = QString() */) 609 641 { 610 642 if (m_strImportedISOPath == strPath) -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h
r100333 r100348 56 56 57 57 void sigTableSelectionChanged(bool fIsSelectionEmpty); 58 void sigISOContentImportedOrRemoved(bool fImportedr); 58 59 59 60 public: … … 65 66 UICustomFileSystemItem *pParentItem = 0, 66 67 const QString &strDirPath = QString()); 68 void removeISOContentFromViso(); 67 69 /** Adds file objests from the host file system. @p pathList consists of list of paths to there objects. */ 68 70 void addObjectsToViso(const QStringList &pathList); … … 77 79 78 80 const QString &importedISOPath() const; 79 void setImportedISOPath(const QString &strPath );81 void setImportedISOPath(const QString &strPath = QString()); 80 82 81 83 public slots: -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r100345 r100348 261 261 , m_pOpenAction(0) 262 262 , m_pImportISOAction(0) 263 , m_pRemoveISOAction(0) 263 264 , m_pMainLayout(0) 264 265 , m_pHostBrowser(0) … … 414 415 void UIVisoCreatorWidget::sltISOImportAction() 415 416 { 416 if (!m_pHostBrowser )417 if (!m_pHostBrowser || !m_pVISOContentBrowser) 417 418 return; 418 419 QStringList selectedObjectPaths = m_pHostBrowser->selectedPathList(); … … 420 421 return; 421 422 m_pVISOContentBrowser->importISOContentToViso(selectedObjectPaths[0]); 423 } 424 425 void UIVisoCreatorWidget::sltISORemoveAction() 426 { 427 if (!m_pVISOContentBrowser) 428 return; 429 m_pVISOContentBrowser->removeISOContentFromViso(); 430 } 431 432 void UIVisoCreatorWidget::sltISOContentImportedOrRemoved(bool fImported) 433 { 434 if (m_pImportISOAction) 435 m_pImportISOAction->setEnabled(!fImported); 436 if (m_pRemoveISOAction) 437 m_pRemoveISOAction->setEnabled(fImported); 422 438 } 423 439 … … 510 526 connect(m_pVISOContentBrowser, &UIVisoContentBrowser::sigTableSelectionChanged, 511 527 this, &UIVisoCreatorWidget::sltContentBrowserTableSelectionChanged); 528 connect(m_pVISOContentBrowser, &UIVisoContentBrowser::sigISOContentImportedOrRemoved, 529 this, &UIVisoCreatorWidget::sltISOContentImportedOrRemoved); 512 530 } 513 531 … … 530 548 connect(m_pImportISOAction, &QAction::triggered, 531 549 this, &UIVisoCreatorWidget::sltISOImportAction); 550 if (m_pRemoveISOAction) 551 connect(m_pRemoveISOAction, &QAction::triggered, 552 this, &UIVisoCreatorWidget::sltISORemoveAction); 532 553 } 533 554 … … 546 567 if (m_pImportISOAction) 547 568 m_pImportISOAction->setEnabled(false); 569 570 m_pRemoveISOAction = m_pActionPool->action(UIActionIndex_M_VISOCreator_RemoveISO); 571 if (m_pRemoveISOAction) 572 m_pRemoveISOAction->setEnabled(false); 548 573 } 549 574 … … 566 591 if (m_pImportISOAction) 567 592 m_pMainMenu->addAction(m_pImportISOAction); 593 if (m_pRemoveISOAction) 594 m_pMainMenu->addAction(m_pRemoveISOAction); 568 595 } 569 596 if (m_pVISOContentBrowser) … … 587 614 if (m_pImportISOAction) 588 615 m_pVerticalToolBar->addAction(m_pImportISOAction); 616 if (m_pRemoveISOAction) 617 m_pVerticalToolBar->addAction(m_pRemoveISOAction); 589 618 590 619 m_pVerticalToolBar->addWidget(bottomSpacerWidget); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r100333 r100348 119 119 void sltOpenAction(); 120 120 void sltISOImportAction(); 121 void sltISORemoveAction(); 122 void sltISOContentImportedOrRemoved(bool fImported); 121 123 122 124 private: … … 143 145 QAction *m_pOpenAction; 144 146 QAction *m_pImportISOAction; 147 QAction *m_pRemoveISOAction; 145 148 /** @} */ 146 149
Note:
See TracChangeset
for help on using the changeset viewer.