- Timestamp:
- Aug 7, 2021 7:36:02 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderExtensionPack.cpp
r90541 r90560 34 34 35 35 36 /* static */37 UIDownloaderExtensionPack *UIDownloaderExtensionPack::s_pInstance = 0;38 39 /* static */40 UIDownloaderExtensionPack *UIDownloaderExtensionPack::create()41 {42 if (!s_pInstance)43 s_pInstance = new UIDownloaderExtensionPack;44 return s_pInstance;45 }46 47 36 UIDownloaderExtensionPack::UIDownloaderExtensionPack() 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(); … … 66 51 setTarget(strTarget); 67 52 setPathSHA256SumsFile(strPathSHA256SumsFile); 68 }69 70 UIDownloaderExtensionPack::~UIDownloaderExtensionPack()71 {72 /* Cleanup instance: */73 if (s_pInstance == this)74 s_pInstance = 0;75 53 } 76 54 … … 187 165 } 188 166 } 189 -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderExtensionPack.h
r90541 r90560 43 43 public: 44 44 45 /** Creates downloader instance. */ 46 static UIDownloaderExtensionPack *create(); 47 /** Returns current downloader instance. */ 48 static UIDownloaderExtensionPack *current() { return s_pInstance; } 45 /** Constructs downloader. */ 46 UIDownloaderExtensionPack(); 49 47 50 48 private: 51 52 /** Constructs downloader. */53 UIDownloaderExtensionPack();54 /** Destructs downloader. */55 ~UIDownloaderExtensionPack();56 49 57 50 /** Returns description of the current network operation. */ … … 65 58 virtual void handleVerifiedObject(UINetworkReply *pReply) /* override */; 66 59 67 /** Holds the static singleton instance. */68 static UIDownloaderExtensionPack *s_pInstance;69 70 60 /** Holds the cached received data awaiting for verification. */ 71 61 QByteArray m_receivedData; … … 73 63 74 64 #endif /* !FEQT_INCLUDED_SRC_networking_UIDownloaderExtensionPack_h */ 75 -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIUpdateManager.cpp
r90559 r90560 27 27 #include "UICommon.h" 28 28 #include "VBoxUtils.h" 29 #include "UIDownloaderExtensionPack.h"30 29 #include "UIExtraDataManager.h" 31 30 #include "UIMessageCenter.h" … … 420 419 421 420 /* Return if already downloading: */ 422 if (UI DownloaderExtensionPack::current())421 if (UINotificationDownloaderExtensionPack::exists()) 423 422 { 424 423 emit sigStepComplete(); … … 491 490 492 491 /* Download extension pack: */ 493 UINotificationDownloaderExtensionPack *pNotification = new UINotificationDownloaderExtensionPack(GUI_ExtPackName);492 UINotificationDownloaderExtensionPack *pNotification = UINotificationDownloaderExtensionPack::instance(GUI_ExtPackName); 494 493 /* After downloading finished => propose to install the Extension Pack: */ 495 494 connect(pNotification, &UINotificationDownloaderExtensionPack::sigExtensionPackDownloaded, -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90559 r90560 1492 1492 *********************************************************************************************************************************/ 1493 1493 1494 /* static */ 1495 UINotificationDownloaderExtensionPack *UINotificationDownloaderExtensionPack::s_pInstance = 0; 1496 1497 /* static */ 1498 UINotificationDownloaderExtensionPack *UINotificationDownloaderExtensionPack::instance(const QString &strPackName) 1499 { 1500 if (!s_pInstance) 1501 new UINotificationDownloaderExtensionPack(strPackName); 1502 return s_pInstance; 1503 } 1504 1505 /* static */ 1506 bool UINotificationDownloaderExtensionPack::exists() 1507 { 1508 return !!s_pInstance; 1509 } 1510 1494 1511 UINotificationDownloaderExtensionPack::UINotificationDownloaderExtensionPack(const QString &strPackName) 1495 1512 : m_strPackName(strPackName) 1496 1513 { 1514 s_pInstance = this; 1515 } 1516 1517 UINotificationDownloaderExtensionPack::~UINotificationDownloaderExtensionPack() 1518 { 1519 s_pInstance = 0; 1497 1520 } 1498 1521 … … 1510 1533 { 1511 1534 /* Create and configure the Extension Pack downloader: */ 1512 UIDownloaderExtensionPack *pDownloader = UIDownloaderExtensionPack::create();1535 UIDownloaderExtensionPack *pDownloader = new UIDownloaderExtensionPack; 1513 1536 if (pDownloader) 1514 1537 { -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90559 r90560 1118 1118 }; 1119 1119 1120 /** UINotificationDownloader extension for Extension Pack downloading functionality. */1120 /** UINotificationDownloader extension for extension pack downloading functionality. */ 1121 1121 class SHARED_LIBRARY_STUFF UINotificationDownloaderExtensionPack : public UINotificationDownloader 1122 1122 { … … 1135 1135 public: 1136 1136 1137 /** Constructs host-only network interface remove notification-progress. */ 1137 /** Returns singleton instance, creates if necessary. 1138 * @param strPackName Brings the package name. */ 1139 static UINotificationDownloaderExtensionPack *instance(const QString &strPackName); 1140 /** Returns whether singleton instance already created. */ 1141 static bool exists(); 1142 1143 /** Destructs extension pack downloading notification-progress. 1144 * @note Notification-center can destroy us at any time. */ 1145 virtual ~UINotificationDownloaderExtensionPack() /* override final */; 1146 1147 protected: 1148 1149 /** Constructs extension pack downloading notification-progress. 1150 * @param strPackName Brings the package name. */ 1138 1151 UINotificationDownloaderExtensionPack(const QString &strPackName); 1139 1152 1140 protected:1141 1142 1153 /** Returns object name. */ 1143 1154 virtual QString name() const /* override final */; … … 1149 1160 private: 1150 1161 1151 /** Holds the pack being dowloaded. */ 1162 /** Holds the singleton instance. */ 1163 static UINotificationDownloaderExtensionPack *s_pInstance; 1164 1165 /** Holds the name of pack being dowloaded. */ 1152 1166 QString m_strPackName; 1153 1167 };
Note:
See TracChangeset
for help on using the changeset viewer.