Changeset 68435 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 17, 2017 8:59:12 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 18 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r68396 r68435 640 640 src/globals/UIMainEventListener.cpp \ 641 641 src/globals/UIMessageCenter.cpp \ 642 src/globals/UIErrorString.cpp \ 642 643 src/globals/UIModalWindowManager.cpp \ 643 644 src/globals/UIPopupCenter.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIErrorString.cpp
r68433 r68435 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI MessageCenterclass implementation.3 * VBox Qt GUI - UIErrorString class implementation. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 22 22 /* Qt includes: */ 23 # include <QDir> 24 # include <QFileInfo> 25 # include <QLocale> 26 # include <QThread> 27 # include <QProcess> 28 # ifdef VBOX_WS_MAC 29 # include <QPushButton> 30 # endif /* VBOX_WS_MAC */ 23 #include <QObject> 31 24 32 25 /* GUI includes: */ 33 # include "VBoxGlobal.h" 34 # include "UIConverter.h" 35 # include "UIMessageCenter.h" 36 # include "UISelectorWindow.h" 37 # include "UIProgressDialog.h" 38 # ifdef VBOX_GUI_WITH_NETWORK_MANAGER 39 # include "UINetworkManager.h" 40 # include "UINetworkManagerDialog.h" 41 # endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 42 # include "UIModalWindowManager.h" 43 # include "UIExtraDataManager.h" 44 # include "UIMedium.h" 45 # ifdef VBOX_OSE 46 # include "UIDownloaderUserManual.h" 47 # endif /* VBOX_OSE */ 48 # include "UIMachine.h" 49 # include "VBoxAboutDlg.h" 50 # include "UIHostComboEditor.h" 51 # ifdef VBOX_WS_MAC 52 # include "VBoxUtils-darwin.h" 53 # endif /* VBOX_WS_MAC */ 54 # ifdef VBOX_WS_WIN 55 # include <Htmlhelp.h> 56 # endif /* VBOX_WS_WIN */ 26 #include "UIErrorString.h" 27 #include "VBoxGlobal.h" 57 28 58 29 /* COM includes: */ 59 # include "CNATNetwork.h" 60 # include "CDHCPServer.h" 61 # include "CAudioAdapter.h" 62 # include "CNATEngine.h" 63 # include "CSerialPort.h" 64 # include "CSharedFolder.h" 65 # include "CSnapshot.h" 66 # include "CStorageController.h" 67 # include "CUSBController.h" 68 # include "CUSBDeviceFilters.h" 69 # include "CUSBDeviceFilter.h" 70 # include "CConsole.h" 71 # include "CMachine.h" 72 # include "CSystemProperties.h" 73 # include "CVirtualBoxErrorInfo.h" 74 # include "CMediumAttachment.h" 75 # include "CMediumFormat.h" 76 # include "CAppliance.h" 77 # include "CExtPackManager.h" 78 # include "CExtPackFile.h" 79 # include "CHostNetworkInterface.h" 80 # include "CVRDEServer.h" 81 # include "CNetworkAdapter.h" 82 # include "CEmulatedUSB.h" 83 # ifdef VBOX_WITH_DRAG_AND_DROP 84 # include "CGuest.h" 85 # include "CDnDSource.h" 86 # include "CDnDTarget.h" 87 # endif /* VBOX_WITH_DRAG_AND_DROP */ 88 89 /* Other VBox includes: */ 90 # include <iprt/param.h> 91 # include <iprt/path.h> 30 #include "COMDefs.h" 31 #include "CProgress.h" 32 #include "CVirtualBoxErrorInfo.h" 92 33 93 34 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 94 35 95 #include <iprt/err.h> 96 97 98 /* static */ 99 UIMessageCenter* UIMessageCenter::m_spInstance = 0; 100 UIMessageCenter* UIMessageCenter::instance() { return m_spInstance; } 101 102 /* static */ 103 void UIMessageCenter::create() 104 { 105 /* Make sure instance is NOT created yet: */ 106 if (m_spInstance) 107 { 108 AssertMsgFailed(("UIMessageCenter instance is already created!")); 109 return; 110 } 111 112 /* Create instance: */ 113 new UIMessageCenter; 114 /* Prepare instance: */ 115 m_spInstance->prepare(); 116 } 117 118 /* static */ 119 void UIMessageCenter::destroy() 120 { 121 /* Make sure instance is NOT destroyed yet: */ 122 if (!m_spInstance) 123 { 124 AssertMsgFailed(("UIMessageCenter instance is already destroyed!")); 125 return; 126 } 127 128 /* Cleanup instance: */ 129 m_spInstance->cleanup(); 130 /* Destroy instance: */ 131 delete m_spInstance; 132 } 133 134 bool UIMessageCenter::warningShown(const QString &strWarningName) const 135 { 136 return m_warnings.contains(strWarningName); 137 } 138 139 void UIMessageCenter::setWarningShown(const QString &strWarningName, bool fWarningShown) const 140 { 141 if (fWarningShown && !m_warnings.contains(strWarningName)) 142 m_warnings.append(strWarningName); 143 else if (!fWarningShown && m_warnings.contains(strWarningName)) 144 m_warnings.removeAll(strWarningName); 145 } 146 147 int UIMessageCenter::message(QWidget *pParent, MessageType type, 148 const QString &strMessage, 149 const QString &strDetails, 150 const char *pcszAutoConfirmId /* = 0*/, 151 int iButton1 /* = 0*/, 152 int iButton2 /* = 0*/, 153 int iButton3 /* = 0*/, 154 const QString &strButtonText1 /* = QString() */, 155 const QString &strButtonText2 /* = QString() */, 156 const QString &strButtonText3 /* = QString() */) const 157 { 158 /* If this is NOT a GUI thread: */ 159 if (thread() != QThread::currentThread()) 160 { 161 /* We have to throw a blocking signal 162 * to show a message-box in the GUI thread: */ 163 emit sigToShowMessageBox(pParent, type, 164 strMessage, strDetails, 165 iButton1, iButton2, iButton3, 166 strButtonText1, strButtonText2, strButtonText3, 167 QString(pcszAutoConfirmId)); 168 /* Inter-thread communications are not yet implemented: */ 169 return 0; 170 } 171 /* In usual case we can chow a message-box directly: */ 172 return showMessageBox(pParent, type, 173 strMessage, strDetails, 174 iButton1, iButton2, iButton3, 175 strButtonText1, strButtonText2, strButtonText3, 176 QString(pcszAutoConfirmId)); 177 } 178 179 void UIMessageCenter::error(QWidget *pParent, MessageType type, 180 const QString &strMessage, 181 const QString &strDetails, 182 const char *pcszAutoConfirmId /* = 0*/) const 183 { 184 message(pParent, type, strMessage, strDetails, pcszAutoConfirmId, 185 AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape); 186 } 187 188 bool UIMessageCenter::errorWithQuestion(QWidget *pParent, MessageType type, 189 const QString &strMessage, 190 const QString &strDetails, 191 const char *pcszAutoConfirmId /* = 0*/, 192 const QString &strOkButtonText /* = QString()*/, 193 const QString &strCancelButtonText /* = QString()*/) const 194 { 195 return (message(pParent, type, strMessage, strDetails, pcszAutoConfirmId, 196 AlertButton_Ok | AlertButtonOption_Default, 197 AlertButton_Cancel | AlertButtonOption_Escape, 198 0 /* third button */, 199 strOkButtonText, 200 strCancelButtonText, 201 QString() /* third button */) & 202 AlertButtonMask) == AlertButton_Ok; 203 } 204 205 void UIMessageCenter::alert(QWidget *pParent, MessageType type, 206 const QString &strMessage, 207 const char *pcszAutoConfirmId /* = 0*/) const 208 { 209 error(pParent, type, strMessage, QString(), pcszAutoConfirmId); 210 } 211 212 int UIMessageCenter::question(QWidget *pParent, MessageType type, 213 const QString &strMessage, 214 const char *pcszAutoConfirmId/* = 0*/, 215 int iButton1 /* = 0*/, 216 int iButton2 /* = 0*/, 217 int iButton3 /* = 0*/, 218 const QString &strButtonText1 /* = QString()*/, 219 const QString &strButtonText2 /* = QString()*/, 220 const QString &strButtonText3 /* = QString()*/) const 221 { 222 return message(pParent, type, strMessage, QString(), pcszAutoConfirmId, 223 iButton1, iButton2, iButton3, strButtonText1, strButtonText2, strButtonText3); 224 } 225 226 bool UIMessageCenter::questionBinary(QWidget *pParent, MessageType type, 227 const QString &strMessage, 228 const char *pcszAutoConfirmId /* = 0*/, 229 const QString &strOkButtonText /* = QString()*/, 230 const QString &strCancelButtonText /* = QString()*/, 231 bool fDefaultFocusForOk /* = true*/) const 232 { 233 return fDefaultFocusForOk ? 234 ((question(pParent, type, strMessage, pcszAutoConfirmId, 235 AlertButton_Ok | AlertButtonOption_Default, 236 AlertButton_Cancel | AlertButtonOption_Escape, 237 0 /* third button */, 238 strOkButtonText, 239 strCancelButtonText, 240 QString() /* third button */) & 241 AlertButtonMask) == AlertButton_Ok) : 242 ((question(pParent, type, strMessage, pcszAutoConfirmId, 243 AlertButton_Ok, 244 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, 245 0 /* third button */, 246 strOkButtonText, 247 strCancelButtonText, 248 QString() /* third button */) & 249 AlertButtonMask) == AlertButton_Ok); 250 } 251 252 int UIMessageCenter::questionTrinary(QWidget *pParent, MessageType type, 253 const QString &strMessage, 254 const char *pcszAutoConfirmId /* = 0*/, 255 const QString &strChoice1ButtonText /* = QString()*/, 256 const QString &strChoice2ButtonText /* = QString()*/, 257 const QString &strCancelButtonText /* = QString()*/) const 258 { 259 return question(pParent, type, strMessage, pcszAutoConfirmId, 260 AlertButton_Choice1, 261 AlertButton_Choice2 | AlertButtonOption_Default, 262 AlertButton_Cancel | AlertButtonOption_Escape, 263 strChoice1ButtonText, 264 strChoice2ButtonText, 265 strCancelButtonText); 266 } 267 268 int UIMessageCenter::messageWithOption(QWidget *pParent, MessageType type, 269 const QString &strMessage, 270 const QString &strOptionText, 271 bool fDefaultOptionValue /* = true */, 272 int iButton1 /* = 0*/, 273 int iButton2 /* = 0*/, 274 int iButton3 /* = 0*/, 275 const QString &strButtonName1 /* = QString() */, 276 const QString &strButtonName2 /* = QString() */, 277 const QString &strButtonName3 /* = QString() */) const 278 { 279 /* If no buttons are set, using single 'OK' button: */ 280 if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0) 281 iButton1 = AlertButton_Ok | AlertButtonOption_Default; 282 283 /* Assign corresponding title and icon: */ 284 QString strTitle; 285 AlertIconType icon; 286 switch (type) 287 { 288 default: 289 case MessageType_Info: 290 strTitle = tr("VirtualBox - Information", "msg box title"); 291 icon = AlertIconType_Information; 292 break; 293 case MessageType_Question: 294 strTitle = tr("VirtualBox - Question", "msg box title"); 295 icon = AlertIconType_Question; 296 break; 297 case MessageType_Warning: 298 strTitle = tr("VirtualBox - Warning", "msg box title"); 299 icon = AlertIconType_Warning; 300 break; 301 case MessageType_Error: 302 strTitle = tr("VirtualBox - Error", "msg box title"); 303 icon = AlertIconType_Critical; 304 break; 305 case MessageType_Critical: 306 strTitle = tr("VirtualBox - Critical Error", "msg box title"); 307 icon = AlertIconType_Critical; 308 break; 309 case MessageType_GuruMeditation: 310 strTitle = "VirtualBox - Guru Meditation"; /* don't translate this */ 311 icon = AlertIconType_GuruMeditation; 312 break; 313 } 314 315 /* Create message-box: */ 316 QWidget *pBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown()); 317 QPointer<QIMessageBox> pBox = new QIMessageBox(strTitle, strMessage, icon, 318 iButton1, iButton2, iButton3, pBoxParent); 319 windowManager().registerNewParent(pBox, pBoxParent); 320 321 /* Load option: */ 322 if (!strOptionText.isNull()) 323 { 324 pBox->setFlagText(strOptionText); 325 pBox->setFlagChecked(fDefaultOptionValue); 326 } 327 328 /* Configure button-text: */ 329 if (!strButtonName1.isNull()) 330 pBox->setButtonText(0, strButtonName1); 331 if (!strButtonName2.isNull()) 332 pBox->setButtonText(1, strButtonName2); 333 if (!strButtonName3.isNull()) 334 pBox->setButtonText(2, strButtonName3); 335 336 /* Show box: */ 337 int rc = pBox->exec(); 338 339 /* Make sure box still valid: */ 340 if (!pBox) 341 return rc; 342 343 /* Save option: */ 344 if (pBox->flagChecked()) 345 rc |= AlertOption_CheckBox; 346 347 /* Delete message-box: */ 348 if (pBox) 349 delete pBox; 350 351 return rc; 352 } 353 354 bool UIMessageCenter::showModalProgressDialog(CProgress &progress, 355 const QString &strTitle, 356 const QString &strImage /* = "" */, 357 QWidget *pParent /* = 0*/, 358 int cMinDuration /* = 2000 */) 359 { 360 /* Prepare pixmap: */ 361 QPixmap *pPixmap = NULL; 362 if (!strImage.isEmpty()) 363 pPixmap = new QPixmap(strImage); 364 365 /* Create progress-dialog: */ 366 QWidget *pDlgParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown()); 367 QPointer<UIProgressDialog> pProgressDlg = new UIProgressDialog(progress, strTitle, pPixmap, cMinDuration, pDlgParent); 368 windowManager().registerNewParent(pProgressDlg, pDlgParent); 369 370 /* Run the dialog with the 350 ms refresh interval. */ 371 pProgressDlg->run(350); 372 373 /* Make sure progress-dialog still valid: */ 374 bool fRc; 375 if (pProgressDlg) 376 { 377 /* Delete progress-dialog: */ 378 delete pProgressDlg; 379 380 fRc = true; 381 } 382 else 383 fRc = false; 384 385 /* Cleanup pixmap: */ 386 if (pPixmap) 387 delete pPixmap; 388 389 return fRc; 390 } 391 392 #ifdef RT_OS_LINUX 393 void UIMessageCenter::warnAboutWrongUSBMounted() const 394 { 395 alert(0, MessageType_Warning, 396 tr("You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. " 397 "We strongly recommend that you change this, as it is a severe mis-configuration of " 398 "your system which could cause USB devices to fail in unexpected ways."), 399 "warnAboutWrongUSBMounted"); 400 } 401 #endif /* RT_OS_LINUX */ 402 403 void UIMessageCenter::cannotStartSelector() const 404 { 405 alert(0, MessageType_Critical, 406 tr("<p>Cannot start the VirtualBox Manager due to local restrictions.</p>" 407 "<p>The application will now terminate.</p>")); 408 } 409 410 void UIMessageCenter::showBetaBuildWarning() const 411 { 412 alert(0, MessageType_Warning, 413 tr("You are running a prerelease version of VirtualBox. " 414 "This version is not suitable for production use.")); 415 } 416 417 void UIMessageCenter::showExperimentalBuildWarning() const 418 { 419 alert(0, MessageType_Warning, 420 tr("You are running an EXPERIMENTAL build of VirtualBox. " 421 "This version is not suitable for production use.")); 422 } 423 424 void UIMessageCenter::cannotInitUserHome(const QString &strUserHome) const 425 { 426 error(0, MessageType_Critical, 427 tr("<p>Failed to initialize COM because the VirtualBox global " 428 "configuration directory <b><nobr>%1</nobr></b> is not accessible. " 429 "Please check the permissions of this directory and of its parent directory.</p>" 430 "<p>The application will now terminate.</p>") 431 .arg(strUserHome), 432 formatErrorInfo(COMErrorInfo())); 433 } 434 435 void UIMessageCenter::cannotInitCOM(HRESULT rc) const 436 { 437 error(0, MessageType_Critical, 438 tr("<p>Failed to initialize COM or to find the VirtualBox COM server. " 439 "Most likely, the VirtualBox server is not running or failed to start.</p>" 440 "<p>The application will now terminate.</p>"), 441 formatErrorInfo(COMErrorInfo(), rc)); 442 } 443 444 void UIMessageCenter::cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const 445 { 446 error(0, MessageType_Critical, 447 tr("<p>Failed to create the VirtualBoxClient COM object.</p>" 448 "<p>The application will now terminate.</p>"), 449 formatErrorInfo(client)); 450 } 451 452 void UIMessageCenter::cannotAcquireVirtualBox(const CVirtualBoxClient &client) const 453 { 454 QString err = tr("<p>Failed to acquire the VirtualBox COM object.</p>" 455 "<p>The application will now terminate.</p>"); 456 #if defined(VBOX_WS_X11) || defined(VBOX_WS_MAC) 457 if (client.lastRC() == NS_ERROR_SOCKET_FAIL) 458 err += tr("<p>The reason for this error are most likely wrong permissions of the IPC " 459 "daemon socket due to an installation problem. Please check the permissions of " 460 "<font color=blue>'/tmp'</font> and <font color=blue>'/tmp/.vbox-*-ipc/'</font></p>"); 461 #endif 462 error(0, MessageType_Critical, err, formatErrorInfo(client)); 463 } 464 465 void UIMessageCenter::cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const 466 { 467 alert(0, MessageType_Error, 468 tr("<p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>" 469 "<p>The language will be temporarily reset to the system default language. " 470 "Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the " 471 "VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>") 472 .arg(strLangId).arg(strNlsPath)); 473 } 474 475 void UIMessageCenter::cannotLoadLanguage(const QString &strLangFile) const 476 { 477 alert(0, MessageType_Error, 478 tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. " 479 "<p>The language will be temporarily reset to English (built-in). " 480 "Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the " 481 "VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>") 482 .arg(strLangFile)); 483 } 484 485 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const 486 { 487 error(0, MessageType_Error, 488 tr("There is no virtual machine named <b>%1</b>.") 489 .arg(strName), 490 formatErrorInfo(vbox)); 491 } 492 493 void UIMessageCenter::cannotFindMachineById(const CVirtualBox &vbox, const QString &strId) const 494 { 495 error(0, MessageType_Error, 496 tr("There is no virtual machine with the identifier <b>%1</b>.") 497 .arg(strId), 498 formatErrorInfo(vbox)); 499 } 500 501 void UIMessageCenter::cannotOpenSession(const CSession &session) const 502 { 503 error(0, MessageType_Error, 504 tr("Failed to create a new session."), 505 formatErrorInfo(session)); 506 } 507 508 void UIMessageCenter::cannotOpenSession(const CMachine &machine) const 509 { 510 error(0, MessageType_Error, 511 tr("Failed to open a session for the virtual machine <b>%1</b>.") 512 .arg(CMachine(machine).GetName()), 513 formatErrorInfo(machine)); 514 } 515 516 void UIMessageCenter::cannotOpenSession(const CProgress &progress, const QString &strMachineName) const 517 { 518 error(0, MessageType_Error, 519 tr("Failed to open a session for the virtual machine <b>%1</b>.") 520 .arg(strMachineName), 521 formatErrorInfo(progress)); 522 } 523 524 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &medium) const 525 { 526 error(0, MessageType_Error, 527 tr("Failed to access the disk image file <nobr><b>%1</b></nobr>.") 528 .arg(medium.location()), 529 formatErrorInfo(medium.result())); 530 } 531 532 void UIMessageCenter::cannotOpenURL(const QString &strUrl) const 533 { 534 alert(0, MessageType_Error, 535 tr("Failed to open <tt>%1</tt>. " 536 "Make sure your desktop environment can properly handle URLs of this type.") 537 .arg(strUrl)); 538 } 539 540 void UIMessageCenter::cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue) 541 { 542 error(0, MessageType_Error, 543 tr("Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.") 544 .arg(strKey, strValue), 545 formatErrorInfo(vbox)); 546 } 547 548 void UIMessageCenter::cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue) 549 { 550 error(0, MessageType_Error, 551 tr("Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.") 552 .arg(strKey, CMachine(machine).GetName(), strValue), 553 formatErrorInfo(machine)); 554 } 555 556 void UIMessageCenter::warnAboutInvalidEncryptionPassword(const QString &strPasswordId, QWidget *pParent /* = 0 */) 557 { 558 alert(pParent, MessageType_Error, 559 tr("Encryption password for <nobr>ID = '%1'</nobr> is invalid.") 560 .arg(strPasswordId)); 561 } 562 563 void UIMessageCenter::cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const 564 { 565 error(0, MessageType_Error, 566 tr("Failed to open virtual machine located in %1.") 567 .arg(strMachinePath), 568 formatErrorInfo(vbox)); 569 } 570 571 void UIMessageCenter::cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) const 572 { 573 alert(0, MessageType_Error, 574 tr("Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.") 575 .arg(strMachineName, strMachinePath)); 576 } 577 578 void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strCollisionName, const QString &strGroupName) const 579 { 580 alert(0, MessageType_Error, 581 tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> " 582 "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>" 583 "<p>Please resolve this name-conflict and try again.</p>") 584 .arg(strCollisionName, strGroupName)); 585 } 586 587 bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) const 588 { 589 return questionBinary(0, MessageType_Question, 590 tr("<p>You are trying to move group <nobr><b>%1</b></nobr> " 591 "to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>" 592 "<p>Would you like to automatically rename it?</p>") 593 .arg(strName, strGroupName), 594 0 /* auto-confirm id */, 595 tr("Rename")); 596 } 597 598 void UIMessageCenter::cannotSetGroups(const CMachine &machine) const 599 { 600 /* Compose machine name: */ 601 QString strName = CMachine(machine).GetName(); 602 if (strName.isEmpty()) 603 strName = QFileInfo(CMachine(machine).GetSettingsFilePath()).baseName(); 604 /* Show the error: */ 605 error(0, MessageType_Error, 606 tr("Failed to set groups of the virtual machine <b>%1</b>.") 607 .arg(strName), 608 formatErrorInfo(machine)); 609 } 610 611 bool UIMessageCenter::confirmMachineItemRemoval(const QStringList &names) const 612 { 613 return questionBinary(0, MessageType_Question, 614 tr("<p>You are about to remove following virtual machine items from the machine list:</p>" 615 "<p><b>%1</b></p><p>Do you wish to proceed?</p>") 616 .arg(names.join(", ")), 617 0 /* auto-confirm id */, 618 tr("Remove") /* ok button text */, 619 QString() /* cancel button text */, 620 false /* ok button by default? */); 621 } 622 623 int UIMessageCenter::confirmMachineRemoval(const QList<CMachine> &machines) const 624 { 625 /* Enumerate the machines: */ 626 int cInacessibleMachineCount = 0; 627 bool fMachineWithHardDiskPresent = false; 628 QString strMachineNames; 629 foreach (const CMachine &machine, machines) 630 { 631 /* Prepare machine name: */ 632 QString strMachineName; 633 if (machine.GetAccessible()) 634 { 635 /* Just get machine name: */ 636 strMachineName = machine.GetName(); 637 /* Enumerate the attachments: */ 638 const CMediumAttachmentVector &attachments = machine.GetMediumAttachments(); 639 foreach (const CMediumAttachment &attachment, attachments) 640 { 641 /* Check if the medium is a hard disk: */ 642 if (attachment.GetType() == KDeviceType_HardDisk) 643 { 644 /* Check if that hard disk isn't shared. 645 * If hard disk is shared, it will *never* be deleted: */ 646 QVector<QString> usedMachineList = attachment.GetMedium().GetMachineIds(); 647 if (usedMachineList.size() == 1) 648 { 649 fMachineWithHardDiskPresent = true; 650 break; 651 } 652 } 653 } 654 } 655 else 656 { 657 /* Compose machine name: */ 658 QFileInfo fi(machine.GetSettingsFilePath()); 659 strMachineName = VBoxGlobal::hasAllowedExtension(fi.completeSuffix(), VBoxFileExts) ? fi.completeBaseName() : fi.fileName(); 660 /* Increment inacessible machine count: */ 661 ++cInacessibleMachineCount; 662 } 663 /* Append machine name to the full name string: */ 664 strMachineNames += QString(strMachineNames.isEmpty() ? "<b>%1</b>" : ", <b>%1</b>").arg(strMachineName); 665 } 666 667 /* Prepare message text: */ 668 QString strText = cInacessibleMachineCount == machines.size() ? 669 tr("<p>You are about to remove following inaccessible virtual machines from the machine list:</p>" 670 "<p>%1</p>" 671 "<p>Do you wish to proceed?</p>") 672 .arg(strMachineNames) : 673 fMachineWithHardDiskPresent ? 674 tr("<p>You are about to remove following virtual machines from the machine list:</p>" 675 "<p>%1</p>" 676 "<p>Would you like to delete the files containing the virtual machine from your hard disk as well? " 677 "Doing this will also remove the files containing the machine's virtual hard disks " 678 "if they are not in use by another machine.</p>") 679 .arg(strMachineNames) : 680 tr("<p>You are about to remove following virtual machines from the machine list:</p>" 681 "<p>%1</p>" 682 "<p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p>") 683 .arg(strMachineNames); 684 685 /* Prepare message itself: */ 686 return cInacessibleMachineCount == machines.size() ? 687 message(0, MessageType_Question, 688 strText, QString(), 689 0 /* auto-confirm id */, 690 AlertButton_Ok, 691 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, 692 0, 693 tr("Remove")) : 694 message(0, MessageType_Question, 695 strText, QString(), 696 0 /* auto-confirm id */, 697 AlertButton_Choice1, 698 AlertButton_Choice2, 699 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, 700 tr("Delete all files"), 701 tr("Remove only")); 702 } 703 704 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine) const 705 { 706 error(0, MessageType_Error, 707 tr("Failed to remove the virtual machine <b>%1</b>.") 708 .arg(CMachine(machine).GetName()), 709 formatErrorInfo(machine)); 710 } 711 712 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const 713 { 714 error(0, MessageType_Error, 715 tr("Failed to remove the virtual machine <b>%1</b>.") 716 .arg(CMachine(machine).GetName()), 717 formatErrorInfo(progress)); 718 } 719 720 bool UIMessageCenter::warnAboutInaccessibleMedia() const 721 { 722 return questionBinary(0, MessageType_Warning, 723 tr("<p>One or more disk image files are not currently accessible. As a result, you will " 724 "not be able to operate virtual machines that use these files until " 725 "they become accessible later.</p>" 726 "<p>Press <b>Check</b> to open the Virtual Media Manager window and " 727 "see which files are inaccessible, or press <b>Ignore</b> to " 728 "ignore this message.</p>"), 729 "warnAboutInaccessibleMedia", 730 tr("Ignore"), tr("Check", "inaccessible media message box")); 731 } 732 733 bool UIMessageCenter::confirmDiscardSavedState(const QString &strNames) const 734 { 735 return questionBinary(0, MessageType_Question, 736 tr("<p>Are you sure you want to discard the saved state of " 737 "the following virtual machines?</p><p><b>%1</b></p>" 738 "<p>This operation is equivalent to resetting or powering off " 739 "the machine without doing a proper shutdown of the guest OS.</p>") 740 .arg(strNames), 741 0 /* auto-confirm id */, 742 tr("Discard", "saved state")); 743 } 744 745 bool UIMessageCenter::confirmResetMachine(const QString &strNames) const 746 { 747 return questionBinary(0, MessageType_Question, 748 tr("<p>Do you really want to reset the following virtual machines?</p>" 749 "<p><b>%1</b></p><p>This will cause any unsaved data " 750 "in applications running inside it to be lost.</p>") 751 .arg(strNames), 752 "confirmResetMachine" /* auto-confirm id */, 753 tr("Reset", "machine")); 754 } 755 756 bool UIMessageCenter::confirmACPIShutdownMachine(const QString &strNames) const 757 { 758 return questionBinary(0, MessageType_Question, 759 tr("<p>Do you really want to send an ACPI shutdown signal " 760 "to the following virtual machines?</p><p><b>%1</b></p>") 761 .arg(strNames), 762 "confirmACPIShutdownMachine" /* auto-confirm id */, 763 tr("ACPI Shutdown", "machine")); 764 } 765 766 bool UIMessageCenter::confirmPowerOffMachine(const QString &strNames) const 767 { 768 return questionBinary(0, MessageType_Question, 769 tr("<p>Do you really want to power off the following virtual machines?</p>" 770 "<p><b>%1</b></p><p>This will cause any unsaved data in applications " 771 "running inside it to be lost.</p>") 772 .arg(strNames), 773 "confirmPowerOffMachine" /* auto-confirm id */, 774 tr("Power Off", "machine")); 775 } 776 777 void UIMessageCenter::cannotPauseMachine(const CConsole &console) const 778 { 779 error(0, MessageType_Error, 780 tr("Failed to pause the execution of the virtual machine <b>%1</b>.") 781 .arg(CConsole(console).GetMachine().GetName()), 782 formatErrorInfo(console)); 783 } 784 785 void UIMessageCenter::cannotResumeMachine(const CConsole &console) const 786 { 787 error(0, MessageType_Error, 788 tr("Failed to resume the execution of the virtual machine <b>%1</b>.") 789 .arg(CConsole(console).GetMachine().GetName()), 790 formatErrorInfo(console)); 791 } 792 793 void UIMessageCenter::cannotDiscardSavedState(const CMachine &machine) const 794 { 795 error(0, MessageType_Error, 796 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.") 797 .arg(machine.GetName()), 798 formatErrorInfo(machine)); 799 } 800 801 void UIMessageCenter::cannotSaveMachineState(const CMachine &machine) 802 { 803 error(0, MessageType_Error, 804 tr("Failed to save the state of the virtual machine <b>%1</b>.") 805 .arg(machine.GetName()), 806 formatErrorInfo(machine)); 807 } 808 809 void UIMessageCenter::cannotSaveMachineState(const CProgress &progress, const QString &strMachineName) 810 { 811 error(0, MessageType_Error, 812 tr("Failed to save the state of the virtual machine <b>%1</b>.") 813 .arg(strMachineName), 814 formatErrorInfo(progress)); 815 } 816 817 void UIMessageCenter::cannotACPIShutdownMachine(const CConsole &console) const 818 { 819 error(0, MessageType_Error, 820 tr("Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.") 821 .arg(CConsole(console).GetMachine().GetName()), 822 formatErrorInfo(console)); 823 } 824 825 void UIMessageCenter::cannotPowerDownMachine(const CConsole &console) const 826 { 827 error(0, MessageType_Error, 828 tr("Failed to stop the virtual machine <b>%1</b>.") 829 .arg(CConsole(console).GetMachine().GetName()), 830 formatErrorInfo(console)); 831 } 832 833 void UIMessageCenter::cannotPowerDownMachine(const CProgress &progress, const QString &strMachineName) const 834 { 835 error(0, MessageType_Error, 836 tr("Failed to stop the virtual machine <b>%1</b>.") 837 .arg(strMachineName), 838 formatErrorInfo(progress)); 839 } 840 841 bool UIMessageCenter::confirmStartMultipleMachines(const QString &strNames) const 842 { 843 return questionBinary(0, MessageType_Question, 844 tr("<p>You are about to start all of the following virtual machines:</p>" 845 "<p><b>%1</b></p><p>This could take some time and consume a lot of " 846 "host system resources. Do you wish to proceed?</p>").arg(strNames), 847 "confirmStartMultipleMachines" /* auto-confirm id */); 848 } 849 850 int UIMessageCenter::confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) const 851 { 852 return fAlsoCreateNewSnapshot ? 853 messageWithOption(0, MessageType_Question, 854 tr("<p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p>" 855 "<p>You can create a snapshot of the current state of the virtual machine first by checking the box below; " 856 "if you do not do this the current state will be permanently lost. Do you wish to proceed?</p>") 857 .arg(strSnapshotName), 858 tr("Create a snapshot of the current machine state"), 859 !gEDataManager->messagesWithInvertedOption().contains("confirmSnapshotRestoring"), 860 AlertButton_Ok, 861 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, 862 0 /* 3rd button */, 863 tr("Restore"), tr("Cancel"), QString() /* 3rd button text */) : 864 message(0, MessageType_Question, 865 tr("<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>") 866 .arg(strSnapshotName), 867 QString() /* details */, 868 0 /* auto-confirm id */, 869 AlertButton_Ok, 870 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, 871 0 /* 3rd button */, 872 tr("Restore"), tr("Cancel"), QString() /* 3rd button text */); 873 } 874 875 bool UIMessageCenter::confirmSnapshotRemoval(const QString &strSnapshotName) const 876 { 877 return questionBinary(0, MessageType_Question, 878 tr("<p>Deleting the snapshot will cause the state information saved in it to be lost, and storage data spread over " 879 "several image files that VirtualBox has created together with the snapshot will be merged into one file. " 880 "This can be a lengthy process, and the information in the snapshot cannot be recovered.</p>" 881 "</p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>") 882 .arg(strSnapshotName), 883 0 /* auto-confirm id */, 884 tr("Delete") /* ok button text */, 885 QString() /* cancel button text */, 886 false /* ok button by default? */); 887 } 888 889 bool UIMessageCenter::warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, 890 const QString &strTargetImageName, 891 const QString &strTargetImageMaxSize, 892 const QString &strTargetFileSystemFree) const 893 { 894 return questionBinary(0, MessageType_Question, 895 tr("<p>Deleting the snapshot %1 will temporarily need more storage space. In the worst case the size of image %2 will grow by %3, " 896 "however on this filesystem there is only %4 free.</p><p>Running out of storage space during the merge operation can result in " 897 "corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting " 898 "the snapshot at your own risk.</p>") 899 .arg(strSnapshotName, strTargetImageName, strTargetImageMaxSize, strTargetFileSystemFree), 900 0 /* auto-confirm id */, 901 tr("Delete") /* ok button text */, 902 QString() /* cancel button text */, 903 false /* ok button by default? */); 904 } 905 906 void UIMessageCenter::cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent /* = 0*/) const 907 { 908 error(pParent, MessageType_Error, 909 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 910 .arg(strMachineName), 911 formatErrorInfo(machine)); 912 } 913 914 void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const 915 { 916 error(pParent, MessageType_Error, 917 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 918 .arg(strMachineName), 919 formatErrorInfo(progress)); 920 } 921 922 bool UIMessageCenter::cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const 923 { 924 error(0, MessageType_Error, 925 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 926 .arg(strSnapshotName, strMachineName), 927 formatErrorInfo(machine)); 928 return false; 929 } 930 931 bool UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const 932 { 933 error(0, MessageType_Error, 934 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 935 .arg(strSnapshotName, strMachineName), 936 formatErrorInfo(progress)); 937 return false; 938 } 939 940 void UIMessageCenter::cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const 941 { 942 error(0, MessageType_Error, 943 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 944 .arg(strSnapshotName, strMachineName), 945 formatErrorInfo(machine)); 946 } 947 948 void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const 949 { 950 error(0, MessageType_Error, 951 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 952 .arg(strSnapshotName).arg(strMachineName), 953 formatErrorInfo(progress)); 954 } 955 956 void UIMessageCenter::cannotFindSnapshotByName(const CMachine &comMachine, 957 const QString &strName, 958 QWidget *pParent /* = 0*/) const 959 { 960 error(pParent, MessageType_Error, 961 tr("Can't find snapshot named <b>%1</b>.") 962 .arg(strName), 963 formatErrorInfo(comMachine)); 964 } 965 966 void UIMessageCenter::cannotFindSnapshotById(const CMachine &comMachine, 967 const QString &strId, 968 QWidget *pParent /* = 0 */) const 969 { 970 error(pParent, MessageType_Error, 971 tr("Can't find snapshot with ID=<b>%1</b>.") 972 .arg(strId), 973 formatErrorInfo(comMachine)); 974 } 975 976 void UIMessageCenter::cannotAcquireSnapshotAttributes(const CSnapshot &comSnapshot, 977 QWidget *pParent /* = 0 */) 978 { 979 error(pParent, MessageType_Error, 980 tr("Can't acquire snapshot attributes."), 981 formatErrorInfo(comSnapshot)); 982 } 983 984 void UIMessageCenter::cannotSaveSettings(const QString strDetails, QWidget *pParent /* = 0 */) const 985 { 986 error(pParent, MessageType_Error, 987 tr("Failed to save the settings."), 988 strDetails); 989 } 990 991 bool UIMessageCenter::confirmNATNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const 992 { 993 return questionBinary(pParent, MessageType_Question, 994 tr("<p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p>" 995 "<p>If this network is in use by one or more virtual " 996 "machine network adapters these adapters will no longer be " 997 "usable until you correct their settings by either choosing " 998 "a different network name or a different adapter attachment " 999 "type.</p>") 1000 .arg(strName), 1001 0 /* auto-confirm id */, 1002 tr("Remove") /* ok button text */, 1003 QString() /* cancel button text */, 1004 false /* ok button by default? */); 1005 } 1006 1007 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties, QWidget *pParent /* = 0*/) const 1008 { 1009 error(pParent, MessageType_Critical, 1010 tr("Failed to set global VirtualBox properties."), 1011 formatErrorInfo(properties)); 1012 } 1013 1014 void UIMessageCenter::warnAboutUnaccessibleUSB(const COMBaseWithEI &object, QWidget *pParent /* = 0*/) const 1015 { 1016 /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return 1017 * E_NOTIMPL, it means the USB support is intentionally missing 1018 * (as in the OSE version). Don't show the error message in this case. */ 1019 COMResult res(object); 1020 if (res.rc() == E_NOTIMPL) 1021 return; 1022 /* Show the error: */ 1023 error(pParent, res.isWarning() ? MessageType_Warning : MessageType_Error, 1024 tr("Failed to access the USB subsystem."), 1025 formatErrorInfo(res), 1026 "warnAboutUnaccessibleUSB"); 1027 } 1028 1029 void UIMessageCenter::warnAboutStateChange(QWidget *pParent /* = 0*/) const 1030 { 1031 if (warningShown("warnAboutStateChange")) 1032 return; 1033 setWarningShown("warnAboutStateChange", true); 1034 1035 alert(pParent, MessageType_Warning, 1036 tr("The virtual machine that you are changing has been started. " 1037 "Only certain settings can be changed while a machine is running. " 1038 "All other changes will be lost if you close this window now.")); 1039 1040 setWarningShown("warnAboutStateChange", false); 1041 } 1042 1043 bool UIMessageCenter::confirmSettingsReloading(QWidget *pParent /* = 0*/) const 1044 { 1045 return questionBinary(pParent, MessageType_Question, 1046 tr("<p>The machine settings were changed while you were editing them. " 1047 "You currently have unsaved setting changes.</p>" 1048 "<p>Would you like to reload the changed settings or to keep your own changes?</p>"), 1049 0 /* auto-confirm id */, 1050 tr("Reload settings"), tr("Keep changes")); 1051 } 1052 1053 int UIMessageCenter::confirmHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent /* = 0*/) const 1054 { 1055 return questionTrinary(pParent, MessageType_Question, 1056 tr("<p>You are about to add a virtual hard disk to controller <b>%1</b>.</p>" 1057 "<p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>") 1058 .arg(strControllerName), 1059 0 /* auto-confirm id */, 1060 tr("Create &new disk"), tr("&Choose existing disk")); 1061 } 1062 1063 int UIMessageCenter::confirmOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent /* = 0*/) const 1064 { 1065 return questionTrinary(pParent, MessageType_Question, 1066 tr("<p>You are about to add a new optical drive to controller <b>%1</b>.</p>" 1067 "<p>Would you like to choose a virtual optical disk to put in the drive " 1068 "or to leave it empty for now?</p>") 1069 .arg(strControllerName), 1070 0 /* auto-confirm id */, 1071 tr("Leave &empty"), tr("&Choose disk")); 1072 } 1073 1074 int UIMessageCenter::confirmFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent /* = 0*/) const 1075 { 1076 return questionTrinary(pParent, MessageType_Question, 1077 tr("<p>You are about to add a new floppy drive to controller <b>%1</b>.</p>" 1078 "<p>Would you like to choose a virtual floppy disk to put in the drive " 1079 "or to leave it empty for now?</p>") 1080 .arg(strControllerName), 1081 0 /* auto-confirm id */, 1082 tr("Leave &empty"), tr("&Choose disk")); 1083 } 1084 1085 int UIMessageCenter::confirmRemovingOfLastDVDDevice(QWidget *pParent /* = 0*/) const 1086 { 1087 return questionBinary(pParent, MessageType_Info, 1088 tr("<p>Are you sure you want to delete the optical drive?</p>" 1089 "<p>You will not be able to insert any optical disks or ISO images " 1090 "or install the Guest Additions without it!</p>"), 1091 0 /* auto-confirm id */, 1092 tr("&Remove", "medium") /* ok button text */, 1093 QString() /* cancel button text */, 1094 false /* ok button by default? */); 1095 } 1096 1097 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType type, 1098 const QString &strLocation, const StorageSlot &storageSlot, 1099 QWidget *pParent /* = 0*/) 1100 { 1101 QString strMessage; 1102 switch (type) 1103 { 1104 case UIMediumType_HardDisk: 1105 { 1106 strMessage = tr("Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.") 1107 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName()); 1108 break; 1109 } 1110 case UIMediumType_DVD: 1111 { 1112 strMessage = tr("Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.") 1113 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName()); 1114 break; 1115 } 1116 case UIMediumType_Floppy: 1117 { 1118 strMessage = tr("Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.") 1119 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName()); 1120 break; 1121 } 1122 default: 1123 break; 1124 } 1125 error(pParent, MessageType_Error, 1126 strMessage, formatErrorInfo(machine)); 1127 } 1128 1129 bool UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent /* = 0 */) const 1130 { 1131 alert(pParent, MessageType_Error, 1132 tr("The current port forwarding rules are not valid. " 1133 "None of the host or guest port values may be set to zero.")); 1134 return false; 1135 } 1136 1137 bool UIMessageCenter::warnAboutIncorrectAddress(QWidget *pParent /* = 0 */) const 1138 { 1139 alert(pParent, MessageType_Error, 1140 tr("The current port forwarding rules are not valid. " 1141 "All of the host or guest address values should be correct or empty.")); 1142 return false; 1143 } 1144 1145 bool UIMessageCenter::warnAboutEmptyGuestAddress(QWidget *pParent /* = 0 */) const 1146 { 1147 alert(pParent, MessageType_Error, 1148 tr("The current port forwarding rules are not valid. " 1149 "None of the guest address values may be empty.")); 1150 return false; 1151 } 1152 1153 bool UIMessageCenter::warnAboutNameShouldBeUnique(QWidget *pParent /* = 0 */) const 1154 { 1155 alert(pParent, MessageType_Error, 1156 tr("The current port forwarding rules are not valid. " 1157 "Rule names should be unique.")); 1158 return false; 1159 } 1160 1161 bool UIMessageCenter::warnAboutRulesConflict(QWidget *pParent /* = 0 */) const 1162 { 1163 alert(pParent, MessageType_Error, 1164 tr("The current port forwarding rules are not valid. " 1165 "Few rules have same host ports and conflicting IP addresses.")); 1166 return false; 1167 } 1168 1169 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent /* = 0*/) const 1170 { 1171 return questionBinary(pParent, MessageType_Question, 1172 tr("<p>There are unsaved changes in the port forwarding configuration.</p>" 1173 "<p>If you proceed your changes will be discarded.</p>"), 1174 0 /* auto-confirm id */, 1175 QString() /* ok button text */, 1176 QString() /* cancel button text */, 1177 false /* ok button by default? */); 1178 } 1179 1180 void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /* = 0*/) const 1181 { 1182 error(pParent, MessageType_Error, 1183 tr("Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.") 1184 .arg(machine.GetName(), CMachine(machine).GetSettingsFilePath()), 1185 formatErrorInfo(machine)); 1186 } 1187 1188 void UIMessageCenter::cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent /* = 0*/) const 1189 { 1190 error(pParent, MessageType_Error, 1191 tr("<p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p>") 1192 .arg(gpConverter->toString(oldMediumType)).arg(gpConverter->toString(newMediumType)), 1193 formatErrorInfo(medium)); 1194 } 1195 1196 void UIMessageCenter::cannotMoveMediumStorage(const CMedium &comMedium, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent /* = 0 */) const 1197 { 1198 error(pParent, MessageType_Error, 1199 tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.") 1200 .arg(strLocationOld, strLocationNew), 1201 formatErrorInfo(comMedium)); 1202 } 1203 1204 void UIMessageCenter::cannotMoveMediumStorage(const CProgress &comProgress, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent /* = 0 */) const 1205 { 1206 error(pParent, MessageType_Error, 1207 tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.") 1208 .arg(strLocationOld, strLocationNew), 1209 formatErrorInfo(comProgress)); 1210 } 1211 1212 void UIMessageCenter::cannotChangeMediumDescription(const CMedium &comMedium, const QString &strLocation, QWidget *pParent /* = 0 */) const 1213 { 1214 error(pParent, MessageType_Error, 1215 tr("<p>Error changing the description of the disk image <b>%1</b>.</p>") 1216 .arg(strLocation), 1217 formatErrorInfo(comMedium)); 1218 } 1219 1220 bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, QWidget *pParent /* = 0*/) const 1221 { 1222 /* Prepare the usage: */ 1223 QStringList usage; 1224 CVirtualBox vbox = vboxGlobal().virtualBox(); 1225 foreach (const QString &strMachineID, medium.curStateMachineIds()) 1226 { 1227 CMachine machine = vbox.FindMachine(strMachineID); 1228 if (!vbox.isOk() || machine.isNull()) 1229 continue; 1230 usage << machine.GetName(); 1231 } 1232 /* Show the question: */ 1233 return questionBinary(pParent, MessageType_Question, 1234 tr("<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p>" 1235 "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>") 1236 .arg(medium.location(), usage.join(", ")), 1237 0 /* auto-confirm id */, 1238 tr("Release", "detach medium")); 1239 } 1240 1241 bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pParent /* = 0*/) const 1242 { 1243 /* Prepare the message: */ 1244 QString strMessage; 1245 switch (medium.type()) 1246 { 1247 case UIMediumType_HardDisk: 1248 { 1249 strMessage = tr("<p>Are you sure you want to remove the virtual hard disk " 1250 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>"); 1251 /* Compose capabilities flag: */ 1252 qulonglong caps = 0; 1253 QVector<KMediumFormatCapabilities> capabilities; 1254 capabilities = medium.medium().GetMediumFormat().GetCapabilities(); 1255 for (int i = 0; i < capabilities.size(); ++i) 1256 caps |= capabilities[i]; 1257 /* Check capabilities for additional options: */ 1258 if (caps & KMediumFormatCapabilities_File) 1259 { 1260 if (medium.state() == KMediumState_Inaccessible) 1261 strMessage += tr("<p>As this hard disk is inaccessible its image file" 1262 " can not be deleted.</p>"); 1263 } 1264 break; 1265 } 1266 case UIMediumType_DVD: 1267 { 1268 strMessage = tr("<p>Are you sure you want to remove the virtual optical disk " 1269 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>"); 1270 strMessage += tr("<p>Note that the storage unit of this medium will not be " 1271 "deleted and that it will be possible to use it later again.</p>"); 1272 break; 1273 } 1274 case UIMediumType_Floppy: 1275 { 1276 strMessage = tr("<p>Are you sure you want to remove the virtual floppy disk " 1277 "<nobr><b>%1</b></nobr> from the list of known disk image files?</p>"); 1278 strMessage += tr("<p>Note that the storage unit of this medium will not be " 1279 "deleted and that it will be possible to use it later again.</p>"); 1280 break; 1281 } 1282 default: 1283 break; 1284 } 1285 /* Show the question: */ 1286 return questionBinary(pParent, MessageType_Question, 1287 strMessage.arg(medium.location()), 1288 0 /* auto-confirm id */, 1289 tr("Remove", "medium") /* ok button text */, 1290 QString() /* cancel button text */, 1291 false /* ok button by default? */); 1292 } 1293 1294 int UIMessageCenter::confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const 1295 { 1296 return questionTrinary(pParent, MessageType_Question, 1297 tr("<p>Do you want to delete the storage unit of the virtual hard disk " 1298 "<nobr><b>%1</b></nobr>?</p>" 1299 "<p>If you select <b>Delete</b> then the specified storage unit " 1300 "will be permanently deleted. This operation <b>cannot be " 1301 "undone</b>.</p>" 1302 "<p>If you select <b>Keep</b> then the hard disk will be only " 1303 "removed from the list of known hard disks, but the storage unit " 1304 "will be left untouched which makes it possible to add this hard " 1305 "disk to the list later again.</p>") 1306 .arg(strLocation), 1307 0 /* auto-confirm id */, 1308 tr("Delete", "hard disk storage"), 1309 tr("Keep", "hard disk storage")); 1310 } 1311 1312 void UIMessageCenter::cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const 1313 { 1314 error(pParent, MessageType_Error, 1315 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1316 .arg(strLocation), 1317 formatErrorInfo(medium)); 1318 } 1319 1320 void UIMessageCenter::cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const 1321 { 1322 error(pParent, MessageType_Error, 1323 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1324 .arg(strLocation), 1325 formatErrorInfo(progress)); 1326 } 1327 1328 void UIMessageCenter::cannotResizeHardDiskStorage(const CMedium &comMedium, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent /* = 0 */) const 1329 { 1330 error(pParent, MessageType_Error, 1331 tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.") 1332 .arg(strLocation, strSizeOld, strSizeNew), 1333 formatErrorInfo(comMedium)); 1334 } 1335 1336 void UIMessageCenter::cannotResizeHardDiskStorage(const CProgress &comProgress, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent /* = 0 */) const 1337 { 1338 error(pParent, MessageType_Error, 1339 tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.") 1340 .arg(strLocation, strSizeOld, strSizeNew), 1341 formatErrorInfo(comProgress)); 1342 } 1343 1344 void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /* = 0*/) const 1345 { 1346 /* Prepare the message: */ 1347 QString strMessage; 1348 switch (type) 1349 { 1350 case UIMediumType_HardDisk: 1351 { 1352 strMessage = tr("Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.") 1353 .arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName()); 1354 break; 1355 } 1356 case UIMediumType_DVD: 1357 { 1358 strMessage = tr("Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.") 1359 .arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName()); 1360 break; 1361 } 1362 case UIMediumType_Floppy: 1363 { 1364 strMessage = tr("Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.") 1365 .arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName()); 1366 break; 1367 } 1368 default: 1369 break; 1370 } 1371 /* Show the error: */ 1372 error(pParent, MessageType_Error, strMessage, formatErrorInfo(machine)); 1373 } 1374 1375 bool UIMessageCenter::cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent /* = 0*/) const 1376 { 1377 /* Compose the message: */ 1378 QString strMessage; 1379 switch (medium.type()) 1380 { 1381 case UIMediumType_DVD: 1382 { 1383 if (fMount) 1384 { 1385 strMessage = tr("<p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p>"); 1386 if (fRetry) 1387 strMessage += tr("<p>Would you like to try to force insertion of this disk?</p>"); 1388 } 1389 else 1390 { 1391 strMessage = tr("<p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p>"); 1392 if (fRetry) 1393 strMessage += tr("<p>Would you like to try to force ejection of this disk?</p>"); 1394 } 1395 break; 1396 } 1397 case UIMediumType_Floppy: 1398 { 1399 if (fMount) 1400 { 1401 strMessage = tr("<p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p>"); 1402 if (fRetry) 1403 strMessage += tr("<p>Would you like to try to force insertion of this disk?</p>"); 1404 } 1405 else 1406 { 1407 strMessage = tr("<p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p>"); 1408 if (fRetry) 1409 strMessage += tr("<p>Would you like to try to force ejection of this disk?</p>"); 1410 } 1411 break; 1412 } 1413 default: 1414 break; 1415 } 1416 /* Show the messsage: */ 1417 if (fRetry) 1418 return errorWithQuestion(pParent, MessageType_Question, 1419 strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()), 1420 formatErrorInfo(machine), 1421 0 /* Auto Confirm ID */, 1422 tr("Force Unmount")); 1423 error(pParent, MessageType_Error, 1424 strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()), 1425 formatErrorInfo(machine)); 1426 return false; 1427 } 1428 1429 void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType /* type */, const QString &strLocation, QWidget *pParent /* = 0*/) const 1430 { 1431 /* Show the error: */ 1432 error(pParent, MessageType_Error, 1433 tr("Failed to open the disk image file <nobr><b>%1</b></nobr>.").arg(strLocation), formatErrorInfo(vbox)); 1434 } 1435 1436 void UIMessageCenter::cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent /* = 0*/) const 1437 { 1438 /* Show the error: */ 1439 error(pParent, MessageType_Error, 1440 tr("Failed to close the disk image file <nobr><b>%1</b></nobr>.").arg(medium.location()), formatErrorInfo(rc)); 1441 } 1442 1443 bool UIMessageCenter::confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent /* = 0 */) const 1444 { 1445 return questionBinary(pParent, MessageType_Question, 1446 tr("<p>Deleting this host-only network will remove " 1447 "the host-only interface this network is based on. Do you want to " 1448 "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" 1449 "<p><b>Note:</b> this interface may be in use by one or more " 1450 "virtual network adapters belonging to one of your VMs. " 1451 "After it is removed, these adapters will no longer be usable until " 1452 "you correct their settings by either choosing a different interface " 1453 "name or a different adapter attachment type.</p>") 1454 .arg(strName), 1455 0 /* auto-confirm id */, 1456 tr("Remove") /* ok button text */, 1457 QString() /* cancel button text */, 1458 false /* ok button by default? */); 1459 } 1460 1461 void UIMessageCenter::cannotAcquireHostNetworkInterfaces(const CHost &comHost, QWidget *pParent /* = 0 */) const 1462 { 1463 error(pParent, MessageType_Error, 1464 tr("Failed to acquire host network interfaces."), 1465 formatErrorInfo(comHost)); 1466 } 1467 1468 void UIMessageCenter::cannotFindHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const 1469 { 1470 error(pParent, MessageType_Error, 1471 tr("Unable to find the host network interface <b>%1</b>.") 1472 .arg(strInterfaceName), 1473 formatErrorInfo(comHost)); 1474 } 1475 1476 void UIMessageCenter::cannotCreateHostNetworkInterface(const CHost &comHost, QWidget *pParent /* = 0 */) const 1477 { 1478 error(pParent, MessageType_Error, 1479 tr("Failed to create a host network interface."), 1480 formatErrorInfo(comHost)); 1481 } 1482 1483 void UIMessageCenter::cannotCreateHostNetworkInterface(const CProgress &progress, QWidget *pParent /* = 0 */) const 1484 { 1485 error(pParent, MessageType_Error, 1486 tr("Failed to create a host network interface."), 1487 formatErrorInfo(progress)); 1488 } 1489 1490 void UIMessageCenter::cannotRemoveHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const 1491 { 1492 error(pParent, MessageType_Error, 1493 tr("Failed to remove the host network interface <b>%1</b>.") 1494 .arg(strInterfaceName), 1495 formatErrorInfo(comHost)); 1496 } 1497 1498 void UIMessageCenter::cannotRemoveHostNetworkInterface(const CProgress &progress, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const 1499 { 1500 error(pParent, MessageType_Error, 1501 tr("Failed to remove the host network interface <b>%1</b>.") 1502 .arg(strInterfaceName), 1503 formatErrorInfo(progress)); 1504 } 1505 1506 void UIMessageCenter::cannotAcquireHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent /* = 0 */) const 1507 { 1508 error(pParent, MessageType_Error, 1509 tr("Failed to acquire host network interface parameter."), 1510 formatErrorInfo(comInterface)); 1511 } 1512 1513 void UIMessageCenter::cannotSaveHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent /* = 0 */) const 1514 { 1515 error(pParent, MessageType_Error, 1516 tr("Failed to save host network interface parameter."), 1517 formatErrorInfo(comInterface)); 1518 } 1519 1520 void UIMessageCenter::cannotCreateDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const 1521 { 1522 error(pParent, MessageType_Error, 1523 tr("Failed to create a DHCP server for the network interface <b>%1</b>.") 1524 .arg(strInterfaceName), 1525 formatErrorInfo(comVBox)); 1526 } 1527 1528 void UIMessageCenter::cannotRemoveDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const 1529 { 1530 error(pParent, MessageType_Error, 1531 tr("Failed to remove the DHCP server for the network interface <b>%1</b>.") 1532 .arg(strInterfaceName), 1533 formatErrorInfo(comVBox)); 1534 } 1535 1536 void UIMessageCenter::cannotAcquireDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent /* = 0 */) const 1537 { 1538 error(pParent, MessageType_Error, 1539 tr("Failed to acquire DHCP server parameter."), 1540 formatErrorInfo(comServer)); 1541 } 1542 1543 void UIMessageCenter::cannotSaveDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent /* = 0 */) const 1544 { 1545 error(pParent, MessageType_Error, 1546 tr("Failed to save DHCP server parameter."), 1547 formatErrorInfo(comServer)); 1548 } 1549 1550 bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent /* = 0*/) const 1551 { 1552 return questionBinary(pParent, MessageType_Warning, 1553 tr("You are about to create a new virtual machine without a hard disk. " 1554 "You will not be able to install an operating system on the machine " 1555 "until you add one. In the mean time you will only be able to start the " 1556 "machine using a virtual optical disk or from the network."), 1557 0 /* auto-confirm id */, 1558 tr("Continue", "no hard disk attached"), 1559 tr("Go Back", "no hard disk attached")); 1560 } 1561 1562 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0*/) const 1563 { 1564 error(pParent, MessageType_Error, 1565 tr("Failed to create a new virtual machine."), 1566 formatErrorInfo(vbox)); 1567 } 1568 1569 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent /* = 0*/) const 1570 { 1571 error(pParent, MessageType_Error, 1572 tr("Failed to register the virtual machine <b>%1</b>.") 1573 .arg(strMachineName), 1574 formatErrorInfo(vbox)); 1575 } 1576 1577 void UIMessageCenter::cannotCreateClone(const CMachine &machine, QWidget *pParent /* = 0*/) const 1578 { 1579 error(pParent, MessageType_Error, 1580 tr("Failed to clone the virtual machine <b>%1</b>.") 1581 .arg(CMachine(machine).GetName()), 1582 formatErrorInfo(machine)); 1583 } 1584 1585 void UIMessageCenter::cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const 1586 { 1587 error(pParent, MessageType_Error, 1588 tr("Failed to clone the virtual machine <b>%1</b>.") 1589 .arg(strMachineName), 1590 formatErrorInfo(progress)); 1591 } 1592 1593 void UIMessageCenter::cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const 1594 { 1595 alert(pParent, MessageType_Info, 1596 tr("<p>The hard disk storage unit at location <b>%1</b> already exists. " 1597 "You cannot create a new virtual hard disk that uses this location " 1598 "because it can be already used by another virtual hard disk.</p>" 1599 "<p>Please specify a different location.</p>") 1600 .arg(strLocation)); 1601 } 1602 1603 void UIMessageCenter::cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation, QWidget *pParent /* = 0*/) const 1604 { 1605 error(pParent, MessageType_Error, 1606 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1607 .arg(strLocation), 1608 formatErrorInfo(vbox)); 1609 } 1610 1611 void UIMessageCenter::cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const 1612 { 1613 error(pParent, MessageType_Error, 1614 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1615 .arg(strLocation), 1616 formatErrorInfo(medium)); 1617 } 1618 1619 void UIMessageCenter::cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const 1620 { 1621 error(pParent, MessageType_Error, 1622 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1623 .arg(strLocation), 1624 formatErrorInfo(progress)); 1625 } 1626 1627 void UIMessageCenter::cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const 1628 { 1629 alert(pParent, MessageType_Critical, 1630 tr("<p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p>" 1631 "<p>Please check that this folder really exists and that you have permissions to remove it.</p>") 1632 .arg(QFileInfo(strFolderName).fileName())); 1633 } 1634 1635 void UIMessageCenter::cannotRewriteMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const 1636 { 1637 QFileInfo fi(strFolderName); 1638 alert(pParent, MessageType_Critical, 1639 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>" 1640 "<p>This folder already exists and possibly belongs to another machine.</p>") 1641 .arg(fi.fileName()).arg(fi.absolutePath())); 1642 } 1643 1644 void UIMessageCenter::cannotCreateMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const 1645 { 1646 QFileInfo fi(strFolderName); 1647 alert(pParent, MessageType_Critical, 1648 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>" 1649 "<p>Please check that the parent really exists and that you have permissions to create the machine folder.</p>") 1650 .arg(fi.fileName()).arg(fi.absolutePath())); 1651 } 1652 1653 void UIMessageCenter::cannotImportAppliance(CAppliance &appliance, QWidget *pParent /* = 0*/) const 1654 { 1655 /* Preserve error-info: */ 1656 QString strErrorInfo = formatErrorInfo(appliance); 1657 /* Add the warnings in the case of an early error: */ 1658 QString strWarningInfo; 1659 foreach(const QString &strWarning, appliance.GetWarnings()) 1660 strWarningInfo += QString("<br />Warning: %1").arg(strWarning); 1661 if (!strWarningInfo.isEmpty()) 1662 strWarningInfo = "<br />" + strWarningInfo; 1663 /* Show the error: */ 1664 error(pParent, MessageType_Error, 1665 tr("Failed to open/interpret appliance <b>%1</b>.") 1666 .arg(appliance.GetPath()), 1667 strWarningInfo + strErrorInfo); 1668 } 1669 1670 void UIMessageCenter::cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const 1671 { 1672 error(pParent, MessageType_Error, 1673 tr("Failed to import appliance <b>%1</b>.") 1674 .arg(strPath), 1675 formatErrorInfo(progress)); 1676 } 1677 1678 void UIMessageCenter::cannotCheckFiles(const CProgress &progress, QWidget *pParent /* = 0*/) const 1679 { 1680 error(pParent, MessageType_Error, 1681 tr("Failed to check files."), 1682 formatErrorInfo(progress)); 1683 } 1684 1685 void UIMessageCenter::cannotRemoveFiles(const CProgress &progress, QWidget *pParent /* = 0*/) const 1686 { 1687 error(pParent, MessageType_Error, 1688 tr("Failed to remove file."), 1689 formatErrorInfo(progress)); 1690 } 1691 1692 bool UIMessageCenter::confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent /* = 0*/) const 1693 { 1694 return questionBinary(pParent, MessageType_Warning, 1695 tr("<p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p>" 1696 "<p>If you continue the runtime state of the exported machine(s) will be discarded. " 1697 "The other machine(s) will not be changed.</p>", 1698 "This text is never used with n == 0. Feel free to drop the %n where possible, " 1699 "we only included it because of problems with Qt Linguist (but the user can see " 1700 "how many machines are in the list and doesn't need to be told).", machineNames.size()) 1701 .arg(machineNames.join(", ")), 1702 0 /* auto-confirm id */, 1703 tr("Continue")); 1704 } 1705 1706 void UIMessageCenter::cannotExportAppliance(const CAppliance &appliance, QWidget *pParent /* = 0*/) const 1707 { 1708 error(pParent, MessageType_Error, 1709 tr("Failed to prepare the export of the appliance <b>%1</b>.") 1710 .arg(CAppliance(appliance).GetPath()), 1711 formatErrorInfo(appliance)); 1712 } 1713 1714 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0*/) const 1715 { 1716 error(pParent, MessageType_Error, 1717 tr("Failed to prepare the export of the appliance <b>%1</b>.") 1718 .arg(strPath), 1719 formatErrorInfo(machine)); 1720 } 1721 1722 void UIMessageCenter::cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const 1723 { 1724 error(pParent, MessageType_Error, 1725 tr("Failed to export appliance <b>%1</b>.") 1726 .arg(strPath), 1727 formatErrorInfo(progress)); 1728 } 1729 1730 void UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent /* = 0 */) 1731 { 1732 error(pParent, MessageType_Error, 1733 tr("Bad password or authentication failure."), 1734 formatErrorInfo(appliance)); 1735 } 1736 1737 void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const 1738 { 1739 /* Prepare auto-confirm id: */ 1740 QByteArray autoConfimId = "showRuntimeError."; 1741 1742 /* Prepare variables: */ 1743 CConsole console1 = console; 1744 KMachineState state = console1.GetState(); 1745 MessageType type; 1746 QString severity; 1747 1748 /// @todo Move to Runtime UI! 1749 /* Preprocessing: */ 1750 if (fFatal) 1751 { 1752 /* The machine must be paused on fFatal errors: */ 1753 Assert(state == KMachineState_Paused); 1754 if (state != KMachineState_Paused) 1755 console1.Pause(); 1756 } 1757 1758 /* Compose type, severity, advance confirm id: */ 1759 if (fFatal) 1760 { 1761 type = MessageType_Critical; 1762 severity = tr("<nobr>Fatal Error</nobr>", "runtime error info"); 1763 autoConfimId += "fatal."; 1764 } 1765 else if (state == KMachineState_Paused) 1766 { 1767 type = MessageType_Error; 1768 severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info"); 1769 autoConfimId += "error."; 1770 } 1771 else 1772 { 1773 type = MessageType_Warning; 1774 severity = tr("<nobr>Warning</nobr>", "runtime error info"); 1775 autoConfimId += "warning."; 1776 } 1777 /* Advance auto-confirm id: */ 1778 autoConfimId += strErrorId.toUtf8(); 1779 1780 /* Format error-details: */ 1781 QString formatted("<!--EOM-->"); 1782 if (!strErrorMsg.isEmpty()) 1783 formatted.prepend(QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strErrorMsg))); 1784 if (!strErrorId.isEmpty()) 1785 formatted += QString("<table bgcolor=#EEEEEE border=0 cellspacing=5 " 1786 "cellpadding=0 width=100%>" 1787 "<tr><td>%1</td><td>%2</td></tr>" 1788 "<tr><td>%3</td><td>%4</td></tr>" 1789 "</table>") 1790 .arg(tr("<nobr>Error ID: </nobr>", "runtime error info"), strErrorId) 1791 .arg(tr("Severity: ", "runtime error info"), severity); 1792 if (!formatted.isEmpty()) 1793 formatted = "<qt>" + formatted + "</qt>"; 1794 1795 /* Show the error: */ 1796 if (type == MessageType_Critical) 1797 { 1798 error(0, type, 1799 tr("<p>A fatal error has occurred during virtual machine execution! " 1800 "The virtual machine will be powered off. Please copy the following error message " 1801 "using the clipboard to help diagnose the problem:</p>"), 1802 formatted, autoConfimId.data()); 1803 } 1804 else if (type == MessageType_Error) 1805 { 1806 error(0, type, 1807 tr("<p>An error has occurred during virtual machine execution! " 1808 "The error details are shown below. You may try to correct the error " 1809 "and resume the virtual machine execution.</p>"), 1810 formatted, autoConfimId.data()); 1811 } 1812 else 1813 { 1814 error(0, type, 1815 tr("<p>The virtual machine execution may run into an error condition as described below. " 1816 "We suggest that you take an appropriate action to avert the error.</p>"), 1817 formatted, autoConfimId.data()); 1818 } 1819 1820 /// @todo Move to Runtime UI! 1821 /* Postprocessing: */ 1822 if (fFatal) 1823 { 1824 /* Power down after a fFatal error: */ 1825 LogRel(("GUI: Powering VM down after a fatal runtime error...\n")); 1826 console1.PowerDown(); 1827 } 1828 } 1829 1830 bool UIMessageCenter::remindAboutGuruMeditation(const QString &strLogFolder) 1831 { 1832 return questionBinary(0, MessageType_GuruMeditation, 1833 tr("<p>A critical error has occurred while running the virtual " 1834 "machine and the machine execution has been stopped.</p>" 1835 "" 1836 "<p>For help, please see the Community section on " 1837 "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> " 1838 "or your support contract. Please provide the contents of the " 1839 "log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, " 1840 "which you can find in the <nobr><b>%1</b></nobr> directory, " 1841 "as well as a description of what you were doing when this error happened. " 1842 "" 1843 "Note that you can also access the above files by selecting <b>Show Log</b> " 1844 "from the <b>Machine</b> menu of the main VirtualBox window.</p>" 1845 "" 1846 "<p>Press <b>OK</b> if you want to power off the machine " 1847 "or press <b>Ignore</b> if you want to leave it as is for debugging. " 1848 "Please note that debugging requires special knowledge and tools, " 1849 "so it is recommended to press <b>OK</b> now.</p>") 1850 .arg(strLogFolder), 1851 0 /* auto-confirm id */, 1852 QIMessageBox::tr("OK"), 1853 tr("Ignore")); 1854 } 1855 1856 void UIMessageCenter::warnAboutVBoxSVCUnavailable() const 1857 { 1858 alert(0, MessageType_Critical, 1859 tr("<p>A critical error has occurred while running the virtual " 1860 "machine and the machine execution should be stopped.</p>" 1861 "" 1862 "<p>For help, please see the Community section on " 1863 "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> " 1864 "or your support contract. Please provide the contents of the " 1865 "log file <tt>VBox.log</tt>, " 1866 "which you can find in the virtual machine log directory, " 1867 "as well as a description of what you were doing when this error happened. " 1868 "" 1869 "Note that you can also access the above file by selecting <b>Show Log</b> " 1870 "from the <b>Machine</b> menu of the main VirtualBox window.</p>" 1871 "" 1872 "<p>Press <b>OK</b> to power off the machine.</p>"), 1873 0 /* auto-confirm id */); 1874 } 1875 1876 bool UIMessageCenter::warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const 1877 { 1878 if (fHWVirtExSupported) 1879 return questionBinary(0, MessageType_Error, 1880 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. " 1881 "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p>" 1882 "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"), 1883 0 /* auto-confirm id */, 1884 tr("Close VM"), tr("Continue")); 1885 else 1886 return questionBinary(0, MessageType_Error, 1887 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. " 1888 "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot."), 1889 0 /* auto-confirm id */, 1890 tr("Close VM"), tr("Continue")); 1891 } 1892 1893 bool UIMessageCenter::warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const 1894 { 1895 if (fHWVirtExSupported) 1896 return questionBinary(0, MessageType_Error, 1897 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. " 1898 "Certain guests (e.g. OS/2 and QNX) require this feature.</p>" 1899 "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"), 1900 0 /* auto-confirm id */, 1901 tr("Close VM"), tr("Continue")); 1902 else 1903 return questionBinary(0, MessageType_Error, 1904 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. " 1905 "Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p>"), 1906 0 /* auto-confirm id */, 1907 tr("Close VM"), tr("Continue")); 1908 } 1909 1910 bool UIMessageCenter::cannotStartWithoutNetworkIf(const QString &strMachineName, const QString &strIfNames) const 1911 { 1912 return questionBinary(0, MessageType_Error, 1913 tr("<p>Could not start the machine <b>%1</b> because the following " 1914 "physical network interfaces were not found:</p><p><b>%2</b></p>" 1915 "<p>You can either change the machine's network settings or stop the machine.</p>") 1916 .arg(strMachineName, strIfNames), 1917 0 /* auto-confirm id */, 1918 tr("Change Network Settings"), tr("Close VM")); 1919 } 1920 1921 void UIMessageCenter::cannotStartMachine(const CConsole &console, const QString &strName) const 1922 { 1923 error(0, MessageType_Error, 1924 tr("Failed to start the virtual machine <b>%1</b>.") 1925 .arg(strName), 1926 formatErrorInfo(console)); 1927 } 1928 1929 void UIMessageCenter::cannotStartMachine(const CProgress &progress, const QString &strName) const 1930 { 1931 error(0, MessageType_Error, 1932 tr("Failed to start the virtual machine <b>%1</b>.") 1933 .arg(strName), 1934 formatErrorInfo(progress)); 1935 } 1936 1937 bool UIMessageCenter::confirmInputCapture(bool &fAutoConfirmed) const 1938 { 1939 int rc = question(0, MessageType_Info, 1940 tr("<p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. " 1941 "This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer " 1942 "integration is not currently supported by the guest OS) and the keyboard, which will make them " 1943 "unavailable to other applications running on your host machine.</p>" 1944 "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the keyboard and mouse " 1945 "(if it is captured) and return them to normal operation. " 1946 "The currently assigned host key is shown on the status bar at the bottom of the Virtual Machine window, " 1947 "next to the <img src=:/hostkey_16px.png/> icon. " 1948 "This icon, together with the mouse icon placed nearby, indicate the current keyboard and mouse capture state.</p>") + 1949 tr("<p>The host key is currently defined as <b>%1</b>.</p>", "additional message box paragraph") 1950 .arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 1951 "confirmInputCapture", 1952 AlertButton_Ok | AlertButtonOption_Default, 1953 AlertButton_Cancel | AlertButtonOption_Escape, 1954 0, 1955 tr("Capture", "do input capture")); 1956 /* Was the message auto-confirmed? */ 1957 fAutoConfirmed = (rc & AlertOption_AutoConfirmed); 1958 /* True if "Ok" was pressed: */ 1959 return (rc & AlertButtonMask) == AlertButton_Ok; 1960 } 1961 1962 bool UIMessageCenter::confirmGoingFullscreen(const QString &strHotKey) const 1963 { 1964 return questionBinary(0, MessageType_Info, 1965 tr("<p>The virtual machine window will be now switched to <b>full-screen</b> mode. " 1966 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>" 1967 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>" 1968 "<p>Note that the main menu bar is hidden in full-screen mode. " 1969 "You can access it by pressing <b>Host+Home</b>.</p>") 1970 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 1971 "confirmGoingFullscreen", 1972 tr("Switch")); 1973 } 1974 1975 bool UIMessageCenter::confirmGoingSeamless(const QString &strHotKey) const 1976 { 1977 return questionBinary(0, MessageType_Info, 1978 tr("<p>The virtual machine window will be now switched to <b>Seamless</b> mode. " 1979 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>" 1980 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>" 1981 "<p>Note that the main menu bar is hidden in seamless mode. " 1982 "You can access it by pressing <b>Host+Home</b>.</p>") 1983 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 1984 "confirmGoingSeamless", 1985 tr("Switch")); 1986 } 1987 1988 bool UIMessageCenter::confirmGoingScale(const QString &strHotKey) const 1989 { 1990 return questionBinary(0, MessageType_Info, 1991 tr("<p>The virtual machine window will be now switched to <b>Scale</b> mode. " 1992 "You can go back to windowed mode at any time by pressing <b>%1</b>.</p>" 1993 "<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>" 1994 "<p>Note that the main menu bar is hidden in scaled mode. " 1995 "You can access it by pressing <b>Host+Home</b>.</p>") 1996 .arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())), 1997 "confirmGoingScale", 1998 tr("Switch")); 1999 } 2000 2001 bool UIMessageCenter::cannotEnterFullscreenMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const 2002 { 2003 return questionBinary(0, MessageType_Warning, 2004 tr("<p>Could not switch the guest display to full-screen mode due to insufficient guest video memory.</p>" 2005 "<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>" 2006 "<p>Press <b>Ignore</b> to switch to full-screen mode anyway or press <b>Cancel</b> to cancel the operation.</p>") 2007 .arg(VBoxGlobal::formatSize(uMinVRAM)), 2008 0 /* auto-confirm id */, 2009 tr("Ignore")); 2010 } 2011 2012 void UIMessageCenter::cannotEnterSeamlessMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const 2013 { 2014 alert(0, MessageType_Error, 2015 tr("<p>Could not enter seamless mode due to insufficient guest " 2016 "video memory.</p>" 2017 "<p>You should configure the virtual machine to have at " 2018 "least <b>%1</b> of video memory.</p>") 2019 .arg(VBoxGlobal::formatSize(uMinVRAM))); 2020 } 2021 2022 bool UIMessageCenter::cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const 2023 { 2024 return questionBinary(0, MessageType_Warning, 2025 tr("<p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p>" 2026 "<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>" 2027 "<p>Press <b>Ignore</b> to switch the screen anyway or press <b>Cancel</b> to cancel the operation.</p>") 2028 .arg(VBoxGlobal::formatSize(uMinVRAM)), 2029 0 /* auto-confirm id */, 2030 tr("Ignore")); 2031 } 2032 2033 void UIMessageCenter::cannotSwitchScreenInSeamless(quint64 uMinVRAM) const 2034 { 2035 alert(0, MessageType_Error, 2036 tr("<p>Could not change the guest screen to this host screen " 2037 "due to insufficient guest video memory.</p>" 2038 "<p>You should configure the virtual machine to have at " 2039 "least <b>%1</b> of video memory.</p>") 2040 .arg(VBoxGlobal::formatSize(uMinVRAM))); 2041 } 2042 2043 void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console, const QString &strDevice) const 2044 { 2045 error(0, MessageType_Error, 2046 tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.") 2047 .arg(strDevice, CConsole(console).GetMachine().GetName()), 2048 formatErrorInfo(console)); 2049 } 2050 2051 void UIMessageCenter::cannotAttachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const 2052 { 2053 error(0, MessageType_Error, 2054 tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.") 2055 .arg(strDevice, strMachineName), 2056 formatErrorInfo(errorInfo)); 2057 } 2058 2059 void UIMessageCenter::cannotDetachUSBDevice(const CConsole &console, const QString &strDevice) const 2060 { 2061 error(0, MessageType_Error, 2062 tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.") 2063 .arg(strDevice, CConsole(console).GetMachine().GetName()), 2064 formatErrorInfo(console)); 2065 } 2066 2067 void UIMessageCenter::cannotDetachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const 2068 { 2069 error(0, MessageType_Error, 2070 tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.") 2071 .arg(strDevice, strMachineName), 2072 formatErrorInfo(errorInfo)); 2073 } 2074 2075 void UIMessageCenter::cannotAttachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const 2076 { 2077 error(0, MessageType_Error, 2078 tr("Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.") 2079 .arg(strWebCamName, strMachineName), 2080 formatErrorInfo(dispatcher)); 2081 } 2082 2083 void UIMessageCenter::cannotDetachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const 2084 { 2085 error(0, MessageType_Error, 2086 tr("Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.") 2087 .arg(strWebCamName, strMachineName), 2088 formatErrorInfo(dispatcher)); 2089 } 2090 2091 void UIMessageCenter::cannotToggleVideoCapture(const CMachine &machine, bool fEnable) 2092 { 2093 /* Get machine-name preserving error-info: */ 2094 QString strMachineName(CMachine(machine).GetName()); 2095 error(0, MessageType_Error, 2096 fEnable ? 2097 tr("Failed to enable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName) : 2098 tr("Failed to disable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName), 2099 formatErrorInfo(machine)); 2100 } 2101 2102 void UIMessageCenter::cannotToggleVRDEServer(const CVRDEServer &server, const QString &strMachineName, bool fEnable) 2103 { 2104 error(0, MessageType_Error, 2105 fEnable ? 2106 tr("Failed to enable the remote desktop server for the virtual machine <b>%1</b>.").arg(strMachineName) : 2107 tr("Failed to disable the remote desktop server for the virtual machine <b>%1</b>.").arg(strMachineName), 2108 formatErrorInfo(server)); 2109 } 2110 2111 void UIMessageCenter::cannotToggleNetworkAdapterCable(const CNetworkAdapter &adapter, const QString &strMachineName, bool fConnect) 2112 { 2113 error(0, MessageType_Error, 2114 fConnect ? 2115 tr("Failed to connect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName) : 2116 tr("Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName), 2117 formatErrorInfo(adapter)); 2118 } 2119 2120 void UIMessageCenter::remindAboutGuestAdditionsAreNotActive() const 2121 { 2122 alert(0, MessageType_Warning, 2123 tr("<p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, " 2124 "and shared folders cannot be used without them. To use shared folders inside the virtual machine, " 2125 "please install the Guest Additions if they are not installed, or re-install them if they are " 2126 "not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. " 2127 "If they are installed but the machine is not yet fully started then shared folders will be available once it is.</p>"), 2128 "remindAboutGuestAdditionsAreNotActive"); 2129 } 2130 2131 void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName) const 2132 { 2133 alert(0, MessageType_Error, 2134 tr("<p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, " 2135 "as the machine has no optical drives. Please add a drive using the storage page of the " 2136 "virtual machine settings window.</p>") 2137 .arg(strMachineName)); 2138 } 2139 2140 void UIMessageCenter::cannotAddDiskEncryptionPassword(const CConsole &console) 2141 { 2142 error(0, MessageType_Error, 2143 tr("Bad password or authentication failure."), 2144 formatErrorInfo(console)); 2145 } 2146 2147 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 2148 bool UIMessageCenter::confirmCancelingAllNetworkRequests() const 2149 { 2150 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2151 tr("Do you wish to cancel all current network operations?")); 2152 } 2153 2154 void UIMessageCenter::showUpdateSuccess(const QString &strVersion, const QString &strLink) const 2155 { 2156 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info, 2157 tr("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available " 2158 "at <a href=\"https://www.virtualbox.org/\">virtualbox.org</a>.</p>" 2159 "<p>You can download this version using the link:</p>" 2160 "<p><a href=%2>%3</a></p>") 2161 .arg(strVersion, strLink, strLink)); 2162 } 2163 2164 void UIMessageCenter::showUpdateNotFound() const 2165 { 2166 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info, 2167 tr("You are already running the most recent version of VirtualBox.")); 2168 } 2169 2170 void UIMessageCenter::askUserToDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion) const 2171 { 2172 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info, 2173 tr("<p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p>" 2174 "<p>You should download and install version %3 of this extension pack from Oracle!</p>") 2175 .arg(strExtPackVersion).arg(strExtPackName).arg(strVBoxVersion)); 2176 } 2177 2178 bool UIMessageCenter::cannotFindGuestAdditions() const 2179 { 2180 return questionBinary(0, MessageType_Question, 2181 tr("<p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p>" 2182 "<p>Do you wish to download this disk image file from the Internet?</p>"), 2183 0 /* auto-confirm id */, 2184 tr("Download")); 2185 } 2186 2187 bool UIMessageCenter::confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const 2188 { 2189 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2190 tr("<p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file " 2191 "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>") 2192 .arg(strUrl, QLocale(VBoxGlobal::languageId()).toString(uSize)), 2193 0 /* auto-confirm id */, 2194 tr("Download")); 2195 } 2196 2197 void UIMessageCenter::cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const 2198 { 2199 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2200 tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded " 2201 "from <nobr><a href=\"%1\">%1</a></nobr> " 2202 "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>" 2203 "<p>Please choose another location for that file.</p>") 2204 .arg(strURL, strTarget)); 2205 } 2206 2207 bool UIMessageCenter::proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const 2208 { 2209 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2210 tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded " 2211 "from <nobr><a href=\"%1\">%1</a></nobr> " 2212 "and saved locally as <nobr><b>%2</b>.</nobr></p>" 2213 "<p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p>") 2214 .arg(strUrl, strSrc), 2215 0 /* auto-confirm id */, 2216 tr("Insert", "additions")); 2217 } 2218 2219 void UIMessageCenter::cannotValidateGuestAdditionsSHA256Sum(const QString &strUrl, const QString &strSrc) const 2220 { 2221 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2222 tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded " 2223 "from <nobr><a href=\"%1\">%1</a></nobr> " 2224 "and saved locally as <nobr><b>%2</b>, </nobr>" 2225 "but the SHA-256 checksum verification failed.</p>" 2226 "<p>Please do the download, installation and verification manually.</p>") 2227 .arg(strUrl, strSrc)); 2228 } 2229 2230 void UIMessageCenter::cannotUpdateGuestAdditions(const CProgress &progress) const 2231 { 2232 error(0, MessageType_Error, 2233 tr("Failed to update Guest Additions. " 2234 "The Guest Additions disk image file will be inserted for user installation."), 2235 formatErrorInfo(progress)); 2236 } 2237 2238 bool UIMessageCenter::cannotFindUserManual(const QString &strMissedLocation) const 2239 { 2240 return questionBinary(0, MessageType_Question, 2241 tr("<p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p>" 2242 "<p>Do you wish to download this file from the Internet?</p>") 2243 .arg(strMissedLocation), 2244 0 /* auto-confirm id */, 2245 tr("Download")); 2246 } 2247 2248 bool UIMessageCenter::confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const 2249 { 2250 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2251 tr("<p>Are you sure you want to download the <b>VirtualBox User Manual</b> " 2252 "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>") 2253 .arg(strURL, QLocale(VBoxGlobal::languageId()).toString(uSize)), 2254 0 /* auto-confirm id */, 2255 tr("Download")); 2256 } 2257 2258 void UIMessageCenter::cannotSaveUserManual(const QString &strURL, const QString &strTarget) const 2259 { 2260 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2261 tr("<p>The VirtualBox User Manual has been successfully downloaded " 2262 "from <nobr><a href=\"%1\">%1</a></nobr> " 2263 "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>" 2264 "<p>Please choose another location for that file.</p>") 2265 .arg(strURL, strTarget)); 2266 } 2267 2268 void UIMessageCenter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) const 2269 { 2270 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Warning, 2271 tr("<p>The VirtualBox User Manual has been successfully downloaded " 2272 "from <nobr><a href=\"%1\">%1</a></nobr> " 2273 "and saved locally as <nobr><b>%2</b>.</nobr></p>") 2274 .arg(strURL, strTarget)); 2275 } 2276 2277 bool UIMessageCenter::warAboutOutdatedExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const 2278 { 2279 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2280 tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>" 2281 "<p>Do you wish to download latest one from the Internet?</p>") 2282 .arg(strExtPackVersion).arg(strExtPackName), 2283 0 /* auto-confirm id */, 2284 tr("Download")); 2285 } 2286 2287 bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const 2288 { 2289 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2290 tr("<p>Are you sure you want to download the <b><nobr>%1</nobr></b> " 2291 "from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>") 2292 .arg(strExtPackName, strURL, QLocale(VBoxGlobal::languageId()).toString(uSize)), 2293 0 /* auto-confirm id */, 2294 tr("Download")); 2295 } 2296 2297 void UIMessageCenter::cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const 2298 { 2299 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2300 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded " 2301 "from <nobr><a href=\"%2\">%2</a></nobr> " 2302 "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>" 2303 "<p>Please choose another location for that file.</p>") 2304 .arg(strExtPackName, strFrom, strTo)); 2305 } 2306 2307 bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const 2308 { 2309 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2310 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded " 2311 "from <nobr><a href=\"%2\">%2</a></nobr> " 2312 "and saved locally as <nobr><b>%3</b>.</nobr></p>" 2313 "<p>Do you wish to install this extension pack?</p>") 2314 .arg(strExtPackName, strFrom, strTo), 2315 0 /* auto-confirm id */, 2316 tr("Install", "extension pack")); 2317 } 2318 2319 void UIMessageCenter::cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const 2320 { 2321 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2322 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded " 2323 "from <nobr><a href=\"%2\">%2</a></nobr> " 2324 "and saved locally as <nobr><b>%3</b>, </nobr>" 2325 "but the SHA-256 checksum verification failed.</p>" 2326 "<p>Please do the download, installation and verification manually.</p>") 2327 .arg(strExtPackName, strFrom, strTo)); 2328 } 2329 2330 bool UIMessageCenter::proposeDeleteExtentionPack(const QString &strTo) const 2331 { 2332 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2333 tr("Do you want to delete the downloaded file <nobr><b>%1</b></nobr>?") 2334 .arg(strTo), 2335 0 /* auto-confirm id */, 2336 tr("Delete", "extension pack")); 2337 } 2338 2339 bool UIMessageCenter::proposeDeleteOldExtentionPacks(const QStringList &strFiles) const 2340 { 2341 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2342 tr("Do you want to delete following list of files <nobr><b>%1</b></nobr>?") 2343 .arg(strFiles.join(",")), 2344 0 /* auto-confirm id */, 2345 tr("Delete", "extension pack")); 2346 } 2347 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 2348 2349 bool UIMessageCenter::confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion, 2350 const QString &strPackDescription, QWidget *pParent /* = 0*/) const 2351 { 2352 return questionBinary(pParent, MessageType_Question, 2353 tr("<p>You are about to install a VirtualBox extension pack. " 2354 "Extension packs complement the functionality of VirtualBox and can contain system level software " 2355 "that could be potentially harmful to your system. Please review the description below and only proceed " 2356 "if you have obtained the extension pack from a trusted source.</p>" 2357 "<p><table cellpadding=0 cellspacing=5>" 2358 "<tr><td><b>Name: </b></td><td>%1</td></tr>" 2359 "<tr><td><b>Version: </b></td><td>%2</td></tr>" 2360 "<tr><td><b>Description: </b></td><td>%3</td></tr>" 2361 "</table></p>") 2362 .arg(strPackName).arg(strPackVersion).arg(strPackDescription), 2363 0 /* auto-confirm id */, 2364 tr("Install", "extension pack")); 2365 } 2366 2367 bool UIMessageCenter::confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew, 2368 const QString &strPackVersionOld, const QString &strPackDescription, 2369 QWidget *pParent /* = 0*/) const 2370 { 2371 /* Prepare initial message: */ 2372 QString strBelehrung = tr("Extension packs complement the functionality of VirtualBox and can contain " 2373 "system level software that could be potentially harmful to your system. " 2374 "Please review the description below and only proceed if you have obtained " 2375 "the extension pack from a trusted source."); 2376 2377 /* Compare versions: */ 2378 QByteArray ba1 = strPackVersionNew.toUtf8(); 2379 QByteArray ba2 = strPackVersionOld.toUtf8(); 2380 int iVerCmp = RTStrVersionCompare(ba1.constData(), ba2.constData()); 2381 2382 /* Show the question: */ 2383 bool fRc; 2384 if (iVerCmp > 0) 2385 fRc = questionBinary(pParent, MessageType_Question, 2386 tr("<p>An older version of the extension pack is already installed, would you like to upgrade? " 2387 "<p>%1</p>" 2388 "<p><table cellpadding=0 cellspacing=5>" 2389 "<tr><td><b>Name: </b></td><td>%2</td></tr>" 2390 "<tr><td><b>New Version: </b></td><td>%3</td></tr>" 2391 "<tr><td><b>Current Version: </b></td><td>%4</td></tr>" 2392 "<tr><td><b>Description: </b></td><td>%5</td></tr>" 2393 "</table></p>") 2394 .arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription), 2395 0 /* auto-confirm id */, 2396 tr("&Upgrade")); 2397 else if (iVerCmp < 0) 2398 fRc = questionBinary(pParent, MessageType_Question, 2399 tr("<p>An newer version of the extension pack is already installed, would you like to downgrade? " 2400 "<p>%1</p>" 2401 "<p><table cellpadding=0 cellspacing=5>" 2402 "<tr><td><b>Name: </b></td><td>%2</td></tr>" 2403 "<tr><td><b>New Version: </b></td><td>%3</td></tr>" 2404 "<tr><td><b>Current Version: </b></td><td>%4</td></tr>" 2405 "<tr><td><b>Description: </b></td><td>%5</td></tr>" 2406 "</table></p>") 2407 .arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription), 2408 0 /* auto-confirm id */, 2409 tr("&Downgrade")); 2410 else 2411 fRc = questionBinary(pParent, MessageType_Question, 2412 tr("<p>The extension pack is already installed with the same version, would you like reinstall it? " 2413 "<p>%1</p>" 2414 "<p><table cellpadding=0 cellspacing=5>" 2415 "<tr><td><b>Name: </b></td><td>%2</td></tr>" 2416 "<tr><td><b>Version: </b></td><td>%3</td></tr>" 2417 "<tr><td><b>Description: </b></td><td>%4</td></tr>" 2418 "</table></p>") 2419 .arg(strBelehrung).arg(strPackName).arg(strPackVersionOld).arg(strPackDescription), 2420 0 /* auto-confirm id */, 2421 tr("&Reinstall")); 2422 return fRc; 2423 } 2424 2425 bool UIMessageCenter::confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent /* = 0*/) const 2426 { 2427 return questionBinary(pParent, MessageType_Question, 2428 tr("<p>You are about to remove the VirtualBox extension pack <b>%1</b>.</p>" 2429 "<p>Are you sure you want to proceed?</p>") 2430 .arg(strPackName), 2431 0 /* auto-confirm id */, 2432 tr("&Remove") /* ok button text */, 2433 QString() /* cancel button text */, 2434 false /* ok button by default? */); 2435 } 2436 2437 void UIMessageCenter::cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent /* = 0*/) const 2438 { 2439 error(pParent, MessageType_Error, 2440 tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename), 2441 formatErrorInfo(extPackManager)); 2442 } 2443 2444 void UIMessageCenter::warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent /* = 0*/) const 2445 { 2446 error(pParent, MessageType_Error, 2447 tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename), 2448 "<!--EOM-->" + extPackFile.GetWhyUnusable()); 2449 } 2450 2451 void UIMessageCenter::cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent /* = 0*/) const 2452 { 2453 error(pParent, MessageType_Error, 2454 tr("Failed to install the Extension Pack <b>%1</b>.") 2455 .arg(strFilename), 2456 formatErrorInfo(extPackFile)); 2457 } 2458 2459 void UIMessageCenter::cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent /* = 0*/) const 2460 { 2461 error(pParent, MessageType_Error, 2462 tr("Failed to install the Extension Pack <b>%1</b>.") 2463 .arg(strFilename), 2464 formatErrorInfo(progress)); 2465 } 2466 2467 void UIMessageCenter::cannotUninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent /* = 0*/) const 2468 { 2469 error(pParent, MessageType_Error, 2470 tr("Failed to uninstall the Extension Pack <b>%1</b>.") 2471 .arg(strPackName), 2472 formatErrorInfo(extPackManager)); 2473 } 2474 2475 void UIMessageCenter::cannotUninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent /* = 0*/) const 2476 { 2477 error(pParent, MessageType_Error, 2478 tr("Failed to uninstall the Extension Pack <b>%1</b>.") 2479 .arg(strPackName), 2480 formatErrorInfo(progress)); 2481 } 2482 2483 void UIMessageCenter::warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent /* = 0*/) const 2484 { 2485 alert(pParent, MessageType_Info, 2486 tr("The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.") 2487 .arg(strPackName)); 2488 } 2489 2490 #ifdef VBOX_WITH_DRAG_AND_DROP 2491 void UIMessageCenter::cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const 2492 { 2493 error(pParent, MessageType_Error, 2494 tr("Drag and drop operation from host to guest failed."), 2495 formatErrorInfo(dndTarget)); 2496 } 2497 2498 void UIMessageCenter::cannotDropDataToGuest(const CProgress &progress, QWidget *pParent /* = 0 */) const 2499 { 2500 error(pParent, MessageType_Error, 2501 tr("Drag and drop operation from host to guest failed."), 2502 formatErrorInfo(progress)); 2503 } 2504 2505 void UIMessageCenter::cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const 2506 { 2507 error(pParent, MessageType_Error, 2508 tr("Unable to cancel host to guest drag and drop operation."), 2509 formatErrorInfo(dndTarget)); 2510 } 2511 2512 void UIMessageCenter::cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent /* = 0 */) const 2513 { 2514 error(pParent, MessageType_Error, 2515 tr("Drag and drop operation from guest to host failed."), 2516 formatErrorInfo(dndSource)); 2517 } 2518 2519 void UIMessageCenter::cannotDropDataToHost(const CProgress &progress, QWidget *pParent /* = 0 */) const 2520 { 2521 error(pParent, MessageType_Error, 2522 tr("Drag and drop operation from guest to host failed."), 2523 formatErrorInfo(progress)); 2524 } 2525 #endif /* VBOX_WITH_DRAG_AND_DROP */ 2526 2527 void UIMessageCenter::cannotOpenLicenseFile(const QString &strPath, QWidget *pParent /* = 0*/) const 2528 { 2529 alert(pParent, MessageType_Error, 2530 tr("Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.") 2531 .arg(strPath)); 2532 } 2533 2534 bool UIMessageCenter::confirmOverridingFile(const QString &strPath, QWidget *pParent /* = 0*/) const 2535 { 2536 return questionBinary(pParent, MessageType_Question, 2537 tr("A file named <b>%1</b> already exists. " 2538 "Are you sure you want to replace it?<br /><br />" 2539 "Replacing it will overwrite its contents.") 2540 .arg(strPath), 2541 0 /* auto-confirm id */, 2542 QString() /* ok button text */, 2543 QString() /* cancel button text */, 2544 false /* ok button by default? */); 2545 } 2546 2547 bool UIMessageCenter::confirmOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent /* = 0*/) const 2548 { 2549 /* If it is only one file use the single question versions above: */ 2550 if (strPaths.size() == 1) 2551 return confirmOverridingFile(strPaths.at(0), pParent); 2552 else if (strPaths.size() > 1) 2553 return questionBinary(pParent, MessageType_Question, 2554 tr("The following files already exist:<br /><br />%1<br /><br />" 2555 "Are you sure you want to replace them? " 2556 "Replacing them will overwrite their contents.") 2557 .arg(QStringList(strPaths.toList()).join("<br />")), 2558 0 /* auto-confirm id */, 2559 QString() /* ok button text */, 2560 QString() /* cancel button text */, 2561 false /* ok button by default? */); 2562 else 2563 return true; 2564 } 2565 2566 bool UIMessageCenter::confirmOverridingFileIfExists(const QString &strPath, QWidget *pParent /* = 0*/) const 2567 { 2568 QFileInfo fi(strPath); 2569 if (fi.exists()) 2570 return confirmOverridingFile(strPath, pParent); 2571 else 2572 return true; 2573 } 2574 2575 bool UIMessageCenter::confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent /* = 0*/) const 2576 { 2577 QVector<QString> existingFiles; 2578 foreach(const QString &file, strPaths) 2579 { 2580 QFileInfo fi(file); 2581 if (fi.exists()) 2582 existingFiles << fi.absoluteFilePath(); 2583 } 2584 /* If it is only one file use the single question versions above: */ 2585 if (existingFiles.size() == 1) 2586 return confirmOverridingFileIfExists(existingFiles.at(0), pParent); 2587 else if (existingFiles.size() > 1) 2588 return confirmOverridingFiles(existingFiles, pParent); 2589 else 2590 return true; 2591 } 2592 2593 /* static */ 2594 QString UIMessageCenter::formatRC(HRESULT rc) 36 37 /* static */ 38 QString UIErrorString::formatRC(HRESULT rc) 2595 39 { 2596 40 QString str; 2597 41 2598 42 PCRTCOMERRMSG msg = NULL; 2599 const char * errMsg = NULL;43 const char *pErrMsg = NULL; 2600 44 2601 45 /* First, try as is (only set bit 31 bit for warnings): */ … … 2606 50 2607 51 if (msg != NULL) 2608 errMsg = msg->pszDefine;52 pErrMsg = msg->pszDefine; 2609 53 2610 54 #ifdef VBOX_WS_WIN … … 2617 61 2618 62 if (winMsg != NULL) 2619 errMsg = winMsg->pszDefine;63 pErrMsg = winMsg->pszDefine; 2620 64 } 2621 65 #endif /* VBOX_WS_WIN */ 2622 66 2623 if ( errMsg != NULL && *errMsg != '\0')2624 str.sprintf("%s", errMsg);67 if (pErrMsg != NULL && *pErrMsg != '\0') 68 str.sprintf("%s", pErrMsg); 2625 69 2626 70 return str; … … 2628 72 2629 73 /* static */ 2630 QString UI MessageCenter::formatRCFull(HRESULT rc)74 QString UIErrorString::formatRCFull(HRESULT rc) 2631 75 { 2632 76 QString str; 2633 77 2634 78 PCRTCOMERRMSG msg = NULL; 2635 const char * errMsg = NULL;79 const char *pErrMsg = NULL; 2636 80 2637 81 /* First, try as is (only set bit 31 bit for warnings): */ … … 2642 86 2643 87 if (msg != NULL) 2644 errMsg = msg->pszDefine;88 pErrMsg = msg->pszDefine; 2645 89 2646 90 #ifdef VBOX_WS_WIN … … 2653 97 2654 98 if (winMsg != NULL) 2655 errMsg = winMsg->pszDefine;99 pErrMsg = winMsg->pszDefine; 2656 100 } 2657 101 #endif /* VBOX_WS_WIN */ 2658 102 2659 if ( errMsg != NULL && *errMsg != '\0')2660 str.sprintf("%s (0x%08X)", errMsg, rc);103 if (pErrMsg != NULL && *pErrMsg != '\0') 104 str.sprintf("%s (0x%08X)", pErrMsg, rc); 2661 105 else 2662 106 str.sprintf("0x%08X", rc); … … 2666 110 2667 111 /* static */ 2668 QString UI MessageCenter::formatErrorInfo(const CProgress &progress)112 QString UIErrorString::formatErrorInfo(const CProgress &comProgress) 2669 113 { 2670 114 /* Check for API errors first: */ 2671 if (! progress.isOk())2672 return formatErrorInfo(static_cast<COMBaseWithEI>( progress));115 if (!comProgress.isOk()) 116 return formatErrorInfo(static_cast<COMBaseWithEI>(comProgress)); 2673 117 2674 118 /* For progress errors otherwise: */ 2675 CVirtualBoxErrorInfo errorInfo = progress.GetErrorInfo();119 CVirtualBoxErrorInfo comErrorInfo = comProgress.GetErrorInfo(); 2676 120 /* Handle valid error-info first: */ 2677 if (! errorInfo.isNull())2678 return formatErrorInfo( errorInfo);121 if (!comErrorInfo.isNull()) 122 return formatErrorInfo(comErrorInfo); 2679 123 /* Handle NULL error-info otherwise: */ 2680 124 return QString("<table bgcolor=#EEEEEE border=0 cellspacing=5 cellpadding=0 width=100%>" 2681 125 "<tr><td>%1</td><td><tt>%2</tt></td></tr></table>") 2682 .arg( tr("Result Code: ", "error info"))2683 .arg(formatRCFull( progress.GetResultCode()))126 .arg(QObject::tr("Result Code: ", "error info")) 127 .arg(formatRCFull(comProgress.GetResultCode())) 2684 128 .prepend("<!--EOM-->") /* move to details */; 2685 129 } 2686 130 2687 131 /* static */ 2688 QString UIMessageCenter::formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC /* = S_OK */) 2689 { 2690 QString formatted = errorInfoToString(info, wrapperRC); 2691 return QString("<qt>%1</qt>").arg(formatted); 2692 } 2693 2694 /* static */ 2695 QString UIMessageCenter::formatErrorInfo(const CVirtualBoxErrorInfo &info) 2696 { 2697 return formatErrorInfo(COMErrorInfo(info)); 2698 } 2699 2700 /* static */ 2701 QString UIMessageCenter::formatErrorInfo(const COMBaseWithEI &wrapper) 2702 { 2703 Assert(wrapper.lastRC() != S_OK); 2704 return formatErrorInfo(wrapper.errorInfo(), wrapper.lastRC()); 2705 } 2706 2707 /* static */ 2708 QString UIMessageCenter::formatErrorInfo(const COMResult &rc) 2709 { 2710 Assert(rc.rc() != S_OK); 2711 return formatErrorInfo(rc.errorInfo(), rc.rc()); 2712 } 2713 2714 void UIMessageCenter::sltShowHelpWebDialog() 2715 { 2716 vboxGlobal().openURL("https://www.virtualbox.org"); 2717 } 2718 2719 void UIMessageCenter::sltShowBugTracker() 2720 { 2721 vboxGlobal().openURL("https://www.virtualbox.org/wiki/Bugtracker"); 2722 } 2723 2724 void UIMessageCenter::sltShowForums() 2725 { 2726 vboxGlobal().openURL("https://forums.virtualbox.org/"); 2727 } 2728 2729 void UIMessageCenter::sltShowOracle() 2730 { 2731 vboxGlobal().openURL("http://www.oracle.com/us/technologies/virtualization/virtualbox/overview/index.html"); 2732 } 2733 2734 void UIMessageCenter::sltShowHelpAboutDialog() 2735 { 2736 CVirtualBox vbox = vboxGlobal().virtualBox(); 2737 QString strFullVersion; 2738 if (vboxGlobal().brandingIsActive()) 2739 { 2740 strFullVersion = QString("%1 r%2 - %3").arg(vbox.GetVersion()) 2741 .arg(vbox.GetRevision()) 2742 .arg(vboxGlobal().brandingGetKey("Name")); 2743 } 2744 else 2745 { 2746 strFullVersion = QString("%1 r%2").arg(vbox.GetVersion()) 2747 .arg(vbox.GetRevision()); 2748 } 2749 AssertWrapperOk(vbox); 2750 2751 (new VBoxAboutDlg(windowManager().mainWindowShown(), strFullVersion))->show(); 2752 } 2753 2754 void UIMessageCenter::sltShowHelpHelpDialog() 2755 { 2756 #ifndef VBOX_OSE 2757 /* For non-OSE version we just open it: */ 2758 sltShowUserManual(vboxGlobal().helpFile()); 2759 #else /* #ifndef VBOX_OSE */ 2760 /* For OSE version we have to check if it present first: */ 2761 QString strUserManualFileName1 = vboxGlobal().helpFile(); 2762 QString strShortFileName = QFileInfo(strUserManualFileName1).fileName(); 2763 QString strUserManualFileName2 = QDir(vboxGlobal().homeFolder()).absoluteFilePath(strShortFileName); 2764 /* Show if user manual already present: */ 2765 if (QFile::exists(strUserManualFileName1)) 2766 sltShowUserManual(strUserManualFileName1); 2767 else if (QFile::exists(strUserManualFileName2)) 2768 sltShowUserManual(strUserManualFileName2); 2769 /* If downloader is running already: */ 2770 else if (UIDownloaderUserManual::current()) 2771 { 2772 /* Just show network access manager: */ 2773 gNetworkManager->show(); 2774 } 2775 /* Else propose to download user manual: */ 2776 else if (cannotFindUserManual(strUserManualFileName1)) 2777 { 2778 /* Create User Manual downloader: */ 2779 UIDownloaderUserManual *pDl = UIDownloaderUserManual::create(); 2780 /* After downloading finished => show User Manual: */ 2781 connect(pDl, &UIDownloaderUserManual::sigDownloadFinished, this, &UIMessageCenter::sltShowUserManual); 2782 /* Start downloading: */ 2783 pDl->start(); 2784 } 2785 #endif /* #ifdef VBOX_OSE */ 2786 } 2787 2788 void UIMessageCenter::sltResetSuppressedMessages() 2789 { 2790 /* Nullify suppressed message list: */ 2791 gEDataManager->setSuppressedMessages(QStringList()); 2792 } 2793 2794 void UIMessageCenter::sltShowUserManual(const QString &strLocation) 2795 { 2796 #if defined (VBOX_WS_WIN) 2797 HtmlHelp(GetDesktopWindow(), strLocation.utf16(), HH_DISPLAY_TOPIC, NULL); 2798 #elif defined (VBOX_WS_X11) 2799 # ifndef VBOX_OSE 2800 char szViewerPath[RTPATH_MAX]; 2801 int rc; 2802 rc = RTPathAppPrivateArch(szViewerPath, sizeof(szViewerPath)); 2803 AssertRC(rc); 2804 QProcess::startDetached(QString(szViewerPath) + "/kchmviewer", QStringList(strLocation)); 2805 # else /* #ifndef VBOX_OSE */ 2806 vboxGlobal().openURL("file://" + strLocation); 2807 # endif /* #ifdef VBOX_OSE */ 2808 #elif defined (VBOX_WS_MAC) 2809 vboxGlobal().openURL("file://" + strLocation); 2810 #endif 2811 } 2812 2813 void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType type, 2814 const QString &strMessage, const QString &strDetails, 2815 int iButton1, int iButton2, int iButton3, 2816 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3, 2817 const QString &strAutoConfirmId) const 2818 { 2819 /* Now we can show a message-box directly: */ 2820 showMessageBox(pParent, type, 2821 strMessage, strDetails, 2822 iButton1, iButton2, iButton3, 2823 strButtonText1, strButtonText2, strButtonText3, 2824 strAutoConfirmId); 2825 } 2826 2827 UIMessageCenter::UIMessageCenter() 2828 { 2829 /* Assign instance: */ 2830 m_spInstance = this; 2831 } 2832 2833 UIMessageCenter::~UIMessageCenter() 2834 { 2835 /* Unassign instance: */ 2836 m_spInstance = 0; 2837 } 2838 2839 void UIMessageCenter::prepare() 2840 { 2841 /* Register required objects as meta-types: */ 2842 qRegisterMetaType<CProgress>(); 2843 qRegisterMetaType<CHost>(); 2844 qRegisterMetaType<CMachine>(); 2845 qRegisterMetaType<CConsole>(); 2846 qRegisterMetaType<CHostNetworkInterface>(); 2847 qRegisterMetaType<UIMediumType>(); 2848 qRegisterMetaType<StorageSlot>(); 2849 2850 /* Prepare interthread connection: */ 2851 qRegisterMetaType<MessageType>(); 2852 // Won't go until we are supporting C++11 or at least variadic templates everywhere. 2853 // connect(this, &UIMessageCenter::sigToShowMessageBox, 2854 // this, &UIMessageCenter::sltShowMessageBox, 2855 connect(this, SIGNAL(sigToShowMessageBox(QWidget*, MessageType, 2856 const QString&, const QString&, 2857 int, int, int, 2858 const QString&, const QString&, const QString&, 2859 const QString&)), 2860 this, SLOT(sltShowMessageBox(QWidget*, MessageType, 2861 const QString&, const QString&, 2862 int, int, int, 2863 const QString&, const QString&, const QString&, 2864 const QString&)), 2865 Qt::BlockingQueuedConnection); 2866 2867 /* Translations for Main. 2868 * Please make sure they corresponds to the strings coming from Main one-by-one symbol! */ 2869 tr("Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might not be installed on the host computer"); 2870 tr("VirtualBox is not currently allowed to access USB devices. You can change this by adding your user to the 'vboxusers' group. Please see the user manual for a more detailed explanation"); 2871 tr("VirtualBox is not currently allowed to access USB devices. You can change this by allowing your user to access the 'usbfs' folder and files. Please see the user manual for a more detailed explanation"); 2872 tr("The USB Proxy Service has not yet been ported to this host"); 2873 tr("Could not load the Host USB Proxy service"); 2874 } 2875 2876 void UIMessageCenter::cleanup() 2877 { 2878 /* Nothing for now... */ 2879 } 2880 2881 QString UIMessageCenter::errorInfoToString(const COMErrorInfo &info, 2882 HRESULT wrapperRC /* = S_OK */) 132 QString UIErrorString::formatErrorInfo(const COMErrorInfo &comInfo, HRESULT wrapperRC /* = S_OK */) 133 { 134 return QString("<qt>%1</qt>").arg(UIErrorString::errorInfoToString(comInfo, wrapperRC)); 135 } 136 137 /* static */ 138 QString UIErrorString::formatErrorInfo(const CVirtualBoxErrorInfo &comInfo) 139 { 140 return formatErrorInfo(COMErrorInfo(comInfo)); 141 } 142 143 /* static */ 144 QString UIErrorString::formatErrorInfo(const COMBaseWithEI &comWrapper) 145 { 146 Assert(comWrapper.lastRC() != S_OK); 147 return formatErrorInfo(comWrapper.errorInfo(), comWrapper.lastRC()); 148 } 149 150 /* static */ 151 QString UIErrorString::formatErrorInfo(const COMResult &comRc) 152 { 153 Assert(comRc.rc() != S_OK); 154 return formatErrorInfo(comRc.errorInfo(), comRc.rc()); 155 } 156 157 /* static */ 158 QString UIErrorString::errorInfoToString(const COMErrorInfo &comInfo, HRESULT wrapperRC) 2883 159 { 2884 160 /* Compose complex details string with internal <!--EOM--> delimiter to 2885 161 * make it possible to split string into info & details parts which will 2886 * be used separately in QIMessageBox */2887 QString formatted;162 * be used separately in QIMessageBox. */ 163 QString strFormatted; 2888 164 2889 165 /* Check if details text is NOT empty: */ 2890 QString strDetailsInfo = info.text();166 const QString strDetailsInfo = comInfo.text(); 2891 167 if (!strDetailsInfo.isEmpty()) 2892 168 { 2893 169 /* Check if details text written in English (latin1) and translated: */ 2894 if ( strDetailsInfo == QString::fromLatin1(strDetailsInfo.toLatin1()) &&2895 strDetailsInfo !=tr(strDetailsInfo.toLatin1().constData()))2896 formatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(tr(strDetailsInfo.toLatin1().constData())));170 if ( strDetailsInfo == QString::fromLatin1(strDetailsInfo.toLatin1()) 171 && strDetailsInfo != QObject::tr(strDetailsInfo.toLatin1().constData())) 172 strFormatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(QObject::tr(strDetailsInfo.toLatin1().constData()))); 2897 173 else 2898 formatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strDetailsInfo));2899 } 2900 2901 formatted += "<!--EOM--><table bgcolor=#EEEEEE border=0 cellspacing=5 "2902 "cellpadding=0 width=100%>";2903 2904 bool haveResultCode = false;2905 2906 if ( info.isBasicAvailable())2907 { 2908 #if defined (VBOX_WS_WIN)2909 haveResultCode = info.isFullAvailable();2910 bool haveComponent = true;2911 bool haveInterfaceID = true;2912 #else /* defined (VBOX_WS_WIN)*/2913 haveResultCode = true;2914 bool haveComponent = info.isFullAvailable();2915 bool haveInterfaceID = info.isFullAvailable();174 strFormatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strDetailsInfo)); 175 } 176 177 strFormatted += "<!--EOM--><table bgcolor=#EEEEEE border=0 cellspacing=5 " 178 "cellpadding=0 width=100%>"; 179 180 bool fHaveResultCode = false; 181 182 if (comInfo.isBasicAvailable()) 183 { 184 #ifdef VBOX_WS_WIN 185 fHaveResultCode = comInfo.isFullAvailable(); 186 bool fHaveComponent = true; 187 bool fHaveInterfaceID = true; 188 #else /* !VBOX_WS_WIN */ 189 fHaveResultCode = true; 190 bool fHaveComponent = comInfo.isFullAvailable(); 191 bool fHaveInterfaceID = comInfo.isFullAvailable(); 2916 192 #endif 2917 193 2918 if ( haveResultCode)194 if (fHaveResultCode) 2919 195 { 2920 formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")2921 .arg( tr("Result Code: ", "error info"))2922 .arg(formatRCFull( info.resultCode()));196 strFormatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>") 197 .arg(QObject::tr("Result Code: ", "error info")) 198 .arg(formatRCFull(comInfo.resultCode())); 2923 199 } 2924 200 2925 if ( haveComponent)2926 formatted += QString("<tr><td>%1</td><td>%2</td></tr>")2927 .arg( tr("Component: ", "error info"), info.component());2928 2929 if ( haveInterfaceID)201 if (fHaveComponent) 202 strFormatted += QString("<tr><td>%1</td><td>%2</td></tr>") 203 .arg(QObject::tr("Component: ", "error info"), comInfo.component()); 204 205 if (fHaveInterfaceID) 2930 206 { 2931 QString s = info.interfaceID().toString();2932 if (! info.interfaceName().isEmpty())2933 s = info.interfaceName() + ' ' + s;2934 formatted += QString("<tr><td>%1</td><td>%2</td></tr>")2935 .arg( tr("Interface: ", "error info"), s);207 QString s = comInfo.interfaceID().toString(); 208 if (!comInfo.interfaceName().isEmpty()) 209 s = comInfo.interfaceName() + ' ' + s; 210 strFormatted += QString("<tr><td>%1</td><td>%2</td></tr>") 211 .arg(QObject::tr("Interface: ", "error info"), s); 2936 212 } 2937 213 2938 if (! info.calleeIID().isNull() && info.calleeIID() != info.interfaceID())214 if (!comInfo.calleeIID().isNull() && comInfo.calleeIID() != comInfo.interfaceID()) 2939 215 { 2940 QString s = info.calleeIID().toString();2941 if (! info.calleeName().isEmpty())2942 s = info.calleeName() + ' ' + s;2943 formatted += QString("<tr><td>%1</td><td>%2</td></tr>")2944 .arg( tr("Callee: ", "error info"), s);216 QString s = comInfo.calleeIID().toString(); 217 if (!comInfo.calleeName().isEmpty()) 218 s = comInfo.calleeName() + ' ' + s; 219 strFormatted += QString("<tr><td>%1</td><td>%2</td></tr>") 220 .arg(QObject::tr("Callee: ", "error info"), s); 2945 221 } 2946 222 } 2947 223 2948 if ( FAILED (wrapperRC) &&2949 (!haveResultCode || wrapperRC != info.resultCode()))2950 { 2951 formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")2952 .arg( tr("Callee RC: ", "error info"))224 if ( FAILED(wrapperRC) 225 && (!fHaveResultCode || wrapperRC != comInfo.resultCode())) 226 { 227 strFormatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>") 228 .arg(QObject::tr("Callee RC: ", "error info")) 2953 229 .arg(formatRCFull(wrapperRC)); 2954 230 } 2955 231 2956 formatted += "</table>"; 2957 2958 if (info.next()) 2959 formatted = formatted + "<!--EOP-->" + errorInfoToString(*info.next()); 2960 2961 return formatted; 2962 } 2963 2964 int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType type, 2965 const QString &strMessage, const QString &strDetails, 2966 int iButton1, int iButton2, int iButton3, 2967 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3, 2968 const QString &strAutoConfirmId) const 2969 { 2970 /* Choose the 'default' button: */ 2971 if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0) 2972 iButton1 = AlertButton_Ok | AlertButtonOption_Default; 2973 2974 /* Check if message-box was auto-confirmed before: */ 2975 QStringList confirmedMessageList; 2976 if (!strAutoConfirmId.isEmpty()) 2977 { 2978 const QString strID = vboxGlobal().isVMConsoleProcess() ? vboxGlobal().managedVMUuid() : UIExtraDataManager::GlobalID; 2979 confirmedMessageList = gEDataManager->suppressedMessages(strID); 2980 if ( confirmedMessageList.contains(strAutoConfirmId) 2981 || confirmedMessageList.contains("allMessageBoxes") 2982 || confirmedMessageList.contains("all") ) 2983 { 2984 int iResultCode = AlertOption_AutoConfirmed; 2985 if (iButton1 & AlertButtonOption_Default) 2986 iResultCode |= (iButton1 & AlertButtonMask); 2987 if (iButton2 & AlertButtonOption_Default) 2988 iResultCode |= (iButton2 & AlertButtonMask); 2989 if (iButton3 & AlertButtonOption_Default) 2990 iResultCode |= (iButton3 & AlertButtonMask); 2991 return iResultCode; 2992 } 2993 } 2994 2995 /* Choose title and icon: */ 2996 QString title; 2997 AlertIconType icon; 2998 switch (type) 2999 { 3000 default: 3001 case MessageType_Info: 3002 title = tr("VirtualBox - Information", "msg box title"); 3003 icon = AlertIconType_Information; 3004 break; 3005 case MessageType_Question: 3006 title = tr("VirtualBox - Question", "msg box title"); 3007 icon = AlertIconType_Question; 3008 break; 3009 case MessageType_Warning: 3010 title = tr("VirtualBox - Warning", "msg box title"); 3011 icon = AlertIconType_Warning; 3012 break; 3013 case MessageType_Error: 3014 title = tr("VirtualBox - Error", "msg box title"); 3015 icon = AlertIconType_Critical; 3016 break; 3017 case MessageType_Critical: 3018 title = tr("VirtualBox - Critical Error", "msg box title"); 3019 icon = AlertIconType_Critical; 3020 break; 3021 case MessageType_GuruMeditation: 3022 title = "VirtualBox - Guru Meditation"; /* don't translate this */ 3023 icon = AlertIconType_GuruMeditation; 3024 break; 3025 } 3026 3027 /* Create message-box: */ 3028 QWidget *pMessageBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown()); 3029 QPointer<QIMessageBox> pMessageBox = new QIMessageBox(title, strMessage, icon, 3030 iButton1, iButton2, iButton3, 3031 pMessageBoxParent); 3032 windowManager().registerNewParent(pMessageBox, pMessageBoxParent); 3033 3034 /* Prepare auto-confirmation check-box: */ 3035 if (!strAutoConfirmId.isEmpty()) 3036 { 3037 pMessageBox->setFlagText(tr("Do not show this message again", "msg box flag")); 3038 pMessageBox->setFlagChecked(false); 3039 } 3040 3041 /* Configure details: */ 3042 if (!strDetails.isEmpty()) 3043 pMessageBox->setDetailsText(strDetails); 3044 3045 /* Configure button-text: */ 3046 if (!strButtonText1.isNull()) 3047 pMessageBox->setButtonText(0, strButtonText1); 3048 if (!strButtonText2.isNull()) 3049 pMessageBox->setButtonText(1, strButtonText2); 3050 if (!strButtonText3.isNull()) 3051 pMessageBox->setButtonText(2, strButtonText3); 3052 3053 /* Show message-box: */ 3054 int iResultCode = pMessageBox->exec(); 3055 3056 /* Make sure message-box still valid: */ 3057 if (!pMessageBox) 3058 return iResultCode; 3059 3060 /* Remember auto-confirmation check-box value: */ 3061 if (!strAutoConfirmId.isEmpty()) 3062 { 3063 if (pMessageBox->flagChecked()) 3064 { 3065 confirmedMessageList << strAutoConfirmId; 3066 gEDataManager->setSuppressedMessages(confirmedMessageList); 3067 } 3068 } 3069 3070 /* Delete message-box: */ 3071 delete pMessageBox; 3072 3073 /* Return result-code: */ 3074 return iResultCode; 3075 } 3076 232 strFormatted += "</table>"; 233 234 if (comInfo.next()) 235 strFormatted = strFormatted + "<!--EOP-->" + errorInfoToString(*comInfo.next()); 236 237 return strFormatted; 238 } 239 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIErrorString.h
r68433 r68435 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UI MessageCenterclass declaration.3 * VBox Qt GUI - UIErrorString class declaration. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ UIMessageCenter_h__19 #define __ UIMessageCenter_h__18 #ifndef ___UIErrorString_h___ 19 #define ___UIErrorString_h___ 20 20 21 21 /* Qt includes: */ 22 #include <Q Object>22 #include <QString> 23 23 24 /* GUI includes: */ 25 #include "QIMessageBox.h" 26 #include "UIMediumDefs.h" 27 28 /* COM includes: */ 29 #include "COMEnums.h" 30 #include "CProgress.h" 24 /* Other VBox includes: */ 25 #include <VBox/com/defs.h> 31 26 32 27 /* Forward declarations: */ 33 class UIMedium;34 struct StorageSlot;35 #ifdef VBOX_WITH_DRAG_AND_DROP 36 class C Guest;37 #endif /* VBOX_WITH_DRAG_AND_DROP */ 28 class COMBaseWithEI; 29 class COMErrorInfo; 30 class COMResult; 31 class CProgress; 32 class CVirtualBoxErrorInfo; 38 33 39 /* Possible message types: */ 40 enum MessageType 34 35 /** Namespace simplifying COM error formatting. */ 36 class UIErrorString 41 37 { 42 MessageType_Info = 1,43 MessageType_Question,44 MessageType_Warning,45 MessageType_Error,46 MessageType_Critical,47 MessageType_GuruMeditation48 };49 Q_DECLARE_METATYPE(MessageType);50 51 /* Global message-center object: */52 class UIMessageCenter: public QObject53 {54 Q_OBJECT;55 56 signals:57 58 /* Notifier: Interthreading stuff: */59 void sigToShowMessageBox(QWidget *pParent, MessageType type,60 const QString &strMessage, const QString &strDetails,61 int iButton1, int iButton2, int iButton3,62 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,63 const QString &strAutoConfirmId) const;64 65 38 public: 66 39 67 /* Static API: Create/destroy stuff: */ 68 static void create(); 69 static void destroy(); 70 71 /* API: Warning registration stuff: */ 72 bool warningShown(const QString &strWarningName) const; 73 void setWarningShown(const QString &strWarningName, bool fWarningShown) const; 74 75 /* API: Main message function, used directly only in exceptional cases: */ 76 int message(QWidget *pParent, MessageType type, 77 const QString &strMessage, 78 const QString &strDetails, 79 const char *pcszAutoConfirmId = 0, 80 int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, 81 const QString &strButtonText1 = QString(), 82 const QString &strButtonText2 = QString(), 83 const QString &strButtonText3 = QString()) const; 84 85 /* API: Wrapper to 'message' function. 86 * Provides single OK button: */ 87 void error(QWidget *pParent, MessageType type, 88 const QString &strMessage, 89 const QString &strDetails, 90 const char *pcszAutoConfirmId = 0) const; 91 92 /* API: Wrapper to 'message' function, 93 * Error with question providing two buttons (OK and Cancel by default): */ 94 bool errorWithQuestion(QWidget *pParent, MessageType type, 95 const QString &strMessage, 96 const QString &strDetails, 97 const char *pcszAutoConfirmId = 0, 98 const QString &strOkButtonText = QString(), 99 const QString &strCancelButtonText = QString()) const; 100 101 /* API: Wrapper to 'error' function. 102 * Omits details: */ 103 void alert(QWidget *pParent, MessageType type, 104 const QString &strMessage, 105 const char *pcszAutoConfirmId = 0) const; 106 107 /* API: Wrapper to 'message' function. 108 * Omits details, provides two or three buttons: */ 109 int question(QWidget *pParent, MessageType type, 110 const QString &strMessage, 111 const char *pcszAutoConfirmId = 0, 112 int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, 113 const QString &strButtonText1 = QString(), 114 const QString &strButtonText2 = QString(), 115 const QString &strButtonText3 = QString()) const; 116 117 /* API: Wrapper to 'question' function, 118 * Question providing two buttons (OK and Cancel by default): */ 119 bool questionBinary(QWidget *pParent, MessageType type, 120 const QString &strMessage, 121 const char *pcszAutoConfirmId = 0, 122 const QString &strOkButtonText = QString(), 123 const QString &strCancelButtonText = QString(), 124 bool fDefaultFocusForOk = true) const; 125 126 /* API: Wrapper to 'question' function, 127 * Question providing three buttons (Yes, No and Cancel by default): */ 128 int questionTrinary(QWidget *pParent, MessageType type, 129 const QString &strMessage, 130 const char *pcszAutoConfirmId = 0, 131 const QString &strChoice1ButtonText = QString(), 132 const QString &strChoice2ButtonText = QString(), 133 const QString &strCancelButtonText = QString()) const; 134 135 /* API: One more main function: */ 136 int messageWithOption(QWidget *pParent, MessageType type, 137 const QString &strMessage, 138 const QString &strOptionText, 139 bool fDefaultOptionValue = true, 140 int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, 141 const QString &strButtonText1 = QString(), 142 const QString &strButtonText2 = QString(), 143 const QString &strButtonText3 = QString()) const; 144 145 /* API: Progress-dialog stuff: */ 146 bool showModalProgressDialog(CProgress &progress, const QString &strTitle, 147 const QString &strImage = "", QWidget *pParent = 0, 148 int cMinDuration = 2000); 149 150 /* API: Main (startup) warnings: */ 151 #ifdef RT_OS_LINUX 152 void warnAboutWrongUSBMounted() const; 153 #endif /* RT_OS_LINUX */ 154 void cannotStartSelector() const; 155 void showBetaBuildWarning() const; 156 void showExperimentalBuildWarning() const; 157 158 /* API: COM startup warnings: */ 159 void cannotInitUserHome(const QString &strUserHome) const; 160 void cannotInitCOM(HRESULT rc) const; 161 void cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const; 162 void cannotAcquireVirtualBox(const CVirtualBoxClient &client) const; 163 164 /* API: Global warnings: */ 165 void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const; 166 void cannotLoadLanguage(const QString &strLangFile) const; 167 void cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const; 168 void cannotFindMachineById(const CVirtualBox &vbox, const QString &strId) const; 169 void cannotOpenSession(const CSession &session) const; 170 void cannotOpenSession(const CMachine &machine) const; 171 void cannotOpenSession(const CProgress &progress, const QString &strMachineName) const; 172 void cannotGetMediaAccessibility(const UIMedium &medium) const; 173 void cannotOpenURL(const QString &strUrl) const; 174 void cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue); 175 void cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue); 176 void warnAboutInvalidEncryptionPassword(const QString &strPasswordId, QWidget *pParent = 0); 177 178 /* API: Selector warnings: */ 179 void cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const; 180 void cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) const; 181 void cannotResolveCollisionAutomatically(const QString &strCollisionName, const QString &strGroupName) const; 182 bool confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) const; 183 void cannotSetGroups(const CMachine &machine) const; 184 bool confirmMachineItemRemoval(const QStringList &names) const; 185 int confirmMachineRemoval(const QList<CMachine> &machines) const; 186 void cannotRemoveMachine(const CMachine &machine) const; 187 void cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const; 188 bool warnAboutInaccessibleMedia() const; 189 bool confirmDiscardSavedState(const QString &strNames) const; 190 bool confirmResetMachine(const QString &strNames) const; 191 bool confirmACPIShutdownMachine(const QString &strNames) const; 192 bool confirmPowerOffMachine(const QString &strNames) const; 193 void cannotPauseMachine(const CConsole &console) const; 194 void cannotResumeMachine(const CConsole &console) const; 195 void cannotDiscardSavedState(const CMachine &machine) const; 196 void cannotSaveMachineState(const CMachine &machine); 197 void cannotSaveMachineState(const CProgress &progress, const QString &strMachineName); 198 void cannotACPIShutdownMachine(const CConsole &console) const; 199 void cannotPowerDownMachine(const CConsole &console) const; 200 void cannotPowerDownMachine(const CProgress &progress, const QString &strMachineName) const; 201 bool confirmStartMultipleMachines(const QString &strNames) const; 202 203 /* API: Snapshot warnings: */ 204 int confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) const; 205 bool confirmSnapshotRemoval(const QString &strSnapshotName) const; 206 bool warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, const QString &strTargetImageName, 207 const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree) const; 208 void cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent = 0) const; 209 void cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const; 210 bool cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const; 211 bool cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const; 212 void cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const; 213 void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const; 214 void cannotFindSnapshotByName(const CMachine &comMachine, const QString &strName, QWidget *pParent = 0) const; 215 void cannotFindSnapshotById(const CMachine &comMachine, const QString &strId, QWidget *pParent = 0) const; 216 void cannotAcquireSnapshotAttributes(const CSnapshot &comSnapshot, QWidget *pParent = 0); 217 218 /* API: Common settings warnings: */ 219 void cannotSaveSettings(const QString strDetails, QWidget *pParent = 0) const; 220 221 /* API: Global settings warnings: */ 222 bool confirmNATNetworkRemoval(const QString &strName, QWidget *pParent = 0) const; 223 void cannotSetSystemProperties(const CSystemProperties &properties, QWidget *pParent = 0) const; 224 225 /* API: Machine settings warnings: */ 226 void warnAboutUnaccessibleUSB(const COMBaseWithEI &object, QWidget *pParent = 0) const; 227 void warnAboutStateChange(QWidget *pParent = 0) const; 228 bool confirmSettingsReloading(QWidget *pParent = 0) const; 229 int confirmHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 230 int confirmOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 231 int confirmFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 232 int confirmRemovingOfLastDVDDevice(QWidget *pParent = 0) const; 233 void cannotAttachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0); 234 bool warnAboutIncorrectPort(QWidget *pParent = 0) const; 235 bool warnAboutIncorrectAddress(QWidget *pParent = 0) const; 236 bool warnAboutEmptyGuestAddress(QWidget *pParent = 0) const; 237 bool warnAboutNameShouldBeUnique(QWidget *pParent = 0) const; 238 bool warnAboutRulesConflict(QWidget *pParent = 0) const; 239 bool confirmCancelingPortForwardingDialog(QWidget *pParent = 0) const; 240 void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0) const; 241 242 /* API: Virtual Medium Manager warnings: */ 243 void cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent = 0) const; 244 void cannotMoveMediumStorage(const CMedium &comMedium, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent = 0) const; 245 void cannotMoveMediumStorage(const CProgress &comProgress, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent = 0) const; 246 void cannotChangeMediumDescription(const CMedium &comMedium, const QString &strLocation, QWidget *pParent = 0) const; 247 bool confirmMediumRelease(const UIMedium &medium, QWidget *pParent = 0) const; 248 bool confirmMediumRemoval(const UIMedium &medium, QWidget *pParent = 0) const; 249 int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const; 250 void cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0) const; 251 void cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0) const; 252 void cannotResizeHardDiskStorage(const CMedium &comMedium, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent = 0) const; 253 void cannotResizeHardDiskStorage(const CProgress &comProgress, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent = 0) const; 254 void cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0) const; 255 bool cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent = 0) const; 256 void cannotOpenMedium(const CVirtualBox &vbox, UIMediumType type, const QString &strLocation, QWidget *pParent = 0) const; 257 void cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent = 0) const; 258 259 /* API: Host Network Manager warnings: */ 260 bool confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent = 0) const; 261 void cannotAcquireHostNetworkInterfaces(const CHost &comHost, QWidget *pParent = 0) const; 262 void cannotFindHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent = 0) const; 263 void cannotCreateHostNetworkInterface(const CHost &comHost, QWidget *pParent = 0) const; 264 void cannotCreateHostNetworkInterface(const CProgress &progress, QWidget *pParent = 0) const; 265 void cannotRemoveHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent = 0) const; 266 void cannotRemoveHostNetworkInterface(const CProgress &progress, const QString &strInterfaceName, QWidget *pParent = 0) const; 267 void cannotAcquireHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent = 0) const; 268 void cannotSaveHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent = 0) const; 269 void cannotCreateDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent = 0) const; 270 void cannotRemoveDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent = 0) const; 271 void cannotAcquireDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent = 0) const; 272 void cannotSaveDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent = 0) const; 273 274 /* API: Wizards warnings: */ 275 bool confirmHardDisklessMachine(QWidget *pParent = 0) const; 276 void cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent = 0) const; 277 void cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent = 0) const; 278 void cannotCreateClone(const CMachine &machine, QWidget *pParent = 0) const; 279 void cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const; 280 void cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const; 281 void cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation,QWidget *pParent = 0) const; 282 void cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0) const; 283 void cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0) const; 284 void cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent = 0) const; 285 void cannotRewriteMachineFolder(const QString &strFolderName, QWidget *pParent = 0) const; 286 void cannotCreateMachineFolder(const QString &strFolderName, QWidget *pParent = 0) const; 287 void cannotImportAppliance(CAppliance &appliance, QWidget *pParent = 0) const; 288 void cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const; 289 void cannotCheckFiles(const CProgress &progress, QWidget *pParent = 0) const; 290 void cannotRemoveFiles(const CProgress &progress, QWidget *pParent = 0) const; 291 bool confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent = 0) const; 292 void cannotExportAppliance(const CAppliance &appliance, QWidget *pParent = 0) const; 293 void cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent = 0) const; 294 void cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const; 295 void cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent = 0); 296 297 /* API: Runtime UI warnings: */ 298 void showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const; 299 bool remindAboutGuruMeditation(const QString &strLogFolder); 300 void warnAboutVBoxSVCUnavailable() const; 301 bool warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const; 302 bool warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const; 303 bool cannotStartWithoutNetworkIf(const QString &strMachineName, const QString &strIfNames) const; 304 void cannotStartMachine(const CConsole &console, const QString &strName) const; 305 void cannotStartMachine(const CProgress &progress, const QString &strName) const; 306 bool confirmInputCapture(bool &fAutoConfirmed) const; 307 bool confirmGoingFullscreen(const QString &strHotKey) const; 308 bool confirmGoingSeamless(const QString &strHotKey) const; 309 bool confirmGoingScale(const QString &strHotKey) const; 310 bool cannotEnterFullscreenMode(ULONG uWidth, ULONG uHeight, ULONG uBpp, ULONG64 uMinVRAM) const; 311 void cannotEnterSeamlessMode(ULONG uWidth, ULONG uHeight, ULONG uBpp, ULONG64 uMinVRAM) const; 312 bool cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const; 313 void cannotSwitchScreenInSeamless(quint64 uMinVRAM) const; 314 void cannotAttachUSBDevice(const CConsole &console, const QString &strDevice) const; 315 void cannotAttachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const; 316 void cannotDetachUSBDevice(const CConsole &console, const QString &strDevice) const; 317 void cannotDetachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const; 318 void cannotAttachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const; 319 void cannotDetachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const; 320 void cannotToggleVideoCapture(const CMachine &machine, bool fEnable); 321 void cannotToggleVRDEServer(const CVRDEServer &server, const QString &strMachineName, bool fEnable); 322 void cannotToggleNetworkAdapterCable(const CNetworkAdapter &adapter, const QString &strMachineName, bool fConnect); 323 void remindAboutGuestAdditionsAreNotActive() const; 324 void cannotMountGuestAdditions(const QString &strMachineName) const; 325 void cannotAddDiskEncryptionPassword(const CConsole &console); 326 327 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 328 /* API: Network management warnings: */ 329 bool confirmCancelingAllNetworkRequests() const; 330 void showUpdateSuccess(const QString &strVersion, const QString &strLink) const; 331 void showUpdateNotFound() const; 332 void askUserToDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion) const; 333 334 /* API: Downloading warnings: */ 335 bool cannotFindGuestAdditions() const; 336 bool confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const; 337 void cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const; 338 bool proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const; 339 void cannotValidateGuestAdditionsSHA256Sum(const QString &strUrl, const QString &strSrc) const; 340 void cannotUpdateGuestAdditions(const CProgress &progress) const; 341 bool cannotFindUserManual(const QString &strMissedLocation) const; 342 bool confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const; 343 void cannotSaveUserManual(const QString &strURL, const QString &strTarget) const; 344 void warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) const; 345 bool warAboutOutdatedExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const; 346 bool confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const; 347 void cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const; 348 bool proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const; 349 void cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const; 350 bool proposeDeleteExtentionPack(const QString &strTo) const; 351 bool proposeDeleteOldExtentionPacks(const QStringList &strFiles) const; 352 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 353 354 /* API: Extension-pack warnings: */ 355 bool confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion, const QString &strPackDescription, QWidget *pParent = 0) const; 356 bool confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew, const QString &strPackVersionOld, 357 const QString &strPackDescription, QWidget *pParent = 0) const; 358 bool confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent = 0) const; 359 void cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent = 0) const; 360 void warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent = 0) const; 361 void cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent = 0) const; 362 void cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent = 0) const; 363 void cannotUninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent = 0) const; 364 void cannotUninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent = 0) const; 365 void warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent = 0) const; 366 367 #ifdef VBOX_WITH_DRAG_AND_DROP 368 /* API: Drag and drop warnings: */ 369 void cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const; 370 void cannotDropDataToGuest(const CProgress &progress, QWidget *pParent = 0) const; 371 void cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const; 372 void cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent = 0) const; 373 void cannotDropDataToHost(const CProgress &progress, QWidget *pParent = 0) const; 374 #endif /* VBOX_WITH_DRAG_AND_DROP */ 375 376 /* API: License-viewer warnings: */ 377 void cannotOpenLicenseFile(const QString &strPath, QWidget *pParent = 0) const; 378 379 /* API: File-dialog warnings: */ 380 bool confirmOverridingFile(const QString &strPath, QWidget *pParent = 0) const; 381 bool confirmOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent = 0) const; 382 bool confirmOverridingFileIfExists(const QString &strPath, QWidget *pParent = 0) const; 383 bool confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent = 0) const; 384 385 /* API: Static helpers: */ 40 /** Returns formatted @a rc information. */ 386 41 static QString formatRC(HRESULT rc); 42 /** Returns full formatted @a rc information. */ 387 43 static QString formatRCFull(HRESULT rc); 388 static QString formatErrorInfo(const CProgress &progress); 389 static QString formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC = S_OK); 390 static QString formatErrorInfo(const CVirtualBoxErrorInfo &info); 391 static QString formatErrorInfo(const COMBaseWithEI &wrapper); 392 static QString formatErrorInfo(const COMResult &rc); 393 394 public slots: 395 396 /* Handlers: Help menu stuff: */ 397 void sltShowHelpWebDialog(); 398 void sltShowBugTracker(); 399 void sltShowForums(); 400 void sltShowOracle(); 401 void sltShowHelpAboutDialog(); 402 void sltShowHelpHelpDialog(); 403 void sltResetSuppressedMessages(); 404 void sltShowUserManual(const QString &strLocation); 405 406 private slots: 407 408 /* Handler: Interthreading stuff: */ 409 void sltShowMessageBox(QWidget *pParent, MessageType type, 410 const QString &strMessage, const QString &strDetails, 411 int iButton1, int iButton2, int iButton3, 412 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3, 413 const QString &strAutoConfirmId) const; 44 /** Returns formatted error information for passed @a comProgress. */ 45 static QString formatErrorInfo(const CProgress &comProgress); 46 /** Returns formatted error information for passed @a comInfo and @a wrapperRC. */ 47 static QString formatErrorInfo(const COMErrorInfo &comInfo, HRESULT wrapperRC = S_OK); 48 /** Returns formatted error information for passed @a comInfo. */ 49 static QString formatErrorInfo(const CVirtualBoxErrorInfo &comInfo); 50 /** Returns formatted error information for passed @a comWrapper. */ 51 static QString formatErrorInfo(const COMBaseWithEI &comWrapper); 52 /** Returns formatted error information for passed @a comRc. */ 53 static QString formatErrorInfo(const COMResult &comRc); 414 54 415 55 private: 416 56 417 /* Constructor/destructor: */ 418 UIMessageCenter(); 419 ~UIMessageCenter(); 420 421 /* Helpers: Prepare/cleanup stuff: */ 422 void prepare(); 423 void cleanup(); 424 425 /* Helper: */ 426 static QString errorInfoToString(const COMErrorInfo &info, HRESULT wrapperRC = S_OK); 427 428 /* Helper: Message-box stuff: */ 429 int showMessageBox(QWidget *pParent, MessageType type, 430 const QString &strMessage, const QString &strDetails, 431 int iButton1, int iButton2, int iButton3, 432 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3, 433 const QString &strAutoConfirmId) const; 434 435 /* Variables: */ 436 mutable QStringList m_warnings; 437 438 /* API: Instance stuff: */ 439 static UIMessageCenter* m_spInstance; 440 static UIMessageCenter* instance(); 441 friend UIMessageCenter& msgCenter(); 57 /** Converts passed @a comInfo and @a wrapperRC to string. */ 58 static QString errorInfoToString(const COMErrorInfo &comInfo, HRESULT wrapperRC = S_OK); 442 59 }; 443 60 444 /* Shortcut to the static UIMessageCenter::instance() method: */ 445 inline UIMessageCenter& msgCenter() { return *UIMessageCenter::instance(); } 61 #endif /* !___UIErrorString_h___ */ 446 62 447 #endif // __UIMessageCenter_h__448 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r68411 r68435 36 36 # include "UISelectorWindow.h" 37 37 # include "UIProgressDialog.h" 38 # include "UIErrorString.h" 38 39 # ifdef VBOX_GUI_WITH_NETWORK_MANAGER 39 40 # include "UINetworkManager.h" … … 430 431 "<p>The application will now terminate.</p>") 431 432 .arg(strUserHome), 432 formatErrorInfo(COMErrorInfo()));433 UIErrorString::formatErrorInfo(COMErrorInfo())); 433 434 } 434 435 … … 439 440 "Most likely, the VirtualBox server is not running or failed to start.</p>" 440 441 "<p>The application will now terminate.</p>"), 441 formatErrorInfo(COMErrorInfo(), rc));442 UIErrorString::formatErrorInfo(COMErrorInfo(), rc)); 442 443 } 443 444 … … 447 448 tr("<p>Failed to create the VirtualBoxClient COM object.</p>" 448 449 "<p>The application will now terminate.</p>"), 449 formatErrorInfo(client));450 UIErrorString::formatErrorInfo(client)); 450 451 } 451 452 … … 460 461 "<font color=blue>'/tmp'</font> and <font color=blue>'/tmp/.vbox-*-ipc/'</font></p>"); 461 462 #endif 462 error(0, MessageType_Critical, err, formatErrorInfo(client));463 error(0, MessageType_Critical, err, UIErrorString::formatErrorInfo(client)); 463 464 } 464 465 … … 488 489 tr("There is no virtual machine named <b>%1</b>.") 489 490 .arg(strName), 490 formatErrorInfo(vbox));491 UIErrorString::formatErrorInfo(vbox)); 491 492 } 492 493 … … 496 497 tr("There is no virtual machine with the identifier <b>%1</b>.") 497 498 .arg(strId), 498 formatErrorInfo(vbox));499 UIErrorString::formatErrorInfo(vbox)); 499 500 } 500 501 … … 503 504 error(0, MessageType_Error, 504 505 tr("Failed to create a new session."), 505 formatErrorInfo(session));506 UIErrorString::formatErrorInfo(session)); 506 507 } 507 508 … … 511 512 tr("Failed to open a session for the virtual machine <b>%1</b>.") 512 513 .arg(CMachine(machine).GetName()), 513 formatErrorInfo(machine));514 UIErrorString::formatErrorInfo(machine)); 514 515 } 515 516 … … 519 520 tr("Failed to open a session for the virtual machine <b>%1</b>.") 520 521 .arg(strMachineName), 521 formatErrorInfo(progress));522 UIErrorString::formatErrorInfo(progress)); 522 523 } 523 524 … … 527 528 tr("Failed to access the disk image file <nobr><b>%1</b></nobr>.") 528 529 .arg(medium.location()), 529 formatErrorInfo(medium.result()));530 UIErrorString::formatErrorInfo(medium.result())); 530 531 } 531 532 … … 543 544 tr("Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.") 544 545 .arg(strKey, strValue), 545 formatErrorInfo(vbox));546 UIErrorString::formatErrorInfo(vbox)); 546 547 } 547 548 … … 551 552 tr("Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.") 552 553 .arg(strKey, CMachine(machine).GetName(), strValue), 553 formatErrorInfo(machine));554 UIErrorString::formatErrorInfo(machine)); 554 555 } 555 556 … … 566 567 tr("Failed to open virtual machine located in %1.") 567 568 .arg(strMachinePath), 568 formatErrorInfo(vbox));569 UIErrorString::formatErrorInfo(vbox)); 569 570 } 570 571 … … 606 607 tr("Failed to set groups of the virtual machine <b>%1</b>.") 607 608 .arg(strName), 608 formatErrorInfo(machine));609 UIErrorString::formatErrorInfo(machine)); 609 610 } 610 611 … … 707 708 tr("Failed to remove the virtual machine <b>%1</b>.") 708 709 .arg(CMachine(machine).GetName()), 709 formatErrorInfo(machine));710 UIErrorString::formatErrorInfo(machine)); 710 711 } 711 712 … … 715 716 tr("Failed to remove the virtual machine <b>%1</b>.") 716 717 .arg(CMachine(machine).GetName()), 717 formatErrorInfo(progress));718 UIErrorString::formatErrorInfo(progress)); 718 719 } 719 720 … … 780 781 tr("Failed to pause the execution of the virtual machine <b>%1</b>.") 781 782 .arg(CConsole(console).GetMachine().GetName()), 782 formatErrorInfo(console));783 UIErrorString::formatErrorInfo(console)); 783 784 } 784 785 … … 788 789 tr("Failed to resume the execution of the virtual machine <b>%1</b>.") 789 790 .arg(CConsole(console).GetMachine().GetName()), 790 formatErrorInfo(console));791 UIErrorString::formatErrorInfo(console)); 791 792 } 792 793 … … 796 797 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.") 797 798 .arg(machine.GetName()), 798 formatErrorInfo(machine));799 UIErrorString::formatErrorInfo(machine)); 799 800 } 800 801 … … 804 805 tr("Failed to save the state of the virtual machine <b>%1</b>.") 805 806 .arg(machine.GetName()), 806 formatErrorInfo(machine));807 UIErrorString::formatErrorInfo(machine)); 807 808 } 808 809 … … 812 813 tr("Failed to save the state of the virtual machine <b>%1</b>.") 813 814 .arg(strMachineName), 814 formatErrorInfo(progress));815 UIErrorString::formatErrorInfo(progress)); 815 816 } 816 817 … … 820 821 tr("Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.") 821 822 .arg(CConsole(console).GetMachine().GetName()), 822 formatErrorInfo(console));823 UIErrorString::formatErrorInfo(console)); 823 824 } 824 825 … … 828 829 tr("Failed to stop the virtual machine <b>%1</b>.") 829 830 .arg(CConsole(console).GetMachine().GetName()), 830 formatErrorInfo(console));831 UIErrorString::formatErrorInfo(console)); 831 832 } 832 833 … … 836 837 tr("Failed to stop the virtual machine <b>%1</b>.") 837 838 .arg(strMachineName), 838 formatErrorInfo(progress));839 UIErrorString::formatErrorInfo(progress)); 839 840 } 840 841 … … 909 910 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 910 911 .arg(strMachineName), 911 formatErrorInfo(machine));912 UIErrorString::formatErrorInfo(machine)); 912 913 } 913 914 … … 917 918 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 918 919 .arg(strMachineName), 919 formatErrorInfo(progress));920 UIErrorString::formatErrorInfo(progress)); 920 921 } 921 922 … … 925 926 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 926 927 .arg(strSnapshotName, strMachineName), 927 formatErrorInfo(machine));928 UIErrorString::formatErrorInfo(machine)); 928 929 return false; 929 930 } … … 934 935 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 935 936 .arg(strSnapshotName, strMachineName), 936 formatErrorInfo(progress));937 UIErrorString::formatErrorInfo(progress)); 937 938 return false; 938 939 } … … 943 944 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 944 945 .arg(strSnapshotName, strMachineName), 945 formatErrorInfo(machine));946 UIErrorString::formatErrorInfo(machine)); 946 947 } 947 948 … … 951 952 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 952 953 .arg(strSnapshotName).arg(strMachineName), 953 formatErrorInfo(progress));954 UIErrorString::formatErrorInfo(progress)); 954 955 } 955 956 … … 961 962 tr("Can't find snapshot named <b>%1</b>.") 962 963 .arg(strName), 963 formatErrorInfo(comMachine));964 UIErrorString::formatErrorInfo(comMachine)); 964 965 } 965 966 … … 971 972 tr("Can't find snapshot with ID=<b>%1</b>.") 972 973 .arg(strId), 973 formatErrorInfo(comMachine));974 UIErrorString::formatErrorInfo(comMachine)); 974 975 } 975 976 … … 979 980 error(pParent, MessageType_Error, 980 981 tr("Can't acquire snapshot attributes."), 981 formatErrorInfo(comSnapshot));982 UIErrorString::formatErrorInfo(comSnapshot)); 982 983 } 983 984 … … 1009 1010 error(pParent, MessageType_Critical, 1010 1011 tr("Failed to set global VirtualBox properties."), 1011 formatErrorInfo(properties));1012 UIErrorString::formatErrorInfo(properties)); 1012 1013 } 1013 1014 … … 1023 1024 error(pParent, res.isWarning() ? MessageType_Warning : MessageType_Error, 1024 1025 tr("Failed to access the USB subsystem."), 1025 formatErrorInfo(res),1026 UIErrorString::formatErrorInfo(res), 1026 1027 "warnAboutUnaccessibleUSB"); 1027 1028 } … … 1124 1125 } 1125 1126 error(pParent, MessageType_Error, 1126 strMessage, formatErrorInfo(machine));1127 strMessage, UIErrorString::formatErrorInfo(machine)); 1127 1128 } 1128 1129 … … 1183 1184 tr("Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.") 1184 1185 .arg(machine.GetName(), CMachine(machine).GetSettingsFilePath()), 1185 formatErrorInfo(machine));1186 UIErrorString::formatErrorInfo(machine)); 1186 1187 } 1187 1188 … … 1191 1192 tr("<p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p>") 1192 1193 .arg(gpConverter->toString(oldMediumType)).arg(gpConverter->toString(newMediumType)), 1193 formatErrorInfo(medium));1194 UIErrorString::formatErrorInfo(medium)); 1194 1195 } 1195 1196 … … 1199 1200 tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.") 1200 1201 .arg(strLocationOld, strLocationNew), 1201 formatErrorInfo(comMedium));1202 UIErrorString::formatErrorInfo(comMedium)); 1202 1203 } 1203 1204 … … 1207 1208 tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.") 1208 1209 .arg(strLocationOld, strLocationNew), 1209 formatErrorInfo(comProgress));1210 UIErrorString::formatErrorInfo(comProgress)); 1210 1211 } 1211 1212 … … 1215 1216 tr("<p>Error changing the description of the disk image <b>%1</b>.</p>") 1216 1217 .arg(strLocation), 1217 formatErrorInfo(comMedium));1218 UIErrorString::formatErrorInfo(comMedium)); 1218 1219 } 1219 1220 … … 1315 1316 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1316 1317 .arg(strLocation), 1317 formatErrorInfo(medium));1318 UIErrorString::formatErrorInfo(medium)); 1318 1319 } 1319 1320 … … 1323 1324 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1324 1325 .arg(strLocation), 1325 formatErrorInfo(progress));1326 UIErrorString::formatErrorInfo(progress)); 1326 1327 } 1327 1328 … … 1331 1332 tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.") 1332 1333 .arg(strLocation, strSizeOld, strSizeNew), 1333 formatErrorInfo(comMedium));1334 UIErrorString::formatErrorInfo(comMedium)); 1334 1335 } 1335 1336 … … 1339 1340 tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.") 1340 1341 .arg(strLocation, strSizeOld, strSizeNew), 1341 formatErrorInfo(comProgress));1342 UIErrorString::formatErrorInfo(comProgress)); 1342 1343 } 1343 1344 … … 1370 1371 } 1371 1372 /* Show the error: */ 1372 error(pParent, MessageType_Error, strMessage, formatErrorInfo(machine));1373 error(pParent, MessageType_Error, strMessage, UIErrorString::formatErrorInfo(machine)); 1373 1374 } 1374 1375 … … 1418 1419 return errorWithQuestion(pParent, MessageType_Question, 1419 1420 strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()), 1420 formatErrorInfo(machine),1421 UIErrorString::formatErrorInfo(machine), 1421 1422 0 /* Auto Confirm ID */, 1422 1423 tr("Force Unmount")); 1423 1424 error(pParent, MessageType_Error, 1424 1425 strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()), 1425 formatErrorInfo(machine));1426 UIErrorString::formatErrorInfo(machine)); 1426 1427 return false; 1427 1428 } … … 1431 1432 /* Show the error: */ 1432 1433 error(pParent, MessageType_Error, 1433 tr("Failed to open the disk image file <nobr><b>%1</b></nobr>.").arg(strLocation), formatErrorInfo(vbox));1434 tr("Failed to open the disk image file <nobr><b>%1</b></nobr>.").arg(strLocation), UIErrorString::formatErrorInfo(vbox)); 1434 1435 } 1435 1436 … … 1438 1439 /* Show the error: */ 1439 1440 error(pParent, MessageType_Error, 1440 tr("Failed to close the disk image file <nobr><b>%1</b></nobr>.").arg(medium.location()), formatErrorInfo(rc));1441 tr("Failed to close the disk image file <nobr><b>%1</b></nobr>.").arg(medium.location()), UIErrorString::formatErrorInfo(rc)); 1441 1442 } 1442 1443 … … 1463 1464 error(pParent, MessageType_Error, 1464 1465 tr("Failed to acquire host network interfaces."), 1465 formatErrorInfo(comHost));1466 UIErrorString::formatErrorInfo(comHost)); 1466 1467 } 1467 1468 … … 1471 1472 tr("Unable to find the host network interface <b>%1</b>.") 1472 1473 .arg(strInterfaceName), 1473 formatErrorInfo(comHost));1474 UIErrorString::formatErrorInfo(comHost)); 1474 1475 } 1475 1476 … … 1478 1479 error(pParent, MessageType_Error, 1479 1480 tr("Failed to create a host network interface."), 1480 formatErrorInfo(comHost));1481 UIErrorString::formatErrorInfo(comHost)); 1481 1482 } 1482 1483 … … 1485 1486 error(pParent, MessageType_Error, 1486 1487 tr("Failed to create a host network interface."), 1487 formatErrorInfo(progress));1488 UIErrorString::formatErrorInfo(progress)); 1488 1489 } 1489 1490 … … 1493 1494 tr("Failed to remove the host network interface <b>%1</b>.") 1494 1495 .arg(strInterfaceName), 1495 formatErrorInfo(comHost));1496 UIErrorString::formatErrorInfo(comHost)); 1496 1497 } 1497 1498 … … 1501 1502 tr("Failed to remove the host network interface <b>%1</b>.") 1502 1503 .arg(strInterfaceName), 1503 formatErrorInfo(progress));1504 UIErrorString::formatErrorInfo(progress)); 1504 1505 } 1505 1506 … … 1508 1509 error(pParent, MessageType_Error, 1509 1510 tr("Failed to acquire host network interface parameter."), 1510 formatErrorInfo(comInterface));1511 UIErrorString::formatErrorInfo(comInterface)); 1511 1512 } 1512 1513 … … 1515 1516 error(pParent, MessageType_Error, 1516 1517 tr("Failed to save host network interface parameter."), 1517 formatErrorInfo(comInterface));1518 UIErrorString::formatErrorInfo(comInterface)); 1518 1519 } 1519 1520 … … 1523 1524 tr("Failed to create a DHCP server for the network interface <b>%1</b>.") 1524 1525 .arg(strInterfaceName), 1525 formatErrorInfo(comVBox));1526 UIErrorString::formatErrorInfo(comVBox)); 1526 1527 } 1527 1528 … … 1531 1532 tr("Failed to remove the DHCP server for the network interface <b>%1</b>.") 1532 1533 .arg(strInterfaceName), 1533 formatErrorInfo(comVBox));1534 UIErrorString::formatErrorInfo(comVBox)); 1534 1535 } 1535 1536 … … 1538 1539 error(pParent, MessageType_Error, 1539 1540 tr("Failed to acquire DHCP server parameter."), 1540 formatErrorInfo(comServer));1541 UIErrorString::formatErrorInfo(comServer)); 1541 1542 } 1542 1543 … … 1545 1546 error(pParent, MessageType_Error, 1546 1547 tr("Failed to save DHCP server parameter."), 1547 formatErrorInfo(comServer));1548 UIErrorString::formatErrorInfo(comServer)); 1548 1549 } 1549 1550 … … 1564 1565 error(pParent, MessageType_Error, 1565 1566 tr("Failed to create a new virtual machine."), 1566 formatErrorInfo(vbox));1567 UIErrorString::formatErrorInfo(vbox)); 1567 1568 } 1568 1569 … … 1572 1573 tr("Failed to register the virtual machine <b>%1</b>.") 1573 1574 .arg(strMachineName), 1574 formatErrorInfo(vbox));1575 UIErrorString::formatErrorInfo(vbox)); 1575 1576 } 1576 1577 … … 1580 1581 tr("Failed to clone the virtual machine <b>%1</b>.") 1581 1582 .arg(CMachine(machine).GetName()), 1582 formatErrorInfo(machine));1583 UIErrorString::formatErrorInfo(machine)); 1583 1584 } 1584 1585 … … 1588 1589 tr("Failed to clone the virtual machine <b>%1</b>.") 1589 1590 .arg(strMachineName), 1590 formatErrorInfo(progress));1591 UIErrorString::formatErrorInfo(progress)); 1591 1592 } 1592 1593 … … 1606 1607 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1607 1608 .arg(strLocation), 1608 formatErrorInfo(vbox));1609 UIErrorString::formatErrorInfo(vbox)); 1609 1610 } 1610 1611 … … 1614 1615 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1615 1616 .arg(strLocation), 1616 formatErrorInfo(medium));1617 UIErrorString::formatErrorInfo(medium)); 1617 1618 } 1618 1619 … … 1622 1623 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1623 1624 .arg(strLocation), 1624 formatErrorInfo(progress));1625 UIErrorString::formatErrorInfo(progress)); 1625 1626 } 1626 1627 … … 1654 1655 { 1655 1656 /* Preserve error-info: */ 1656 QString strErrorInfo = formatErrorInfo(appliance);1657 QString strErrorInfo = UIErrorString::formatErrorInfo(appliance); 1657 1658 /* Add the warnings in the case of an early error: */ 1658 1659 QString strWarningInfo; … … 1673 1674 tr("Failed to import appliance <b>%1</b>.") 1674 1675 .arg(strPath), 1675 formatErrorInfo(progress));1676 UIErrorString::formatErrorInfo(progress)); 1676 1677 } 1677 1678 … … 1680 1681 error(pParent, MessageType_Error, 1681 1682 tr("Failed to check files."), 1682 formatErrorInfo(progress));1683 UIErrorString::formatErrorInfo(progress)); 1683 1684 } 1684 1685 … … 1687 1688 error(pParent, MessageType_Error, 1688 1689 tr("Failed to remove file."), 1689 formatErrorInfo(progress));1690 UIErrorString::formatErrorInfo(progress)); 1690 1691 } 1691 1692 … … 1709 1710 tr("Failed to prepare the export of the appliance <b>%1</b>.") 1710 1711 .arg(CAppliance(appliance).GetPath()), 1711 formatErrorInfo(appliance));1712 UIErrorString::formatErrorInfo(appliance)); 1712 1713 } 1713 1714 … … 1717 1718 tr("Failed to prepare the export of the appliance <b>%1</b>.") 1718 1719 .arg(strPath), 1719 formatErrorInfo(machine));1720 UIErrorString::formatErrorInfo(machine)); 1720 1721 } 1721 1722 … … 1725 1726 tr("Failed to export appliance <b>%1</b>.") 1726 1727 .arg(strPath), 1727 formatErrorInfo(progress));1728 UIErrorString::formatErrorInfo(progress)); 1728 1729 } 1729 1730 … … 1732 1733 error(pParent, MessageType_Error, 1733 1734 tr("Bad password or authentication failure."), 1734 formatErrorInfo(appliance));1735 UIErrorString::formatErrorInfo(appliance)); 1735 1736 } 1736 1737 … … 1924 1925 tr("Failed to start the virtual machine <b>%1</b>.") 1925 1926 .arg(strName), 1926 formatErrorInfo(console));1927 UIErrorString::formatErrorInfo(console)); 1927 1928 } 1928 1929 … … 1932 1933 tr("Failed to start the virtual machine <b>%1</b>.") 1933 1934 .arg(strName), 1934 formatErrorInfo(progress));1935 UIErrorString::formatErrorInfo(progress)); 1935 1936 } 1936 1937 … … 2046 2047 tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.") 2047 2048 .arg(strDevice, CConsole(console).GetMachine().GetName()), 2048 formatErrorInfo(console));2049 UIErrorString::formatErrorInfo(console)); 2049 2050 } 2050 2051 … … 2054 2055 tr("Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.") 2055 2056 .arg(strDevice, strMachineName), 2056 formatErrorInfo(errorInfo));2057 UIErrorString::formatErrorInfo(errorInfo)); 2057 2058 } 2058 2059 … … 2062 2063 tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.") 2063 2064 .arg(strDevice, CConsole(console).GetMachine().GetName()), 2064 formatErrorInfo(console));2065 UIErrorString::formatErrorInfo(console)); 2065 2066 } 2066 2067 … … 2070 2071 tr("Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.") 2071 2072 .arg(strDevice, strMachineName), 2072 formatErrorInfo(errorInfo));2073 UIErrorString::formatErrorInfo(errorInfo)); 2073 2074 } 2074 2075 … … 2078 2079 tr("Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.") 2079 2080 .arg(strWebCamName, strMachineName), 2080 formatErrorInfo(dispatcher));2081 UIErrorString::formatErrorInfo(dispatcher)); 2081 2082 } 2082 2083 … … 2086 2087 tr("Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.") 2087 2088 .arg(strWebCamName, strMachineName), 2088 formatErrorInfo(dispatcher));2089 UIErrorString::formatErrorInfo(dispatcher)); 2089 2090 } 2090 2091 … … 2097 2098 tr("Failed to enable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName) : 2098 2099 tr("Failed to disable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName), 2099 formatErrorInfo(machine));2100 UIErrorString::formatErrorInfo(machine)); 2100 2101 } 2101 2102 … … 2106 2107 tr("Failed to enable the remote desktop server for the virtual machine <b>%1</b>.").arg(strMachineName) : 2107 2108 tr("Failed to disable the remote desktop server for the virtual machine <b>%1</b>.").arg(strMachineName), 2108 formatErrorInfo(server));2109 UIErrorString::formatErrorInfo(server)); 2109 2110 } 2110 2111 … … 2115 2116 tr("Failed to connect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName) : 2116 2117 tr("Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName), 2117 formatErrorInfo(adapter));2118 UIErrorString::formatErrorInfo(adapter)); 2118 2119 } 2119 2120 … … 2142 2143 error(0, MessageType_Error, 2143 2144 tr("Bad password or authentication failure."), 2144 formatErrorInfo(console));2145 UIErrorString::formatErrorInfo(console)); 2145 2146 } 2146 2147 … … 2233 2234 tr("Failed to update Guest Additions. " 2234 2235 "The Guest Additions disk image file will be inserted for user installation."), 2235 formatErrorInfo(progress));2236 UIErrorString::formatErrorInfo(progress)); 2236 2237 } 2237 2238 … … 2439 2440 error(pParent, MessageType_Error, 2440 2441 tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename), 2441 formatErrorInfo(extPackManager));2442 UIErrorString::formatErrorInfo(extPackManager)); 2442 2443 } 2443 2444 … … 2454 2455 tr("Failed to install the Extension Pack <b>%1</b>.") 2455 2456 .arg(strFilename), 2456 formatErrorInfo(extPackFile));2457 UIErrorString::formatErrorInfo(extPackFile)); 2457 2458 } 2458 2459 … … 2462 2463 tr("Failed to install the Extension Pack <b>%1</b>.") 2463 2464 .arg(strFilename), 2464 formatErrorInfo(progress));2465 UIErrorString::formatErrorInfo(progress)); 2465 2466 } 2466 2467 … … 2470 2471 tr("Failed to uninstall the Extension Pack <b>%1</b>.") 2471 2472 .arg(strPackName), 2472 formatErrorInfo(extPackManager));2473 UIErrorString::formatErrorInfo(extPackManager)); 2473 2474 } 2474 2475 … … 2478 2479 tr("Failed to uninstall the Extension Pack <b>%1</b>.") 2479 2480 .arg(strPackName), 2480 formatErrorInfo(progress));2481 UIErrorString::formatErrorInfo(progress)); 2481 2482 } 2482 2483 … … 2493 2494 error(pParent, MessageType_Error, 2494 2495 tr("Drag and drop operation from host to guest failed."), 2495 formatErrorInfo(dndTarget));2496 UIErrorString::formatErrorInfo(dndTarget)); 2496 2497 } 2497 2498 … … 2500 2501 error(pParent, MessageType_Error, 2501 2502 tr("Drag and drop operation from host to guest failed."), 2502 formatErrorInfo(progress));2503 UIErrorString::formatErrorInfo(progress)); 2503 2504 } 2504 2505 … … 2507 2508 error(pParent, MessageType_Error, 2508 2509 tr("Unable to cancel host to guest drag and drop operation."), 2509 formatErrorInfo(dndTarget));2510 UIErrorString::formatErrorInfo(dndTarget)); 2510 2511 } 2511 2512 … … 2514 2515 error(pParent, MessageType_Error, 2515 2516 tr("Drag and drop operation from guest to host failed."), 2516 formatErrorInfo(dndSource));2517 UIErrorString::formatErrorInfo(dndSource)); 2517 2518 } 2518 2519 … … 2521 2522 error(pParent, MessageType_Error, 2522 2523 tr("Drag and drop operation from guest to host failed."), 2523 formatErrorInfo(progress));2524 UIErrorString::formatErrorInfo(progress)); 2524 2525 } 2525 2526 #endif /* VBOX_WITH_DRAG_AND_DROP */ … … 2589 2590 else 2590 2591 return true; 2591 }2592 2593 /* static */2594 QString UIMessageCenter::formatRC(HRESULT rc)2595 {2596 QString str;2597 2598 PCRTCOMERRMSG msg = NULL;2599 const char *errMsg = NULL;2600 2601 /* First, try as is (only set bit 31 bit for warnings): */2602 if (SUCCEEDED_WARNING(rc))2603 msg = RTErrCOMGet(rc | 0x80000000);2604 else2605 msg = RTErrCOMGet(rc);2606 2607 if (msg != NULL)2608 errMsg = msg->pszDefine;2609 2610 #ifdef VBOX_WS_WIN2611 PCRTWINERRMSG winMsg = NULL;2612 2613 /* If not found, try again using RTErrWinGet with masked off top 16bit: */2614 if (msg == NULL)2615 {2616 winMsg = RTErrWinGet(rc & 0xFFFF);2617 2618 if (winMsg != NULL)2619 errMsg = winMsg->pszDefine;2620 }2621 #endif /* VBOX_WS_WIN */2622 2623 if (errMsg != NULL && *errMsg != '\0')2624 str.sprintf("%s", errMsg);2625 2626 return str;2627 }2628 2629 /* static */2630 QString UIMessageCenter::formatRCFull(HRESULT rc)2631 {2632 QString str;2633 2634 PCRTCOMERRMSG msg = NULL;2635 const char *errMsg = NULL;2636 2637 /* First, try as is (only set bit 31 bit for warnings): */2638 if (SUCCEEDED_WARNING(rc))2639 msg = RTErrCOMGet(rc | 0x80000000);2640 else2641 msg = RTErrCOMGet(rc);2642 2643 if (msg != NULL)2644 errMsg = msg->pszDefine;2645 2646 #ifdef VBOX_WS_WIN2647 PCRTWINERRMSG winMsg = NULL;2648 2649 /* If not found, try again using RTErrWinGet with masked off top 16bit: */2650 if (msg == NULL)2651 {2652 winMsg = RTErrWinGet(rc & 0xFFFF);2653 2654 if (winMsg != NULL)2655 errMsg = winMsg->pszDefine;2656 }2657 #endif /* VBOX_WS_WIN */2658 2659 if (errMsg != NULL && *errMsg != '\0')2660 str.sprintf("%s (0x%08X)", errMsg, rc);2661 else2662 str.sprintf("0x%08X", rc);2663 2664 return str;2665 }2666 2667 /* static */2668 QString UIMessageCenter::formatErrorInfo(const CProgress &progress)2669 {2670 /* Check for API errors first: */2671 if (!progress.isOk())2672 return formatErrorInfo(static_cast<COMBaseWithEI>(progress));2673 2674 /* For progress errors otherwise: */2675 CVirtualBoxErrorInfo errorInfo = progress.GetErrorInfo();2676 /* Handle valid error-info first: */2677 if (!errorInfo.isNull())2678 return formatErrorInfo(errorInfo);2679 /* Handle NULL error-info otherwise: */2680 return QString("<table bgcolor=#EEEEEE border=0 cellspacing=5 cellpadding=0 width=100%>"2681 "<tr><td>%1</td><td><tt>%2</tt></td></tr></table>")2682 .arg(tr("Result Code: ", "error info"))2683 .arg(formatRCFull(progress.GetResultCode()))2684 .prepend("<!--EOM-->") /* move to details */;2685 }2686 2687 /* static */2688 QString UIMessageCenter::formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC /* = S_OK */)2689 {2690 QString formatted = errorInfoToString(info, wrapperRC);2691 return QString("<qt>%1</qt>").arg(formatted);2692 }2693 2694 /* static */2695 QString UIMessageCenter::formatErrorInfo(const CVirtualBoxErrorInfo &info)2696 {2697 return formatErrorInfo(COMErrorInfo(info));2698 }2699 2700 /* static */2701 QString UIMessageCenter::formatErrorInfo(const COMBaseWithEI &wrapper)2702 {2703 Assert(wrapper.lastRC() != S_OK);2704 return formatErrorInfo(wrapper.errorInfo(), wrapper.lastRC());2705 }2706 2707 /* static */2708 QString UIMessageCenter::formatErrorInfo(const COMResult &rc)2709 {2710 Assert(rc.rc() != S_OK);2711 return formatErrorInfo(rc.errorInfo(), rc.rc());2712 2592 } 2713 2593 … … 2877 2757 { 2878 2758 /* Nothing for now... */ 2879 }2880 2881 QString UIMessageCenter::errorInfoToString(const COMErrorInfo &info,2882 HRESULT wrapperRC /* = S_OK */)2883 {2884 /* Compose complex details string with internal <!--EOM--> delimiter to2885 * make it possible to split string into info & details parts which will2886 * be used separately in QIMessageBox */2887 QString formatted;2888 2889 /* Check if details text is NOT empty: */2890 QString strDetailsInfo = info.text();2891 if (!strDetailsInfo.isEmpty())2892 {2893 /* Check if details text written in English (latin1) and translated: */2894 if (strDetailsInfo == QString::fromLatin1(strDetailsInfo.toLatin1()) &&2895 strDetailsInfo != tr(strDetailsInfo.toLatin1().constData()))2896 formatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(tr(strDetailsInfo.toLatin1().constData())));2897 else2898 formatted += QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strDetailsInfo));2899 }2900 2901 formatted += "<!--EOM--><table bgcolor=#EEEEEE border=0 cellspacing=5 "2902 "cellpadding=0 width=100%>";2903 2904 bool haveResultCode = false;2905 2906 if (info.isBasicAvailable())2907 {2908 #if defined (VBOX_WS_WIN)2909 haveResultCode = info.isFullAvailable();2910 bool haveComponent = true;2911 bool haveInterfaceID = true;2912 #else /* defined (VBOX_WS_WIN) */2913 haveResultCode = true;2914 bool haveComponent = info.isFullAvailable();2915 bool haveInterfaceID = info.isFullAvailable();2916 #endif2917 2918 if (haveResultCode)2919 {2920 formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")2921 .arg(tr("Result Code: ", "error info"))2922 .arg(formatRCFull(info.resultCode()));2923 }2924 2925 if (haveComponent)2926 formatted += QString("<tr><td>%1</td><td>%2</td></tr>")2927 .arg(tr("Component: ", "error info"), info.component());2928 2929 if (haveInterfaceID)2930 {2931 QString s = info.interfaceID().toString();2932 if (!info.interfaceName().isEmpty())2933 s = info.interfaceName() + ' ' + s;2934 formatted += QString("<tr><td>%1</td><td>%2</td></tr>")2935 .arg(tr("Interface: ", "error info"), s);2936 }2937 2938 if (!info.calleeIID().isNull() && info.calleeIID() != info.interfaceID())2939 {2940 QString s = info.calleeIID().toString();2941 if (!info.calleeName().isEmpty())2942 s = info.calleeName() + ' ' + s;2943 formatted += QString("<tr><td>%1</td><td>%2</td></tr>")2944 .arg(tr("Callee: ", "error info"), s);2945 }2946 }2947 2948 if (FAILED (wrapperRC) &&2949 (!haveResultCode || wrapperRC != info.resultCode()))2950 {2951 formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")2952 .arg(tr("Callee RC: ", "error info"))2953 .arg(formatRCFull(wrapperRC));2954 }2955 2956 formatted += "</table>";2957 2958 if (info.next())2959 formatted = formatted + "<!--EOP-->" + errorInfoToString(*info.next());2960 2961 return formatted;2962 2759 } 2963 2760 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r68411 r68435 383 383 bool confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent = 0) const; 384 384 385 /* API: Static helpers: */386 static QString formatRC(HRESULT rc);387 static QString formatRCFull(HRESULT rc);388 static QString formatErrorInfo(const CProgress &progress);389 static QString formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC = S_OK);390 static QString formatErrorInfo(const CVirtualBoxErrorInfo &info);391 static QString formatErrorInfo(const COMBaseWithEI &wrapper);392 static QString formatErrorInfo(const COMResult &rc);393 394 385 public slots: 395 386 … … 423 414 void cleanup(); 424 415 425 /* Helper: */426 static QString errorInfoToString(const COMErrorInfo &info, HRESULT wrapperRC = S_OK);427 428 416 /* Helper: Message-box stuff: */ 429 417 int showMessageBox(QWidget *pParent, MessageType type, -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
r68045 r68435 25 25 # include "VBoxGlobal.h" 26 26 # include "UIConverter.h" 27 # include "UI MessageCenter.h"27 # include "UIErrorString.h" 28 28 # include "UIExtraDataManager.h" 29 29 # include "UIIconPool.h" … … 411 411 /* Accessibility check (eg GetState()) itself failed: */ 412 412 m_strToolTip += m_sstrRow.arg("<hr>") + m_sstrRow.arg(VBoxGlobal::tr("Failed to check accessibility of disk image files.", "medium")) + 413 m_sstrRow.arg(UI MessageCenter::formatErrorInfo(m_result) + ".");413 m_sstrRow.arg(UIErrorString::formatErrorInfo(m_result) + "."); 414 414 } 415 415 break; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r68396 r68435 33 33 # include "UIActionPoolSelector.h" 34 34 # include "UIDesktopServices.h" 35 # include "UIErrorString.h" 35 36 # include "UIExtraDataManager.h" 36 37 # include "UIGChooser.h" … … 299 300 { 300 301 /* The VM is inaccessible: */ 301 m_pPaneToolsMachine->setDetailsError(UI MessageCenter::formatErrorInfo(pItem->accessError()));302 m_pPaneToolsMachine->setDetailsError(UIErrorString::formatErrorInfo(pItem->accessError())); 302 303 } 303 304 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
r68394 r68435 34 34 # include "UIConverter.h" 35 35 # include "UIGraphicsTextPane.h" 36 # include "UI MessageCenter.h"36 # include "UIErrorString.h" 37 37 38 38 /* COM includes: */ … … 514 514 AssertMsg(controller.isOk(), 515 515 ("Unable to acquire controller data: %s\n", 516 msgCenter().formatRC(controller.lastRC()).toUtf8().constData()));516 UIErrorString::formatRC(controller.lastRC()).toUtf8().constData())); 517 517 if (!controller.isOk()) 518 518 continue; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
r66626 r68435 26 26 # include "UIGlobalSettingsGeneral.h" 27 27 # include "UIExtraDataManager.h" 28 # include "UI MessageCenter.h"28 # include "UIErrorString.h" 29 29 # include "VBoxGlobal.h" 30 30 … … 211 211 /* Show error message if necessary: */ 212 212 if (!fSuccess) 213 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_properties));213 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_properties)); 214 214 215 215 /* Save new general data from the cache: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r66761 r68435 27 27 # include "UIIconPool.h" 28 28 # include "UIConverter.h" 29 # include "UIErrorString.h" 29 30 # include "UIMessageCenter.h" 30 31 # include "UIGlobalSettingsNetwork.h" … … 709 710 /* Show error message if necessary: */ 710 711 if (!fSuccess) 711 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comVBox));712 notifyOperationProgressError(UIErrorString::formatErrorInfo(comVBox)); 712 713 } 713 714 /* Return result: */ … … 735 736 /* Show error message if necessary: */ 736 737 if (!fSuccess) 737 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comVBox));738 notifyOperationProgressError(UIErrorString::formatErrorInfo(comVBox)); 738 739 else 739 740 { … … 811 812 /* Show error message if necessary: */ 812 813 if (!fSuccess) 813 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comNetwork));814 notifyOperationProgressError(UIErrorString::formatErrorInfo(comNetwork)); 814 815 } 815 816 } … … 838 839 /* Show error message if necessary: */ 839 840 if (!fSuccess) 840 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comVBox));841 notifyOperationProgressError(UIErrorString::formatErrorInfo(comVBox)); 841 842 else 842 843 { … … 940 941 /* Show error message if necessary: */ 941 942 if (!fSuccess) 942 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comNetwork));943 notifyOperationProgressError(UIErrorString::formatErrorInfo(comNetwork)); 943 944 } 944 945 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r66626 r68435 23 23 # include "UIConverter.h" 24 24 # include "UIMachineSettingsAudio.h" 25 # include "UI MessageCenter.h"25 # include "UIErrorString.h" 26 26 27 27 /* COM includes: */ … … 273 273 /* Show error message if necessary: */ 274 274 if (!fSuccess) 275 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));275 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 276 276 else 277 277 { … … 297 297 /* Show error message if necessary: */ 298 298 if (!fSuccess) 299 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comAdapter));299 notifyOperationProgressError(UIErrorString::formatErrorInfo(comAdapter)); 300 300 } 301 301 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r66626 r68435 26 26 # include "UIExtraDataManager.h" 27 27 # include "UIMachineSettingsDisplay.h" 28 # include "UI MessageCenter.h"28 # include "UIErrorString.h" 29 29 # include "VBoxGlobal.h" 30 30 … … 1275 1275 /* Show error message if necessary: */ 1276 1276 if (!fSuccess) 1277 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1277 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1278 1278 1279 1279 /* Save guest-screen scale-factor: */ … … 1308 1308 /* Show error message if necessary: */ 1309 1309 if (!fSuccess) 1310 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1310 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1311 1311 else 1312 1312 { … … 1346 1346 /* Show error message if necessary: */ 1347 1347 if (!fSuccess) 1348 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comServer));1348 notifyOperationProgressError(UIErrorString::formatErrorInfo(comServer)); 1349 1349 } 1350 1350 } … … 1485 1485 /* Show error message if necessary: */ 1486 1486 if (!fSuccess) 1487 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1487 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1488 1488 } 1489 1489 /* Return result: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r66626 r68435 28 28 # include "UIConverter.h" 29 29 # include "UIMachineSettingsGeneral.h" 30 # include "UI MessageCenter.h"30 # include "UIErrorString.h" 31 31 # include "UIModalWindowManager.h" 32 32 # include "UIProgressDialog.h" … … 37 37 # include "CMedium.h" 38 38 # include "CMediumAttachment.h" 39 # include "CProgress.h" 39 40 40 41 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 717 718 /* Show error message if necessary: */ 718 719 if (!fSuccess) 719 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));720 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 720 721 } 721 722 /* Return result: */ … … 764 765 /* Show error message if necessary: */ 765 766 if (!fSuccess) 766 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));767 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 767 768 } 768 769 /* Return result: */ … … 791 792 /* Show error message if necessary: */ 792 793 if (!fSuccess) 793 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));794 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 794 795 } 795 796 /* Return result: */ … … 834 835 /* Show error message if necessary: */ 835 836 if (!fSuccess) 836 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));837 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 837 838 838 839 /* For each attachment: */ … … 859 860 /* Show error message if necessary: */ 860 861 if (!fSuccess) 861 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comAttachment));862 notifyOperationProgressError(UIErrorString::formatErrorInfo(comAttachment)); 862 863 else 863 864 { … … 937 938 /* Show error message if necessary: */ 938 939 if (!fSuccess) 939 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comMedium));940 notifyOperationProgressError(UIErrorString::formatErrorInfo(comMedium)); 940 941 } 941 942 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r66626 r68435 27 27 # include "UIIconPool.h" 28 28 # include "UIMachineSettingsNetwork.h" 29 # include "UI MessageCenter.h"29 # include "UIErrorString.h" 30 30 # include "VBoxGlobal.h" 31 31 … … 1499 1499 /* Show error message if necessary: */ 1500 1500 if (!fSuccess) 1501 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1501 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1502 1502 else 1503 1503 { … … 1601 1601 /* Show error message if necessary: */ 1602 1602 if (!fSuccess) 1603 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comAdapter));1603 notifyOperationProgressError(UIErrorString::formatErrorInfo(comAdapter)); 1604 1604 else 1605 1605 { … … 1638 1638 /* Show error message if necessary: */ 1639 1639 if (!fSuccess) 1640 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comEngine));1640 notifyOperationProgressError(UIErrorString::formatErrorInfo(comEngine)); 1641 1641 } 1642 1642 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r66626 r68435 28 28 # include "UIMachineSettingsSF.h" 29 29 # include "UIMachineSettingsSFDetails.h" 30 # include "UI MessageCenter.h"30 # include "UIErrorString.h" 31 31 # include "VBoxGlobal.h" 32 32 # include "VBoxUtils.h" … … 869 869 /* Show error message if necessary: */ 870 870 if (!fSuccess) 871 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));871 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 872 872 873 873 break; … … 883 883 /* Show error message if necessary: */ 884 884 if (!fSuccess) 885 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_console));885 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_console)); 886 886 887 887 break; … … 915 915 /* Show error message if necessary: */ 916 916 if (!fSuccess) 917 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comCurrentFolder));917 notifyOperationProgressError(UIErrorString::formatErrorInfo(comCurrentFolder)); 918 918 919 919 /* If that's the folder we are looking for => take it: */ … … 988 988 { 989 989 /* Show error message: */ 990 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));990 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 991 991 } 992 992 break; … … 1001 1001 { 1002 1002 /* Show error message: */ 1003 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_console));1003 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_console)); 1004 1004 } 1005 1005 break; … … 1054 1054 { 1055 1055 /* Show error message: */ 1056 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1056 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1057 1057 } 1058 1058 break; … … 1067 1067 { 1068 1068 /* Show error message: */ 1069 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_console));1069 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_console)); 1070 1070 } 1071 1071 break; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r68394 r68435 28 28 # include "UIConverter.h" 29 29 # include "UIMachineSettingsSerial.h" 30 # include "UI MessageCenter.h"30 # include "UIErrorString.h" 31 31 # include "VBoxGlobal.h" 32 32 … … 630 630 /* Show error message if necessary: */ 631 631 if (!fSuccess) 632 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));632 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 633 633 else 634 634 { … … 688 688 /* Show error message if necessary: */ 689 689 if (!fSuccess) 690 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comPort));690 notifyOperationProgressError(UIErrorString::formatErrorInfo(comPort)); 691 691 } 692 692 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r68339 r68435 34 34 # include "VBoxGlobal.h" 35 35 # include "QIFileDialog.h" 36 # include "UIErrorString.h" 36 37 # include "UIMessageCenter.h" 37 38 # include "UIMachineSettingsStorage.h" … … 4044 4045 /* Show error message if necessary: */ 4045 4046 if (!fSuccess) 4046 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));4047 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 4047 4048 } 4048 4049 /* Return result: */ … … 4076 4077 /* Show error message if necessary: */ 4077 4078 if (!fSuccess) 4078 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));4079 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 4079 4080 else 4080 4081 { … … 4117 4118 /* Show error message if necessary: */ 4118 4119 if (!fSuccess) 4119 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comController));4120 notifyOperationProgressError(UIErrorString::formatErrorInfo(comController)); 4120 4121 4121 4122 /* For each attachment: */ … … 4154 4155 /* Show error message if necessary: */ 4155 4156 if (!fSuccess) 4156 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));4157 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 4157 4158 else 4158 4159 { … … 4196 4197 /* Show error message if necessary: */ 4197 4198 if (!fSuccess) 4198 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comController));4199 notifyOperationProgressError(UIErrorString::formatErrorInfo(comController)); 4199 4200 4200 4201 // We need to separately remove attachments first because … … 4269 4270 /* Show error message if necessary: */ 4270 4271 if (!fSuccess) 4271 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));4272 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 4272 4273 } 4273 4274 /* Return result: */ … … 4359 4360 /* Show error message if necessary: */ 4360 4361 if (!fSuccess) 4361 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));4362 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 4362 4363 } 4363 4364 /* Return result: */ … … 4447 4448 /* Show error message if necessary: */ 4448 4449 if (!fSuccess) 4449 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));4450 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 4450 4451 } 4451 4452 /* Return result: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r66626 r68435 28 28 # include "UIIconPool.h" 29 29 # include "UIMachineSettingsSystem.h" 30 # include "UI MessageCenter.h"30 # include "UIErrorString.h" 31 31 # include "VBoxGlobal.h" 32 32 … … 1139 1139 /* Show error message if necessary: */ 1140 1140 if (!fSuccess) 1141 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1141 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1142 1142 } 1143 1143 /* Return result: */ … … 1178 1178 /* Show error message if necessary: */ 1179 1179 if (!fSuccess) 1180 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1180 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1181 1181 } 1182 1182 /* Return result: */ … … 1217 1217 /* Show error message if necessary: */ 1218 1218 if (!fSuccess) 1219 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1219 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1220 1220 } 1221 1221 /* Return result: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r66626 r68435 31 31 # include "UIMachineSettingsUSB.h" 32 32 # include "UIMachineSettingsUSBFilterDetails.h" 33 # include "UI MessageCenter.h"33 # include "UIErrorString.h" 34 34 # include "UIToolBar.h" 35 35 # include "VBoxGlobal.h" … … 1015 1015 /* Show error message if necessary: */ 1016 1016 if (!fSuccess) 1017 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1017 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1018 1018 else 1019 1019 { … … 1060 1060 /* Show error message if necessary: */ 1061 1061 if (!fSuccess) 1062 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1062 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1063 1063 1064 1064 /* For each controller: */ … … 1085 1085 /* Show error message if necessary: */ 1086 1086 if (!fSuccess) 1087 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comController));1087 notifyOperationProgressError(UIErrorString::formatErrorInfo(comController)); 1088 1088 else 1089 1089 { … … 1101 1101 /* Show error message if necessary: */ 1102 1102 if (!fSuccess) 1103 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1103 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1104 1104 } 1105 1105 } … … 1138 1138 /* Show error message if necessary: */ 1139 1139 if (!fSuccess) 1140 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1140 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1141 1141 else 1142 1142 { … … 1160 1160 /* Show error message if necessary: */ 1161 1161 if (!fSuccess) 1162 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1162 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1163 1163 } 1164 1164 … … 1188 1188 /* Show error message if necessary: */ 1189 1189 if (!fSuccess) 1190 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1190 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1191 1191 } 1192 1192 … … 1209 1209 /* Show error message if necessary: */ 1210 1210 if (!fSuccess) 1211 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(m_machine));1211 notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine)); 1212 1212 } 1213 1213 … … 1236 1236 /* Show error message if necessary: */ 1237 1237 if (!fSuccess) 1238 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comFiltersObject));1238 notifyOperationProgressError(UIErrorString::formatErrorInfo(comFiltersObject)); 1239 1239 } 1240 1240 /* Return result: */ … … 1255 1255 /* Show error message if necessary: */ 1256 1256 if (!fSuccess) 1257 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comFiltersObject));1257 notifyOperationProgressError(UIErrorString::formatErrorInfo(comFiltersObject)); 1258 1258 else 1259 1259 { … … 1315 1315 /* Show error message if necessary: */ 1316 1316 if (!fSuccess) 1317 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comFilter));1317 notifyOperationProgressError(UIErrorString::formatErrorInfo(comFilter)); 1318 1318 else 1319 1319 { … … 1324 1324 /* Show error message if necessary: */ 1325 1325 if (!fSuccess) 1326 notifyOperationProgressError(UI MessageCenter::formatErrorInfo(comFiltersObject));1326 notifyOperationProgressError(UIErrorString::formatErrorInfo(comFiltersObject)); 1327 1327 } 1328 1328 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp
r62493 r68435 30 30 /* GUI includes: */ 31 31 # include "UIProgressDialog.h" 32 # include "UI MessageCenter.h"32 # include "UIErrorString.h" 33 33 # include "UISpecialControls.h" 34 34 # include "UIModalWindowManager.h" … … 399 399 /* Notify listeners about the operation progress error: */ 400 400 if (!m_progress.isOk() || m_progress.GetResultCode() != 0) 401 emit sigProgressError(UI MessageCenter::formatErrorInfo(m_progress));401 emit sigProgressError(UIErrorString::formatErrorInfo(m_progress)); 402 402 403 403 /* Exit from the event-loop if there is any: */
Note:
See TracChangeset
for help on using the changeset viewer.