Changeset 45270 in vbox
- Timestamp:
- Apr 1, 2013 11:33:42 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45269 r45270 346 346 { 347 347 message(0, MessageType_Error, 348 tr("<p>Could not find a language file for the language " 349 "<b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>" 350 "<p>The language will be temporarily reset to the system " 351 "default language. Please go to the <b>Preferences</b> " 352 "dialog which you can open from the <b>File</b> menu of the " 353 "main VirtualBox window, and select one of the existing " 354 "languages on the <b>Language</b> page.</p>") 355 .arg(strLangId).arg(strNlsPath)); 348 tr("<p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>" 349 "<p>The language will be temporarily reset to the system default language. " 350 "Please go to the <b>Preferences</b> dialog which you can open from the <b>File</b> menu " 351 "of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p>") 352 .arg(strLangId).arg(strNlsPath)); 356 353 } 357 354 … … 359 356 { 360 357 message(0, MessageType_Error, 361 tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. " 362 "<p>The language will be temporarily reset to English (built-in). " 363 "Please go to the <b>Preferences</b> " 364 "dialog which you can open from the <b>File</b> menu of the " 365 "main VirtualBox window, and select one of the existing " 366 "languages on the <b>Language</b> page.</p>") 367 .arg(strLangFile)); 358 tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. " 359 "<p>The language will be temporarily reset to English (built-in). " 360 "Please go to the <b>Preferences</b> dialog which you can open from the <b>File</b> menu " 361 "of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p>") 362 .arg(strLangFile)); 368 363 } 369 364 370 365 void UIMessageCenter::cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError) 371 366 { 372 /* preserve the current error info before calling the object again*/367 /* Preserve error-info: */ 373 368 COMResult res(vbox); 374 375 message(mainWindowShown(), MessageType_Critical, 376 tr("<p>Failed to load the global GUI configuration from " 377 "<b><nobr>%1</nobr></b>.</p>" 378 "<p>The application will now terminate.</p>") 379 .arg(vbox.GetSettingsFilePath()), 380 !res.isOk() ? formatErrorInfo(res) 381 : QString("<!--EOM--><p>%1</p>").arg(vboxGlobal().emphasize(strError))); 369 /* Show the message: */ 370 message(0, MessageType_Critical, 371 tr("<p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p>" 372 "<p>The application will now terminate.</p>").arg(vbox.GetSettingsFilePath()), 373 !res.isOk() ? formatErrorInfo(res) 374 : QString("<!--EOM--><p>%1</p>").arg(vboxGlobal().emphasize(strError))); 382 375 } 383 376 384 377 void UIMessageCenter::cannotSaveGlobalConfig(const CVirtualBox &vbox) 385 378 { 386 /* preserve the current error info before calling the object again*/379 /* Preserve error-info: */ 387 380 COMResult res(vbox); 388 389 message(mainWindowShown(), MessageType_Critical, 390 tr("<p>Failed to save the global GUI configuration to " 391 "<b><nobr>%1</nobr></b>.</p>" 392 "<p>The application will now terminate.</p>") 393 .arg(vbox.GetSettingsFilePath()), 394 formatErrorInfo(res)); 395 } 396 397 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &props) 398 { 399 message(mainWindowShown(), MessageType_Critical, 400 tr("Failed to set global VirtualBox properties."), 401 formatErrorInfo(props)); 402 } 403 404 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, 405 const QString &name) 406 { 407 message( 408 QApplication::desktop()->screen(QApplication::desktop()->primaryScreen()), 409 MessageType_Error, 410 tr("There is no virtual machine named <b>%1</b>.") 411 .arg(name), 412 formatErrorInfo(vbox) 413 ); 381 /* Show the message: */ 382 message(0, MessageType_Critical, 383 tr("<p>Failed to save the global GUI configuration to <b><nobr>%1</nobr></b>.</p>" 384 "<p>The application will now terminate.</p>").arg(vbox.GetSettingsFilePath()), 385 formatErrorInfo(res)); 386 } 387 388 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, const QString &name) 389 { 390 message(0, MessageType_Error, 391 tr("There is no virtual machine named <b>%1</b>.").arg(name), 392 formatErrorInfo(vbox)); 414 393 } 415 394 … … 417 396 { 418 397 Assert(session.isNull()); 419 420 message( 421 mainWindowShown(), 422 MessageType_Error, 423 tr("Failed to create a new session."), 424 formatErrorInfo(session) 425 ); 426 } 427 428 void UIMessageCenter::cannotOpenSession(const CVirtualBox &vbox, 429 const CMachine &machine, 430 const CProgress &progress) 398 /* Show the message: */ 399 message(mainWindowShown(), MessageType_Error, 400 tr("Failed to create a new session."), 401 formatErrorInfo(session)); 402 } 403 404 void UIMessageCenter::cannotOpenSession(const CVirtualBox &vbox, const CMachine &machine, 405 const CProgress &progress /* = CProgress() */) 431 406 { 432 407 Assert(!vbox.isOk() || progress.isOk()); 433 434 QString name = machine.GetName(); 435 if (name.isEmpty()) 436 name = QFileInfo(machine.GetSettingsFilePath()).baseName(); 437 438 message( 439 mainWindowShown(), 440 MessageType_Error, 441 tr("Failed to open a session for the virtual machine <b>%1</b>.") 442 .arg(name), 443 !vbox.isOk() ? formatErrorInfo(vbox) : 444 formatErrorInfo(progress.GetErrorInfo()) 445 ); 408 /* Compose machine name: */ 409 QString strName = machine.GetName(); 410 if (strName.isEmpty()) 411 strName = QFileInfo(machine.GetSettingsFilePath()).baseName(); 412 /* Show the message: */ 413 message(mainWindowShown(), MessageType_Error, 414 tr("Failed to open a session for the virtual machine <b>%1</b>.").arg(strName), 415 !vbox.isOk() ? formatErrorInfo(vbox) : formatErrorInfo(progress.GetErrorInfo())); 446 416 } 447 417 448 418 void UIMessageCenter::cannotOpenSession(const CMachine &machine) 449 419 { 420 /* Preserve error-info: */ 450 421 COMResult res(machine); 451 QString name = machine.GetName(); 452 if (name.isEmpty()) 453 name = QFileInfo(machine.GetSettingsFilePath()).baseName(); 454 422 /* Compose machine name: */ 423 QString strName = machine.GetName(); 424 if (strName.isEmpty()) 425 strName = QFileInfo(machine.GetSettingsFilePath()).baseName(); 426 /* Show the message: */ 455 427 message(mainWindowShown(), MessageType_Error, 456 tr("Failed to open a session for the virtual machine <b>%1</b>.").arg( name),428 tr("Failed to open a session for the virtual machine <b>%1</b>.").arg(strName), 457 429 formatErrorInfo(res)); 458 430 } 459 431 460 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &aMedium) 461 { 462 message(qApp->activeWindow(), MessageType_Error, 463 tr("Failed to determine the accessibility state of the medium " 464 "<nobr><b>%1</b></nobr>.") 465 .arg(aMedium.location()), 466 formatErrorInfo(aMedium.result())); 432 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &medium) 433 { 434 message(mainWindowShown(), MessageType_Error, 435 tr("Failed to determine the accessibility state of the medium <nobr><b>%1</b></nobr>.") 436 .arg(medium.location()), 437 formatErrorInfo(medium.result())); 467 438 } 468 439 469 440 void UIMessageCenter::cannotOpenURL(const QString &strUrl) 470 441 { 471 message 472 (mainWindowShown(), MessageType_Error, 473 tr("Failed to open <tt>%1</tt>. Make sure your desktop environment " 474 "can properly handle URLs of this type.") 475 .arg(strUrl)); 442 message(mainWindowShown(), MessageType_Error, 443 tr("Failed to open <tt>%1</tt>. " 444 "Make sure your desktop environment can properly handle URLs of this type.") 445 .arg(strUrl)); 476 446 } 477 447 … … 836 806 formatErrorInfo(machine) 837 807 ); 808 } 809 810 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties) 811 { 812 message(mainWindowShown(), MessageType_Critical, 813 tr("Failed to set global VirtualBox properties."), 814 formatErrorInfo(properties)); 838 815 } 839 816 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45269 r45270 202 202 void cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError); 203 203 void cannotSaveGlobalConfig(const CVirtualBox &vbox); 204 void cannotSetSystemProperties(const CSystemProperties &props);205 204 void cannotFindMachineByName(const CVirtualBox &vbox, const QString &name); 206 205 void cannotOpenSession(const CSession &session); 207 206 void cannotOpenSession(const CVirtualBox &vbox, const CMachine &machine, const CProgress &progress = CProgress()); 208 207 void cannotOpenSession(const CMachine &machine); 209 void cannotGetMediaAccessibility(const UIMedium & aMedium);208 void cannotGetMediaAccessibility(const UIMedium &medium); 210 209 void cannotOpenURL(const QString &strUrl); 211 210 … … 241 240 242 241 /* API: Settings warnings: */ 242 void cannotSetSystemProperties(const CSystemProperties &properties); 243 243 void cannotAccessUSB(const COMBaseWithEI &object); 244 244 void cannotLoadMachineSettings(const CMachine &machine, bool fStrict = true, QWidget *pParent = 0); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r45193 r45270 475 475 CSession session = vboxGlobal().openSession(pItem->id()); 476 476 if (session.isNull()) 477 {478 msgCenter().cannotOpenSession(session);479 477 return; 480 }481 478 482 479 /* Get session console: */ … … 523 520 CSession session = vboxGlobal().openExistingSession(pItem->id()); 524 521 if (session.isNull()) 525 {526 msgCenter().cannotOpenSession(session);527 522 return; 528 }529 523 530 524 /* Get session console: */ … … 576 570 CSession session = vboxGlobal().openExistingSession(pItem->id()); 577 571 if (session.isNull()) 578 {579 msgCenter().cannotOpenSession(session);580 572 return; 581 }582 573 583 574 /* Get session console: */ … … 607 598 CSession session = vboxGlobal().openExistingSession(pItem->id()); 608 599 if (session.isNull()) 609 {610 msgCenter().cannotOpenSession(session);611 600 return; 612 }613 601 614 602 /* Get session console: */ … … 659 647 CSession session = vboxGlobal().openExistingSession(pItem->id()); 660 648 if (session.isNull()) 661 {662 msgCenter().cannotOpenSession(session);663 649 return; 664 }665 650 666 651 /* Get session console: */ … … 701 686 CSession session = vboxGlobal().openExistingSession(pItem->id()); 702 687 if (session.isNull()) 703 {704 msgCenter().cannotOpenSession(session);705 688 return; 706 }707 689 708 690 /* Get session console: */ … … 1795 1777 CSession session = vboxGlobal().openExistingSession(pItem->id()); 1796 1778 if (session.isNull()) 1797 {1798 msgCenter().cannotOpenSession(session);1799 1779 return false; 1800 }1801 1780 CConsole console = session.GetConsole(); 1802 1781 if (console.isNull()) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r45233 r45270 521 521 bool UISettingsDialogGlobal::isPageAvailable(int iPageId) 522 522 { 523 /* Show the host error message for particular group if present.524 * We don't use the generic cannotLoadGlobalConfig()525 * call here because we want this message to be suppressible: */526 523 switch (iPageId) 527 524 { … … 539 536 if (host.lastRC() == E_NOTIMPL) 540 537 return false; 541 #else 538 #else /* ENABLE_GLOBAL_USB */ 542 539 return false; 543 #endif 540 #endif /* !ENABLE_GLOBAL_USB */ 544 541 break; 545 542 }
Note:
See TracChangeset
for help on using the changeset viewer.