- Timestamp:
- Aug 19, 2024 4:39:24 PM (3 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.cpp
r105363 r105730 42 42 #include "UIIconPool.h" 43 43 #include "UINotificationCenter.h" 44 #include "UIToolBox.h"45 44 #include "UIVirtualBoxEventHandler.h" 46 45 #include "UIVirtualBoxManager.h" … … 54 53 55 54 UIWizardNewCloudVMPageExpert::UIWizardNewCloudVMPageExpert() 56 : m_pToolBox(0) 57 , m_pLayoutProvider(0) 55 : m_pLayoutProvider(0) 58 56 , m_pProviderLabel(0) 59 57 , m_pProviderComboBox(0) … … 69 67 if (pLayoutMain) 70 68 { 71 /* Prepare tool-box: */72 m_pToolBox = new UIToolBox(this);73 if ( m_pToolBox)69 /* Prepare location widget: */ 70 QWidget *pWidgetLocation = new QWidget(this); 71 if (pWidgetLocation) 74 72 { 75 /* Prepare location widget: */76 Q Widget *pWidgetLocation = new QWidget(m_pToolBox);77 if (p WidgetLocation)73 /* Prepare location layout: */ 74 QVBoxLayout *pLayoutLocation = new QVBoxLayout(pWidgetLocation); 75 if (pLayoutLocation) 78 76 { 79 /* Prepare location layout: */ 80 QVBoxLayout *pLayoutLocation = new QVBoxLayout(pWidgetLocation); 81 if (pLayoutLocation) 77 pLayoutLocation->setContentsMargins(0, 0, 0, 0); 78 79 /* Prepare provider layout: */ 80 m_pLayoutProvider = new QGridLayout; 81 if (m_pLayoutProvider) 82 82 { 83 pLayoutLocation->setContentsMargins(0, 0, 0, 0); 84 85 /* Prepare provider layout: */ 86 m_pLayoutProvider = new QGridLayout; 87 if (m_pLayoutProvider) 83 m_pLayoutProvider->setContentsMargins(0, 0, 0, 0); 84 m_pLayoutProvider->setColumnStretch(0, 0); 85 m_pLayoutProvider->setColumnStretch(1, 1); 86 87 /* Prepare provider label: */ 88 m_pProviderLabel = new QLabel(this); 89 if (m_pProviderLabel) 90 m_pLayoutProvider->addWidget(m_pProviderLabel, 0, 0, Qt::AlignRight); 91 92 /* Prepare provider combo-box: */ 93 m_pProviderComboBox = new QIComboBox(pWidgetLocation); 94 if (m_pProviderComboBox) 88 95 { 89 m_pLayoutProvider->setContentsMargins(0, 0, 0, 0); 90 m_pLayoutProvider->setColumnStretch(0, 0); 91 m_pLayoutProvider->setColumnStretch(1, 1); 92 93 /* Prepare provider label: */ 94 m_pProviderLabel = new QLabel(this); 95 if (m_pProviderLabel) 96 m_pLayoutProvider->addWidget(m_pProviderLabel, 0, 0, Qt::AlignRight); 97 98 /* Prepare provider combo-box: */ 99 m_pProviderComboBox = new QIComboBox(pWidgetLocation); 100 if (m_pProviderComboBox) 96 m_pProviderLabel->setBuddy(m_pProviderComboBox); 97 m_pLayoutProvider->addWidget(m_pProviderComboBox, 0, 1); 98 } 99 100 /* Prepare profile label: */ 101 m_pProfileLabel = new QLabel(this); 102 if (m_pProfileLabel) 103 m_pLayoutProvider->addWidget(m_pProfileLabel, 1, 0, Qt::AlignRight); 104 105 /* Prepare profile layout: */ 106 QHBoxLayout *pLayoutProfile = new QHBoxLayout; 107 if (pLayoutProfile) 108 { 109 pLayoutProfile->setContentsMargins(0, 0, 0, 0); 110 pLayoutProfile->setSpacing(1); 111 112 /* Prepare profile combo-box: */ 113 m_pProfileComboBox = new QIComboBox(pWidgetLocation); 114 if (m_pProfileComboBox) 101 115 { 102 m_pPro viderLabel->setBuddy(m_pProviderComboBox);103 m_pLayoutProvider->addWidget(m_pProviderComboBox, 0, 1);116 m_pProfileLabel->setBuddy(m_pProfileComboBox); 117 pLayoutProfile->addWidget(m_pProfileComboBox); 104 118 } 105 119 106 /* Prepare profile label: */ 107 m_pProfileLabel = new QLabel(this); 108 if (m_pProfileLabel) 109 m_pLayoutProvider->addWidget(m_pProfileLabel, 1, 0, Qt::AlignRight); 110 111 /* Prepare profile layout: */ 112 QHBoxLayout *pLayoutProfile = new QHBoxLayout; 113 if (pLayoutProfile) 120 /* Prepare profile tool-button: */ 121 m_pProfileToolButton = new QIToolButton(pWidgetLocation); 122 if (m_pProfileToolButton) 114 123 { 115 pLayoutProfile->setContentsMargins(0, 0, 0, 0); 116 pLayoutProfile->setSpacing(1); 117 118 /* Prepare profile combo-box: */ 119 m_pProfileComboBox = new QIComboBox(pWidgetLocation); 120 if (m_pProfileComboBox) 121 { 122 m_pProfileLabel->setBuddy(m_pProfileComboBox); 123 pLayoutProfile->addWidget(m_pProfileComboBox); 124 } 125 126 /* Prepare profile tool-button: */ 127 m_pProfileToolButton = new QIToolButton(pWidgetLocation); 128 if (m_pProfileToolButton) 129 { 130 m_pProfileToolButton->setIcon(UIIconPool::iconSet(":/cloud_profile_manager_16px.png", 131 ":/cloud_profile_manager_disabled_16px.png")); 132 pLayoutProfile->addWidget(m_pProfileToolButton); 133 } 134 135 /* Add into layout: */ 136 m_pLayoutProvider->addLayout(pLayoutProfile, 1, 1); 124 m_pProfileToolButton->setIcon(UIIconPool::iconSet(":/cloud_profile_manager_16px.png", 125 ":/cloud_profile_manager_disabled_16px.png")); 126 pLayoutProfile->addWidget(m_pProfileToolButton); 137 127 } 138 128 139 129 /* Add into layout: */ 140 pLayoutLocation->addLayout(m_pLayoutProvider);130 m_pLayoutProvider->addLayout(pLayoutProfile, 1, 1); 141 131 } 132 133 /* Add into layout: */ 134 pLayoutLocation->addLayout(m_pLayoutProvider); 142 135 } 143 144 /* Add into tool-box: */145 m_pToolBox->insertPage(0, pWidgetLocation, QString());146 136 } 147 137 148 /* Prepare source widget: */ 149 QWidget *pWidgetSource = new QWidget(m_pToolBox); 150 if (pWidgetSource) 138 /* Add into layout: */ 139 pLayoutMain->addWidget(pWidgetLocation); 140 } 141 142 /* Prepare source widget: */ 143 QWidget *pWidgetSource = new QWidget(this); 144 if (pWidgetSource) 145 { 146 /* Prepare source layout: */ 147 QVBoxLayout *pLayoutSource = new QVBoxLayout(pWidgetSource); 148 if (pLayoutSource) 151 149 { 152 /* Prepare source layout: */ 153 QVBoxLayout *pLayoutSource = new QVBoxLayout(pWidgetSource); 154 if (pLayoutSource) 150 pLayoutSource->setContentsMargins(0, 0, 0, 0); 151 pLayoutSource->setSpacing(0); 152 153 /* Prepare source tab-bar: */ 154 m_pSourceTabBar = new QTabBar(pWidgetSource); 155 if (m_pSourceTabBar) 155 156 { 156 pLayoutSource->setContentsMargins(0, 0, 0, 0); 157 pLayoutSource->setSpacing(0); 158 159 /* Prepare source tab-bar: */ 160 m_pSourceTabBar = new QTabBar(pWidgetSource); 161 if (m_pSourceTabBar) 162 { 163 m_pSourceTabBar->addTab(QString()); 164 m_pSourceTabBar->addTab(QString()); 165 166 /* Add into layout: */ 167 pLayoutSource->addWidget(m_pSourceTabBar); 168 } 169 170 /* Prepare source image list: */ 171 m_pSourceImageList = new QIListWidget(pWidgetSource); 172 if (m_pSourceImageList) 173 { 174 /* We want to have sorting enabled: */ 175 m_pSourceImageList->setSortingEnabled(true); 176 /* A bit of look&feel: */ 177 m_pSourceImageList->setAlternatingRowColors(true); 178 179 /* Add into layout: */ 180 pLayoutSource->addWidget(m_pSourceImageList); 181 } 157 m_pSourceTabBar->addTab(QString()); 158 m_pSourceTabBar->addTab(QString()); 159 160 /* Add into layout: */ 161 pLayoutSource->addWidget(m_pSourceTabBar); 182 162 } 183 163 184 /* Add into tool-box: */ 185 m_pToolBox->insertPage(1, pWidgetSource, QString()); 164 /* Prepare source image list: */ 165 m_pSourceImageList = new QIListWidget(pWidgetSource); 166 if (m_pSourceImageList) 167 { 168 /* Make source image list fit 50 symbols 169 * horizontally and 8 lines vertically: */ 170 const QFontMetrics fm(m_pSourceImageList->font()); 171 const int iFontWidth = fm.horizontalAdvance('x'); 172 const int iTotalWidth = 50 * iFontWidth; 173 const int iFontHeight = fm.height(); 174 const int iTotalHeight = 8 * iFontHeight; 175 m_pSourceImageList->setMinimumSize(QSize(iTotalWidth, iTotalHeight)); 176 /* We want to have sorting enabled: */ 177 m_pSourceImageList->setSortingEnabled(true); 178 /* A bit of look&feel: */ 179 m_pSourceImageList->setAlternatingRowColors(true); 180 181 /* Add into layout: */ 182 pLayoutSource->addWidget(m_pSourceImageList); 183 } 186 184 } 187 185 188 /* Prepare settings widget: */ 189 QWidget *pWidgetSettings = new QWidget(m_pToolBox); 190 if (pWidgetSettings) 186 /* Add into layout: */ 187 pLayoutMain->addWidget(pWidgetSource); 188 } 189 190 /* Prepare settings widget: */ 191 QWidget *pWidgetSettings = new QWidget(this); 192 if (pWidgetSettings) 193 { 194 /* Prepare settings layout: */ 195 QVBoxLayout *pLayoutSettings = new QVBoxLayout(pWidgetSettings); 196 if (pLayoutSettings) 191 197 { 192 /* Prepare settings layout: */ 193 QVBoxLayout *pLayoutSettings = new QVBoxLayout(pWidgetSettings); 194 if (pLayoutSettings) 198 pLayoutSettings->setContentsMargins(0, 0, 0, 0); 199 200 /* Prepare form editor widget: */ 201 m_pFormEditor = new UIFormEditorWidget(pWidgetSettings); 202 if (m_pFormEditor) 195 203 { 196 pLayoutSettings->setContentsMargins(0, 0, 0, 0);197 198 /* Prepare form editor widget: */199 m_pFormEditor = new UIFormEditorWidget(pWidgetSettings);200 if ( m_pFormEditor)201 {202 /* Add into layout: */ 203 pLayoutSettings->addWidget(m_pFormEditor);204 }204 /* Make form-editor fit 6 sections in height by default: */ 205 const int iDefaultSectionHeight = m_pFormEditor->verticalHeader() 206 ? m_pFormEditor->verticalHeader()->defaultSectionSize() 207 : 0; 208 if (iDefaultSectionHeight > 0) 209 m_pFormEditor->setMinimumHeight(6 * iDefaultSectionHeight); 210 211 /* Add into layout: */ 212 pLayoutSettings->addWidget(m_pFormEditor); 205 213 } 206 207 /* Add into tool-box: */208 m_pToolBox->insertPage(2, pWidgetSettings, QString());209 214 } 210 215 211 216 /* Add into layout: */ 212 pLayoutMain->addWidget( m_pToolBox);217 pLayoutMain->addWidget(pWidgetSettings); 213 218 } 214 219 } … … 238 243 void UIWizardNewCloudVMPageExpert::sltRetranslateUI() 239 244 { 240 /* Translate tool-box: */241 if (m_pToolBox)242 {243 m_pToolBox->setPageTitle(0, UIWizardNewCloudVM::tr("Location"));244 m_pToolBox->setPageTitle(1, UIWizardNewCloudVM::tr("Source"));245 m_pToolBox->setPageTitle(2, UIWizardNewCloudVM::tr("Settings"));246 }247 248 245 /* Translate provider label: */ 249 246 if (m_pProviderLabel) … … 287 284 void UIWizardNewCloudVMPageExpert::initializePage() 288 285 { 289 /* Choose 1st tool to be chosen initially: */290 m_pToolBox->setCurrentPage(0);291 286 /* Make sure form-editor knows notification-center: */ 292 287 m_pFormEditor->setNotificationCenter(wizard()->notificationCenter()); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.h
r104566 r105730 40 40 class QLabel; 41 41 class QIListWidget; 42 class UIToolBox;43 42 class UIWizardNewCloudVM; 44 43 … … 97 96 QString m_strSourceImageId; 98 97 99 /** Holds the tool-box instance. */100 UIToolBox *m_pToolBox;101 102 98 /** Holds the provider layout instance. */ 103 99 QGridLayout *m_pLayoutProvider;
Note:
See TracChangeset
for help on using the changeset viewer.