- Timestamp:
- Jul 6, 2016 5:54:09 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108554
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp
r62081 r62082 88 88 for (int i = 0; i < buttons.size(); ++i) 89 89 buttons[i]->setText(gpConverter->toString(buttons[i]->property("mediumType").value<KMediumType>())); 90 91 /* Translate details-pane: */ 92 updateDetailsPane(); 90 93 } 91 94 … … 111 114 * for now only the previous type is restricted, others are free to choose: */ 112 115 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_enmMediumTypeOld != m_enmMediumTypeNew); 116 117 /* Update details-pane: */ 118 updateDetailsPane(); 113 119 } 114 120 … … 190 196 191 197 /* Create group-box layout: */ 192 m_pGroupBoxLayout = new QVBoxLayout(m_pGroupBox); 193 AssertPtrReturnVoid(m_pGroupBoxLayout); 194 { 195 /* Populate radio-buttons: */ 196 prepareMediumTypeButton(KMediumType_Normal); 197 prepareMediumTypeButton(KMediumType_Immutable); 198 prepareMediumTypeButton(KMediumType_Writethrough); 199 prepareMediumTypeButton(KMediumType_Shareable); 200 prepareMediumTypeButton(KMediumType_MultiAttach); 201 /* Make sure button reflecting current type is checked: */ 202 QList<QRadioButton*> buttons = m_pGroupBox->findChildren<QRadioButton*>(); 203 for (int i = 0; i < buttons.size(); ++i) 204 { 205 if (buttons[i]->property("mediumType").value<KMediumType>() == m_enmMediumTypeOld) 198 QHBoxLayout *pGroupBoxLayout = new QHBoxLayout(m_pGroupBox); 199 AssertPtrReturnVoid(pGroupBoxLayout); 200 { 201 /* Create button layout: */ 202 m_pButtonLayout = new QVBoxLayout; 203 AssertPtrReturnVoid(m_pButtonLayout); 204 { 205 /* Populate radio-buttons: */ 206 prepareMediumTypeButton(KMediumType_Normal); 207 prepareMediumTypeButton(KMediumType_Immutable); 208 prepareMediumTypeButton(KMediumType_Writethrough); 209 prepareMediumTypeButton(KMediumType_Shareable); 210 prepareMediumTypeButton(KMediumType_MultiAttach); 211 /* Make sure button reflecting current type is checked: */ 212 QList<QRadioButton*> buttons = m_pGroupBox->findChildren<QRadioButton*>(); 213 for (int i = 0; i < buttons.size(); ++i) 206 214 { 207 buttons[i]->setChecked(true); 208 buttons[i]->setFocus(); 209 break; 215 if (buttons[i]->property("mediumType").value<KMediumType>() == m_enmMediumTypeOld) 216 { 217 buttons[i]->setChecked(true); 218 buttons[i]->setFocus(); 219 break; 220 } 210 221 } 211 } 222 223 /* Add stretch into button layout: */ 224 m_pButtonLayout->addStretch(); 225 } 226 /* Add button layout into group-box layout: */ 227 pGroupBoxLayout->addLayout(m_pButtonLayout); 228 229 /* Create details layout: */ 230 QVBoxLayout *pDetailsLayout = new QVBoxLayout; 231 AssertPtrReturnVoid(pDetailsLayout); 232 { 233 /* Create details-pane: */ 234 m_pDetailsPane = new QILabel; 235 AssertPtrReturnVoid(m_pDetailsPane); 236 { 237 /* Configure details-pane: */ 238 m_pDetailsPane->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 239 m_pDetailsPane->setMargin(2); 240 m_pDetailsPane->setWordWrap(true); 241 m_pDetailsPane->useSizeHintForWidth(320); 242 m_pDetailsPane->updateGeometry(); 243 } 244 /* Add details-pane into details layout: */ 245 pDetailsLayout->addWidget(m_pDetailsPane); 246 247 /* Add stretch into details layout: */ 248 pDetailsLayout->addStretch(); 249 } 250 /* Add details layout into group-box layout: */ 251 pGroupBoxLayout->addLayout(pDetailsLayout); 212 252 } 213 253 } … … 224 264 } 225 265 /* Add radio-button into layout: */ 226 m_pGroupBoxLayout->addWidget(pRadioButton); 227 } 228 266 m_pButtonLayout->addWidget(pRadioButton); 267 } 268 269 void UIMediumTypeChangeDialog::updateDetailsPane() 270 { 271 switch (m_enmMediumTypeNew) 272 { 273 case KMediumType_Normal: 274 m_pDetailsPane->setText(tr("This type of medium is attached directly or indirectly, preserved when taking snapshots.")); 275 break; 276 case KMediumType_Immutable: 277 m_pDetailsPane->setText(tr("This type of medium is attached indirectly, changes are wiped out the next time the " 278 "virtual machine is started.")); 279 break; 280 case KMediumType_Writethrough: 281 m_pDetailsPane->setText(tr("This type of medium is attached directly, ignored when taking snapshots.")); 282 break; 283 case KMediumType_Shareable: 284 m_pDetailsPane->setText(tr("This type of medium is attached directly, allowed to be used concurrently by several machines.")); 285 break; 286 case KMediumType_Readonly: 287 m_pDetailsPane->setText(tr("This type of medium is attached directly, and can be used by several machines.")); 288 break; 289 case KMediumType_MultiAttach: 290 m_pDetailsPane->setText(tr("This type of medium is attached indirectly, so that one base medium can be used for several " 291 "VMs which have their own differencing medium to store their modifications.")); 292 break; 293 default: 294 break; 295 } 296 } 297 -
trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h
r62080 r62082 71 71 void prepareMediumTypeButton(KMediumType mediumType); 72 72 73 /** Updates the details-pane. */ 74 void updateDetailsPane(); 75 73 76 /** Holds the medium ID reference. */ 74 77 const QString &m_strMediumID; … … 85 88 QGroupBox *m_pGroupBox; 86 89 /** Holds the button layout instance. */ 87 QVBoxLayout *m_pGroupBoxLayout; 90 QVBoxLayout *m_pButtonLayout; 91 /** Holds the details-pane instance. */ 92 QILabel *m_pDetailsPane; 88 93 /** Holds the button-box instance. */ 89 94 QIDialogButtonBox *m_pButtonBox;
Note:
See TracChangeset
for help on using the changeset viewer.