VirtualBox

Changeset 90568 in vbox


Ignore:
Timestamp:
Aug 7, 2021 12:10:50 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146174
Message:

FE/Qt: bugref:10067: Notification signature for guest additions downloading which should now go to center instead of network-request center; Moving singleton functionality from UIDownloaderAdditions to UINotificationDownloaderGuestAdditions.

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

Legend:

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

    r90541 r90568  
    3434
    3535
    36 /* static */
    37 UIDownloaderAdditions *UIDownloaderAdditions::s_pInstance = 0;
    38 
    39 /* static */
    40 UIDownloaderAdditions *UIDownloaderAdditions::create()
    41 {
    42     if (!s_pInstance)
    43         s_pInstance = new UIDownloaderAdditions;
    44     return s_pInstance;
    45 }
    46 
    4736UIDownloaderAdditions::UIDownloaderAdditions()
    4837{
    49     /* Prepare instance: */
    50     if (!s_pInstance)
    51         s_pInstance = this;
    52 
    5338    /* Get version number and adjust it for test and trunk builds. The server only has official releases. */
    5439    const QString strVersion = UIVersion(uiCommon().vboxVersionStringNormalized()).effectiveReleasedVersion().toString();
     
    6550    setTarget(strTarget);
    6651    setPathSHA256SumsFile(strPathSHA256SumsFile);
    67 }
    68 
    69 UIDownloaderAdditions::~UIDownloaderAdditions()
    70 {
    71     /* Cleanup instance: */
    72     if (s_pInstance == this)
    73         s_pInstance = 0;
    7452}
    7553
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderAdditions.h

    r90541 r90568  
    4141public:
    4242
    43     /** Creates downloader instance. */
    44     static UIDownloaderAdditions *create();
    45     /** Returns current downloader instance. */
    46     static UIDownloaderAdditions *current() { return s_pInstance; }
     43    /** Constructs downloader. */
     44    UIDownloaderAdditions();
    4745
    4846private:
    49 
    50     /** Constructs downloader. */
    51     UIDownloaderAdditions();
    52     /** Destructs downloader. */
    53     ~UIDownloaderAdditions();
    5447
    5548    /** Returns description of the current network operation. */
     
    6356    virtual void handleVerifiedObject(UINetworkReply *pReply) /* override */;
    6457
    65     /** Holds the static singleton instance. */
    66     static UIDownloaderAdditions *s_pInstance;
    67 
    6858    /** Holds the cached received data awaiting for verification. */
    6959    QByteArray m_receivedData;
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90561 r90568  
    2222/* GUI includes: */
    2323#include "UICommon.h"
     24#include "UIDownloaderAdditions.h"
    2425#include "UIDownloaderExtensionPack.h"
    2526#include "UIDownloaderUserManual.h"
     
    15461547
    15471548/*********************************************************************************************************************************
     1549*   Class UINotificationDownloaderGuestAdditions implementation.                                                                 *
     1550*********************************************************************************************************************************/
     1551
     1552/* static */
     1553UINotificationDownloaderGuestAdditions *UINotificationDownloaderGuestAdditions::s_pInstance = 0;
     1554
     1555/* static */
     1556UINotificationDownloaderGuestAdditions *UINotificationDownloaderGuestAdditions::instance(const QString &strFileName)
     1557{
     1558    if (!s_pInstance)
     1559        new UINotificationDownloaderGuestAdditions(strFileName);
     1560    return s_pInstance;
     1561}
     1562
     1563/* static */
     1564bool UINotificationDownloaderGuestAdditions::exists()
     1565{
     1566    return !!s_pInstance;
     1567}
     1568
     1569UINotificationDownloaderGuestAdditions::UINotificationDownloaderGuestAdditions(const QString &strFileName)
     1570    : m_strFileName(strFileName)
     1571{
     1572    s_pInstance = this;
     1573}
     1574
     1575UINotificationDownloaderGuestAdditions::~UINotificationDownloaderGuestAdditions()
     1576{
     1577    s_pInstance = 0;
     1578}
     1579
     1580QString UINotificationDownloaderGuestAdditions::name() const
     1581{
     1582    return UINotificationDownloader::tr("Downloading Guest Additions ...");
     1583}
     1584
     1585QString UINotificationDownloaderGuestAdditions::details() const
     1586{
     1587    return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strFileName);
     1588}
     1589
     1590UIDownloader *UINotificationDownloaderGuestAdditions::createDownloader()
     1591{
     1592    /* Create and configure the User Manual downloader: */
     1593    UIDownloaderAdditions *pDownloader = new UIDownloaderAdditions;
     1594    if (pDownloader)
     1595    {
     1596        connect(pDownloader, &UIDownloaderAdditions::sigDownloadFinished,
     1597                this, &UINotificationDownloaderGuestAdditions::sigGuestAdditionsDownloaded);
     1598        return pDownloader;
     1599    }
     1600    return 0;
     1601}
     1602
     1603
     1604/*********************************************************************************************************************************
    15481605*   Class UINotificationDownloaderUserManual implementation.                                                                     *
    15491606*********************************************************************************************************************************/
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90561 r90568  
    11671167};
    11681168
     1169/** UINotificationDownloader extension for guest additions downloading functionality. */
     1170class SHARED_LIBRARY_STUFF UINotificationDownloaderGuestAdditions : public UINotificationDownloader
     1171{
     1172    Q_OBJECT;
     1173
     1174signals:
     1175
     1176    /** Notifies listeners about guest additions downloaded.
     1177      * @param  strLocation  Brings the UM location. */
     1178    void sigGuestAdditionsDownloaded(const QString &strLocation);
     1179
     1180public:
     1181
     1182    /** Returns singleton instance, creates if necessary.
     1183      * @param  strFileName  Brings the file name. */
     1184    static UINotificationDownloaderGuestAdditions *instance(const QString &strFileName);
     1185    /** Returns whether singleton instance already created. */
     1186    static bool exists();
     1187
     1188    /** Destructs guest additions downloading notification-progress.
     1189      * @note  Notification-center can destroy us at any time. */
     1190    virtual ~UINotificationDownloaderGuestAdditions() /* override final */;
     1191
     1192protected:
     1193
     1194    /** Constructs guest additions downloading notification-progress.
     1195      * @param  strFileName  Brings the file name. */
     1196    UINotificationDownloaderGuestAdditions(const QString &strFileName);
     1197
     1198    /** Returns object name. */
     1199    virtual QString name() const /* override final */;
     1200    /** Returns object details. */
     1201    virtual QString details() const /* override final */;
     1202    /** Creates and returns started progress-wrapper. */
     1203    virtual UIDownloader *createDownloader() /* override final */;
     1204
     1205private:
     1206
     1207    /** Holds the singleton instance. */
     1208    static UINotificationDownloaderGuestAdditions *s_pInstance;
     1209
     1210    /** Holds the name of file being dowloaded. */
     1211    QString  m_strFileName;
     1212};
     1213
    11691214/** UINotificationDownloader extension for user manual downloading functionality. */
    11701215class SHARED_LIBRARY_STUFF UINotificationDownloaderUserManual : public UINotificationDownloader
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r90539 r90568  
    3535#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    3636# include "UINetworkRequestManager.h"
    37 # include "UIDownloaderAdditions.h"
     37# include "UINotificationCenter.h"
    3838#endif
    3939#include "UIHostComboEditor.h"
     
    25252525#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    25262526    /* If downloader is running already: */
    2527     if (UIDownloaderAdditions::current())
     2527    if (UINotificationDownloaderGuestAdditions::exists())
    25282528    {
    25292529        /// @todo show notification-center
     
    25322532    else if (msgCenter().cannotFindGuestAdditions())
    25332533    {
    2534         /* Create Additions downloader: */
    2535         UIDownloaderAdditions *pDl = UIDownloaderAdditions::create();
    2536         /* After downloading finished => propose to install the Additions: */
    2537         connect(pDl, &UIDownloaderAdditions::sigDownloadFinished, uisession(), &UISession::sltInstallGuestAdditionsFrom);
    2538         /* Start downloading: */
    2539         pDl->start();
     2534        /* Download guest additions: */
     2535        UINotificationDownloaderGuestAdditions *pNotification = UINotificationDownloaderGuestAdditions::instance(GUI_GuestAdditionsName);
     2536        /* After downloading finished => propose to install the guest additions: */
     2537        connect(pNotification, &UINotificationDownloaderGuestAdditions::sigGuestAdditionsDownloaded,
     2538                uisession(), &UISession::sltInstallGuestAdditionsFrom);
     2539        /* Append and start notification: */
     2540        gpNotificationCenter->append(pNotification);
    25402541    }
    25412542#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
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