- Timestamp:
- Mar 22, 2018 3:07:08 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r71371 r71461 86 86 87 87 /* COM includes: */ 88 # include "CExtPack.h" 89 # include "CExtPackFile.h" 90 # include "CExtPackManager.h" 88 91 # include "CMachine.h" 89 92 # include "CSystemProperties.h" … … 3441 3444 #endif /* VBOX_WS_X11 */ 3442 3445 3446 /* static */ 3447 void VBoxGlobal::doExtPackInstallation(QString const &strFilePath, QString const &strDigest, 3448 QWidget *pParent, QString *pstrExtPackName) 3449 { 3450 /* Open the extpack tarball via IExtPackManager: */ 3451 CExtPackManager comManager = vboxGlobal().virtualBox().GetExtensionPackManager(); 3452 CExtPackFile comExtPackFile; 3453 if (strDigest.isEmpty()) 3454 comExtPackFile = comManager.OpenExtPackFile(strFilePath); 3455 else 3456 { 3457 QString strFileAndHash = QString("%1::SHA-256=%2").arg(strFilePath).arg(strDigest); 3458 comExtPackFile = comManager.OpenExtPackFile(strFileAndHash); 3459 } 3460 if (!comManager.isOk()) 3461 { 3462 msgCenter().cannotOpenExtPack(strFilePath, comManager, pParent); 3463 return; 3464 } 3465 3466 if (!comExtPackFile.GetUsable()) 3467 { 3468 msgCenter().warnAboutBadExtPackFile(strFilePath, comExtPackFile, pParent); 3469 return; 3470 } 3471 3472 const QString strPackName = comExtPackFile.GetName(); 3473 const QString strPackDescription = comExtPackFile.GetDescription(); 3474 const QString strPackVersion = QString("%1r%2%3").arg(comExtPackFile.GetVersion()).arg(comExtPackFile.GetRevision()).arg(comExtPackFile.GetEdition()); 3475 3476 /* Check if there is a version of the extension pack already 3477 * installed on the system and let the user decide what to do about it. */ 3478 CExtPack comExtPackCur = comManager.Find(strPackName); 3479 bool fReplaceIt = comExtPackCur.isOk(); 3480 if (fReplaceIt) 3481 { 3482 QString strPackVersionCur = QString("%1r%2%3").arg(comExtPackCur.GetVersion()).arg(comExtPackCur.GetRevision()).arg(comExtPackCur.GetEdition()); 3483 if (!msgCenter().confirmReplaceExtensionPack(strPackName, strPackVersion, strPackVersionCur, strPackDescription, pParent)) 3484 return; 3485 } 3486 /* If it's a new package just ask for general confirmation. */ 3487 else 3488 { 3489 if (!msgCenter().confirmInstallExtensionPack(strPackName, strPackVersion, strPackDescription, pParent)) 3490 return; 3491 } 3492 3493 /* Display the license dialog if required by the extension pack. */ 3494 if (comExtPackFile.GetShowLicense()) 3495 { 3496 QString strLicense = comExtPackFile.GetLicense(); 3497 VBoxLicenseViewer licenseViewer(pParent); 3498 if (licenseViewer.showLicenseFromString(strLicense) != QDialog::Accepted) 3499 return; 3500 } 3501 3502 /* Install the selected package. 3503 * Set the package name return value before doing 3504 * this as the caller should do a refresh even on failure. */ 3505 QString strDisplayInfo; 3506 #ifdef VBOX_WS_WIN 3507 if (pParent) 3508 strDisplayInfo.sprintf("hwnd=%#llx", (uint64_t)(uintptr_t)pParent->winId()); 3509 #endif 3510 /* Prepare installation progress: */ 3511 CProgress comProgress = comExtPackFile.Install(fReplaceIt, strDisplayInfo); 3512 if (comExtPackFile.isOk()) 3513 { 3514 /* Show installation progress: */ 3515 /** @todo move this tr into UIUpdateManager context */ 3516 msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIGlobalSettingsExtension", 3517 "Extensions"), 3518 ":/progress_install_guest_additions_90px.png", pParent); 3519 if (!comProgress.GetCanceled()) 3520 { 3521 if (comProgress.isOk() && comProgress.GetResultCode() == 0) 3522 msgCenter().warnAboutExtPackInstalled(strPackName, pParent); 3523 else 3524 msgCenter().cannotInstallExtPack(comProgress, strFilePath, pParent); 3525 } 3526 } 3527 else 3528 msgCenter().cannotInstallExtPack(comExtPackFile, strFilePath, pParent); 3529 3530 if (pstrExtPackName) 3531 *pstrExtPackName = strPackName; 3532 } 3533 3443 3534 // Public slots 3444 3535 //////////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r71371 r71461 444 444 static void setWMClass(QWidget *pWidget, const QString &strNameString, const QString &strClassString); 445 445 #endif 446 447 /** Initiates the extension pack installation process. 448 * @param strFilePath Brings the extension pack file path. 449 * @param strDigest Brings the extension pack file digest. 450 * @param pParent Brings the parent dialog reference. 451 * @param pstrExtPackName Brings the extension pack name. */ 452 static void doExtPackInstallation(QString const &strFilePath, 453 QString const &strDigest, 454 QWidget *pParent, 455 QString *pstrExtPackName); 446 456 447 457 signals: -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
r71448 r71461 44 44 /* COM includes: */ 45 45 # include "CExtPack.h" 46 # include "CExtPackFile.h"47 46 # include "CExtPackManager.h" 48 47 # include "CSystemProperties.h" … … 492 491 /* Warn the user about extension pack was downloaded and saved, propose to install it: */ 493 492 if (msgCenter().proposeInstallExtentionPack(GUI_ExtPackName, strSource, QDir::toNativeSeparators(strTarget))) 494 UIUpdateManager::doExtPackInstallation(strTarget, strDigest, windowManager().networkManagerOrMainWindowShown(), NULL);493 VBoxGlobal::doExtPackInstallation(strTarget, strDigest, windowManager().networkManagerOrMainWindowShown(), NULL); 495 494 /* Propose to delete the downloaded extension pack: */ 496 495 if (msgCenter().proposeDeleteExtentionPack(QDir::toNativeSeparators(strTarget))) … … 572 571 } 573 572 574 /* static */575 void UIUpdateManager::doExtPackInstallation(QString const &strFilePath, QString const &strDigest,576 QWidget *pParent, QString *pstrExtPackName)577 {578 /* Open the extpack tarball via IExtPackManager: */579 CExtPackManager comManager = vboxGlobal().virtualBox().GetExtensionPackManager();580 CExtPackFile comExtPackFile;581 if (strDigest.isEmpty())582 comExtPackFile = comManager.OpenExtPackFile(strFilePath);583 else584 {585 QString strFileAndHash = QString("%1::SHA-256=%2").arg(strFilePath).arg(strDigest);586 comExtPackFile = comManager.OpenExtPackFile(strFileAndHash);587 }588 if (!comManager.isOk())589 {590 msgCenter().cannotOpenExtPack(strFilePath, comManager, pParent);591 return;592 }593 594 if (!comExtPackFile.GetUsable())595 {596 msgCenter().warnAboutBadExtPackFile(strFilePath, comExtPackFile, pParent);597 return;598 }599 600 const QString strPackName = comExtPackFile.GetName();601 const QString strPackDescription = comExtPackFile.GetDescription();602 const QString strPackVersion = QString("%1r%2%3").arg(comExtPackFile.GetVersion()).arg(comExtPackFile.GetRevision()).arg(comExtPackFile.GetEdition());603 604 /* Check if there is a version of the extension pack already605 * installed on the system and let the user decide what to do about it. */606 CExtPack comExtPackCur = comManager.Find(strPackName);607 bool fReplaceIt = comExtPackCur.isOk();608 if (fReplaceIt)609 {610 QString strPackVersionCur = QString("%1r%2%3").arg(comExtPackCur.GetVersion()).arg(comExtPackCur.GetRevision()).arg(comExtPackCur.GetEdition());611 if (!msgCenter().confirmReplaceExtensionPack(strPackName, strPackVersion, strPackVersionCur, strPackDescription, pParent))612 return;613 }614 /* If it's a new package just ask for general confirmation. */615 else616 {617 if (!msgCenter().confirmInstallExtensionPack(strPackName, strPackVersion, strPackDescription, pParent))618 return;619 }620 621 /* Display the license dialog if required by the extension pack. */622 if (comExtPackFile.GetShowLicense())623 {624 QString strLicense = comExtPackFile.GetLicense();625 VBoxLicenseViewer licenseViewer(pParent);626 if (licenseViewer.showLicenseFromString(strLicense) != QDialog::Accepted)627 return;628 }629 630 /* Install the selected package.631 * Set the package name return value before doing632 * this as the caller should do a refresh even on failure. */633 QString strDisplayInfo;634 #ifdef VBOX_WS_WIN635 if (pParent)636 strDisplayInfo.sprintf("hwnd=%#llx", (uint64_t)(uintptr_t)pParent->winId());637 #endif638 /* Prepare installation progress: */639 CProgress comProgress = comExtPackFile.Install(fReplaceIt, strDisplayInfo);640 if (comExtPackFile.isOk())641 {642 /* Show installation progress: */643 /** @todo move this tr into UIUpdateManager context */644 msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIGlobalSettingsExtension",645 "Extensions"),646 ":/progress_install_guest_additions_90px.png", pParent);647 if (!comProgress.GetCanceled())648 {649 if (comProgress.isOk() && comProgress.GetResultCode() == 0)650 msgCenter().warnAboutExtPackInstalled(strPackName, pParent);651 else652 msgCenter().cannotInstallExtPack(comProgress, strFilePath, pParent);653 }654 }655 else656 msgCenter().cannotInstallExtPack(comExtPackFile, strFilePath, pParent);657 658 if (pstrExtPackName)659 *pstrExtPackName = strPackName;660 }661 662 573 void UIUpdateManager::sltForceCheck() 663 574 { -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.h
r71448 r71461 45 45 static UIUpdateManager *instance() { return s_pInstance; } 46 46 47 /** Initiates the extension pack installation process.48 * @param strFilePath Brings the extension pack file path.49 * @param strDigest Brings the extension pack file digest.50 * @param pParent Brings the parent dialog reference.51 * @param pstrExtPackName Brings the extension pack name. */52 static void doExtPackInstallation(QString const &strFilePath,53 QString const &strDigest,54 QWidget *pParent,55 QString *pstrExtPackName);56 57 47 public slots: 58 48 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r71449 r71461 36 36 # include "UIExtraDataManager.h" 37 37 # include "UIGChooser.h" 38 # include "UIUpdateManager.h"39 38 # include "UIHostNetworkManager.h" 40 39 # include "UIMedium.h" … … 402 401 vboxGlobal().setEPInstallationRequested(true); 403 402 /* Propose the user to install EP described by the arguments @a list. */ 404 UIUpdateManager::doExtPackInstallation(strFile, QString(), this, NULL);403 VBoxGlobal::doExtPackInstallation(strFile, QString(), this, NULL); 405 404 /* Allow update manager to propose us to update EP: */ 406 405 vboxGlobal().setEPInstallationRequested(false); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
r71448 r71461 30 30 # include "UIIconPool.h" 31 31 # include "UIMessageCenter.h" 32 # include "UIUpdateManager.h"33 32 34 33 /* COM includes: */ … … 308 307 { 309 308 QString strExtPackName; 310 UIUpdateManager::doExtPackInstallation(strFilePath, QString(), this, &strExtPackName);309 VBoxGlobal::doExtPackInstallation(strFilePath, QString(), this, &strExtPackName); 311 310 312 311 /* Since we might be reinstalling an existing package, we have to
Note:
See TracChangeset
for help on using the changeset viewer.