VirtualBox

Changeset 62080 in vbox for trunk


Ignore:
Timestamp:
Jul 6, 2016 5:33:31 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8399: Medium Type Change dialog cleanup/rework (part 03): Moving.

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

Legend:

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

    r62079 r62080  
    4040UIMediumTypeChangeDialog::UIMediumTypeChangeDialog(QWidget *pParent, const QString &strMediumID)
    4141    : QIWithRetranslateUI<QIDialog>(pParent)
    42 {
    43 #ifdef VBOX_WS_MAC
    44     // TODO: Is that necessary?
    45     setWindowFlags(Qt::Sheet);
    46 #else /* !VBOX_WS_MAC */
    47     /* Enable size-grip: */
    48     setSizeGripEnabled(true);
    49 #endif /* !VBOX_WS_MAC */
    50 
    51     /* Search for corresponding medium: */
    52     m_medium = vboxGlobal().medium(strMediumID).medium();
    53     m_enmMediumTypeOld = m_medium.GetType();
    54     m_enmMediumTypeNew = m_enmMediumTypeOld;
    55 
    56     /* Create main layout: */
    57     QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    58 
    59     /* Create label: */
    60     m_pLabel = new QILabel(this);
    61     /* Configure label: */
    62     m_pLabel->setWordWrap(true);
    63     m_pLabel->useSizeHintForWidth(450);
    64     m_pLabel->updateGeometry();
    65     /* Add label into main layout: */
    66     pMainLayout->addWidget(m_pLabel);
    67 
    68     /* Create group-box: */
    69     m_pGroupBox = new QGroupBox(this);
    70     /* Add group-box into main layout: */
    71     pMainLayout->addWidget(m_pGroupBox);
    72 
    73     /* Create button-box: */
    74     m_pButtonBox = new QIDialogButtonBox(this);
    75     /* Configure button-box: */
    76     m_pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    77     m_pButtonBox->button(QDialogButtonBox::Ok)->setDefault(true);
    78     connect(m_pButtonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(sltAccept()));
    79     connect(m_pButtonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(sltReject()));
    80     /* Add button-box into main layout: */
    81     pMainLayout->addWidget(m_pButtonBox);
    82 
    83     /* Add a stretch to main layout: */
    84     pMainLayout->addStretch();
    85 
    86     /* Prepare radio-buttons: */
    87     prepareMediumTypeButtons();
    88 
    89     /* Retranslate: */
    90     retranslateUi();
    91 
    92     /* Resize to minimum size: */
    93     resize(minimumSizeHint());
     42    , m_strMediumID(strMediumID)
     43{
     44    /* Prepare: */
     45    prepare();
    9446}
    9547
     
    158110     * for now only the previous type is restricted, others are free to choose: */
    159111    m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_enmMediumTypeOld != m_enmMediumTypeNew);
     112}
     113
     114void UIMediumTypeChangeDialog::prepare()
     115{
     116#ifdef VBOX_WS_MAC
     117    // TODO: Is that necessary?
     118    setWindowFlags(Qt::Sheet);
     119#else /* !VBOX_WS_MAC */
     120    /* Enable size-grip: */
     121    setSizeGripEnabled(true);
     122#endif /* !VBOX_WS_MAC */
     123
     124    /* Search for corresponding medium: */
     125    m_medium = vboxGlobal().medium(m_strMediumID).medium();
     126    m_enmMediumTypeOld = m_medium.GetType();
     127    m_enmMediumTypeNew = m_enmMediumTypeOld;
     128
     129    /* Create main layout: */
     130    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     131
     132    /* Create label: */
     133    m_pLabel = new QILabel(this);
     134    /* Configure label: */
     135    m_pLabel->setWordWrap(true);
     136    m_pLabel->useSizeHintForWidth(450);
     137    m_pLabel->updateGeometry();
     138    /* Add label into main layout: */
     139    pMainLayout->addWidget(m_pLabel);
     140
     141    /* Create group-box: */
     142    m_pGroupBox = new QGroupBox(this);
     143    /* Add group-box into main layout: */
     144    pMainLayout->addWidget(m_pGroupBox);
     145
     146    /* Create button-box: */
     147    m_pButtonBox = new QIDialogButtonBox(this);
     148    /* Configure button-box: */
     149    m_pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
     150    m_pButtonBox->button(QDialogButtonBox::Ok)->setDefault(true);
     151    connect(m_pButtonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(sltAccept()));
     152    connect(m_pButtonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(sltReject()));
     153    /* Add button-box into main layout: */
     154    pMainLayout->addWidget(m_pButtonBox);
     155
     156    /* Add a stretch to main layout: */
     157    pMainLayout->addStretch();
     158
     159    /* Prepare radio-buttons: */
     160    prepareMediumTypeButtons();
     161
     162    /* Retranslate: */
     163    retranslateUi();
     164
     165    /* Resize to minimum size: */
     166    resize(minimumSizeHint());
    160167}
    161168
  • trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h

    r62079 r62080  
    6464private:
    6565
     66    /** Prepares all. */
     67    void prepare();
    6668    /** Prepares medium-type radio-buttons. */
    6769    void prepareMediumTypeButtons();
    6870    /** Prepares radio-button for the passed @a mediumType. */
    6971    void prepareMediumTypeButton(KMediumType mediumType);
     72
     73    /** Holds the medium ID reference. */
     74    const QString &m_strMediumID;
     75    /** Holds the medium instance to be modified. */
     76    CMedium m_medium;
     77    /** Holds the old medium type. */
     78    KMediumType m_enmMediumTypeOld;
     79    /** Holds the new medium type. */
     80    KMediumType m_enmMediumTypeNew;
    7081
    7182    /** Holds the description label instance. */
     
    7788    /** Holds the button-box instance. */
    7889    QIDialogButtonBox *m_pButtonBox;
    79 
    80     /** Holds the medium instance to be modified. */
    81     CMedium m_medium;
    82     /** Holds the old medium type. */
    83     KMediumType m_enmMediumTypeOld;
    84     /** Holds the new medium type. */
    85     KMediumType m_enmMediumTypeNew;
    8690};
    8791
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