VirtualBox

Changeset 90561 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 7, 2021 9:04:01 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146167
Message:

FE/Qt: bugref:10067: Notification signature for user manual downloading which should now go to center instead of network-request center; Moving singleton functionality from UIDownloaderUserManual to UINotificationDownloaderUserManual.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r90539 r90561  
    4545#endif
    4646#ifdef VBOX_OSE
    47 # include "UIDownloaderUserManual.h"
     47# include "UINotificationCenter.h"
    4848#endif
    4949#ifdef VBOX_WS_MAC
     
    34203420    else if (cannotFindUserManual(strUserManualFileName1))
    34213421    {
    3422         /* Create User Manual downloader: */
    3423         UIDownloaderUserManual *pDl = UIDownloaderUserManual::create();
     3422        /* Download user manual: */
     3423        UINotificationDownloaderUserManual *pNotification = UINotificationDownloaderUserManual::instance(UICommon::helpFile());
    34243424        /* After downloading finished => show User Manual: */
    3425         connect(pDl, &UIDownloaderUserManual::sigDownloadFinished, this, &UIMessageCenter::sltShowUserManual);
    3426         /* Start downloading: */
    3427         pDl->start();
     3425        connect(pNotification, &UINotificationDownloaderUserManual::sigUserManualDownloaded,
     3426                this, &UIMessageCenter::sltShowUserManual);
     3427        /* Append and start notification: */
     3428        notificationCenter().append(pNotification);
    34283429    }
    34293430#endif /* #ifdef VBOX_OSE */
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderUserManual.cpp

    r90541 r90561  
    3131
    3232
    33 /* static */
    34 UIDownloaderUserManual* UIDownloaderUserManual::s_pInstance = 0;
    35 
    36 /* static */
    37 UIDownloaderUserManual* UIDownloaderUserManual::create()
    38 {
    39     if (!s_pInstance)
    40         s_pInstance = new UIDownloaderUserManual;
    41     return s_pInstance;
    42 }
    43 
    4433UIDownloaderUserManual::UIDownloaderUserManual()
    4534{
    46     /* Prepare instance: */
    47     if (!s_pInstance)
    48         s_pInstance = this;
    49 
    5035    /* Get version number and adjust it for test and trunk builds. The server only has official releases. */
    5136    const QString strVersion = UIVersion(uiCommon().vboxVersionStringNormalized()).effectiveReleasedVersion().toString();
     
    6449    QString strUserManualDestination = QDir(uiCommon().homeFolder()).absoluteFilePath(strUserManualShortFileName);
    6550    setTarget(strUserManualDestination);
    66 }
    67 
    68 UIDownloaderUserManual::~UIDownloaderUserManual()
    69 {
    70     /* Cleanup instance: */
    71     if (s_pInstance == this)
    72         s_pInstance = 0;
    7351}
    7452
     
    130108    }
    131109}
    132 
  • trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderUserManual.h

    r90541 r90561  
    3838public:
    3939
    40     /** Creates downloader instance. */
    41     static UIDownloaderUserManual *create();
    42     /** Returns current downloader instance. */
    43     static UIDownloaderUserManual *current() { return s_pInstance; }
     40    /** Constructs downloader. */
     41    UIDownloaderUserManual();
    4442
    4543private:
    46 
    47     /** Constructs downloader. */
    48     UIDownloaderUserManual();
    49     /** Destructs downloader. */
    50     ~UIDownloaderUserManual();
    5144
    5245    /** Returns description of the current network operation. */
     
    5750    /** Handles downloaded object for passed @a pReply. */
    5851    virtual void handleDownloadedObject(UINetworkReply *pReply) /* override */;
    59 
    60     /** Holds the static singleton instance. */
    61     static UIDownloaderUserManual *s_pInstance;
    6252};
    6353
    6454#endif /* !FEQT_INCLUDED_SRC_networking_UIDownloaderUserManual_h */
    65 
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

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

    r90560 r90561  
    11671167};
    11681168
     1169/** UINotificationDownloader extension for user manual downloading functionality. */
     1170class SHARED_LIBRARY_STUFF UINotificationDownloaderUserManual : public UINotificationDownloader
     1171{
     1172    Q_OBJECT;
     1173
     1174signals:
     1175
     1176    /** Notifies listeners about user manual downloaded.
     1177      * @param  strLocation  Brings the UM location. */
     1178    void sigUserManualDownloaded(const QString &strLocation);
     1179
     1180public:
     1181
     1182    /** Returns singleton instance, creates if necessary.
     1183      * @param  strFileName  Brings the file name. */
     1184    static UINotificationDownloaderUserManual *instance(const QString &strFileName);
     1185    /** Returns whether singleton instance already created. */
     1186    static bool exists();
     1187
     1188    /** Destructs user manual downloading notification-progress.
     1189      * @note  Notification-center can destroy us at any time. */
     1190    virtual ~UINotificationDownloaderUserManual() /* override final */;
     1191
     1192protected:
     1193
     1194    /** Constructs user manual downloading notification-progress.
     1195      * @param  strFileName  Brings the file name. */
     1196    UINotificationDownloaderUserManual(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 UINotificationDownloaderUserManual *s_pInstance;
     1209
     1210    /** Holds the name of file being dowloaded. */
     1211    QString  m_strFileName;
     1212};
     1213
    11691214#endif /* !FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjects_h */
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