VirtualBox

Changeset 39337 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 16, 2011 3:51:11 PM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: Update Manager rework: Support update queue, which can now synchronously process enqueued activities (For now there are two of them: 1. Checking for a new VBox version, 2. Checking/Updating of VBox Extension Pack).

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
5 edited

Legend:

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

    r38977 r39337  
    366366        src/globals/UIActionPool.cpp \
    367367        src/globals/UIExtraDataEventHandler.cpp \
     368        src/net/UIUpdateManager.cpp \
    368369        src/runtime/UIActionPoolRuntime.cpp \
    369370        src/runtime/UIIndicatorsPool.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp

    r39326 r39337  
    5252
    5353/* static */
    54 void UIDownloaderExtensionPack::download(QObject *pListener)
     54UIDownloaderExtensionPack* UIDownloaderExtensionPack::create()
    5555{
    56     /* Create and configure the Extension Pack downloader: */
    57     UIDownloaderExtensionPack *pDownloader = new UIDownloaderExtensionPack;
    58     pDownloader->setParentWidget(msgCenter().mainWindowShown());
    59     /* After downloading finished => propose to install the Extension Pack: */
    60     connect(pDownloader, SIGNAL(sigNotifyAboutExtensionPackDownloaded(const QString &, const QString &)),
    61             pListener, SLOT(sltHandleDownloadedExtensionPack(const QString &, const QString &)));
    62     /* Start downloading: */
    63     pDownloader->start();
     56    if (!m_pInstance)
     57        m_pInstance = new UIDownloaderExtensionPack;
     58    return m_pInstance;
     59}
     60
     61/* static */
     62UIDownloaderExtensionPack* UIDownloaderExtensionPack::current()
     63{
     64    return m_pInstance;
    6465}
    6566
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.h

    r39326 r39337  
    4747public:
    4848
    49     /* Returns updater if exists: */
    50     static UIDownloaderExtensionPack* current() { return m_pInstance; }
    51     /* Start downloading: */
    52     static void download(QObject *pListener);
     49    /* Create downloader: */
     50    static UIDownloaderExtensionPack* create();
     51    /* Return downloader: */
     52    static UIDownloaderExtensionPack* current();
     53
     54    /* Starts downloading: */
     55    void start();
    5356
    5457signals:
     
    5659    /* Notify listeners about extension pack downloaded: */
    5760    void sigNotifyAboutExtensionPackDownloaded(const QString &strSource, const QString &strTarget);
    58 
    59 protected:
    60 
    61     /* Starts downloading: */
    62     void start();
    6361
    6462private:
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp

    r39326 r39337  
    2323#include <QTimer>
    2424#include <QDir>
    25 
     25#include <QPointer>
    2626#include <VBox/version.h>
    2727
    2828/* Local includes: */
     29#include "UIUpdateDefs.h"
    2930#include "UIUpdateManager.h"
    3031#include "UINetworkManager.h"
     
    3940using namespace VBoxGlobalDefs;
    4041
     42/* Interface representing update step: */
     43class UIUpdateStep : public QObject
     44{
     45    Q_OBJECT;
     46
     47public:
     48
     49    /* Constructor: */
     50    UIUpdateStep()
     51    {
     52        /* Connect completion-signal of the step to the destruction-slot of the step: */
     53        connect(this, SIGNAL(sigStepComplete()), this, SLOT(deleteLater()), Qt::QueuedConnection);
     54    }
     55
     56signals:
     57
     58    /* Completion-signal of the step: */
     59    void sigStepComplete();
     60
     61protected slots:
     62
     63    /* Starting-slot of the step: */
     64    virtual void sltStartStep() = 0;
     65};
     66
     67/* Queue for processing update steps: */
     68class UIUpdateQueue : public QObject
     69{
     70    Q_OBJECT;
     71
     72public:
     73
     74    /* Constructor: */
     75    UIUpdateQueue(UIUpdateManager *pParent) : QObject(pParent) {}
     76
     77    /* Enqueue passed-step with previously queued (if any) passed-steps: */
     78    void add(UIUpdateStep *pStep)
     79    {
     80        /* Set 'this' as parent for passed step,
     81         * that way passed-step could be cleaned-up in case of queue destruction: */
     82        pStep->setParent(this);
     83
     84        /* If queue had no passed-steps yet: */
     85        if (!m_pLastStep)
     86        {
     87            /* Connect starting-signal of the queue to starting-slot of the passed-step: */
     88            connect(this, SIGNAL(sigStartQueue()), pStep, SLOT(sltStartStep()), Qt::QueuedConnection);
     89        }
     90        /* If queue already had at least one passed-step: */
     91        else
     92        {
     93            /* Reconnect completion-signal of the last-step from completion-signal of the queue to starting-slot of the passed-step: */
     94            disconnect(m_pLastStep, SIGNAL(sigStepComplete()), this, SIGNAL(sigQueueFinished()));
     95            connect(m_pLastStep, SIGNAL(sigStepComplete()), pStep, SLOT(sltStartStep()), Qt::QueuedConnection);
     96        }
     97
     98        /* Connect completion-signal of the passed-step to the completion-signal of the queue: */
     99        connect(pStep, SIGNAL(sigStepComplete()), this, SIGNAL(sigQueueFinished()), Qt::QueuedConnection);
     100
     101        /* Remember last-step: */
     102        m_pLastStep = pStep;
     103    }
     104
     105    /* Starts a queue: */
     106    void start()
     107    {
     108        /* Emit signal which starts queue: */
     109        emit sigStartQueue();
     110    }
     111
     112signals:
     113
     114    /* Starting-signal of the queue: */
     115    void sigStartQueue();
     116
     117    /* Completion-signal of the queue: */
     118    void sigQueueFinished();
     119
     120private:
     121
     122    /* Guarded pointer to the last passed-step: */
     123    QPointer<UIUpdateStep> m_pLastStep;
     124};
     125
     126/* Update step to check for the new VirtualBox version: */
     127class UIUpdateStepVirtualBox : public UIUpdateStep
     128{
     129    Q_OBJECT;
     130
     131public:
     132
     133    /* Constructor: */
     134    UIUpdateStepVirtualBox(bool fForceCall)
     135        : m_url("http://update.virtualbox.org/query.php")
     136        , m_fForceCall(fForceCall)
     137    {
     138    }
     139
     140private slots:
     141
     142    /* Startup slot: */
     143    void sltStartStep()
     144    {
     145        /* Calculate the count of checks left: */
     146        int cCount = 1;
     147        QString strCount = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_UpdateCheckCount);
     148        if (!strCount.isEmpty())
     149        {
     150            bool ok = false;
     151            int c = strCount.toLongLong(&ok);
     152            if (ok) cCount = c;
     153        }
     154
     155        /* Compose query: */
     156        QUrl url(m_url);
     157        url.addQueryItem("platform", vboxGlobal().virtualBox().GetPackageType());
     158        /* Check if branding is active: */
     159        if (vboxGlobal().brandingIsActive())
     160        {
     161            /* Branding: Check whether we have a local branding file which tells us our version suffix "FOO"
     162                         (e.g. 3.06.54321_FOO) to identify this installation: */
     163            url.addQueryItem("version", QString("%1_%2_%3").arg(vboxGlobal().virtualBox().GetVersion())
     164                                                           .arg(vboxGlobal().virtualBox().GetRevision())
     165                                                           .arg(vboxGlobal().brandingGetKey("VerSuffix")));
     166        }
     167        else
     168        {
     169            /* Use hard coded version set by VBOX_VERSION_STRING: */
     170            url.addQueryItem("version", QString("%1_%2").arg(vboxGlobal().virtualBox().GetVersion())
     171                                                        .arg(vboxGlobal().virtualBox().GetRevision()));
     172        }
     173        url.addQueryItem("count", QString::number(cCount));
     174        url.addQueryItem("branch", VBoxUpdateData(vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_UpdateDate)).branchName());
     175        QString strUserAgent(QString("VirtualBox %1 <%2>").arg(vboxGlobal().virtualBox().GetVersion()).arg(vboxGlobal().platformInfo()));
     176
     177        /* Setup GET request: */
     178        QNetworkRequest request;
     179        request.setUrl(url);
     180        request.setRawHeader("User-Agent", strUserAgent.toAscii());
     181        QNetworkReply *pReply = gNetworkManager->get(request);
     182        connect(pReply, SIGNAL(sslErrors(QList<QSslError>)), pReply, SLOT(ignoreSslErrors()));
     183        connect(pReply, SIGNAL(finished()), this, SLOT(sltHandleCheckReply()));
     184    }
     185
     186    /* Finishing slot: */
     187    void sltHandleCheckReply()
     188    {
     189        /* Get corresponding network reply object: */
     190        QNetworkReply *pReply = qobject_cast<QNetworkReply*>(sender());
     191        /* And ask it for suicide: */
     192        pReply->deleteLater();
     193
     194        /* Handle normal result: */
     195        if (pReply->error() == QNetworkReply::NoError)
     196        {
     197            /* Deserialize incoming data: */
     198            QString strResponseData(pReply->readAll());
     199
     200            /* Newer version of necessary package found: */
     201            if (strResponseData.indexOf(QRegExp("^\\d+\\.\\d+\\.\\d+ \\S+$")) == 0)
     202            {
     203                QStringList response = strResponseData.split(" ", QString::SkipEmptyParts);
     204                msgCenter().showUpdateSuccess(vboxGlobal().mainWindow(), response[0], response[1]);
     205            }
     206            /* No newer version of necessary package found: */
     207            else
     208            {
     209                if (m_fForceCall)
     210                    msgCenter().showUpdateNotFound(vboxGlobal().mainWindow());
     211            }
     212
     213            /* Save left count of checks: */
     214            int cCount = 1;
     215            QString strCount = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_UpdateCheckCount);
     216            if (!strCount.isEmpty())
     217            {
     218                bool ok = false;
     219                int c = strCount.toLongLong(&ok);
     220                if (ok) cCount = c;
     221            }
     222            vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_UpdateCheckCount, QString("%1").arg((qulonglong)cCount + 1));
     223        }
     224        /* Handle errors: */
     225        else
     226        {
     227            if (m_fForceCall)
     228                msgCenter().showUpdateFailure(vboxGlobal().mainWindow(), pReply->errorString());
     229        }
     230
     231        /* Notify about step completion: */
     232        emit sigStepComplete();
     233    }
     234
     235private:
     236
     237    /* Variables: */
     238    QUrl m_url;
     239    bool m_fForceCall;
     240};
     241
     242/* Update step to check for the new VirtualBox Extension Pack version: */
     243class UIUpdateStepVirtualBoxExtensionPack : public UIUpdateStep
     244{
     245    Q_OBJECT;
     246
     247public:
     248
     249    /* Constructor: */
     250    UIUpdateStepVirtualBoxExtensionPack() {}
     251
     252private slots:
     253
     254    /* Startup slot: */
     255    void sltStartStep()
     256    {
     257        /* Return if already downloading: */
     258        if (UIDownloaderExtensionPack::current())
     259        {
     260            emit sigStepComplete();
     261            return;
     262        }
     263
     264        /* Get extension pack: */
     265        CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(UI_ExtPackName);
     266        /* Return if extension pack is NOT installed: */
     267        if (extPack.isNull())
     268        {
     269            emit sigStepComplete();
     270            return;
     271        }
     272
     273        /* Get VirtualBox version: */
     274        QString strVBoxVersion(vboxGlobal().vboxVersionStringNormalized());
     275        VBoxVersion vboxVersion(strVBoxVersion);
     276        /* Get extension pack version: */
     277        QString strExtPackVersion(extPack.GetVersion().remove(VBOX_BUILD_PUBLISHER));
     278        VBoxVersion extPackVersion(strExtPackVersion);
     279        /* Check if extension pack version less than required: */
     280        if ((vboxVersion.z() % 2 != 0) /* Skip unstable VBox version */ ||
     281            !(extPackVersion < vboxVersion) /* Ext Pack version more or equal to VBox version */)
     282        {
     283            emit sigStepComplete();
     284            return;
     285        }
     286
     287        if (strExtPackVersion.contains("ENTERPRISE"))
     288        {
     289            /* Inform the user that he should update the extension pack: */
     290            msgCenter().requestUserDownloadExtensionPack(UI_ExtPackName, strExtPackVersion, strVBoxVersion);
     291            /* Never try to download for ENTERPRISE version: */
     292            emit sigStepComplete();
     293            return;
     294        }
     295        else
     296        {
     297            /* Ask the user about extension pack downloading: */
     298            if (!msgCenter().proposeDownloadExtensionPack(UI_ExtPackName, strExtPackVersion))
     299            {
     300                emit sigStepComplete();
     301                return;
     302            }
     303        }
     304
     305        /* Create and configure the Extension Pack downloader: */
     306        UIDownloaderExtensionPack *pDl = UIDownloaderExtensionPack::create();
     307        pDl->setParentWidget(msgCenter().mainWindowShown());
     308        /* After downloading finished => propose to install the Extension Pack: */
     309        connect(pDl, SIGNAL(sigNotifyAboutExtensionPackDownloaded(const QString &, const QString &)),
     310                this, SLOT(sltHandleDownloadedExtensionPack(const QString &, const QString &)));
     311        /* Also, destroyed downloader is a signal to finish the step: */
     312        connect(pDl, SIGNAL(destroyed(QObject*)), this, SIGNAL(sigStepComplete()));
     313        /* Start downloading: */
     314        pDl->start();
     315    }
     316
     317    /* Finishing slot: */
     318    void sltHandleDownloadedExtensionPack(const QString &strSource, const QString &strTarget)
     319    {
     320        /* Warn the user about extension pack was downloaded and saved, propose to install it: */
     321        if (msgCenter().proposeInstallExtentionPack(UI_ExtPackName, strSource, QDir::toNativeSeparators(strTarget)))
     322            UIGlobalSettingsExtension::doInstallation(strTarget, msgCenter().mainWindowShown(), NULL);
     323    }
     324};
     325
    41326/* UIUpdateManager stuff: */
    42327UIUpdateManager* UIUpdateManager::m_pInstance = 0;
     
    67352{
    68353    /* Force call for new version check: */
    69     sltCheckIfUpdateIsNecessary(true);
     354    sltCheckIfUpdateIsNecessary(true /* force call */);
    70355}
    71356
    72357UIUpdateManager::UIUpdateManager()
    73     : m_uTime(1 /* day */ * 24 /* hours */ * 60 /* minutes */ * 60 /* seconds */ * 1000 /* ms */)
     358    : m_pQueue(new UIUpdateQueue(this))
     359    , m_uTime(1 /* day */ * 24 /* hours */ * 60 /* minutes */ * 60 /* seconds */ * 1000 /* ms */)
    74360{
    75361    /* Prepare instance: */
    76362    if (m_pInstance != this)
    77363        m_pInstance = this;
     364
     365    /* Configure queue: */
     366    connect(m_pQueue, SIGNAL(sigQueueFinished()), this, SLOT(sltHandleUpdateFinishing()));
    78367
    79368#ifdef VBOX_WITH_UPDATE_REQUEST
     
    96385    VBoxUpdateData currentData(vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_UpdateDate));
    97386
    98     /* Check if update is really neessary: */
     387    /* If update is really necessary: */
    99388    if (fForceCall || currentData.isNeedToCheck())
    100389    {
    101         /* Check if update is necessary for VirtualBox itself: */
    102         checkIfUpdateIsNecessary(fForceCall);
    103 
    104         /* Check if update is necessary for VirtualBox extension pack: */
    105         checkIfUpdateIsNecessaryForExtensionPack(fForceCall);
    106 
    107         /* Encode/save new update data: */
    108         VBoxUpdateData newData(currentData.periodIndex(), currentData.branchIndex());
    109         vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_UpdateDate, newData.data());
    110     }
     390        /* Prepare update queue: */
     391        m_pQueue->add(new UIUpdateStepVirtualBox(fForceCall));
     392        m_pQueue->add(new UIUpdateStepVirtualBoxExtensionPack);
     393        /* Start update queue: */
     394        m_pQueue->start();
     395    }
     396    else
     397        sltHandleUpdateFinishing();
     398}
     399
     400void UIUpdateManager::sltHandleUpdateFinishing()
     401{
     402    /* Load/decode curent update data: */
     403    VBoxUpdateData currentData(vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_UpdateDate));
     404    /* Encode/save new update data: */
     405    VBoxUpdateData newData(currentData.periodIndex(), currentData.branchIndex());
     406    vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_UpdateDate, newData.data());
    111407
    112408#ifdef VBOX_WITH_UPDATE_REQUEST
     
    116412}
    117413
    118 void UIUpdateManager::checkIfUpdateIsNecessary(bool fForceCall)
    119 {
    120     /* Creating VirtualBox version checker: */
    121     UINewVersionChecker checker(fForceCall);
    122     /* Start synchronous check: */
    123     checker.checkForTheNewVersion();
    124 }
    125 
    126 void UIUpdateManager::checkIfUpdateIsNecessaryForExtensionPack(bool /* fForceCall */)
    127 {
    128     /* Check if updater instance already created: */
    129     if (UIDownloaderExtensionPack::current())
    130         return;
    131 
    132     /* Get extension pack information: */
    133     CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(UI_ExtPackName);
    134     /* Check if extension pack is really installed: */
    135     if (extPack.isNull())
    136         return;
    137 
    138     /* Get VirtualBox version: */
    139     QString strVBoxVersion(vboxGlobal().vboxVersionStringNormalized());
    140     VBoxVersion vboxVersion(strVBoxVersion);
    141     /* Get extension pack version: */
    142     QString strExtPackVersion(extPack.GetVersion().remove(VBOX_BUILD_PUBLISHER));
    143     VBoxVersion extPackVersion(strExtPackVersion);
    144     /* Check if extension pack version less than required: */
    145     if ((vboxVersion.z() % 2 != 0) /* Skip unstable VBox version */ ||
    146         !(extPackVersion < vboxVersion) /* Ext Pack version more or equal to VBox version */)
    147         return;
    148 
    149     if (strExtPackVersion.contains("ENTERPRISE"))
    150     {
    151         /* Inform the user that he should update the extension pack: */
    152         msgCenter().requestUserDownloadExtensionPack(UI_ExtPackName, strExtPackVersion, strVBoxVersion);
    153         /* Never try to download here! */
    154         return;
    155     }
    156     else
    157     {
    158         /* Ask the user about extension pack downloading: */
    159         if (!msgCenter().proposeDownloadExtensionPack(UI_ExtPackName, strExtPackVersion))
    160             return;
    161     }
    162 
    163     /* Run downloader for VirtualBox extension pack: */
    164     UIDownloaderExtensionPack::download(this);
    165 }
    166 
    167 void UIUpdateManager::sltHandleDownloadedExtensionPack(const QString &strSource, const QString &strTarget)
    168 {
    169     /* Warn the user about extension pack was downloaded and saved, propose to install it: */
    170     if (msgCenter().proposeInstallExtentionPack(UI_ExtPackName, strSource, QDir::toNativeSeparators(strTarget)))
    171         UIGlobalSettingsExtension::doInstallation(strTarget, msgCenter().mainWindowShown(), NULL);
    172 }
    173 
    174 /* UINewVersionChecker stuff: */
    175 UINewVersionChecker::UINewVersionChecker(bool fForceCall)
    176     : m_url("http://update.virtualbox.org/query.php")
    177     , m_fForceCall(fForceCall)
    178     , m_pLoop(new QEventLoop(this))
    179 {
    180 }
    181 
    182 void UINewVersionChecker::checkForTheNewVersion()
    183 {
    184     /* Calculate the count of checks left: */
    185     int cCount = 1;
    186     QString strCount = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_UpdateCheckCount);
    187     if (!strCount.isEmpty())
    188     {
    189         bool ok = false;
    190         int c = strCount.toLongLong(&ok);
    191         if (ok) cCount = c;
    192     }
    193 
    194     /* Compose query: */
    195     QUrl url(m_url);
    196     url.addQueryItem("platform", vboxGlobal().virtualBox().GetPackageType());
    197     /* Check if branding is active: */
    198     if (vboxGlobal().brandingIsActive())
    199     {
    200         /* Branding: Check whether we have a local branding file which tells us our version suffix "FOO"
    201                      (e.g. 3.06.54321_FOO) to identify this installation: */
    202         url.addQueryItem("version", QString("%1_%2_%3").arg(vboxGlobal().virtualBox().GetVersion())
    203                                                        .arg(vboxGlobal().virtualBox().GetRevision())
    204                                                        .arg(vboxGlobal().brandingGetKey("VerSuffix")));
    205     }
    206     else
    207     {
    208         /* Use hard coded version set by VBOX_VERSION_STRING: */
    209         url.addQueryItem("version", QString("%1_%2").arg(vboxGlobal().virtualBox().GetVersion())
    210                                                     .arg(vboxGlobal().virtualBox().GetRevision()));
    211     }
    212     url.addQueryItem("count", QString::number(cCount));
    213     url.addQueryItem("branch", VBoxUpdateData(vboxGlobal().virtualBox().
    214                                               GetExtraData(VBoxDefs::GUI_UpdateDate)).branchName());
    215     QString strUserAgent(QString("VirtualBox %1 <%2>")
    216                             .arg(vboxGlobal().virtualBox().GetVersion())
    217                             .arg(vboxGlobal().platformInfo()));
    218 
    219     /* Setup GET request: */
    220     QNetworkRequest request;
    221     request.setUrl(url);
    222     request.setRawHeader("User-Agent", strUserAgent.toAscii());
    223     QNetworkReply *pReply = gNetworkManager->get(request);
    224     connect(pReply, SIGNAL(finished()), this, SLOT(sltHandleCheckReply()));
    225     connect(pReply, SIGNAL(sslErrors(QList<QSslError>)), pReply, SLOT(ignoreSslErrors()));
    226 
    227     /* Lock event loop: */
    228     m_pLoop->exec();
    229 }
    230 
    231 void UINewVersionChecker::sltHandleCheckReply()
    232 {
    233     /* Get corresponding network reply object: */
    234     QNetworkReply *pReply = qobject_cast<QNetworkReply*>(sender());
    235     /* And ask it for suicide: */
    236     pReply->deleteLater();
    237 
    238     /* Handle normal result: */
    239     if (pReply->error() == QNetworkReply::NoError)
    240     {
    241         /* Deserialize incoming data: */
    242         QString strResponseData(pReply->readAll());
    243 
    244         /* Newer version of necessary package found: */
    245         if (strResponseData.indexOf(QRegExp("^\\d+\\.\\d+\\.\\d+ \\S+$")) == 0)
    246         {
    247             QStringList response = strResponseData.split(" ", QString::SkipEmptyParts);
    248             msgCenter().showUpdateSuccess(vboxGlobal().mainWindow(), response[0], response[1]);
    249         }
    250         /* No newer version of necessary package found: */
    251         else
    252         {
    253             if (m_fForceCall)
    254                 msgCenter().showUpdateNotFound(vboxGlobal().mainWindow());
    255         }
    256 
    257         /* Save left count of checks: */
    258         int cCount = 1;
    259         QString strCount = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_UpdateCheckCount);
    260         if (!strCount.isEmpty())
    261         {
    262             bool ok = false;
    263             int c = strCount.toLongLong(&ok);
    264             if (ok) cCount = c;
    265         }
    266         vboxGlobal().virtualBox().SetExtraData(VBoxDefs::GUI_UpdateCheckCount, QString("%1").arg((qulonglong)cCount + 1));
    267     }
    268     /* Handle errors: */
    269     else
    270     {
    271         if (m_fForceCall)
    272             msgCenter().showUpdateFailure(vboxGlobal().mainWindow(), pReply->errorString());
    273     }
    274 
    275     /* Unlock event loop: */
    276     m_pLoop->exit();
    277 }
    278 
     414#include "UIUpdateManager.moc"
     415
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.h

    r39326 r39337  
    2121
    2222/* Global includes: */
    23 #include <QUrl>
    24 
    25 /* Local includes: */
    26 #include "UIUpdateDefs.h"
     23#include <QObject>
    2724
    2825/* Forward declarations: */
    29 class QEventLoop;
     26class UIUpdateQueue;
    3027
    31 /* Singleton to check for the new VirtualBox version.
    32  * Performs update of required parts if necessary. */
     28/* Singleton to perform new version checks and
     29 * updates of various VirtualBox parts. */
    3330class UIUpdateManager : public QObject
    3431{
     
    5451    void sltCheckIfUpdateIsNecessary(bool fForceCall = false);
    5552
    56     /* Handle downloaded extension pack: */
    57     void sltHandleDownloadedExtensionPack(const QString &strSource, const QString &strTarget);
     53    /* Slot to handle update finishing: */
     54    void sltHandleUpdateFinishing();
    5855
    5956private:
     
    6360    ~UIUpdateManager();
    6461
    65     /* Helping stuff: */
    66     void checkIfUpdateIsNecessary(bool fForceCall);
    67     void checkIfUpdateIsNecessaryForExtensionPack(bool fForceCall);
    68 
    6962    /* Variables: */
    7063    static UIUpdateManager* m_pInstance;
     64    UIUpdateQueue *m_pQueue;
    7165    quint64 m_uTime;
    7266};
    7367#define gUpdateManager UIUpdateManager::instance()
    7468
    75 /* Class to check for the new VirtualBox version: */
    76 class UINewVersionChecker : public QObject
    77 {
    78     Q_OBJECT;
    79 
    80 public:
    81 
    82     /* Constructor: */
    83     UINewVersionChecker(bool fForceCall);
    84 
    85     /* Function to check if new version is available: */
    86     void checkForTheNewVersion();
    87 
    88 private slots:
    89 
    90     /* Slot to analyze new version check reply: */
    91     void sltHandleCheckReply();
    92 
    93 private:
    94 
    95     /* Variables: */
    96     QUrl m_url;
    97     bool m_fForceCall;
    98     QEventLoop *m_pLoop;
    99 };
    100 
    10169#endif // __UIUpdateManager_h__
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