VirtualBox

Changeset 90541 in vbox for trunk/src


Ignore:
Timestamp:
Aug 6, 2021 10:19:48 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: A bit of refactoring for UINetworkCustomer and UIDownloader code.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/networking
Files:
10 edited

Legend:

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

    r90540 r90541  
    2424
    2525
    26 void UIDownloader::start()
     26UIDownloader::UIDownloader()
     27    : m_state(UIDownloaderState_Null)
    2728{
    28     startDelayedAcknowledging();
     29    /* Connect async listeners for our own commands: */
     30    connect(this, &UIDownloader::sigToStartAcknowledging, this, &UIDownloader::sltStartAcknowledging, Qt::QueuedConnection);
     31    connect(this, &UIDownloader::sigToStartDownloading,   this, &UIDownloader::sltStartDownloading,   Qt::QueuedConnection);
     32    connect(this, &UIDownloader::sigToStartVerifying,     this, &UIDownloader::sltStartVerifying,     Qt::QueuedConnection);
    2933}
    3034
     
    5660}
    5761
    58 UIDownloader::UIDownloader()
    59     : m_state(UIDownloaderState_Null)
    60 {
    61     /* Connect listeners: */
    62     connect(this, &UIDownloader::sigToStartAcknowledging, this, &UIDownloader::sltStartAcknowledging, Qt::QueuedConnection);
    63     connect(this, &UIDownloader::sigToStartDownloading,   this, &UIDownloader::sltStartDownloading,   Qt::QueuedConnection);
    64     connect(this, &UIDownloader::sigToStartVerifying,     this, &UIDownloader::sltStartVerifying,     Qt::QueuedConnection);
    65 }
    66 
    67 const QString UIDownloader::description() const
     62QString UIDownloader::description() const
    6863{
    6964    /* Look for known state: */
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloader.h

    r90540 r90541  
    5252public:
    5353
     54    /** Constructs downloader. */
     55    UIDownloader();
     56
     57public slots:
     58
    5459    /** Starts the sequence. */
    55     void start();
     60    void start() { startDelayedAcknowledging(); }
    5661
    5762protected slots:
     
    6570
    6671protected:
    67 
    68     /** UIDownloader states. */
    69     enum UIDownloaderState
    70     {
    71         UIDownloaderState_Null,
    72         UIDownloaderState_Acknowledging,
    73         UIDownloaderState_Downloading,
    74         UIDownloaderState_Verifying
    75     };
    76 
    77     /** Constructs downloader. */
    78     UIDownloader();
    7972
    8073    /** Appends subsequent source to try to download from. */
     
    9891
    9992    /** Returns description of the current network operation. */
    100     virtual const QString description() const;
    101 
    102     /** Starts delayed acknowledging. */
    103     void startDelayedAcknowledging() { emit sigToStartAcknowledging(); }
    104     /** Starts delayed downloading. */
    105     void startDelayedDownloading() { emit sigToStartDownloading(); }
    106     /** Starts delayed verifying. */
    107     void startDelayedVerifying() { emit sigToStartVerifying(); }
     93    virtual QString description() const;
    10894
    10995    /** Handles network-reply progress for @a iReceived bytes of @a iTotal. */
    110     void processNetworkReplyProgress(qint64 iReceived, qint64 iTotal);
     96    virtual void processNetworkReplyProgress(qint64 iReceived, qint64 iTotal) /* override */;
    11197    /** Handles network-reply failed with specified @a strError. */
    112     void processNetworkReplyFailed(const QString &strError);
     98    virtual void processNetworkReplyFailed(const QString &strError) /* override */;
    11399    /** Handles network-reply cancel request for @a pReply. */
    114     void processNetworkReplyCanceled(UINetworkReply *pReply);
     100    virtual void processNetworkReplyCanceled(UINetworkReply *pReply) /* override */;
    115101    /** Handles network-reply finish for @a pReply. */
    116     void processNetworkReplyFinished(UINetworkReply *pReply);
    117 
    118     /** Handles acknowledging result. */
    119     virtual void handleAcknowledgingResult(UINetworkReply *pReply);
    120     /** Handles downloading result. */
    121     virtual void handleDownloadingResult(UINetworkReply *pReply);
    122     /** Handles verifying result. */
    123     virtual void handleVerifyingResult(UINetworkReply *pReply);
     102    virtual void processNetworkReplyFinished(UINetworkReply *pReply) /* override */;
    124103
    125104    /** Asks user for downloading confirmation for passed @a pReply. */
     
    131110
    132111private:
     112
     113    /** UIDownloader states. */
     114    enum UIDownloaderState
     115    {
     116        UIDownloaderState_Null,
     117        UIDownloaderState_Acknowledging,
     118        UIDownloaderState_Downloading,
     119        UIDownloaderState_Verifying
     120    };
     121
     122    /** Starts delayed acknowledging. */
     123    void startDelayedAcknowledging() { emit sigToStartAcknowledging(); }
     124    /** Starts delayed downloading. */
     125    void startDelayedDownloading() { emit sigToStartDownloading(); }
     126    /** Starts delayed verifying. */
     127    void startDelayedVerifying() { emit sigToStartVerifying(); }
     128
     129    /** Handles acknowledging result. */
     130    void handleAcknowledgingResult(UINetworkReply *pReply);
     131    /** Handles downloading result. */
     132    void handleDownloadingResult(UINetworkReply *pReply);
     133    /** Handles verifying result. */
     134    void handleVerifyingResult(UINetworkReply *pReply);
    133135
    134136    /** Holds the downloader state. */
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderAdditions.cpp

    r90491 r90541  
    55
    66/*
    7  * Copyright (C) 2006-2020 Oracle Corporation
     7 * Copyright (C) 2006-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    7474}
    7575
    76 const QString UIDownloaderAdditions::description() const
     76QString UIDownloaderAdditions::description() const
    7777{
    7878    return UIDownloader::description().arg(tr("VirtualBox Guest Additions"));
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderAdditions.h

    r86996 r90541  
    55
    66/*
    7  * Copyright (C) 2006-2020 Oracle Corporation
     7 * Copyright (C) 2006-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5454
    5555    /** Returns description of the current network operation. */
    56     virtual const QString description() const /* override */;
     56    virtual QString description() const /* override */;
    5757
    5858    /** Asks user for downloading confirmation for passed @a pReply. */
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderExtensionPack.cpp

    r90491 r90541  
    55
    66/*
    7  * Copyright (C) 2011-2020 Oracle Corporation
     7 * Copyright (C) 2011-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    7575}
    7676
    77 const QString UIDownloaderExtensionPack::description() const
     77QString UIDownloaderExtensionPack::description() const
    7878{
    7979    return UIDownloader::description().arg(tr("VirtualBox Extension Pack"));
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderExtensionPack.h

    r86996 r90541  
    55
    66/*
    7  * Copyright (C) 2011-2020 Oracle Corporation
     7 * Copyright (C) 2011-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5656
    5757    /** Returns description of the current network operation. */
    58     virtual const QString description() const /* override */;
     58    virtual QString description() const /* override */;
    5959
    6060    /** Asks user for downloading confirmation for passed @a pReply. */
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderUserManual.cpp

    r90491 r90541  
    55
    66/*
    7  * Copyright (C) 2006-2020 Oracle Corporation
     7 * Copyright (C) 2006-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    7373}
    7474
    75 const QString UIDownloaderUserManual::description() const
     75QString UIDownloaderUserManual::description() const
    7676{
    7777    return UIDownloader::description().arg(tr("VirtualBox User Manual"));
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderUserManual.h

    r86996 r90541  
    55
    66/*
    7  * Copyright (C) 2010-2020 Oracle Corporation
     7 * Copyright (C) 2010-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5151
    5252    /** Returns description of the current network operation. */
    53     virtual const QString description() const /* override */;
     53    virtual QString description() const /* override */;
    5454
    5555    /** Asks user for downloading confirmation for passed @a pReply. */
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UINetworkCustomer.h

    r90540 r90541  
    4747    bool isItForceCall() const { return m_fForceCall; }
    4848
     49    /** Returns description of the current network operation. */
     50    virtual QString description() const { return QString(); }
     51
    4952    /** Handles network reply progress for @a iReceived amount of bytes among @a iTotal. */
    5053    virtual void processNetworkReplyProgress(qint64 iReceived, qint64 iTotal) = 0;
     
    5558    /** Handles network reply finishing for a passed @a pReply. */
    5659    virtual void processNetworkReplyFinished(UINetworkReply *pReply) = 0;
    57 
    58     /** Returns description of the current network operation. */
    59     virtual const QString description() const { return QString(); }
    6060
    6161protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateManager.cpp

    r90540 r90541  
    144144protected:
    145145
     146    /** Returns description of the current network operation. */
     147    virtual QString description() const /* override */;
     148
    146149    /** Handles network reply finishing with specified @a strError. */
    147150    virtual void processNetworkReplyFailed(const QString &strError) /* override */;
     
    150153    /** Handles network reply finishing for a passed @a pReply. */
    151154    virtual void processNetworkReplyFinished(UINetworkReply *pReply) /* override */;
    152 
    153     /** Returns description of the current network operation. */
    154     virtual const QString description() const /* override */;
    155155
    156156protected slots:
     
    249249*********************************************************************************************************************************/
    250250
     251QString UIUpdateStepVirtualBox::description() const
     252{
     253    return tr("Checking for a new VirtualBox version...");
     254}
     255
    251256void UIUpdateStepVirtualBox::processNetworkReplyFailed(const QString &strError)
    252257{
     
    291296    /* Notify about step completion: */
    292297    emit sigStepComplete();
    293 }
    294 
    295 const QString UIUpdateStepVirtualBox::description() const
    296 {
    297     return tr("Checking for a new VirtualBox version...");
    298298}
    299299
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