Changeset 18080 in vbox
- Timestamp:
- Mar 18, 2009 9:38:05 PM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
-
include/VBoxNewVMWzd.h (modified) (1 diff)
-
src/VBoxNewVMWzd.cpp (modified) (8 diffs)
-
ui/VBoxNewVMWzd.ui (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxNewVMWzd.h
r16867 r18080 50 50 void accept(); 51 51 void showMediaManager(); 52 void showNewHDWizard();53 52 void onOSTypeChanged(); 54 53 void slRAMValueChanged (int aValue); 55 54 void leRAMTextChanged (const QString &aTtext); 55 void hdTypeChanged(); 56 56 void revalidate (QIWidgetValidator *aWval); 57 57 void enableNext (const QIWidgetValidator *aWval); 58 58 void onPageShow(); 59 void showBackPage(); 59 60 void showNextPage(); 60 61 61 62 private: 62 63 64 bool showNewHDWizard(); 63 65 bool constructMachine(); 64 66 void ensureNewHardDiskDeleted(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxNewVMWzd.cpp
r17943 r18080 88 88 89 89 /* HDD Images page */ 90 QStyleOptionButton options; 91 options.initFrom (mNewVDIRadio); 92 QGridLayout *hdLayout = qobject_cast <QGridLayout*> (mGbHDA->layout()); 93 int wid = mNewVDIRadio->style()->subElementRect (QStyle::SE_RadioButtonIndicator, &options, mNewVDIRadio).width() + 94 mNewVDIRadio->style()->pixelMetric (QStyle::PM_RadioButtonLabelSpacing, &options, mNewVDIRadio) - 95 hdLayout->spacing() - 1; 96 QSpacerItem *spacer = new QSpacerItem (wid, 0, QSizePolicy::Fixed, QSizePolicy::Fixed); 97 hdLayout->addItem (spacer, 2, 0); 90 98 mHDCombo->setType (VBoxDefs::MediaType_HardDisk); 91 99 mHDCombo->repopulate(); 100 mTbVmm->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png", 101 ":/select_file_dis_16px.png")); 92 102 93 103 mWvalHDD = new QIWidgetValidator (mPageHDD, this); … … 97 107 this, SLOT (revalidate (QIWidgetValidator*))); 98 108 connect (mGbHDA, SIGNAL (toggled (bool)), mWvalHDD, SLOT (revalidate())); 109 connect (mNewVDIRadio, SIGNAL (toggled (bool)), this, SLOT (hdTypeChanged())); 110 connect (mExistRadio, SIGNAL (toggled (bool)), this, SLOT (hdTypeChanged())); 99 111 connect (mHDCombo, SIGNAL (currentIndexChanged (int)), 100 112 mWvalHDD, SLOT (revalidate())); 101 connect (mPbNewHD, SIGNAL (clicked()), this, SLOT (showNewHDWizard())); 102 connect (mPbExistingHD, SIGNAL (clicked()), this, SLOT (showMediaManager())); 113 connect (mTbVmm, SIGNAL (clicked()), this, SLOT (showMediaManager())); 103 114 104 115 /* Name and OS page */ … … 107 118 /* Memory page */ 108 119 slRAMValueChanged (mSlRAM->value()); 120 121 /* HDD Images page */ 122 hdTypeChanged(); 109 123 110 124 /* Initial revalidation */ … … 201 215 } 202 216 203 void VBoxNewVMWzd::showNewHDWizard()204 {205 VBoxNewHDWzd dlg (this);206 207 dlg.setRecommendedFileName (mLeName->text());208 dlg.setRecommendedSize (mOSTypeSelector->type().GetRecommendedHDD());209 210 if (dlg.exec() == QDialog::Accepted)211 {212 ensureNewHardDiskDeleted();213 mHardDisk = dlg.hardDisk();214 mHDCombo->setCurrentItem (mHardDisk.GetId());215 }216 217 mHDCombo->setFocus();218 }219 220 217 void VBoxNewVMWzd::onOSTypeChanged() 221 218 { … … 231 228 { 232 229 mSlRAM->setValue (aText.toInt()); 230 } 231 232 void VBoxNewVMWzd::hdTypeChanged() 233 { 234 mHDCombo->setEnabled (mExistRadio->isChecked()); 235 mTbVmm->setEnabled (mExistRadio->isChecked()); 236 if (mExistRadio->isChecked()) 237 mHDCombo->setFocus(); 233 238 } 234 239 … … 287 292 } 288 293 294 void VBoxNewVMWzd::showBackPage() 295 { 296 /* Delete temporary HD if present */ 297 if (sender() == mBtnBack5) 298 ensureNewHardDiskDeleted(); 299 300 /* Switch to the back page */ 301 QIAbstractWizard::showBackPage(); 302 } 303 289 304 void VBoxNewVMWzd::showNextPage() 290 305 { … … 294 309 return; 295 310 311 /* Show the New Hard Disk wizard */ 312 if (sender() == mBtnNext4 && mNewVDIRadio->isChecked() && 313 !showNewHDWizard()) 314 return; 315 296 316 /* Switch to the next page */ 297 317 QIAbstractWizard::showNextPage(); 298 318 } 299 319 320 321 bool VBoxNewVMWzd::showNewHDWizard() 322 { 323 VBoxNewHDWzd dlg (this); 324 325 dlg.setRecommendedFileName (mLeName->text()); 326 dlg.setRecommendedSize (mOSTypeSelector->type().GetRecommendedHDD()); 327 328 if (dlg.exec() == QDialog::Accepted) 329 { 330 ensureNewHardDiskDeleted(); 331 mHardDisk = dlg.hardDisk(); 332 mHDCombo->setCurrentItem (mHardDisk.GetId()); 333 return true; 334 } 335 336 return false; 337 } 300 338 301 339 bool VBoxNewVMWzd::constructMachine() … … 360 398 { 361 399 CMachine m = session.GetMachine(); 362 m.AttachHardDisk (mHDCombo->id(), QString("IDE"), 0, 0);400 m.AttachHardDisk (mHDCombo->id(), QString("IDE"), 0, 0); 363 401 if (m.isOk()) 364 402 { -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui
r14437 r18080 824 824 </property> 825 825 <layout class="QGridLayout" > 826 <property name="topMargin" > 827 <number>4</number> 828 </property> 829 <item row="1" column="0" > 830 <widget class="QPushButton" name="mPbNewHD" > 826 <item row="0" column="0" colspan="3" > 827 <widget class="QRadioButton" name="mNewVDIRadio" > 831 828 <property name="text" > 832 <string>N&ew...</string> 829 <string>&Create new hard disk</string> 830 </property> 831 <property name="checked"> 832 <bool>true</bool> 833 833 </property> 834 834 </widget> 835 835 </item> 836 <item row="1" column=" 1" >837 <widget class="Q PushButton" name="mPbExistingHD" >836 <item row="1" column="0" colspan="3" > 837 <widget class="QRadioButton" name="mExistRadio" > 838 838 <property name="text" > 839 <string> E&xisting...</string>839 <string>&Use existing hard disk</string> 840 840 </property> 841 841 </widget> 842 842 </item> 843 <item row="1" column="2" > 844 <spacer> 845 <property name="orientation" > 846 <enum>Qt::Horizontal</enum> 847 </property> 848 <property name="sizeHint" > 849 <size> 850 <width>0</width> 851 <height>0</height> 852 </size> 853 </property> 854 </spacer> 855 </item> 856 <item row="0" column="0" colspan="3" > 843 <item row="2" column="1" > 857 844 <widget class="VBoxMediaComboBox" name="mHDCombo" > 858 845 <property name="sizePolicy" > … … 861 848 <verstretch>0</verstretch> 862 849 </sizepolicy> 850 </property> 851 </widget> 852 </item> 853 <item row="2" column="2" > 854 <widget class="QToolButton" name="mTbVmm" > 855 <property name="autoRaise" > 856 <bool>true</bool> 863 857 </property> 864 858 </widget> … … 1199 1193 <tabstop>mBtnNext3</tabstop> 1200 1194 <tabstop>mBtnCancel3</tabstop> 1195 <tabstop>mNewVDIRadio</tabstop> 1196 <tabstop>mExistRadio</tabstop> 1201 1197 <tabstop>mHDCombo</tabstop> 1202 <tabstop>mPbNewHD</tabstop> 1203 <tabstop>mPbExistingHD</tabstop> 1198 <tabstop>mTbVmm</tabstop> 1204 1199 <tabstop>mBtnBack4</tabstop> 1205 1200 <tabstop>mBtnNext4</tabstop>
Note:
See TracChangeset
for help on using the changeset viewer.

