VirtualBox

Changeset 43855 in vbox


Ignore:
Timestamp:
Nov 12, 2012 11:58:16 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: 6338: UIProgressDialog will be reflecting cancelable state at runtime (making corresponding button enabled/disabled).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp

    r43104 r43855  
    5050  , m_progress(progress)
    5151  , m_pImageLbl(0)
    52   , m_pCancelBtn(0)
    5352  , m_fCancelEnabled(false)
    5453  , m_cOperations(m_progress.GetOperationCount())
     
    109108    m_progressBar->setValue(0);
    110109    m_fCancelEnabled = m_progress.GetCancelable();
    111     if (m_fCancelEnabled)
    112     {
    113         m_pCancelBtn = new UIMiniCancelButton(this);
    114         m_pCancelBtn->setFocusPolicy(Qt::ClickFocus);
    115         pLayout2->addWidget(m_pCancelBtn, 0, Qt::AlignVCenter);
    116         connect(m_pCancelBtn, SIGNAL(clicked()), this, SLOT(cancelOperation()));
    117     }
     110    m_pCancelBtn = new UIMiniCancelButton(this);
     111    m_pCancelBtn->setEnabled(m_fCancelEnabled);
     112    m_pCancelBtn->setFocusPolicy(Qt::ClickFocus);
     113    pLayout2->addWidget(m_pCancelBtn, 0, Qt::AlignVCenter);
     114    connect(m_pCancelBtn, SIGNAL(clicked()), this, SLOT(cancelOperation()));
    118115
    119116    m_pEtaLbl = new QILabel(this);
     
    143140{
    144141    m_strCancel = tr("Canceling...");
    145     if (m_pCancelBtn)
    146     {
    147         m_pCancelBtn->setText(tr("&Cancel"));
    148         m_pCancelBtn->setToolTip(tr("Cancel the current operation"));
    149     }
     142    m_pCancelBtn->setText(tr("&Cancel"));
     143    m_pCancelBtn->setToolTip(tr("Cancel the current operation"));
    150144}
    151145
     
    287281        }
    288282        m_progressBar->setValue(m_progress.GetPercent());
     283
     284        /* Then cancel button: */
     285        m_fCancelEnabled = m_progress.GetCancelable();
     286        m_pCancelBtn->setEnabled(m_fCancelEnabled);
    289287    }
    290288    else
     
    313311void UIProgressDialog::cancelOperation()
    314312{
    315     if (m_pCancelBtn)
    316         m_pCancelBtn->setEnabled(false);
     313    m_pCancelBtn->setEnabled(false);
    317314    m_progress.Cancel();
    318315}
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