- Timestamp:
- May 9, 2018 8:03:15 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r72177 r72182 334 334 connect(m_pNamePathSelector, &UIVMNamePathSelector::sigNameChanged, 335 335 this, &UINameAndSystemEditor::sigNameChanged); 336 connect(m_pNamePathSelector, &UIVMNamePathSelector::sigPathChanged, 337 this, &UINameAndSystemEditor::sigPathChanged); 336 338 connect(m_pComboFamily, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 337 339 this, &UINameAndSystemEditor::sltFamilyChanged); … … 346 348 m_pNamePathSelector->setNameFieldValidator(strValidatorString); 347 349 } 350 351 void UINameAndSystemEditor::setMachineFilePath(const QString &strPath) 352 { 353 if (!m_pNamePathSelector) 354 return; 355 m_pNamePathSelector->setToolTipText(strPath); 356 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
r72177 r72182 49 49 /** Notifies listeners about VM name change. */ 50 50 void sigNameChanged(const QString &strNewName); 51 void sigPathChanged(const QString &strName); 51 52 52 53 /** Notifies listeners about VM OS type change. */ … … 73 74 74 75 void setNameFieldValidator(const QString &strValidatorString); 76 77 /** Forwards the machine name to UIVMNamePathSelector member instance. */ 78 void setMachineFilePath(const QString &strPath); 75 79 76 80 protected: -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIVMNamePathSelector.cpp
r72177 r72182 98 98 connect(m_pName, &QILineEdit::textChanged, 99 99 this, &UIVMNamePathSelector::sigNameChanged); 100 101 100 } 102 101 … … 116 115 m_pPath->setText(path); 117 116 m_pPath->setFixedWidthByText(path); 117 emit sigPathChanged(path); 118 118 } 119 119 … … 136 136 void UIVMNamePathSelector::retranslateUi() 137 137 { 138 setToolTip(tr("The Virtual Machine files will be saved under ...")); 138 if (m_strToolTipText.isEmpty()) 139 return; 140 QString strToolTip = "The Virtual Machine files will be saved under " + m_strToolTipText; 141 setToolTip(tr(qPrintable(strToolTip))); 139 142 } 140 143 … … 146 149 if (!strSelectedPath.isEmpty()) 147 150 { 148 m_pPath->setText(strSelectedPath);151 setPath(strSelectedPath); 149 152 } 150 153 } … … 156 159 m_pName->setValidator(new QRegExpValidator(QRegExp(strValidatorString), this)); 157 160 } 161 162 void UIVMNamePathSelector::setToolTipText(const QString &strToolTipText) 163 { 164 if (m_strToolTipText == strToolTipText) 165 return; 166 m_strToolTipText = strToolTipText; 167 retranslateUi(); 168 } 169 170 const QString& UIVMNamePathSelector::toolTipText() const 171 { 172 return m_strToolTipText; 173 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIVMNamePathSelector.h
r72177 r72182 38 38 39 39 void sigNameChanged(const QString &strName); 40 void sigPathChanged(const QString &strName); 40 41 41 42 public: … … 45 46 public slots: 46 47 47 QString path() const;48 void setPath(const QString &path);48 QString path() const; 49 void setPath(const QString &path); 49 50 50 QString name() const; 51 void setName(const QString &name); 52 void setNameFieldValidator(const QString &strValidatorString); 51 QString name() const; 52 void setName(const QString &name); 53 void setNameFieldValidator(const QString &strValidatorString); 54 55 void setToolTipText(const QString &strToolTipText); 56 const QString& toolTipText() const; 53 57 54 58 protected: … … 62 66 private: 63 67 64 void prepareWidgets();65 QString defaultMachineFolder() const;68 void prepareWidgets(); 69 QString defaultMachineFolder() const; 66 70 67 71 QHBoxLayout *m_pMainLayout; … … 70 74 QILabel *m_pSeparator; 71 75 QIToolButton *m_pFileDialogButton; 72 76 /** Tooltip set is set by clients of this widget. */ 77 QString m_strToolTipText; 73 78 }; 74 79 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r72177 r72182 215 215 } 216 216 217 bool UIWizardNewVMPage1::createMachineFolder() 218 { 219 if (!m_pNameAndSystemEditor) 220 return false; 221 /* Cleanup previosly created folder if any: */ 222 if (machineFolderCreated() && !cleanupMachineFolder()) 223 { 224 msgCenter().cannotRemoveMachineFolder(m_strMachineFolder, thisImp()); 225 return false; 226 } 227 217 void UIWizardNewVMPage1::composeMachineFilePath() 218 { 228 219 /* Get VBox: */ 229 220 CVirtualBox vbox = vboxGlobal().virtualBox(); 230 /* Get default machine folder: */231 //const QString strMachineFolder = vbox.GetSystemProperties().GetDefaultMachineFolder();232 221 233 222 /* Compose machine filename: */ … … 241 230 m_strMachineBaseName = fileInfo.completeBaseName(); 242 231 232 if (m_pNameAndSystemEditor) 233 m_pNameAndSystemEditor->setMachineFilePath(m_strMachineFolder); 234 } 235 236 bool UIWizardNewVMPage1::createMachineFolder() 237 { 238 if (!m_pNameAndSystemEditor) 239 return false; 240 /* Cleanup previosly created folder if any: */ 241 if (machineFolderCreated() && !cleanupMachineFolder()) 242 { 243 msgCenter().cannotRemoveMachineFolder(m_strMachineFolder, thisImp()); 244 return false; 245 } 246 247 composeMachineFilePath(); 248 243 249 /* Make sure that folder doesn't exists: */ 244 250 if (QDir(m_strMachineFolder).exists()) … … 286 292 287 293 /* Setup connections: */ 288 connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltNameChanged(const QString &))); 289 connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(sltOsTypeChanged())); 294 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged); 295 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged); 296 connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged); 290 297 291 298 /* Register fields: */ … … 301 308 /* Call to base-class: */ 302 309 onNameChanged(strNewName); 310 composeMachineFilePath(); 311 } 312 313 void UIWizardNewVMPageBasic1::sltPathChanged(const QString &strNewPath) 314 { 315 composeMachineFilePath(); 303 316 } 304 317 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
r72177 r72182 56 56 void setMachineBaseName(const QString &strMachineBaseName) { m_strMachineBaseName = strMachineBaseName; } 57 57 58 /** calls CVirtualBox::ComposeMachineFilename(...) and sets related member variables */ 59 void composeMachineFilePath(); 60 58 61 /** Full path (including the file name) of the machine's configuration file. */ 59 62 QString m_strMachineFilePath; … … 66 69 UINameAndSystemEditor *m_pNameAndSystemEditor; 67 70 68 /** Variables: */69 71 QString m_strGroup; 70 72 bool m_fSupportsHWVirtEx; … … 94 96 /* Handlers: */ 95 97 void sltNameChanged(const QString &strNewText); 98 void sltPathChanged(const QString &strNewPath); 96 99 void sltOsTypeChanged(); 97 100
Note:
See TracChangeset
for help on using the changeset viewer.