VirtualBox

Ignore:
Timestamp:
Nov 18, 2008 1:37:42 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
39449
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
Files:
2 added
4 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk

    r14092 r14274  
    217217# Headers containing definitions of classes that use the Q_OBJECT macro.
    218218VirtualBox4_QT_MOCHDRS = \
     219        include/QIHttp.h \
    219220        include/QIWidgetValidator.h \
    220221        include/QIHotKeyEdit.h \
     
    242243        include/VBoxProblemReporter.h \
    243244        include/VBoxDownloaderWgt.h \
    244         include/VBoxNetworkFramework.h \
    245245        include/VBoxAboutDlg.h \
    246246        include/VBoxCloseVMDlg.h \
     
    282282VirtualBox4_QT_MOCSRCS = \
    283283        src/VBoxSelectorWnd.cpp \
     284        src/VBoxConsoleWnd.cpp \
    284285        src/VBoxMediaManagerDlg.cpp
    285286ifdef VBOX_WITH_XPCOM
     
    318319        src/VBoxVMListView.cpp \
    319320        src/VBoxFrameBuffer.cpp \
    320         src/HappyHttp.cpp \
    321         src/VBoxNetworkFramework.cpp \
    322321        src/VBoxAboutDlg.cpp \
    323322        src/VBoxCloseVMDlg.cpp \
     
    391390# The Qt modules we're using.
    392391# (The include directory and lib/framework for each module will be added by the Qt4 unit.)
    393 VirtualBox4_QT_MODULES = Core Gui
     392VirtualBox4_QT_MODULES = Core Gui Network
    394393
    395394# Import QDesigner UI sources and translations from VBoxUI.pro.
     
    412411VirtualBox4_QT_TRANSLATIONS_INST = $(INST_BIN)nls/
    413412
    414 
    415 # Some flag hacks (should go away).
    416 ifneq ($(KBUILD_TARGET),win)
    417  VirtualBox4_src/HappyHttp.cpp_CXXFLAGS += -fexceptions
    418  VirtualBox4_src/VBoxDownloaderWgt.cpp_CXXFLAGS += -fexceptions
    419  VirtualBox4_src/VBoxNetworkFramework.cpp_CXXFLAGS += -fexceptions
    420 endif
    421 VirtualBox4_src/HappyHttp.cpp_CXXFLAGS.linux += -O2
    422413
    423414## @todo how to detect what tool is used?
  • trunk/src/VBox/Frontends/VirtualBox4/VirtualBox.qrc

    r13553 r14274  
    109109    <file alias="site_disabled_32px.png">images/site_disabled_32px.png</file>
    110110    <file alias="register_16px.png">images/register_16px.png</file>
     111    <file alias="register_32px.png">images/register_32px.png</file>
    111112    <file alias="register_disabled_16px.png">images/register_disabled_16px.png</file>
    112113    <file alias="reset_16px.png">images/reset_16px.png</file>
  • 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
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r13580 r14274  
    3636#include "QIStatusBar.h"
    3737#include "QIHotKeyEdit.h"
     38#include "QIHttp.h"
    3839
    3940/* Qt includes */
     
    4445#include <QDir>
    4546#include <QTimer>
     47#include <QProgressBar>
    4648#ifdef Q_WS_X11
    4749# include <QX11Info>
     
    9395class Q3HttpResponseHeader;
    9496#endif
     97
     98class VBoxAdditionsDownloader : public VBoxDownloaderWgt
     99{
     100    Q_OBJECT;
     101
     102public:
     103
     104    VBoxAdditionsDownloader (const QString &aSource, const QString &aTarget, QAction *aAction)
     105        : VBoxDownloaderWgt (aSource, aTarget)
     106        , mAction (aAction)
     107    {
     108        mAction->setEnabled (false);
     109        retranslateUi();
     110    }
     111
     112    void start()
     113    {
     114        acknowledgeStart();
     115    }
     116
     117protected:
     118
     119    void retranslateUi()
     120    {
     121        mCancelButton->setText (tr ("Cancel"));
     122        mProgressBar->setToolTip (tr ("Downloading the VirtualBox Guest Additions "
     123                                      "CD image from <nobr><b>%1</b>...</nobr>")
     124                                      .arg (mSource.toString()));
     125        mCancelButton->setToolTip (tr ("Cancel the VirtualBox Guest "
     126                                       "Additions CD image download"));
     127    }
     128
     129private slots:
     130
     131    void downloadFinished (bool aError)
     132    {
     133        if (aError)
     134            VBoxDownloaderWgt::downloadFinished (aError);
     135        else
     136        {
     137            QByteArray receivedData (mHttp->readAll());
     138            /* Serialize the incoming buffer into the .iso image. */
     139            while (true)
     140            {
     141                QFile file (mTarget);
     142                if (file.open (QIODevice::WriteOnly))
     143                {
     144                    file.write (receivedData);
     145                    file.close();
     146                    if (vboxProblem().confirmMountAdditions (mSource.toString(),
     147                        QDir::toNativeSeparators (mTarget)))
     148                        vboxGlobal().consoleWnd().installGuestAdditionsFrom (mTarget);
     149                    QTimer::singleShot (0, this, SLOT (suicide()));
     150                    break;
     151                }
     152                else
     153                {
     154                    vboxProblem().message (window(), VBoxProblemReporter::Error,
     155                        tr ("<p>Failed to save the downloaded file as "
     156                            "<nobr><b>%1</b>.</nobr></p>")
     157                        .arg (QDir::toNativeSeparators (mTarget)));
     158                }
     159
     160                QString target = vboxGlobal().getExistingDirectory (
     161                    QFileInfo (mTarget).absolutePath(), this,
     162                    tr ("Select folder to save Guest Additions image to"), true);
     163                if (target.isNull())
     164                    QTimer::singleShot (0, this, SLOT (suicide()));
     165                else
     166                    mTarget = QDir (target).absoluteFilePath (QFileInfo (mTarget).fileName());
     167            }
     168        }
     169    }
     170
     171    void suicide()
     172    {
     173        QStatusBar *sb = qobject_cast <QStatusBar*> (parent());
     174        Assert (sb);
     175        sb->removeWidget (this);
     176        mAction->setEnabled (true);
     177        VBoxDownloaderWgt::suicide();
     178    }
     179
     180private:
     181
     182    bool confirmDownload()
     183    {
     184        return vboxProblem().confirmDownloadAdditions (mSource.toString(),
     185            mHttp->lastResponse().contentLength());
     186    }
     187
     188    void warnAboutError (const QString &aError)
     189    {
     190        return vboxProblem().cannotDownloadGuestAdditions (mSource.toString(), aError);
     191    }
     192
     193    QAction *mAction;
     194};
    95195
    96196/** \class VBoxConsoleWnd
     
    26822782#else
    26832783    char szAppPrivPath [RTPATH_MAX];
    2684     int rc;
    2685 
    2686     rc = RTPathAppPrivateNoArch (szAppPrivPath, sizeof (szAppPrivPath));
     2784    int rc = RTPathAppPrivateNoArch (szAppPrivPath, sizeof (szAppPrivPath));
    26872785    AssertRC (rc);
    26882786
     
    26912789#endif
    26922790
     2791    /* Check the standard image locations */
    26932792    if (QFile::exists (src1))
    2694         installGuestAdditionsFrom (src1);
     2793        return installGuestAdditionsFrom (src1);
    26952794    else if (QFile::exists (src2))
    2696         installGuestAdditionsFrom (src2);
    2697     else
    2698     {
    2699         /* Check for the already registered required image */
    2700         CVirtualBox vbox = vboxGlobal().virtualBox();
    2701         QString name = QString ("VBoxGuestAdditions_%1.iso")
    2702                                  .arg (vbox.GetVersion().remove ("_OSE"));
    2703 
    2704         CDVDImage2Vector vec = vbox.GetDVDImages();
    2705         for (CDVDImage2Vector::ConstIterator it = vec.begin();
    2706              it != vec.end(); ++ it)
    2707         {
    2708             QString path = it->GetLocation();
    2709             /* Compare the name part ignoring the file case */
    2710             QString fn = QFileInfo (path).fileName();
    2711             if (RTPathCompare (name.toUtf8().constData(), fn.toUtf8().constData()) == 0)
    2712                 return installGuestAdditionsFrom (path);
    2713         }
    2714 
    2715         /* Download the required image: */
    2716         int rc = vboxProblem().cannotFindGuestAdditions (
    2717             QDir::toNativeSeparators (src1), QDir::toNativeSeparators (src2));
    2718         if (rc == QIMessageBox::Yes)
    2719         {
    2720             QString url = QString ("http://download.virtualbox.org/virtualbox/%1/")
    2721                                    .arg (vbox.GetVersion().remove ("_OSE")) + name;
    2722             QString target = QDir (vboxGlobal().virtualBox().GetHomeFolder())
    2723                                    .absoluteFilePath (name);
    2724 
    2725             new VBoxDownloaderWgt (statusBar(), devicesInstallGuestToolsAction,
    2726                                    url, target);
    2727         }
     2795        return installGuestAdditionsFrom (src2);
     2796
     2797    /* Check for the already registered image */
     2798    CVirtualBox vbox = vboxGlobal().virtualBox();
     2799    QString name = QString ("VBoxGuestAdditions_%1.iso")
     2800                            .arg (vbox.GetVersion().remove ("_OSE"));
     2801
     2802    CDVDImage2Vector vec = vbox.GetDVDImages();
     2803    for (CDVDImage2Vector::ConstIterator it = vec.begin();
     2804         it != vec.end(); ++ it)
     2805    {
     2806        QString path = it->GetLocation();
     2807        /* Compare the name part ignoring the file case */
     2808        QString fn = QFileInfo (path).fileName();
     2809        if (RTPathCompare (name.toUtf8().constData(), fn.toUtf8().constData()) == 0)
     2810            return installGuestAdditionsFrom (path);
     2811    }
     2812
     2813    /* Download the required image */
     2814    int result = vboxProblem().cannotFindGuestAdditions (
     2815        QDir::toNativeSeparators (src1), QDir::toNativeSeparators (src2));
     2816    if (result == QIMessageBox::Yes)
     2817    {
     2818        QString source = QString ("http://download.virtualbox.org/virtualbox/%1/")
     2819                                  .arg (vbox.GetVersion().remove ("_OSE")) + name;
     2820        QString target = QDir (vboxGlobal().virtualBox().GetHomeFolder())
     2821                               .absoluteFilePath (name);
     2822
     2823        VBoxAdditionsDownloader *dl =
     2824            new VBoxAdditionsDownloader (source, target, devicesInstallGuestToolsAction);
     2825        statusBar()->addWidget (dl, 0);
     2826        dl->start();
    27282827    }
    27292828}
     
    27452844
    27462845    if (!vbox.isOk())
    2747     {
    2748         vboxProblem().cannotOpenMedium (this, vbox,
    2749                                         VBoxDefs::MediaType_DVD, aSource);
    2750         return;
    2751     }
     2846        return vboxProblem().cannotOpenMedium (this, vbox,
     2847                                               VBoxDefs::MediaType_DVD, aSource);
    27522848
    27532849    Assert (!uuid.isNull());
    27542850    CDVDDrive drv = csession.GetMachine().GetDVDDrive();
    27552851    drv.MountImage (uuid);
    2756     /// @todo NEWMEDIA use VBoxProblemReporter::cannotMountMedia
    27572852    AssertWrapperOk (drv);
     2853    if (drv.isOk())
     2854    {
     2855        if (mIsAutoSaveMedia)
     2856        {
     2857            CMachine m = csession.GetMachine();
     2858            m.SaveSettings();
     2859            if (!m.isOk())
     2860                vboxProblem().cannotSaveMachineSettings (m);
     2861        }
     2862    }
    27582863}
    27592864
     
    36353740    QDialog::showEvent (aEvent);
    36363741}
     3742
     3743#include "VBoxConsoleWnd.moc"
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDownloaderWgt.cpp

    r13580 r14274  
    2121 */
    2222
     23#include "QIHttp.h"
     24#include "VBoxDownloaderWgt.h"
    2325#include "VBoxGlobal.h"
    24 #include "VBoxProblemReporter.h"
    25 #include "VBoxConsoleWnd.h"
    26 #include "VBoxDownloaderWgt.h"
    2726
    2827/* Qt includes */
     28#include <QFile>
     29#include <QHBoxLayout>
     30#include <QHttpResponseHeader>
    2931#include <QProgressBar>
    30 #include <QHBoxLayout>
    31 #include <QTimer>
    3232#include <QToolButton>
    33 #include <QStatusBar>
    34 #include <QDir>
    35 #include <QThread>
    3633
    37 /* These notifications are used to notify the GUI thread about different
    38  * downloading events: Downloading Started, Downloading in Progress,
    39  * Downloading Finished. */
    40 enum
     34VBoxDownloaderWgt::VBoxDownloaderWgt (const QString &aSource, const QString &aTarget)
     35    : mSource (aSource), mTarget (aTarget), mHttp (0)
     36    , mProgressBar (new QProgressBar (this))
     37    , mCancelButton (new QToolButton (this))
    4138{
    42     StartDownloadEventType = QEvent::User + 100,
    43     ProcessDownloadEventType,
    44     FinishDownloadEventType,
    45     ErrorDownloadEventType
    46 };
    47 
    48 class StartDownloadEvent : public QEvent
    49 {
    50 public:
    51     StartDownloadEvent (int aStatus, long aSize)
    52         : QEvent ((QEvent::Type) StartDownloadEventType)
    53         , mStatus (aStatus), mSize (aSize) {}
    54 
    55     int  mStatus;
    56     long mSize;
    57 };
    58 
    59 class ProcessDownloadEvent : public QEvent
    60 {
    61 public:
    62     ProcessDownloadEvent (const char *aData, ulong aSize)
    63         : QEvent ((QEvent::Type) ProcessDownloadEventType)
    64         , mData (aData, aSize) {}
    65 
    66     QByteArray mData;
    67 };
    68 
    69 class FinishDownloadEvent : public QEvent
    70 {
    71 public:
    72     FinishDownloadEvent()
    73         : QEvent ((QEvent::Type) FinishDownloadEventType) {}
    74 };
    75 
    76 class ErrorDownloadEvent : public QEvent
    77 {
    78 public:
    79     ErrorDownloadEvent (const QString &aInfo)
    80         : QEvent ((QEvent::Type) ErrorDownloadEventType)
    81         , mInfo (aInfo) {}
    82 
    83     QString mInfo;
    84 };
    85 
    86 /* This callback is used to handle the file-downloading procedure
    87  * beginning. It checks the downloading status for the file
    88  * presence verifying purposes. */
    89 void OnBegin (const happyhttp::Response *aResponse, void *aUserdata)
    90 {
    91     VBoxDownloaderWgt *loader = static_cast<VBoxDownloaderWgt*> (aUserdata);
    92     if (loader->isCheckingPresence())
    93     {
    94         int status = aResponse->getstatus();
    95         QString contentLength = aResponse->getheader ("Content-length");
    96 
    97         QApplication::postEvent (loader,
    98             new StartDownloadEvent (status, contentLength.toLong()));
    99     }
    100 }
    101 
    102 /* This callback is used to handle the progress of the file-downloading
    103  * procedure. It also checks the downloading status for the file
    104  * presence verifying purposes. */
    105 void OnData (const happyhttp::Response*, void *aUserdata,
    106              const unsigned char *aData, int aSize)
    107 {
    108     VBoxDownloaderWgt *loader = static_cast<VBoxDownloaderWgt*> (aUserdata);
    109     if (!loader->isCheckingPresence())
    110     {
    111         QApplication::postEvent (loader,
    112             new ProcessDownloadEvent ((const char*)aData, aSize));
    113     }
    114 }
    115 
    116 /* This callback is used to handle the finish signal of every operation's
    117  * response. It is used to display the errors occurred during the download
    118  * operation and for the received-buffer serialization procedure. */
    119 void OnComplete (const happyhttp::Response*, void *aUserdata)
    120 {
    121     VBoxDownloaderWgt *loader = static_cast<VBoxDownloaderWgt*> (aUserdata);
    122     if (!loader->isCheckingPresence())
    123         QApplication::postEvent (loader,
    124             new FinishDownloadEvent());
    125 }
    126 
    127 VBoxDownloaderWgt::VBoxDownloaderWgt (QStatusBar *aStatusBar, QAction *aAction,
    128                                       const QString &aUrl, const QString &aTarget)
    129     : QIWithRetranslateUI<QWidget> ()
    130     , mUrl (aUrl), mTarget (aTarget)
    131     , mStatusBar (aStatusBar), mAction (aAction)
    132     , mProgressBar (0), mCancelButton (0)
    133     , mIsChecking (true), mSuicide (false)
    134     , mConn (new HConnect (mUrl.host().toAscii().constData(), 80))
    135     , mRequestThread (0)
    136     , mDataStream (&mDataArray, QIODevice::WriteOnly)
    137     , mTimeout (new QTimer (this))
    138 {
    139     /* Disable the associated action */
    140     mAction->setEnabled (false);
    141     mTimeout->setSingleShot (true);
    142     connect (mTimeout, SIGNAL (timeout()),
    143              this, SLOT (processTimeout()));
    144 
    145     /* Drawing itself */
    146     setFixedHeight (16);
    147 
    148     mProgressBar = new QProgressBar (this);
     39    /* Progress Bar setup */
    14940    mProgressBar->setFixedWidth (100);
    15041    mProgressBar->setFormat ("%p%");
    15142    mProgressBar->setValue (0);
    15243
    153     mCancelButton = new QToolButton (this);
     44    /* Cancel Button setup */
    15445    mCancelButton->setAutoRaise (true);
    15546    mCancelButton->setFocusPolicy (Qt::TabFocus);
    156     connect (mCancelButton, SIGNAL (clicked()),
    157              this, SLOT (processAbort()));
     47    connect (mCancelButton, SIGNAL (clicked()), this, SLOT (cancelDownloading()));
    15848
     49    /* Downloader setup */
     50    setFixedHeight (16);
    15951    QHBoxLayout *mainLayout = new QHBoxLayout (this);
    16052    mainLayout->setSpacing (0);
     
    16355    mainLayout->addWidget (mCancelButton);
    16456    mainLayout->addStretch (1);
    165 
    166     /* Prepare the connection */
    167     mConn->setcallbacks (OnBegin, OnData, OnComplete, this);
    168 
    169     retranslateUi();
    170     mStatusBar->addWidget (this, 1);
    171 
    172     /* Try to get the required file for the information */
    173     getFile();
    17457}
    17558
    176 void VBoxDownloaderWgt::retranslateUi()
     59void VBoxDownloaderWgt::start()
    17760{
    178     mCancelButton->setText (tr ("Cancel"));
    179     /// @todo the below title should be parametrized
    180     mProgressBar->setToolTip (tr ("Downloading the VirtualBox Guest Additions "
    181                                   "CD image from <nobr><b>%1</b>...</nobr>")
    182                               .arg (mUrl.toString()));
    183     /// @todo the below title should be parametrized
    184     mCancelButton->setToolTip (tr ("Cancel the VirtualBox Guest "
    185                                    "Additions CD image download"));
     61    /* By default we are not using acknowledging step, so
     62     * making downloading immediately */
     63    downloadStart();
    18664}
    18765
    188 /* This slot is used to control the connection timeout. */
    189 void VBoxDownloaderWgt::processTimeout()
     66/* This function is used to start acknowledging mechanism:
     67 * checking file presence & size */
     68void VBoxDownloaderWgt::acknowledgeStart()
    19069{
    191     abortDownload (tr ("Connection timed out."));
     70    delete mHttp;
     71    mHttp = new QIHttp (this, mSource.host());
     72    connect (mHttp, SIGNAL (responseHeaderReceived (const QHttpResponseHeader &)),
     73             this, SLOT (acknowledgeProcess (const QHttpResponseHeader &)));
     74    connect (mHttp, SIGNAL (allIsDone (bool)), this, SLOT (acknowledgeFinished (bool)));
     75    mHttp->get (mSource.toEncoded());
    19276}
    19377
    194 /* This slot is used to process cancel-button clicking signal. */
    195 void VBoxDownloaderWgt::processAbort()
     78/* This function is used to store content length */
     79void VBoxDownloaderWgt::acknowledgeProcess (const QHttpResponseHeader &aResponse)
    19680{
    197     abortDownload (tr ("The download process has been cancelled "
    198                        "by the user."));
     81    /* Abort connection as we already got all we need */
     82    mHttp->abort();
    19983}
    20084
    201 /* This slot is used to terminate the downloader, activate the
    202  * associated action and removing the downloader's
    203  * sub-widgets from the VM Console status-bar. */
     85/* This function is used to ask the user about if he really want
     86 * to download file of proposed size if no error present or
     87 * abort download progress if error is present */
     88void VBoxDownloaderWgt::acknowledgeFinished (bool aError)
     89{
     90    AssertMsg (aError, ("Error must be 'true' due to aborting.\n"));
     91
     92    mHttp->disconnect (this);
     93
     94    switch (mHttp->errorCode())
     95    {
     96        case QIHttp::Aborted:
     97        {
     98            /* Ask the user if he wish to download it */
     99            if (confirmDownload())
     100                QTimer::singleShot (0, this, SLOT (downloadStart()));
     101            else
     102                QTimer::singleShot (0, this, SLOT (suicide()));
     103            break;
     104        }
     105        case QIHttp::MovedTemporarilyError:
     106        {
     107            /* Restart downloading at new location */
     108            mSource = mHttp->lastResponse().value ("location");
     109            QTimer::singleShot (0, this, SLOT (acknowledgeStart()));
     110            break;
     111        }
     112        default:
     113        {
     114            /* Show error happens during acknowledging */
     115            abortDownload (mHttp->errorString());
     116            break;
     117        }
     118    }
     119}
     120
     121/* This function is used to start downloading mechanism:
     122 * downloading and saving the target */
     123void VBoxDownloaderWgt::downloadStart()
     124{
     125    delete mHttp;
     126    mHttp = new QIHttp (this, mSource.host());
     127    connect (mHttp, SIGNAL (dataReadProgress (int, int)),
     128             this, SLOT (downloadProcess (int, int)));
     129    connect (mHttp, SIGNAL (allIsDone (bool)), this, SLOT (downloadFinished (bool)));
     130    mHttp->get (mSource.toEncoded());
     131}
     132
     133/* this function is used to observe the downloading progress through
     134 * changing the corresponding qprogressbar value */
     135void VBoxDownloaderWgt::downloadProcess (int aDone, int aTotal)
     136{
     137    mProgressBar->setMaximum (aTotal);
     138    mProgressBar->setValue (aDone);
     139}
     140
     141/* This function is used to handle the 'downloading finished' issue
     142 * through saving the downloaded into the file if there in no error or
     143 * notifying the user about error happens */
     144void VBoxDownloaderWgt::downloadFinished (bool aError)
     145{
     146    mHttp->disconnect (this);
     147
     148    if (aError)
     149    {
     150        /* Show information about error happens */
     151        if (mHttp->errorCode() == QIHttp::Aborted)
     152            abortDownload (tr ("The download process has been cancelled by the user."));
     153        else
     154            abortDownload (mHttp->errorString());
     155    }
     156    else
     157    {
     158        /* Trying to serialize the incoming buffer into the target, this is the
     159         * default behavior which have to be reimplemented in sub-class */
     160        QFile file (mTarget);
     161        if (file.open (QIODevice::WriteOnly))
     162        {
     163            file.write (mHttp->readAll());
     164            file.close();
     165        }
     166        QTimer::singleShot (0, this, SLOT (suicide()));
     167    }
     168}
     169
     170/* This slot is used to process cancel-button clicking */
     171void VBoxDownloaderWgt::cancelDownloading()
     172{
     173    QTimer::singleShot (0, this, SLOT (suicide()));
     174}
     175
     176/* This function is used to abort download by showing aborting reason
     177 * and calling the downloader's delete function */
     178void VBoxDownloaderWgt::abortDownload (const QString &aError)
     179{
     180    warnAboutError (aError);
     181    QTimer::singleShot (0, this, SLOT (suicide()));
     182}
     183
     184/* This function is used to delete the downloader widget itself,
     185 * should be reimplemented to enhanse necessary functionality in sub-class */
    204186void VBoxDownloaderWgt::suicide()
    205187{
    206     delete mRequestThread;
    207     delete mConn;
    208 
    209     mAction->setEnabled (true);
    210     mStatusBar->removeWidget (this);
    211188    delete this;
    212189}
    213190
    214 /* Used to process all the widget events */
    215 bool VBoxDownloaderWgt::event (QEvent *aEvent)
    216 {
    217     switch (aEvent->type())
    218     {
    219         case StartDownloadEventType:
    220         {
    221             StartDownloadEvent *e = static_cast<StartDownloadEvent*> (aEvent);
    222 
    223             mTimeout->stop();
    224             if (e->mStatus == 404)
    225                 abortDownload (tr ("Could not locate the file on "
    226                     "the server (response: %1).").arg (e->mStatus));
    227             else
    228                 processFile (e->mSize);
    229 
    230             return true;
    231         }
    232         case ProcessDownloadEventType:
    233         {
    234             ProcessDownloadEvent *e = static_cast<ProcessDownloadEvent*> (aEvent);
    235 
    236             mTimeout->start (20000);
    237             mProgressBar->setValue (mProgressBar->value() + e->mData.size());
    238             mDataStream.writeRawData (e->mData.data(), e->mData.size());
    239 
    240             return true;
    241         }
    242         case FinishDownloadEventType:
    243         {
    244             mTimeout->stop();
    245 
    246             /* Serialize the incoming buffer into the .iso image. */
    247             while (true)
    248             {
    249                 QFile file (mTarget);
    250                 if (file.open (QIODevice::WriteOnly))
    251                 {
    252                     file.write (mDataArray);
    253                     file.close();
    254                     /// @todo the below action is not part of the generic
    255                     //  VBoxDownloaderWgt functionality, so this class should just
    256                     //  emit a signal when it is done saving the downloaded file
    257                     //  (succeeded or failed).
    258                     if (vboxProblem()
    259                             .confirmMountAdditions (mUrl.toString(),
    260                                                     QDir::toNativeSeparators (mTarget)))
    261                         vboxGlobal().consoleWnd().installGuestAdditionsFrom (mTarget);
    262                     QTimer::singleShot (0, this, SLOT (suicide()));
    263                     break;
    264                 }
    265                 else
    266                 {
    267                     vboxProblem().message (mStatusBar->window(),
    268                         VBoxProblemReporter::Error,
    269                         tr ("<p>Failed to save the downloaded file as "
    270                             "<nobr><b>%1</b>.</nobr></p>")
    271                         .arg (QDir::toNativeSeparators (mTarget)));
    272                 }
    273 
    274                 /// @todo read the todo above (probably should just parametrize
    275                 /// the title)
    276                 QString target = vboxGlobal().getExistingDirectory (
    277                     QFileInfo (mTarget).absolutePath(), this,
    278                     tr ("Select folder to save Guest Additions image to"), true);
    279                 if (target.isNull())
    280                     QTimer::singleShot (0, this, SLOT (suicide()));
    281                 else
    282                     mTarget = QDir (target).absoluteFilePath (QFileInfo (mTarget).fileName());
    283             }
    284 
    285             return true;
    286         }
    287         case ErrorDownloadEventType:
    288         {
    289             ErrorDownloadEvent *e = static_cast<ErrorDownloadEvent*> (aEvent);
    290 
    291             abortDownload (e->mInfo);
    292 
    293             return true;
    294         }
    295         default:
    296             break;
    297     }
    298 
    299     return QWidget::event (aEvent);
    300 }
    301 
    302 /* This function is used to make a request to get a file */
    303 void VBoxDownloaderWgt::getFile()
    304 {
    305     /* Http request thread class */
    306     class Thread : public QThread
    307     {
    308     public:
    309 
    310         Thread (VBoxDownloaderWgt *aParent, HConnect *aConn,
    311                 const QString &aPath, QMutex *aMutex)
    312             : mParent (aParent), mConn (aConn)
    313             , mPath (aPath), mMutex (aMutex) {}
    314 
    315         virtual void run()
    316         {
    317             try
    318             {
    319                 mConn->request ("GET", mPath.toAscii().constData());
    320                 while (mConn->outstanding())
    321                 {
    322                     QMutexLocker locker (mMutex);
    323                     mConn->pump();
    324                 }
    325             }
    326             catch (happyhttp::Wobbly &ex)
    327             {
    328                 QApplication::postEvent (mParent,
    329                     new ErrorDownloadEvent (ex.what()));
    330             }
    331         }
    332 
    333     private:
    334 
    335         VBoxDownloaderWgt *mParent;
    336         HConnect *mConn;
    337         QString mPath;
    338         QMutex *mMutex;
    339     };
    340 
    341     if (!mRequestThread)
    342         mRequestThread = new Thread (this, mConn, mUrl.path(), &mMutex);
    343     mRequestThread->start();
    344     mTimeout->start (20000);
    345 }
    346 
    347 /* This function is used to ask the user about he wants to download the
    348  * founded Guest Additions image or not. It also shows the progress-bar
    349  * and Cancel-button widgets. */
    350 void VBoxDownloaderWgt::processFile (int aSize)
    351 {
    352     abortConnection();
    353 
    354     /// @todo the below action is not part of the generic
    355     //  VBoxDownloaderWgt functionality, so this class should just
    356     //  emit a signal when it is done detecting the file size.
    357 
    358     /* Ask user about GA image downloading */
    359     if (vboxProblem().confirmDownloadAdditions (mUrl.toString(), aSize))
    360     {
    361         mIsChecking = false;
    362         mProgressBar->setMaximum (aSize);
    363         getFile();
    364     }
    365     else
    366         abortDownload();
    367 }
    368 
    369 /* This wrapper displays an error message box (unless aReason is
    370  * QString::null) with the cause of the download procedure
    371  * termination. After the message box is dismissed, the downloader signals
    372  * to close itself on the next event loop iteration. */
    373 void VBoxDownloaderWgt::abortDownload (const QString &aReason)
    374 {
    375     abortConnection();
    376 
    377     /* Protect against double kill request. */
    378     if (mSuicide)
    379         return;
    380     mSuicide = true;
    381 
    382     /// @todo the below action is not part of the generic
    383     //  VBoxDownloaderWgt functionality, so this class should just emit a
    384     //  signal to display the error message when the download is aborted.
    385 
    386     if (!aReason.isNull())
    387         vboxProblem().cannotDownloadGuestAdditions (mUrl.toString(), aReason);
    388 
    389     /* Allows all the queued signals to be processed before quit. */
    390     QTimer::singleShot (0, this, SLOT (suicide()));
    391 }
    392 
    393 void VBoxDownloaderWgt::abortConnection()
    394 {
    395     mMutex.lock();
    396     mConn->close();
    397     mMutex.unlock();
    398 }
    399 
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxProblemReporter.cpp

    r14190 r14274  
    15391539
    15401540bool VBoxProblemReporter::confirmDownloadAdditions (const QString &aURL,
    1541                                                    ulong aSize)
     1541                                                    ulong aSize)
    15421542{
    15431543    return messageOkCancel (&vboxGlobal().consoleWnd(), Question,
     
    16241624    message (aParent, Error,
    16251625             tr ("<p>Failed to connect to the VirtualBox online "
    1626                  "registration service.</p><p>%1</p>")
     1626                 "registration service due to the following error:</p><p><b>%1</b></p>")
    16271627                 .arg (aReason));
    16281628}
     
    16561656                                             const QString &aReason)
    16571657{
    1658     message (aParent, Info,
     1658    message (aParent, Error,
    16591659             tr ("<p>Unable to obtain the new version information "
    1660                  "due to the following network error:</p><p><b>%1</b></p>")
     1660                 "due to the following error:</p><p><b>%1</b></p>")
    16611661                 .arg (aReason));
    16621662}
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxRegistrationDlg.cpp

    r11465 r14274  
    2121 */
    2222
    23 #include "VBoxRegistrationDlg.h"
     23#include "QIHttp.h"
    2424#include "VBoxGlobal.h"
    2525#include "VBoxProblemReporter.h"
    26 #include "VBoxNetworkFramework.h"
     26#include "VBoxRegistrationDlg.h"
    2727
    2828/* Qt includes */
    2929#include <QTimer>
    30 #include <QProcess>
    31 
    32 #include <iprt/err.h>
    33 #include <iprt/param.h>
    34 #include <iprt/path.h>
    35 
    36 /* Time to auto-disconnect if no network answer received. */
    37 static const int MaxWaitTime = 20000;
    3830
    3931/**
     
    4739        : mIsValid (false), mIsRegistered (false)
    4840        , mData (aData)
    49         , mTriesLeft (3 /* the initial tries value! */)
     41        , mTriesLeft (3 /* the initial tries value */)
    5042    {
    5143        decode (aData);
     
    5345
    5446    VBoxRegistrationData (const QString &aName, const QString &aEmail,
    55                           const QString &aPrivate)
     47                          const QString &aIsPrivate)
    5648        : mIsValid (true), mIsRegistered (true)
    57         , mName (aName), mEmail (aEmail), mPrivate (aPrivate)
     49        , mName (aName), mEmail (aEmail), mIsPrivate (aIsPrivate)
    5850        , mTriesLeft (0)
    5951    {
    60         encode (aName, aEmail, aPrivate);
     52        encode (aName, aEmail, aIsPrivate);
    6153    }
    6254
    63     bool isValid() const              { return mIsValid; }
    64     bool isRegistered() const         { return mIsRegistered; }
    65 
    66     const QString &data() const       { return mData; }
    67     const QString &name() const       { return mName; }
    68     const QString &email() const      { return mEmail; }
    69     const QString &isPrivate() const  { return mPrivate; }
    70 
    71     uint triesLeft() const            { return mTriesLeft; }
     55    bool isValid() const { return mIsValid; }
     56    bool isRegistered() const { return mIsRegistered; }
     57
     58    const QString &data() const { return mData; }
     59    const QString &name() const { return mName; }
     60    const QString &email() const { return mEmail; }
     61    const QString &isPrivate() const { return mIsPrivate; }
     62
     63    uint triesLeft() const { return mTriesLeft; }
    7264
    7365private:
     
    117109        mName = dataList [0];
    118110        mEmail = dataList [1];
    119         mPrivate = dataList [2];
     111        mIsPrivate = dataList [2];
    120112
    121113        mIsValid = true;
     
    189181    QString mName;
    190182    QString mEmail;
    191     QString mPrivate;
     183    QString mIsPrivate;
    192184
    193185    uint mTriesLeft;
    194186};
    195187
    196 VBoxRegistrationDlg::VBoxRegistrationDlg (VBoxRegistrationDlg **aSelf,
    197                                           QWidget *aParent,
    198                                           Qt::WindowFlags aFlags)
    199     : QIWithRetranslateUI2<QIAbstractWizard> (aParent, aFlags)
     188/* Static member to check if registration dialog necessary. */
     189bool VBoxRegistrationDlg::hasToBeShown()
     190{
     191    VBoxRegistrationData regData (vboxGlobal().virtualBox().
     192        GetExtraData (VBoxDefs::GUI_RegistrationData));
     193
     194    return (!regData.isValid()) ||
     195           (!regData.isRegistered() && regData.triesLeft() > 0);
     196}
     197
     198VBoxRegistrationDlg::VBoxRegistrationDlg (VBoxRegistrationDlg **aSelf, QWidget *aParent)
     199    : QIWithRetranslateUI <QIAbstractWizard> (aParent)
    200200    , mSelf (aSelf)
    201201    , mWvalReg (0)
    202202    , mUrl ("http://registration.virtualbox.org/register762.php")
    203     , mKey (QString::null)
    204     , mTimeout (new QTimer (this))
    205     , mHandshake (true)
    206     , mSuicide (false)
    207     , mNetfw (0)
    208 {
    209     /* Store external pointer to this dialog. */
     203    , mHttp (new QIHttp (this, mUrl.host()))
     204{
     205    /* Store external pointer to this dialog */
    210206    *mSelf = this;
    211207
    212208    /* Apply UI decorations */
    213209    Ui::VBoxRegistrationDlg::setupUi (this);
     210
     211    /* Apply window icons */
     212    setWindowIcon (vboxGlobal().iconSetFull (QSize (32, 32), QSize (16, 16),
     213                                             ":/register_32px.png", ":/register_16px.png"));
    214214
    215215    /* Initialize wizard hdr */
     
    219219    QRegExp nameExp ("[\\S\\s]+");
    220220    /* E-mail address is validated according to RFC2821, RFC2822,
    221      * see http://en.wikipedia.org/wiki/E-mail_address. */
     221     * see http://en.wikipedia.org/wiki/E-mail_address */
    222222    QRegExp emailExp ("(([a-zA-Z0-9_\\-\\.!#$%\\*/?|^{}`~&'\\+=]*"
    223223                        "[a-zA-Z0-9_\\-!#$%\\*/?|^{}`~&'\\+=])|"
     
    234234    mLeEmail->setMaxLength (50);
    235235
    236     /* This is a single shot timer */
    237     mTimeout->setSingleShot (true);
    238 
    239236    /* Setup other connections */
    240237    mWvalReg = new QIWidgetValidator (mPageReg, this);
     
    243240    connect (mWvalReg, SIGNAL (isValidRequested (QIWidgetValidator *)),
    244241             this, SLOT (revalidate (QIWidgetValidator *)));
    245     connect (mTimeout, SIGNAL (timeout()), this, SLOT (processTimeout()));
    246242
    247243    /* Setup initial dialog parameters. */
     
    264260VBoxRegistrationDlg::~VBoxRegistrationDlg()
    265261{
    266     /* Delete network framework. */
    267     delete mNetfw;
    268 
    269262    /* Erase dialog handle in config file. */
    270263    vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_RegistrationDlgWinID,
     
    273266    /* Erase external pointer to this dialog. */
    274267    *mSelf = 0;
    275 }
    276 
    277 /* Static member to check if registration dialog necessary. */
    278 bool VBoxRegistrationDlg::hasToBeShown()
    279 {
    280     VBoxRegistrationData regData (vboxGlobal().virtualBox().
    281         GetExtraData (VBoxDefs::GUI_RegistrationData));
    282 
    283     return !regData.isValid() ||
    284            (!regData.isRegistered() && regData.triesLeft() > 0);
    285268}
    286269
     
    302285
    303286    /* Perform connection handshake */
    304     QTimer::singleShot (0, this, SLOT (handshake()));
     287    QTimer::singleShot (0, this, SLOT (handshakeStart()));
    305288}
    306289
     
    325308}
    326309
    327 void VBoxRegistrationDlg::handshake()
    328 {
    329     /* Handshake arguments initializing */
    330     QString version = vboxGlobal().virtualBox().GetVersion();
    331     version = QUrl::toPercentEncoding (version);
     310void VBoxRegistrationDlg::handshakeStart()
     311{
     312    /* Compose query */
     313    QUrl url (mUrl);
     314    url.addQueryItem ("version", vboxGlobal().virtualBox().GetVersion());
    332315
    333316    /* Handshake */
    334     QString body = QString ("version=%1").arg (version);
    335     postRequest (mUrl.host(), mUrl.path(), body);
    336 }
    337 
    338 void VBoxRegistrationDlg::registration()
    339 {
    340     /* Registration arguments initializing */
    341     mHandshake = false;
    342     QString version = vboxGlobal().virtualBox().GetVersion();
    343     QString platform = vboxGlobal().platformInfo();
    344     QString name = mLeName->text();
    345     QString email = mLeEmail->text();
    346     QString prvt = mCbUse->isChecked() ? "1" : "0";
    347     version = QUrl::toPercentEncoding (version);
    348     platform = QUrl::toPercentEncoding (platform);
    349     name = QUrl::toPercentEncoding (name);
    350     email = QUrl::toPercentEncoding (email);
     317    mHttp->disconnect (this);
     318    connect (mHttp, SIGNAL (allIsDone (bool)), this, SLOT (handshakeResponse (bool)));
     319    mHttp->post (url.toEncoded());
     320}
     321
     322void VBoxRegistrationDlg::handshakeResponse (bool aError)
     323{
     324    /* Block all the other incoming signals */
     325    mHttp->disconnect (this);
     326
     327    /* Process error if present */
     328    if (aError)
     329        return abortRequest (mHttp->errorString());
     330
     331    /* Read received data */
     332    mKey = mHttp->readAll();
     333
     334    /* Verifying key correctness */
     335    if (QString (mKey).indexOf (QRegExp ("^[a-zA-Z0-9]{32}$")))
     336        return abortRequest (tr ("Could not perform connection handshake."));
     337
     338    /* Perform registration */
     339    QTimer::singleShot (0, this, SLOT (registrationStart()));
     340}
     341
     342void VBoxRegistrationDlg::registrationStart()
     343{
     344    /* Compose query */
     345    QUrl url (mUrl);
     346    url.addQueryItem ("version", vboxGlobal().virtualBox().GetVersion());
     347    url.addQueryItem ("key", mKey);
     348    url.addQueryItem ("platform", vboxGlobal().platformInfo());
     349    url.addQueryItem ("name", mLeName->text());
     350    url.addQueryItem ("email", mLeEmail->text());
     351    url.addQueryItem ("private", mCbUse->isChecked() ? "1" : "0");
    351352
    352353    /* Registration */
    353     QString body;
    354     body += QString ("version=%1").arg (version);
    355     body += QString ("&key=%1").arg (mKey);
    356     body += QString ("&platform=%1").arg (platform);
    357     body += QString ("&name=%1").arg (name);
    358     body += QString ("&email=%1").arg (email);
    359     body += QString ("&private=%1").arg (prvt);
    360 
    361     postRequest (mUrl.host(), mUrl.path(), body);
    362 }
    363 
    364 void VBoxRegistrationDlg::processTimeout()
    365 {
    366     abortRegisterRequest (tr ("Connection timed out."));
    367 }
    368 
    369 /* Handles the network request begining. */
    370 void VBoxRegistrationDlg::onNetBegin (int aStatus)
    371 {
    372     if (mSuicide) return;
    373 
    374     if (aStatus == 404)
    375         abortRegisterRequest (tr ("Could not locate the registration form on "
    376             "the server (response: %1).").arg (aStatus));
    377     else
    378         mTimeout->start (MaxWaitTime);
    379 }
    380 
    381 /* Handles the network request data incoming. */
    382 void VBoxRegistrationDlg::onNetData (const QByteArray&)
    383 {
    384     if (mSuicide) return;
    385 
    386     mTimeout->start (MaxWaitTime);
    387 }
    388 
    389 /* Handles the network request end. */
    390 void VBoxRegistrationDlg::onNetEnd (const QByteArray &aTotalData)
    391 {
    392     if (mSuicide) return;
    393 
    394     mTimeout->stop();
    395     if (mHandshake)
    396     {
    397         /* Verifying key correctness */
    398         if (QString (aTotalData).indexOf (QRegExp ("^[a-zA-Z0-9]{32}$")))
    399         {
    400             abortRegisterRequest (tr ("Could not perform connection handshake."));
    401             return;
    402         }
    403         mKey = aTotalData;
    404 
    405         /* Perform registration */
    406         QTimer::singleShot (0, this, SLOT (registration()));
    407     }
    408     else
    409     {
    410         /* Show registration result */
    411         QString result (aTotalData);
    412         vboxProblem().showRegisterResult (this, result);
    413 
    414         /* Close the dialog */
    415         result == "OK" ? finish() : reject();
    416     }
    417 }
    418 
    419 /* Handles the network error. */
    420 void VBoxRegistrationDlg::onNetError (const QString &aError)
    421 {
    422     abortRegisterRequest (aError);
     354    mHttp->disconnect (this);
     355    connect (mHttp, SIGNAL (allIsDone (bool)), this, SLOT (registrationResponse (bool)));
     356    mHttp->post (url.toEncoded());
     357}
     358
     359void VBoxRegistrationDlg::registrationResponse (bool aError)
     360{
     361    /* Block all the other incoming signals */
     362    mHttp->disconnect (this);
     363
     364    /* Process error if present */
     365    if (aError)
     366        return abortRequest (mHttp->errorString());
     367
     368    /* Read received data */
     369    QString data (mHttp->readAll());
     370
     371    /* Show registration result */
     372    vboxProblem().showRegisterResult (this, data);
     373
     374    /* Close the dialog */
     375    data == "OK" ? finish() : reject();
    423376}
    424377
     
    441394}
    442395
    443 void VBoxRegistrationDlg::postRequest (const QString &aHost,
    444                                        const QString &aUrl,
    445                                        const QString &aBody)
    446 {
    447     delete mNetfw;
    448     mNetfw = new VBoxNetworkFramework();
    449     connect (mNetfw, SIGNAL (netBegin (int)),
    450              SLOT (onNetBegin (int)));
    451     connect (mNetfw, SIGNAL (netData (const QByteArray&)),
    452              SLOT (onNetData (const QByteArray&)));
    453     connect (mNetfw, SIGNAL (netEnd (const QByteArray&)),
    454              SLOT (onNetEnd (const QByteArray&)));
    455     connect (mNetfw, SIGNAL (netError (const QString&)),
    456              SLOT (onNetError (const QString&)));
    457     mTimeout->start (MaxWaitTime);
    458     mNetfw->postRequest (aHost, aUrl, aBody);
    459 }
    460 
    461 /* This wrapper displays an error message box (unless aReason is
    462  * QString::null) with the cause of the request-send procedure
    463  * termination. After the message box is dismissed, the downloader signals
    464  * to close itself on the next event loop iteration. */
    465 void VBoxRegistrationDlg::abortRegisterRequest (const QString &aReason)
    466 {
    467     /* Protect against double kill request. */
    468     if (mSuicide) return;
    469     mSuicide = true;
    470 
     396/* This wrapper displays an error message box (unless aReason is QString::null)
     397 * with the cause of the request-send procedure termination. After the message
     398 * box dismissed, the registration dialog signals to close itself on the next
     399 * event loop iteration. */
     400void VBoxRegistrationDlg::abortRequest (const QString &aReason)
     401{
    471402    if (!aReason.isNull())
    472403        vboxProblem().cannotConnectRegister (this, mUrl.toString(), aReason);
     
    479410{
    480411    VBoxRegistrationData regData (mLeName->text(), mLeEmail->text(),
    481         mCbUse->isChecked() ? "yes" : "no");
     412                                  mCbUse->isChecked() ? "yes" : "no");
    482413    vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_RegistrationData,
    483414                                            regData.data());
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxUpdateDlg.cpp

    r12286 r14274  
    2222
    2323/* Common includes */
    24 #include "VBoxUpdateDlg.h"
     24#include "QIHttp.h"
    2525#include "VBoxGlobal.h"
    2626#include "VBoxProblemReporter.h"
    27 #include "VBoxNetworkFramework.h"
     27#include "VBoxUpdateDlg.h"
    2828
    2929/* Qt includes */
    3030#include <QTimer>
    31 
    32 /* Time to auto-disconnect if no network answer received. */
    33 static const int MaxWaitTime = 20000;
    34 
    3531
    3632/* VBoxVersion stuff */
     
    5349    bool operator< (const VBoxVersion &aOther) const
    5450    {
    55         return x <  aOther.x ||
     51        return (x <  aOther.x) ||
    5652               (x == aOther.x && y <  aOther.y) ||
    5753               (x == aOther.x && y == aOther.y && z <  aOther.z);
     
    7268
    7369/* VBoxUpdateData stuff */
    74 QList<UpdateDay> VBoxUpdateData::mDayList = QList<UpdateDay>();
     70QList <UpdateDay> VBoxUpdateData::mDayList = QList <UpdateDay>();
    7571
    7672void VBoxUpdateData::populate()
     
    121117bool VBoxUpdateData::isNecessary()
    122118{
    123     return mIndex != NeverCheck &&
    124            QDate::currentDate() >= mDate;
     119    return mIndex != NeverCheck && QDate::currentDate() >= mDate;
    125120}
    126121
     
    215210}
    216211
    217 VBoxUpdateDlg::VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun,
    218                               QWidget *aParent, Qt::WindowFlags aFlags)
    219     : QIWithRetranslateUI2<QIAbstractWizard> (aParent, aFlags)
     212VBoxUpdateDlg::VBoxUpdateDlg (VBoxUpdateDlg **aSelf, bool aForceRun, QWidget *aParent)
     213    : QIWithRetranslateUI <QIAbstractWizard> (aParent)
    220214    , mSelf (aSelf)
    221     , mNetfw (0)
    222     , mTimeout (new QTimer (this))
    223215    , mUrl ("http://update.virtualbox.org/query.php")
     216    , mHttp (new QIHttp (this, mUrl.host()))
    224217    , mForceRun (aForceRun)
    225     , mSuicide (false)
    226218{
    227219    /* Store external pointer to this dialog. */
     
    231223    Ui::VBoxUpdateDlg::setupUi (this);
    232224
     225    /* Apply window icons */
     226    setWindowIcon (vboxGlobal().iconSetFull (QSize (32, 32), QSize (16, 16),
     227                                             ":/refresh_32px.png", ":/refresh_16px.png"));
     228
    233229    /* Initialize wizard hdr */
    234230    initializeWizardHdr();
    235231
    236     /* Network outage - single shot timer */
    237     mTimeout->setSingleShot (true);
    238 
    239232    /* Setup other connections */
    240     connect (mTimeout, SIGNAL (timeout()), this, SLOT (processTimeout()));
    241233    connect (mBtnCheck, SIGNAL (clicked()), this, SLOT (search()));
    242234
     
    245237
    246238    /* Setup initial condition */
    247     mPbCheck->setMinimumWidth (mLogoUpdate->width() +
    248                                mLogoUpdate->frameWidth() * 2);
     239    mPbCheck->setMinimumWidth (mLogoUpdate->width() + mLogoUpdate->frameWidth() * 2);
    249240    mPbCheck->hide();
    250 
    251241    mTextSuccessInfo->hide();
    252242    mTextFailureInfo->hide();
     
    259249VBoxUpdateDlg::~VBoxUpdateDlg()
    260250{
    261     /* Delete network framework. */
    262     delete mNetfw;
    263 
    264251    /* Erase dialog handle in config file. */
    265     vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_UpdateDlgWinID,
    266                                             QString::null);
     252    vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_UpdateDlgWinID, QString::null);
    267253
    268254    /* Erase external pointer to this dialog. */
     
    270256}
    271257
     258void VBoxUpdateDlg::retranslateUi()
     259{
     260    /* Translate uic generated strings */
     261    Ui::VBoxUpdateDlg::retranslateUi (this);
     262
     263#if 0 /* All the text constants */
     264    setWindowTitle (tr ("VirtualBox Update Wizard"));
     265
     266    mPageUpdateHdr->setText (tr ("Check for Updates"));
     267    mBtnCheck->setText (tr ("Chec&k"));
     268    mBtnCancel->setText (tr ("Cancel"));
     269
     270    mPageFinishHdr->setText (tr ("Summary"));
     271    mBtnFinish->setText (tr ("&Close"));
     272
     273    mTextUpdateInfo->setText (tr ("<p>This wizard will connect to the VirtualBox "
     274                                  "web-site and check if a newer version of "
     275                                  "VirtualBox is available.</p><p>Use the "
     276                                  "<b>Check</b> button to check for a new version "
     277                                  "now or the <b>Cancel</b> button if you do not "
     278                                  "want to perform this check.</p><p>You can run "
     279                                  "this wizard at any time by choosing <b>Check "
     280                                  "for Updates...</b> from the <b>Help</b> menu.</p>"));
     281
     282    mTextSuccessInfo->setText (tr ("<p>A new version of VirtualBox has been released! "
     283                                   "Version <b>%1</b> is available at "
     284                                   "<a href=\"http://www.virtualbox.org/\">virtualbox.org</a>.</p>"
     285                                   "<p>You can download this version from this direct link:</p>"
     286                                   "<p><a href=%2>%3</a></p>"));
     287
     288    mTextFailureInfo->setText (tr ("<p>Unable to obtain the new version information "
     289                                   "due to the following network error:</p><p><b>%1</b></p>"));
     290
     291    mTextNotFoundInfo->setText (tr ("You have already installed the latest VirtualBox "
     292                                    "version. Please repeat the version check later."));
     293#endif
     294}
     295
    272296void VBoxUpdateDlg::accept()
    273297{
    274298    /* Recalculate new update data */
    275299    VBoxUpdateData oldData (vboxGlobal().virtualBox().
    276         GetExtraData (VBoxDefs::GUI_UpdateDate));
     300                            GetExtraData (VBoxDefs::GUI_UpdateDate));
    277301    VBoxUpdateData newData (oldData.index());
    278302    vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_UpdateDate,
     
    284308void VBoxUpdateDlg::search()
    285309{
    286     /* Create & setup network framework */
    287     mNetfw = new VBoxNetworkFramework();
    288     connect (mNetfw, SIGNAL (netBegin (int)),
    289              SLOT (onNetBegin (int)));
    290     connect (mNetfw, SIGNAL (netData (const QByteArray&)),
    291              SLOT (onNetData (const QByteArray&)));
    292     connect (mNetfw, SIGNAL (netEnd (const QByteArray&)),
    293              SLOT (onNetEnd (const QByteArray&)));
    294     connect (mNetfw, SIGNAL (netError (const QString&)),
    295              SLOT (onNetError (const QString&)));
    296 
     310    /* Calculate the count of checks left */
     311    int count = 1;
     312    QString sc = vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_UpdateCheckCount);
     313    if (!sc.isEmpty())
     314    {
     315        bool ok = false;
     316        int c = sc.toLongLong (&ok);
     317        if (ok) count = c;
     318    }
     319
     320    /* Compose query */
     321    QUrl url (mUrl);
     322    url.addQueryItem ("platform", vboxGlobal().virtualBox().GetPackageType());
     323    url.addQueryItem ("version", QString ("%1_%2").arg (vboxGlobal().virtualBox().GetVersion())
     324                                                  .arg (vboxGlobal().virtualBox().GetRevision()));
     325    url.addQueryItem ("count", QString::number (count));
     326
     327    QString userAgent (QString ("VirtualBox %1 <%2>")
     328                                .arg (vboxGlobal().virtualBox().GetVersion())
     329                                .arg (vboxGlobal().platformInfo()));
     330
     331    /* Show progress bar */
     332    mPbCheck->show();
     333
     334    /* Send composed information */
     335    QHttpRequestHeader header ("POST", url.toEncoded());
     336    header.setValue ("Host", url.host());
     337    header.setValue ("User-Agent", userAgent);
     338    mHttp->disconnect (this);
     339    connect (mHttp, SIGNAL (allIsDone (bool)), this, SLOT (searchResponse (bool)));
     340    mHttp->request (header);
     341}
     342
     343void VBoxUpdateDlg::searchResponse (bool aError)
     344{
     345    /* Block all the other incoming signals */
     346    mHttp->disconnect (this);
     347
     348    /* Process error if present */
     349    if (aError)
     350        return abortRequest (mHttp->errorString());
     351
     352    /* Hide progress bar */
     353    mPbCheck->hide();
     354
     355    /* Parse incoming data */
     356    QString responseData (mHttp->readAll());
     357
     358    if (responseData.indexOf (QRegExp ("^\\d+\\.\\d+\\.\\d+ \\S+$")) == 0)
     359    {
     360        /* Newer version of necessary package found */
     361        QStringList response = responseData.split (" ", QString::SkipEmptyParts);
     362
     363        if (isHidden())
     364        {
     365            /* For background update */
     366            vboxProblem().showUpdateSuccess (vboxGlobal().mainWindow(),
     367                                             response [0], response [1]);
     368            QTimer::singleShot (0, this, SLOT (accept()));
     369        }
     370        else
     371        {
     372            /* For wizard update */
     373            mTextSuccessInfo->setText (mTextSuccessInfo->text()
     374                                       .arg (response [0], response [1], response [1]));
     375            mTextSuccessInfo->show();
     376            mPageStack->setCurrentIndex (1);
     377        }
     378    }
     379    else /* if (responseData == "UPTODATE") */
     380    {
     381        /* No newer version of necessary package found */
     382        if (isHidden())
     383        {
     384            /* For background update */
     385            if (mForceRun)
     386                vboxProblem().showUpdateNotFound (vboxGlobal().mainWindow());
     387            QTimer::singleShot (0, this, SLOT (accept()));
     388        }
     389        else
     390        {
     391            /* For wizard update */
     392            mTextNotFoundInfo->show();
     393            mPageStack->setCurrentIndex (1);
     394        }
     395    }
     396
     397    /* Save left count of checks */
    297398    int count = 1;
    298399    bool ok = false;
    299400    QString sc = vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_UpdateCheckCount);
    300401    if (!sc.isEmpty())
    301     {
    302         int c = sc.toLongLong(&ok);
    303         if (ok)
    304             count = c;
    305     }
    306     QString package = vboxGlobal().virtualBox().GetPackageType();
    307     QString version = vboxGlobal().virtualBox().GetVersion();
    308     QString revision = QString::number (vboxGlobal().virtualBox().GetRevision());
    309     package = QUrl::toPercentEncoding (package);
    310     version = QUrl::toPercentEncoding (version);
    311     revision = QUrl::toPercentEncoding (revision);
    312     QString body;
    313     body += QString ("platform=%1").arg (package);
    314     body += QString ("&version=%1_%2").arg (version).arg (revision);
    315     body += QString ("&count=%1").arg (count);
    316 
    317     QStringList header ("User-Agent");
    318     header << QString ("VirtualBox %1 <%2>")
    319               .arg (vboxGlobal().virtualBox().GetVersion())
    320               .arg (vboxGlobal().platformInfo());
    321 
    322     /* Show progress bar & send composed information */
    323     mPbCheck->show();
    324     mTimeout->start (MaxWaitTime);
    325     mNetfw->postRequest (mUrl.host(), mUrl.path(), body, header);
    326 }
    327 
    328 void VBoxUpdateDlg::retranslateUi()
    329 {
    330     /* Translate uic generated strings */
    331     Ui::VBoxUpdateDlg::retranslateUi (this);
    332 }
    333 
    334 void VBoxUpdateDlg::processTimeout()
    335 {
    336     networkAbort (tr ("Connection timed out."));
    337 }
    338 
    339 /* Handles the network request begining. */
    340 void VBoxUpdateDlg::onNetBegin (int aStatus)
    341 {
    342     if (mSuicide) return;
    343 
    344     if (aStatus == 404)
    345         networkAbort (tr ("Could not locate the latest version "
    346             "list on the server (response: %1).").arg (aStatus));
    347     else
    348         mTimeout->start (MaxWaitTime);
    349 }
    350 
    351 /* Handles the network request data incoming. */
    352 void VBoxUpdateDlg::onNetData (const QByteArray&)
    353 {
    354     if (mSuicide) return;
    355 
    356     mTimeout->start (MaxWaitTime);
    357 }
    358 
    359 /* Handles the network request end. */
    360 void VBoxUpdateDlg::onNetEnd (const QByteArray &aTotalData)
    361 {
    362     if (mSuicide) return;
    363 
    364     mTimeout->stop();
    365     processResponse (aTotalData);
    366 }
    367 
    368 /* Handles the network error. */
    369 void VBoxUpdateDlg::onNetError (const QString &aError)
    370 {
    371     networkAbort (aError);
     402        count = sc.toLongLong (&ok);
     403    vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_UpdateCheckCount,
     404                                            QString ("%1").arg ((qulonglong) count + 1));
    372405}
    373406
     
    380413}
    381414
    382 void VBoxUpdateDlg::networkAbort (const QString &aReason)
    383 {
    384     /* Protect against double kill request. */
    385     if (mSuicide) return;
    386     mSuicide = true;
    387 
     415void VBoxUpdateDlg::abortRequest (const QString &aReason)
     416{
    388417    /* Hide progress bar */
    389418    mPbCheck->hide();
     
    405434}
    406435
    407 void VBoxUpdateDlg::processResponse (const QString &aResponse)
    408 {
    409     /* Hide progress bar */
    410     mPbCheck->hide();
    411 
    412     if (aResponse.indexOf (QRegExp ("^\\d+\\.\\d+\\.\\d+ \\S+$")) == 0)
    413     {
    414         /* Newer version of necessary package found */
    415         QStringList response = aResponse.split (" ", QString::SkipEmptyParts);
    416 
    417         if (isHidden())
    418         {
    419             /* For background update */
    420             vboxProblem().showUpdateSuccess (vboxGlobal().mainWindow(),
    421                 response [0], response [1]);
    422             QTimer::singleShot (0, this, SLOT (accept()));
    423         }
    424         else
    425         {
    426             /* For wizard update */
    427             mTextSuccessInfo->setText (mTextSuccessInfo->text()
    428                 .arg (response [0], response [1], response [1]));
    429             mTextSuccessInfo->show();
    430             mPageStack->setCurrentIndex (1);
    431         }
    432     }
    433     else /* if (aResponse == "UPTODATE") */
    434     {
    435         /* No newer version of necessary package found */
    436         if (isHidden())
    437         {
    438             /* For background update */
    439             if (mForceRun)
    440                 vboxProblem().showUpdateNotFound (vboxGlobal().mainWindow());
    441             QTimer::singleShot (0, this, SLOT (accept()));
    442         }
    443         else
    444         {
    445             /* For wizard update */
    446             mTextNotFoundInfo->show();
    447             mPageStack->setCurrentIndex (1);
    448         }
    449     }
    450 
    451     int count = 1;
    452     bool ok = false;
    453     QString sc = vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_UpdateCheckCount);
    454     if (!sc.isEmpty())
    455         count = sc.toLongLong(&ok);
    456     vboxGlobal().virtualBox().SetExtraData (VBoxDefs::GUI_UpdateCheckCount,
    457                                             QString ("%1").arg ((qulonglong) count + 1));
    458 }
    459 
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxRegistrationDlg.ui

    r12030 r14274  
    3030   <string>VirtualBox Registration Dialog</string>
    3131  </property>
    32   <property name="windowIcon" >
    33    <iconset resource="../VirtualBox.qrc" >:/register_16px.png</iconset>
    34   </property>
    3532  <layout class="QVBoxLayout" >
    3633   <property name="leftMargin" >
  • trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxUpdateDlg.ui

    r12030 r14274  
    2727   </rect>
    2828  </property>
    29   <property name="windowTitle" >
    30    <string>VirtualBox Update Wizard</string>
    31   </property>
    32   <property name="windowIcon" >
    33    <iconset resource="../VirtualBox.qrc" >:/refresh_16px.png</iconset>
    34   </property>
    3529  <layout class="QVBoxLayout" >
    3630   <property name="leftMargin" >
     
    6357          </font>
    6458         </property>
    65          <property name="text" >
    66           <string>Check for Updates</string>
    67          </property>
    6859        </widget>
    6960       </item>
     
    112103              </size>
    113104             </property>
    114              <property name="text" >
    115               <string>&lt;p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.&lt;/p>
    116 &lt;p>Use the &lt;b>Check&lt;/b> button to check for a new version now or the &lt;b>Cancel&lt;/b> button if you do not want to perform this check.&lt;/p>
    117 &lt;p>You can run this wizard at any time by choosing &lt;b>Check for Updates...&lt;/b> from the &lt;b>Help&lt;/b> menu.&lt;/p></string>
    118              </property>
    119105             <property name="wordWrap" >
    120106              <bool>true</bool>
     
    188174         <item>
    189175          <widget class="QPushButton" name="mBtnCheck" >
    190            <property name="text" >
    191             <string>Chec&amp;k</string>
    192            </property>
    193176           <property name="default" >
    194177            <bool>true</bool>
     
    213196         </item>
    214197         <item>
    215           <widget class="QPushButton" name="mBtnCancel" >
    216            <property name="text" >
    217             <string>Cancel</string>
    218            </property>
    219           </widget>
     198          <widget class="QPushButton" name="mBtnCancel" />
    220199         </item>
    221200        </layout>
     
    235214          </font>
    236215         </property>
    237          <property name="text" >
    238           <string>Summary</string>
    239          </property>
    240216        </widget>
    241217       </item>
     
    288264                 <height>0</height>
    289265                </size>
    290                </property>
    291                <property name="text" >
    292                 <string>&lt;p>A new version of VirtualBox has been released! Version &lt;b>%1&lt;/b> is available at &lt;a href="http://www.virtualbox.org/">virtualbox.org&lt;/a>.&lt;/p>&lt;p>You can download this version from this direct link:&lt;/p>&lt;p>&lt;a href=%2>%3&lt;/a>&lt;/p></string>
    293266               </property>
    294267               <property name="wordWrap" >
     
    311284                </size>
    312285               </property>
    313                <property name="text" >
    314                 <string>&lt;p>Unable to obtain the new version information due to the following network error:&lt;/p>&lt;p>&lt;b>%1&lt;/b>&lt;/p></string>
    315                </property>
    316286               <property name="wordWrap" >
    317287                <bool>true</bool>
     
    333303                </size>
    334304               </property>
    335                <property name="text" >
    336                 <string>You have already installed the latest VirtualBox version. Please repeat the version check later.</string>
    337                </property>
    338305               <property name="wordWrap" >
    339306                <bool>true</bool>
     
    387354         <item>
    388355          <widget class="QPushButton" name="mBtnFinish" >
    389            <property name="text" >
    390             <string>&amp;Close</string>
    391            </property>
    392356           <property name="default" >
    393357            <bool>true</bool>
Note: See TracChangeset for help on using the changeset viewer.

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