Changeset 57877 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 24, 2015 12:33:13 PM (9 years ago)
- 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 67 67 } 68 68 69 UINetworkManagerIndicator* UINetworkManager::indicator() const 70 { 71 return m_pNetworkManagerIndicator; 69 UINetworkManagerIndicator* 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 85 void 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 94 void 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); 72 101 } 73 102 … … 98 127 UINetworkManager::UINetworkManager() 99 128 : m_pNetworkManagerDialog(0) 100 , m_pNetworkManagerIndicator(0)101 129 { 102 130 /* Prepare instance: */ … … 115 143 m_pNetworkManagerDialog = new UINetworkManagerDialog; 116 144 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 }124 145 } 125 146 … … 128 149 /* Cleanup network-requests first: */ 129 150 cleanupNetworkRequests(); 130 131 /* Cleanup network-manager state-indicator: */132 if (!vboxGlobal().isVMConsoleProcess())133 {134 delete m_pNetworkManagerIndicator;135 m_pNetworkManagerIndicator = 0;136 }137 151 138 152 /* Cleanup network-manager dialog: */ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h
r55401 r57877 46 46 void sigCancelNetworkRequests(); 47 47 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 48 53 public: 49 54 … … 58 63 UINetworkManagerDialog* window() const; 59 64 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); 62 73 63 74 public slots: … … 114 125 /* Network-manager dialog: */ 115 126 UINetworkManagerDialog *m_pNetworkManagerDialog; 116 UINetworkManagerIndicator *m_pNetworkManagerIndicator;117 127 }; 118 128 #define gNetworkManager UINetworkManager::instance() -
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.cpp
r56039 r57877 40 40 } 41 41 42 void UINetworkManagerIndicator:: addNetworkRequest(UINetworkRequest *pNetworkRequest)42 void UINetworkManagerIndicator::sltAddNetworkManagerIndicatorDescription(UINetworkRequest *pNetworkRequest) 43 43 { 44 44 /* Make sure network-request is really exists: */ … … 67 67 } 68 68 69 void UINetworkManagerIndicator:: removeNetworkRequest(const QUuid &uuid)69 void UINetworkManagerIndicator::sldRemoveNetworkManagerIndicatorDescription(const QUuid &uuid) 70 70 { 71 71 /* Make sure network-request still registered: */ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.h
r55401 r57877 44 44 public: 45 45 46 /* Constructor: */ 47 UINetworkManagerIndicator(); 48 46 49 /** Update routine. */ 47 50 void updateAppearance(); 48 51 49 pr otected:52 private slots: 50 53 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); 64 58 65 59 /* Set particular network-request progress to 'started': */ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.cpp
r52730 r57877 40 40 UINetworkManager *pNetworkManager) 41 41 : QObject(pNetworkManager) 42 , m_pNetworkManagerDialog(pNetworkManager->window())43 , m_pNetworkManagerIndicator(pNetworkManager->indicator())44 42 , m_uuid(QUuid::createUuid()) 45 43 , m_requests(QList<QNetworkRequest>() << request) … … 58 56 UINetworkManager *pNetworkManager) 59 57 : QObject(pNetworkManager) 60 , m_pNetworkManagerDialog(pNetworkManager->window())61 , m_pNetworkManagerIndicator(pNetworkManager->indicator())62 58 , m_uuid(QUuid::createUuid()) 63 59 , m_requests(requests) … … 78 74 cleanupNetworkReply(); 79 75 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 80 UINetworkManager* UINetworkRequest::manager() const 81 { 82 AssertPtrReturn(parent(), 0); 83 return qobject_cast<UINetworkManager*>(parent()); 86 84 } 87 85 … … 188 186 connect(parent(), SIGNAL(sigCancelNetworkRequests()), this, SLOT(sltCancel()), Qt::QueuedConnection); 189 187 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); 196 190 197 191 /* Choose first network-request as current: */ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h
r55401 r57877 66 66 ~UINetworkRequest(); 67 67 68 /** Returns parent network-manager. */ 69 UINetworkManager* manager() const; 68 70 /* Getters: */ 69 71 const QUuid& uuid() const { return m_uuid; } … … 96 98 void abortNetworkReply(); 97 99 98 /* Widgets: */99 UINetworkManagerDialog *m_pNetworkManagerDialog;100 UINetworkManagerIndicator *m_pNetworkManagerIndicator;101 102 100 /* Variables: */ 103 101 QUuid m_uuid; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r57844 r57877 1454 1454 1455 1455 /* Add network-manager indicator: */ 1456 UINetworkManagerIndicator *pIndicator = gNetworkManager-> indicator();1456 UINetworkManagerIndicator *pIndicator = gNetworkManager->createIndicator(); 1457 1457 statusBar()->addPermanentWidget(pIndicator); 1458 1458 pIndicator->updateAppearance();
Note:
See TracChangeset
for help on using the changeset viewer.