VirtualBox

Changeset 55279 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 15, 2015 11:34:52 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99597
Message:

FE/Qt: 7676: Disk Encryption (DE) support: Reflecting encryption progress during settings save routine.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r52727 r55279  
    7878    Q_OBJECT;
    7979
     80signals:
     81
     82    /** Notifies listeners about particular operation progress change.
     83      * @param iOperations  holds the number of operations CProgress have,
     84      * @param strOperation holds the description of the current CProgress operation,
     85      * @param iOperation   holds the index of the current CProgress operation,
     86      * @param iPercent     holds the percentage of the current CProgress operation. */
     87    void sigOperationProgressChange(ulong iOperations, QString strOperation,
     88                                    ulong iOperation, ulong iPercent);
     89
    8090public:
    8191
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp

    r55276 r55279  
    2929# include "UISettingsPage.h"
    3030# include "UIIconPool.h"
     31# include "QILabel.h"
    3132#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3233
     
    144145            m_iIdOfHighPriorityPage = -1;
    145146        /* Process this page if its enabled: */
     147        connect(pPage, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
     148                this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)));
    146149        if (pPage->isEnabled())
    147150        {
     
    152155        }
    153156        /* Remember what page was processed: */
     157        disconnect(pPage, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
     158                   this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)));
    154159        pPage->setProcessed(true);
    155160        /* Remove processed page from our map: */
     
    174179}
    175180
     181QString UISettingsSerializerProgress::m_strProgressDescriptionTemplate = QString("<compact elipsis=\"middle\">%1 (%2/%3)</compact>");
     182
    176183UISettingsSerializerProgress::UISettingsSerializerProgress(QWidget *pParent, UISettingsSerializer::SerializationDirection direction,
    177184                                                           const QVariant &data, const UISettingsPageList &pages)
     
    183190    , m_pLabelOperationProgress(0)
    184191    , m_pBarOperationProgress(0)
     192    , m_pLabelSubOperationProgress(0)
     193    , m_pBarSubOperationProgress(0)
    185194{
    186195    /* Prepare: */
     
    222231        connect(m_pSerializer, SIGNAL(sigNotifyAboutPagesPostprocessed()),
    223232                this, SLOT(sltAdvanceProgressValue()));
     233        connect(m_pSerializer, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
     234                this, SLOT(sltHandleOperationProgressChange(ulong, QString, ulong, ulong)));
    224235    }
    225236
     
    276287                    pLayoutProgress->addWidget(m_pBarOperationProgress);
    277288                }
     289                /* Create sub-operation progress label: */
     290                m_pLabelSubOperationProgress = new QILabel;
     291                AssertPtrReturnVoid(m_pLabelSubOperationProgress);
     292                {
     293                    /* Configure label: */
     294                    m_pLabelSubOperationProgress->hide();
     295                    m_pLabelSubOperationProgress->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
     296                    /* Add label into layout: */
     297                    pLayoutProgress->addWidget(m_pLabelSubOperationProgress);
     298                }
     299                /* Create sub-operation progress bar: */
     300                m_pBarSubOperationProgress = new QProgressBar;
     301                AssertPtrReturnVoid(m_pBarSubOperationProgress);
     302                {
     303                    /* Configure progress bar: */
     304                    m_pBarSubOperationProgress->hide();
     305                    m_pBarSubOperationProgress->setMinimumWidth(300);
     306                    m_pBarSubOperationProgress->setMaximum(100);
     307                    m_pBarSubOperationProgress->setMinimum(0);
     308                    m_pBarSubOperationProgress->setValue(0);
     309                    /* Add bar into layout: */
     310                    pLayoutProgress->addWidget(m_pBarSubOperationProgress);
     311                }
    278312                /* Add stretch: */
    279313                pLayoutProgress->addStretch();
     
    317351void UISettingsSerializerProgress::sltAdvanceProgressValue()
    318352{
    319     /* Advance the serialize progress bar: */
     353    /* Advance the operation progress bar: */
    320354    AssertPtrReturnVoid(m_pBarOperationProgress);
    321355    m_pBarOperationProgress->setValue(m_pBarOperationProgress->value() + 1);
     
    324358void UISettingsSerializerProgress::sltProgressValueChanged(int iValue)
    325359{
     360    /* Hide the progress-dialog upon reaching the 100% progress: */
    326361    AssertPtrReturnVoid(m_pBarOperationProgress);
    327362    if (iValue == m_pBarOperationProgress->maximum())
     
    329364}
    330365
     366void UISettingsSerializerProgress::sltHandleOperationProgressChange(ulong iOperations, QString strOperation,
     367                                                                    ulong iOperation, ulong iPercent)
     368{
     369    /* Update the sub-operation progress label and bar: */
     370    AssertPtrReturnVoid(m_pLabelSubOperationProgress);
     371    AssertPtrReturnVoid(m_pBarSubOperationProgress);
     372    m_pLabelSubOperationProgress->show();
     373    m_pBarSubOperationProgress->show();
     374    m_pLabelSubOperationProgress->setText(m_strProgressDescriptionTemplate.arg(strOperation).arg(iOperation).arg(iOperations));
     375    m_pBarSubOperationProgress->setValue(iPercent);
     376}
     377
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h

    r55276 r55279  
    3333class UISettingsPage;
    3434class QProgressBar;
     35class QILabel;
    3536class QLabel;
    3637
     
    6263    /** Notifies listeners about process has been finished. */
    6364    void sigNotifyAboutProcessFinished();
     65
     66    /** Notifies listeners about particular operation progress change.
     67      * @param iOperations  holds the number of operations CProgress have,
     68      * @param strOperation holds the description of the current CProgress operation,
     69      * @param iOperation   holds the index of the current CProgress operation,
     70      * @param iPercent     holds the percentage of the current CProgress operation. */
     71    void sigOperationProgressChange(ulong iOperations, QString strOperation,
     72                                    ulong iOperation, ulong iPercent);
    6473
    6574public:
     
    179188    void sltProgressValueChanged(int iValue);
    180189
     190    /** Handles particular operation progress change.
     191      * @param iOperations  holds the number of operations CProgress have,
     192      * @param strOperation holds the description of the current CProgress operation,
     193      * @param iOperation   holds the index of the current CProgress operation,
     194      * @param iPercent     holds the percentage of the current CProgress operation. */
     195    void sltHandleOperationProgressChange(ulong iOperations, QString strOperation,
     196                                          ulong iOperation, ulong iPercent);
     197
    181198private:
    182199
     
    196213    /** Holds the operation progress bar. */
    197214    QProgressBar *m_pBarOperationProgress;
     215
     216    /** Holds the sub-operation progress label. */
     217    QILabel *m_pLabelSubOperationProgress;
     218    /** Holds the sub-operation progress bar. */
     219    QProgressBar *m_pBarSubOperationProgress;
     220
     221    /** Holds the template for the sub-operation progress label. */
     222    static QString m_strProgressDescriptionTemplate;
    198223};
    199224
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r55092 r55279  
    2525# include "QIWidgetValidator.h"
    2626# include "UIMachineSettingsGeneral.h"
    27  #include "UIModalWindowManager.h"
     27# include "UIModalWindowManager.h"
     28# include "UIProgressDialog.h"
    2829# include "UIMessageCenter.h"
    2930# include "UIConverter.h"
     
    336337
    337338                        /* Update encryption: */
    338                         CProgress progress = medium.ChangeEncryption(strOldPassword,
    339                                                                      strNewCipher,
    340                                                                      strNewPassword,
    341                                                                      strNewPasswordId);
     339                        CProgress cprogress = medium.ChangeEncryption(strOldPassword,
     340                                                                      strNewCipher,
     341                                                                      strNewPassword,
     342                                                                      strNewPasswordId);
    342343//                        if (!medium.isOk())
    343344//                            printf("  Medium API Error, rc = %s\n", msgCenter().formatRC(medium.lastRC()).toAscii().constData());
    344                         progress.WaitForCompletion(-1);
     345                        UIProgress uiprogress(cprogress);
     346                        connect(&uiprogress, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),
     347                                this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
     348                                Qt::QueuedConnection);
     349                        uiprogress.run(350);
    345350//                        if (!progress.isOk())
    346351//                            printf("  Progress API Error, rc = %s\n", msgCenter().formatRC(progress.lastRC()).toAscii().constData());
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