VirtualBox

Changeset 91717 in vbox for trunk/src


Ignore:
Timestamp:
Oct 13, 2021 3:23:17 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9974. Adding suppress check box to the dialog.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r91713 r91717  
    390390    {
    391391        case UIExtraDataMetaDefs::DialogType_VISOCreator: strResult = "VISOCreator"; break;
     392        case UIExtraDataMetaDefs::DialogType_BootFailure: strResult = "BootFailure"; break;
    392393        case UIExtraDataMetaDefs::DialogType_All:         strResult = "All"; break;
    393394        default:
     
    407408    QStringList keys;      QList<UIExtraDataMetaDefs::DialogType> values;
    408409    keys << "VISOCreator"; values << UIExtraDataMetaDefs::DialogType_VISOCreator;
     410    keys << "BootFailure"; values << UIExtraDataMetaDefs::DialogType_BootFailure;
    409411    keys << "All";         values << UIExtraDataMetaDefs::DialogType_All;
    410412    /* Invalid type for unknown words: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r91713 r91717  
    495495        DialogType_Invalid     = 0,
    496496        DialogType_VISOCreator = RT_BIT(0),
     497        DialogType_BootFailure = RT_BIT(1),
    497498        DialogType_All         = 0xFFFF
    498499    };
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIBootFailureDialog.cpp

    r91715 r91717  
    1818/* Qt includes: */
    1919#include <QAction>
     20#include <QCheckBox>
    2021#include <QHeaderView>
    2122#include <QLabel>
     
    2829#include "QIToolButton.h"
    2930#include "QIRichTextLabel.h"
    30 
     31#include "UIBootFailureDialog.h"
    3132#include "UICommon.h"
     33#include "UIConverter.h"
    3234#include "UIDesktopWidgetWatchdog.h"
    33 
     35#include "UIExtraDataManager.h"
    3436#include "UIFilePathSelector.h"
    35 #include "UIBootFailureDialog.h"
    36 
    3737#include "UIIconPool.h"
     38#include "UIMessageCenter.h"
    3839#include "UIModalWindowManager.h"
    39 #include "UIMessageCenter.h"
    40 
    41 
     40
     41/* COM includes: */
    4242#include "CMediumAttachment.h"
    4343#include "CStorageController.h"
     
    5454    , m_pBootImageSelector(0)
    5555    , m_pBootImageLabel(0)
     56    , m_pIconLabel(0)
     57    , m_pSuppressDialogCheckBox(0)
    5658    , m_comMachine(comMachine)
    5759{
    5860    configure();
     61}
     62
     63UIBootFailureDialog::~UIBootFailureDialog()
     64{
     65    if (m_pSuppressDialogCheckBox && m_pSuppressDialogCheckBox->isChecked())
     66    {
     67        QStringList suppressedMessageList = gEDataManager->suppressedMessages();
     68        suppressedMessageList << gpConverter->toInternalString(UIExtraDataMetaDefs::DialogType_BootFailure);
     69        gEDataManager->setSuppressedMessages(suppressedMessageList);
     70    }
    5971}
    6072
     
    7991    if (m_pBootImageLabel)
    8092        m_pBootImageLabel->setText(tr("Boot DVD:"));
     93    if (m_pSuppressDialogCheckBox)
     94        m_pSuppressDialogCheckBox->setText(tr("Do not show this dialog again"));
    8195}
    8296
     
    110124        return;
    111125
     126    QHBoxLayout *pTopLayout = new QHBoxLayout;
     127    pTopLayout->setContentsMargins(0, 0, 0, 0);
     128
     129    m_pIconLabel = new QLabel;
     130    if (m_pIconLabel)
     131    {
     132        m_pIconLabel->setPixmap(iconPixmap());
     133        m_pIconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
     134        pTopLayout->addWidget(m_pIconLabel, Qt::AlignTop | Qt::AlignCenter);
     135    }
     136
    112137    m_pLabel = new QIRichTextLabel;
    113138    if (m_pLabel)
    114         m_pMainLayout->addWidget(m_pLabel);
     139        pTopLayout->addWidget(m_pLabel);
    115140
    116141    QHBoxLayout *pSelectorLayout = new QHBoxLayout;
     
    134159                this, &UIBootFailureDialog::sltFileSelectorPathChanged);
    135160    }
     161
     162    m_pMainLayout->addLayout(pTopLayout);
    136163    m_pMainLayout->addLayout(pSelectorLayout);
     164
     165    m_pSuppressDialogCheckBox = new QCheckBox;
     166    if (m_pSuppressDialogCheckBox)
     167        m_pMainLayout->addWidget(m_pSuppressDialogCheckBox);
     168
    137169    m_pButtonBox = new QIDialogButtonBox;
    138170    if (m_pButtonBox)
     
    144176        m_pMainLayout->addWidget(m_pButtonBox);
    145177    }
     178
    146179    m_pMainLayout->addStretch();
    147180    retranslateUi();
     
    184217    if (m_pParent)
    185218        UIDesktopWidgetWatchdog::centerWidget(this, m_pParent, false);
    186 
     219    QIWithRetranslateUI<QIMainDialog>::showEvent(pEvent);
    187220}
    188221
     
    247280    insertBootMedium(uiCommon().openMedium(UIMediumDeviceType_DVD, strPath));
    248281}
     282
     283QPixmap UIBootFailureDialog::iconPixmap()
     284{
     285    QIcon icon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxWarning);
     286    if (icon.isNull())
     287        return QPixmap();
     288    int iSize = QApplication::style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0);
     289    return icon.pixmap(iSize, iSize);
     290}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIBootFailureDialog.h

    r91715 r91717  
    3030
    3131/* Forward declarations: */
     32class QCheckBox;
    3233class QLabel;
    3334class QVBoxLayout;
     
    5859
    5960    UIBootFailureDialog(QWidget *pParent, const CMachine &comMachine);
     61    ~UIBootFailureDialog();
    6062    QString bootMediumPath() const;
    6163
    6264protected:
    6365
    64     void showEvent(QShowEvent *pEvent);
    65 
     66    virtual void showEvent(QShowEvent *pEvent) /* override */;
    6667
    6768private slots:
     
    7475
    7576    bool insertBootMedium(const QUuid &uMediumId);
     77    QPixmap iconPixmap();
    7678
    7779    /** @name Event-handling stuff.
     
    100102    UIFilePathSelector   *m_pBootImageSelector;
    101103    QLabel               *m_pBootImageLabel;
     104    QLabel               *m_pIconLabel;
     105    QCheckBox            *m_pSuppressDialogCheckBox;
    102106    CMachine              m_comMachine;
    103107};
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r91715 r91717  
    667667        return askUserForTheDiskEncryptionPasswords();
    668668    else if (strErrorId == "VMBootFail")
    669         return showBootFailureDialog();
     669    {
     670        if (!gEDataManager->suppressedMessages().contains(gpConverter->toInternalString(UIExtraDataMetaDefs::DialogType_BootFailure)))
     671            return showBootFailureDialog();
     672        else
     673            return;
     674    }
    670675
    671676    /* Show runtime error: */
     
    32663271    int iResult = pBootFailureDialog->exec(false);
    32673272
    3268 
    32693273    delete pBootFailureDialog;
    32703274
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