Changeset 67718 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 30, 2017 8:36:52 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116565
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r67704 r67718 754 754 , m_pContextMenu(0) 755 755 , m_pMenu(0) 756 , m_pActionCopy(0), m_pAction Modify(0)757 , m_pActionRe move(0), m_pActionRelease(0)756 , m_pActionCopy(0), m_pActionRemove(0) 757 , m_pActionRelease(0), m_pActionModify(0) 758 758 , m_pActionRefresh(0) 759 759 , m_pProgressBar(0) … … 776 776 m_pActionCopy->setStatusTip(UIMediumManager::tr("Copy an existing disk image file")); 777 777 } 778 if (m_pActionRemove) 779 { 780 m_pActionRemove->setText(UIMediumManager::tr("R&emove")); 781 m_pActionRemove->setToolTip(m_pActionRemove->text().remove('&') + QString(" (%1)").arg(m_pActionRemove->shortcut().toString())); 782 m_pActionRemove->setStatusTip(UIMediumManager::tr("Remove the selected disk image file")); 783 } 784 if (m_pActionRelease) 785 { 786 m_pActionRelease->setText(UIMediumManager::tr("Re&lease")); 787 m_pActionRelease->setToolTip(m_pActionRelease->text().remove('&') + QString(" (%1)").arg(m_pActionRelease->shortcut().toString())); 788 m_pActionRelease->setStatusTip(UIMediumManager::tr("Release the selected disk image file by detaching it from the machines")); 789 } 778 790 if (m_pActionModify) 779 791 { … … 781 793 m_pActionModify->setToolTip(m_pActionModify->text().remove('&') + QString(" (%1)").arg(m_pActionModify->shortcut().toString())); 782 794 m_pActionModify->setStatusTip(UIMediumManager::tr("Modify the attributes of the selected disk image file")); 783 }784 if (m_pActionRemove)785 {786 m_pActionRemove->setText(UIMediumManager::tr("R&emove"));787 m_pActionRemove->setToolTip(m_pActionRemove->text().remove('&') + QString(" (%1)").arg(m_pActionRemove->shortcut().toString()));788 m_pActionRemove->setStatusTip(UIMediumManager::tr("Remove the selected disk image file"));789 }790 if (m_pActionRelease)791 {792 m_pActionRelease->setText(UIMediumManager::tr("Re&lease"));793 m_pActionRelease->setToolTip(m_pActionRelease->text().remove('&') + QString(" (%1)").arg(m_pActionRelease->shortcut().toString()));794 m_pActionRelease->setStatusTip(UIMediumManager::tr("Release the selected disk image file by detaching it from the machines"));795 795 } 796 796 if (m_pActionRefresh) … … 1026 1026 } 1027 1027 1028 void UIMediumManagerWidget::slt ModifyMedium()1028 void UIMediumManagerWidget::sltRemoveMedium() 1029 1029 { 1030 1030 /* Get current medium-item: */ … … 1033 1033 AssertReturnVoid(!pMediumItem->id().isNull()); 1034 1034 1035 /* Modify current medium-item: */ 1036 bool fResult = pMediumItem->modify(); 1037 1038 /* Update HD information-panes: */ 1039 if (fResult) 1040 updateInformationFieldsHD(); 1041 } 1042 1043 void UIMediumManagerWidget::sltRemoveMedium() 1035 /* Remove current medium-item: */ 1036 pMediumItem->remove(); 1037 } 1038 1039 void UIMediumManagerWidget::sltReleaseMedium() 1044 1040 { 1045 1041 /* Get current medium-item: */ … … 1049 1045 1050 1046 /* Remove current medium-item: */ 1051 pMediumItem->remove(); 1052 } 1053 1054 void UIMediumManagerWidget::sltReleaseMedium() 1047 bool fResult = pMediumItem->release(); 1048 1049 /* Refetch currently chosen medium-item: */ 1050 if (fResult) 1051 refetchCurrentChosenMediumItem(); 1052 } 1053 1054 void UIMediumManagerWidget::sltModifyMedium() 1055 1055 { 1056 1056 /* Get current medium-item: */ … … 1059 1059 AssertReturnVoid(!pMediumItem->id().isNull()); 1060 1060 1061 /* Removecurrent medium-item: */1062 bool fResult = pMediumItem-> release();1063 1064 /* Refetch currently chosen medium-item: */1061 /* Modify current medium-item: */ 1062 bool fResult = pMediumItem->modify(); 1063 1064 /* Update HD information-panes: */ 1065 1065 if (fResult) 1066 refetchCurrentChosenMediumItem();1066 updateInformationFieldsHD(); 1067 1067 } 1068 1068 … … 1220 1220 } 1221 1221 1222 /* Create 'Remove' action: */ 1223 m_pActionRemove = new QAction(this); 1224 AssertPtrReturnVoid(m_pActionRemove); 1225 { 1226 /* Configure remove-action: */ 1227 m_pActionRemove->setShortcut(QKeySequence(QKeySequence::Delete)); 1228 connect(m_pActionRemove, SIGNAL(triggered()), this, SLOT(sltRemoveMedium())); 1229 } 1230 1231 /* Create 'Release' action: */ 1232 m_pActionRelease = new QAction(this); 1233 AssertPtrReturnVoid(m_pActionRelease); 1234 { 1235 /* Configure release-action: */ 1236 m_pActionRelease->setShortcut(QKeySequence("Ctrl+L")); 1237 connect(m_pActionRelease, SIGNAL(triggered()), this, SLOT(sltReleaseMedium())); 1238 } 1239 1222 1240 /* Create 'Modify' action: */ 1223 1241 m_pActionModify = new QAction(this); … … 1227 1245 m_pActionModify->setShortcut(QKeySequence("Ctrl+Space")); 1228 1246 connect(m_pActionModify, SIGNAL(triggered()), this, SLOT(sltModifyMedium())); 1229 }1230 1231 /* Create 'Remove' action: */1232 m_pActionRemove = new QAction(this);1233 AssertPtrReturnVoid(m_pActionRemove);1234 {1235 /* Configure remove-action: */1236 m_pActionRemove->setShortcut(QKeySequence(QKeySequence::Delete));1237 connect(m_pActionRemove, SIGNAL(triggered()), this, SLOT(sltRemoveMedium()));1238 }1239 1240 /* Create 'Release' action: */1241 m_pActionRelease = new QAction(this);1242 AssertPtrReturnVoid(m_pActionRelease);1243 {1244 /* Configure release-action: */1245 m_pActionRelease->setShortcut(QKeySequence("Ctrl+L"));1246 connect(m_pActionRelease, SIGNAL(triggered()), this, SLOT(sltReleaseMedium()));1247 1247 } 1248 1248 … … 1271 1271 AssertPtrReturnVoid(m_pMenu); 1272 1272 { 1273 /* Configure 'Actions' menu: */ 1274 m_pMenu->addAction(m_pActionCopy); 1275 m_pMenu->addAction(m_pActionModify); 1276 m_pMenu->addAction(m_pActionRemove); 1277 m_pMenu->addAction(m_pActionRelease); 1278 m_pMenu->addAction(m_pActionRefresh); 1273 /* Configure 'Medium' menu: */ 1274 if (m_pActionCopy) 1275 m_pMenu->addAction(m_pActionCopy); 1276 if (m_pActionRemove) 1277 m_pMenu->addAction(m_pActionRemove); 1278 if ( (m_pActionCopy || m_pActionRemove) 1279 && (m_pActionRelease || m_pActionModify)) 1280 m_pMenu->addSeparator(); 1281 if (m_pActionRelease) 1282 m_pMenu->addAction(m_pActionRelease); 1283 if (m_pActionModify) 1284 m_pMenu->addAction(m_pActionModify); 1285 if ( (m_pActionRelease || m_pActionModify) 1286 && (m_pActionRefresh)) 1287 m_pMenu->addSeparator(); 1288 if (m_pActionRefresh) 1289 m_pMenu->addAction(m_pActionRefresh); 1279 1290 } 1280 1291 } … … 1287 1298 { 1288 1299 /* Configure contex-menu: */ 1289 m_pContextMenu->addAction(m_pActionCopy); 1290 m_pContextMenu->addAction(m_pActionModify); 1291 m_pContextMenu->addAction(m_pActionRemove); 1292 m_pContextMenu->addAction(m_pActionRelease); 1300 if (m_pActionCopy) 1301 m_pContextMenu->addAction(m_pActionCopy); 1302 if (m_pActionRemove) 1303 m_pContextMenu->addAction(m_pActionRemove); 1304 if ( (m_pActionCopy || m_pActionRemove) 1305 && (m_pActionRelease || m_pActionModify)) 1306 m_pContextMenu->addSeparator(); 1307 if (m_pActionRelease) 1308 m_pContextMenu->addAction(m_pActionRelease); 1309 if (m_pActionModify) 1310 m_pContextMenu->addAction(m_pActionModify); 1293 1311 } 1294 1312 } … … 1328 1346 if (m_pActionCopy) 1329 1347 m_pToolBar->addAction(m_pActionCopy); 1348 if (m_pActionRemove) 1349 m_pToolBar->addAction(m_pActionRemove); 1350 if ( (m_pActionCopy || m_pActionRemove) 1351 && (m_pActionModify || m_pActionRelease)) 1352 m_pToolBar->addSeparator(); 1353 if (m_pActionRelease) 1354 m_pToolBar->addAction(m_pActionRelease); 1330 1355 if (m_pActionModify) 1331 1356 m_pToolBar->addAction(m_pActionModify); 1332 if (m_pActionRemove) 1333 m_pToolBar->addAction(m_pActionRemove); 1334 if (m_pActionRelease) 1335 m_pToolBar->addAction(m_pActionRelease); 1357 if ( (m_pActionModify || m_pActionRelease) 1358 && (m_pActionRefresh)) 1359 m_pToolBar->addSeparator(); 1336 1360 if (m_pActionRefresh) 1337 1361 m_pToolBar->addAction(m_pActionRefresh); 1362 1338 1363 #ifdef VBOX_WS_MAC 1339 1364 /* Check whether we are embedded into a stack: */ … … 1365 1390 m_pTabWidget->setTabIcon(tabIndex(UIMediumType_Floppy), m_iconFD); 1366 1391 connect(m_pTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandleCurrentTabChanged())); 1392 1367 1393 /* Add tab-widget into central layout: */ 1368 1394 layout()->addWidget(m_pTabWidget); 1395 1369 1396 /* Update other widgets according chosen tab: */ 1370 1397 sltHandleCurrentTabChanged(); … … 1597 1624 m_pActionCopy->setEnabled(fActionEnabledCopy); 1598 1625 } 1626 if (m_pActionRemove) 1627 { 1628 bool fActionEnabledRemove = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Remove); 1629 m_pActionRemove->setEnabled(fActionEnabledRemove); 1630 } 1631 if (m_pActionRelease) 1632 { 1633 bool fActionEnabledRelease = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Release); 1634 m_pActionRelease->setEnabled(fActionEnabledRelease); 1635 } 1599 1636 if (m_pActionModify) 1600 1637 { … … 1602 1639 fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Modify); 1603 1640 m_pActionModify->setEnabled(fActionEnabledModify); 1604 }1605 if (m_pActionRemove)1606 {1607 bool fActionEnabledRemove = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Remove);1608 m_pActionRemove->setEnabled(fActionEnabledRemove);1609 }1610 if (m_pActionRelease)1611 {1612 bool fActionEnabledRelease = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Release);1613 m_pActionRelease->setEnabled(fActionEnabledRelease);1614 1641 } 1615 1642 } … … 1633 1660 QString(":/%1_copy_disabled_22px.png").arg(strPrefix), 1634 1661 QString(":/%1_copy_disabled_16px.png").arg(strPrefix))); 1635 if (m_pActionModify)1636 m_pActionModify->setIcon(UIIconPool::iconSetFull(QString(":/%1_modify_22px.png").arg(strPrefix),1637 QString(":/%1_modify_16px.png").arg(strPrefix),1638 QString(":/%1_modify_disabled_22px.png").arg(strPrefix),1639 QString(":/%1_modify_disabled_16px.png").arg(strPrefix)));1640 1662 if (m_pActionRemove) 1641 1663 m_pActionRemove->setIcon(UIIconPool::iconSetFull(QString(":/%1_remove_22px.png").arg(strPrefix), … … 1648 1670 QString(":/%1_release_disabled_22px.png").arg(strPrefix), 1649 1671 QString(":/%1_release_disabled_16px.png").arg(strPrefix))); 1672 if (m_pActionModify) 1673 m_pActionModify->setIcon(UIIconPool::iconSetFull(QString(":/%1_modify_22px.png").arg(strPrefix), 1674 QString(":/%1_modify_16px.png").arg(strPrefix), 1675 QString(":/%1_modify_disabled_22px.png").arg(strPrefix), 1676 QString(":/%1_modify_disabled_16px.png").arg(strPrefix))); 1650 1677 if (m_pActionRefresh && m_pActionRefresh->icon().isNull()) 1651 1678 m_pActionRefresh->setIcon(UIIconPool::iconSetFull(":/refresh_22px.png", ":/refresh_16px.png", -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r67704 r67718 107 107 /** Handles command to copy medium. */ 108 108 void sltCopyMedium(); 109 /** Handles command to modify medium. */110 void sltModifyMedium();111 109 /** Handles command to remove medium. */ 112 110 void sltRemoveMedium(); 113 111 /** Handles command to release medium. */ 114 112 void sltReleaseMedium(); 113 /** Handles command to modify medium. */ 114 void sltModifyMedium(); 115 115 /** Handles command to refresh medium. */ 116 116 void sltRefreshAll(); … … 309 309 /** Holds the Copy action instance. */ 310 310 QAction *m_pActionCopy; 311 /** Holds the Modify action instance. */312 QAction *m_pActionModify;313 311 /** Holds the Remove action instance. */ 314 312 QAction *m_pActionRemove; 315 313 /** Holds the Release action instance. */ 316 314 QAction *m_pActionRelease; 315 /** Holds the Modify action instance. */ 316 QAction *m_pActionModify; 317 317 /** Holds the Refresh action instance. */ 318 318 QAction *m_pActionRefresh;
Note:
See TracChangeset
for help on using the changeset viewer.