Changeset 72903 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 4, 2018 7:59:39 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123450
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r72822 r72903 59 59 # include "QIMessageBox.h" 60 60 # include "QIDialogButtonBox.h" 61 # include "UIFDCreationDialog.h" 61 62 # include "UIIconPool.h" 62 63 # include "UIThreadPool.h" … … 2719 2720 } 2720 2721 2722 QString VBoxGlobal::showCreateFloppyDiskDialog(QWidget *pParent, const QString &strMachineName, const QString &strMachineFolder) 2723 { 2724 QString strMediumID; 2725 UIFDCreationDialog *pDialog = new UIFDCreationDialog(pParent, strMachineName, strMachineFolder); 2726 if (pDialog->exec()) 2727 { 2728 strMediumID = pDialog->mediumID(); 2729 } 2730 delete pDialog; 2731 return strMediumID; 2732 } 2733 2721 2734 void VBoxGlobal::prepareStorageMenu(QMenu &menu, 2722 2735 QObject *pListener, const char *pszSlotName, … … 2746 2759 "This is used for hard disks, optical media and floppies")); 2747 2760 2761 /* Prepare create floppy disk action: */ 2762 if (enmMediumType == UIMediumType_Floppy) 2763 { 2764 QAction *pActionCreateFloppy = menu.addAction(UIIconPool::iconSet(":/fd_add_16px.png"), 2765 QString(), pListener, pszSlotName); 2766 pActionCreateFloppy->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(), 2767 comCurrentAttachment.GetDevice(), enmMediumType, 2768 UIMediumTarget::UIMediumTargetType_CreateFloppyDisk))); 2769 pActionCreateFloppy->setText(QApplication::translate("UIMachineSettingsStorage", "Create a new floppy disk...", 2770 "This is used to create a new floppy disk")); 2771 } 2748 2772 /* Prepare ad-hoc-viso action for DVD-ROMs: */ 2749 2773 if (enmMediumType == UIMediumType_DVD) … … 2897 2921 case UIMediumTarget::UIMediumTargetType_WithID: 2898 2922 case UIMediumTarget::UIMediumTargetType_CreateAdHocVISO: 2923 case UIMediumTarget::UIMediumTargetType_CreateFloppyDisk: 2899 2924 { 2900 2925 /* New mount-target attributes: */ … … 2915 2940 /* Call for file-open dialog: */ 2916 2941 const QString strMachineFolder(QFileInfo(comConstMachine.GetSettingsFilePath()).absolutePath()); 2917 const QString strMediumID = target.type != UIMediumTarget::UIMediumTargetType_CreateAdHocVISO 2918 ? openMediumWithFileOpenDialog(target.mediumType, 2919 windowManager().mainWindowShown(), 2920 strMachineFolder) 2921 : createVisoMediumWithFileOpenDialog(windowManager().mainWindowShown(), 2922 strMachineFolder); 2942 QString strMediumID; 2943 if (target.type == UIMediumTarget::UIMediumTargetType_WithID) 2944 strMediumID = openMediumWithFileOpenDialog(target.mediumType, windowManager().mainWindowShown(), strMachineFolder); 2945 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateAdHocVISO) 2946 strMediumID = createVisoMediumWithFileOpenDialog(windowManager().mainWindowShown(), strMachineFolder); 2947 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateFloppyDisk) 2948 strMediumID = showCreateFloppyDiskDialog(windowManager().mainWindowShown(), comConstMachine.GetName(), strMachineFolder); 2949 2923 2950 /* Return focus back: */ 2924 2951 if (pLastFocusedWidget) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r72822 r72903 508 508 QString createVisoMediumWithFileOpenDialog(QWidget *pParent, const QString &strFolder); 509 509 510 /** Creates and shows a dialog thru which user can create a new floppy disk a VISO using the file-open dialog. 511 * @param parent Passes the parent of the dialog, 512 * @param strMachineName Passes the name of the machine, 513 * @param strMachineFolder Passes the machine folder, 514 * returns the ID of the newly created medium if successful, an empty string otherwise.*/ 515 QString showCreateFloppyDiskDialog(QWidget *pParent, const QString &strMachineName, const QString &strMachineFolder); 516 510 517 /** Prepares storage menu according passed parameters. 511 518 * @param menu Brings the #QMenu to be prepared. -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp
r72873 r72903 43 43 UIFDCreationDialog::UIFDCreationDialog(QWidget *pParent /* = 0 */, 44 44 const QString &strMachineName /* = QString() */, 45 const QString &strMachine SettingsFilePath/* = QString() */)45 const QString &strMachineFolder /* = QString() */) 46 46 : QIWithRetranslateUI<QDialog>(pParent) 47 47 , m_pFilePathselector(0) 48 48 , m_strMachineName(strMachineName) 49 , m_strMachine SettingsFilePath(strMachineSettingsFilePath)49 , m_strMachineFolder(strMachineFolder) 50 50 , m_pPathLabel(0) 51 51 , m_pSizeLabel(0) … … 150 150 QString strPreferredExtension = UIMediumDefs::getPreferredExtensionForMedium(KDeviceType_Floppy); 151 151 152 QString strInitialPath = QFileInfo(m_strMachineSettingsFilePath).absolutePath();152 QString strInitialPath = m_strMachineFolder; 153 153 if (strInitialPath.isEmpty()) 154 154 strInitialPath = vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder(); … … 195 195 return; 196 196 } 197 /* Store the id of the newly create medium: */ 198 m_strMediumID = newMedium.GetId(); 197 199 198 200 /* After a successful creation and initilization of the floppy disk we call base class accept … … 200 202 QDialog::accept(); 201 203 } 204 205 QString UIFDCreationDialog::mediumID() const 206 { 207 return m_strMediumID; 208 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.h
r72869 r72903 43 43 UIFDCreationDialog(QWidget *pParent = 0, 44 44 const QString &strMachineName = QString(), 45 const QString &strMachine SettingsFilePath= QString());45 const QString &strMachineFolder = QString()); 46 46 47 47 virtual void accept() /* override */; 48 /* Return the mediumID */ 49 QString mediumID() const; 48 50 49 51 protected: … … 67 69 UIFilePathSelector *m_pFilePathselector; 68 70 QString m_strMachineName; 69 QString m_strMachine SettingsFilePath;71 QString m_strMachineFolder; 70 72 QLabel *m_pPathLabel; 71 73 QLabel *m_pSizeLabel; 72 74 QComboBox *m_pSizeCombo; 73 75 QDialogButtonBox *m_pButtonBox; 76 QString m_strMediumID; 74 77 }; 75 78 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h
r72869 r72903 85 85 { 86 86 /** Medium-target types. */ 87 enum UIMediumTargetType { UIMediumTargetType_WithID, UIMediumTargetType_WithLocation, UIMediumTargetType_CreateAdHocVISO }; 87 enum UIMediumTargetType 88 { 89 UIMediumTargetType_WithID, 90 UIMediumTargetType_WithLocation, 91 UIMediumTargetType_CreateAdHocVISO, 92 UIMediumTargetType_CreateFloppyDisk 93 }; 88 94 89 95 /** Medium-target constructor. */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
r72869 r72903 480 480 void UIMediumSelector::sltCreateMedium() 481 481 { 482 483 UIFDCreationDialog *pDialog = new UIFDCreationDialog(this, m_strMachineName, m_strMachineSettingsFilePath);482 QString strMachineFolder = QFileInfo(m_strMachineSettingsFilePath).absolutePath(); 483 UIFDCreationDialog *pDialog = new UIFDCreationDialog(this, m_strMachineName, strMachineFolder); 484 484 if (pDialog->exec()) 485 485 {
Note:
See TracChangeset
for help on using the changeset viewer.