- Timestamp:
- Aug 19, 2021 4:33:03 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp
r90748 r90755 35 35 , m_comSourceVirtualDisk(comSourceVirtualDisk) 36 36 , m_enmSourceVirtualDiskDeviceType(m_comSourceVirtualDisk.GetDeviceType()) 37 , m_iMediumVariantPageIndex(-1) 37 38 { 38 39 #ifndef VBOX_WS_MAC … … 104 105 { 105 106 addPage(new UIWizardCloneVDPageBasic1(m_enmSourceVirtualDiskDeviceType)); 106 addPage(new UIWizardCloneVDPageBasic2(m_enmSourceVirtualDiskDeviceType));107 m_iMediumVariantPageIndex = addPage(new UIWizardCloneVDPageBasic2(m_enmSourceVirtualDiskDeviceType)); 107 108 addPage(new UIWizardCloneVDPageBasic3); 108 109 break; … … 120 121 } 121 122 } 123 124 const CMediumFormat &UIWizardCloneVD::mediumFormat() const 125 { 126 return m_comMediumFormat; 127 } 128 129 void UIWizardCloneVD::setMediumFormat(const CMediumFormat &comMediumFormat) 130 { 131 m_comMediumFormat = comMediumFormat; 132 if (mode() == WizardMode_Basic) 133 setMediumVariantPageVisibility(); 134 } 135 136 qulonglong UIWizardCloneVD::mediumVariant() const 137 { 138 return m_uMediumVariant; 139 } 140 141 void UIWizardCloneVD::setMediumVariant(qulonglong uMediumVariant) 142 { 143 m_uMediumVariant = uMediumVariant; 144 } 145 146 void UIWizardCloneVD::setMediumVariantPageVisibility() 147 { 148 AssertReturnVoid(!m_comMediumFormat.isNull()); 149 ULONG uCapabilities = 0; 150 QVector<KMediumFormatCapabilities> capabilities; 151 capabilities = m_comMediumFormat.GetCapabilities(); 152 for (int i = 0; i < capabilities.size(); i++) 153 uCapabilities |= capabilities[i]; 154 155 int cTest = 0; 156 if (uCapabilities & KMediumFormatCapabilities_CreateDynamic) 157 ++cTest; 158 if (uCapabilities & KMediumFormatCapabilities_CreateFixed) 159 ++cTest; 160 if (uCapabilities & KMediumFormatCapabilities_CreateSplit2G) 161 ++cTest; 162 setPageVisible(m_iMediumVariantPageIndex, cTest > 1); 163 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h
r90748 r90755 28 28 #include "COMEnums.h" 29 29 #include "CMedium.h" 30 #include "CMediumFormat.h" 30 31 31 32 … … 49 50 bool copyVirtualDisk(); 50 51 52 const CMediumFormat &mediumFormat() const; 53 void setMediumFormat(const CMediumFormat &comMediumFormat); 54 55 qulonglong mediumVariant() const; 56 void setMediumVariant(qulonglong uMediumVariant); 57 51 58 protected: 52 59 … … 57 64 /** Handles translation event. */ 58 65 virtual void retranslateUi() /* override */; 66 void setMediumVariantPageVisibility(); 59 67 68 CMediumFormat m_comMediumFormat; 69 qulonglong m_uMediumVariant; 60 70 /** Holds the source virtual disk wrapper. */ 61 71 CMedium m_comSourceVirtualDisk; … … 63 73 /** Holds the source virtual-disk device type. */ 64 74 KDeviceType m_enmSourceVirtualDiskDeviceType; 75 int m_iMediumVariantPageIndex; 65 76 }; 66 77 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp
r90748 r90755 160 160 { 161 161 pMainLayout->addWidget(m_pFormatGroupBox); 162 // connect(m_pFormatButtonGroup, &UIDiskFormatsGroupBox::sigMediumFormatChanged,163 //this, &UIWizardCloneVDPageBasic1::sltMediumFormatChanged);162 connect(m_pFormatGroupBox, &UIDiskFormatsGroupBox::sigMediumFormatChanged, 163 this, &UIWizardCloneVDPageBasic1::sltMediumFormatChanged); 164 164 } 165 165 pMainLayout->addStretch(); … … 189 189 /* Translate page: */ 190 190 retranslateUi(); 191 if (!m_userModifiedParameters.contains("MediumFormat")) 192 { 193 if (cloneWizard() && m_pFormatGroupBox) 194 cloneWizard()->setMediumFormat(m_pFormatGroupBox->mediumFormat()); 195 } 191 196 } 192 197 … … 196 201 //return !mediumFormat().isNull(); 197 202 return true; 203 } 204 205 void UIWizardCloneVDPageBasic1::sltMediumFormatChanged() 206 { 207 if (cloneWizard() && m_pFormatGroupBox) 208 cloneWizard()->setMediumFormat(m_pFormatGroupBox->mediumFormat()); 209 m_userModifiedParameters << "MediumFormat"; 210 emit completeChanged(); 198 211 } 199 212 … … 227 240 // return UIWizardCloneVD::Page3; 228 241 // } 242 243 UIWizardCloneVD *UIWizardCloneVDPageBasic1::cloneWizard() const 244 { 245 return qobject_cast<UIWizardCloneVD*>(wizard()); 246 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h
r90748 r90755 22 22 #endif 23 23 24 /* Qt includes: */ 25 #include <QSet> 26 24 27 /* GUI includes: */ 25 28 #include "UINativeWizardPage.h" … … 32 35 class QIRichTextLabel; 33 36 class UIDiskFormatsGroupBox; 34 37 class UIWizardCloneVD; 35 38 36 39 // /** 1st page of the Clone Virtual Disk Image wizard (base part): */ … … 79 82 UIWizardCloneVDPageBasic1(KDeviceType enmDeviceType); 80 83 84 private slots: 85 86 void sltMediumFormatChanged(); 87 81 88 private: 89 90 UIWizardCloneVD *cloneWizard() const; 82 91 83 92 /** Handles translation event. */ … … 94 103 QIRichTextLabel *m_pLabel; 95 104 UIDiskFormatsGroupBox *m_pFormatGroupBox; 105 106 QSet<QString> m_userModifiedParameters; 96 107 }; 97 108 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp
r90748 r90755 23 23 24 24 /* GUI includes: */ 25 #include "UIWizardDiskEditors.h" 25 26 #include "UIWizardCloneVDPageBasic2.h" 26 27 #include "UIWizardCloneVD.h" … … 73 74 74 75 UIWizardCloneVDPageBasic2::UIWizardCloneVDPageBasic2(KDeviceType /*enmDeviceType*/) 76 : m_pDescriptionLabel(0) 77 , m_pDynamicLabel(0) 78 , m_pFixedLabel(0) 79 , m_pSplitLabel(0) 80 , m_pVariantGroupBox(0) 75 81 { 76 82 prepare(); … … 78 84 // QVBoxLayout *pMainLayout = new QVBoxLayout(this); 79 85 // { 80 // m_pDescriptionLabel = new QIRichTextLabel(this);81 // m_pDynamicLabel = new QIRichTextLabel(this);82 // m_pFixedLabel = new QIRichTextLabel(this);83 // m_pSplitLabel = new QIRichTextLabel(this);84 86 // QVBoxLayout *pVariantLayout = new QVBoxLayout; 85 87 // { … … 125 127 { 126 128 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 127 Q_UNUSED(pMainLayout); 129 m_pDescriptionLabel = new QIRichTextLabel(this); 130 if (m_pDescriptionLabel) 131 pMainLayout->addWidget(m_pDescriptionLabel); 132 m_pDynamicLabel = new QIRichTextLabel(this); 133 if (m_pDynamicLabel) 134 pMainLayout->addWidget(m_pDynamicLabel); 135 m_pFixedLabel = new QIRichTextLabel(this); 136 if (m_pFixedLabel) 137 pMainLayout->addWidget(m_pFixedLabel); 138 m_pSplitLabel = new QIRichTextLabel(this); 139 if (m_pSplitLabel) 140 pMainLayout->addWidget(m_pSplitLabel); 141 m_pVariantGroupBox = new UIDiskVariantGroupBox(false /* expert mode */, 0); 142 if (m_pVariantGroupBox) 143 pMainLayout->addWidget(m_pVariantGroupBox); 144 retranslateUi(); 128 145 } 129 146 … … 134 151 setTitle(UIWizardCloneVD::tr("Storage on physical hard disk")); 135 152 136 // /* Translate widgets: */ 137 // m_pDescriptionLabel->setText(UIWizardCloneVD::tr("Please choose whether the new virtual disk image file should grow as it is used " 138 // "(dynamically allocated) or if it should be created at its maximum size (fixed size).")); 139 // m_pDynamicLabel->setText(UIWizardCloneVD::tr("<p>A <b>dynamically allocated</b> disk image file will only use space " 140 // "on your physical hard disk as it fills up (up to a maximum <b>fixed size</b>), " 141 // "although it will not shrink again automatically when space on it is freed.</p>")); 142 // m_pFixedLabel->setText(UIWizardCloneVD::tr("<p>A <b>fixed size</b> disk image file may take longer to create on some " 143 // "systems but is often faster to use.</p>")); 144 // m_pSplitLabel->setText(UIWizardCloneVD::tr("<p>You can also choose to <b>split</b> the disk image file into several files " 145 // "of up to two gigabytes each. This is mainly useful if you wish to store the " 146 // "virtual machine on removable USB devices or old systems, some of which cannot " 147 // "handle very large files.")); 148 // m_pDynamicalButton->setText(UIWizardCloneVD::tr("&Dynamically allocated")); 149 // m_pFixedButton->setText(UIWizardCloneVD::tr("&Fixed size")); 150 // m_pSplitBox->setText(UIWizardCloneVD::tr("&Split into files of less than 2GB")); 153 /* Translate widgets: */ 154 m_pDescriptionLabel->setText(UIWizardCloneVD::tr("Please choose whether the new virtual disk image file should grow as it is used " 155 "(dynamically allocated) or if it should be created at its maximum size (fixed size).")); 156 m_pDynamicLabel->setText(UIWizardCloneVD::tr("<p>A <b>dynamically allocated</b> disk image file will only use space " 157 "on your physical hard disk as it fills up (up to a maximum <b>fixed size</b>), " 158 "although it will not shrink again automatically when space on it is freed.</p>")); 159 m_pFixedLabel->setText(UIWizardCloneVD::tr("<p>A <b>fixed size</b> disk image file may take longer to create on some " 160 "systems but is often faster to use.</p>")); 161 m_pSplitLabel->setText(UIWizardCloneVD::tr("<p>You can also choose to <b>split</b> the disk image file into several files " 162 "of up to two gigabytes each. This is mainly useful if you wish to store the " 163 "virtual machine on removable USB devices or old systems, some of which cannot " 164 "handle very large files.")); 151 165 } 152 166 153 167 void UIWizardCloneVDPageBasic2::initializePage() 154 168 { 169 AssertReturnVoid(cloneWizard()); 155 170 /* Translate page: */ 156 171 retranslateUi(); 157 172 173 setWidgetVisibility(cloneWizard()->mediumFormat()); 174 if (m_pVariantGroupBox) 175 cloneWizard()->setMediumVariant(m_pVariantGroupBox->mediumVariant()); 158 176 // /* Setup visibility: */ 159 177 // CMediumFormat mediumFormat = field("mediumFormat").value<CMediumFormat>(); … … 181 199 // return mediumVariant() != (qulonglong)KMediumVariant_Max; 182 200 } 201 202 UIWizardCloneVD *UIWizardCloneVDPageBasic2::cloneWizard() const 203 { 204 return qobject_cast<UIWizardCloneVD*>(wizard()); 205 } 206 207 void UIWizardCloneVDPageBasic2::setWidgetVisibility(const CMediumFormat &mediumFormat) 208 { 209 AssertReturnVoid(m_pVariantGroupBox); 210 211 m_pVariantGroupBox->updateMediumVariantWidgetsAfterFormatChange(mediumFormat, true /* hide disabled widgets*/); 212 213 if (m_pDynamicLabel) 214 m_pDynamicLabel->setHidden(!m_pVariantGroupBox->isCreateDynamicPossible()); 215 if (m_pFixedLabel) 216 m_pFixedLabel->setHidden(!m_pVariantGroupBox->isCreateFixedPossible()); 217 if (m_pSplitLabel) 218 m_pSplitLabel->setHidden(!m_pVariantGroupBox->isCreateSplitPossible()); 219 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h
r90748 r90755 33 33 class QCheckBox; 34 34 class QIRichTextLabel; 35 35 class UIWizardCloneVD; 36 class CMediumFormat; 37 class UIDiskVariantGroupBox; 36 38 37 39 // /** 3rd page of the Clone Virtual Disk Image wizard (base part): */ … … 73 75 virtual void retranslateUi() /* override */; 74 76 void prepare(); 77 UIWizardCloneVD *cloneWizard() const; 75 78 76 79 /** Prepares the page. */ … … 79 82 /** Returns whether the page is complete. */ 80 83 virtual bool isComplete() const /* override */; 84 void setWidgetVisibility(const CMediumFormat &mediumFormat); 81 85 82 86 /** Holds the description label instance. */ … … 88 92 /** Holds the 'Split to 2GB files' description label instance. */ 89 93 QIRichTextLabel *m_pSplitLabel; 94 95 UIDiskVariantGroupBox *m_pVariantGroupBox; 90 96 }; 91 97 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardDiskEditors.cpp
r90748 r90755 410 410 m_pSplitBox->setHidden(!m_pSplitBox->isEnabled()); 411 411 } 412 /* Deselect split box if it is disabled: */ 413 if (!m_pSplitBox->isEnabled()) 414 m_pSplitBox->setChecked(false); 412 415 emit sigMediumVariantChanged(mediumVariant()); 413 416 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardDiskEditors.h
r90748 r90755 50 50 #include "CMediumFormat.h" 51 51 52 /** Base class for disk related group boxes. */ 52 53 class SHARED_LIBRARY_STUFF UIDiskEditorGroupBox : public QIWithRetranslateUI<QGroupBox> 53 54 {
Note:
See TracChangeset
for help on using the changeset viewer.