Changeset 33670 in vbox
- Timestamp:
- Nov 2, 2010 3:53:37 AM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
-
globals/VBoxProblemReporter.cpp (modified) (3 diffs)
-
globals/VBoxProblemReporter.h (modified) (1 diff)
-
settings/vm/VBoxVMSettingsHD.cpp (modified) (7 diffs)
-
settings/vm/VBoxVMSettingsHD.h (modified) (2 diffs)
-
settings/vm/VBoxVMSettingsHD.ui (modified) (12 diffs)
-
wizards/newvm/UINewVMWzd.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
r33558 r33670 1297 1297 } 1298 1298 1299 int VBoxProblemReporter::confirmRunNewHDWzdOr VDM(KDeviceType aDeviceType)1299 int VBoxProblemReporter::confirmRunNewHDWzdOrOFD (KDeviceType aDeviceType) 1300 1300 { 1301 1301 switch (aDeviceType) … … 1303 1303 case KDeviceType_HardDisk: 1304 1304 return message (QApplication::activeWindow(), Info, 1305 tr ("<p>There are no unused medi aavailable for the newly "1305 tr ("<p>There are no unused medium available for the newly " 1306 1306 "created attachment.</p>" 1307 1307 "<p>Press the <b>Create</b> button to start the <i>New " 1308 1308 "Virtual Disk</i> wizard and create a new medium, " 1309 "or press the <b>Select</b> if you wish to open the <i>Virtual"1310 " Media Manager</i>.</p>"),1309 "or press the <b>Select</b> if you wish to open existing " 1310 "medium using file-open dialog.</p>"), 1311 1311 0, /* aAutoConfirmId */ 1312 1312 QIMessageBox::Yes, … … 1317 1317 default: 1318 1318 return message (QApplication::activeWindow(), Info, 1319 tr ("<p>There are no unused medi aavailable for the newly "1319 tr ("<p>There are no unused medium available for the newly " 1320 1320 "created attachment.</p>" 1321 "<p>Press the <b>Select</b> if you wish to open the <i>Virtual"1322 " Media Manager</i>.</p>"),1321 "<p>Press the <b>Select</b> if you wish to open existing " 1322 "medium using file-open dialog.</p>"), 1323 1323 0, /* aAutoConfirmId */ 1324 1324 QIMessageBox::No | QIMessageBox::Default, -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h
r33540 r33670 256 256 int confirmDetachAddControllerSlots (QWidget *aParent) const; 257 257 int confirmChangeAddControllerSlots (QWidget *aParent) const; 258 int confirmRunNewHDWzdOr VDM(KDeviceType aDeviceType);258 int confirmRunNewHDWzdOrOFD (KDeviceType aDeviceType); 259 259 260 260 int confirmRemovingOfLastDVDDevice() const; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.cpp
r33632 r33670 23 23 #include "UINewHDWzd.h" 24 24 #include "VBoxGlobal.h" 25 #include " VBoxMediaManagerDlg.h"25 #include "QIFileDialog.h" 26 26 #include "VBoxProblemReporter.h" 27 27 #include "VBoxVMSettingsHD.h" … … 1716 1716 1717 1717 /* Vmm Button */ 1718 mTb Vmm->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::VMMEn),1718 mTbOpen->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::VMMEn), 1719 1719 PixmapPool::pool()->pixmap (PixmapPool::VMMDis))); 1720 mTbNew->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddEn), 1721 PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddDis))); 1720 1722 1721 1723 /* Info Pane initialization */ … … 1767 1769 connect (mCbIoCache, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1768 1770 connect (mCbVdi, SIGNAL (activated (int)), this, SLOT (setInformation())); 1769 connect (mTbVmm, SIGNAL (clicked (bool)), this, SLOT (onVmmInvoked())); 1771 connect (mTbOpen, SIGNAL (clicked (bool)), this, SLOT (sltOpenMedium())); 1772 connect (mTbNew, SIGNAL (clicked (bool)), this, SLOT (sltNewMedium())); 1770 1773 connect (mCbShowDiffs, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); 1771 1774 connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation())); … … 2290 2293 { 2291 2294 case KDeviceType_HardDisk: 2292 mLbVdi->setText (tr ("Hard &Disk:")); 2295 mLbVdi->setText(tr("Hard &Disk:")); 2296 mTbOpen->setWhatsThis(tr("Open hard disk image file using file-open dialog.")); 2297 mTbOpen->setToolTip(tr("Open hard disk image file")); 2298 mTbNew->setVisible(true); 2293 2299 break; 2294 2300 case KDeviceType_DVD: 2295 mLbVdi->setText (tr ("&CD/DVD Device:")); 2301 mLbVdi->setText(tr("&CD/DVD Device:")); 2302 mTbOpen->setWhatsThis(tr("Open CD/DVD image file using file-open dialog.")); 2303 mTbOpen->setToolTip(tr("Open CD/DVD image file")); 2304 mTbNew->setVisible(false); 2296 2305 break; 2297 2306 case KDeviceType_Floppy: 2298 mLbVdi->setText (tr ("&Floppy Device:")); 2307 mLbVdi->setText(tr("&Floppy Device:")); 2308 mTbOpen->setWhatsThis(tr("Open floppy image file using file-open dialog.")); 2309 mTbOpen->setToolTip(tr("Open floppy image file")); 2310 mTbNew->setVisible(false); 2299 2311 break; 2300 2312 default: … … 2389 2401 } 2390 2402 2391 void VBoxVMSettingsHD::onVmmInvoked() 2392 { 2393 QString id = getWithMediaManager (mCbVdi->type()); 2403 void VBoxVMSettingsHD::sltOpenMedium() 2404 { 2405 QString id = getWithOpenFileDialog(mCbVdi->type()); 2406 if (!id.isNull()) 2407 mCbVdi->setCurrentItem (id); 2408 } 2409 2410 void VBoxVMSettingsHD::sltNewMedium() 2411 { 2412 QString id = getWithNewHDWizard(); 2394 2413 if (!id.isNull()) 2395 2414 mCbVdi->setCurrentItem (id); … … 2449 2468 /* Ask the user for the method to select medium */ 2450 2469 KDeviceType deviceType = mStorageModel->data (index, StorageModel::R_AttDevice).value <KDeviceType>(); 2451 int askResult = vboxProblem().confirmRunNewHDWzdOr VDM(deviceType);2470 int askResult = vboxProblem().confirmRunNewHDWzdOrOFD (deviceType); 2452 2471 QString mediumId = askResult == QIMessageBox::Yes ? getWithNewHDWizard() : 2453 askResult == QIMessageBox::No ? getWith MediaManager(typeToLocal (deviceType)) : QString();2472 askResult == QIMessageBox::No ? getWithOpenFileDialog(typeToLocal (deviceType)) : QString(); 2454 2473 if (mediumId.isNull()) 2455 2474 mediumId = firstAvailableId; … … 2733 2752 } 2734 2753 2754 QString VBoxVMSettingsHD::getWithOpenFileDialog (VBoxDefs::MediumType aMediumType) 2755 { 2756 /* Initialize variables: */ 2757 CVirtualBox vbox = vboxGlobal().virtualBox(); 2758 QString strHomeFolder = vbox.GetHomeFolder(); 2759 QList < QPair <QString, QString> > filters; 2760 QStringList backends; 2761 QStringList prefixes; 2762 QString strFilter; 2763 QString strTitle; 2764 QString allType; 2765 KDeviceType type; 2766 switch (aMediumType) 2767 { 2768 case VBoxDefs::MediumType_HardDisk: 2769 { 2770 filters = vboxGlobal().HDDBackends(); 2771 strTitle = tr ("Select a hard disk image file"); 2772 allType = tr ("hard disk"); 2773 type = KDeviceType_HardDisk; 2774 break; 2775 } 2776 case VBoxDefs::MediumType_DVD: 2777 { 2778 filters = vboxGlobal().DVDBackends(); 2779 strTitle = tr ("Select a CD/DVD-ROM disk image file"); 2780 allType = tr ("CD/DVD-ROM disk"); 2781 type = KDeviceType_DVD; 2782 break; 2783 } 2784 case VBoxDefs::MediumType_Floppy: 2785 { 2786 filters = vboxGlobal().FloppyBackends(); 2787 strTitle = tr ("Select a floppy disk image file"); 2788 allType = tr ("floppy disk"); 2789 type = KDeviceType_Floppy; 2790 break; 2791 } 2792 default: 2793 break; 2794 } 2795 2796 /* Prepare filters and backends: */ 2797 for (int i = 0; i < filters.count(); ++i) 2798 { 2799 /* Get iterated filter: */ 2800 QPair <QString, QString> item = filters.at(i); 2801 /* Create one backend filter string: */ 2802 backends << QString("%1 (%2)").arg(item.first).arg(item.second); 2803 /* Save the suffix's for the "All" entry: */ 2804 prefixes << item.second; 2805 } 2806 if (!prefixes.isEmpty()) 2807 backends.insert(0, tr("All %1 images (%2)").arg(allType).arg(prefixes.join(" ").trimmed())); 2808 backends << tr("All files (*)"); 2809 strFilter = backends.join(";;").trimmed(); 2810 2811 /* Create open file dialog: */ 2812 QStringList files = QIFileDialog::getOpenFileNames(strHomeFolder, strFilter, this, strTitle, 0, true, true); 2813 if (!files.empty() && !files[0].isEmpty()) 2814 { 2815 /* Get location: */ 2816 QString strLocation = files[0]; 2817 2818 /* Open corresponding medium: */ 2819 CMedium comMedium = vbox.OpenMedium(strLocation, type, KAccessMode_ReadWrite); 2820 2821 if (vbox.isOk()) 2822 { 2823 /* Prepare vbox medium wrapper: */ 2824 VBoxMedium vboxMedium; 2825 2826 /* First of all we should test if that medium already opened: */ 2827 if (!vboxGlobal().findMedium(comMedium, vboxMedium)) 2828 { 2829 /* And create new otherwise: */ 2830 vboxMedium = VBoxMedium(CMedium(comMedium), aMediumType, KMediumState_Created); 2831 vboxGlobal().addMedium(vboxMedium); 2832 } 2833 2834 /* Return vboxMedium id: */ 2835 return vboxMedium.id(); 2836 } 2837 else 2838 vboxProblem().cannotOpenMedium(this, vbox, aMediumType, strLocation); 2839 } 2840 2841 /* Return null string: */ 2842 return QString(); 2843 } 2844 2735 2845 QString VBoxVMSettingsHD::getWithNewHDWizard() 2736 2846 { 2737 2847 /* Run New HD Wizard */ 2738 UINewHDWzd dlg (this); 2848 UINewHDWzd dlg(this); 2849 /* Initialize variables: */ 2850 CGuestOSType guestOSType = vboxGlobal().virtualBox().GetGuestOSType(m_machine.GetOSTypeId()); 2851 dlg.setRecommendedSize(guestOSType.GetRecommendedHDD()); 2852 QString strMachineSettingsFilepath = m_machine.GetSettingsFilePath(); 2853 QFileInfo fileInfo(strMachineSettingsFilepath); 2854 dlg.setDefaultPath(fileInfo.absolutePath()); 2739 2855 2740 2856 return dlg.exec() == QDialog::Accepted ? dlg.hardDisk().GetId() : QString(); 2741 }2742 2743 QString VBoxVMSettingsHD::getWithMediaManager (VBoxDefs::MediumType aMediumType)2744 {2745 /* Run Media Manager */2746 VBoxMediaManagerDlg dlg (this);2747 dlg.setup (aMediumType,2748 true /* do select? */,2749 false /* do refresh? */,2750 m_machine,2751 mCbVdi->id(),2752 mCbShowDiffs->isChecked());2753 2754 return dlg.exec() == QDialog::Accepted ? dlg.selectedId() : QString();2755 2857 } 2756 2858 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.h
r33631 r33670 616 616 void setInformation(); 617 617 618 void onVmmInvoked(); 618 void sltOpenMedium(); 619 void sltNewMedium(); 619 620 620 621 void updateActionsState(); … … 637 638 void addAttachmentWrapper (KDeviceType aDevice); 638 639 640 QString getWithOpenFileDialog (VBoxDefs::MediumType aMediumType); 639 641 QString getWithNewHDWizard(); 640 QString getWithMediaManager (VBoxDefs::MediumType aMediumType);641 642 642 643 void updateAdditionalObjects (KDeviceType aType); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.ui
r32760 r33670 248 248 <number>0</number> 249 249 </property> 250 <item row="0" column="0" colspan=" 4" >250 <item row="0" column="0" colspan="3" > 251 251 <widget class="QILabelSeparator" native="1" name="mLsAttributes" > 252 252 <property name="text" > … … 268 268 </widget> 269 269 </item> 270 <item row="1" column="2" colspan="2">270 <item row="1" column="2" > 271 271 <widget class="QComboBox" name="mCbSlot" > 272 272 <property name="whatsThis" > … … 292 292 </item> 293 293 <item row="2" column="2" > 294 <widget class="VBoxMediaComboBox" native="1" name="mCbVdi" > 295 <property name="whatsThis" > 296 <string>Selects the virtual disk image or the host drive used by this attachment.</string> 297 </property> 298 <property name="sizePolicy" > 299 <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > 300 <horstretch>0</horstretch> 301 <verstretch>0</verstretch> 302 </sizepolicy> 303 </property> 304 </widget> 305 </item> 306 <item row="2" column="3" > 307 <widget class="QIToolButton" name="mTbVmm" > 308 <property name="whatsThis" > 309 <string>Opens the Virtual Media Manager to select a virtual image for this attachment.</string> 310 </property> 311 <property name="toolTip" > 312 <string>Open Virtual Media Manager</string> 313 </property> 314 <property name="text" > 315 <string/> 316 </property> 317 <property name="autoRaise" > 318 <bool>true</bool> 319 </property> 320 </widget> 321 </item> 322 <item row="3" column="2" colspan="2" > 294 <widget class="QWidget" name="mWtContainer" > 295 <layout class="QHBoxLayout" name="mLtContainer" > 296 <property name="leftMargin" > 297 <number>0</number> 298 </property> 299 <property name="topMargin" > 300 <number>0</number> 301 </property> 302 <property name="rightMargin" > 303 <number>0</number> 304 </property> 305 <property name="bottomMargin" > 306 <number>0</number> 307 </property> 308 <property name="spacing" > 309 <number>0</number> 310 </property> 311 <item> 312 <widget class="VBoxMediaComboBox" native="1" name="mCbVdi" > 313 <property name="whatsThis" > 314 <string>Selects the virtual disk image or the host drive used by this attachment.</string> 315 </property> 316 <property name="sizePolicy" > 317 <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > 318 <horstretch>0</horstretch> 319 <verstretch>0</verstretch> 320 </sizepolicy> 321 </property> 322 </widget> 323 </item> 324 <item> 325 <widget class="QIToolButton" name="mTbOpen" > 326 <property name="text" > 327 <string/> 328 </property> 329 <property name="autoRaise" > 330 <bool>true</bool> 331 </property> 332 </widget> 333 </item> 334 <item> 335 <widget class="QIToolButton" name="mTbNew" > 336 <property name="whatsThis" > 337 <string>Create hard disk image file using New Hard Disk wizard.</string> 338 </property> 339 <property name="toolTip" > 340 <string>Create hard disk image file</string> 341 </property> 342 <property name="text" > 343 <string/> 344 </property> 345 <property name="autoRaise" > 346 <bool>true</bool> 347 </property> 348 </widget> 349 </item> 350 </layout> 351 </widget> 352 </item> 353 <item row="3" column="2" > 323 354 <widget class="QCheckBox" name="mCbShowDiffs"> 324 355 <property name="sizePolicy" > … … 336 367 </widget> 337 368 </item> 338 <item row="4" column="2" colspan="2">369 <item row="4" column="2" > 339 370 <widget class="QCheckBox" name="mCbPassthrough" > 340 371 <property name="sizePolicy" > … … 352 383 </widget> 353 384 </item> 354 <item row="5" column="0" colspan=" 4" >385 <item row="5" column="0" colspan="3" > 355 386 <widget class="QILabelSeparator" native="1" name="mLsInformation" > 356 387 <property name="text" > … … 369 400 </widget> 370 401 </item> 371 <item row="6" column="2" colspan="2">402 <item row="6" column="2" > 372 403 <widget class="QILabel" name="mLbHDVirtualSizeValue" > 373 404 <property name="sizePolicy" > … … 389 420 </widget> 390 421 </item> 391 <item row="7" column="2" colspan="2">422 <item row="7" column="2" > 392 423 <widget class="QILabel" name="mLbHDActualSizeValue" > 393 424 <property name="sizePolicy" > … … 409 440 </widget> 410 441 </item> 411 <item row="8" column="2" colspan="2">442 <item row="8" column="2" > 412 443 <widget class="QILabel" name="mLbSizeValue" > 413 444 <property name="sizePolicy" > … … 429 460 </widget> 430 461 </item> 431 <item row="9" column="2" colspan="2">462 <item row="9" column="2" > 432 463 <widget class="QILabel" name="mLbLocationValue" > 433 464 <property name="sizePolicy" > … … 449 480 </widget> 450 481 </item> 451 <item row="10" column="2" colspan="2">482 <item row="10" column="2" > 452 483 <widget class="QILabel" name="mLbHDFormatValue" > 453 484 <property name="sizePolicy" > … … 469 500 </widget> 470 501 </item> 471 <item row="11" column="2" colspan="2">502 <item row="11" column="2" > 472 503 <widget class="QILabel" name="mLbUsageValue" > 473 504 <property name="sizePolicy" > … … 479 510 </widget> 480 511 </item> 481 <item row="12" column="0" colspan=" 4" >512 <item row="12" column="0" colspan="3" > 482 513 <spacer name="mSp6" > 483 514 <property name="orientation" > -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp
r33668 r33670 566 566 QString strLocation = files[0]; 567 567 568 /* Prepare GUI medium wrapper: */569 VBoxMedium vboxMedium;570 571 568 /* Open corresponding medium: */ 572 569 CMedium comMedium = vbox.OpenMedium(strLocation, KDeviceType_HardDisk, KAccessMode_ReadWrite); 570 573 571 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); 572 { 573 /* Prepare vbox medium wrapper: */ 574 VBoxMedium vboxMedium; 575 576 /* First of all we should test if that medium already opened: */ 577 if (!vboxGlobal().findMedium(comMedium, vboxMedium)) 578 { 579 /* And create new otherwise: */ 580 vboxMedium = VBoxMedium(CMedium(comMedium), VBoxDefs::MediumType_HardDisk, KMediumState_Created); 581 vboxGlobal().addMedium(vboxMedium); 582 } 583 584 /* Ask medium combobox to select newly added medium: */ 585 m_pDiskSelector->setCurrentItem(vboxMedium.id()); 586 587 /* Update hard disk source: */ 588 hardDiskSourceChanged(); 589 590 m_pDiskSelector->setFocus(); 591 } 579 592 else 580 593 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 594 } 590 595 }
Note:
See TracChangeset
for help on using the changeset viewer.

