VirtualBox

Changeset 90626 in vbox


Ignore:
Timestamp:
Aug 11, 2021 12:48:59 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146238
Message:

FE/Qt: bugref:10067: Since all downloaders now being created by corresponding notification-center objects, we can finally do manual construction/destruction.

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

Legend:

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

    r90551 r90626  
    8484    /* Notify listeners: */
    8585    emit sigProgressFailed(strError);
    86     /* Delete downloader: */
    87     deleteLater();
    8886}
    8987
     
    9290    /* Notify listeners: */
    9391    emit sigProgressCanceled();
    94     /* Delete downloader: */
    95     deleteLater();
    9692}
    9793
     
    136132        /* Notify listeners: */
    137133        emit sigProgressFinished();
    138         /* Delete downloader: */
    139         deleteLater();
    140134    }
    141135}
     
    156150        /* Notify listeners: */
    157151        emit sigProgressFinished();
    158         /* Delete downloader: */
    159         deleteLater();
    160152    }
    161153}
     
    168160    /* Notify listeners: */
    169161    emit sigProgressFinished();
    170     /* Delete downloader: */
    171     deleteLater();
    172162}
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateManager.cpp

    r90620 r90626  
    208208    connect(pNotification, &UINotificationDownloaderExtensionPack::sigExtensionPackDownloaded,
    209209            this, &UIUpdateStepVirtualBoxExtensionPack::sltHandleDownloadedExtensionPack);
    210     /* Also, destroyed downloader is a signal to finish the step: */
    211     connect(pNotification, &UINotificationDownloaderExtensionPack::sigDownloaderDestroyed,
     210    /* Handle any signal as step-finished: */
     211    connect(pNotification, &UINotificationDownloaderExtensionPack::sigProgressFailed,
     212            this, &UIUpdateStepVirtualBoxExtensionPack::sigStepFinished);
     213    connect(pNotification, &UINotificationDownloaderExtensionPack::sigProgressCanceled,
     214            this, &UIUpdateStepVirtualBoxExtensionPack::sigStepFinished);
     215    connect(pNotification, &UINotificationDownloaderExtensionPack::sigProgressFinished,
    212216            this, &UIUpdateStepVirtualBoxExtensionPack::sigStepFinished);
    213217    /* Append and start notification: */
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObject.cpp

    r90625 r90626  
    123123
    124124UINotificationDownloader::UINotificationDownloader()
     125    : m_pDownloader(0)
    125126{
    126127}
     
    129130{
    130131    delete m_pDownloader;
     132    m_pDownloader = 0;
    131133}
    132134
     
    163165                this, &UINotificationDownloader::sltHandleProgressFailed);
    164166        connect(m_pDownloader, &UIDownloader::sigProgressCanceled,
    165                 this, &UINotificationDownloader::sigProgressCanceled);
     167                this, &UINotificationDownloader::sltHandleProgressCanceled);
    166168        connect(m_pDownloader, &UIDownloader::sigProgressFinished,
    167                 this, &UINotificationDownloader::sigProgressFinished);
    168         connect(m_pDownloader, &UIDownloader::destroyed,
    169                 this, &UINotificationDownloader::sigDownloaderDestroyed);
     169                this, &UINotificationDownloader::sltHandleProgressFinished);
    170170
    171171        /* And start it finally: */
     
    191191void UINotificationDownloader::sltHandleProgressFailed(const QString &strError)
    192192{
     193    delete m_pDownloader;
     194    m_pDownloader = 0;
    193195    m_strError = strError;
    194196    emit sigProgressFailed();
     197}
     198
     199void UINotificationDownloader::sltHandleProgressCanceled()
     200{
     201    delete m_pDownloader;
     202    m_pDownloader = 0;
     203    emit sigProgressCanceled();
     204}
     205
     206void UINotificationDownloader::sltHandleProgressFinished()
     207{
     208    delete m_pDownloader;
     209    m_pDownloader = 0;
     210    emit sigProgressFinished();
    195211}
    196212
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObject.h

    r90625 r90626  
    2424/* Qt includes: */
    2525#include <QObject>
    26 #include <QPointer>
    2726
    2827/* GUI includes: */
     
    148147    void sigProgressFinished();
    149148
    150     /** Notifies listeners about downloader destroyed. */
    151     void sigDownloaderDestroyed();
    152 
    153149public:
    154150
     
    181177      * @param  uPercent  Brings new progress percentage value. */
    182178    void sltHandleProgressChange(ulong uPercent);
    183     /** Handles signal about progress failed.
    184       * @param  strError  Brings error message if any. */
    185     void sltHandleProgressFailed(const QString &strError);
    186 
    187 private:
    188 
    189     /** Holds the instance of downloader being wrapped by this notification-downloader. */
    190     QPointer<UIDownloader>  m_pDownloader;
    191 
    192     /** Holds the last cached progress percentage value. */
    193     ulong    m_uPercent;
    194     /** Holds the error message is any. */
    195     QString  m_strError;
    196 };
    197 
    198 /** UINotificationObject extension for notification-new-version-checker. */
    199 class SHARED_LIBRARY_STUFF UINotificationNewVersionChecker : public UINotificationObject
    200 {
    201     Q_OBJECT;
    202 
    203 signals:
    204 
    205     /** Notifies listeners about progress failed. */
    206     void sigProgressFailed();
    207     /** Notifies listeners about progress canceled. */
    208     void sigProgressCanceled();
    209     /** Notifies listeners about progress finished. */
    210     void sigProgressFinished();
    211 
    212 public:
    213 
    214     /** Constructs notification-new-version-checker. */
    215     UINotificationNewVersionChecker();
    216     /** Destructs notification-new-version-checker. */
    217     virtual ~UINotificationNewVersionChecker() /* override final */;
    218 
    219     /** Creates and returns started checker-wrapper. */
    220     virtual UINewVersionChecker *createChecker() = 0;
    221 
    222     /** Returns whether current progress is done. */
    223     bool isDone() const;
    224     /** Returns error-message if any. */
    225     QString error() const;
    226 
    227     /** Returns whether object is critical. */
    228     virtual bool isCritical() const;
    229     /** Handles notification-object being added. */
    230     virtual void handle() /* override final */;
    231 
    232 public slots:
    233 
    234     /** Stops the checker and notifies model about closing. */
    235     virtual void close() /* override final */;
    236 
    237 private slots:
    238 
    239179    /** Handles signal about progress failed.
    240180      * @param  strError  Brings error message if any. */
     
    247187private:
    248188
     189    /** Holds the instance of downloader being wrapped by this notification-downloader. */
     190    UIDownloader *m_pDownloader;
     191
     192    /** Holds the last cached progress percentage value. */
     193    ulong    m_uPercent;
     194    /** Holds the error message is any. */
     195    QString  m_strError;
     196};
     197
     198/** UINotificationObject extension for notification-new-version-checker. */
     199class SHARED_LIBRARY_STUFF UINotificationNewVersionChecker : public UINotificationObject
     200{
     201    Q_OBJECT;
     202
     203signals:
     204
     205    /** Notifies listeners about progress failed. */
     206    void sigProgressFailed();
     207    /** Notifies listeners about progress canceled. */
     208    void sigProgressCanceled();
     209    /** Notifies listeners about progress finished. */
     210    void sigProgressFinished();
     211
     212public:
     213
     214    /** Constructs notification-new-version-checker. */
     215    UINotificationNewVersionChecker();
     216    /** Destructs notification-new-version-checker. */
     217    virtual ~UINotificationNewVersionChecker() /* override final */;
     218
     219    /** Creates and returns started checker-wrapper. */
     220    virtual UINewVersionChecker *createChecker() = 0;
     221
     222    /** Returns whether current progress is done. */
     223    bool isDone() const;
     224    /** Returns error-message if any. */
     225    QString error() const;
     226
     227    /** Returns whether object is critical. */
     228    virtual bool isCritical() const;
     229    /** Handles notification-object being added. */
     230    virtual void handle() /* override final */;
     231
     232public slots:
     233
     234    /** Stops the checker and notifies model about closing. */
     235    virtual void close() /* override final */;
     236
     237private slots:
     238
     239    /** Handles signal about progress failed.
     240      * @param  strError  Brings error message if any. */
     241    void sltHandleProgressFailed(const QString &strError);
     242    /** Handles signal about progress canceled. */
     243    void sltHandleProgressCanceled();
     244    /** Handles signal about progress finished. */
     245    void sltHandleProgressFinished();
     246
     247private:
     248
    249249    /** Holds the instance of checker being wrapped by this notification-new-version-checker. */
    250250    UINewVersionChecker *m_pChecker;
Note: See TracChangeset for help on using the changeset viewer.

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