Changeset 14274 in vbox for trunk/src/VBox/Frontends/VirtualBox4/include
- Timestamp:
- Nov 18, 2008 1:37:42 AM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4/include
- Files:
-
- 1 added
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDownloaderWgt.h
r9729 r14274 24 24 #define __VBoxDownloaderWgt_h__ 25 25 26 #include "HappyHttp.h"27 26 #include "QIWithRetranslateUI.h" 28 27 29 28 /* Qt includes */ 29 #include <QUrl> 30 30 #include <QWidget> 31 #include <QUrl>32 #include <QMutex>33 31 34 class Q StatusBar;35 class Q Action;32 class QIHttp; 33 class QHttpResponseHeader; 36 34 class QProgressBar; 37 35 class QToolButton; 38 class QThread;39 class QTimer;40 typedef happyhttp::Connection HConnect;41 36 42 /** class VBoxDownloaderWgt 37 /** 38 * The VBoxDownloaderWgt class is QWidget class re-implementation which embeds 39 * into the Dialog's status-bar and allows background http downloading. 40 * This class is not supposed to be used itself and made for sub-classing only. 43 41 * 44 * The VBoxDownloaderWgt class is an QWidget class for Guest Additions 45 * http backgroung downloading. This class is also used to display the 46 * Guest Additions download state through the progress dialog integrated 47 * into the VM console status bar. 42 * This class has two parts: 43 * 1. Acknowledging (getting information about target presence and size). 44 * 2. Downloading (starting and handling file downloading process). 45 * Every subclass can determine using or not those two parts and handling 46 * the result of those parts itself. 48 47 */ 49 class VBoxDownloaderWgt : public QIWithRetranslateUI <QWidget>48 class VBoxDownloaderWgt : public QIWithRetranslateUI <QWidget> 50 49 { 51 50 Q_OBJECT; … … 53 52 public: 54 53 55 VBoxDownloaderWgt (QStatusBar *aStatusBar, QAction *aAction, 56 const QString &aUrl, const QString &aTarget); 54 VBoxDownloaderWgt (const QString &aSource, const QString &aTarget); 57 55 56 virtual void start(); 58 57 59 bool isCheckingPresence() { return mIsChecking; } 58 protected slots: 59 60 /* Acknowledging part */ 61 virtual void acknowledgeStart(); 62 virtual void acknowledgeProcess (const QHttpResponseHeader &aResponse); 63 virtual void acknowledgeFinished (bool aError); 64 65 /* Downloading part */ 66 virtual void downloadStart(); 67 virtual void downloadProcess (int aDone, int aTotal); 68 virtual void downloadFinished (bool aError); 69 70 /* Common slots */ 71 virtual void cancelDownloading(); 72 virtual void abortDownload (const QString &aError); 73 virtual void suicide(); 60 74 61 75 protected: 62 76 63 void retranslateUi(); 77 /* In sub-class this function will show the user downloading object size 78 * and ask him about downloading confirmation. Returns user response. */ 79 virtual bool confirmDownload() = 0; 64 80 65 private slots: 81 /* In sub-class this function will show the user which error happens 82 * in context of downloading file and executing his request. */ 83 virtual void warnAboutError (const QString &aError) = 0; 66 84 67 /* This slot is used to control the connection timeout. */ 68 void processTimeout(); 69 70 /* This slot is used to process cancel-button clicking signal. */ 71 void processAbort(); 72 73 /* This slot is used to terminate the downloader, activate the 74 * Install Guest Additions action and removing the downloader's 75 * sub-widgets from the VM Console status-bar. */ 76 void suicide(); 77 78 private: 79 80 /* Used to process all the widget events */ 81 bool event (QEvent *aEvent); 82 83 /* This function is used to make a request to get a file */ 84 void getFile(); 85 86 /* This function is used to ask the user about he wants to download the 87 * founded Guest Additions image or not. It also shows the progress-bar 88 * and Cancel-button widgets. */ 89 void processFile (int aSize); 90 91 /* This wrapper displays an error message box (unless @aReason is 92 * QString::null) with the cause of the download procedure 93 * termination. After the message box is dismissed, the downloader signals 94 * to close itself on the next event loop iteration. */ 95 void abortDownload (const QString &aReason = QString::null); 96 97 void abortConnection(); 98 99 QUrl mUrl; 85 QUrl mSource; 100 86 QString mTarget; 101 QStatusBar *mStatusBar; 102 QAction *mAction; 87 QIHttp *mHttp; 103 88 QProgressBar *mProgressBar; 104 89 QToolButton *mCancelButton; 105 bool mIsChecking;106 bool mSuicide;107 HConnect *mConn;108 QThread *mRequestThread;109 QMutex mMutex;110 QByteArray mDataArray;111 QDataStream mDataStream;112 QTimer *mTimeout;113 90 }; 114 91 115 #endif 92 #endif // __VBoxDownloaderWgt_h__ 116 93 -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxRegistrationDlg.h
r11401 r14274 25 25 26 26 #include "QIAbstractWizard.h" 27 #include "VBoxRegistrationDlg.gen.h"28 #include "COMDefs.h"29 27 #include "QIWidgetValidator.h" 30 28 #include "QIWithRetranslateUI.h" 29 #include "VBoxRegistrationDlg.gen.h" 31 30 32 31 /* Qt includes */ 33 32 #include <QUrl> 34 33 35 class VBoxNetworkFramework;34 class QIHttp; 36 35 37 class VBoxRegistrationDlg : public QIWithRetranslateUI 2<QIAbstractWizard>,36 class VBoxRegistrationDlg : public QIWithRetranslateUI <QIAbstractWizard>, 38 37 public Ui::VBoxRegistrationDlg 39 38 { … … 42 41 public: 43 42 44 VBoxRegistrationDlg (VBoxRegistrationDlg **aSelf, QWidget *aParent = 0, 45 Qt::WindowFlags aFlags = 0); 43 static bool hasToBeShown(); 44 45 VBoxRegistrationDlg (VBoxRegistrationDlg **aSelf, QWidget *aParent = 0); 46 46 ~VBoxRegistrationDlg(); 47 48 static bool hasToBeShown();49 47 50 48 protected: … … 56 54 void accept(); 57 55 void reject(); 58 void handshake(); 59 void registration(); 60 void processTimeout(); 61 void onNetBegin (int aStatus); 62 void onNetData (const QByteArray &aData); 63 void onNetEnd (const QByteArray &aData); 64 void onNetError (const QString &aError); 56 57 void handshakeStart(); 58 void handshakeResponse (bool aError); 59 60 void registrationStart(); 61 void registrationResponse (bool aError); 65 62 66 63 void revalidate (QIWidgetValidator *aWval); … … 70 67 private: 71 68 72 void postRequest (const Q String &aHost, const QString &aUrl, const QString &aBody);73 void abortRe gisterRequest (const QString &aReason);69 void postRequest (const QUrl &aUrl); 70 void abortRequest (const QString &aReason); 74 71 void finish(); 75 72 … … 77 74 QIWidgetValidator *mWvalReg; 78 75 QUrl mUrl; 76 QIHttp *mHttp; 79 77 QString mKey; 80 QTimer *mTimeout;81 bool mHandshake;82 bool mSuicide;83 VBoxNetworkFramework *mNetfw;84 78 }; 85 79 -
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxUpdateDlg.h
r11401 r14274 24 24 #define __VBoxUpdateDlg_h__ 25 25 26 /* Common includes */27 26 #include "QIAbstractWizard.h" 27 #include "QIWithRetranslateUI.h" 28 28 #include "VBoxUpdateDlg.gen.h" 29 #include "QIWithRetranslateUI.h"30 29 31 30 /* Qt includes */ … … 33 32 #include <QDate> 34 33 35 class VBoxNetworkFramework;34 class QIHttp; 36 35 37 36 /** … … 84 83 85 84 /* Private variables */ 86 static QList <UpdateDay> mDayList;85 static QList <UpdateDay> mDayList; 87 86 88 87 QString mData; … … 91 90 }; 92 91 93 class VBoxUpdateDlg : public QIWithRetranslateUI 2<QIAbstractWizard>,92 class VBoxUpdateDlg : public QIWithRetranslateUI <QIAbstractWizard>, 94 93 public Ui::VBoxUpdateDlg 95 94 { … … 100 99 static bool isNecessary(); 101 100 102 VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, 103 QWidget *aParent = 0, Qt::WindowFlags aFlags = 0); 101 VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, QWidget *aParent = 0); 104 102 ~VBoxUpdateDlg(); 105 103 106 104 public slots: 107 105 108 void accept();109 106 void search(); 110 107 … … 115 112 private slots: 116 113 117 void processTimeout(); 118 119 void onNetBegin (int aStatus); 120 void onNetData (const QByteArray &aData); 121 void onNetEnd (const QByteArray &aData); 122 void onNetError (const QString &aError); 123 114 void accept(); 115 void searchResponse (bool aError); 124 116 void onPageShow(); 125 117 126 118 private: 127 119 128 /* Private functions */ 129 void networkAbort (const QString &aReason); 130 void processResponse (const QString &aResponse); 120 void abortRequest (const QString &aReason); 131 121 132 122 /* Private variables */ 133 123 VBoxUpdateDlg **mSelf; 134 VBoxNetworkFramework *mNetfw; 135 QTimer *mTimeout; 136 QUrl mUrl; 137 bool mForceRun; 138 bool mSuicide; 124 QUrl mUrl; 125 QIHttp *mHttp; 126 bool mForceRun; 139 127 }; 140 128
Note:
See TracChangeset
for help on using the changeset viewer.