VirtualBox

Ignore:
Timestamp:
Sep 24, 2015 12:33:13 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Selector UI: Network Manager indicator which permanently added into selector-window should be managed/cleared by the selector-window as well (not by the Network Manager).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.cpp

    r52730 r57877  
    6767}
    6868
    69 UINetworkManagerIndicator* UINetworkManager::indicator() const
    70 {
    71     return m_pNetworkManagerIndicator;
     69UINetworkManagerIndicator* UINetworkManager::createIndicator() const
     70{
     71    /* For Selector UI only: */
     72    AssertReturn(!vboxGlobal().isVMConsoleProcess(), 0);
     73
     74    /* Create network-manager state-indicator: */
     75    UINetworkManagerIndicator *pNetworkManagerIndicator = new UINetworkManagerIndicator;
     76    connect(pNetworkManagerIndicator, SIGNAL(sigMouseDoubleClick(QIStatusBarIndicator*, QMouseEvent*)),
     77            this, SLOT(show()));
     78    connect(this, SIGNAL(sigAddNetworkManagerIndicatorDescription(UINetworkRequest*)),
     79            pNetworkManagerIndicator, SLOT(sltAddNetworkManagerIndicatorDescription(UINetworkRequest*)));
     80    connect(this, SIGNAL(sigRemoveNetworkManagerIndicatorDescription(const QUuid &)),
     81            pNetworkManagerIndicator, SLOT(sldRemoveNetworkManagerIndicatorDescription(const QUuid &)));
     82    return pNetworkManagerIndicator;
     83}
     84
     85void UINetworkManager::registerNetworkRequest(UINetworkRequest *pNetworkRequest)
     86{
     87    /* Add network-request widget to network-manager dialog: */
     88    m_pNetworkManagerDialog->addNetworkRequestWidget(pNetworkRequest);
     89
     90    /* Add network-request description to network-manager state-indicators: */
     91    emit sigAddNetworkManagerIndicatorDescription(pNetworkRequest);
     92}
     93
     94void UINetworkManager::unregisterNetworkRequest(const QUuid &uuid)
     95{
     96    /* Remove network-request description from network-manager state-indicator: */
     97    emit sigRemoveNetworkManagerIndicatorDescription(uuid);
     98
     99    /* Remove network-request widget from network-manager dialog: */
     100    m_pNetworkManagerDialog->removeNetworkRequestWidget(uuid);
    72101}
    73102
     
    98127UINetworkManager::UINetworkManager()
    99128    : m_pNetworkManagerDialog(0)
    100     , m_pNetworkManagerIndicator(0)
    101129{
    102130    /* Prepare instance: */
     
    115143    m_pNetworkManagerDialog = new UINetworkManagerDialog;
    116144    connect(m_pNetworkManagerDialog, SIGNAL(sigCancelNetworkRequests()), this, SIGNAL(sigCancelNetworkRequests()));
    117 
    118     /* Prepare network-manager state-indicator: */
    119     if (!vboxGlobal().isVMConsoleProcess())
    120     {
    121         m_pNetworkManagerIndicator = new UINetworkManagerIndicator;
    122         connect(m_pNetworkManagerIndicator, SIGNAL(sigMouseDoubleClick(QIStatusBarIndicator*, QMouseEvent*)), this, SLOT(show()));
    123     }
    124145}
    125146
     
    128149    /* Cleanup network-requests first: */
    129150    cleanupNetworkRequests();
    130 
    131     /* Cleanup network-manager state-indicator: */
    132     if (!vboxGlobal().isVMConsoleProcess())
    133     {
    134         delete m_pNetworkManagerIndicator;
    135         m_pNetworkManagerIndicator = 0;
    136     }
    137151
    138152    /* Cleanup network-manager dialog: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h

    r55401 r57877  
    4646    void sigCancelNetworkRequests();
    4747
     48    /** Requests to add @a pNetworkRequest to network-manager state-indicators. */
     49    void sigAddNetworkManagerIndicatorDescription(UINetworkRequest *pNetworkRequest);
     50    /** Requests to remove network-request with @a uuid from network-manager state-indicators. */
     51    void sigRemoveNetworkManagerIndicatorDescription(const QUuid &uuid);
     52
    4853public:
    4954
     
    5863    UINetworkManagerDialog* window() const;
    5964
    60     /* Pointer to network-manager state-indicator: */
    61     UINetworkManagerIndicator* indicator() const;
     65    /** Creates network-manager state-indicator.
     66      * @remarks To be cleaned up by the caller. */
     67    UINetworkManagerIndicator* createIndicator() const;
     68
     69    /** Registers @a pNetworkRequest in network-manager. */
     70    void registerNetworkRequest(UINetworkRequest *pNetworkRequest);
     71    /** Unregisters network-request with @a uuid from network-manager. */
     72    void unregisterNetworkRequest(const QUuid &uuid);
    6273
    6374public slots:
     
    114125    /* Network-manager dialog: */
    115126    UINetworkManagerDialog *m_pNetworkManagerDialog;
    116     UINetworkManagerIndicator *m_pNetworkManagerIndicator;
    117127};
    118128#define gNetworkManager UINetworkManager::instance()
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.cpp

    r56039 r57877  
    4040}
    4141
    42 void UINetworkManagerIndicator::addNetworkRequest(UINetworkRequest *pNetworkRequest)
     42void UINetworkManagerIndicator::sltAddNetworkManagerIndicatorDescription(UINetworkRequest *pNetworkRequest)
    4343{
    4444    /* Make sure network-request is really exists: */
     
    6767}
    6868
    69 void UINetworkManagerIndicator::removeNetworkRequest(const QUuid &uuid)
     69void UINetworkManagerIndicator::sldRemoveNetworkManagerIndicatorDescription(const QUuid &uuid)
    7070{
    7171    /* Make sure network-request still registered: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.h

    r55401 r57877  
    4444public:
    4545
     46    /* Constructor: */
     47    UINetworkManagerIndicator();
     48
    4649    /** Update routine. */
    4750    void updateAppearance();
    4851
    49 protected:
     52private slots:
    5053
    51     /* Allow creation of UINetworkManagerIndicator to UINetworkManager: */
    52     friend class UINetworkManager;
    53     /* Constructor: */
    54     UINetworkManagerIndicator();
    55 
    56     /* Allow adding/removing network-request tokens to UINetworkRequest: */
    57     friend class UINetworkRequest;
    58     /* Add network-request token: */
    59     void addNetworkRequest(UINetworkRequest *pNetworkRequest);
    60     /* Remove network-request token: */
    61     void removeNetworkRequest(const QUuid &uuid);
    62 
    63 private slots:
     54    /** Adds @a pNetworkRequest to network-manager state-indicators. */
     55    void sltAddNetworkManagerIndicatorDescription(UINetworkRequest *pNetworkRequest);
     56    /** Removes network-request with @a uuid from network-manager state-indicators. */
     57    void sldRemoveNetworkManagerIndicatorDescription(const QUuid &uuid);
    6458
    6559    /* Set particular network-request progress to 'started': */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.cpp

    r52730 r57877  
    4040                                   UINetworkManager *pNetworkManager)
    4141    : QObject(pNetworkManager)
    42     , m_pNetworkManagerDialog(pNetworkManager->window())
    43     , m_pNetworkManagerIndicator(pNetworkManager->indicator())
    4442    , m_uuid(QUuid::createUuid())
    4543    , m_requests(QList<QNetworkRequest>() << request)
     
    5856                                   UINetworkManager *pNetworkManager)
    5957    : QObject(pNetworkManager)
    60     , m_pNetworkManagerDialog(pNetworkManager->window())
    61     , m_pNetworkManagerIndicator(pNetworkManager->indicator())
    6258    , m_uuid(QUuid::createUuid())
    6359    , m_requests(requests)
     
    7874    cleanupNetworkReply();
    7975
    80     /* Remove network-request description from network-manager state-indicator: */
    81     if (m_pNetworkManagerIndicator)
    82         m_pNetworkManagerIndicator->removeNetworkRequest(m_uuid);
    83 
    84     /* Remove network-request widget from network-manager dialog: */
    85     m_pNetworkManagerDialog->removeNetworkRequestWidget(m_uuid);
     76    /* Unregister network-request from network-manager: */
     77    manager()->unregisterNetworkRequest(m_uuid);
     78}
     79
     80UINetworkManager* UINetworkRequest::manager() const
     81{
     82    AssertPtrReturn(parent(), 0);
     83    return qobject_cast<UINetworkManager*>(parent());
    8684}
    8785
     
    188186    connect(parent(), SIGNAL(sigCancelNetworkRequests()), this, SLOT(sltCancel()), Qt::QueuedConnection);
    189187
    190     /* Create network-request widget in network-manager dialog: */
    191     m_pNetworkManagerDialog->addNetworkRequestWidget(this);
    192 
    193     /* Create network-request description in network-manager state-indicator: */
    194     if (m_pNetworkManagerIndicator)
    195         m_pNetworkManagerIndicator->addNetworkRequest(this);
     188    /* Register network-request in network-manager: */
     189    manager()->registerNetworkRequest(this);
    196190
    197191    /* Choose first network-request as current: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h

    r55401 r57877  
    6666    ~UINetworkRequest();
    6767
     68    /** Returns parent network-manager. */
     69    UINetworkManager* manager() const;
    6870    /* Getters: */
    6971    const QUuid& uuid() const { return m_uuid; }
     
    9698    void abortNetworkReply();
    9799
    98     /* Widgets: */
    99     UINetworkManagerDialog *m_pNetworkManagerDialog;
    100     UINetworkManagerIndicator *m_pNetworkManagerIndicator;
    101 
    102100    /* Variables: */
    103101    QUuid m_uuid;
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r57844 r57877  
    14541454
    14551455    /* Add network-manager indicator: */
    1456     UINetworkManagerIndicator *pIndicator = gNetworkManager->indicator();
     1456    UINetworkManagerIndicator *pIndicator = gNetworkManager->createIndicator();
    14571457    statusBar()->addPermanentWidget(pIndicator);
    14581458    pIndicator->updateAppearance();
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