- Timestamp:
- Sep 9, 2021 1:50:47 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensionpackmanager/UIExtensionPackManager.cpp
r91009 r91180 254 254 /* Show error message if necessary: */ 255 255 if (!comVBox.isOk()) 256 msgCenter().cannotAcquireExtensionPackManager(comVBox);256 UINotificationMessage::cannotGetExtensionPackManager(comVBox); 257 257 else 258 258 { … … 492 492 /* Show error message if necessary: */ 493 493 if (!comVBox.isOk()) 494 msgCenter().cannotAcquireExtensionPackManager(comVBox);494 UINotificationMessage::cannotGetExtensionPackManager(comVBox); 495 495 else 496 496 { … … 500 500 /* Show error message if necessary: */ 501 501 if (!comEPManager.isOk()) 502 msgCenter().cannotAcquireExtensionPacks(comEPManager);502 UINotificationMessage::cannotAcquireExtensionPackManagerParameter(comEPManager); 503 503 else 504 504 { … … 545 545 /* Show error message if necessary: */ 546 546 if (!comExtensionPack.isOk()) 547 msgCenter().cannotAcquireExtensionPackParameter(comExtensionPack, this);547 UINotificationMessage::cannotAcquireExtensionPackParameter(comExtensionPack); 548 548 } 549 549 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIExtension.cpp
r91009 r91180 33 33 { 34 34 /* If the extension pack manager isn't available, skip any attempts to install: */ 35 CExtPackManager extPackManager = uiCommon().virtualBox().GetExtensionPackManager();36 if ( extPackManager.isNull())35 CExtPackManager comExtPackManager = uiCommon().virtualBox().GetExtensionPackManager(); 36 if (comExtPackManager.isNull()) 37 37 return; 38 38 /* Open the extpack tarball via IExtPackManager: */ 39 39 CExtPackFile comExtPackFile; 40 40 if (strDigest.isEmpty()) 41 comExtPackFile = extPackManager.OpenExtPackFile(strFilePath);41 comExtPackFile = comExtPackManager.OpenExtPackFile(strFilePath); 42 42 else 43 43 { 44 44 QString strFileAndHash = QString("%1::SHA-256=%2").arg(strFilePath).arg(strDigest); 45 comExtPackFile = extPackManager.OpenExtPackFile(strFileAndHash);45 comExtPackFile = comExtPackManager.OpenExtPackFile(strFileAndHash); 46 46 } 47 if (! extPackManager.isOk())47 if (!comExtPackManager.isOk()) 48 48 { 49 msgCenter().cannotOpenExtPack(strFilePath, extPackManager, pParent);49 UINotificationMessage::cannotOpenExtPack(comExtPackManager, strFilePath); 50 50 return; 51 51 } … … 53 53 if (!comExtPackFile.GetUsable()) 54 54 { 55 msgCenter().warnAboutBadExtPackFile(strFilePath, comExtPackFile, pParent);55 UINotificationMessage::cannotOpenExtPackFile(comExtPackFile, strFilePath); 56 56 return; 57 57 } … … 63 63 /* Check if there is a version of the extension pack already 64 64 * installed on the system and let the user decide what to do about it. */ 65 CExtPack comExtPackCur = extPackManager.Find(strPackName);65 CExtPack comExtPackCur = comExtPackManager.Find(strPackName); 66 66 bool fReplaceIt = comExtPackCur.isOk(); 67 67 if (fReplaceIt) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r91179 r91180 1130 1130 QString() /* cancel button text */, 1131 1131 false /* ok button by default? */); 1132 }1133 1134 bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, bool fInduced, QWidget *pParent /* = 0 */) const1135 {1136 /* Prepare the usage: */1137 QStringList usage;1138 CVirtualBox vbox = uiCommon().virtualBox();1139 foreach (const QUuid &uMachineID, medium.curStateMachineIds())1140 {1141 CMachine machine = vbox.FindMachine(uMachineID.toString());1142 if (!vbox.isOk() || machine.isNull())1143 continue;1144 usage << machine.GetName();1145 }1146 /* Show the question: */1147 return !fInduced1148 ? questionBinary(pParent, MessageType_Question,1149 tr("<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p>"1150 "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>")1151 .arg(medium.location(), usage.join(", ")),1152 0 /* auto-confirm id */,1153 tr("Release", "detach medium"))1154 : questionBinary(pParent, MessageType_Question,1155 tr("<p>The changes you requested require this disk to "1156 "be released from the machines it is attached to.</p>"1157 "<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p>"1158 "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>")1159 .arg(medium.location(), usage.join(", ")),1160 0 /* auto-confirm id */,1161 tr("Release", "detach medium"));1162 }1163 1164 bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pParent /* = 0*/) const1165 {1166 /* Prepare the message: */1167 QString strMessage;1168 switch (medium.type())1169 {1170 case UIMediumDeviceType_HardDisk:1171 {1172 strMessage = tr("<p>Are you sure you want to remove the virtual hard disk "1173 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");1174 /* Compose capabilities flag: */1175 qulonglong caps = 0;1176 QVector<KMediumFormatCapabilities> capabilities;1177 capabilities = medium.medium().GetMediumFormat().GetCapabilities();1178 for (int i = 0; i < capabilities.size(); ++i)1179 caps |= capabilities[i];1180 /* Check capabilities for additional options: */1181 if (caps & KMediumFormatCapabilities_File)1182 {1183 if (medium.state() == KMediumState_Inaccessible)1184 strMessage += tr("<p>As this hard disk is inaccessible its image file"1185 " can not be deleted.</p>");1186 }1187 break;1188 }1189 case UIMediumDeviceType_DVD:1190 {1191 strMessage = tr("<p>Are you sure you want to remove the virtual optical disk "1192 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");1193 strMessage += tr("<p>Note that the storage unit of this medium will not be "1194 "deleted and that it will be possible to use it later again.</p>");1195 break;1196 }1197 case UIMediumDeviceType_Floppy:1198 {1199 strMessage = tr("<p>Are you sure you want to remove the virtual floppy disk "1200 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");1201 strMessage += tr("<p>Note that the storage unit of this medium will not be "1202 "deleted and that it will be possible to use it later again.</p>");1203 break;1204 }1205 default:1206 break;1207 }1208 /* Show the question: */1209 return questionBinary(pParent, MessageType_Question,1210 strMessage.arg(medium.location()),1211 0 /* auto-confirm id */,1212 tr("Remove", "medium") /* ok button text */,1213 QString() /* cancel button text */,1214 false /* ok button by default? */);1215 }1216 1217 int UIMessageCenter::confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const1218 {1219 return questionTrinary(pParent, MessageType_Question,1220 tr("<p>Do you want to delete the storage unit of the virtual hard disk "1221 "<nobr><b>%1</b></nobr>?</p>"1222 "<p>If you select <b>Delete</b> then the specified storage unit "1223 "will be permanently deleted. This operation <b>cannot be "1224 "undone</b>.</p>"1225 "<p>If you select <b>Keep</b> then the hard disk will be only "1226 "removed from the list of known hard disks, but the storage unit "1227 "will be left untouched which makes it possible to add this hard "1228 "disk to the list later again.</p>")1229 .arg(strLocation),1230 0 /* auto-confirm id */,1231 tr("Delete", "hard disk storage"),1232 tr("Keep", "hard disk storage"));1233 }1234 1235 bool UIMessageCenter::confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent /* = 0 */) const1236 {1237 return questionBinary(pParent, MessageType_Question,1238 tr("<p>Deleting this host-only network will remove "1239 "the host-only interface this network is based on. Do you want to "1240 "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>"1241 "<p><b>Note:</b> this interface may be in use by one or more "1242 "virtual network adapters belonging to one of your VMs. "1243 "After it is removed, these adapters will no longer be usable until "1244 "you correct their settings by either choosing a different interface "1245 "name or a different adapter attachment type.</p>")1246 .arg(strName),1247 0 /* auto-confirm id */,1248 tr("Remove") /* ok button text */,1249 QString() /* cancel button text */,1250 false /* ok button by default? */);1251 }1252 1253 bool UIMessageCenter::confirmNATNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const1254 {1255 return questionBinary(pParent, MessageType_Question,1256 tr("<p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p>"1257 "<p>If this network is in use by one or more virtual "1258 "machine network adapters these adapters will no longer be "1259 "usable until you correct their settings by either choosing "1260 "a different network name or a different adapter attachment "1261 "type.</p>")1262 .arg(strName),1263 0 /* auto-confirm id */,1264 tr("Remove") /* ok button text */,1265 QString() /* cancel button text */,1266 false /* ok button by default? */);1267 }1268 1269 bool UIMessageCenter::confirmCloudProfileRemoval(const QString &strName, QWidget *pParent /* = 0 */) const1270 {1271 return questionBinary(pParent, MessageType_Question,1272 tr("<p>Do you want to remove the cloud profile <nobr><b>%1</b>?</nobr></p>")1273 .arg(strName),1274 0 /* auto-confirm id */,1275 tr("Remove") /* ok button text */,1276 QString() /* cancel button text */,1277 false /* ok button by default? */);1278 }1279 1280 bool UIMessageCenter::confirmCloudProfilesImport(QWidget *pParent /* = 0 */) const1281 {1282 return questionBinary(pParent, MessageType_Question,1283 tr("<p>Do you want to import cloud profiles from external files?</p>"1284 "<p>VirtualBox cloud profiles will be overwritten and their data will be lost.</p>"),1285 0 /* auto-confirm id */,1286 tr("Import") /* ok button text */,1287 QString() /* cancel button text */,1288 false /* ok button by default? */);1289 }1290 1291 int UIMessageCenter::confirmCloudProfileManagerClosing(QWidget *pParent /* = 0 */) const1292 {1293 return question(pParent, MessageType_Question,1294 tr("<p>Do you want to close the Cloud Profile Manager?</p>"1295 "<p>There seems to be an unsaved changes. "1296 "You can choose to <b>Accept</b> or <b>Reject</b> them automatically "1297 "or cancel to keep the dialog opened.</p>"),1298 0 /* auto-confirm id */,1299 AlertButton_Choice1,1300 AlertButton_Choice2,1301 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,1302 tr("Accept", "cloud profile manager changes"),1303 tr("Reject", "cloud profile manager changes"));1304 }1305 1306 bool UIMessageCenter::confirmCloudConsoleApplicationRemoval(const QString &strName, QWidget *pParent /* = 0 */) const1307 {1308 return questionBinary(pParent, MessageType_Question,1309 tr("<p>Do you want to remove the cloud console application <nobr><b>%1</b>?</nobr></p>")1310 .arg(strName),1311 0 /* auto-confirm id */,1312 tr("Remove") /* ok button text */,1313 QString() /* cancel button text */,1314 false /* ok button by default? */);1315 }1316 1317 bool UIMessageCenter::confirmCloudConsoleProfileRemoval(const QString &strName, QWidget *pParent /* = 0 */) const1318 {1319 return questionBinary(pParent, MessageType_Question,1320 tr("<p>Do you want to remove the cloud console profile <nobr><b>%1</b>?</nobr></p>")1321 .arg(strName),1322 0 /* auto-confirm id */,1323 tr("Remove") /* ok button text */,1324 QString() /* cancel button text */,1325 false /* ok button by default? */);1326 }1327 1328 void UIMessageCenter::cannotAcquireHardDiskLocation(const CMedium &comMedium, QWidget *pParent /* = 0 */) const1329 {1330 /* Show the error: */1331 error(pParent, MessageType_Error,1332 tr("Failed to acquire hard disk location."), UIErrorString::formatErrorInfo(comMedium));1333 }1334 1335 void UIMessageCenter::cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const1336 {1337 error(pParent, MessageType_Error,1338 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")1339 .arg(strLocation),1340 UIErrorString::formatErrorInfo(medium));1341 }1342 1343 void UIMessageCenter::cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const1344 {1345 error(pParent, MessageType_Error,1346 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")1347 .arg(strLocation),1348 UIErrorString::formatErrorInfo(progress));1349 }1350 1351 void UIMessageCenter::cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent /* = 0*/) const1352 {1353 error(pParent, MessageType_Error,1354 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")1355 .arg(strMachineName),1356 UIErrorString::formatErrorInfo(machine));1357 }1358 1359 void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const1360 {1361 error(pParent, MessageType_Error,1362 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")1363 .arg(strMachineName),1364 UIErrorString::formatErrorInfo(progress));1365 }1366 1367 void UIMessageCenter::cannotFindSnapshotByName(const CMachine &comMachine,1368 const QString &strName,1369 QWidget *pParent /* = 0 */) const1370 {1371 error(pParent, MessageType_Error,1372 tr("Can't find snapshot named <b>%1</b>.")1373 .arg(strName),1374 UIErrorString::formatErrorInfo(comMachine));1375 }1376 1377 void UIMessageCenter::cannotAcquireCloudProviderManager(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const1378 {1379 error(pParent, MessageType_Error,1380 tr("Failed to acquire cloud provider manager."),1381 UIErrorString::formatErrorInfo(comVBox));1382 }1383 1384 void UIMessageCenter::cannotFindCloudProvider(const CCloudProviderManager &comManager, const QUuid &uId, QWidget *pParent /* = 0 */) const1385 {1386 error(pParent, MessageType_Error,1387 tr("Failed to find cloud provider with following uuid: <b>%1</b>.").arg(uId.toString()),1388 UIErrorString::formatErrorInfo(comManager));1389 }1390 1391 void UIMessageCenter::cannotFindCloudProfile(const CCloudProvider &comProvider, const QString &strName, QWidget *pParent /* = 0 */) const1392 {1393 error(pParent, MessageType_Error,1394 tr("Failed to find cloud profile with following name: <b>%1</b>.").arg(strName),1395 UIErrorString::formatErrorInfo(comProvider));1396 }1397 1398 void UIMessageCenter::cannotCreateCloudClient(const CCloudProfile &comProfile, QWidget *pParent /* = 0 */) const1399 {1400 error(pParent, MessageType_Error,1401 tr("Failed to create cloud client."),1402 UIErrorString::formatErrorInfo(comProfile));1403 }1404 1405 void UIMessageCenter::cannotAcquireCloudProviderManagerParameter(const CCloudProviderManager &comManager, QWidget *pParent /* = 0 */) const1406 {1407 error(pParent, MessageType_Error,1408 tr("Failed to acquire cloud provider manager parameter."),1409 UIErrorString::formatErrorInfo(comManager));1410 }1411 1412 void UIMessageCenter::cannotAcquireCloudProviderParameter(const CCloudProvider &comProvider, QWidget *pParent /* = 0 */) const1413 {1414 error(pParent, MessageType_Error,1415 tr("Failed to acquire cloud provider parameter."),1416 UIErrorString::formatErrorInfo(comProvider));1417 }1418 1419 void UIMessageCenter::cannotAcquireCloudProfileParameter(const CCloudProfile &comProfile, QWidget *pParent /* = 0 */) const1420 {1421 error(pParent, MessageType_Error,1422 tr("Failed to acquire cloud profile parameter."),1423 UIErrorString::formatErrorInfo(comProfile));1424 }1425 1426 void UIMessageCenter::cannotAcquireCloudClientParameter(const CCloudClient &comClient, QWidget *pParent /* = 0 */) const1427 {1428 error(pParent, MessageType_Error,1429 tr("Failed to acquire cloud client parameter."),1430 UIErrorString::formatErrorInfo(comClient));1431 }1432 1433 void UIMessageCenter::cannotAcquireCloudClientParameter(const CProgress &comProgress, QWidget *pParent /* = 0 */) const1434 {1435 error(pParent, MessageType_Error,1436 tr("Failed to acquire cloud client parameter."),1437 UIErrorString::formatErrorInfo(comProgress));1438 }1439 1440 void UIMessageCenter::cannotAcquireCloudMachineParameter(const CCloudMachine &comMachine, QWidget *pParent /* = 0 */) const1441 {1442 error(pParent, MessageType_Error,1443 tr("Failed to acquire cloud machine parameter."),1444 UIErrorString::formatErrorInfo(comMachine));1445 }1446 1447 void UIMessageCenter::cannotAcquireCloudMachineParameter(const CProgress &comProgress, QWidget *pParent /* = 0 */) const1448 {1449 error(pParent, MessageType_Error,1450 tr("Failed to acquire cloud machine parameter."),1451 UIErrorString::formatErrorInfo(comProgress));1452 }1453 1454 void UIMessageCenter::cannotAssignFormValue(const QString &strError, QWidget *pParent /* = 0 */) const1455 {1456 error(pParent, MessageType_Error,1457 tr("Failed to assign form value."),1458 strError);1459 }1460 1461 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER1462 bool UIMessageCenter::confirmLookingForGuestAdditions() const1463 {1464 return questionBinary(0, MessageType_Question,1465 tr("<p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p>"1466 "<p>Do you wish to download this disk image file from the Internet?</p>"),1467 0 /* auto-confirm id */,1468 tr("Download"));1469 }1470 1471 bool UIMessageCenter::confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const1472 {1473 return questionBinary(windowManager().mainWindowShown(), MessageType_Question,1474 tr("<p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file "1475 "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>")1476 .arg(strUrl, QLocale(UITranslator::languageId()).toString(uSize)),1477 0 /* auto-confirm id */,1478 tr("Download"));1479 }1480 1481 void UIMessageCenter::cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const1482 {1483 alert(windowManager().mainWindowShown(), MessageType_Error,1484 tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "1485 "from <nobr><a href=\"%1\">%1</a></nobr> "1486 "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>"1487 "<p>Please choose another location for that file.</p>")1488 .arg(strURL, strTarget));1489 }1490 1491 bool UIMessageCenter::proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const1492 {1493 return questionBinary(windowManager().mainWindowShown(), MessageType_Question,1494 tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "1495 "from <nobr><a href=\"%1\">%1</a></nobr> "1496 "and saved locally as <nobr><b>%2</b>.</nobr></p>"1497 "<p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p>")1498 .arg(strUrl, strSrc),1499 0 /* auto-confirm id */,1500 tr("Insert", "additions"));1501 }1502 1503 bool UIMessageCenter::confirmLookingForUserManual(const QString &strMissedLocation) const1504 {1505 return questionBinary(0, MessageType_Question,1506 tr("<p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p>"1507 "<p>Do you wish to download this file from the Internet?</p>")1508 .arg(strMissedLocation),1509 0 /* auto-confirm id */,1510 tr("Download"));1511 }1512 1513 bool UIMessageCenter::confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const1514 {1515 return questionBinary(windowManager().mainWindowShown(), MessageType_Question,1516 tr("<p>Are you sure you want to download the <b>VirtualBox User Manual</b> "1517 "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>")1518 .arg(strURL, QLocale(UITranslator::languageId()).toString(uSize)),1519 0 /* auto-confirm id */,1520 tr("Download"));1521 }1522 1523 void UIMessageCenter::cannotSaveUserManual(const QString &strURL, const QString &strTarget) const1524 {1525 alert(windowManager().mainWindowShown(), MessageType_Error,1526 tr("<p>The VirtualBox User Manual has been successfully downloaded "1527 "from <nobr><a href=\"%1\">%1</a></nobr> "1528 "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>"1529 "<p>Please choose another location for that file.</p>")1530 .arg(strURL, strTarget));1531 }1532 1533 bool UIMessageCenter::confirmLookingForExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const1534 {1535 return questionBinary(windowManager().mainWindowShown(), MessageType_Question,1536 tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>"1537 "<p>Do you wish to download latest one from the Internet?</p>")1538 .arg(strExtPackVersion).arg(strExtPackName),1539 0 /* auto-confirm id */,1540 tr("Download"));1541 }1542 1543 bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const1544 {1545 return questionBinary(windowManager().mainWindowShown(), MessageType_Question,1546 tr("<p>Are you sure you want to download the <b><nobr>%1</nobr></b> "1547 "from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>")1548 .arg(strExtPackName, strURL, QLocale(UITranslator::languageId()).toString(uSize)),1549 0 /* auto-confirm id */,1550 tr("Download"));1551 }1552 1553 void UIMessageCenter::cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const1554 {1555 alert(windowManager().mainWindowShown(), MessageType_Error,1556 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "1557 "from <nobr><a href=\"%2\">%2</a></nobr> "1558 "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>"1559 "<p>Please choose another location for that file.</p>")1560 .arg(strExtPackName, strFrom, strTo));1561 }1562 1563 bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const1564 {1565 return questionBinary(windowManager().mainWindowShown(), MessageType_Question,1566 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "1567 "from <nobr><a href=\"%2\">%2</a></nobr> "1568 "and saved locally as <nobr><b>%3</b>.</nobr></p>"1569 "<p>Do you wish to install this extension pack?</p>")1570 .arg(strExtPackName, strFrom, strTo),1571 0 /* auto-confirm id */,1572 tr("Install", "extension pack"));1573 }1574 1575 bool UIMessageCenter::proposeDeleteExtentionPack(const QString &strTo) const1576 {1577 return questionBinary(windowManager().mainWindowShown(), MessageType_Question,1578 tr("Do you want to delete the downloaded file <nobr><b>%1</b></nobr>?")1579 .arg(strTo),1580 0 /* auto-confirm id */,1581 tr("Delete", "extension pack"));1582 }1583 1584 bool UIMessageCenter::proposeDeleteOldExtentionPacks(const QStringList &strFiles) const1585 {1586 return questionBinary(windowManager().mainWindowShown(), MessageType_Question,1587 tr("Do you want to delete following list of files <nobr><b>%1</b></nobr>?")1588 .arg(strFiles.join(",")),1589 0 /* auto-confirm id */,1590 tr("Delete", "extension pack"));1591 }1592 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */1593 1594 bool UIMessageCenter::cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const1595 {1596 error(0, MessageType_Error,1597 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")1598 .arg(strSnapshotName, strMachineName),1599 UIErrorString::formatErrorInfo(machine));1600 return false;1601 }1602 1603 bool UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const1604 {1605 error(0, MessageType_Error,1606 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")1607 .arg(strSnapshotName, strMachineName),1608 UIErrorString::formatErrorInfo(progress));1609 return false;1610 }1611 1612 void UIMessageCenter::cannotStartMachine(const CConsole &console, const QString &strName) const1613 {1614 error(0, MessageType_Error,1615 tr("Failed to start the virtual machine <b>%1</b>.")1616 .arg(strName),1617 UIErrorString::formatErrorInfo(console));1618 }1619 1620 void UIMessageCenter::cannotStartMachine(const CProgress &progress, const QString &strName) const1621 {1622 error(0, MessageType_Error,1623 tr("Failed to start the virtual machine <b>%1</b>.")1624 .arg(strName),1625 UIErrorString::formatErrorInfo(progress));1626 }1627 1628 bool UIMessageCenter::warnAboutNetworkInterfaceNotFound(const QString &strMachineName, const QString &strIfNames) const1629 {1630 return questionBinary(0, MessageType_Error,1631 tr("<p>Could not start the machine <b>%1</b> because the following "1632 "physical network interfaces were not found:</p><p><b>%2</b></p>"1633 "<p>You can either change the machine's network settings or stop the machine.</p>")1634 .arg(strMachineName, strIfNames),1635 0 /* auto-confirm id */,1636 tr("Change Network Settings"), tr("Close VM"));1637 }1638 1639 bool UIMessageCenter::warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const1640 {1641 if (fHWVirtExSupported)1642 return questionBinary(0, MessageType_Error,1643 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "1644 "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p>"1645 "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),1646 0 /* auto-confirm id */,1647 tr("Close VM"), tr("Continue"));1648 else1649 return questionBinary(0, MessageType_Error,1650 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "1651 "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot."),1652 0 /* auto-confirm id */,1653 tr("Close VM"), tr("Continue"));1654 }1655 1656 bool UIMessageCenter::warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const1657 {1658 if (fHWVirtExSupported)1659 return questionBinary(0, MessageType_Error,1660 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "1661 "Certain guests (e.g. OS/2 and QNX) require this feature.</p>"1662 "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),1663 0 /* auto-confirm id */,1664 tr("Close VM"), tr("Continue"));1665 else1666 return questionBinary(0, MessageType_Error,1667 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "1668 "Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p>"),1669 0 /* auto-confirm id */,1670 tr("Close VM"), tr("Continue"));1671 }1672 1673 void UIMessageCenter::warnAboutVBoxSVCUnavailable() const1674 {1675 alert(0, MessageType_Critical,1676 tr("<p>A critical error has occurred while running the virtual "1677 "machine and the machine execution should be stopped.</p>"1678 ""1679 "<p>For help, please see the Community section on "1680 "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> "1681 "or your support contract. Please provide the contents of the "1682 "log file <tt>VBox.log</tt>, "1683 "which you can find in the virtual machine log directory, "1684 "as well as a description of what you were doing when this error happened. "1685 ""1686 "Note that you can also access the above file by selecting <b>Show Log</b> "1687 "from the <b>Machine</b> menu of the main VirtualBox window.</p>"1688 ""1689 "<p>Press <b>OK</b> to power off the machine.</p>"),1690 0 /* auto-confirm id */);1691 }1692 1693 bool UIMessageCenter::warnAboutGuruMeditation(const QString &strLogFolder)1694 {1695 return questionBinary(0, MessageType_GuruMeditation,1696 tr("<p>A critical error has occurred while running the virtual "1697 "machine and the machine execution has been stopped.</p>"1698 ""1699 "<p>For help, please see the Community section on "1700 "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> "1701 "or your support contract. Please provide the contents of the "1702 "log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, "1703 "which you can find in the <nobr><b>%1</b></nobr> directory, "1704 "as well as a description of what you were doing when this error happened. "1705 ""1706 "Note that you can also access the above files by selecting <b>Show Log</b> "1707 "from the <b>Machine</b> menu of the main VirtualBox window.</p>"1708 ""1709 "<p>Press <b>OK</b> if you want to power off the machine "1710 "or press <b>Ignore</b> if you want to leave it as is for debugging. "1711 "Please note that debugging requires special knowledge and tools, "1712 "so it is recommended to press <b>OK</b> now.</p>")1713 .arg(strLogFolder),1714 0 /* auto-confirm id */,1715 QIMessageBox::tr("OK"),1716 tr("Ignore"));1717 }1718 1719 void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const1720 {1721 /* Prepare auto-confirm id: */1722 QByteArray autoConfimId = "showRuntimeError.";1723 1724 /* Prepare variables: */1725 CConsole console1 = console;1726 KMachineState state = console1.GetState();1727 MessageType enmType;1728 QString severity;1729 1730 /// @todo Move to Runtime UI!1731 /* Preprocessing: */1732 if (fFatal)1733 {1734 /* The machine must be paused on fFatal errors: */1735 Assert(state == KMachineState_Paused);1736 if (state != KMachineState_Paused)1737 console1.Pause();1738 }1739 1740 /* Compose type, severity, advance confirm id: */1741 if (fFatal)1742 {1743 enmType = MessageType_Critical;1744 severity = tr("<nobr>Fatal Error</nobr>", "runtime error info");1745 autoConfimId += "fatal.";1746 }1747 else if (state == KMachineState_Paused)1748 {1749 enmType = MessageType_Error;1750 severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info");1751 autoConfimId += "error.";1752 }1753 else1754 {1755 enmType = MessageType_Warning;1756 severity = tr("<nobr>Warning</nobr>", "runtime error info");1757 autoConfimId += "warning.";1758 }1759 /* Advance auto-confirm id: */1760 autoConfimId += strErrorId.toUtf8();1761 1762 /* Format error-details: */1763 QString formatted("<!--EOM-->");1764 if (!strErrorMsg.isEmpty())1765 formatted.prepend(QString("<p>%1.</p>").arg(UITranslator::emphasize(strErrorMsg)));1766 if (!strErrorId.isEmpty())1767 formatted += QString("<table bgcolor=%1 border=0 cellspacing=5 "1768 "cellpadding=0 width=100%>"1769 "<tr><td>%2</td><td>%3</td></tr>"1770 "<tr><td>%4</td><td>%5</td></tr>"1771 "</table>")1772 .arg(QApplication::palette().color(QPalette::Active, QPalette::Window).name(QColor::HexRgb))1773 .arg(tr("<nobr>Error ID: </nobr>", "runtime error info"), strErrorId)1774 .arg(tr("Severity: ", "runtime error info"), severity);1775 if (!formatted.isEmpty())1776 formatted = "<qt>" + formatted + "</qt>";1777 1778 /* Show the error: */1779 if (enmType == MessageType_Critical)1780 {1781 error(0, enmType,1782 tr("<p>A fatal error has occurred during virtual machine execution! "1783 "The virtual machine will be powered off. Please copy the following error message "1784 "using the clipboard to help diagnose the problem:</p>"),1785 formatted, autoConfimId.data());1786 }1787 else if (enmType == MessageType_Error)1788 {1789 error(0, enmType,1790 tr("<p>An error has occurred during virtual machine execution! "1791 "The error details are shown below. You may try to correct the error "1792 "and resume the virtual machine execution.</p>"),1793 formatted, autoConfimId.data());1794 }1795 else1796 {1797 /** @todo r=bird: This is a very annoying message as it refers to invisible text1798 * below. User have to expand "Details" to see what actually went wrong.1799 * Probably a good idea to check strErrorId and see if we can come up with better1800 * messages here, at least for common stuff like DvdOrFloppyImageInaccesssible... */1801 error(0, enmType,1802 tr("<p>The virtual machine execution ran into a non-fatal problem as described below. "1803 "We suggest that you take appropriate action to prevent the problem from recurring.</p>"),1804 formatted, autoConfimId.data());1805 }1806 1807 /// @todo Move to Runtime UI!1808 /* Postprocessing: */1809 if (fFatal)1810 {1811 /* Power off after a fFatal error: */1812 LogRel(("GUI: Powering VM off after a fatal runtime error...\n"));1813 console1.PowerDown();1814 }1815 }1816 1817 bool UIMessageCenter::confirmInputCapture(bool &fAutoConfirmed) const1818 {1819 int rc = question(0, MessageType_Info,1820 tr("<p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. "1821 "This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer "1822 "integration is not currently supported by the guest OS) and the keyboard, which will make them "1823 "unavailable to other applications running on your host machine.</p>"1824 "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the keyboard and mouse "1825 "(if it is captured) and return them to normal operation. "1826 "The currently assigned host key is shown on the status bar at the bottom of the Virtual Machine window, "1827 "next to the <img src=:/hostkey_16px.png/> icon. "1828 "This icon, together with the mouse icon placed nearby, indicate the current keyboard and mouse capture state.</p>") +1829 tr("<p>The host key is currently defined as <b>%1</b>.</p>", "additional message box paragraph")1830 .arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),1831 "confirmInputCapture",1832 AlertButton_Ok | AlertButtonOption_Default,1833 AlertButton_Cancel | AlertButtonOption_Escape,1834 0,1835 tr("Capture", "do input capture"));1836 /* Was the message auto-confirmed? */1837 fAutoConfirmed = (rc & AlertOption_AutoConfirmed);1838 /* True if "Ok" was pressed: */1839 return (rc & AlertButtonMask) == AlertButton_Ok;1840 }1841 1842 bool UIMessageCenter::confirmGoingFullscreen(const QString &strHotKey) const1843 {1844 return questionBinary(0, MessageType_Info,1845 tr("<p>The virtual machine window will be now switched to <b>full-screen</b> mode. "1846 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"1847 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"1848 "<p>Note that the main menu bar is hidden in full-screen mode. "1849 "You can access it by pressing <b>Host+Home</b>.</p>")1850 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),1851 "confirmGoingFullscreen",1852 tr("Switch"));1853 }1854 1855 bool UIMessageCenter::confirmGoingSeamless(const QString &strHotKey) const1856 {1857 return questionBinary(0, MessageType_Info,1858 tr("<p>The virtual machine window will be now switched to <b>Seamless</b> mode. "1859 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"1860 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"1861 "<p>Note that the main menu bar is hidden in seamless mode. "1862 "You can access it by pressing <b>Host+Home</b>.</p>")1863 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),1864 "confirmGoingSeamless",1865 tr("Switch"));1866 }1867 1868 bool UIMessageCenter::confirmGoingScale(const QString &strHotKey) const1869 {1870 return questionBinary(0, MessageType_Info,1871 tr("<p>The virtual machine window will be now switched to <b>Scale</b> mode. "1872 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"1873 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"1874 "<p>Note that the main menu bar is hidden in scaled mode. "1875 "You can access it by pressing <b>Host+Home</b>.</p>")1876 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),1877 "confirmGoingScale",1878 tr("Switch"));1879 }1880 1881 bool UIMessageCenter::cannotEnterFullscreenMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const1882 {1883 return questionBinary(0, MessageType_Warning,1884 tr("<p>Could not switch the guest display to full-screen mode due to insufficient guest video memory.</p>"1885 "<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>"1886 "<p>Press <b>Ignore</b> to switch to full-screen mode anyway or press <b>Cancel</b> to cancel the operation.</p>")1887 .arg(UITranslator::formatSize(uMinVRAM)),1888 0 /* auto-confirm id */,1889 tr("Ignore"));1890 }1891 1892 void UIMessageCenter::cannotEnterSeamlessMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const1893 {1894 alert(0, MessageType_Error,1895 tr("<p>Could not enter seamless mode due to insufficient guest "1896 "video memory.</p>"1897 "<p>You should configure the virtual machine to have at "1898 "least <b>%1</b> of video memory.</p>")1899 .arg(UITranslator::formatSize(uMinVRAM)));1900 }1901 1902 bool UIMessageCenter::cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const1903 {1904 return questionBinary(0, MessageType_Warning,1905 tr("<p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p>"1906 "<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>"1907 "<p>Press <b>Ignore</b> to switch the screen anyway or press <b>Cancel</b> to cancel the operation.</p>")1908 .arg(UITranslator::formatSize(uMinVRAM)),1909 0 /* auto-confirm id */,1910 tr("Ignore"));1911 }1912 1913 void UIMessageCenter::cannotSwitchScreenInSeamless(quint64 uMinVRAM) const1914 {1915 alert(0, MessageType_Error,1916 tr("<p>Could not change the guest screen to this host screen "1917 "due to insufficient guest video memory.</p>"1918 "<p>You should configure the virtual machine to have at "1919 "least <b>%1</b> of video memory.</p>")1920 .arg(UITranslator::formatSize(uMinVRAM)));1921 }1922 1923 bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent /* = 0*/) const1924 {1925 return questionBinary(pParent, MessageType_Warning,1926 tr("You are about to create a new virtual machine without a hard disk. "1927 "You will not be able to install an operating system on the machine "1928 "until you add one. In the mean time you will only be able to start the "1929 "machine using a virtual optical disk or from the network."),1930 0 /* auto-confirm id */,1931 tr("Continue", "no hard disk attached"),1932 tr("Go Back", "no hard disk attached"));1933 }1934 1935 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0*/) const1936 {1937 error(pParent, MessageType_Error,1938 tr("Failed to create a new virtual machine."),1939 UIErrorString::formatErrorInfo(vbox));1940 }1941 1942 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent /* = 0*/) const1943 {1944 error(pParent, MessageType_Error,1945 tr("Failed to register the virtual machine <b>%1</b>.")1946 .arg(strMachineName),1947 UIErrorString::formatErrorInfo(vbox));1948 }1949 1950 void UIMessageCenter::cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const1951 {1952 alert(pParent, MessageType_Info,1953 tr("<p>The hard disk storage unit at location <b>%1</b> already exists. "1954 "You cannot create a new virtual hard disk that uses this location "1955 "because it can be already used by another virtual hard disk.</p>"1956 "<p>Please specify a different location.</p>")1957 .arg(strLocation));1958 }1959 1960 void UIMessageCenter::cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation, QWidget *pParent /* = 0*/) const1961 {1962 error(pParent, MessageType_Error,1963 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")1964 .arg(strLocation),1965 UIErrorString::formatErrorInfo(vbox));1966 }1967 1968 void UIMessageCenter::cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const1969 {1970 error(pParent, MessageType_Error,1971 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")1972 .arg(strLocation),1973 UIErrorString::formatErrorInfo(medium));1974 }1975 1976 void UIMessageCenter::cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const1977 {1978 error(pParent, MessageType_Error,1979 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")1980 .arg(strLocation),1981 UIErrorString::formatErrorInfo(progress));1982 }1983 1984 void UIMessageCenter::cannotCreateHardDiskStorageInFAT(const QString &strLocation, QWidget *pParent /* = 0 */) const1985 {1986 alert(pParent, MessageType_Info,1987 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr> FAT file systems have 4GB file size limit.")1988 .arg(strLocation));1989 }1990 1991 void UIMessageCenter::cannotCreateMediumStorage(const CVirtualBox &comVBox, const QString &strLocation, QWidget *pParent /* = 0 */) const1992 {1993 error(pParent, MessageType_Error,1994 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>")1995 .arg(strLocation),1996 UIErrorString::formatErrorInfo(comVBox));1997 }1998 1999 void UIMessageCenter::cannotCreateMediumStorage(const CMedium &comMedium, const QString &strLocation, QWidget *pParent /* = 0 */) const2000 {2001 error(pParent, MessageType_Error,2002 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>")2003 .arg(strLocation),2004 UIErrorString::formatErrorInfo(comMedium));2005 }2006 2007 void UIMessageCenter::cannotCreateMediumStorage(const CProgress &comProgress, const QString &strLocation, QWidget *pParent /* = 0 */) const2008 {2009 error(pParent, MessageType_Error,2010 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>")2011 .arg(strLocation),2012 UIErrorString::formatErrorInfo(comProgress));2013 }2014 2015 void UIMessageCenter::cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const2016 {2017 alert(pParent, MessageType_Critical,2018 tr("<p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p>"2019 "<p>Please check that this folder really exists and that you have permissions to remove it.</p>")2020 .arg(QFileInfo(strFolderName).fileName()));2021 }2022 2023 void UIMessageCenter::cannotRewriteMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const2024 {2025 QFileInfo fi(strFolderName);2026 alert(pParent, MessageType_Critical,2027 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>"2028 "<p>This folder already exists and possibly belongs to another machine.</p>")2029 .arg(fi.fileName()).arg(fi.absolutePath()));2030 }2031 2032 void UIMessageCenter::cannotCreateMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const2033 {2034 QFileInfo fi(strFolderName);2035 alert(pParent, MessageType_Critical,2036 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>"2037 "<p>Please check that the parent really exists and that you have permissions to create the machine folder.</p>")2038 .arg(fi.fileName()).arg(fi.absolutePath()));2039 }2040 2041 void UIMessageCenter::cannotCreateAppliance(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const2042 {2043 error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual appliance.</p>"),2044 UIErrorString::formatErrorInfo(comVBox));2045 }2046 2047 void UIMessageCenter::cannotCreateVirtualSystemDescription(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const2048 {2049 error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual system description.</p>"),2050 UIErrorString::formatErrorInfo(comAppliance));2051 }2052 2053 void UIMessageCenter::cannotAcquireVirtualSystemDescription(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const2054 {2055 error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual system description.</p>"),2056 UIErrorString::formatErrorInfo(comAppliance));2057 }2058 2059 void UIMessageCenter::cannotAddVirtualSystemDescriptionValue(const CVirtualSystemDescription &comDescription,2060 QWidget *pParent /* = 0 */) const2061 {2062 error(pParent, MessageType_Critical, tr("<p>Cannot add a virtual system description value.</p>"),2063 UIErrorString::formatErrorInfo(comDescription));2064 }2065 2066 void UIMessageCenter::cannotAcquireVirtualSystemDescriptionFormProperty(const CVirtualSystemDescriptionForm &comForm,2067 QWidget *pParent /* = 0 */) const2068 {2069 error(pParent, MessageType_Critical, tr("<p>Cannot acquire a virtual system description property.</p>"),2070 UIErrorString::formatErrorInfo(comForm));2071 }2072 2073 void UIMessageCenter::cannotImportAppliance(CAppliance &appliance, QWidget *pParent /* = 0*/) const2074 {2075 /* Preserve error-info: */2076 QString strErrorInfo = UIErrorString::formatErrorInfo(appliance);2077 /* Add the warnings in the case of an early error: */2078 QString strWarningInfo;2079 foreach(const QString &strWarning, appliance.GetWarnings())2080 strWarningInfo += QString("<br />Warning: %1").arg(strWarning);2081 if (!strWarningInfo.isEmpty())2082 strWarningInfo = "<br />" + strWarningInfo;2083 /* Show the error: */2084 error(pParent, MessageType_Error,2085 tr("Failed to open/interpret appliance <b>%1</b>.")2086 .arg(appliance.GetPath()),2087 strWarningInfo + strErrorInfo);2088 }2089 2090 void UIMessageCenter::cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const2091 {2092 error(pParent, MessageType_Error,2093 tr("Failed to import appliance <b>%1</b>.")2094 .arg(strPath),2095 UIErrorString::formatErrorInfo(progress));2096 }2097 2098 bool UIMessageCenter::cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const2099 {2100 error(pParent, MessageType_Error,2101 tr("Failed to check files."),2102 UIErrorString::formatErrorInfo(comAppliance));2103 return false;2104 }2105 2106 bool UIMessageCenter::cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const2107 {2108 error(pParent, MessageType_Error,2109 tr("Failed to check files."),2110 UIErrorString::formatErrorInfo(comVFSExplorer));2111 return false;2112 }2113 2114 bool UIMessageCenter::cannotCheckFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const2115 {2116 error(pParent, MessageType_Error,2117 tr("Failed to check files."),2118 UIErrorString::formatErrorInfo(comProgress));2119 return false;2120 }2121 2122 bool UIMessageCenter::cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const2123 {2124 error(pParent, MessageType_Error,2125 tr("Failed to remove file."),2126 UIErrorString::formatErrorInfo(comVFSExplorer));2127 return false;2128 }2129 2130 bool UIMessageCenter::cannotRemoveFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const2131 {2132 error(pParent, MessageType_Error,2133 tr("Failed to remove file."),2134 UIErrorString::formatErrorInfo(comProgress));2135 return false;2136 }2137 2138 bool UIMessageCenter::confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent /* = 0*/) const2139 {2140 return questionBinary(pParent, MessageType_Warning,2141 tr("<p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p>"2142 "<p>If you continue the runtime state of the exported machine(s) will be discarded. "2143 "The other machine(s) will not be changed.</p>",2144 "This text is never used with n == 0. Feel free to drop the %n where possible, "2145 "we only included it because of problems with Qt Linguist (but the user can see "2146 "how many machines are in the list and doesn't need to be told).", machineNames.size())2147 .arg(machineNames.join(", ")),2148 0 /* auto-confirm id */,2149 tr("Continue"));2150 }2151 2152 bool UIMessageCenter::cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const2153 {2154 error(pParent, MessageType_Error,2155 tr("Failed to prepare the export of the appliance <b>%1</b>.")2156 .arg(CAppliance(comAppliance).GetPath()),2157 UIErrorString::formatErrorInfo(comAppliance));2158 return false;2159 }2160 2161 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0 */) const2162 {2163 error(pParent, MessageType_Error,2164 tr("Failed to prepare the export of the appliance <b>%1</b>.")2165 .arg(strPath),2166 UIErrorString::formatErrorInfo(machine));2167 }2168 2169 bool UIMessageCenter::cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent /* = 0 */) const2170 {2171 error(pParent, MessageType_Error,2172 tr("Failed to export appliance <b>%1</b>.")2173 .arg(strPath),2174 UIErrorString::formatErrorInfo(comProgress));2175 return false;2176 }2177 2178 bool UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent /* = 0 */)2179 {2180 error(pParent, MessageType_Error,2181 tr("Bad password or authentication failure."),2182 UIErrorString::formatErrorInfo(comAppliance));2183 return false;2184 }2185 2186 void UIMessageCenter::cannotRunUnattendedGuestInstall(const CUnattended &comUnattendedInstall, QWidget *pParent /* = 0 */)2187 {2188 COMErrorInfo comErrorInfo = comUnattendedInstall.errorInfo(); \2189 error(pParent, MessageType_Error,2190 tr("An error has occured during unattended guest install setup."),2191 UIErrorString::formatErrorInfo(comErrorInfo));2192 1132 } 2193 1133 … … 2280 1220 } 2281 1221 2282 void UIMessageCenter::cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent /* = 0*/) const 2283 { 2284 error(pParent, MessageType_Error, 2285 tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename), 2286 UIErrorString::formatErrorInfo(extPackManager)); 2287 } 2288 2289 void UIMessageCenter::warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent /* = 0*/) const 2290 { 2291 error(pParent, MessageType_Error, 2292 tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename), 2293 "<!--EOM-->" + extPackFile.GetWhyUnusable()); 2294 } 2295 2296 void UIMessageCenter::cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent /* = 0*/) const 2297 { 2298 error(pParent, MessageType_Error, 2299 tr("Failed to install the Extension Pack <b>%1</b>.") 2300 .arg(strFilename), 2301 UIErrorString::formatErrorInfo(extPackFile)); 2302 } 2303 2304 void UIMessageCenter::cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent /* = 0*/) const 2305 { 2306 error(pParent, MessageType_Error, 2307 tr("Failed to install the Extension Pack <b>%1</b>.") 2308 .arg(strFilename), 1222 bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, bool fInduced, QWidget *pParent /* = 0 */) const 1223 { 1224 /* Prepare the usage: */ 1225 QStringList usage; 1226 CVirtualBox vbox = uiCommon().virtualBox(); 1227 foreach (const QUuid &uMachineID, medium.curStateMachineIds()) 1228 { 1229 CMachine machine = vbox.FindMachine(uMachineID.toString()); 1230 if (!vbox.isOk() || machine.isNull()) 1231 continue; 1232 usage << machine.GetName(); 1233 } 1234 /* Show the question: */ 1235 return !fInduced 1236 ? questionBinary(pParent, MessageType_Question, 1237 tr("<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p>" 1238 "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>") 1239 .arg(medium.location(), usage.join(", ")), 1240 0 /* auto-confirm id */, 1241 tr("Release", "detach medium")) 1242 : questionBinary(pParent, MessageType_Question, 1243 tr("<p>The changes you requested require this disk to " 1244 "be released from the machines it is attached to.</p>" 1245 "<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p>" 1246 "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>") 1247 .arg(medium.location(), usage.join(", ")), 1248 0 /* auto-confirm id */, 1249 tr("Release", "detach medium")); 1250 } 1251 1252 bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pParent /* = 0*/) const 1253 { 1254 /* Prepare the message: */ 1255 QString strMessage; 1256 switch (medium.type()) 1257 { 1258 case UIMediumDeviceType_HardDisk: 1259 { 1260 strMessage = tr("<p>Are you sure you want to remove the virtual hard disk " 1261 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>"); 1262 /* Compose capabilities flag: */ 1263 qulonglong caps = 0; 1264 QVector<KMediumFormatCapabilities> capabilities; 1265 capabilities = medium.medium().GetMediumFormat().GetCapabilities(); 1266 for (int i = 0; i < capabilities.size(); ++i) 1267 caps |= capabilities[i]; 1268 /* Check capabilities for additional options: */ 1269 if (caps & KMediumFormatCapabilities_File) 1270 { 1271 if (medium.state() == KMediumState_Inaccessible) 1272 strMessage += tr("<p>As this hard disk is inaccessible its image file" 1273 " can not be deleted.</p>"); 1274 } 1275 break; 1276 } 1277 case UIMediumDeviceType_DVD: 1278 { 1279 strMessage = tr("<p>Are you sure you want to remove the virtual optical disk " 1280 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>"); 1281 strMessage += tr("<p>Note that the storage unit of this medium will not be " 1282 "deleted and that it will be possible to use it later again.</p>"); 1283 break; 1284 } 1285 case UIMediumDeviceType_Floppy: 1286 { 1287 strMessage = tr("<p>Are you sure you want to remove the virtual floppy disk " 1288 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>"); 1289 strMessage += tr("<p>Note that the storage unit of this medium will not be " 1290 "deleted and that it will be possible to use it later again.</p>"); 1291 break; 1292 } 1293 default: 1294 break; 1295 } 1296 /* Show the question: */ 1297 return questionBinary(pParent, MessageType_Question, 1298 strMessage.arg(medium.location()), 1299 0 /* auto-confirm id */, 1300 tr("Remove", "medium") /* ok button text */, 1301 QString() /* cancel button text */, 1302 false /* ok button by default? */); 1303 } 1304 1305 int UIMessageCenter::confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const 1306 { 1307 return questionTrinary(pParent, MessageType_Question, 1308 tr("<p>Do you want to delete the storage unit of the virtual hard disk " 1309 "<nobr><b>%1</b></nobr>?</p>" 1310 "<p>If you select <b>Delete</b> then the specified storage unit " 1311 "will be permanently deleted. This operation <b>cannot be " 1312 "undone</b>.</p>" 1313 "<p>If you select <b>Keep</b> then the hard disk will be only " 1314 "removed from the list of known hard disks, but the storage unit " 1315 "will be left untouched which makes it possible to add this hard " 1316 "disk to the list later again.</p>") 1317 .arg(strLocation), 1318 0 /* auto-confirm id */, 1319 tr("Delete", "hard disk storage"), 1320 tr("Keep", "hard disk storage")); 1321 } 1322 1323 bool UIMessageCenter::confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent /* = 0 */) const 1324 { 1325 return questionBinary(pParent, MessageType_Question, 1326 tr("<p>Deleting this host-only network will remove " 1327 "the host-only interface this network is based on. Do you want to " 1328 "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" 1329 "<p><b>Note:</b> this interface may be in use by one or more " 1330 "virtual network adapters belonging to one of your VMs. " 1331 "After it is removed, these adapters will no longer be usable until " 1332 "you correct their settings by either choosing a different interface " 1333 "name or a different adapter attachment type.</p>") 1334 .arg(strName), 1335 0 /* auto-confirm id */, 1336 tr("Remove") /* ok button text */, 1337 QString() /* cancel button text */, 1338 false /* ok button by default? */); 1339 } 1340 1341 bool UIMessageCenter::confirmNATNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const 1342 { 1343 return questionBinary(pParent, MessageType_Question, 1344 tr("<p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p>" 1345 "<p>If this network is in use by one or more virtual " 1346 "machine network adapters these adapters will no longer be " 1347 "usable until you correct their settings by either choosing " 1348 "a different network name or a different adapter attachment " 1349 "type.</p>") 1350 .arg(strName), 1351 0 /* auto-confirm id */, 1352 tr("Remove") /* ok button text */, 1353 QString() /* cancel button text */, 1354 false /* ok button by default? */); 1355 } 1356 1357 bool UIMessageCenter::confirmCloudProfileRemoval(const QString &strName, QWidget *pParent /* = 0 */) const 1358 { 1359 return questionBinary(pParent, MessageType_Question, 1360 tr("<p>Do you want to remove the cloud profile <nobr><b>%1</b>?</nobr></p>") 1361 .arg(strName), 1362 0 /* auto-confirm id */, 1363 tr("Remove") /* ok button text */, 1364 QString() /* cancel button text */, 1365 false /* ok button by default? */); 1366 } 1367 1368 bool UIMessageCenter::confirmCloudProfilesImport(QWidget *pParent /* = 0 */) const 1369 { 1370 return questionBinary(pParent, MessageType_Question, 1371 tr("<p>Do you want to import cloud profiles from external files?</p>" 1372 "<p>VirtualBox cloud profiles will be overwritten and their data will be lost.</p>"), 1373 0 /* auto-confirm id */, 1374 tr("Import") /* ok button text */, 1375 QString() /* cancel button text */, 1376 false /* ok button by default? */); 1377 } 1378 1379 int UIMessageCenter::confirmCloudProfileManagerClosing(QWidget *pParent /* = 0 */) const 1380 { 1381 return question(pParent, MessageType_Question, 1382 tr("<p>Do you want to close the Cloud Profile Manager?</p>" 1383 "<p>There seems to be an unsaved changes. " 1384 "You can choose to <b>Accept</b> or <b>Reject</b> them automatically " 1385 "or cancel to keep the dialog opened.</p>"), 1386 0 /* auto-confirm id */, 1387 AlertButton_Choice1, 1388 AlertButton_Choice2, 1389 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, 1390 tr("Accept", "cloud profile manager changes"), 1391 tr("Reject", "cloud profile manager changes")); 1392 } 1393 1394 bool UIMessageCenter::confirmCloudConsoleApplicationRemoval(const QString &strName, QWidget *pParent /* = 0 */) const 1395 { 1396 return questionBinary(pParent, MessageType_Question, 1397 tr("<p>Do you want to remove the cloud console application <nobr><b>%1</b>?</nobr></p>") 1398 .arg(strName), 1399 0 /* auto-confirm id */, 1400 tr("Remove") /* ok button text */, 1401 QString() /* cancel button text */, 1402 false /* ok button by default? */); 1403 } 1404 1405 bool UIMessageCenter::confirmCloudConsoleProfileRemoval(const QString &strName, QWidget *pParent /* = 0 */) const 1406 { 1407 return questionBinary(pParent, MessageType_Question, 1408 tr("<p>Do you want to remove the cloud console profile <nobr><b>%1</b>?</nobr></p>") 1409 .arg(strName), 1410 0 /* auto-confirm id */, 1411 tr("Remove") /* ok button text */, 1412 QString() /* cancel button text */, 1413 false /* ok button by default? */); 1414 } 1415 1416 void UIMessageCenter::cannotAcquireHardDiskLocation(const CMedium &comMedium, QWidget *pParent /* = 0 */) const 1417 { 1418 /* Show the error: */ 1419 error(pParent, MessageType_Error, 1420 tr("Failed to acquire hard disk location."), UIErrorString::formatErrorInfo(comMedium)); 1421 } 1422 1423 void UIMessageCenter::cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const 1424 { 1425 error(pParent, MessageType_Error, 1426 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1427 .arg(strLocation), 1428 UIErrorString::formatErrorInfo(medium)); 1429 } 1430 1431 void UIMessageCenter::cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const 1432 { 1433 error(pParent, MessageType_Error, 1434 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1435 .arg(strLocation), 2309 1436 UIErrorString::formatErrorInfo(progress)); 2310 1437 } 2311 1438 2312 void UIMessageCenter::cannot UninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent /* = 0*/) const2313 { 2314 error(pParent, MessageType_Error, 2315 tr("Failed to uninstall the Extension Pack<b>%1</b>.")2316 .arg(str PackName),2317 UIErrorString::formatErrorInfo( extPackManager));2318 } 2319 2320 void UIMessageCenter::cannot UninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent /* = 0*/) const2321 { 2322 error(pParent, MessageType_Error, 2323 tr("Failed to uninstall the Extension Pack<b>%1</b>.")2324 .arg(str PackName),1439 void UIMessageCenter::cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent /* = 0*/) const 1440 { 1441 error(pParent, MessageType_Error, 1442 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 1443 .arg(strMachineName), 1444 UIErrorString::formatErrorInfo(machine)); 1445 } 1446 1447 void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const 1448 { 1449 error(pParent, MessageType_Error, 1450 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 1451 .arg(strMachineName), 2325 1452 UIErrorString::formatErrorInfo(progress)); 2326 1453 } 2327 1454 2328 void UIMessageCenter::warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent /* = 0*/) const 1455 void UIMessageCenter::cannotFindSnapshotByName(const CMachine &comMachine, 1456 const QString &strName, 1457 QWidget *pParent /* = 0 */) const 1458 { 1459 error(pParent, MessageType_Error, 1460 tr("Can't find snapshot named <b>%1</b>.") 1461 .arg(strName), 1462 UIErrorString::formatErrorInfo(comMachine)); 1463 } 1464 1465 void UIMessageCenter::cannotAcquireCloudProviderManager(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const 1466 { 1467 error(pParent, MessageType_Error, 1468 tr("Failed to acquire cloud provider manager."), 1469 UIErrorString::formatErrorInfo(comVBox)); 1470 } 1471 1472 void UIMessageCenter::cannotFindCloudProvider(const CCloudProviderManager &comManager, const QUuid &uId, QWidget *pParent /* = 0 */) const 1473 { 1474 error(pParent, MessageType_Error, 1475 tr("Failed to find cloud provider with following uuid: <b>%1</b>.").arg(uId.toString()), 1476 UIErrorString::formatErrorInfo(comManager)); 1477 } 1478 1479 void UIMessageCenter::cannotFindCloudProfile(const CCloudProvider &comProvider, const QString &strName, QWidget *pParent /* = 0 */) const 1480 { 1481 error(pParent, MessageType_Error, 1482 tr("Failed to find cloud profile with following name: <b>%1</b>.").arg(strName), 1483 UIErrorString::formatErrorInfo(comProvider)); 1484 } 1485 1486 void UIMessageCenter::cannotCreateCloudClient(const CCloudProfile &comProfile, QWidget *pParent /* = 0 */) const 1487 { 1488 error(pParent, MessageType_Error, 1489 tr("Failed to create cloud client."), 1490 UIErrorString::formatErrorInfo(comProfile)); 1491 } 1492 1493 void UIMessageCenter::cannotAcquireCloudProviderManagerParameter(const CCloudProviderManager &comManager, QWidget *pParent /* = 0 */) const 1494 { 1495 error(pParent, MessageType_Error, 1496 tr("Failed to acquire cloud provider manager parameter."), 1497 UIErrorString::formatErrorInfo(comManager)); 1498 } 1499 1500 void UIMessageCenter::cannotAcquireCloudProviderParameter(const CCloudProvider &comProvider, QWidget *pParent /* = 0 */) const 1501 { 1502 error(pParent, MessageType_Error, 1503 tr("Failed to acquire cloud provider parameter."), 1504 UIErrorString::formatErrorInfo(comProvider)); 1505 } 1506 1507 void UIMessageCenter::cannotAcquireCloudProfileParameter(const CCloudProfile &comProfile, QWidget *pParent /* = 0 */) const 1508 { 1509 error(pParent, MessageType_Error, 1510 tr("Failed to acquire cloud profile parameter."), 1511 UIErrorString::formatErrorInfo(comProfile)); 1512 } 1513 1514 void UIMessageCenter::cannotAcquireCloudClientParameter(const CCloudClient &comClient, QWidget *pParent /* = 0 */) const 1515 { 1516 error(pParent, MessageType_Error, 1517 tr("Failed to acquire cloud client parameter."), 1518 UIErrorString::formatErrorInfo(comClient)); 1519 } 1520 1521 void UIMessageCenter::cannotAcquireCloudClientParameter(const CProgress &comProgress, QWidget *pParent /* = 0 */) const 1522 { 1523 error(pParent, MessageType_Error, 1524 tr("Failed to acquire cloud client parameter."), 1525 UIErrorString::formatErrorInfo(comProgress)); 1526 } 1527 1528 void UIMessageCenter::cannotAcquireCloudMachineParameter(const CCloudMachine &comMachine, QWidget *pParent /* = 0 */) const 1529 { 1530 error(pParent, MessageType_Error, 1531 tr("Failed to acquire cloud machine parameter."), 1532 UIErrorString::formatErrorInfo(comMachine)); 1533 } 1534 1535 void UIMessageCenter::cannotAcquireCloudMachineParameter(const CProgress &comProgress, QWidget *pParent /* = 0 */) const 1536 { 1537 error(pParent, MessageType_Error, 1538 tr("Failed to acquire cloud machine parameter."), 1539 UIErrorString::formatErrorInfo(comProgress)); 1540 } 1541 1542 void UIMessageCenter::cannotAssignFormValue(const QString &strError, QWidget *pParent /* = 0 */) const 1543 { 1544 error(pParent, MessageType_Error, 1545 tr("Failed to assign form value."), 1546 strError); 1547 } 1548 1549 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 1550 bool UIMessageCenter::confirmLookingForGuestAdditions() const 1551 { 1552 return questionBinary(0, MessageType_Question, 1553 tr("<p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p>" 1554 "<p>Do you wish to download this disk image file from the Internet?</p>"), 1555 0 /* auto-confirm id */, 1556 tr("Download")); 1557 } 1558 1559 bool UIMessageCenter::confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const 1560 { 1561 return questionBinary(windowManager().mainWindowShown(), MessageType_Question, 1562 tr("<p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file " 1563 "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>") 1564 .arg(strUrl, QLocale(UITranslator::languageId()).toString(uSize)), 1565 0 /* auto-confirm id */, 1566 tr("Download")); 1567 } 1568 1569 void UIMessageCenter::cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const 1570 { 1571 alert(windowManager().mainWindowShown(), MessageType_Error, 1572 tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded " 1573 "from <nobr><a href=\"%1\">%1</a></nobr> " 1574 "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>" 1575 "<p>Please choose another location for that file.</p>") 1576 .arg(strURL, strTarget)); 1577 } 1578 1579 bool UIMessageCenter::proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const 1580 { 1581 return questionBinary(windowManager().mainWindowShown(), MessageType_Question, 1582 tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded " 1583 "from <nobr><a href=\"%1\">%1</a></nobr> " 1584 "and saved locally as <nobr><b>%2</b>.</nobr></p>" 1585 "<p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p>") 1586 .arg(strUrl, strSrc), 1587 0 /* auto-confirm id */, 1588 tr("Insert", "additions")); 1589 } 1590 1591 bool UIMessageCenter::confirmLookingForUserManual(const QString &strMissedLocation) const 1592 { 1593 return questionBinary(0, MessageType_Question, 1594 tr("<p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p>" 1595 "<p>Do you wish to download this file from the Internet?</p>") 1596 .arg(strMissedLocation), 1597 0 /* auto-confirm id */, 1598 tr("Download")); 1599 } 1600 1601 bool UIMessageCenter::confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const 1602 { 1603 return questionBinary(windowManager().mainWindowShown(), MessageType_Question, 1604 tr("<p>Are you sure you want to download the <b>VirtualBox User Manual</b> " 1605 "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>") 1606 .arg(strURL, QLocale(UITranslator::languageId()).toString(uSize)), 1607 0 /* auto-confirm id */, 1608 tr("Download")); 1609 } 1610 1611 void UIMessageCenter::cannotSaveUserManual(const QString &strURL, const QString &strTarget) const 1612 { 1613 alert(windowManager().mainWindowShown(), MessageType_Error, 1614 tr("<p>The VirtualBox User Manual has been successfully downloaded " 1615 "from <nobr><a href=\"%1\">%1</a></nobr> " 1616 "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>" 1617 "<p>Please choose another location for that file.</p>") 1618 .arg(strURL, strTarget)); 1619 } 1620 1621 bool UIMessageCenter::confirmLookingForExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const 1622 { 1623 return questionBinary(windowManager().mainWindowShown(), MessageType_Question, 1624 tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>" 1625 "<p>Do you wish to download latest one from the Internet?</p>") 1626 .arg(strExtPackVersion).arg(strExtPackName), 1627 0 /* auto-confirm id */, 1628 tr("Download")); 1629 } 1630 1631 bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const 1632 { 1633 return questionBinary(windowManager().mainWindowShown(), MessageType_Question, 1634 tr("<p>Are you sure you want to download the <b><nobr>%1</nobr></b> " 1635 "from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>") 1636 .arg(strExtPackName, strURL, QLocale(UITranslator::languageId()).toString(uSize)), 1637 0 /* auto-confirm id */, 1638 tr("Download")); 1639 } 1640 1641 void UIMessageCenter::cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const 1642 { 1643 alert(windowManager().mainWindowShown(), MessageType_Error, 1644 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded " 1645 "from <nobr><a href=\"%2\">%2</a></nobr> " 1646 "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>" 1647 "<p>Please choose another location for that file.</p>") 1648 .arg(strExtPackName, strFrom, strTo)); 1649 } 1650 1651 bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const 1652 { 1653 return questionBinary(windowManager().mainWindowShown(), MessageType_Question, 1654 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded " 1655 "from <nobr><a href=\"%2\">%2</a></nobr> " 1656 "and saved locally as <nobr><b>%3</b>.</nobr></p>" 1657 "<p>Do you wish to install this extension pack?</p>") 1658 .arg(strExtPackName, strFrom, strTo), 1659 0 /* auto-confirm id */, 1660 tr("Install", "extension pack")); 1661 } 1662 1663 bool UIMessageCenter::proposeDeleteExtentionPack(const QString &strTo) const 1664 { 1665 return questionBinary(windowManager().mainWindowShown(), MessageType_Question, 1666 tr("Do you want to delete the downloaded file <nobr><b>%1</b></nobr>?") 1667 .arg(strTo), 1668 0 /* auto-confirm id */, 1669 tr("Delete", "extension pack")); 1670 } 1671 1672 bool UIMessageCenter::proposeDeleteOldExtentionPacks(const QStringList &strFiles) const 1673 { 1674 return questionBinary(windowManager().mainWindowShown(), MessageType_Question, 1675 tr("Do you want to delete following list of files <nobr><b>%1</b></nobr>?") 1676 .arg(strFiles.join(",")), 1677 0 /* auto-confirm id */, 1678 tr("Delete", "extension pack")); 1679 } 1680 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 1681 1682 bool UIMessageCenter::cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const 1683 { 1684 error(0, MessageType_Error, 1685 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 1686 .arg(strSnapshotName, strMachineName), 1687 UIErrorString::formatErrorInfo(machine)); 1688 return false; 1689 } 1690 1691 bool UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const 1692 { 1693 error(0, MessageType_Error, 1694 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 1695 .arg(strSnapshotName, strMachineName), 1696 UIErrorString::formatErrorInfo(progress)); 1697 return false; 1698 } 1699 1700 void UIMessageCenter::cannotStartMachine(const CConsole &console, const QString &strName) const 1701 { 1702 error(0, MessageType_Error, 1703 tr("Failed to start the virtual machine <b>%1</b>.") 1704 .arg(strName), 1705 UIErrorString::formatErrorInfo(console)); 1706 } 1707 1708 void UIMessageCenter::cannotStartMachine(const CProgress &progress, const QString &strName) const 1709 { 1710 error(0, MessageType_Error, 1711 tr("Failed to start the virtual machine <b>%1</b>.") 1712 .arg(strName), 1713 UIErrorString::formatErrorInfo(progress)); 1714 } 1715 1716 bool UIMessageCenter::warnAboutNetworkInterfaceNotFound(const QString &strMachineName, const QString &strIfNames) const 1717 { 1718 return questionBinary(0, MessageType_Error, 1719 tr("<p>Could not start the machine <b>%1</b> because the following " 1720 "physical network interfaces were not found:</p><p><b>%2</b></p>" 1721 "<p>You can either change the machine's network settings or stop the machine.</p>") 1722 .arg(strMachineName, strIfNames), 1723 0 /* auto-confirm id */, 1724 tr("Change Network Settings"), tr("Close VM")); 1725 } 1726 1727 bool UIMessageCenter::warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const 1728 { 1729 if (fHWVirtExSupported) 1730 return questionBinary(0, MessageType_Error, 1731 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. " 1732 "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p>" 1733 "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"), 1734 0 /* auto-confirm id */, 1735 tr("Close VM"), tr("Continue")); 1736 else 1737 return questionBinary(0, MessageType_Error, 1738 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. " 1739 "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot."), 1740 0 /* auto-confirm id */, 1741 tr("Close VM"), tr("Continue")); 1742 } 1743 1744 bool UIMessageCenter::warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const 1745 { 1746 if (fHWVirtExSupported) 1747 return questionBinary(0, MessageType_Error, 1748 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. " 1749 "Certain guests (e.g. OS/2 and QNX) require this feature.</p>" 1750 "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"), 1751 0 /* auto-confirm id */, 1752 tr("Close VM"), tr("Continue")); 1753 else 1754 return questionBinary(0, MessageType_Error, 1755 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. " 1756 "Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p>"), 1757 0 /* auto-confirm id */, 1758 tr("Close VM"), tr("Continue")); 1759 } 1760 1761 void UIMessageCenter::warnAboutVBoxSVCUnavailable() const 1762 { 1763 alert(0, MessageType_Critical, 1764 tr("<p>A critical error has occurred while running the virtual " 1765 "machine and the machine execution should be stopped.</p>" 1766 "" 1767 "<p>For help, please see the Community section on " 1768 "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> " 1769 "or your support contract. Please provide the contents of the " 1770 "log file <tt>VBox.log</tt>, " 1771 "which you can find in the virtual machine log directory, " 1772 "as well as a description of what you were doing when this error happened. " 1773 "" 1774 "Note that you can also access the above file by selecting <b>Show Log</b> " 1775 "from the <b>Machine</b> menu of the main VirtualBox window.</p>" 1776 "" 1777 "<p>Press <b>OK</b> to power off the machine.</p>"), 1778 0 /* auto-confirm id */); 1779 } 1780 1781 bool UIMessageCenter::warnAboutGuruMeditation(const QString &strLogFolder) 1782 { 1783 return questionBinary(0, MessageType_GuruMeditation, 1784 tr("<p>A critical error has occurred while running the virtual " 1785 "machine and the machine execution has been stopped.</p>" 1786 "" 1787 "<p>For help, please see the Community section on " 1788 "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> " 1789 "or your support contract. Please provide the contents of the " 1790 "log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, " 1791 "which you can find in the <nobr><b>%1</b></nobr> directory, " 1792 "as well as a description of what you were doing when this error happened. " 1793 "" 1794 "Note that you can also access the above files by selecting <b>Show Log</b> " 1795 "from the <b>Machine</b> menu of the main VirtualBox window.</p>" 1796 "" 1797 "<p>Press <b>OK</b> if you want to power off the machine " 1798 "or press <b>Ignore</b> if you want to leave it as is for debugging. " 1799 "Please note that debugging requires special knowledge and tools, " 1800 "so it is recommended to press <b>OK</b> now.</p>") 1801 .arg(strLogFolder), 1802 0 /* auto-confirm id */, 1803 QIMessageBox::tr("OK"), 1804 tr("Ignore")); 1805 } 1806 1807 void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const 1808 { 1809 /* Prepare auto-confirm id: */ 1810 QByteArray autoConfimId = "showRuntimeError."; 1811 1812 /* Prepare variables: */ 1813 CConsole console1 = console; 1814 KMachineState state = console1.GetState(); 1815 MessageType enmType; 1816 QString severity; 1817 1818 /// @todo Move to Runtime UI! 1819 /* Preprocessing: */ 1820 if (fFatal) 1821 { 1822 /* The machine must be paused on fFatal errors: */ 1823 Assert(state == KMachineState_Paused); 1824 if (state != KMachineState_Paused) 1825 console1.Pause(); 1826 } 1827 1828 /* Compose type, severity, advance confirm id: */ 1829 if (fFatal) 1830 { 1831 enmType = MessageType_Critical; 1832 severity = tr("<nobr>Fatal Error</nobr>", "runtime error info"); 1833 autoConfimId += "fatal."; 1834 } 1835 else if (state == KMachineState_Paused) 1836 { 1837 enmType = MessageType_Error; 1838 severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info"); 1839 autoConfimId += "error."; 1840 } 1841 else 1842 { 1843 enmType = MessageType_Warning; 1844 severity = tr("<nobr>Warning</nobr>", "runtime error info"); 1845 autoConfimId += "warning."; 1846 } 1847 /* Advance auto-confirm id: */ 1848 autoConfimId += strErrorId.toUtf8(); 1849 1850 /* Format error-details: */ 1851 QString formatted("<!--EOM-->"); 1852 if (!strErrorMsg.isEmpty()) 1853 formatted.prepend(QString("<p>%1.</p>").arg(UITranslator::emphasize(strErrorMsg))); 1854 if (!strErrorId.isEmpty()) 1855 formatted += QString("<table bgcolor=%1 border=0 cellspacing=5 " 1856 "cellpadding=0 width=100%>" 1857 "<tr><td>%2</td><td>%3</td></tr>" 1858 "<tr><td>%4</td><td>%5</td></tr>" 1859 "</table>") 1860 .arg(QApplication::palette().color(QPalette::Active, QPalette::Window).name(QColor::HexRgb)) 1861 .arg(tr("<nobr>Error ID: </nobr>", "runtime error info"), strErrorId) 1862 .arg(tr("Severity: ", "runtime error info"), severity); 1863 if (!formatted.isEmpty()) 1864 formatted = "<qt>" + formatted + "</qt>"; 1865 1866 /* Show the error: */ 1867 if (enmType == MessageType_Critical) 1868 { 1869 error(0, enmType, 1870 tr("<p>A fatal error has occurred during virtual machine execution! " 1871 "The virtual machine will be powered off. Please copy the following error message " 1872 "using the clipboard to help diagnose the problem:</p>"), 1873 formatted, autoConfimId.data()); 1874 } 1875 else if (enmType == MessageType_Error) 1876 { 1877 error(0, enmType, 1878 tr("<p>An error has occurred during virtual machine execution! " 1879 "The error details are shown below. You may try to correct the error " 1880 "and resume the virtual machine execution.</p>"), 1881 formatted, autoConfimId.data()); 1882 } 1883 else 1884 { 1885 /** @todo r=bird: This is a very annoying message as it refers to invisible text 1886 * below. User have to expand "Details" to see what actually went wrong. 1887 * Probably a good idea to check strErrorId and see if we can come up with better 1888 * messages here, at least for common stuff like DvdOrFloppyImageInaccesssible... */ 1889 error(0, enmType, 1890 tr("<p>The virtual machine execution ran into a non-fatal problem as described below. " 1891 "We suggest that you take appropriate action to prevent the problem from recurring.</p>"), 1892 formatted, autoConfimId.data()); 1893 } 1894 1895 /// @todo Move to Runtime UI! 1896 /* Postprocessing: */ 1897 if (fFatal) 1898 { 1899 /* Power off after a fFatal error: */ 1900 LogRel(("GUI: Powering VM off after a fatal runtime error...\n")); 1901 console1.PowerDown(); 1902 } 1903 } 1904 1905 bool UIMessageCenter::confirmInputCapture(bool &fAutoConfirmed) const 1906 { 1907 int rc = question(0, MessageType_Info, 1908 tr("<p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. " 1909 "This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer " 1910 "integration is not currently supported by the guest OS) and the keyboard, which will make them " 1911 "unavailable to other applications running on your host machine.</p>" 1912 "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the keyboard and mouse " 1913 "(if it is captured) and return them to normal operation. " 1914 "The currently assigned host key is shown on the status bar at the bottom of the Virtual Machine window, " 1915 "next to the <img src=:/hostkey_16px.png/> icon. " 1916 "This icon, together with the mouse icon placed nearby, indicate the current keyboard and mouse capture state.</p>") + 1917 tr("<p>The host key is currently defined as <b>%1</b>.</p>", "additional message box paragraph") 1918 .arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 1919 "confirmInputCapture", 1920 AlertButton_Ok | AlertButtonOption_Default, 1921 AlertButton_Cancel | AlertButtonOption_Escape, 1922 0, 1923 tr("Capture", "do input capture")); 1924 /* Was the message auto-confirmed? */ 1925 fAutoConfirmed = (rc & AlertOption_AutoConfirmed); 1926 /* True if "Ok" was pressed: */ 1927 return (rc & AlertButtonMask) == AlertButton_Ok; 1928 } 1929 1930 bool UIMessageCenter::confirmGoingFullscreen(const QString &strHotKey) const 1931 { 1932 return questionBinary(0, MessageType_Info, 1933 tr("<p>The virtual machine window will be now switched to <b>full-screen</b> mode. " 1934 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>" 1935 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>" 1936 "<p>Note that the main menu bar is hidden in full-screen mode. " 1937 "You can access it by pressing <b>Host+Home</b>.</p>") 1938 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 1939 "confirmGoingFullscreen", 1940 tr("Switch")); 1941 } 1942 1943 bool UIMessageCenter::confirmGoingSeamless(const QString &strHotKey) const 1944 { 1945 return questionBinary(0, MessageType_Info, 1946 tr("<p>The virtual machine window will be now switched to <b>Seamless</b> mode. " 1947 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>" 1948 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>" 1949 "<p>Note that the main menu bar is hidden in seamless mode. " 1950 "You can access it by pressing <b>Host+Home</b>.</p>") 1951 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 1952 "confirmGoingSeamless", 1953 tr("Switch")); 1954 } 1955 1956 bool UIMessageCenter::confirmGoingScale(const QString &strHotKey) const 1957 { 1958 return questionBinary(0, MessageType_Info, 1959 tr("<p>The virtual machine window will be now switched to <b>Scale</b> mode. " 1960 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>" 1961 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>" 1962 "<p>Note that the main menu bar is hidden in scaled mode. " 1963 "You can access it by pressing <b>Host+Home</b>.</p>") 1964 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 1965 "confirmGoingScale", 1966 tr("Switch")); 1967 } 1968 1969 bool UIMessageCenter::cannotEnterFullscreenMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const 1970 { 1971 return questionBinary(0, MessageType_Warning, 1972 tr("<p>Could not switch the guest display to full-screen mode due to insufficient guest video memory.</p>" 1973 "<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>" 1974 "<p>Press <b>Ignore</b> to switch to full-screen mode anyway or press <b>Cancel</b> to cancel the operation.</p>") 1975 .arg(UITranslator::formatSize(uMinVRAM)), 1976 0 /* auto-confirm id */, 1977 tr("Ignore")); 1978 } 1979 1980 void UIMessageCenter::cannotEnterSeamlessMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const 1981 { 1982 alert(0, MessageType_Error, 1983 tr("<p>Could not enter seamless mode due to insufficient guest " 1984 "video memory.</p>" 1985 "<p>You should configure the virtual machine to have at " 1986 "least <b>%1</b> of video memory.</p>") 1987 .arg(UITranslator::formatSize(uMinVRAM))); 1988 } 1989 1990 bool UIMessageCenter::cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const 1991 { 1992 return questionBinary(0, MessageType_Warning, 1993 tr("<p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p>" 1994 "<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>" 1995 "<p>Press <b>Ignore</b> to switch the screen anyway or press <b>Cancel</b> to cancel the operation.</p>") 1996 .arg(UITranslator::formatSize(uMinVRAM)), 1997 0 /* auto-confirm id */, 1998 tr("Ignore")); 1999 } 2000 2001 void UIMessageCenter::cannotSwitchScreenInSeamless(quint64 uMinVRAM) const 2002 { 2003 alert(0, MessageType_Error, 2004 tr("<p>Could not change the guest screen to this host screen " 2005 "due to insufficient guest video memory.</p>" 2006 "<p>You should configure the virtual machine to have at " 2007 "least <b>%1</b> of video memory.</p>") 2008 .arg(UITranslator::formatSize(uMinVRAM))); 2009 } 2010 2011 bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent /* = 0*/) const 2012 { 2013 return questionBinary(pParent, MessageType_Warning, 2014 tr("You are about to create a new virtual machine without a hard disk. " 2015 "You will not be able to install an operating system on the machine " 2016 "until you add one. In the mean time you will only be able to start the " 2017 "machine using a virtual optical disk or from the network."), 2018 0 /* auto-confirm id */, 2019 tr("Continue", "no hard disk attached"), 2020 tr("Go Back", "no hard disk attached")); 2021 } 2022 2023 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0*/) const 2024 { 2025 error(pParent, MessageType_Error, 2026 tr("Failed to create a new virtual machine."), 2027 UIErrorString::formatErrorInfo(vbox)); 2028 } 2029 2030 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent /* = 0*/) const 2031 { 2032 error(pParent, MessageType_Error, 2033 tr("Failed to register the virtual machine <b>%1</b>.") 2034 .arg(strMachineName), 2035 UIErrorString::formatErrorInfo(vbox)); 2036 } 2037 2038 void UIMessageCenter::cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const 2329 2039 { 2330 2040 alert(pParent, MessageType_Info, 2331 tr("The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.") 2332 .arg(strPackName)); 2333 } 2334 2335 void UIMessageCenter::cannotAcquireExtensionPackManager(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const 2336 { 2337 error(pParent, MessageType_Error, 2338 tr("Failed to acquire Extension Pack Manager."), 2041 tr("<p>The hard disk storage unit at location <b>%1</b> already exists. " 2042 "You cannot create a new virtual hard disk that uses this location " 2043 "because it can be already used by another virtual hard disk.</p>" 2044 "<p>Please specify a different location.</p>") 2045 .arg(strLocation)); 2046 } 2047 2048 void UIMessageCenter::cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation, QWidget *pParent /* = 0*/) const 2049 { 2050 error(pParent, MessageType_Error, 2051 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 2052 .arg(strLocation), 2053 UIErrorString::formatErrorInfo(vbox)); 2054 } 2055 2056 void UIMessageCenter::cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const 2057 { 2058 error(pParent, MessageType_Error, 2059 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 2060 .arg(strLocation), 2061 UIErrorString::formatErrorInfo(medium)); 2062 } 2063 2064 void UIMessageCenter::cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const 2065 { 2066 error(pParent, MessageType_Error, 2067 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 2068 .arg(strLocation), 2069 UIErrorString::formatErrorInfo(progress)); 2070 } 2071 2072 void UIMessageCenter::cannotCreateHardDiskStorageInFAT(const QString &strLocation, QWidget *pParent /* = 0 */) const 2073 { 2074 alert(pParent, MessageType_Info, 2075 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr> FAT file systems have 4GB file size limit.") 2076 .arg(strLocation)); 2077 } 2078 2079 void UIMessageCenter::cannotCreateMediumStorage(const CVirtualBox &comVBox, const QString &strLocation, QWidget *pParent /* = 0 */) const 2080 { 2081 error(pParent, MessageType_Error, 2082 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>") 2083 .arg(strLocation), 2339 2084 UIErrorString::formatErrorInfo(comVBox)); 2340 2085 } 2341 2086 2342 void UIMessageCenter::cannotAcquireExtensionPacks(const CExtPackManager &comEPManager, QWidget *pParent /* = 0 */) const 2343 { 2344 error(pParent, MessageType_Error, 2345 tr("Failed to acquire extension packs."), 2346 UIErrorString::formatErrorInfo(comEPManager)); 2347 } 2348 2349 void UIMessageCenter::cannotAcquireExtensionPackParameter(const CExtPack &comPackage, QWidget *pParent /* = 0 */) const 2350 { 2351 error(pParent, MessageType_Error, 2352 tr("Failed to acquire parameter of the Extension Pack <b>%1</b>.") 2353 .arg(CExtPack(comPackage).GetName()), 2354 UIErrorString::formatErrorInfo(comPackage)); 2087 void UIMessageCenter::cannotCreateMediumStorage(const CMedium &comMedium, const QString &strLocation, QWidget *pParent /* = 0 */) const 2088 { 2089 error(pParent, MessageType_Error, 2090 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>") 2091 .arg(strLocation), 2092 UIErrorString::formatErrorInfo(comMedium)); 2093 } 2094 2095 void UIMessageCenter::cannotCreateMediumStorage(const CProgress &comProgress, const QString &strLocation, QWidget *pParent /* = 0 */) const 2096 { 2097 error(pParent, MessageType_Error, 2098 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>") 2099 .arg(strLocation), 2100 UIErrorString::formatErrorInfo(comProgress)); 2101 } 2102 2103 void UIMessageCenter::cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const 2104 { 2105 alert(pParent, MessageType_Critical, 2106 tr("<p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p>" 2107 "<p>Please check that this folder really exists and that you have permissions to remove it.</p>") 2108 .arg(QFileInfo(strFolderName).fileName())); 2109 } 2110 2111 void UIMessageCenter::cannotRewriteMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const 2112 { 2113 QFileInfo fi(strFolderName); 2114 alert(pParent, MessageType_Critical, 2115 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>" 2116 "<p>This folder already exists and possibly belongs to another machine.</p>") 2117 .arg(fi.fileName()).arg(fi.absolutePath())); 2118 } 2119 2120 void UIMessageCenter::cannotCreateMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const 2121 { 2122 QFileInfo fi(strFolderName); 2123 alert(pParent, MessageType_Critical, 2124 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>" 2125 "<p>Please check that the parent really exists and that you have permissions to create the machine folder.</p>") 2126 .arg(fi.fileName()).arg(fi.absolutePath())); 2127 } 2128 2129 void UIMessageCenter::cannotCreateAppliance(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const 2130 { 2131 error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual appliance.</p>"), 2132 UIErrorString::formatErrorInfo(comVBox)); 2133 } 2134 2135 void UIMessageCenter::cannotCreateVirtualSystemDescription(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const 2136 { 2137 error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual system description.</p>"), 2138 UIErrorString::formatErrorInfo(comAppliance)); 2139 } 2140 2141 void UIMessageCenter::cannotAcquireVirtualSystemDescription(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const 2142 { 2143 error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual system description.</p>"), 2144 UIErrorString::formatErrorInfo(comAppliance)); 2145 } 2146 2147 void UIMessageCenter::cannotAddVirtualSystemDescriptionValue(const CVirtualSystemDescription &comDescription, 2148 QWidget *pParent /* = 0 */) const 2149 { 2150 error(pParent, MessageType_Critical, tr("<p>Cannot add a virtual system description value.</p>"), 2151 UIErrorString::formatErrorInfo(comDescription)); 2152 } 2153 2154 void UIMessageCenter::cannotAcquireVirtualSystemDescriptionFormProperty(const CVirtualSystemDescriptionForm &comForm, 2155 QWidget *pParent /* = 0 */) const 2156 { 2157 error(pParent, MessageType_Critical, tr("<p>Cannot acquire a virtual system description property.</p>"), 2158 UIErrorString::formatErrorInfo(comForm)); 2159 } 2160 2161 void UIMessageCenter::cannotImportAppliance(CAppliance &appliance, QWidget *pParent /* = 0*/) const 2162 { 2163 /* Preserve error-info: */ 2164 QString strErrorInfo = UIErrorString::formatErrorInfo(appliance); 2165 /* Add the warnings in the case of an early error: */ 2166 QString strWarningInfo; 2167 foreach(const QString &strWarning, appliance.GetWarnings()) 2168 strWarningInfo += QString("<br />Warning: %1").arg(strWarning); 2169 if (!strWarningInfo.isEmpty()) 2170 strWarningInfo = "<br />" + strWarningInfo; 2171 /* Show the error: */ 2172 error(pParent, MessageType_Error, 2173 tr("Failed to open/interpret appliance <b>%1</b>.") 2174 .arg(appliance.GetPath()), 2175 strWarningInfo + strErrorInfo); 2176 } 2177 2178 void UIMessageCenter::cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const 2179 { 2180 error(pParent, MessageType_Error, 2181 tr("Failed to import appliance <b>%1</b>.") 2182 .arg(strPath), 2183 UIErrorString::formatErrorInfo(progress)); 2184 } 2185 2186 bool UIMessageCenter::cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const 2187 { 2188 error(pParent, MessageType_Error, 2189 tr("Failed to check files."), 2190 UIErrorString::formatErrorInfo(comAppliance)); 2191 return false; 2192 } 2193 2194 bool UIMessageCenter::cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const 2195 { 2196 error(pParent, MessageType_Error, 2197 tr("Failed to check files."), 2198 UIErrorString::formatErrorInfo(comVFSExplorer)); 2199 return false; 2200 } 2201 2202 bool UIMessageCenter::cannotCheckFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const 2203 { 2204 error(pParent, MessageType_Error, 2205 tr("Failed to check files."), 2206 UIErrorString::formatErrorInfo(comProgress)); 2207 return false; 2208 } 2209 2210 bool UIMessageCenter::cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const 2211 { 2212 error(pParent, MessageType_Error, 2213 tr("Failed to remove file."), 2214 UIErrorString::formatErrorInfo(comVFSExplorer)); 2215 return false; 2216 } 2217 2218 bool UIMessageCenter::cannotRemoveFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const 2219 { 2220 error(pParent, MessageType_Error, 2221 tr("Failed to remove file."), 2222 UIErrorString::formatErrorInfo(comProgress)); 2223 return false; 2224 } 2225 2226 bool UIMessageCenter::confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent /* = 0*/) const 2227 { 2228 return questionBinary(pParent, MessageType_Warning, 2229 tr("<p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p>" 2230 "<p>If you continue the runtime state of the exported machine(s) will be discarded. " 2231 "The other machine(s) will not be changed.</p>", 2232 "This text is never used with n == 0. Feel free to drop the %n where possible, " 2233 "we only included it because of problems with Qt Linguist (but the user can see " 2234 "how many machines are in the list and doesn't need to be told).", machineNames.size()) 2235 .arg(machineNames.join(", ")), 2236 0 /* auto-confirm id */, 2237 tr("Continue")); 2238 } 2239 2240 bool UIMessageCenter::cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const 2241 { 2242 error(pParent, MessageType_Error, 2243 tr("Failed to prepare the export of the appliance <b>%1</b>.") 2244 .arg(CAppliance(comAppliance).GetPath()), 2245 UIErrorString::formatErrorInfo(comAppliance)); 2246 return false; 2247 } 2248 2249 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0 */) const 2250 { 2251 error(pParent, MessageType_Error, 2252 tr("Failed to prepare the export of the appliance <b>%1</b>.") 2253 .arg(strPath), 2254 UIErrorString::formatErrorInfo(machine)); 2255 } 2256 2257 bool UIMessageCenter::cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent /* = 0 */) const 2258 { 2259 error(pParent, MessageType_Error, 2260 tr("Failed to export appliance <b>%1</b>.") 2261 .arg(strPath), 2262 UIErrorString::formatErrorInfo(comProgress)); 2263 return false; 2264 } 2265 2266 bool UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) 2267 { 2268 error(pParent, MessageType_Error, 2269 tr("Bad password or authentication failure."), 2270 UIErrorString::formatErrorInfo(comAppliance)); 2271 return false; 2272 } 2273 2274 void UIMessageCenter::cannotRunUnattendedGuestInstall(const CUnattended &comUnattendedInstall, QWidget *pParent /* = 0 */) 2275 { 2276 COMErrorInfo comErrorInfo = comUnattendedInstall.errorInfo(); \ 2277 error(pParent, MessageType_Error, 2278 tr("An error has occured during unattended guest install setup."), 2279 UIErrorString::formatErrorInfo(comErrorInfo)); 2355 2280 } 2356 2281 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r91179 r91180 337 337 bool warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, const QString &strTargetImageName, 338 338 const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree) const; 339 /** @} */ 340 341 /** @name VirtualBox Manager / Extension Manager warnings. 342 * @{ */ 343 bool confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion, 344 const QString &strPackDescription, QWidget *pParent = 0) const; 345 bool confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew, 346 const QString &strPackVersionOld, const QString &strPackDescription, 347 QWidget *pParent = 0) const; 348 bool confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent = 0) const; 339 349 /** @} */ 340 350 … … 480 490 void cannotRunUnattendedGuestInstall(const CUnattended &comUnattendedInstall, QWidget *pParent = 0); 481 491 482 /* API: Extension-pack warnings: */483 bool confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion, const QString &strPackDescription, QWidget *pParent = 0) const;484 bool confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew, const QString &strPackVersionOld,485 const QString &strPackDescription, QWidget *pParent = 0) const;486 bool confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent = 0) const;487 void cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent = 0) const;488 void warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent = 0) const;489 void cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent = 0) const;490 void cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent = 0) const;491 void cannotUninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent = 0) const;492 void cannotUninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent = 0) const;493 void warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent = 0) const;494 void cannotAcquireExtensionPackManager(const CVirtualBox &comVBox, QWidget *pParent = 0) const;495 void cannotAcquireExtensionPacks(const CExtPackManager &comEPManager, QWidget *pParent = 0) const;496 void cannotAcquireExtensionPackParameter(const CExtPack &comPackage, QWidget *pParent = 0) const;497 498 492 #ifdef VBOX_WITH_DRAG_AND_DROP 499 493 /* API: Drag and drop warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r91179 r91180 41 41 #include "CDHCPServer.h" 42 42 #include "CDisplay.h" 43 #include "CExtPack.h" 43 44 #include "CGraphicsAdapter.h" 44 45 #include "CHostNetworkInterface.h" … … 512 513 513 514 /* static */ 515 void UINotificationMessage::cannotAcquireExtensionPackManagerParameter(const CExtPackManager &comEPManager) 516 { 517 createMessage( 518 QApplication::translate("UIMessageCenter", "EP Manager failure ..."), 519 QApplication::translate("UIMessageCenter", "Failed to acquire EP Manager parameter.") + 520 UIErrorString::formatErrorInfo(comEPManager)); 521 } 522 523 /* static */ 524 void UINotificationMessage::cannotAcquireExtensionPackParameter(const CExtPack &comPackage) 525 { 526 createMessage( 527 QApplication::translate("UIMessageCenter", "EP failure ..."), 528 QApplication::translate("UIMessageCenter", "Failed to acquire EP parameter.") + 529 UIErrorString::formatErrorInfo(comPackage)); 530 } 531 532 /* static */ 514 533 void UINotificationMessage::cannotAcquireHostParameter(const CHost &comHost) 515 534 { … … 763 782 .arg(strLocation) + 764 783 UIErrorString::formatErrorInfo(comVBox)); 784 } 785 786 /* static */ 787 void UINotificationMessage::cannotGetExtensionPackManager(const CVirtualBox &comVBox) 788 { 789 createMessage( 790 QApplication::translate("UIMessageCenter", "Can't get EP Manager ..."), 791 QApplication::translate("UIMessageCenter", "Failed to acquire Extension Pack Manager.") + 792 UIErrorString::formatErrorInfo(comVBox)); 793 } 794 795 /* static */ 796 void UINotificationMessage::cannotOpenExtPack(const CExtPackManager &comExtPackManager, const QString &strFilename) 797 { 798 createMessage( 799 QApplication::translate("UIMessageCenter", "Can't open EP ..."), 800 QApplication::translate("UIMessageCenter", "Failed to open the Extension Pack <b>%1</b>.") 801 .arg(strFilename) + 802 UIErrorString::formatErrorInfo(comExtPackManager)); 803 } 804 805 /* static */ 806 void UINotificationMessage::cannotOpenExtPackFile(const CExtPackFile &comExtPackFile, const QString &strFilename) 807 { 808 createMessage( 809 QApplication::translate("UIMessageCenter", "Can't open EP file ..."), 810 QApplication::translate("UIMessageCenter", "Failed to open the Extension Pack <b>%1</b>.") 811 .arg(strFilename) + 812 comExtPackFile.GetWhyUnusable()); 765 813 } 766 814 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r91179 r91180 220 220 * @param comVBox Brings the object parameter get acquired from. */ 221 221 static void cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox); 222 /** Notifies about inability to acquire IExtPackManager parameter. 223 * @param comVBox Brings the object parameter get acquired from. */ 224 static void cannotAcquireExtensionPackManagerParameter(const CExtPackManager &comEPManager); 225 /** Notifies about inability to acquire IExtPack parameter. 226 * @param comPackage Brings the object parameter get acquired from. */ 227 static void cannotAcquireExtensionPackParameter(const CExtPack &comPackage); 222 228 /** Notifies about inability to acquire IHost parameter. 223 229 * @param comHost Brings the object parameter get acquired from. */ … … 308 314 * @param strLocation Brings the machine location. */ 309 315 static void cannotOpenMachine(const CVirtualBox &comVBox, const QString &strLocation); 316 /** Notifies about inability to get ext pack manager. 317 * @param comVBox Brings common VBox object trying to open machine. */ 318 static void cannotGetExtensionPackManager(const CVirtualBox &comVBox); 319 320 /** Notifies about inability to open extension pack. 321 * @param comExtPackManager Brings extension pack manager trying to open extension pack. 322 * @param strFilename Brings extension pack file name. */ 323 static void cannotOpenExtPack(const CExtPackManager &comExtPackManager, const QString &strFilename); 324 /** Notifies about inability to read extpack file. 325 * @param comExtPackFile Brings extension pack manager trying to open extension pack. 326 * @param strFilename Brings extension pack file name. */ 327 static void cannotOpenExtPackFile(const CExtPackFile &comExtPackFile, const QString &strFilename); 310 328 311 329 /** Notifies about inability to find host network interface.
Note:
See TracChangeset
for help on using the changeset viewer.