Changeset 84289 in vbox
- Timestamp:
- May 13, 2020 3:19:41 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageBasic1.cpp
r84288 r84289 21 21 #include <QLabel> 22 22 #include <QListWidget> 23 #include <QTabBar> 23 24 #include <QTableWidget> 24 25 #include <QVBoxLayout> … … 52 53 , m_pAccountPropertyTable(0) 53 54 , m_pSourceImageLabel(0) 55 , m_pSourceTabBar(0) 54 56 , m_pSourceImageList(0) 55 57 { … … 301 303 << KCloudImageState_Available; 302 304 303 /* Ask for cloud custom images: */ 304 CProgress comProgress = comCloudClient.ListImages(cloudImageStates, comNames, comIDs); 305 /* Depending on current source tab-bar index: */ 306 CProgress comProgress; 307 switch (m_pSourceTabBar->currentIndex()) 308 { 309 case 0: 310 { 311 /* Ask for cloud boot-volumes: */ 312 comProgress = comCloudClient.ListBootVolumes(comNames, comIDs); 313 break; 314 } 315 case 1: 316 { 317 /* Ask for cloud images: */ 318 comProgress = comCloudClient.ListImages(cloudImageStates, comNames, comIDs); 319 break; 320 } 321 default: 322 break; 323 } 305 324 if (!comCloudClient.isOk()) 306 325 { … … 387 406 setVSD(comVSD); 388 407 389 /* Add image id to virtual system description: */ 390 comVSD.AddDescription(KVirtualSystemDescriptionType_CloudImageId, imageId(), QString()); 408 /* Depending on current source tab-bar index: */ 409 switch (m_pSourceTabBar->currentIndex()) 410 { 411 case 0: 412 { 413 /* Add boot-volume id to virtual system description: */ 414 comVSD.AddDescription(KVirtualSystemDescriptionType_CloudBootVolumeId, imageId(), QString()); 415 break; 416 } 417 case 1: 418 { 419 /* Add image id to virtual system description: */ 420 comVSD.AddDescription(KVirtualSystemDescriptionType_CloudImageId, imageId(), QString()); 421 break; 422 } 423 default: 424 break; 425 } 391 426 if (!comVSD.isOk()) 392 427 { … … 641 676 m_pOptionsLayout->addWidget(m_pSourceImageLabel, 2, 0, Qt::AlignRight); 642 677 } 643 /* Create source image list: */ 644 m_pSourceImageList = new QListWidget(this); 645 if (m_pSourceImageList) 646 { 647 m_pSourceImageLabel->setBuddy(m_pSourceImageList); 648 const QFontMetrics fm(m_pSourceImageList->font()); 649 const int iFontWidth = fm.width('x'); 650 const int iTotalWidth = 50 * iFontWidth; 651 const int iFontHeight = fm.height(); 652 const int iTotalHeight = 4 * iFontHeight; 653 m_pSourceImageList->setMinimumSize(QSize(iTotalWidth, iTotalHeight)); 654 //m_pSourceImageList->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 655 m_pSourceImageList->setAlternatingRowColors(true); 678 /* Create source image layout: */ 679 QVBoxLayout *pSourceImageLayout = new QVBoxLayout; 680 if (pSourceImageLayout) 681 { 682 pSourceImageLayout->setSpacing(0); 683 pSourceImageLayout->setContentsMargins(0, 0, 0, 0); 684 685 /* Create source tab-bar: */ 686 m_pSourceTabBar = new QTabBar(this); 687 if (m_pSourceTabBar) 688 { 689 m_pSourceTabBar->addTab(QString()); 690 m_pSourceTabBar->addTab(QString()); 691 connect(m_pSourceTabBar, &QTabBar::currentChanged, 692 this, &UIWizardNewCloudVMPageBasic1::sltHandleSourceChange); 693 694 /* Add into layout: */ 695 pSourceImageLayout->addWidget(m_pSourceTabBar); 696 } 697 698 /* Create source image list: */ 699 m_pSourceImageList = new QListWidget(this); 700 if (m_pSourceImageList) 701 { 702 m_pSourceImageLabel->setBuddy(m_pSourceImageList); 703 const QFontMetrics fm(m_pSourceImageList->font()); 704 const int iFontWidth = fm.width('x'); 705 const int iTotalWidth = 50 * iFontWidth; 706 const int iFontHeight = fm.height(); 707 const int iTotalHeight = 4 * iFontHeight; 708 m_pSourceImageList->setMinimumSize(QSize(iTotalWidth, iTotalHeight)); 709 //m_pSourceImageList->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 710 m_pSourceImageList->setAlternatingRowColors(true); 711 712 /* Add into layout: */ 713 pSourceImageLayout->addWidget(m_pSourceImageList); 714 } 656 715 657 716 /* Add into layout: */ 658 m_pOptionsLayout->add Widget(m_pSourceImageList, 2, 1, 2, 1);717 m_pOptionsLayout->addLayout(pSourceImageLayout, 2, 1, 2, 1); 659 718 } 660 719 … … 731 790 m_pSourceImageLabel->setText(UIWizardNewCloudVM::tr("&Source:")); 732 791 792 /* Translate source tab-bar: */ 793 m_pSourceTabBar->setTabText(0, UIWizardNewCloudVM::tr("&Boot Volumes")); 794 m_pSourceTabBar->setTabText(1, UIWizardNewCloudVM::tr("&Images")); 795 733 796 /* Adjust label widths: */ 734 797 QList<QWidget*> labels; … … 820 883 gpManager->openCloudProfileManager(); 821 884 } 885 886 void UIWizardNewCloudVMPageBasic1::sltHandleSourceChange() 887 { 888 /* Refresh required settings: */ 889 populateSourceImages(); 890 emit completeChanged(); 891 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageBasic1.h
r84283 r84289 38 38 class QLabel; 39 39 class QListWidget; 40 class QTabBar; 40 41 class QTableWidget; 41 42 class QIComboBox; … … 135 136 /** Holds the source image label instance. */ 136 137 QLabel *m_pSourceImageLabel; 138 /** Holds the source tab-bar instance. */ 139 QTabBar *m_pSourceTabBar; 137 140 /** Holds the source image list instance. */ 138 141 QListWidget *m_pSourceImageList; … … 181 184 /** Handles account tool-button click. */ 182 185 void sltHandleAccountButtonClick(); 186 187 /** Handles change in source tab-bar. */ 188 void sltHandleSourceChange(); 183 189 184 190 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.cpp
r84284 r84289 20 20 #include <QHeaderView> 21 21 #include <QListWidget> 22 #include <QTabBar> 22 23 #include <QTableWidget> 23 24 #include <QVBoxLayout> … … 43 44 if (pMainLayout) 44 45 { 46 pMainLayout->setRowStretch(0, 0); 47 pMainLayout->setRowStretch(1, 1); 48 45 49 /* Create location container: */ 46 50 m_pCntLocation = new QGroupBox(this); … … 129 133 if (pSourceLayout) 130 134 { 135 pSourceLayout->setSpacing(0); 136 137 /* Create source tab-bar: */ 138 m_pSourceTabBar = new QTabBar(this); 139 if (m_pSourceTabBar) 140 { 141 m_pSourceTabBar->addTab(QString()); 142 m_pSourceTabBar->addTab(QString()); 143 connect(m_pSourceTabBar, &QTabBar::currentChanged, 144 this, &UIWizardNewCloudVMPageExpert::sltHandleSourceChange); 145 146 /* Add into layout: */ 147 pSourceLayout->addWidget(m_pSourceTabBar); 148 } 149 131 150 /* Create source image list: */ 132 151 m_pSourceImageList = new QListWidget(m_pCntSource); … … 234 253 m_pCntSource->setTitle(UIWizardNewCloudVM::tr("Source")); 235 254 255 /* Translate source tab-bar: */ 256 m_pSourceTabBar->setTabText(0, UIWizardNewCloudVM::tr("&Boot Volumes")); 257 m_pSourceTabBar->setTabText(1, UIWizardNewCloudVM::tr("&Images")); 258 236 259 /* Translate settings container: */ 237 260 m_pSettingsCnt->setTitle(UIWizardNewCloudVM::tr("Settings")); … … 354 377 } 355 378 379 void UIWizardNewCloudVMPageExpert::sltHandleSourceChange() 380 { 381 /* Refresh required settings: */ 382 populateSourceImages(); 383 populateFormProperties(); 384 refreshFormPropertiesTable(); 385 emit completeChanged(); 386 } 387 356 388 void UIWizardNewCloudVMPageExpert::sltHandleInstanceListChange() 357 389 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.h
r84284 r84289 73 73 void sltHandleAccountButtonClick(); 74 74 75 /** Handles change in source tab-bar. */ 76 void sltHandleSourceChange(); 77 75 78 /** Handles change in instance list. */ 76 79 void sltHandleInstanceListChange();
Note:
See TracChangeset
for help on using the changeset viewer.