VirtualBox

Ignore:
Timestamp:
Nov 18, 2008 1:37:42 AM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: 3328: FE/Qt4: Update network sub-level of all GUI networking stuff. Stuff ported to Qt4 Network module + cumulative fixes.

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  
    2424#define __VBoxDownloaderWgt_h__
    2525
    26 #include "HappyHttp.h"
    2726#include "QIWithRetranslateUI.h"
    2827
    2928/* Qt includes */
     29#include <QUrl>
    3030#include <QWidget>
    31 #include <QUrl>
    32 #include <QMutex>
    3331
    34 class QStatusBar;
    35 class QAction;
     32class QIHttp;
     33class QHttpResponseHeader;
    3634class QProgressBar;
    3735class QToolButton;
    38 class QThread;
    39 class QTimer;
    40 typedef happyhttp::Connection HConnect;
    4136
    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.
    4341 *
    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.
    4847 */
    49 class VBoxDownloaderWgt : public QIWithRetranslateUI<QWidget>
     48class VBoxDownloaderWgt : public QIWithRetranslateUI <QWidget>
    5049{
    5150    Q_OBJECT;
     
    5352public:
    5453
    55     VBoxDownloaderWgt (QStatusBar *aStatusBar, QAction *aAction,
    56                        const QString &aUrl, const QString &aTarget);
     54    VBoxDownloaderWgt (const QString &aSource, const QString &aTarget);
    5755
     56    virtual void start();
    5857
    59     bool isCheckingPresence() { return mIsChecking; }
     58protected 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();
    6074
    6175protected:
    6276
    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;
    6480
    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;
    6684
    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;
    10086    QString mTarget;
    101     QStatusBar *mStatusBar;
    102     QAction *mAction;
     87    QIHttp *mHttp;
    10388    QProgressBar *mProgressBar;
    10489    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;
    11390};
    11491
    115 #endif
     92#endif // __VBoxDownloaderWgt_h__
    11693
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxRegistrationDlg.h

    r11401 r14274  
    2525
    2626#include "QIAbstractWizard.h"
    27 #include "VBoxRegistrationDlg.gen.h"
    28 #include "COMDefs.h"
    2927#include "QIWidgetValidator.h"
    3028#include "QIWithRetranslateUI.h"
     29#include "VBoxRegistrationDlg.gen.h"
    3130
    3231/* Qt includes */
    3332#include <QUrl>
    3433
    35 class VBoxNetworkFramework;
     34class QIHttp;
    3635
    37 class VBoxRegistrationDlg : public QIWithRetranslateUI2<QIAbstractWizard>,
     36class VBoxRegistrationDlg : public QIWithRetranslateUI <QIAbstractWizard>,
    3837                            public Ui::VBoxRegistrationDlg
    3938{
     
    4241public:
    4342
    44     VBoxRegistrationDlg (VBoxRegistrationDlg **aSelf, QWidget *aParent = 0,
    45                          Qt::WindowFlags aFlags = 0);
     43    static bool hasToBeShown();
     44
     45    VBoxRegistrationDlg (VBoxRegistrationDlg **aSelf, QWidget *aParent = 0);
    4646   ~VBoxRegistrationDlg();
    47 
    48     static bool hasToBeShown();
    4947
    5048protected:
     
    5654    void accept();
    5755    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);
    6562
    6663    void revalidate (QIWidgetValidator *aWval);
     
    7067private:
    7168
    72     void postRequest (const QString &aHost, const QString &aUrl, const QString &aBody);
    73     void abortRegisterRequest (const QString &aReason);
     69    void postRequest (const QUrl &aUrl);
     70    void abortRequest (const QString &aReason);
    7471    void finish();
    7572
     
    7774    QIWidgetValidator    *mWvalReg;
    7875    QUrl                  mUrl;
     76    QIHttp               *mHttp;
    7977    QString               mKey;
    80     QTimer               *mTimeout;
    81     bool                  mHandshake;
    82     bool                  mSuicide;
    83     VBoxNetworkFramework *mNetfw;
    8478};
    8579
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxUpdateDlg.h

    r11401 r14274  
    2424#define __VBoxUpdateDlg_h__
    2525
    26 /* Common includes */
    2726#include "QIAbstractWizard.h"
     27#include "QIWithRetranslateUI.h"
    2828#include "VBoxUpdateDlg.gen.h"
    29 #include "QIWithRetranslateUI.h"
    3029
    3130/* Qt includes */
     
    3332#include <QDate>
    3433
    35 class VBoxNetworkFramework;
     34class QIHttp;
    3635
    3736/**
     
    8483
    8584    /* Private variables */
    86     static QList<UpdateDay> mDayList;
     85    static QList <UpdateDay> mDayList;
    8786
    8887    QString mData;
     
    9190};
    9291
    93 class VBoxUpdateDlg : public QIWithRetranslateUI2<QIAbstractWizard>,
     92class VBoxUpdateDlg : public QIWithRetranslateUI <QIAbstractWizard>,
    9493                      public Ui::VBoxUpdateDlg
    9594{
     
    10099    static bool isNecessary();
    101100
    102     VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun,
    103                    QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
     101    VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, QWidget *aParent = 0);
    104102   ~VBoxUpdateDlg();
    105103
    106104public slots:
    107105
    108     void accept();
    109106    void search();
    110107
     
    115112private slots:
    116113
    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);
    124116    void onPageShow();
    125117
    126118private:
    127119
    128     /* Private functions */
    129     void networkAbort (const QString &aReason);
    130     void processResponse (const QString &aResponse);
     120    void abortRequest (const QString &aReason);
    131121
    132122    /* Private variables */
    133123    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;
    139127};
    140128
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette