- Timestamp:
- May 22, 2018 2:29:53 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r72279 r72288 248 248 { 249 249 m_pPathLabel->setAlignment(Qt::AlignRight); 250 m_pPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 250 251 pMainLayout->addWidget(m_pPathLabel, 1, 0, 1, 1); 251 252 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp
r72243 r72288 21 21 22 22 /* Qt includes: */ 23 # include <QCheckBox> 24 # include <QLabel> 23 25 # include <QVBoxLayout> 24 # include <QLineEdit>25 # include <QCheckBox>26 26 27 27 /* GUI includes: */ 28 28 # include "QIRichTextLabel.h" 29 # include "UIVMNamePathSelector.h" 29 # include "QILineEdit.h" 30 # include "UIFilePathSelector.h" 30 31 # include "UIWizardCloneVM.h" 31 32 # include "UIWizardCloneVMPageBasic1.h" … … 42 43 , m_strDefaultPath(strDefaultPath) 43 44 , m_strGroup(strGroup) 45 , m_pReinitMACsCheckBox(0) 46 , m_pNameLineEdit(0) 47 , m_pPathSelector(0) 48 , m_pNameLabel(0) 49 , m_pPathLabel(0) 44 50 { 45 51 } … … 47 53 QString UIWizardCloneVMPage1::cloneName() const 48 54 { 49 return m_pNamePathSelector->name(); 55 if (!m_pNameLineEdit) 56 return QString(); 57 return m_pNameLineEdit->text(); 50 58 } 51 59 52 60 void UIWizardCloneVMPage1::setCloneName(const QString &strName) 53 61 { 54 m_pNamePathSelector->setName(strName); 62 if (!m_pNameLineEdit) 63 return; 64 m_pNameLineEdit->setText(strName); 55 65 } 56 66 57 67 QString UIWizardCloneVMPage1::clonePath() const 58 68 { 59 if (!m_p NamePathSelector)69 if (!m_pPathSelector) 60 70 return QString(); 61 return m_p NamePathSelector->path();71 return m_pPathSelector->path(); 62 72 } 63 73 64 74 void UIWizardCloneVMPage1::setClonePath(const QString &strPath) 65 75 { 66 m_pNamePathSelector->setPath(strPath); 76 if (!m_pPathSelector) 77 m_pPathSelector->setPath(strPath); 67 78 } 68 79 … … 82 93 bool UIWizardCloneVMPage1::isReinitMACsChecked() const 83 94 { 95 if (!m_pReinitMACsCheckBox) 96 return false; 84 97 return m_pReinitMACsCheckBox->isChecked(); 85 98 } … … 88 101 { 89 102 CVirtualBox vbox = vboxGlobal().virtualBox(); 90 setCloneFilePath(vbox.ComposeMachineFilename(m_pName PathSelector->name(),103 setCloneFilePath(vbox.ComposeMachineFilename(m_pNameLineEdit ? m_pNameLineEdit->text() : QString(), 91 104 m_strGroup, 92 105 QString::null, 93 m_p NamePathSelector->path()));106 m_pPathSelector ? m_pPathSelector->path() : QString())); 94 107 const QFileInfo fileInfo(m_strCloneFilePath); 95 108 m_strCloneFolder = fileInfo.absolutePath(); 96 if (m_pNamePathSelector)97 m_pNamePathSelector->setToolTipText(m_strCloneFolder);98 109 } 99 110 100 111 UIWizardCloneVMPageBasic1::UIWizardCloneVMPageBasic1(const QString &strOriginalName, const QString &strDefaultPath, const QString &strGroup) 101 112 : UIWizardCloneVMPage1(strOriginalName, strDefaultPath, strGroup) 113 , m_pMainLabel(0) 102 114 { 103 115 /* Create widgets: */ 104 116 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 117 if (!pMainLayout) 118 return; 119 120 m_pMainLabel = new QIRichTextLabel(this); 121 if (m_pMainLabel) 105 122 { 106 m_pLabel = new QIRichTextLabel(this); 107 if (m_pLabel) 108 { 109 pMainLayout->addWidget(m_pLabel); 110 } 111 112 m_pNamePathSelector = new UIVMNamePathSelector(this); 113 if (m_pNamePathSelector) 114 { 115 pMainLayout->addWidget(m_pNamePathSelector); 116 m_pNamePathSelector->setName(UIWizardCloneVM::tr("%1 Clone").arg(m_strOriginalName)); 117 m_pNamePathSelector->setPath(m_strDefaultPath); 118 } 119 120 m_pReinitMACsCheckBox = new QCheckBox(this); 121 122 if (m_pReinitMACsCheckBox) 123 { 124 pMainLayout->addWidget(m_pReinitMACsCheckBox); 125 } 126 pMainLayout->addStretch(); 123 pMainLayout->addWidget(m_pMainLabel); 127 124 } 128 125 126 QWidget *pContainerWidget = new QWidget(this); 127 if (pContainerWidget) 128 { 129 pMainLayout->addWidget(pContainerWidget); 130 QGridLayout *pContainerLayout = new QGridLayout(pContainerWidget); 131 pContainerLayout->setContentsMargins(0, 0, 0, 0); 132 133 m_pNameLabel = new QLabel; 134 if (m_pNameLabel) 135 { 136 m_pNameLabel->setAlignment(Qt::AlignRight); 137 m_pNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 138 pContainerLayout->addWidget(m_pNameLabel, 0, 0, 1, 1); 139 } 140 141 m_pNameLineEdit = new QILineEdit(); 142 if (m_pNameLineEdit) 143 { 144 pContainerLayout->addWidget(m_pNameLineEdit, 0, 1, 1, 1); 145 m_pNameLineEdit->setText(UIWizardCloneVM::tr("%1 Clone").arg(m_strOriginalName)); 146 } 147 148 m_pPathLabel = new QLabel(this); 149 if (m_pPathLabel) 150 { 151 m_pPathLabel->setAlignment(Qt::AlignRight); 152 m_pPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 153 pContainerLayout->addWidget(m_pPathLabel, 1, 0, 1, 1); 154 } 155 156 m_pPathSelector = new UIFilePathSelector(this); 157 if (m_pPathSelector) 158 { 159 pContainerLayout->addWidget(m_pPathSelector, 1, 1, 1, 1); 160 m_pPathSelector->setPath(m_strDefaultPath); 161 162 } 163 164 m_pReinitMACsCheckBox = new QCheckBox(this); 165 if (m_pReinitMACsCheckBox) 166 { 167 pContainerLayout->addWidget(m_pReinitMACsCheckBox, 2, 0, 1, 2); 168 } 169 } 170 pMainLayout->addStretch(); 171 129 172 /* Setup connections: */ 130 connect(m_pName PathSelector, &UIVMNamePathSelector::sigNameChanged, this, &UIWizardCloneVMPageBasic1::completeChanged);131 connect(m_p NamePathSelector, &UIVMNamePathSelector::sigPathChanged, this, &UIWizardCloneVMPageBasic1::completeChanged);132 133 connect(m_pName PathSelector, &UIVMNamePathSelector::sigNameChanged, this, &UIWizardCloneVMPageBasic1::sltNameChanged);134 connect(m_p NamePathSelector, &UIVMNamePathSelector::sigPathChanged, this, &UIWizardCloneVMPageBasic1::sltPathChanged);173 connect(m_pNameLineEdit, &QILineEdit::textChanged, this, &UIWizardCloneVMPageBasic1::completeChanged); 174 connect(m_pPathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardCloneVMPageBasic1::completeChanged); 175 176 connect(m_pNameLineEdit, &QILineEdit::textChanged, this, &UIWizardCloneVMPageBasic1::sltNameChanged); 177 connect(m_pPathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardCloneVMPageBasic1::sltPathChanged); 135 178 136 179 /* Register fields: */ … … 147 190 148 191 /* Translate widgets: */ 149 m_pLabel->setText(UIWizardCloneVM::tr("<p>Please choose a folder and a name for the new virtual machine. " 150 "The new machine will be a clone of the machine <b>%1</b>.</p>") 151 .arg(m_strOriginalName)); 152 m_pReinitMACsCheckBox->setToolTip(UIWizardCloneVM::tr("When checked a new unique MAC address will be assigned to all configured network cards.")); 153 m_pReinitMACsCheckBox->setText(UIWizardCloneVM::tr("&Reinitialize the MAC address of all network cards")); 192 if (m_pMainLabel) 193 m_pMainLabel->setText(UIWizardCloneVM::tr("<p>Please choose a name and optionally a folder for the new virtual machine. " 194 "The new machine will be a clone of the machine <b>%1</b>.</p>") 195 .arg(m_strOriginalName)); 196 197 if (m_pNameLabel) 198 m_pNameLabel->setText(UIWizardCloneVM::tr("Name:")); 199 200 if (m_pPathLabel) 201 m_pPathLabel->setText(UIWizardCloneVM::tr("Path:")); 202 if (m_pReinitMACsCheckBox) 203 { 204 m_pReinitMACsCheckBox->setToolTip(UIWizardCloneVM::tr("When checked a new unique MAC address will be assigned to all configured network cards.")); 205 m_pReinitMACsCheckBox->setText(UIWizardCloneVM::tr("&Reinitialize the MAC address of all network cards")); 206 } 154 207 } 155 208 … … 158 211 /* Translate page: */ 159 212 retranslateUi(); 160 if (m_pName PathSelector)161 m_pName PathSelector->setFocus();213 if (m_pNameLineEdit) 214 m_pNameLineEdit->setFocus(); 162 215 } 163 216 164 217 bool UIWizardCloneVMPageBasic1::isComplete() const 165 218 { 166 if (!m_p NamePathSelector)219 if (!m_pPathSelector) 167 220 return false; 168 221 169 QString path = m_p NamePathSelector->path();222 QString path = m_pPathSelector->path(); 170 223 if (path.isEmpty()) 171 224 return false; 172 225 /* Make sure VM name feat the rules: */ 173 QString strName = m_pName PathSelector->name().trimmed();226 QString strName = m_pNameLineEdit->text().trimmed(); 174 227 return !strName.isEmpty() && strName != m_strOriginalName; 175 228 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.h
r72215 r72288 23 23 24 24 /* Forward declarations: */ 25 class Q LineEdit;25 class QILineEdit; 26 26 class QCheckBox; 27 class QLabel; 27 28 class QIRichTextLabel; 28 class UI VMNamePathSelector;29 class UIFilePathSelector; 29 30 30 31 /* 1st page of the Clone Virtual Machine wizard (base part): */ … … 48 49 void composeCloneFilePath(); 49 50 50 QString m_strOriginalName;51 QString m_strDefaultPath;52 QString m_strGroup;51 QString m_strOriginalName; 52 QString m_strDefaultPath; 53 QString m_strGroup; 53 54 /** Full, non-native path of the clone machines setting file. Generated by CVirtualBox::ComposeMachineFilename(...) */ 54 QString m_strCloneFilePath;55 QString m_strCloneFilePath; 55 56 /** The full path of the folder where clone machine's settings file is located. 56 57 * Generated from the m_strCloneFilePath by removing base file name */ 57 QString m_strCloneFolder; 58 QCheckBox *m_pReinitMACsCheckBox; 59 UIVMNamePathSelector *m_pNamePathSelector; 58 QString m_strCloneFolder; 59 QCheckBox *m_pReinitMACsCheckBox; 60 QILineEdit *m_pNameLineEdit; 61 UIFilePathSelector *m_pPathSelector; 62 QLabel *m_pNameLabel; 63 QLabel *m_pPathLabel; 60 64 61 65 }; … … 86 90 bool isComplete() const; 87 91 88 QIRichTextLabel *m_p Label;92 QIRichTextLabel *m_pMainLabel; 89 93 }; 90 94 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp
r72215 r72288 21 21 22 22 /* Global includes: */ 23 # include <QButtonGroup> 24 # include <QCheckBox> 23 25 # include <QGridLayout> 24 # include <QButtonGroup>25 26 # include <QGroupBox> 26 # include <QLineEdit> 27 # include <QCheckBox> 27 # include <QLabel> 28 28 # include <QRadioButton> 29 29 30 30 /* Local includes: */ 31 # include "UIVMNamePathSelector.h" 31 # include "QILineEdit.h" 32 # include "UIFilePathSelector.h" 32 33 # include "UIWizardCloneVMPageExpert.h" 33 34 # include "UIWizardCloneVM.h" … … 47 48 m_pNameCnt = new QGroupBox(this); 48 49 { 49 Q VBoxLayout *pNameCntLayout = new QVBoxLayout(m_pNameCnt);50 QGridLayout *pNameCntLayout = new QGridLayout(m_pNameCnt); 50 51 { 51 m_pNamePathSelector = new UIVMNamePathSelector(m_pNameCnt); 52 { 53 m_pNamePathSelector->setName(UIWizardCloneVM::tr("%1 Clone").arg(m_strOriginalName)); 54 } 55 pNameCntLayout->addWidget(m_pNamePathSelector); 52 pNameCntLayout->setContentsMargins(0, 0, 0, 0); 53 54 m_pNameLabel = new QLabel; 55 if (m_pNameLabel) 56 { 57 m_pNameLabel->setAlignment(Qt::AlignRight); 58 m_pNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 59 pNameCntLayout->addWidget(m_pNameLabel, 0, 0, 1, 1); 60 61 } 62 m_pNameLineEdit = new QILineEdit(m_pNameCnt); 63 if (m_pNameLineEdit) 64 { 65 m_pNameLineEdit->setText(UIWizardCloneVM::tr("%1 Clone").arg(m_strOriginalName)); 66 pNameCntLayout->addWidget(m_pNameLineEdit, 0, 1, 1, 1); 67 } 68 69 m_pPathLabel = new QLabel(this); 70 if (m_pPathLabel) 71 { 72 m_pPathLabel->setAlignment(Qt::AlignRight); 73 m_pPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 74 pNameCntLayout->addWidget(m_pPathLabel, 1, 0, 1, 1); 75 } 76 77 m_pPathSelector = new UIFilePathSelector(this); 78 if (m_pPathSelector) 79 { 80 pNameCntLayout->addWidget(m_pPathSelector, 1, 1, 1, 1); 81 m_pPathSelector->setPath(m_strDefaultPath); 82 } 56 83 } 57 84 } … … 103 130 104 131 /* Setup connections: */ 105 connect(m_pName PathSelector, &UIVMNamePathSelector::sigNameChanged,132 connect(m_pNameLineEdit, &QILineEdit::textChanged, 106 133 this, &UIWizardCloneVMPageExpert::completeChanged); 107 connect(m_p NamePathSelector, &UIVMNamePathSelector::sigPathChanged,134 connect(m_pPathSelector, &UIFilePathSelector::pathChanged, 108 135 this, &UIWizardCloneVMPageExpert::completeChanged); 109 connect(m_pName PathSelector, &UIVMNamePathSelector::sigNameChanged,136 connect(m_pNameLineEdit, &QILineEdit::textChanged, 110 137 this, &UIWizardCloneVMPageExpert::sltNameChanged); 111 connect(m_p NamePathSelector, &UIVMNamePathSelector::sigPathChanged,138 connect(m_pPathSelector, &UIFilePathSelector::pathChanged, 112 139 this, &UIWizardCloneVMPageExpert::sltPathChanged); 113 140 connect(m_pButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked), … … 134 161 { 135 162 /* Translate widgets: */ 136 m_pNameCnt->setTitle(UIWizardCloneVM::tr("New machine &name "));163 m_pNameCnt->setTitle(UIWizardCloneVM::tr("New machine &name and path")); 137 164 m_pCloneTypeCnt->setTitle(UIWizardCloneVM::tr("Clone type")); 138 165 m_pFullCloneRadio->setText(UIWizardCloneVM::tr("&Full Clone")); … … 144 171 m_pReinitMACsCheckBox->setToolTip(UIWizardCloneVM::tr("When checked a new unique MAC address will be assigned to all configured network cards.")); 145 172 m_pReinitMACsCheckBox->setText(UIWizardCloneVM::tr("&Reinitialize the MAC address of all network cards")); 173 m_pNameLabel->setText(UIWizardCloneVM::tr("Name:")); 174 m_pPathLabel->setText(UIWizardCloneVM::tr("Path:")); 146 175 } 147 176 … … 154 183 bool UIWizardCloneVMPageExpert::isComplete() const 155 184 { 156 if (!m_p NamePathSelector)185 if (!m_pPathSelector) 157 186 return false; 158 187 159 QString path = m_p NamePathSelector->path();188 QString path = m_pPathSelector->path(); 160 189 if (path.isEmpty()) 161 190 return false; 162 191 /* Make sure VM name feat the rules: */ 163 QString strName = m_pName PathSelector->name().trimmed();192 QString strName = m_pNameLineEdit->text().trimmed(); 164 193 return !strName.isEmpty() && strName != m_strOriginalName; 165 194 }
Note:
See TracChangeset
for help on using the changeset viewer.