Changeset 33668 in vbox
- Timestamp:
- Nov 2, 2010 1:43:28 AM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
- Files:
-
- 3 edited
-
UINewVMWzd.cpp (modified) (3 diffs)
-
UINewVMWzd.h (modified) (1 diff)
-
UINewVMWzdPage4.ui (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp
r33667 r33668 25 25 #include "UINewHDWzd.h" 26 26 #include "UINewVMWzd.h" 27 #include " VBoxMediaManagerDlg.h"27 #include "QIFileDialog.h" 28 28 #include "VBoxProblemReporter.h" 29 29 #include "VBoxVMSettingsHD.h" … … 417 417 connect(m_pDiskPresent, SIGNAL(toggled(bool)), this, SLOT(hardDiskSourceChanged())); 418 418 connect(m_pDiskSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(hardDiskSourceChanged())); 419 connect(m_pVMMButton, SIGNAL(clicked()), this, SLOT(getWith MediaManager()));419 connect(m_pVMMButton, SIGNAL(clicked()), this, SLOT(getWithFileOpenDialog())); 420 420 421 421 /* Initialise page connections */ … … 532 532 } 533 533 534 void UINewVMWzdPage4::getWithMediaManager() 535 { 536 VBoxMediaManagerDlg dlg(this); 537 dlg.setup(VBoxDefs::MediumType_HardDisk, true); 538 539 if (dlg.exec() == QDialog::Accepted) 540 { 541 QString newId = dlg.selectedId(); 542 if (m_pDiskSelector->id() != newId) 543 m_pDiskSelector->setCurrentItem(newId); 544 } 545 546 hardDiskSourceChanged(); 547 548 m_pDiskSelector->setFocus(); 534 void UINewVMWzdPage4::getWithFileOpenDialog() 535 { 536 /* Initialize variables: */ 537 CVirtualBox vbox = vboxGlobal().virtualBox(); 538 QString strHomeFolder = vbox.GetHomeFolder(); 539 QString title = m_pVMMButton->toolTip(); 540 QList < QPair <QString, QString> > filters = vboxGlobal().HDDBackends(); 541 QString allType = tr("hard disk"); 542 QString strFilter; 543 QStringList backends; 544 QStringList prefixes; 545 546 /* Prepare filters and backends: */ 547 for (int i = 0; i < filters.count(); ++i) 548 { 549 /* Get iterated filter: */ 550 QPair <QString, QString> item = filters.at(i); 551 /* Create one backend filter string: */ 552 backends << QString("%1 (%2)").arg(item.first).arg(item.second); 553 /* Save the suffix's for the "All" entry: */ 554 prefixes << item.second; 555 } 556 if (!prefixes.isEmpty()) 557 backends.insert(0, tr("All %1 images (%2)").arg(allType).arg(prefixes.join(" ").trimmed())); 558 backends << tr("All files (*)"); 559 strFilter = backends.join(";;").trimmed(); 560 561 /* Create open file dialog: */ 562 QStringList files = QIFileDialog::getOpenFileNames(strHomeFolder, strFilter, this, title, 0, true, true); 563 if (!files.empty() && !files[0].isEmpty()) 564 { 565 /* Get location: */ 566 QString strLocation = files[0]; 567 568 /* Prepare GUI medium wrapper: */ 569 VBoxMedium vboxMedium; 570 571 /* Open corresponding medium: */ 572 CMedium comMedium = vbox.OpenMedium(strLocation, KDeviceType_HardDisk, KAccessMode_ReadWrite); 573 if (vbox.isOk()) 574 vboxMedium = VBoxMedium(CMedium(comMedium), VBoxDefs::MediumType_HardDisk, KMediumState_Created); 575 576 /* Add medium to GUI list: */ 577 if (vbox.isOk()) 578 vboxGlobal().addMedium(vboxMedium); 579 else 580 vboxProblem().cannotOpenMedium(this, vbox, VBoxDefs::MediumType_HardDisk, strLocation); 581 582 /* Ask medium combobox to select newly added medium: */ 583 m_pDiskSelector->setCurrentItem(vboxMedium.id()); 584 585 /* Update hard disk source: */ 586 hardDiskSourceChanged(); 587 588 m_pDiskSelector->setFocus(); 589 } 549 590 } 550 591 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.h
r33667 r33668 144 144 void ensureNewHardDiskDeleted(); 145 145 void hardDiskSourceChanged(); 146 void getWith MediaManager();146 void getWithFileOpenDialog(); 147 147 148 148 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzdPage4.ui
r29001 r33668 91 91 <bool>true</bool> 92 92 </property> 93 <property name="toolTip"> 94 <string>Select a hard disk image file</string> 95 </property> 93 96 </widget> 94 97 </item>
Note:
See TracChangeset
for help on using the changeset viewer.

