- Timestamp:
- Aug 12, 2021 1:41:42 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
-
notificationcenter/UINotificationObjects.cpp (modified) (1 diff)
-
notificationcenter/UINotificationObjects.h (modified) (2 diffs)
-
runtime/UISession.cpp (modified) (1 diff)
-
runtime/UISession.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90645 r90663 1418 1418 1419 1419 /********************************************************************************************************************************* 1420 * Class UINotificationProgressGuestAdditionsInstall implementation. * 1421 *********************************************************************************************************************************/ 1422 1423 UINotificationProgressGuestAdditionsInstall::UINotificationProgressGuestAdditionsInstall(const CGuest &comGuest, 1424 const QString &strSource) 1425 : m_comGuest(comGuest) 1426 , m_strSource(strSource) 1427 { 1428 connect(this, &UINotificationProgress::sigProgressFinished, 1429 this, &UINotificationProgressGuestAdditionsInstall::sltHandleProgressFinished); 1430 } 1431 1432 QString UINotificationProgressGuestAdditionsInstall::name() const 1433 { 1434 return UINotificationProgress::tr("Installing image ..."); 1435 } 1436 1437 QString UINotificationProgressGuestAdditionsInstall::details() const 1438 { 1439 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strSource); 1440 } 1441 1442 CProgress UINotificationProgressGuestAdditionsInstall::createProgress(COMResult &comResult) 1443 { 1444 /* Initialize progress-wrapper: */ 1445 QVector<QString> args; 1446 QVector<KAdditionsUpdateFlag> flags; 1447 CProgress comProgress = m_comGuest.UpdateGuestAdditions(m_strSource, args, flags); 1448 /* Store COM result: */ 1449 comResult = m_comGuest; 1450 /* Return progress-wrapper: */ 1451 return comProgress; 1452 } 1453 1454 void UINotificationProgressGuestAdditionsInstall::sltHandleProgressFinished() 1455 { 1456 if (!error().isEmpty()) 1457 emit sigGuestAdditionsInstallationFailed(m_strSource); 1458 } 1459 1460 1461 /********************************************************************************************************************************* 1420 1462 * Class UINotificationProgressHostOnlyNetworkInterfaceCreate implementation. * 1421 1463 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90606 r90663 35 35 #include "CExtPackFile.h" 36 36 #include "CExtPackManager.h" 37 #include "CGuest.h" 37 38 #include "CHost.h" 38 39 #include "CHostNetworkInterface.h" … … 1034 1035 }; 1035 1036 1037 /** UINotificationProgress extension for guest additions install functionality. */ 1038 class SHARED_LIBRARY_STUFF UINotificationProgressGuestAdditionsInstall : public UINotificationProgress 1039 { 1040 Q_OBJECT; 1041 1042 signals: 1043 1044 /** Notifies listeners about guest additions installation failed. 1045 * @param strSource Brings the guest additions file path. */ 1046 void sigGuestAdditionsInstallationFailed(const QString &strSource); 1047 1048 public: 1049 1050 /** Constructs guest additions install notification-progress. 1051 * @param comGuest Brings the guest additions being installed to. 1052 * @param strSource Brings the guest additions file path. */ 1053 UINotificationProgressGuestAdditionsInstall(const CGuest &comGuest, 1054 const QString &strSource); 1055 1056 protected: 1057 1058 /** Returns object name. */ 1059 virtual QString name() const /* override final */; 1060 /** Returns object details. */ 1061 virtual QString details() const /* override final */; 1062 /** Creates and returns started progress-wrapper. */ 1063 virtual CProgress createProgress(COMResult &comResult) /* override final */; 1064 1065 private slots: 1066 1067 /** Handles signal about progress being finished. */ 1068 void sltHandleProgressFinished(); 1069 1070 private: 1071 1072 /** Holds the guest additions being installed to. */ 1073 CGuest m_comGuest; 1074 /** Holds the guest additions file path. */ 1075 QString m_strSource; 1076 }; 1077 1036 1078 /** UINotificationProgress extension for host-only network interface create functionality. */ 1037 1079 class SHARED_LIBRARY_STUFF UINotificationProgressHostOnlyNetworkInterfaceCreate : public UINotificationProgress -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r90567 r90663 470 470 void UISession::sltInstallGuestAdditionsFrom(const QString &strSource) 471 471 { 472 /* This flag indicates whether we want to do the usual .ISO mounting or not. 473 * First try updating the Guest Additions directly without mounting the .ISO. */ 474 bool fDoMount = false; 475 476 /* Auto-update through GUI is currently disabled. */ 477 #ifndef VBOX_WITH_ADDITIONS_AUTOUPDATE_UI 478 fDoMount = true; 479 #else /* VBOX_WITH_ADDITIONS_AUTOUPDATE_UI */ 480 /* Initiate installation progress: */ 481 QVector<QString> aArgs; 482 QVector<KAdditionsUpdateFlag> aFlagsUpdate; 483 CProgress comProgressInstall = guest().UpdateGuestAdditions(strSource, aArgs, aFlagsUpdate); 484 if (guest().isOk() && comProgressInstall.isNotNull()) 485 { 486 /* Show installation progress: */ 487 msgCenter().showModalProgressDialog(comProgressInstall, tr("Updating Guest Additions"), 488 ":/progress_install_guest_additions_90px.png", 489 0, 500 /* 500ms delay. */); 490 if (comProgressInstall.GetCanceled()) 491 return; 492 493 /* Check whether progress result isn't Ok: */ 494 const HRESULT rc = comProgressInstall.GetResultCode(); 495 if (!comProgressInstall.isOk() || rc != S_OK) 496 { 497 /* If we got back a VBOX_E_NOT_SUPPORTED we don't complain (guest OS simply isn't 498 * supported yet), so silently fall back to "old" .ISO mounting method. */ 499 if ( !SUCCEEDED_WARNING(rc) 500 && rc != VBOX_E_NOT_SUPPORTED) 501 { 502 msgCenter().cannotUpdateGuestAdditions(comProgressInstall); 503 504 /* Throw the error message into release log as well: */ 505 const QString &strErr = comProgressInstall.GetErrorInfo().GetText(); 506 if (!strErr.isEmpty()) 507 LogRel(("%s\n", strErr.toLatin1().constData())); 508 } 509 510 /* Since automatic updating failed, fall back to .ISO mounting: */ 511 fDoMount = true; 512 } 513 } 514 #endif /* VBOX_WITH_ADDITIONS_AUTOUPDATE_UI */ 515 516 /* Check whether we still want mounting? */ 517 if (!fDoMount) 518 return; 519 520 /* Mount medium add-hoc: */ 472 /* Install guest additions: */ 473 UINotificationProgressGuestAdditionsInstall *pNotification = 474 new UINotificationProgressGuestAdditionsInstall(guest(), strSource); 475 connect(pNotification, &UINotificationProgressGuestAdditionsInstall::sigGuestAdditionsInstallationFailed, 476 this, &UISession::sltMountDVDAdHoc); 477 gpNotificationCenter->append(pNotification); 478 } 479 480 void UISession::sltMountDVDAdHoc(const QString &strSource) 481 { 521 482 mountAdHocImage(KDeviceType_DVD, UIMediumDeviceType_DVD, strSource); 522 483 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r90567 r90663 326 326 public slots: 327 327 328 /** Handles request to install guest additions image. 329 * @param strSource Brings the source of image being installed. */ 328 330 void sltInstallGuestAdditionsFrom(const QString &strSource); 331 /** Mounts DVD adhoc. 332 * @param strSource Brings the source of image being mounted. */ 333 void sltMountDVDAdHoc(const QString &strSource); 329 334 330 335 /** Defines @a iKeyboardState. */
Note:
See TracChangeset
for help on using the changeset viewer.

