Changeset 39326 in vbox
- Timestamp:
- Nov 16, 2011 10:44:17 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 21 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r39188 r39326 2946 2946 else if (!UIDownloaderUserManual::current() && askAboutUserManualDownload(strUserManualFileName1)) 2947 2947 { 2948 /* Create User Manual downloader: */2948 /* Create and configure the User Manual downloader: */ 2949 2949 UIDownloaderUserManual *pDl = UIDownloaderUserManual::create(); 2950 /* Configure User Manual downloader: */2951 2950 CVirtualBox vbox = vboxGlobal().virtualBox(); 2952 2951 pDl->addSource(QString("http://download.virtualbox.org/virtualbox/%1/").arg(vboxGlobal().vboxVersionStringNormalized()) + strShortFileName); … … 2954 2953 pDl->setTarget(strUserManualFileName2); 2955 2954 pDl->setParentWidget(mainWindowShown()); 2956 /* After the download is finished => show the document: */2955 /* After downloading finished => show the User Manual: */ 2957 2956 connect(pDl, SIGNAL(sigDownloadFinished(const QString&)), this, SLOT(sltShowUserManual(const QString&))); 2958 /* Notify listeners: */ 2959 emit sigDownloaderUserManualCreated(); 2960 /* Start the downloader: */ 2957 /* Start downloading: */ 2961 2958 pDl->start(); 2962 2959 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r39188 r39326 431 431 signals: 432 432 433 void sigDownloaderUserManualCreated();434 433 void sigToCloseAllWarnings(); 435 434 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.cpp
r38421 r39326 127 127 connect(this, SIGNAL(sigToStartAcknowledging()), this, SLOT(sltStartAcknowledging()), Qt::QueuedConnection); 128 128 connect(this, SIGNAL(sigToStartDownloading()), this, SLOT(sltStartDownloading()), Qt::QueuedConnection); 129 connect(this, SIGNAL(sigDownloadingStarted(UIDownloadType)), gNetworkManager, SIGNAL(sigDownloaderCreated(UIDownloadType))); 129 130 } 130 131 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.h
r38421 r39326 24 24 #include <QUrl> 25 25 #include <QPointer> 26 27 /* Local includes: */ 28 #include "UINetworkDefs.h" 26 29 27 30 /* Forward declarations: */ … … 124 127 void sigDownloadProgress(qint64 cDone, qint64 cTotal); 125 128 129 /* Notifies network manager about downloading started: */ 130 void sigDownloadingStarted(UIDownloadType downloadType); 131 126 132 protected: 127 133 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp
r38421 r39326 53 53 { 54 54 return m_pAction; 55 } 56 57 void UIDownloaderAdditions::start() 58 { 59 /* Call for base-class: */ 60 UIDownloader::start(); 61 /* Notify about downloading started: */ 62 emit sigDownloadingStarted(UIDownloadType_Additions); 55 63 } 56 64 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.h
r38421 r39326 59 59 QAction *action() const; 60 60 61 void start(); 62 61 63 signals: 62 64 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp
r38575 r39326 54 54 void UIDownloaderExtensionPack::download(QObject *pListener) 55 55 { 56 /* Create downloader instance: */56 /* Create and configure the Extension Pack downloader: */ 57 57 UIDownloaderExtensionPack *pDownloader = new UIDownloaderExtensionPack; 58 58 pDownloader->setParentWidget(msgCenter().mainWindowShown()); 59 60 /* Configure connections for the passed listener: */ 61 connect(pDownloader, SIGNAL(sigToStartAcknowledging()), 62 pListener, SIGNAL(sigDownloaderCreatedForExtensionPack())); 59 /* After downloading finished => propose to install the Extension Pack: */ 63 60 connect(pDownloader, SIGNAL(sigNotifyAboutExtensionPackDownloaded(const QString &, const QString &)), 64 61 pListener, SLOT(sltHandleDownloadedExtensionPack(const QString &, const QString &))); 62 /* Start downloading: */ 63 pDownloader->start(); 64 } 65 66 void UIDownloaderExtensionPack::start() 67 { 68 /* Call for base-class: */ 69 UIDownloader::start(); 70 /* Notify about downloading started: */ 71 emit sigDownloadingStarted(UIDownloadType_ExtensionPack); 65 72 } 66 73 … … 85 92 setSource(strSource); 86 93 setTarget(strTarget); 87 88 /* Start downloading: */89 start();90 94 } 91 95 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.h
r38476 r39326 57 57 void sigNotifyAboutExtensionPackDownloaded(const QString &strSource, const QString &strTarget); 58 58 59 protected: 60 61 /* Starts downloading: */ 62 void start(); 63 59 64 private: 60 65 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.cpp
r38421 r39326 59 59 void UIDownloaderUserManual::start() 60 60 { 61 /* If at least one source to try left: */ 62 if (!m_sourcesList.isEmpty()) 63 { 64 /* Set the first of left sources as current one: */ 65 UIDownloader::setSource(m_sourcesList.takeFirst()); 66 /* Warn process-bar(s) about source was changed: */ 67 emit sigSourceChanged(source()); 68 /* Try to download: */ 69 startDelayedAcknowledging(); 70 } 61 /* Start downloading: */ 62 startDownloading(); 63 /* Notify about downloading started: */ 64 emit sigDownloadingStarted(UIDownloadType_UserManual); 71 65 } 72 66 … … 82 76 } 83 77 78 void UIDownloaderUserManual::startDownloading() 79 { 80 /* If at least one source to try left: */ 81 if (!m_sourcesList.isEmpty()) 82 { 83 /* Set the first of left sources as current one: */ 84 UIDownloader::setSource(m_sourcesList.takeFirst()); 85 /* Warn process-bar(s) about source was changed: */ 86 emit sigSourceChanged(source()); 87 /* Try to download: */ 88 startDelayedAcknowledging(); 89 } 90 } 91 84 92 void UIDownloaderUserManual::handleError(QNetworkReply *pReply) 85 93 { … … 88 96 { 89 97 /* Restart acknowledging: */ 90 start ();98 startDownloading(); 91 99 } 92 100 else -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.h
r38421 r39326 79 79 ~UIDownloaderUserManual(); 80 80 81 void startDownloading(); 82 81 83 void handleError(QNetworkReply *pReply); 82 84 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkDefs.h
r39291 r39326 2 2 * 3 3 * VBox frontends: Qt4 GUI ("VirtualBox"): 4 * Updateroutine related declarations4 * Network routine related declarations 5 5 */ 6 6 7 7 /* 8 * Copyright (C) 20 06-2011 Oracle Corporation8 * Copyright (C) 2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 17 17 */ 18 18 19 #ifndef __UI UpdateDefs_h__20 #define __UI UpdateDefs_h__19 #ifndef __UINetworkDefs_h__ 20 #define __UINetworkDefs_h__ 21 21 22 /* Global includes: */ 23 #include <QDate> 24 25 /* This structure is used to store retranslated reminder values. */ 26 struct VBoxUpdateDay 22 /* Download types: */ 23 enum UIDownloadType 27 24 { 28 VBoxUpdateDay(const QString &strVal, const QString &strKey) 29 : val(strVal), key(strKey) {} 30 31 bool operator==(const VBoxUpdateDay &other) { return val == other.val || key == other.key; } 32 33 QString val; 34 QString key; 35 }; 36 typedef QList<VBoxUpdateDay> VBoxUpdateDayList; 37 38 /* This class is used to encode/decode update data. */ 39 class VBoxUpdateData 40 { 41 public: 42 43 /* Period types: */ 44 enum PeriodType 45 { 46 PeriodNever = -2, 47 PeriodUndefined = -1, 48 Period1Day = 0, 49 Period2Days = 1, 50 Period3Days = 2, 51 Period4Days = 3, 52 Period5Days = 4, 53 Period6Days = 5, 54 Period1Week = 6, 55 Period2Weeks = 7, 56 Period3Weeks = 8, 57 Period1Month = 9 58 }; 59 60 /* Branch types: */ 61 enum BranchType 62 { 63 BranchStable = 0, 64 BranchAllRelease = 1, 65 BranchWithBetas = 2 66 }; 67 68 /* Public static helpers: */ 69 static void populate(); 70 static QStringList list(); 71 72 /* Constructors: */ 73 VBoxUpdateData(const QString &strData); 74 VBoxUpdateData(PeriodType periodIndex, BranchType branchIndex); 75 76 /* Public helpers: */ 77 bool isNoNeedToCheck() const; 78 bool isNeedToCheck() const; 79 QString data() const; 80 PeriodType periodIndex() const; 81 QString date() const; 82 BranchType branchIndex() const; 83 QString branchName() const; 84 85 private: 86 87 /* Private helpers: */ 88 void decode(); 89 void encode(); 90 91 /* Private variables: */ 92 static VBoxUpdateDayList m_dayList; 93 QString m_strData; 94 PeriodType m_periodIndex; 95 QDate m_date; 96 BranchType m_branchIndex; 25 UIDownloadType_Additions, 26 UIDownloadType_UserManual, 27 UIDownloadType_ExtensionPack, 28 UIDownloadType_Max 97 29 }; 98 30 99 #endif // __UI UpdateDefs_h__31 #endif // __UINetworkDefs_h__ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h
r38421 r39326 23 23 #include <QNetworkAccessManager> 24 24 25 /* Local inludes: */ 26 #include "UINetworkDefs.h" 27 25 28 /* QNetworkAccessManager class reimplementation providing 26 29 * network access for the VirtualBox application purposes. */ … … 37 40 static void create(); 38 41 static void destroy(); 42 43 signals: 44 45 /* Signal to notify listeners about downloader creation: */ 46 void sigDownloaderCreated(UIDownloadType downloaderType); 39 47 40 48 private: -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
r39190 r39326 79 79 #ifdef VBOX_WITH_UPDATE_REQUEST 80 80 /* Ask updater to check for the first time: */ 81 QTimer::singleShot(0, this, SLOT(sltCheckIfUpdateIsNecessary())); 81 if (!vboxGlobal().isVMConsoleProcess()) 82 QTimer::singleShot(0, this, SLOT(sltCheckIfUpdateIsNecessary())); 82 83 #endif /* VBOX_WITH_UPDATE_REQUEST */ 83 84 } -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.h
r38476 r39326 43 43 /* Manager instance: */ 44 44 static UIUpdateManager* instance() { return m_pInstance; } 45 46 signals:47 48 /* Signal to notify listeners about downloading: */49 void sigDownloaderCreatedForExtensionPack();50 45 51 46 public slots: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r38815 r39326 1502 1502 if (result == QIMessageBox::Yes) 1503 1503 { 1504 /* Create and configure the Additions downloader: */ 1505 UIDownloaderAdditions *pDl = UIDownloaderAdditions::create(); 1504 1506 const QString &source = QString("http://download.virtualbox.org/virtualbox/%1/").arg(vboxGlobal().vboxVersionStringNormalized()) + name; 1505 1507 const QString &target = QDir(vboxGlobal().virtualBox().GetHomeFolder()).absoluteFilePath(name); 1506 1507 UIDownloaderAdditions *pDl = UIDownloaderAdditions::create();1508 /* Configure the additions downloader. */1509 1508 pDl->setSource(source); 1510 1509 pDl->setTarget(target); 1511 1510 pDl->setAction(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools)); 1512 1511 pDl->setParentWidget(mainMachineWindow()->machineWindow()); 1513 /* After the download is finished the user may like to install the 1514 * additions.*/ 1512 /* After downloading finished => propose to install the Additions: */ 1515 1513 connect(pDl, SIGNAL(sigDownloadFinished(const QString&)), 1516 1514 uisession(), SLOT(sltInstallGuestAdditionsFrom(const QString&))); 1517 /* Some of the modes may show additional info of the download progress: */ 1518 emit sigDownloaderAdditionsCreated(); 1519 /* Start the download: */ 1515 /* Start downloading: */ 1520 1516 pDl->start(); 1521 1517 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r38477 r39326 81 81 #endif /* Q_WS_MAC */ 82 82 83 signals:84 85 /* Signal to notify listeners about additions downloader created: */86 void sigDownloaderAdditionsCreated();87 88 83 protected: 89 84 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r38477 r39326 26 26 #include "UIExtraDataEventHandler.h" 27 27 #include "UIImageTools.h" 28 #include "UIUpdateManager.h"29 28 30 29 /* Global includes */ … … 275 274 #endif 276 275 277 #if defined(Q_WS_MAC) && (QT_VERSION < 0x040700)278 if (m_fIsFirstTime)279 # endif280 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_Update));281 276 #ifndef Q_WS_MAC 282 277 pMenu->addSeparator(); … … 287 282 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_About)); 288 283 289 290 284 #if defined(Q_WS_MAC) && (QT_VERSION < 0x040700) 291 285 /* Because this connections are done to VBoxGlobal, they are needed once only. … … 296 290 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_About), SIGNAL(triggered()), 297 291 &msgCenter(), SLOT(sltShowHelpAboutDialog())); 298 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_Update), SIGNAL(triggered()),299 gUpdateManager, SLOT(sltForceCheck()));300 292 #if defined(Q_WS_MAC) && (QT_VERSION < 0x040700) 301 293 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r38476 r39326 31 31 #include "UIMachineWindow.h" 32 32 #include "UIDownloaderAdditions.h" 33 #include "UIDownloaderUserManual.h" 33 34 #include "UIDownloaderExtensionPack.h" 34 35 … … 80 81 /* If there is an Additions download running, update the parent window information. */ 81 82 if (UIDownloaderAdditions *pDl = UIDownloaderAdditions::current()) 83 pDl->setParentWidget(mainMachineWindow()->machineWindow()); 84 85 /* If there is an User Manual download running, update the parent window information. */ 86 if (UIDownloaderUserManual *pDl = UIDownloaderUserManual::current()) 82 87 pDl->setParentWidget(mainMachineWindow()->machineWindow()); 83 88 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r39298 r39326 37 37 #include "UIMachineWindowNormal.h" 38 38 #include "UIMachineView.h" 39 #include "UI UpdateManager.h"39 #include "UINetworkManager.h" 40 40 #include "UIDownloaderAdditions.h" 41 41 #include "UIDownloaderUserManual.h" … … 170 170 } 171 171 172 void UIMachineWindowNormal::sltEmbedDownloaderForAdditions() 173 { 174 /* If there is an additions download running show the process bar: */ 175 if (UIDownloaderAdditions *pDl = UIDownloaderAdditions::current()) 176 statusBar()->addWidget(pDl->progressWidget(this), 0); 177 } 178 179 void UIMachineWindowNormal::sltEmbedDownloaderForUserManual() 180 { 181 /* If there is an additions download running show the process bar: */ 182 if (UIDownloaderUserManual *pDl = UIDownloaderUserManual::current()) 183 statusBar()->addWidget(pDl->progressWidget(this), 0); 184 } 185 186 void UIMachineWindowNormal::sltEmbedDownloaderForExtensionPack() 187 { 188 /* If there is an extension pack download running show the process bar: */ 189 if (UIDownloaderExtensionPack *pDl = UIDownloaderExtensionPack::current()) 190 statusBar()->addWidget(pDl->progressWidget(this), 0); 172 void UIMachineWindowNormal::sltEmbedDownloader(UIDownloadType downloaderType) 173 { 174 switch (downloaderType) 175 { 176 case UIDownloadType_Additions: 177 { 178 if (UIDownloaderAdditions *pDl = UIDownloaderAdditions::current()) 179 statusBar()->addWidget(pDl->progressWidget(this), 0); 180 break; 181 } 182 case UIDownloadType_UserManual: 183 { 184 if (UIDownloaderUserManual *pDl = UIDownloaderUserManual::current()) 185 statusBar()->addWidget(pDl->progressWidget(this), 0); 186 break; 187 } 188 case UIDownloadType_ExtensionPack: 189 { 190 if (UIDownloaderExtensionPack *pDl = UIDownloaderExtensionPack::current()) 191 statusBar()->addWidget(pDl->progressWidget(this), 0); 192 break; 193 } 194 default: 195 break; 196 } 191 197 } 192 198 … … 438 444 /* Add the additions downloader progress bar to the status bar, 439 445 * if a download is actually running: */ 440 sltEmbedDownloaderForAdditions();446 tryToEmbedDownloaderForAdditions(); 441 447 442 448 /* Add the user manual progress bar to the status bar, 443 449 * if a download is actually running: */ 444 sltEmbedDownloaderForUserManual();450 tryToEmbedDownloaderForUserManual(); 445 451 446 452 /* Add the extension pack progress bar to the status bar, 447 453 * if a download is actually running: */ 448 sltEmbedDownloaderForExtensionPack();454 tryToEmbedDownloaderForExtensionPack(); 449 455 450 456 /* Create & start timer to update LEDs: */ … … 464 470 connect(&vboxGlobal().settings(), SIGNAL(propertyChanged(const char *, const char *)), 465 471 this, SLOT(sltProcessGlobalSettingChange(const char *, const char *))); 466 /* Setup additions downloader listener: */ 467 connect(machineLogic(), SIGNAL(sigDownloaderAdditionsCreated()), this, SLOT(sltEmbedDownloaderForAdditions())); 468 /* Setup user manual downloader listener: */ 469 connect(&msgCenter(), SIGNAL(sigDownloaderUserManualCreated()), this, SLOT(sltEmbedDownloaderForUserManual())); 470 /* Setup extension pack downloader listener: */ 471 connect(gUpdateManager, SIGNAL(sigDownloaderCreatedForExtensionPack()), this, SLOT(sltEmbedDownloaderForExtensionPack())); 472 /* Setup network manager listener: */ 473 connect(gNetworkManager, SIGNAL(sigDownloaderCreated(UIDownloadType)), this, SLOT(sltEmbedDownloader(UIDownloadType))); 472 474 } 473 475 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
r39296 r39326 28 28 #include "UIMachineWindow.h" 29 29 #include "COMDefs.h" 30 #include "UINetworkDefs.h" 30 31 31 32 /* Local forwards */ … … 63 64 void sltTryClose(); 64 65 65 /* Downloader listeners: */ 66 void sltEmbedDownloaderForAdditions(); 67 void sltEmbedDownloaderForUserManual(); 68 void sltEmbedDownloaderForExtensionPack(); 66 /* Network manager handler: */ 67 void sltEmbedDownloader(UIDownloadType downloaderType); 69 68 70 69 private: … … 107 106 void updateIndicatorState(QIStateIndicator *pIndicator, KDeviceType deviceType); 108 107 108 /* Network manager helpers: */ 109 void tryToEmbedDownloaderForAdditions() { sltEmbedDownloader(UIDownloadType_Additions); } 110 void tryToEmbedDownloaderForUserManual() { sltEmbedDownloader(UIDownloadType_UserManual); } 111 void tryToEmbedDownloaderForExtensionPack() { sltEmbedDownloader(UIDownloadType_ExtensionPack); } 112 109 113 /* Indicators pool: */ 110 114 UIIndicatorsPool *m_pIndicatorsPool; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r39241 r39326 29 29 #include "QISplitter.h" 30 30 #include "UIBar.h" 31 #include "UINetworkManager.h" 31 32 #include "UIUpdateManager.h" 32 33 #include "UIDownloaderUserManual.h" … … 1181 1182 } 1182 1183 1183 void UISelectorWindow::sltEmbedDownloaderForUserManual() 1184 { 1185 /* If there is User Manual downloader created => show the process bar: */ 1186 if (UIDownloaderUserManual *pDl = UIDownloaderUserManual::current()) 1187 statusBar()->addWidget(pDl->progressWidget(this), 0); 1188 } 1189 1190 void UISelectorWindow::sltEmbedDownloaderForExtensionPack() 1191 { 1192 /* If there is Extension Pack downloader created => show the process bar: */ 1193 if (UIDownloaderExtensionPack *pDl = UIDownloaderExtensionPack::current()) 1194 statusBar()->addWidget(pDl->progressWidget(this), 0); 1184 void UISelectorWindow::sltEmbedDownloader(UIDownloadType downloaderType) 1185 { 1186 switch (downloaderType) 1187 { 1188 case UIDownloadType_UserManual: 1189 { 1190 if (UIDownloaderUserManual *pDl = UIDownloaderUserManual::current()) 1191 statusBar()->addWidget(pDl->progressWidget(this), 0); 1192 break; 1193 } 1194 case UIDownloadType_ExtensionPack: 1195 { 1196 if (UIDownloaderExtensionPack *pDl = UIDownloaderExtensionPack::current()) 1197 statusBar()->addWidget(pDl->progressWidget(this), 0); 1198 break; 1199 } 1200 default: 1201 break; 1202 } 1195 1203 } 1196 1204 … … 1592 1600 connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltMediumEnumFinished(const VBoxMediaList &))); 1593 1601 1594 /* Downloader connections: */ 1595 connect(&msgCenter(), SIGNAL(sigDownloaderUserManualCreated()), this, SLOT(sltEmbedDownloaderForUserManual())); 1596 connect(gUpdateManager, SIGNAL(sigDownloaderCreatedForExtensionPack()), this, SLOT(sltEmbedDownloaderForExtensionPack())); 1602 /* Network manager connections: */ 1603 connect(gNetworkManager, SIGNAL(sigDownloaderCreated(UIDownloadType)), this, SLOT(sltEmbedDownloader(UIDownloadType))); 1597 1604 1598 1605 /* Menu-bar connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r39096 r39326 31 31 #include "VBoxMedium.h" 32 32 #include "COMDefs.h" 33 #include "UINetworkDefs.h" 33 34 34 35 /* Forward declarations: */ … … 127 128 void sltMediumEnumFinished(const VBoxMediaList &mediumList); 128 129 129 /* Downloader related slots: */ 130 void sltEmbedDownloaderForUserManual(); 131 void sltEmbedDownloaderForExtensionPack(); 130 /* Downloading handler: */ 131 void sltEmbedDownloader(UIDownloadType downloaderType); 132 132 133 133 private:
Note:
See TracChangeset
for help on using the changeset viewer.