Changeset 90561 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 7, 2021 9:04:01 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 146167
- 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 45 45 #endif 46 46 #ifdef VBOX_OSE 47 # include "UI DownloaderUserManual.h"47 # include "UINotificationCenter.h" 48 48 #endif 49 49 #ifdef VBOX_WS_MAC … … 3420 3420 else if (cannotFindUserManual(strUserManualFileName1)) 3421 3421 { 3422 /* Create User Manual downloader: */3423 UI DownloaderUserManual *pDl = UIDownloaderUserManual::create();3422 /* Download user manual: */ 3423 UINotificationDownloaderUserManual *pNotification = UINotificationDownloaderUserManual::instance(UICommon::helpFile()); 3424 3424 /* 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); 3428 3429 } 3429 3430 #endif /* #ifdef VBOX_OSE */ -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderUserManual.cpp
r90541 r90561 31 31 32 32 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 44 33 UIDownloaderUserManual::UIDownloaderUserManual() 45 34 { 46 /* Prepare instance: */47 if (!s_pInstance)48 s_pInstance = this;49 50 35 /* Get version number and adjust it for test and trunk builds. The server only has official releases. */ 51 36 const QString strVersion = UIVersion(uiCommon().vboxVersionStringNormalized()).effectiveReleasedVersion().toString(); … … 64 49 QString strUserManualDestination = QDir(uiCommon().homeFolder()).absoluteFilePath(strUserManualShortFileName); 65 50 setTarget(strUserManualDestination); 66 }67 68 UIDownloaderUserManual::~UIDownloaderUserManual()69 {70 /* Cleanup instance: */71 if (s_pInstance == this)72 s_pInstance = 0;73 51 } 74 52 … … 130 108 } 131 109 } 132 -
trunk/src/VBox/Frontends/VirtualBox/src/networking/UIDownloaderUserManual.h
r90541 r90561 38 38 public: 39 39 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(); 44 42 45 43 private: 46 47 /** Constructs downloader. */48 UIDownloaderUserManual();49 /** Destructs downloader. */50 ~UIDownloaderUserManual();51 44 52 45 /** Returns description of the current network operation. */ … … 57 50 /** Handles downloaded object for passed @a pReply. */ 58 51 virtual void handleDownloadedObject(UINetworkReply *pReply) /* override */; 59 60 /** Holds the static singleton instance. */61 static UIDownloaderUserManual *s_pInstance;62 52 }; 63 53 64 54 #endif /* !FEQT_INCLUDED_SRC_networking_UIDownloaderUserManual_h */ 65 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90560 r90561 23 23 #include "UICommon.h" 24 24 #include "UIDownloaderExtensionPack.h" 25 #include "UIDownloaderUserManual.h" 25 26 #include "UINotificationObjects.h" 26 27 … … 1542 1543 return 0; 1543 1544 } 1545 1546 1547 /********************************************************************************************************************************* 1548 * Class UINotificationDownloaderUserManual implementation. * 1549 *********************************************************************************************************************************/ 1550 1551 /* static */ 1552 UINotificationDownloaderUserManual *UINotificationDownloaderUserManual::s_pInstance = 0; 1553 1554 /* static */ 1555 UINotificationDownloaderUserManual *UINotificationDownloaderUserManual::instance(const QString &strFileName) 1556 { 1557 if (!s_pInstance) 1558 new UINotificationDownloaderUserManual(strFileName); 1559 return s_pInstance; 1560 } 1561 1562 /* static */ 1563 bool UINotificationDownloaderUserManual::exists() 1564 { 1565 return !!s_pInstance; 1566 } 1567 1568 UINotificationDownloaderUserManual::UINotificationDownloaderUserManual(const QString &strFileName) 1569 : m_strFileName(strFileName) 1570 { 1571 s_pInstance = this; 1572 } 1573 1574 UINotificationDownloaderUserManual::~UINotificationDownloaderUserManual() 1575 { 1576 s_pInstance = 0; 1577 } 1578 1579 QString UINotificationDownloaderUserManual::name() const 1580 { 1581 return UINotificationDownloader::tr("Downloading User Manual ..."); 1582 } 1583 1584 QString UINotificationDownloaderUserManual::details() const 1585 { 1586 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strFileName); 1587 } 1588 1589 UIDownloader *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 1167 1167 }; 1168 1168 1169 /** UINotificationDownloader extension for user manual downloading functionality. */ 1170 class SHARED_LIBRARY_STUFF UINotificationDownloaderUserManual : public UINotificationDownloader 1171 { 1172 Q_OBJECT; 1173 1174 signals: 1175 1176 /** Notifies listeners about user manual downloaded. 1177 * @param strLocation Brings the UM location. */ 1178 void sigUserManualDownloaded(const QString &strLocation); 1179 1180 public: 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 1192 protected: 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 1205 private: 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 1169 1214 #endif /* !FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjects_h */
Note:
See TracChangeset
for help on using the changeset viewer.