Changeset 100180 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 15, 2023 2:57:14 PM (20 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
r100156 r100180 2400 2400 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator")); 2401 2401 setStatusTip(QApplication::translate("UIActionPool", "Remove selected item(s) from VISO")); 2402 setToolTip(QApplication::translate("UIActionPool", "Remove Item(s) from VISO")2402 setToolTip(QApplication::translate("UIActionPool", "Remove Selected Item(s) from VISO") 2403 2403 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2404 2404 } … … 2470 2470 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator")); 2471 2471 setStatusTip(QApplication::translate("UIActionPool", "Rename the selected object")); 2472 setToolTip(QApplication::translate("UIActionPool", "Rename Object")2472 setToolTip(QApplication::translate("UIActionPool", "Rename Selected VISO File Object") 2473 2473 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2474 2474 } … … 2515 2515 UIActionMenuVISOCreatorOpen(UIActionPool *pParent) 2516 2516 : UIActionSimple(pParent, 2517 ":/cd_remove_16px.png", ":/cd_ 16px.png")2517 ":/cd_remove_16px.png", ":/cd_remove_32px.png") 2518 2518 { 2519 2519 setShortcutContext(Qt::WidgetWithChildrenShortcut); … … 2535 2535 setStatusTip(QApplication::translate("UIActionPool", "Open the VISO content.")); 2536 2536 setToolTip(QApplication::translate("UIActionPool", "Open the VISO content.") 2537 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2538 } 2539 }; 2540 2541 2542 class UIActionMenuVISOCreatorImportISO : public UIActionSimple 2543 { 2544 Q_OBJECT; 2545 2546 public: 2547 /** Constructs action passing @a pParent to the base-class. */ 2548 UIActionMenuVISOCreatorImportISO(UIActionPool *pParent) 2549 : UIActionSimple(pParent, 2550 ":/cd_add_16px.png", ":/cd_add_32px.png", ":/cd_add_disabled_16px.png", ":/cd_add_disabled_32px.png") 2551 { 2552 setShortcutContext(Qt::WidgetWithChildrenShortcut); 2553 } 2554 2555 protected: 2556 2557 /** Returns shortcut extra-data ID. */ 2558 virtual QString shortcutExtraDataID() const RT_OVERRIDE 2559 { 2560 return QString("ISOImport"); 2561 } 2562 2563 /** Handles translation event. */ 2564 virtual void retranslateUi() RT_OVERRIDE 2565 { 2566 setName(QApplication::translate("UIActionPool", "ISOImport")); 2567 setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator")); 2568 setStatusTip(QApplication::translate("UIActionPool", "Import ISO into the VISO content.")); 2569 setToolTip(QApplication::translate("UIActionPool", "Import Selected ISO(s) into the VISO content.") 2537 2570 + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 2538 2571 } … … 3193 3226 m_pool[UIActionIndex_M_VISOCreator_Reset] = new UIActionMenuVISOCreatorReset(this); 3194 3227 m_pool[UIActionIndex_M_VISOCreator_Open] = new UIActionMenuVISOCreatorOpen(this); 3228 m_pool[UIActionIndex_M_VISOCreator_ImportISO] = new UIActionMenuVISOCreatorImportISO(this); 3195 3229 3196 3230 /* Medium Selector actions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
r100156 r100180 158 158 UIActionIndex_M_VISOCreator_Reset, 159 159 UIActionIndex_M_VISOCreator_Open, 160 UIActionIndex_M_VISOCreator_ImportISO, 160 161 161 162 /* Medium selector actions : */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r100177 r100180 266 266 , m_pResetAction(0) 267 267 , m_pOpenAction(0) 268 , m_pImportISOAction(0) 268 269 , m_pMainLayout(0) 269 270 , m_pHostBrowser(0) … … 393 394 } 394 395 395 void UIVisoCreatorWidget::sltHostBrowserTableSelectionChanged( bool fIsSelectionEmpty)396 void UIVisoCreatorWidget::sltHostBrowserTableSelectionChanged(QStringList pathList) 396 397 { 397 398 if (m_pAddAction) 398 m_pAddAction->setEnabled(!fIsSelectionEmpty); 399 m_pAddAction->setEnabled(!pathList.isEmpty()); 400 if (m_pImportISOAction) 401 m_pImportISOAction->setEnabled(!findISOFiles(pathList).isEmpty()); 399 402 } 400 403 … … 434 437 if (!strFileName.isEmpty() && m_pVISOContentBrowser) 435 438 m_pVISOContentBrowser->parseVisoFileContent(strFileName); 439 } 440 441 void UIVisoCreatorWidget::sltISOImportAction() 442 { 443 if (!m_pHostBrowser) 444 return; 445 // QStringList selectedObjectPaths = m_pHostBrowser->selectedPathList(); 446 // printf("dddd %d\n", findISOFiles(selectedObjectPaths).size()); 436 447 } 437 448 … … 560 571 connect(m_pOpenAction, &QAction::triggered, 561 572 this, &UIVisoCreatorWidget::sltOpenAction); 573 if (m_pImportISOAction) 574 connect(m_pImportISOAction, &QAction::triggered, 575 this, &UIVisoCreatorWidget::sltISOImportAction); 562 576 } 563 577 … … 580 594 m_pRenameAction->setEnabled(m_pVISOContentBrowser->tableViewHasSelection()); 581 595 m_pResetAction = m_pActionPool->action(UIActionIndex_M_VISOCreator_Reset); 596 m_pOpenAction = m_pActionPool->action(UIActionIndex_M_VISOCreator_Open); 597 m_pImportISOAction = m_pActionPool->action(UIActionIndex_M_VISOCreator_ImportISO); 598 if (m_pImportISOAction) 599 m_pImportISOAction->setEnabled(false); 582 600 } 583 601 … … 594 612 m_pMainMenu->addAction(m_pActionSettings); 595 613 m_pMainMenu->addSeparator(); 614 if (m_pOpenAction) 615 m_pMainMenu->addAction(m_pOpenAction); 596 616 if (m_pAddAction) 597 617 m_pMainMenu->addAction(m_pAddAction); 598 if (m_p OpenAction)599 m_pMainMenu->addAction(m_p OpenAction);618 if (m_pImportISOAction) 619 m_pMainMenu->addAction(m_pImportISOAction); 600 620 if (m_pRemoveAction) 601 621 m_pMainMenu->addAction(m_pRemoveAction); … … 623 643 if (m_pAddAction) 624 644 m_pVerticalToolBar->addAction(m_pAddAction); 645 if (m_pImportISOAction) 646 m_pVerticalToolBar->addAction(m_pImportISOAction); 625 647 if (m_pRenameAction) 626 648 m_pVerticalToolBar->addAction(m_pRenameAction); … … 666 688 m_pSettingsWidget->setSettings(m_visoOptions); 667 689 } 690 } 691 692 QStringList UIVisoCreatorWidget::findISOFiles(const QStringList &pathList) const 693 { 694 QStringList isoList; 695 foreach (const QString &strPath, pathList) 696 { 697 if (QFileInfo(strPath).suffix().compare("iso", Qt::CaseInsensitive) == 0) 698 isoList << strPath; 699 } 700 return isoList; 668 701 } 669 702 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r100169 r100180 114 114 void sltSettingsDialogClosed(bool fAccepted); 115 115 void sltBrowserTreeViewVisibilityChanged(bool fVisible); 116 void sltHostBrowserTableSelectionChanged( bool fIsSelectionEmpty);116 void sltHostBrowserTableSelectionChanged(QStringList pathList); 117 117 void sltContentBrowserTableSelectionChanged(bool fIsSelectionEmpty); 118 118 void sltShowContextMenu(const QWidget *pContextMenuRequester, const QPoint &point); 119 119 void sltOpenAction(); 120 void sltISOImportAction(); 120 121 121 122 private: … … 130 131 void populateMenuMainToolbar(); 131 132 132 void toggleSettingsWidget(bool fShown); 133 void toggleSettingsWidget(bool fShown); 134 QStringList findISOFiles(const QStringList &pathList) const; 133 135 /** @name Main toolbar (and main menu) actions 134 136 * @{ */ … … 144 146 QAction *m_pResetAction; 145 147 QAction *m_pOpenAction; 148 QAction *m_pImportISOAction; 146 149 /** @} */ 147 150 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.cpp
r100169 r100180 251 251 { 252 252 Q_UNUSED(deselected); 253 emit sigTableSelectionChanged(selected.isEmpty()); 253 Q_UNUSED(selected); 254 emit sigTableSelectionChanged(selectedPathList()); 254 255 } 255 256 … … 267 268 setTreeCurrentIndex(index); 268 269 m_pTreeView->blockSignals(false); 269 270 /* Check if we still have something selected after table root index change: */271 if (m_pTableView && m_pTableView->selectionModel())272 emit sigTableSelectionChanged(m_pTableView->selectionModel()->hasSelection());273 270 } 274 271 … … 322 319 if (!m_pTableView || !m_pTableModel) 323 320 return; 321 emit sigAddObjectsToViso(selectedPathList()); 322 } 323 324 QStringList UIVisoHostBrowser::selectedPathList() const 325 { 324 326 QItemSelectionModel *pSelectionModel = m_pTableView->selectionModel(); 325 327 if (!pSelectionModel) 326 return ;328 return QStringList(); 327 329 QModelIndexList selectedIndices = pSelectionModel->selectedRows(0); 328 330 QStringList pathList; … … 334 336 pathList << strPath; 335 337 } 336 emit sigAddObjectsToViso(pathList);338 return pathList; 337 339 } 338 340 … … 352 354 m_pTableView->setRootIndex(m_pTableModel->index(strCurrentTreePath)); 353 355 updateLocationSelectorText(strCurrentTreePath); 356 m_pTableView->clearSelection(); 354 357 } 355 358 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.h
r100155 r100180 48 48 49 49 void sigAddObjectsToViso(QStringList pathList); 50 void sigTableSelectionChanged( bool fIsSelectionEmpty);50 void sigTableSelectionChanged(QStringList pathList); 51 51 52 52 public: … … 58 58 void setCurrentPath(const QString &strPath); 59 59 virtual bool tableViewHasSelection() const final override; 60 /* The list of path of the selected file objects. */ 61 QStringList selectedPathList() const; 60 62 61 63 public slots:
Note:
See TracChangeset
for help on using the changeset viewer.