Changeset 69130 in vbox
- Timestamp:
- Oct 18, 2017 9:29:33 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
- 24 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc
r68508 r69130 40 40 <file alias="cd_modify_disabled_16px.png">images/cd_modify_disabled_16px.png</file> 41 41 <file alias="cd_modify_disabled_22px.png">images/cd_modify_disabled_22px.png</file> 42 <file alias="cd_move_16px.png">images/cd_move_16px.png</file> 43 <file alias="cd_move_22px.png">images/cd_move_22px.png</file> 44 <file alias="cd_move_disabled_16px.png">images/cd_move_disabled_16px.png</file> 45 <file alias="cd_move_disabled_22px.png">images/cd_move_disabled_22px.png</file> 42 46 <file alias="cd_read_16px.png">images/cd_read_16px.png</file> 43 47 <file alias="cd_release_16px.png">images/cd_release_16px.png</file> … … 129 133 <file alias="fd_modify_disabled_16px.png">images/fd_modify_disabled_16px.png</file> 130 134 <file alias="fd_modify_disabled_22px.png">images/fd_modify_disabled_22px.png</file> 135 <file alias="fd_move_16px.png">images/fd_move_16px.png</file> 136 <file alias="fd_move_22px.png">images/fd_move_22px.png</file> 137 <file alias="fd_move_disabled_16px.png">images/fd_move_disabled_16px.png</file> 138 <file alias="fd_move_disabled_22px.png">images/fd_move_disabled_22px.png</file> 131 139 <file alias="fd_read_16px.png">images/fd_read_16px.png</file> 132 140 <file alias="fd_release_16px.png">images/fd_release_16px.png</file> … … 168 176 <file alias="hd_modify_disabled_16px.png">images/hd_modify_disabled_16px.png</file> 169 177 <file alias="hd_modify_disabled_22px.png">images/hd_modify_disabled_22px.png</file> 178 <file alias="hd_move_16px.png">images/hd_move_16px.png</file> 179 <file alias="hd_move_22px.png">images/hd_move_22px.png</file> 180 <file alias="hd_move_disabled_16px.png">images/hd_move_disabled_16px.png</file> 181 <file alias="hd_move_disabled_22px.png">images/hd_move_disabled_22px.png</file> 170 182 <file alias="hd_new_16px.png">images/hd_new_16px.png</file> 171 183 <file alias="hd_new_disabled_16px.png">images/hd_new_disabled_16px.png</file> -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r68962 r69130 35 35 # include "UIWizardCloneVD.h" 36 36 # include "UIMessageCenter.h" 37 # include "QIFileDialog.h" 37 38 # include "QITabWidget.h" 38 39 # include "QITreeWidget.h" … … 73 74 /** Copies UIMedium wrapped by <i>this</i> item. */ 74 75 virtual bool copy() = 0; 76 /** Moves UIMedium wrapped by <i>this</i> item. */ 77 virtual bool move(); 75 78 /** Removes UIMedium wrapped by <i>this</i> item. */ 76 79 virtual bool remove() = 0; … … 318 321 } 319 322 323 bool UIMediumItem::move() 324 { 325 /* Open file-save dialog to choose location for current medium: */ 326 const QString strFileName = QIFileDialog::getSaveFileName(location(), 327 UIMediumManager::tr("Current extension (*.%1)") 328 .arg(QFileInfo(location()).suffix()), 329 treeWidget(), 330 UIMediumManager::tr("Choose the location of this medium"), 331 0, true, true); 332 /* Negative if nothing changed: */ 333 if (strFileName.isNull()) 334 return false; 335 336 /* Search for corresponding medium: */ 337 CMedium comMedium = medium().medium(); 338 339 /* Try to assign new medium location: */ 340 if ( comMedium.isOk() 341 && strFileName != location()) 342 { 343 /* Prepare move storage progress: */ 344 CProgress comProgress = comMedium.SetLocation(strFileName); 345 346 /* Show error message if necessary: */ 347 if (!comMedium.isOk()) 348 { 349 msgCenter().cannotMoveMediumStorage(comMedium, location(), 350 strFileName, treeWidget()); 351 /* Negative if failed: */ 352 return false; 353 } 354 else 355 { 356 /* Show move storage progress: */ 357 msgCenter().showModalProgressDialog(comProgress, UIMediumManager::tr("Moving medium..."), 358 ":/progress_media_move_90px.png", treeWidget()); 359 360 /* Show error message if necessary: */ 361 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 362 { 363 msgCenter().cannotMoveMediumStorage(comProgress, location(), 364 strFileName, treeWidget()); 365 /* Negative if failed: */ 366 return false; 367 } 368 } 369 } 370 371 /* Recache item: */ 372 refreshAll(); 373 374 /* Positive: */ 375 return true; 376 } 377 320 378 bool UIMediumItem::release() 321 379 { … … 780 838 , m_pContextMenu(0) 781 839 , m_pMenu(0) 782 , m_pActionCopy(0), m_pAction Remove(0)840 , m_pActionCopy(0), m_pActionMove(0), m_pActionRemove(0) 783 841 , m_pActionRelease(0), m_pActionDetails(0) 784 842 , m_pActionRefresh(0) … … 801 859 m_pActionCopy->setToolTip(UIMediumManager::tr("Copy Disk Image File (%1)").arg(m_pActionCopy->shortcut().toString())); 802 860 m_pActionCopy->setStatusTip(UIMediumManager::tr("Copy selected disk image file")); 861 } 862 if (m_pActionMove) 863 { 864 m_pActionMove->setText(UIMediumManager::tr("&Move...")); 865 m_pActionMove->setToolTip(UIMediumManager::tr("Move Disk Image File (%1)").arg(m_pActionMove->shortcut().toString())); 866 m_pActionMove->setStatusTip(UIMediumManager::tr("Move selected disk image file")); 803 867 } 804 868 if (m_pActionRemove) … … 1131 1195 } 1132 1196 1197 void UIMediumManagerWidget::sltMoveMedium() 1198 { 1199 /* Get current medium-item: */ 1200 UIMediumItem *pMediumItem = currentMediumItem(); 1201 AssertMsgReturnVoid(pMediumItem, ("Current item must not be null")); 1202 AssertReturnVoid(!pMediumItem->id().isNull()); 1203 1204 /* Copy current medium-item: */ 1205 pMediumItem->move(); 1206 1207 /* Push the current item data into details-widget: */ 1208 sltHandleCurrentTabChanged(); 1209 } 1210 1133 1211 void UIMediumManagerWidget::sltRemoveMedium() 1134 1212 { … … 1314 1392 } 1315 1393 1394 /* Create 'Move' action: */ 1395 m_pActionMove = new QAction(this); 1396 AssertPtrReturnVoid(m_pActionMove); 1397 { 1398 /* Configure move-action: */ 1399 m_pActionMove->setShortcut(QKeySequence("Ctrl+M")); 1400 connect(m_pActionMove, &QAction::triggered, this, &UIMediumManagerWidget::sltMoveMedium); 1401 } 1402 1316 1403 /* Create 'Remove' action: */ 1317 1404 m_pActionRemove = new QAction(this); … … 1369 1456 if (m_pActionCopy) 1370 1457 m_pMenu->addAction(m_pActionCopy); 1458 if (m_pActionMove) 1459 m_pMenu->addAction(m_pActionMove); 1371 1460 if (m_pActionRemove) 1372 1461 m_pMenu->addAction(m_pActionRemove); 1373 if ( (m_pActionCopy || m_pAction Remove)1462 if ( (m_pActionCopy || m_pActionMove || m_pActionRemove) 1374 1463 && (m_pActionRelease || m_pActionDetails)) 1375 1464 m_pMenu->addSeparator(); … … 1395 1484 if (m_pActionCopy) 1396 1485 m_pContextMenu->addAction(m_pActionCopy); 1486 if (m_pActionMove) 1487 m_pContextMenu->addAction(m_pActionMove); 1397 1488 if (m_pActionRemove) 1398 1489 m_pContextMenu->addAction(m_pActionRemove); 1399 if ( (m_pActionCopy || m_pAction Remove)1490 if ( (m_pActionCopy || m_pActionMove || m_pActionRemove) 1400 1491 && (m_pActionRelease || m_pActionDetails)) 1401 1492 m_pContextMenu->addSeparator(); … … 1443 1534 if (m_pActionCopy) 1444 1535 m_pToolBar->addAction(m_pActionCopy); 1536 if (m_pActionMove) 1537 m_pToolBar->addAction(m_pActionMove); 1445 1538 if (m_pActionRemove) 1446 1539 m_pToolBar->addAction(m_pActionRemove); 1447 if ( (m_pActionCopy || m_pAction Remove)1540 if ( (m_pActionCopy || m_pActionMove || m_pActionRemove) 1448 1541 && (m_pActionRelease || m_pActionDetails)) 1449 1542 m_pToolBar->addSeparator(); … … 1698 1791 m_pActionCopy->setEnabled(fActionEnabledCopy); 1699 1792 } 1793 if (m_pActionMove) 1794 { 1795 bool fActionEnabledMove = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Edit); 1796 m_pActionMove->setEnabled(fActionEnabledMove); 1797 } 1700 1798 if (m_pActionRemove) 1701 1799 { … … 1733 1831 QString(":/%1_copy_disabled_22px.png").arg(strPrefix), 1734 1832 QString(":/%1_copy_disabled_16px.png").arg(strPrefix))); 1833 if (m_pActionMove) 1834 m_pActionMove->setIcon(UIIconPool::iconSetFull(QString(":/%1_move_22px.png").arg(strPrefix), 1835 QString(":/%1_move_16px.png").arg(strPrefix), 1836 QString(":/%1_move_disabled_22px.png").arg(strPrefix), 1837 QString(":/%1_move_disabled_16px.png").arg(strPrefix))); 1735 1838 if (m_pActionRemove) 1736 1839 m_pActionRemove->setIcon(UIIconPool::iconSetFull(QString(":/%1_remove_22px.png").arg(strPrefix), … … 1837 1940 } 1838 1941 1839 case Action_Copy: case Action_Modify: case Action_Release: break; /* Shut up MSC */ 1942 default: 1943 break; 1840 1944 } 1841 1945 } … … 2214 2318 return pItem->medium().parentID() == UIMedium::nullID(); 2215 2319 } 2216 case Action_Modify:2217 {2218 /* False for children: */2219 return pItem->medium().parentID() == UIMedium::nullID();2220 }2221 2320 case Action_Remove: 2222 2321 { … … 2230 2329 } 2231 2330 2232 case Action_Add: break; /* Shut up MSC */ 2331 default: 2332 break; 2233 2333 } 2234 2334 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r68962 r69130 58 58 59 59 /** Item action types. */ 60 enum Action { Action_Add, Action_Edit, Action_Copy, Action_ Modify, Action_Remove, Action_Release };60 enum Action { Action_Add, Action_Edit, Action_Copy, Action_Remove, Action_Release }; 61 61 62 62 signals: … … 127 127 /** Handles command to copy medium. */ 128 128 void sltCopyMedium(); 129 /** Handles command to move medium. */ 130 void sltMoveMedium(); 129 131 /** Handles command to remove medium. */ 130 132 void sltRemoveMedium(); … … 310 312 /** Holds the Copy action instance. */ 311 313 QAction *m_pActionCopy; 314 /** Holds the Move action instance. */ 315 QAction *m_pActionMove; 312 316 /** Holds the Remove action instance. */ 313 317 QAction *m_pActionRemove;
Note:
See TracChangeset
for help on using the changeset viewer.