Changeset 78094 in vbox
- Timestamp:
- Apr 10, 2019 3:12:14 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129950
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
r78087 r78094 20 20 #include <QHeaderView> 21 21 #include <QLabel> 22 #include <QListWidget> 22 23 #include <QStackedLayout> 23 24 #include <QTableWidget> … … 37 38 #include "UIWizardImportAppPageBasic2.h" 38 39 40 /* COM includes: */ 41 #include "CCloudClient.h" 42 39 43 40 44 /********************************************************************************************************************************* … … 54 58 , m_pAccountToolButton(0) 55 59 , m_pAccountPropertyTable(0) 60 , m_pAccountInstanceLabel(0) 61 , m_pAccountInstanceList(0) 56 62 { 57 63 } … … 258 264 } 259 265 266 void UIWizardImportAppPage1::populateAccountInstances() 267 { 268 /* Clear list initially: */ 269 m_pAccountInstanceList->clear(); 270 271 /* If profile chosen: */ 272 if (!m_comCloudProfile.isNull()) 273 { 274 /* Create Cloud Client: */ 275 CCloudClient comCloudClient = m_comCloudProfile.CreateCloudClient(); 276 /* Show error message if necessary: */ 277 if (!m_comCloudProfile.isOk()) 278 msgCenter().cannotCreateCloudClient(m_comCloudProfile); 279 else 280 { 281 /* Read Cloud Client instances: */ 282 QVector<QString> vmNames; 283 /*const QVector<QString> vmIDs =*/ 284 comCloudClient.ListInstances(KCloudMachineState_Running, vmNames); 285 /* Show error message if necessary: */ 286 if (!comCloudClient.isOk()) 287 msgCenter().cannotAcquireCloudClientParameter(comCloudClient); 288 else 289 { 290 /* Push acquired names to list rows: */ 291 for (int i = 0; i < vmNames.size(); ++i) 292 { 293 /* Create list item: */ 294 QListWidgetItem *pItem = new QListWidgetItem(vmNames.at(i), m_pAccountInstanceList); 295 if (pItem) 296 { 297 /* Make item non-editable: */ 298 pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable); 299 } 300 } 301 } 302 } 303 } 304 } 305 260 306 void UIWizardImportAppPage1::updatePageAppearance() 261 307 { … … 441 487 m_pCloudContainerLayout->setColumnStretch(0, 0); 442 488 m_pCloudContainerLayout->setColumnStretch(1, 1); 489 m_pCloudContainerLayout->setRowStretch(2, 0); 490 m_pCloudContainerLayout->setRowStretch(3, 1); 443 491 444 492 /* Create account label: */ … … 501 549 m_pCloudContainerLayout->addWidget(m_pAccountPropertyTable, 1, 1); 502 550 } 551 552 /* Create account instance label: */ 553 m_pAccountInstanceLabel = new QLabel; 554 if (m_pAccountInstanceLabel) 555 { 556 /* Add into layout: */ 557 m_pCloudContainerLayout->addWidget(m_pAccountInstanceLabel, 2, 0, Qt::AlignRight); 558 } 559 560 /* Create profile instances table: */ 561 m_pAccountInstanceList = new QListWidget; 562 if (m_pAccountInstanceList) 563 { 564 m_pAccountInstanceLabel->setBuddy(m_pAccountInstanceLabel); 565 const QFontMetrics fm(m_pAccountInstanceList->font()); 566 const int iFontWidth = fm.width('x'); 567 const int iTotalWidth = 50 * iFontWidth; 568 const int iFontHeight = fm.height(); 569 const int iTotalHeight = 4 * iFontHeight; 570 m_pAccountInstanceList->setMinimumSize(QSize(iTotalWidth, iTotalHeight)); 571 // m_pAccountInstanceList->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 572 m_pAccountInstanceList->setAlternatingRowColors(true); 573 574 /* Add into layout: */ 575 m_pCloudContainerLayout->addWidget(m_pAccountInstanceList, 2, 1, 2, 1); 576 } 503 577 } 504 578 … … 521 595 /* Populate account properties: */ 522 596 populateAccountProperties(); 597 /* Populate account instances: */ 598 populateAccountInstances(); 523 599 524 600 /* Setup connections: */ … … 590 666 m_pFileSelector->setFileFilters(UIWizardImportApp::tr("Open Virtualization Format (%1)").arg("*.ova *.ovf")); 591 667 592 /* Translate Account label : */668 /* Translate Account labels: */ 593 669 m_pAccountLabel->setText(UIWizardImportApp::tr("&Account:")); 670 m_pAccountInstanceLabel->setText(UIWizardImportApp::tr("&Machines:")); 594 671 595 672 /* Adjust label widths: */ … … 597 674 labels << m_pSourceLabel; 598 675 labels << m_pAccountLabel; 676 labels << m_pAccountInstanceLabel; 599 677 int iMaxWidth = 0; 600 678 foreach (QWidget *pLabel, labels) … … 666 744 populateAccounts(); 667 745 populateAccountProperties(); 746 populateAccountInstances(); 668 747 emit completeChanged(); 669 748 } … … 673 752 /* Refresh required settings: */ 674 753 populateAccountProperties(); 754 populateAccountInstances(); 675 755 } 676 756 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h
r78082 r78094 34 34 /* Forward declarations: */ 35 35 class QLabel; 36 class QListWidget; 36 37 class QTableWidget; 37 38 class QStackedLayout; … … 70 71 /** Populates account properties. */ 71 72 void populateAccountProperties(); 73 /** Populates account instances. */ 74 void populateAccountInstances(); 72 75 73 76 /** Updates page appearance. */ … … 128 131 /** Holds the account property table instance. */ 129 132 QTableWidget *m_pAccountPropertyTable; 133 /** Holds the account instance label instance. */ 134 QLabel *m_pAccountInstanceLabel; 135 /** Holds the account instance list instance. */ 136 QListWidget *m_pAccountInstanceList; 130 137 }; 131 138
Note:
See TracChangeset
for help on using the changeset viewer.