VirtualBox

Ignore:
Timestamp:
Apr 4, 2022 12:50:13 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10205. Make use of IHostUpdate to check for a new VBox version.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateManager.cpp

    r93990 r94454  
    9393void UIUpdateStepVirtualBox::exec()
    9494{
     95#if 0
    9596    /* Return if already checking: */
    9697    if (UINotificationNewVersionCheckerVirtualBox::exists())
     
    111112    connect(pNotification, &UINotificationNewVersionCheckerVirtualBox::sigProgressFinished,
    112113            this, &UIUpdateStepVirtualBox::sigStepFinished);
     114
    113115    /* Append and start notification: */
    114116    gpNotificationCenter->append(pNotification);
     117#else
     118    UINotificationProgressNewVersionChecker *pNotification =
     119        new UINotificationProgressNewVersionChecker();
     120    connect(pNotification, &UINotificationProgressNewVersionChecker::sigProgressFinished,
     121            this, &UIUpdateStepVirtualBox::sigStepFinished);
     122    gpNotificationCenter->append(pNotification);
     123#endif
    115124}
    116125
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r94089 r94454  
    43064306}
    43074307
     4308
     4309/*********************************************************************************************************************************
     4310*   Class UINotificationProgressNewVersionChecker implementation.                                                                *
     4311*********************************************************************************************************************************/
     4312
     4313UINotificationProgressNewVersionChecker::UINotificationProgressNewVersionChecker()
     4314{
     4315    connect(this, &UINotificationProgress::sigProgressFinished,
     4316            this, &UINotificationProgressNewVersionChecker::sltHandleProgressFinished);
     4317    CHost comHost = uiCommon().virtualBox().GetHost();
     4318    if (!comHost.isNull())
     4319        m_comUpdateChecker = comHost.GetUpdate();
     4320}
     4321
     4322QString UINotificationProgressNewVersionChecker::name() const
     4323{
     4324    return UINotificationProgress::tr("Check for New Version ...");
     4325}
     4326
     4327QString UINotificationProgressNewVersionChecker::details() const
     4328{
     4329    return QString();
     4330}
     4331
     4332CProgress UINotificationProgressNewVersionChecker::createProgress(COMResult &comResult)
     4333{
     4334    if (!m_comUpdateChecker.isOk())
     4335        return CProgress();
     4336
     4337    CProgress comProgress = m_comUpdateChecker.UpdateCheck(KUpdateCheckType_VirtualBox);
     4338    comResult = m_comUpdateChecker;
     4339
     4340    return comProgress;
     4341}
     4342
     4343void UINotificationProgressNewVersionChecker::sltHandleProgressFinished()
     4344{
     4345    if (m_comUpdateChecker.isNull() && !m_comUpdateChecker.isOk())
     4346        return;
     4347
     4348    bool fUpdateAvailable = m_comUpdateChecker.GetUpdateResponse();
     4349    if (!m_comUpdateChecker.isOk())
     4350        return;
     4351
     4352    if (fUpdateAvailable)
     4353    {
     4354        QString strVersion = m_comUpdateChecker.GetUpdateVersion();
     4355        if (!m_comUpdateChecker.isOk())
     4356            return;
     4357
     4358        QString strURL = m_comUpdateChecker.GetUpdateURL();
     4359        if (!m_comUpdateChecker.isOk())
     4360            return;
     4361
     4362        UINotificationMessage::showUpdateSuccess(strVersion, strURL);
     4363    }
     4364    else
     4365        UINotificationMessage::showUpdateNotFound();
     4366}
     4367
    43084368#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r94089 r94454  
    4242#include "CGuest.h"
    4343#include "CHost.h"
     44#include "CHostUpdate.h"
    4445#include "CHostNetworkInterface.h"
    4546#include "CMachine.h"
     
    26832684    QString  m_strUrl;
    26842685};
     2686
     2687/** UINotificationProgress extension for checking a new VirtualBox version. */
     2688class SHARED_LIBRARY_STUFF UINotificationProgressNewVersionChecker : public UINotificationProgress
     2689{
     2690    Q_OBJECT;
     2691
     2692public:
     2693
     2694    UINotificationProgressNewVersionChecker();
     2695
     2696protected:
     2697
     2698    /** Returns object name. */
     2699    virtual QString name() const /* override final */;
     2700    /** Returns object details. */
     2701    virtual QString details() const /* override final */;
     2702    /** Creates and returns started progress-wrapper. */
     2703    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     2704
     2705private slots:
     2706
     2707    void sltHandleProgressFinished();
     2708
     2709private:
     2710
     2711    CHostUpdate m_comUpdateChecker;
     2712};
     2713
     2714
    26852715#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    26862716
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette