- Timestamp:
- Jul 6, 2016 5:33:31 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp
r62079 r62080 40 40 UIMediumTypeChangeDialog::UIMediumTypeChangeDialog(QWidget *pParent, const QString &strMediumID) 41 41 : 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(); 94 46 } 95 47 … … 158 110 * for now only the previous type is restricted, others are free to choose: */ 159 111 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_enmMediumTypeOld != m_enmMediumTypeNew); 112 } 113 114 void 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()); 160 167 } 161 168 -
trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h
r62079 r62080 64 64 private: 65 65 66 /** Prepares all. */ 67 void prepare(); 66 68 /** Prepares medium-type radio-buttons. */ 67 69 void prepareMediumTypeButtons(); 68 70 /** Prepares radio-button for the passed @a mediumType. */ 69 71 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; 70 81 71 82 /** Holds the description label instance. */ … … 77 88 /** Holds the button-box instance. */ 78 89 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;86 90 }; 87 91
Note:
See TracChangeset
for help on using the changeset viewer.