Changeset 72185 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 10, 2018 7:29:57 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 122617
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r72183 r72185 179 179 180 180 UIWizardNewVMPage1::UIWizardNewVMPage1(const QString &strGroup) 181 : m_strGroup(strGroup) 181 : m_pNameAndSystemEditor(0) 182 , m_strGroup(strGroup) 183 182 184 { 183 185 CHost host = vboxGlobal().host(); … … 196 198 if (strNewName.contains(gs_OSTypePattern[i].pattern)) 197 199 { 198 m_pNameAndSystemEditor->blockSignals(true); 199 m_pNameAndSystemEditor->setType(vboxGlobal().vmGuestOSType(gs_OSTypePattern[i].pcstId)); 200 m_pNameAndSystemEditor->blockSignals(false); 200 if (m_pNameAndSystemEditor) 201 { 202 m_pNameAndSystemEditor->blockSignals(true); 203 m_pNameAndSystemEditor->setType(vboxGlobal().vmGuestOSType(gs_OSTypePattern[i].pcstId)); 204 m_pNameAndSystemEditor->blockSignals(false); 205 } 201 206 break; 202 207 } … … 207 212 /* If the user manually edited the OS type, we didn't want our automatic OS type guessing anymore. 208 213 * So simply disconnect the text-edit signal. */ 209 m_pNameAndSystemEditor->disconnect(SIGNAL(sigNameChanged(const QString &)), thisImp(), SLOT(sltNameChanged(const QString &))); 210 } 211 212 bool UIWizardNewVMPage1::machineFolderCreated() 213 { 214 return !m_strMachineFolder.isEmpty(); 215 } 214 if (m_pNameAndSystemEditor) 215 m_pNameAndSystemEditor->disconnect(SIGNAL(sigNameChanged(const QString &)), thisImp(), SLOT(sltNameChanged(const QString &))); 216 } 217 218 // bool UIWizardNewVMPage1::machineFolderCreated() 219 // { 220 // return !m_strMachineFolder.isEmpty(); 221 // } 216 222 217 223 void UIWizardNewVMPage1::composeMachineFilePath() 218 224 { 225 if (!m_pNameAndSystemEditor) 226 return; 227 if (m_pNameAndSystemEditor->name().isEmpty() || m_pNameAndSystemEditor->path().isEmpty()) 228 return; 219 229 /* Get VBox: */ 220 230 CVirtualBox vbox = vboxGlobal().virtualBox(); … … 239 249 return false; 240 250 /* Cleanup previosly created folder if any: */ 241 if ( machineFolderCreated() &&!cleanupMachineFolder())251 if (!cleanupMachineFolder()) 242 252 { 243 253 msgCenter().cannotRemoveMachineFolder(m_strMachineFolder, thisImp()); … … 261 271 return false; 262 272 } 273 m_strCreatedFolder = m_strMachineFolder; 263 274 return true; 264 275 } … … 267 278 { 268 279 /* Make sure folder was previosly created: */ 269 if (m_strMachineFolder.isEmpty()) 270 return false; 271 /* Try to cleanup folder (and it's predecessors): */ 272 bool fMachineFolderRemoved = QDir().rmpath(m_strMachineFolder); 273 /* Reset machine folder value: */ 274 if (fMachineFolderRemoved) 275 m_strMachineFolder = QString(); 276 /* Return cleanup result: */ 277 return fMachineFolderRemoved; 280 if (!m_strCreatedFolder.isEmpty() && m_strCreatedFolder != m_strMachineFolder) 281 { 282 /* Try to cleanup folder (and it's predecessors): */ 283 bool fMachineFolderRemoved = QDir().rmpath(m_strCreatedFolder); 284 /* Reset machine folder value: */ 285 if (fMachineFolderRemoved) 286 m_strCreatedFolder = QString(); 287 /* Return cleanup result: */ 288 return fMachineFolderRemoved; 289 } 290 return true; 291 } 292 293 QString UIWizardNewVMPage1::machineFilePath() const 294 { 295 return m_strMachineFilePath; 296 } 297 298 void UIWizardNewVMPage1::setMachineFilePath(const QString &strMachineFilePath) 299 { 300 m_strMachineFilePath = strMachineFilePath; 301 } 302 303 QString UIWizardNewVMPage1::machineFolder() const 304 { 305 return m_strMachineFolder; 306 } 307 308 void UIWizardNewVMPage1::setMachineFolder(const QString &strMachineFolder) 309 { 310 m_strMachineFolder = strMachineFolder; 311 } 312 313 QString UIWizardNewVMPage1::machineBaseName() const 314 { 315 return m_strMachineBaseName; 316 } 317 318 void UIWizardNewVMPage1::setMachineBaseName(const QString &strMachineBaseName) 319 { 320 m_strMachineBaseName = strMachineBaseName; 278 321 } 279 322 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
r72182 r72185 39 39 40 40 /* Helping stuff: */ 41 bool machineFolderCreated();41 //bool machineFolderCreated(); 42 42 bool createMachineFolder(); 43 43 bool cleanupMachineFolder(); 44 44 45 QString machineFilePath() const { return m_strMachineFilePath; }46 void setMachineFilePath(const QString &strMachineFilePath) { m_strMachineFilePath = strMachineFilePath; }45 QString machineFilePath() const; 46 void setMachineFilePath(const QString &strMachineFilePath); 47 47 48 /** Returns the machine folder value. */ 49 QString machineFolder() const { return m_strMachineFolder; } 50 /** Defines the @a strMachineFolder value. */ 51 void setMachineFolder(const QString &strMachineFolder) { m_strMachineFolder = strMachineFolder; } 48 QString machineFolder() const; 49 void setMachineFolder(const QString &strMachineFolder); 52 50 53 /** Returns the machine base-name value. */ 54 QString machineBaseName() const { return m_strMachineBaseName; } 55 /** Defines the @a strMachineBaseName value. */ 56 void setMachineBaseName(const QString &strMachineBaseName) { m_strMachineBaseName = strMachineBaseName; } 51 QString machineBaseName() const; 52 void setMachineBaseName(const QString &strMachineBaseName); 57 53 58 54 /** calls CVirtualBox::ComposeMachineFilename(...) and sets related member variables */ 59 55 void composeMachineFilePath(); 56 57 /** Provides a path selector and a line edit field for path and name entry. */ 58 UINameAndSystemEditor *m_pNameAndSystemEditor; 59 60 private: 60 61 61 62 /** Full path (including the file name) of the machine's configuration file. */ … … 63 64 /** Path of the folder hosting the machine's configuration file. Generated from m_strMachineFilePath. */ 64 65 QString m_strMachineFolder; 66 /** Path of the folder created by this wizard page. Used to remove previously created folders etc. */ 67 QString m_strCreatedFolder; 65 68 /** Base name of the machine is generated from the m_strMachineFilePath. */ 66 69 QString m_strMachineBaseName; 67 70 68 /** Provides a path selector and a line edit field for path and name entry. */69 UINameAndSystemEditor *m_pNameAndSystemEditor;70 71 71 72 QString m_strGroup; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
r72177 r72185 138 138 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, 139 139 this, &UIWizardNewVMPageExpert::sltNameChanged); 140 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, 141 this, &UIWizardNewVMPageExpert::sltPathChanged); 140 142 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, 141 143 this, &UIWizardNewVMPageExpert::sltOsTypeChanged); … … 179 181 m_pRamEditor->setValue(type.GetRecommendedRAM()); 180 182 181 /* Broadcast complete-change: */ 182 emit completeChanged(); 183 composeMachineFilePath(); 184 /* Broadcast complete-change: */ 185 emit completeChanged(); 186 } 187 188 void UIWizardNewVMPageExpert::sltPathChanged(const QString &strNewPath) 189 { 190 composeMachineFilePath(); 183 191 } 184 192 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
r72177 r72185 59 59 /* Handlers: */ 60 60 void sltNameChanged(const QString &strNewText); 61 void sltPathChanged(const QString &strNewPath); 61 62 void sltOsTypeChanged(); 62 63 void sltRamSliderValueChanged();
Note:
See TracChangeset
for help on using the changeset viewer.