- Timestamp:
- May 4, 2016 2:39:00 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r60832 r60834 29 29 /* GUI includes: */ 30 30 # include "UINameAndSystemEditor.h" 31 # include "UIFilePathSelector.h" 32 33 /* COM includes: */ 34 # include "CSystemProperties.h" 31 35 32 36 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 39 43 40 44 41 UINameAndSystemEditor::UINameAndSystemEditor(QWidget *pParent )45 UINameAndSystemEditor::UINameAndSystemEditor(QWidget *pParent, bool fChooseLocation /* = false */) 42 46 : QIWithRetranslateUI<QWidget>(pParent) 47 , m_fChooseLocation(fChooseLocation) 43 48 , m_fSupportsHWVirtEx(false) 44 49 , m_fSupportsLongMode(false) … … 48 53 , m_pIconType(0) 49 54 , m_pEditorName(0) 55 , m_pEditorLocation(0) 50 56 , m_pComboFamily(0) 51 57 , m_pComboType(0) … … 95 101 } 96 102 97 /* Create VM name editor: */ 98 m_pEditorName = new QLineEdit; 99 AssertPtrReturnVoid(m_pEditorName); 100 { 101 /* Configure VM name editor: */ 102 m_pEditorName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 103 m_pLabelName->setBuddy(m_pEditorName); 104 /* Add VM name editor into main-layout: */ 105 pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2); 103 if (!m_fChooseLocation) 104 { 105 /* Create VM name editor: */ 106 m_pEditorName = new QLineEdit; 107 AssertPtrReturnVoid(m_pEditorName); 108 { 109 /* Configure VM name editor: */ 110 m_pEditorName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 111 m_pLabelName->setBuddy(m_pEditorName); 112 /* Add VM name editor into main-layout: */ 113 pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2); 114 } 115 } 116 else 117 { 118 /* Create VM location editor: */ 119 m_pEditorLocation = new UIFilePathSelector; 120 AssertPtrReturnVoid(m_pEditorLocation); 121 { 122 /* Configure advanced VM name editor: */ 123 m_pEditorLocation->setResetEnabled(false); 124 m_pEditorLocation->setMode(UIFilePathSelector::Mode_File_Save); 125 m_pEditorLocation->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 126 m_pEditorLocation->setHomeDir(vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder()); 127 m_pLabelName->setBuddy(m_pEditorLocation); 128 /* Add advanced VM name editor into main-layout: */ 129 pMainLayout->addWidget(m_pEditorLocation, 0, 1, 1, 2); 130 } 106 131 } 107 132 … … 196 221 { 197 222 /* Prepare connections: */ 198 connect(m_pEditorName, SIGNAL(textChanged(const QString &)), this, SIGNAL(sigNameChanged(const QString &))); 223 if (!m_fChooseLocation) 224 connect(m_pEditorName, SIGNAL(textChanged(const QString &)), this, SIGNAL(sigNameChanged(const QString &))); 225 else 226 connect(m_pEditorLocation, SIGNAL(pathChanged(const QString &)), this, SIGNAL(sigNameChanged(const QString &))); 199 227 connect(m_pComboFamily, SIGNAL(currentIndexChanged(int)), this, SLOT(sltFamilyChanged(int))); 200 228 connect(m_pComboType, SIGNAL(currentIndexChanged(int)), this, SLOT(sltTypeChanged(int))); … … 203 231 QString UINameAndSystemEditor::name() const 204 232 { 205 return m_pEditorName->text(); 233 if (!m_fChooseLocation) 234 return m_pEditorName->text(); 235 else 236 return m_pEditorLocation->path(); 206 237 } 207 238 208 239 void UINameAndSystemEditor::setName(const QString &strName) 209 240 { 210 m_pEditorName->setText(strName); 241 if (!m_fChooseLocation) 242 m_pEditorName->setText(strName); 243 else 244 m_pEditorLocation->setPath(strName); 211 245 } 212 246 … … 240 274 m_pLabelFamily->setText(tr("&Type:")); 241 275 m_pLabelType->setText(tr("&Version:")); 242 m_pEditorName->setWhatsThis(tr("Holds the name of the virtual machine.")); 276 if (!m_fChooseLocation) 277 m_pEditorName->setWhatsThis(tr("Holds the name of the virtual machine.")); 278 else 279 m_pEditorLocation->setWhatsThis(tr("Holds the location of the virtual machine.")); 243 280 m_pComboFamily->setWhatsThis(tr("Selects the operating system family that " 244 281 "you plan to install into this virtual machine.")); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
r60832 r60834 30 30 class QLineEdit; 31 31 class QComboBox; 32 class UIFilePathSelector; 32 33 33 34 /** QWidget extension providing complex editor for basic VM parameters. */ … … 48 49 public: 49 50 50 /** Constructs VM parameters editor on the basis of passed @a pParent. */ 51 UINameAndSystemEditor(QWidget *pParent); 51 /** Constructs VM parameters editor on the basis of passed @a pParent. 52 * @param fChooseFullPath determine whether we should propose to choose location. */ 53 UINameAndSystemEditor(QWidget *pParent, bool fChooseLocation = false); 52 54 53 55 /** Returns the VM name editor. */ … … 97 99 /** Holds the currently chosen OS type IDs on per-family basis. */ 98 100 QMap<QString, QString> m_currentIds; 101 /** Holds whether we should propose to choose a full path. */ 102 bool m_fChooseLocation; 99 103 /** Holds whether host supports hardware virtualization. */ 100 104 bool m_fSupportsHWVirtEx; … … 112 116 /** Holds the VM name editor instance. */ 113 117 QLineEdit *m_pEditorName; 118 /** Holds the VM location editor instance. */ 119 UIFilePathSelector *m_pEditorLocation; 114 120 /** Holds the VM OS family combo instance. */ 115 121 QComboBox *m_pComboFamily;
Note:
See TracChangeset
for help on using the changeset viewer.