- Timestamp:
- Jul 6, 2016 5:27:13 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108551
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp
r62078 r62079 38 38 39 39 40 UIMediumTypeChangeDialog::UIMediumTypeChangeDialog(QWidget *pParent, const QString &strMediumI d)40 UIMediumTypeChangeDialog::UIMediumTypeChangeDialog(QWidget *pParent, const QString &strMediumID) 41 41 : QIWithRetranslateUI<QIDialog>(pParent) 42 42 { … … 50 50 51 51 /* Search for corresponding medium: */ 52 m_medium = vboxGlobal().medium(strMediumI d).medium();53 m_ oldMediumType= m_medium.GetType();54 m_ newMediumType = m_oldMediumType;52 m_medium = vboxGlobal().medium(strMediumID).medium(); 53 m_enmMediumTypeOld = m_medium.GetType(); 54 m_enmMediumTypeNew = m_enmMediumTypeOld; 55 55 56 56 /* Create main layout: */ … … 84 84 pMainLayout->addStretch(); 85 85 86 /* Create radio-buttons: */87 createMediumTypeButtons();86 /* Prepare radio-buttons: */ 87 prepareMediumTypeButtons(); 88 88 89 89 /* Retranslate: */ … … 97 97 { 98 98 /* Try to assign new medium type: */ 99 m_medium.SetType(m_ newMediumType);99 m_medium.SetType(m_enmMediumTypeNew); 100 100 /* Check for result: */ 101 101 if (!m_medium.isOk()) 102 102 { 103 103 /* Show error message: */ 104 msgCenter().cannotChangeMediumType(m_medium, m_ oldMediumType, m_newMediumType, this);104 msgCenter().cannotChangeMediumType(m_medium, m_enmMediumTypeOld, m_enmMediumTypeNew, this); 105 105 return; 106 106 } … … 153 153 154 154 /* Determine chosen type: */ 155 m_ newMediumType= pCheckedButton->property("mediumType").value<KMediumType>();155 m_enmMediumTypeNew = pCheckedButton->property("mediumType").value<KMediumType>(); 156 156 157 157 /* Enable/disable OK button depending on chosen type, 158 158 * for now only the previous type is restricted, others are free to choose: */ 159 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_ oldMediumType != m_newMediumType);160 } 161 162 void UIMediumTypeChangeDialog:: createMediumTypeButtons()159 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_enmMediumTypeOld != m_enmMediumTypeNew); 160 } 161 162 void UIMediumTypeChangeDialog::prepareMediumTypeButtons() 163 163 { 164 164 /* Register required meta-type: */ … … 168 168 m_pGroupBoxLayout = new QVBoxLayout(m_pGroupBox); 169 169 /* Populate radio-buttons: */ 170 createMediumTypeButton(KMediumType_Normal);171 createMediumTypeButton(KMediumType_Immutable);172 createMediumTypeButton(KMediumType_Writethrough);173 createMediumTypeButton(KMediumType_Shareable);174 createMediumTypeButton(KMediumType_MultiAttach);170 prepareMediumTypeButton(KMediumType_Normal); 171 prepareMediumTypeButton(KMediumType_Immutable); 172 prepareMediumTypeButton(KMediumType_Writethrough); 173 prepareMediumTypeButton(KMediumType_Shareable); 174 prepareMediumTypeButton(KMediumType_MultiAttach); 175 175 /* Make sure button reflecting current type is checked: */ 176 176 QList<QRadioButton*> buttons = findChildren<QRadioButton*>(); 177 177 for (int i = 0; i < buttons.size(); ++i) 178 178 { 179 if (buttons[i]->property("mediumType").value<KMediumType>() == m_ oldMediumType)179 if (buttons[i]->property("mediumType").value<KMediumType>() == m_enmMediumTypeOld) 180 180 { 181 181 buttons[i]->setChecked(true); … … 188 188 } 189 189 190 void UIMediumTypeChangeDialog:: createMediumTypeButton(KMediumType mediumType)190 void UIMediumTypeChangeDialog::prepareMediumTypeButton(KMediumType mediumType) 191 191 { 192 192 /* Create radio-button: */ -
trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h
r62078 r62079 44 44 45 45 /** Constructs the dialog passing @a pParent to the base-class. 46 * @param strMediumI dBrings the ID of the medium to be modified. */47 UIMediumTypeChangeDialog(QWidget *pParent, const QString &strMediumI d);46 * @param strMediumID Brings the ID of the medium to be modified. */ 47 UIMediumTypeChangeDialog(QWidget *pParent, const QString &strMediumID); 48 48 49 49 protected: 50 50 51 51 /** Handles translation event. */ 52 void retranslateUi() ;52 void retranslateUi() /* override */; 53 53 54 54 protected slots: … … 65 65 66 66 /** Prepares medium-type radio-buttons. */ 67 void createMediumTypeButtons();67 void prepareMediumTypeButtons(); 68 68 /** Prepares radio-button for the passed @a mediumType. */ 69 void createMediumTypeButton(KMediumType mediumType);69 void prepareMediumTypeButton(KMediumType mediumType); 70 70 71 71 /** Holds the description label instance. */ … … 81 81 CMedium m_medium; 82 82 /** Holds the old medium type. */ 83 KMediumType m_ oldMediumType;83 KMediumType m_enmMediumTypeOld; 84 84 /** Holds the new medium type. */ 85 KMediumType m_ newMediumType;85 KMediumType m_enmMediumTypeNew; 86 86 }; 87 87
Note:
See TracChangeset
for help on using the changeset viewer.