Changeset 90568 in vbox
- Timestamp:
- Aug 7, 2021 12:10:50 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 146174
- 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 34 34 35 35 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 47 36 UIDownloaderAdditions::UIDownloaderAdditions() 48 37 { 49 /* Prepare instance: */50 if (!s_pInstance)51 s_pInstance = this;52 53 38 /* Get version number and adjust it for test and trunk builds. The server only has official releases. */ 54 39 const QString strVersion = UIVersion(uiCommon().vboxVersionStringNormalized()).effectiveReleasedVersion().toString(); … … 65 50 setTarget(strTarget); 66 51 setPathSHA256SumsFile(strPathSHA256SumsFile); 67 }68 69 UIDownloaderAdditions::~UIDownloaderAdditions()70 {71 /* Cleanup instance: */72 if (s_pInstance == this)73 s_pInstance = 0;74 52 } 75 53 -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderAdditions.h
r90541 r90568 41 41 public: 42 42 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(); 47 45 48 46 private: 49 50 /** Constructs downloader. */51 UIDownloaderAdditions();52 /** Destructs downloader. */53 ~UIDownloaderAdditions();54 47 55 48 /** Returns description of the current network operation. */ … … 63 56 virtual void handleVerifiedObject(UINetworkReply *pReply) /* override */; 64 57 65 /** Holds the static singleton instance. */66 static UIDownloaderAdditions *s_pInstance;67 68 58 /** Holds the cached received data awaiting for verification. */ 69 59 QByteArray m_receivedData; -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90561 r90568 22 22 /* GUI includes: */ 23 23 #include "UICommon.h" 24 #include "UIDownloaderAdditions.h" 24 25 #include "UIDownloaderExtensionPack.h" 25 26 #include "UIDownloaderUserManual.h" … … 1546 1547 1547 1548 /********************************************************************************************************************************* 1549 * Class UINotificationDownloaderGuestAdditions implementation. * 1550 *********************************************************************************************************************************/ 1551 1552 /* static */ 1553 UINotificationDownloaderGuestAdditions *UINotificationDownloaderGuestAdditions::s_pInstance = 0; 1554 1555 /* static */ 1556 UINotificationDownloaderGuestAdditions *UINotificationDownloaderGuestAdditions::instance(const QString &strFileName) 1557 { 1558 if (!s_pInstance) 1559 new UINotificationDownloaderGuestAdditions(strFileName); 1560 return s_pInstance; 1561 } 1562 1563 /* static */ 1564 bool UINotificationDownloaderGuestAdditions::exists() 1565 { 1566 return !!s_pInstance; 1567 } 1568 1569 UINotificationDownloaderGuestAdditions::UINotificationDownloaderGuestAdditions(const QString &strFileName) 1570 : m_strFileName(strFileName) 1571 { 1572 s_pInstance = this; 1573 } 1574 1575 UINotificationDownloaderGuestAdditions::~UINotificationDownloaderGuestAdditions() 1576 { 1577 s_pInstance = 0; 1578 } 1579 1580 QString UINotificationDownloaderGuestAdditions::name() const 1581 { 1582 return UINotificationDownloader::tr("Downloading Guest Additions ..."); 1583 } 1584 1585 QString UINotificationDownloaderGuestAdditions::details() const 1586 { 1587 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strFileName); 1588 } 1589 1590 UIDownloader *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 /********************************************************************************************************************************* 1548 1605 * Class UINotificationDownloaderUserManual implementation. * 1549 1606 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90561 r90568 1167 1167 }; 1168 1168 1169 /** UINotificationDownloader extension for guest additions downloading functionality. */ 1170 class SHARED_LIBRARY_STUFF UINotificationDownloaderGuestAdditions : public UINotificationDownloader 1171 { 1172 Q_OBJECT; 1173 1174 signals: 1175 1176 /** Notifies listeners about guest additions downloaded. 1177 * @param strLocation Brings the UM location. */ 1178 void sigGuestAdditionsDownloaded(const QString &strLocation); 1179 1180 public: 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 1192 protected: 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 1205 private: 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 1169 1214 /** UINotificationDownloader extension for user manual downloading functionality. */ 1170 1215 class SHARED_LIBRARY_STUFF UINotificationDownloaderUserManual : public UINotificationDownloader -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r90539 r90568 35 35 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 36 36 # include "UINetworkRequestManager.h" 37 # include "UI DownloaderAdditions.h"37 # include "UINotificationCenter.h" 38 38 #endif 39 39 #include "UIHostComboEditor.h" … … 2525 2525 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 2526 2526 /* If downloader is running already: */ 2527 if (UI DownloaderAdditions::current())2527 if (UINotificationDownloaderGuestAdditions::exists()) 2528 2528 { 2529 2529 /// @todo show notification-center … … 2532 2532 else if (msgCenter().cannotFindGuestAdditions()) 2533 2533 { 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); 2540 2541 } 2541 2542 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
Note:
See TracChangeset
for help on using the changeset viewer.