VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageFormat.cpp@ 103551

Last change on this file since 103551 was 101563, checked in by vboxsync, 14 months ago

FE/Qt: bugref:10450: Get rid of Qt5 stuff; This one is about signal connection ambiguity stuff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 49.8 KB
Line 
1/* $Id: UIWizardExportAppPageFormat.cpp 101563 2023-10-23 23:36:38Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIWizardExportAppPageFormat class implementation.
4 */
5
6/*
7 * Copyright (C) 2009-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28/* Qt includes: */
29#include <QButtonGroup>
30#include <QCheckBox>
31#include <QDir>
32#include <QGridLayout>
33#include <QLabel>
34#include <QPushButton>
35#include <QRadioButton>
36#include <QStackedWidget>
37#include <QVBoxLayout>
38
39/* GUI includes: */
40#include "QIComboBox.h"
41#include "QIRichTextLabel.h"
42#include "QIToolButton.h"
43#include "UICloudNetworkingStuff.h"
44#include "UICommon.h"
45#include "UIEmptyFilePathSelector.h"
46#include "UIExtraDataManager.h"
47#include "UIIconPool.h"
48#include "UINotificationCenter.h"
49#include "UIVirtualBoxEventHandler.h"
50#include "UIVirtualBoxManager.h"
51#include "UIWizardExportApp.h"
52#include "UIWizardExportAppPageFormat.h"
53
54/* COM includes: */
55#include "CMachine.h"
56#include "CSystemProperties.h"
57
58/* Namespaces: */
59using namespace UIWizardExportAppFormat;
60
61
62/*********************************************************************************************************************************
63* Class UIWizardExportAppFormat implementation. *
64*********************************************************************************************************************************/
65
66void UIWizardExportAppFormat::populateFormats(QIComboBox *pCombo, UINotificationCenter *pCenter, bool fExportToOCIByDefault)
67{
68 /* Sanity check: */
69 AssertPtrReturnVoid(pCombo);
70
71 /* Remember current item data to be able to restore it: */
72 QString strOldData;
73 if (pCombo->currentIndex() != -1)
74 strOldData = pCombo->currentData(FormatData_ShortName).toString();
75 else
76 {
77 /* Otherwise "OCI" or "ovf-1.0" should be the default one: */
78 if (fExportToOCIByDefault)
79 strOldData = "OCI";
80 else
81 strOldData = "ovf-1.0";
82 }
83
84 /* Block signals while updating: */
85 pCombo->blockSignals(true);
86
87 /* Clear combo initially: */
88 pCombo->clear();
89
90 /* Compose hardcoded format list: */
91 QStringList formats;
92 formats << "ovf-0.9";
93 formats << "ovf-1.0";
94 formats << "ovf-2.0";
95 /* Add that list to combo: */
96 foreach (const QString &strShortName, formats)
97 {
98 /* Compose empty item, fill it's data: */
99 pCombo->addItem(QString());
100 pCombo->setItemData(pCombo->count() - 1, strShortName, FormatData_ShortName);
101 }
102
103 /* Iterate through existing providers: */
104 foreach (const CCloudProvider &comProvider, listCloudProviders(pCenter))
105 {
106 /* Skip if we have nothing to populate (file missing?): */
107 if (comProvider.isNull())
108 continue;
109 /* Acquire provider name: */
110 QString strProviderName;
111 if (!cloudProviderName(comProvider, strProviderName, pCenter))
112 continue;
113 /* Acquire provider short name: */
114 QString strProviderShortName;
115 if (!cloudProviderShortName(comProvider, strProviderShortName, pCenter))
116 continue;
117
118 /* Compose empty item, fill it's data: */
119 pCombo->addItem(QString());
120 pCombo->setItemData(pCombo->count() - 1, strProviderName, FormatData_Name);
121 pCombo->setItemData(pCombo->count() - 1, strProviderShortName, FormatData_ShortName);
122 pCombo->setItemData(pCombo->count() - 1, true, FormatData_IsItCloudFormat);
123 }
124
125 /* Set previous/default item if possible: */
126 int iNewIndex = -1;
127 if ( iNewIndex == -1
128 && !strOldData.isNull())
129 iNewIndex = pCombo->findData(strOldData, FormatData_ShortName);
130 if ( iNewIndex == -1
131 && pCombo->count() > 0)
132 iNewIndex = 0;
133 if (iNewIndex != -1)
134 pCombo->setCurrentIndex(iNewIndex);
135
136 /* Unblock signals after update: */
137 pCombo->blockSignals(false);
138}
139
140void UIWizardExportAppFormat::populateMACAddressPolicies(QIComboBox *pCombo)
141{
142 /* Sanity check: */
143 AssertPtrReturnVoid(pCombo);
144 /* We need top-level parent as well: */
145 QWidget *pParent = pCombo->window();
146 AssertPtrReturnVoid(pParent);
147
148 /* Map known export options to known MAC address export policies: */
149 QMap<KExportOptions, MACAddressExportPolicy> knownOptions;
150 knownOptions[KExportOptions_StripAllMACs] = MACAddressExportPolicy_StripAllMACs;
151 knownOptions[KExportOptions_StripAllNonNATMACs] = MACAddressExportPolicy_StripAllNonNATMACs;
152 /* Load currently supported export options: */
153 const QVector<KExportOptions> supportedOptions =
154 uiCommon().virtualBox().GetSystemProperties().GetSupportedExportOptions();
155 /* Check which of supported options/policies are known: */
156 QList<MACAddressExportPolicy> supportedPolicies;
157 foreach (const KExportOptions &enmOption, supportedOptions)
158 if (knownOptions.contains(enmOption))
159 supportedPolicies << knownOptions.value(enmOption);
160 /* Remember current item data to be able to restore it: */
161 MACAddressExportPolicy enmOldData = MACAddressExportPolicy_MAX;
162 if (pCombo->currentIndex() != -1)
163 enmOldData = pCombo->currentData().value<MACAddressExportPolicy>();
164 else
165 {
166 if (supportedPolicies.contains(MACAddressExportPolicy_StripAllNonNATMACs))
167 enmOldData = MACAddressExportPolicy_StripAllNonNATMACs;
168 else
169 enmOldData = MACAddressExportPolicy_KeepAllMACs;
170 }
171
172 /* Block signals while updating: */
173 pCombo->blockSignals(true);
174
175 /* Clear combo initially: */
176 pCombo->clear();
177
178 /* Add supported policies first: */
179 foreach (const MACAddressExportPolicy &enmPolicy, supportedPolicies)
180 pCombo->addItem(QString(), QVariant::fromValue(enmPolicy));
181
182 /* Add hardcoded policy finally: */
183 pCombo->addItem(QString(), QVariant::fromValue(MACAddressExportPolicy_KeepAllMACs));
184
185 /* Set previous/default item if possible: */
186 int iNewIndex = -1;
187 if ( iNewIndex == -1
188 && enmOldData != MACAddressExportPolicy_MAX)
189 iNewIndex = pCombo->findData(QVariant::fromValue(enmOldData));
190 if ( iNewIndex == -1
191 && pCombo->count() > 0)
192 iNewIndex = 0;
193 if (iNewIndex != -1)
194 pCombo->setCurrentIndex(iNewIndex);
195
196 /* Unblock signals after update: */
197 pCombo->blockSignals(false);
198}
199
200QString UIWizardExportAppFormat::format(QIComboBox *pCombo)
201{
202 /* Sanity check: */
203 AssertPtrReturn(pCombo, QString());
204
205 /* Give the actual result: */
206 return pCombo->currentData(FormatData_ShortName).toString();
207}
208
209bool UIWizardExportAppFormat::isFormatCloudOne(QIComboBox *pCombo, int iIndex /* = -1 */)
210{
211 /* Sanity check: */
212 AssertPtrReturn(pCombo, false);
213
214 /* Handle special case, -1 means "current one": */
215 if (iIndex == -1)
216 iIndex = pCombo->currentIndex();
217
218 /* Give the actual result: */
219 return pCombo->itemData(iIndex, FormatData_IsItCloudFormat).toBool();
220}
221
222void UIWizardExportAppFormat::refreshStackedWidget(QStackedWidget *pStackedWidget, bool fIsFormatCloudOne)
223{
224 /* Update stack appearance according to chosen format: */
225 pStackedWidget->setCurrentIndex((int)fIsFormatCloudOne);
226}
227
228void UIWizardExportAppFormat::refreshFileSelectorName(QString &strFileSelectorName,
229 const QStringList &machineNames,
230 const QString &strDefaultApplianceName,
231 bool fIsFormatCloudOne)
232{
233 /* If format is cloud one: */
234 if (fIsFormatCloudOne)
235 {
236 /* We use no name: */
237 strFileSelectorName.clear();
238 }
239 /* If format is local one: */
240 else
241 {
242 /* If it's one VM only, we use the VM name as file-name: */
243 if (machineNames.size() == 1)
244 strFileSelectorName = machineNames.first();
245 /* Otherwise => we use the default file-name: */
246 else
247 strFileSelectorName = strDefaultApplianceName;
248 }
249}
250
251void UIWizardExportAppFormat::refreshFileSelectorExtension(QString &strFileSelectorExt,
252 UIEmptyFilePathSelector *pFileSelector,
253 bool fIsFormatCloudOne)
254{
255 /* If format is cloud one: */
256 if (fIsFormatCloudOne)
257 {
258 /* We use no extension: */
259 strFileSelectorExt.clear();
260
261 /* Update file chooser accordingly: */
262 pFileSelector->setFileFilters(QString());
263 }
264 /* If format is local one: */
265 else
266 {
267 /* We use the default (.ova) extension: */
268 strFileSelectorExt = ".ova";
269
270 /* Update file chooser accordingly: */
271 pFileSelector->setFileFilters(UIWizardExportApp::tr("Open Virtualization Format Archive (%1)").arg("*.ova") + ";;" +
272 UIWizardExportApp::tr("Open Virtualization Format (%1)").arg("*.ovf"));
273 }
274}
275
276void UIWizardExportAppFormat::refreshFileSelectorPath(UIEmptyFilePathSelector *pFileSelector,
277 const QString &strFileSelectorName,
278 const QString &strFileSelectorExt,
279 bool fIsFormatCloudOne)
280{
281 /* If format is cloud one: */
282 if (fIsFormatCloudOne)
283 {
284 /* Clear file selector path: */
285 pFileSelector->setPath(QString());
286 }
287 /* If format is local one: */
288 else
289 {
290 /* Compose file selector path: */
291 const QString strPath = QDir::toNativeSeparators(QString("%1/%2")
292 .arg(uiCommon().documentsPath())
293 .arg(strFileSelectorName + strFileSelectorExt));
294 pFileSelector->setPath(strPath);
295 }
296}
297
298void UIWizardExportAppFormat::refreshManifestCheckBoxAccess(QCheckBox *pCheckBox,
299 bool fIsFormatCloudOne)
300{
301 /* If format is cloud one: */
302 if (fIsFormatCloudOne)
303 {
304 /* Disable manifest check-box: */
305 pCheckBox->setChecked(false);
306 pCheckBox->setEnabled(false);
307 }
308 /* If format is local one: */
309 else
310 {
311 /* Enable and select manifest check-box: */
312 pCheckBox->setChecked(true);
313 pCheckBox->setEnabled(true);
314 }
315}
316
317void UIWizardExportAppFormat::refreshIncludeISOsCheckBoxAccess(QCheckBox *pCheckBox,
318 bool fIsFormatCloudOne)
319{
320 /* If format is cloud one: */
321 if (fIsFormatCloudOne)
322 {
323 /* Disable include ISO check-box: */
324 pCheckBox->setChecked(false);
325 pCheckBox->setEnabled(false);
326 }
327 /* If format is local one: */
328 else
329 {
330 /* Enable include ISO check-box: */
331 pCheckBox->setEnabled(true);
332 }
333}
334
335void UIWizardExportAppFormat::refreshLocalStuff(CAppliance &comLocalAppliance,
336 UIWizardExportApp *pWizard,
337 const QList<QUuid> &machineIDs,
338 const QString &strUri)
339{
340 /* Clear stuff: */
341 comLocalAppliance = CAppliance();
342
343 /* Create appliance: */
344 CVirtualBox comVBox = uiCommon().virtualBox();
345 CAppliance comAppliance = comVBox.CreateAppliance();
346 if (!comVBox.isOk())
347 return UINotificationMessage::cannotCreateAppliance(comVBox, pWizard->notificationCenter());
348
349 /* Remember appliance: */
350 comLocalAppliance = comAppliance;
351
352 /* Iterate over all the selected machine uuids: */
353 foreach (const QUuid &uMachineId, machineIDs)
354 {
355 /* Get the machine with the uMachineId: */
356 CVirtualBox comVBox = uiCommon().virtualBox();
357 CMachine comMachine = comVBox.FindMachine(uMachineId.toString());
358 if (!comVBox.isOk())
359 return UINotificationMessage::cannotFindMachineById(comVBox, uMachineId, pWizard->notificationCenter());
360 /* Add the export description to our appliance object: */
361 CVirtualSystemDescription comVsd = comMachine.ExportTo(comLocalAppliance, strUri);
362 if (!comMachine.isOk())
363 return UINotificationMessage::cannotExportMachine(comMachine, pWizard->notificationCenter());
364 /* Add some additional fields the user may change: */
365 comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", "");
366 comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", "");
367 comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", "");
368 comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", "");
369 comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", "");
370 comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", "");
371 }
372}
373
374void UIWizardExportAppFormat::refreshProfileCombo(QIComboBox *pCombo,
375 UINotificationCenter *pCenter,
376 const QString &strFormat,
377 bool fIsFormatCloudOne)
378{
379 /* Sanity check: */
380 AssertPtrReturnVoid(pCombo);
381
382 /* If format is cloud one: */
383 if (fIsFormatCloudOne)
384 {
385 /* Acquire provider: */
386 CCloudProvider comProvider = cloudProviderByShortName(strFormat, pCenter);
387 AssertReturnVoid(comProvider.isNotNull());
388
389 /* Remember current item data to be able to restore it: */
390 QString strOldData;
391 if (pCombo->currentIndex() != -1)
392 strOldData = pCombo->currentData(ProfileData_Name).toString();
393
394 /* Block signals while updating: */
395 pCombo->blockSignals(true);
396
397 /* Clear combo initially: */
398 pCombo->clear();
399
400 /* Acquire restricted accounts: */
401 const QStringList restrictedProfiles = gEDataManager->cloudProfileManagerRestrictions();
402
403 /* Iterate through existing profile names: */
404 QStringList allowedProfileNames;
405 QStringList restrictedProfileNames;
406 foreach (const CCloudProfile &comProfile, listCloudProfiles(comProvider, pCenter))
407 {
408 /* Skip if we have nothing to populate (wtf happened?): */
409 if (comProfile.isNull())
410 continue;
411 /* Acquire profile name: */
412 QString strCurrentProfileName;
413 if (!cloudProfileName(comProfile, strCurrentProfileName, pCenter))
414 continue;
415
416 /* Compose full profile name: */
417 const QString strFullProfileName = QString("/%1/%2").arg(strFormat).arg(strCurrentProfileName);
418 /* Append to appropriate list: */
419 if (restrictedProfiles.contains(strFullProfileName))
420 restrictedProfileNames.append(strCurrentProfileName);
421 else
422 allowedProfileNames.append(strCurrentProfileName);
423 }
424
425 /* Add allowed items: */
426 foreach (const QString &strAllowedProfileName, allowedProfileNames)
427 {
428 /* Compose item, fill it's data: */
429 pCombo->addItem(strAllowedProfileName);
430 pCombo->setItemData(pCombo->count() - 1, strAllowedProfileName, ProfileData_Name);
431 QFont fnt = pCombo->font();
432 fnt.setBold(true);
433 pCombo->setItemData(pCombo->count() - 1, fnt, Qt::FontRole);
434 }
435 /* Add restricted items: */
436 foreach (const QString &strRestrictedProfileName, restrictedProfileNames)
437 {
438 /* Compose item, fill it's data: */
439 pCombo->addItem(strRestrictedProfileName);
440 pCombo->setItemData(pCombo->count() - 1, strRestrictedProfileName, ProfileData_Name);
441 QBrush brsh;
442 brsh.setColor(Qt::gray);
443 pCombo->setItemData(pCombo->count() - 1, brsh, Qt::ForegroundRole);
444 }
445
446 /* Set previous/default item if possible: */
447 int iNewIndex = -1;
448 if ( iNewIndex == -1
449 && !strOldData.isNull())
450 iNewIndex = pCombo->findData(strOldData, ProfileData_Name);
451 if ( iNewIndex == -1
452 && pCombo->count() > 0)
453 iNewIndex = 0;
454 if (iNewIndex != -1)
455 pCombo->setCurrentIndex(iNewIndex);
456
457 /* Unblock signals after update: */
458 pCombo->blockSignals(false);
459 }
460 /* If format is local one: */
461 else
462 {
463 /* Block signals while updating: */
464 pCombo->blockSignals(true);
465
466 /* Clear combo: */
467 pCombo->clear();
468
469 /* Unblock signals after update: */
470 pCombo->blockSignals(false);
471 }
472}
473
474void UIWizardExportAppFormat::refreshCloudProfile(CCloudProfile &comCloudProfile,
475 UINotificationCenter *pCenter,
476 const QString &strShortProviderName,
477 const QString &strProfileName,
478 bool fIsFormatCloudOne)
479{
480 /* If format is cloud one: */
481 if (fIsFormatCloudOne)
482 comCloudProfile = cloudProfileByName(strShortProviderName, strProfileName, pCenter);
483 /* If format is local one: */
484 else
485 comCloudProfile = CCloudProfile();
486}
487
488void UIWizardExportAppFormat::refreshCloudExportMode(const QMap<CloudExportMode, QAbstractButton*> &radios,
489 bool fIsFormatCloudOne)
490{
491 /* If format is cloud one: */
492 if (fIsFormatCloudOne)
493 {
494 /* Check if something already chosen: */
495 bool fSomethingChosen = false;
496 foreach (QAbstractButton *pButton, radios.values())
497 if (pButton->isChecked())
498 fSomethingChosen = true;
499 /* Choose default cloud export option: */
500 if (!fSomethingChosen)
501 radios.value(CloudExportMode_ExportThenAsk)->setChecked(true);
502 }
503 /* If format is local one: */
504 else
505 {
506 /* Make sure nothing chosen: */
507 foreach (QAbstractButton *pButton, radios.values())
508 pButton->setChecked(false);
509 }
510}
511
512void UIWizardExportAppFormat::refreshCloudStuff(CAppliance &comCloudAppliance,
513 CCloudClient &comCloudClient,
514 CVirtualSystemDescription &comCloudVsd,
515 CVirtualSystemDescriptionForm &comCloudVsdExportForm,
516 UIWizardExportApp *pWizard,
517 const CCloudProfile &comCloudProfile,
518 const QList<QUuid> &machineIDs,
519 const QString &strUri,
520 const CloudExportMode enmCloudExportMode)
521{
522 /* Clear stuff: */
523 comCloudAppliance = CAppliance();
524 comCloudClient = CCloudClient();
525 comCloudVsd = CVirtualSystemDescription();
526 comCloudVsdExportForm = CVirtualSystemDescriptionForm();
527
528 /* Sanity check: */
529 if (comCloudProfile.isNull())
530 return;
531 if (machineIDs.isEmpty())
532 return;
533
534 /* Perform cloud export procedure for first uuid only: */
535 const QUuid uMachineId = machineIDs.first();
536
537 /* Get the machine with the uMachineId: */
538 CVirtualBox comVBox = uiCommon().virtualBox();
539 CMachine comMachine = comVBox.FindMachine(uMachineId.toString());
540 if (!comVBox.isOk())
541 return UINotificationMessage::cannotFindMachineById(comVBox, uMachineId, pWizard->notificationCenter());
542
543 /* Create appliance: */
544 CAppliance comAppliance = comVBox.CreateAppliance();
545 if (!comVBox.isOk())
546 return UINotificationMessage::cannotCreateAppliance(comVBox, pWizard->notificationCenter());
547
548 /* Remember appliance: */
549 comCloudAppliance = comAppliance;
550
551 /* Add the export virtual system description to our appliance object: */
552 CVirtualSystemDescription comVsd = comMachine.ExportTo(comCloudAppliance, strUri);
553 if (!comMachine.isOk())
554 return UINotificationMessage::cannotExportMachine(comMachine, pWizard->notificationCenter());
555
556 /* Remember description: */
557 comCloudVsd = comVsd;
558
559 /* Add Launch Instance flag to virtual system description: */
560 switch (enmCloudExportMode)
561 {
562 case CloudExportMode_AskThenExport:
563 case CloudExportMode_ExportThenAsk:
564 comCloudVsd.AddDescription(KVirtualSystemDescriptionType_CloudLaunchInstance, "true", QString());
565 break;
566 default:
567 comCloudVsd.AddDescription(KVirtualSystemDescriptionType_CloudLaunchInstance, "false", QString());
568 break;
569 }
570 if (!comCloudVsd.isOk())
571 return UINotificationMessage::cannotChangeVirtualSystemDescriptionParameter(comCloudVsd, pWizard->notificationCenter());
572
573 /* Create Cloud Client: */
574 CCloudClient comClient = cloudClient(comCloudProfile);
575 if (comClient.isNull())
576 return;
577
578 /* Remember client: */
579 comCloudClient = comClient;
580
581 /* Read Cloud Client Export description form: */
582 CVirtualSystemDescriptionForm comVsdExportForm;
583 bool fResult = exportDescriptionForm(comCloudClient, comCloudVsd, comVsdExportForm, pWizard->notificationCenter());
584 if (!fResult)
585 return;
586
587 /* Remember export description form: */
588 comCloudVsdExportForm = comVsdExportForm;
589}
590
591QString UIWizardExportAppFormat::profileName(QIComboBox *pCombo)
592{
593 return pCombo->currentData(ProfileData_Name).toString();
594}
595
596void UIWizardExportAppFormat::updateFormatComboToolTip(QIComboBox *pCombo)
597{
598 AssertPtrReturnVoid(pCombo);
599 QString strCurrentToolTip;
600 if (pCombo->count() != 0)
601 {
602 strCurrentToolTip = pCombo->currentData(Qt::ToolTipRole).toString();
603 AssertMsg(!strCurrentToolTip.isEmpty(), ("Data not found!"));
604 }
605 pCombo->setToolTip(strCurrentToolTip);
606}
607
608void UIWizardExportAppFormat::updateMACAddressExportPolicyComboToolTip(QIComboBox *pCombo)
609{
610 AssertPtrReturnVoid(pCombo);
611 QString strCurrentToolTip;
612 if (pCombo->count() != 0)
613 {
614 strCurrentToolTip = pCombo->currentData(Qt::ToolTipRole).toString();
615 AssertMsg(!strCurrentToolTip.isEmpty(), ("Data not found!"));
616 }
617 pCombo->setToolTip(strCurrentToolTip);
618}
619
620
621/*********************************************************************************************************************************
622* Class UIWizardExportAppPageFormat implementation. *
623*********************************************************************************************************************************/
624
625UIWizardExportAppPageFormat::UIWizardExportAppPageFormat(bool fExportToOCIByDefault)
626 : m_fExportToOCIByDefault(fExportToOCIByDefault)
627 , m_pLabelFormat(0)
628 , m_pLabelSettings(0)
629 , m_pFormatLayout(0)
630 , m_pFormatComboBoxLabel(0)
631 , m_pFormatComboBox(0)
632 , m_pSettingsWidget1(0)
633 , m_pSettingsLayout1(0)
634 , m_pFileSelectorLabel(0)
635 , m_pFileSelector(0)
636 , m_pMACComboBoxLabel(0)
637 , m_pMACComboBox(0)
638 , m_pAdditionalLabel(0)
639 , m_pManifestCheckbox(0)
640 , m_pIncludeISOsCheckbox(0)
641 , m_pSettingsLayout2(0)
642 , m_pProfileLabel(0)
643 , m_pProfileComboBox(0)
644 , m_pProfileToolButton(0)
645 , m_pExportModeLabel(0)
646 , m_pExportModeButtonGroup(0)
647{
648 /* Create main layout: */
649 QVBoxLayout *pMainLayout = new QVBoxLayout(this);
650 if (pMainLayout)
651 {
652 /* Create format label: */
653 m_pLabelFormat = new QIRichTextLabel(this);
654 if (m_pLabelFormat)
655 pMainLayout->addWidget(m_pLabelFormat);
656
657 /* Create format layout: */
658 m_pFormatLayout = new QGridLayout;
659 if (m_pFormatLayout)
660 {
661#ifdef VBOX_WS_MAC
662 m_pFormatLayout->setContentsMargins(0, 10, 0, 10);
663 m_pFormatLayout->setSpacing(10);
664#else
665 m_pFormatLayout->setContentsMargins(0, qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin),
666 0, qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
667#endif
668 m_pFormatLayout->setColumnStretch(0, 0);
669 m_pFormatLayout->setColumnStretch(1, 1);
670
671 /* Create format combo-box label: */
672 m_pFormatComboBoxLabel = new QLabel(this);
673 if (m_pFormatComboBoxLabel)
674 {
675 m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
676 m_pFormatLayout->addWidget(m_pFormatComboBoxLabel, 0, 0);
677 }
678 /* Create format combo-box: */
679 m_pFormatComboBox = new QIComboBox(this);
680 if (m_pFormatComboBox)
681 {
682 m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
683 m_pFormatLayout->addWidget(m_pFormatComboBox, 0, 1);
684 }
685
686 /* Add into layout: */
687 pMainLayout->addLayout(m_pFormatLayout);
688 }
689
690 /* Create settings label: */
691 m_pLabelSettings = new QIRichTextLabel(this);
692 if (m_pLabelSettings)
693 pMainLayout->addWidget(m_pLabelSettings);
694
695 /* Create settings widget 1: */
696 m_pSettingsWidget1 = new QStackedWidget(this);
697 if (m_pSettingsWidget1)
698 {
699 /* Create settings pane 1: */
700 QWidget *pSettingsPane1 = new QWidget(m_pSettingsWidget1);
701 if (pSettingsPane1)
702 {
703 /* Create settings layout 1: */
704 m_pSettingsLayout1 = new QGridLayout(pSettingsPane1);
705 if (m_pSettingsLayout1)
706 {
707#ifdef VBOX_WS_MAC
708 m_pSettingsLayout1->setContentsMargins(0, 10, 0, 10);
709 m_pSettingsLayout1->setSpacing(10);
710#else
711 m_pSettingsLayout1->setContentsMargins(0, qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin),
712 0, qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
713#endif
714 m_pSettingsLayout1->setColumnStretch(0, 0);
715 m_pSettingsLayout1->setColumnStretch(1, 1);
716
717 /* Create file selector: */
718 m_pFileSelector = new UIEmptyFilePathSelector(pSettingsPane1);
719 if (m_pFileSelector)
720 {
721 m_pFileSelector->setMode(UIEmptyFilePathSelector::Mode_File_Save);
722 m_pFileSelector->setEditable(true);
723 m_pFileSelector->setButtonPosition(UIEmptyFilePathSelector::RightPosition);
724 m_pFileSelector->setDefaultSaveExt("ova");
725 m_pSettingsLayout1->addWidget(m_pFileSelector, 0, 1, 1, 2);
726 }
727 /* Create file selector label: */
728 m_pFileSelectorLabel = new QLabel(pSettingsPane1);
729 if (m_pFileSelectorLabel)
730 {
731 m_pFileSelectorLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
732 m_pFileSelectorLabel->setBuddy(m_pFileSelector);
733 m_pSettingsLayout1->addWidget(m_pFileSelectorLabel, 0, 0);
734 }
735
736 /* Create MAC policy combo-box: */
737 m_pMACComboBox = new QIComboBox(pSettingsPane1);
738 if (m_pMACComboBox)
739 m_pSettingsLayout1->addWidget(m_pMACComboBox, 1, 1, 1, 2);
740 /* Create format combo-box label: */
741 m_pMACComboBoxLabel = new QLabel(pSettingsPane1);
742 if (m_pMACComboBoxLabel)
743 {
744 m_pMACComboBoxLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
745 m_pMACComboBoxLabel->setBuddy(m_pMACComboBox);
746 m_pSettingsLayout1->addWidget(m_pMACComboBoxLabel, 1, 0);
747 }
748
749 /* Create advanced label: */
750 m_pAdditionalLabel = new QLabel(pSettingsPane1);
751 if (m_pAdditionalLabel)
752 {
753 m_pAdditionalLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
754 m_pSettingsLayout1->addWidget(m_pAdditionalLabel, 2, 0);
755 }
756 /* Create manifest check-box: */
757 m_pManifestCheckbox = new QCheckBox(pSettingsPane1);
758 if (m_pManifestCheckbox)
759 m_pSettingsLayout1->addWidget(m_pManifestCheckbox, 2, 1);
760 /* Create include ISOs check-box: */
761 m_pIncludeISOsCheckbox = new QCheckBox(pSettingsPane1);
762 if (m_pIncludeISOsCheckbox)
763 m_pSettingsLayout1->addWidget(m_pIncludeISOsCheckbox, 3, 1);
764
765 /* Create placeholder: */
766 QWidget *pPlaceholder = new QWidget(pSettingsPane1);
767 if (pPlaceholder)
768 m_pSettingsLayout1->addWidget(pPlaceholder, 4, 0, 1, 3);
769 }
770
771 /* Add into layout: */
772 m_pSettingsWidget1->addWidget(pSettingsPane1);
773 }
774
775 /* Create settings pane 2: */
776 QWidget *pSettingsPane2 = new QWidget(m_pSettingsWidget1);
777 if (pSettingsPane2)
778 {
779 /* Create settings layout 2: */
780 m_pSettingsLayout2 = new QGridLayout(pSettingsPane2);
781 if (m_pSettingsLayout2)
782 {
783#ifdef VBOX_WS_MAC
784 m_pSettingsLayout2->setContentsMargins(0, 10, 0, 10);
785 m_pSettingsLayout2->setSpacing(10);
786
787#else
788 m_pSettingsLayout2->setContentsMargins(0, qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin),
789 0, qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
790#endif
791 m_pSettingsLayout2->setColumnStretch(0, 0);
792 m_pSettingsLayout2->setColumnStretch(1, 1);
793 m_pSettingsLayout2->setRowStretch(4, 1);
794
795 /* Create profile label: */
796 m_pProfileLabel = new QLabel(pSettingsPane2);
797 if (m_pProfileLabel)
798 {
799 m_pProfileLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
800 m_pSettingsLayout2->addWidget(m_pProfileLabel, 0, 0);
801 }
802 /* Create sub-layout: */
803 QHBoxLayout *pSubLayout = new QHBoxLayout;
804 if (pSubLayout)
805 {
806 pSubLayout->setContentsMargins(0, 0, 0, 0);
807 pSubLayout->setSpacing(1);
808
809 /* Create profile combo-box: */
810 m_pProfileComboBox = new QIComboBox(pSettingsPane2);
811 if (m_pProfileComboBox)
812 {
813 m_pProfileLabel->setBuddy(m_pProfileComboBox);
814 pSubLayout->addWidget(m_pProfileComboBox);
815 }
816 /* Create profile tool-button: */
817 m_pProfileToolButton = new QIToolButton(pSettingsPane2);
818 if (m_pProfileToolButton)
819 {
820 m_pProfileToolButton->setIcon(UIIconPool::iconSet(":/cloud_profile_manager_16px.png",
821 ":/cloud_profile_manager_disabled_16px.png"));
822 pSubLayout->addWidget(m_pProfileToolButton);
823 }
824
825 /* Add into layout: */
826 m_pSettingsLayout2->addLayout(pSubLayout, 0, 1);
827 }
828
829 /* Create profile label: */
830 m_pExportModeLabel = new QLabel(pSettingsPane2);
831 if (m_pExportModeLabel)
832 {
833 m_pExportModeLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
834 m_pSettingsLayout2->addWidget(m_pExportModeLabel, 1, 0);
835 }
836
837 /* Create button-group: */
838 m_pExportModeButtonGroup = new QButtonGroup(pSettingsPane2);
839 if (m_pExportModeButtonGroup)
840 {
841 /* Create Do Not Ask button: */
842 m_exportModeButtons[CloudExportMode_DoNotAsk] = new QRadioButton(pSettingsPane2);
843 if (m_exportModeButtons.value(CloudExportMode_DoNotAsk))
844 {
845 m_pExportModeButtonGroup->addButton(m_exportModeButtons.value(CloudExportMode_DoNotAsk));
846 m_pSettingsLayout2->addWidget(m_exportModeButtons.value(CloudExportMode_DoNotAsk), 1, 1);
847 }
848 /* Create Ask Then Export button: */
849 m_exportModeButtons[CloudExportMode_AskThenExport] = new QRadioButton(pSettingsPane2);
850 if (m_exportModeButtons.value(CloudExportMode_AskThenExport))
851 {
852 m_pExportModeButtonGroup->addButton(m_exportModeButtons.value(CloudExportMode_AskThenExport));
853 m_pSettingsLayout2->addWidget(m_exportModeButtons.value(CloudExportMode_AskThenExport), 2, 1);
854 }
855 /* Create Export Then Ask button: */
856 m_exportModeButtons[CloudExportMode_ExportThenAsk] = new QRadioButton(pSettingsPane2);
857 if (m_exportModeButtons.value(CloudExportMode_ExportThenAsk))
858 {
859 m_pExportModeButtonGroup->addButton(m_exportModeButtons.value(CloudExportMode_ExportThenAsk));
860 m_pSettingsLayout2->addWidget(m_exportModeButtons.value(CloudExportMode_ExportThenAsk), 3, 1);
861 }
862 }
863 }
864
865 /* Add into layout: */
866 m_pSettingsWidget1->addWidget(pSettingsPane2);
867 }
868
869 /* Add into layout: */
870 pMainLayout->addWidget(m_pSettingsWidget1);
871 }
872 }
873
874 /* Setup connections: */
875 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigCloudProfileRegistered,
876 this, &UIWizardExportAppPageFormat::sltHandleFormatComboChange);
877 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigCloudProfileChanged,
878 this, &UIWizardExportAppPageFormat::sltHandleFormatComboChange);
879 connect(m_pFileSelector, &UIEmptyFilePathSelector::pathChanged,
880 this, &UIWizardExportAppPageFormat::sltHandleFileSelectorChange);
881 connect(m_pFormatComboBox, &QIComboBox::currentIndexChanged,
882 this, &UIWizardExportAppPageFormat::sltHandleFormatComboChange);
883 connect(m_pMACComboBox, &QIComboBox::currentIndexChanged,
884 this, &UIWizardExportAppPageFormat::sltHandleMACAddressExportPolicyComboChange);
885 connect(m_pManifestCheckbox, &QCheckBox::stateChanged,
886 this, &UIWizardExportAppPageFormat::sltHandleManifestCheckBoxChange);
887 connect(m_pIncludeISOsCheckbox, &QCheckBox::stateChanged,
888 this, &UIWizardExportAppPageFormat::sltHandleIncludeISOsCheckBoxChange);
889 connect(m_pProfileComboBox, &QIComboBox::currentIndexChanged,
890 this, &UIWizardExportAppPageFormat::sltHandleProfileComboChange);
891 connect(m_pExportModeButtonGroup, &QButtonGroup::buttonToggled,
892 this, &UIWizardExportAppPageFormat::sltHandleRadioButtonToggled);
893 connect(m_pProfileToolButton, &QIToolButton::clicked,
894 this, &UIWizardExportAppPageFormat::sltHandleProfileButtonClick);
895}
896
897UIWizardExportApp *UIWizardExportAppPageFormat::wizard() const
898{
899 return qobject_cast<UIWizardExportApp*>(UINativeWizardPage::wizard());
900}
901
902void UIWizardExportAppPageFormat::retranslateUi()
903{
904 /* Translate page: */
905 setTitle(UIWizardExportApp::tr("Format settings"));
906
907 /* Translate objects: */
908 m_strDefaultApplianceName = UIWizardExportApp::tr("Appliance");
909 refreshFileSelectorName(m_strFileSelectorName, wizard()->machineNames(), m_strDefaultApplianceName, wizard()->isFormatCloudOne());
910 refreshFileSelectorPath(m_pFileSelector, m_strFileSelectorName, m_strFileSelectorExt, wizard()->isFormatCloudOne());
911
912 /* Translate format label: */
913 m_pLabelFormat->setText(UIWizardExportApp::
914 tr("<p>Please choose a format to export the virtual appliance to.</p>"
915 "<p>The <b>Open Virtualization Format</b> supports only <b>ovf</b> or <b>ova</b> extensions. "
916 "If you use the <b>ovf</b> extension, several files will be written separately. "
917 "If you use the <b>ova</b> extension, all the files will be combined into one Open "
918 "Virtualization Format archive.</p>"
919 "<p>The <b>Oracle Cloud Infrastructure</b> format supports exporting to remote cloud servers only. "
920 "Main virtual disk of each selected machine will be uploaded to remote server.</p>"));
921
922 /* Translate settings label: */
923 if (wizard()->isFormatCloudOne())
924 m_pLabelSettings->setText(UIWizardExportApp::
925 tr("Please choose one of cloud service profiles you have registered to export virtual "
926 "machines to. It will be used to establish network connection required to upload your "
927 "virtual machine files to a remote cloud facility."));
928 else
929 m_pLabelSettings->setText(UIWizardExportApp::
930 tr("Please choose a filename to export the virtual appliance to. Besides that you can "
931 "specify a certain amount of options which affects the size and content of resulting "
932 "archive."));
933
934 /* Translate file selector: */
935 m_pFileSelectorLabel->setText(UIWizardExportApp::tr("&File:"));
936 m_pFileSelector->setChooseButtonToolTip(UIWizardExportApp::tr("Choose a file to export the virtual appliance to..."));
937 m_pFileSelector->setFileDialogTitle(UIWizardExportApp::tr("Please choose a file to export the virtual appliance to"));
938
939 /* Translate hardcoded values of Format combo-box: */
940 m_pFormatComboBoxLabel->setText(UIWizardExportApp::tr("F&ormat:"));
941 m_pFormatComboBox->setItemText(0, UIWizardExportApp::tr("Open Virtualization Format 0.9"));
942 m_pFormatComboBox->setItemText(1, UIWizardExportApp::tr("Open Virtualization Format 1.0"));
943 m_pFormatComboBox->setItemText(2, UIWizardExportApp::tr("Open Virtualization Format 2.0"));
944 m_pFormatComboBox->setItemData(0, UIWizardExportApp::tr("Write in legacy OVF 0.9 format for compatibility "
945 "with other virtualization products."), Qt::ToolTipRole);
946 m_pFormatComboBox->setItemData(1, UIWizardExportApp::tr("Write in standard OVF 1.0 format."), Qt::ToolTipRole);
947 m_pFormatComboBox->setItemData(2, UIWizardExportApp::tr("Write in new OVF 2.0 format."), Qt::ToolTipRole);
948 /* Translate received values of Format combo-box.
949 * We are enumerating starting from 0 for simplicity: */
950 for (int i = 0; i < m_pFormatComboBox->count(); ++i)
951 if (isFormatCloudOne(m_pFormatComboBox, i))
952 {
953 m_pFormatComboBox->setItemText(i, m_pFormatComboBox->itemData(i, FormatData_Name).toString());
954 m_pFormatComboBox->setItemData(i, UIWizardExportApp::tr("Export to cloud service provider."), Qt::ToolTipRole);
955 }
956
957 /* Translate MAC address policy combo-box: */
958 m_pMACComboBoxLabel->setText(UIWizardExportApp::tr("MAC Address &Policy:"));
959 for (int i = 0; i < m_pMACComboBox->count(); ++i)
960 {
961 const MACAddressExportPolicy enmPolicy = m_pMACComboBox->itemData(i).value<MACAddressExportPolicy>();
962 switch (enmPolicy)
963 {
964 case MACAddressExportPolicy_KeepAllMACs:
965 {
966 m_pMACComboBox->setItemText(i, UIWizardExportApp::tr("Include all network adapter MAC addresses"));
967 m_pMACComboBox->setItemData(i, UIWizardExportApp::tr("Include all network adapter MAC addresses in exported "
968 "appliance archive."), Qt::ToolTipRole);
969 break;
970 }
971 case MACAddressExportPolicy_StripAllNonNATMACs:
972 {
973 m_pMACComboBox->setItemText(i, UIWizardExportApp::tr("Include only NAT network adapter MAC addresses"));
974 m_pMACComboBox->setItemData(i, UIWizardExportApp::tr("Include only NAT network adapter MAC addresses in exported "
975 "appliance archive."), Qt::ToolTipRole);
976 break;
977 }
978 case MACAddressExportPolicy_StripAllMACs:
979 {
980 m_pMACComboBox->setItemText(i, UIWizardExportApp::tr("Strip all network adapter MAC addresses"));
981 m_pMACComboBox->setItemData(i, UIWizardExportApp::tr("Strip all network adapter MAC addresses from exported "
982 "appliance archive."), Qt::ToolTipRole);
983 break;
984 }
985 default:
986 break;
987 }
988 }
989
990 /* Translate addtional stuff: */
991 m_pAdditionalLabel->setText(UIWizardExportApp::tr("Additionally:"));
992 m_pManifestCheckbox->setToolTip(UIWizardExportApp::tr("Create a Manifest file for automatic data integrity checks on import."));
993 m_pManifestCheckbox->setText(UIWizardExportApp::tr("&Write Manifest file"));
994 m_pIncludeISOsCheckbox->setToolTip(UIWizardExportApp::tr("Include ISO image files into exported VM archive."));
995 m_pIncludeISOsCheckbox->setText(UIWizardExportApp::tr("&Include ISO image files"));
996
997 /* Translate profile stuff: */
998 m_pProfileLabel->setText(UIWizardExportApp::tr("&Profile:"));
999 m_pProfileToolButton->setToolTip(UIWizardExportApp::tr("Open Cloud Profile Manager..."));
1000
1001 /* Translate option label: */
1002 m_pExportModeLabel->setText(UIWizardExportApp::tr("Machine Creation:"));
1003 m_exportModeButtons.value(CloudExportMode_DoNotAsk)->setText(UIWizardExportApp::tr("Do not ask me about it, leave custom &image for future usage"));
1004 m_exportModeButtons.value(CloudExportMode_AskThenExport)->setText(UIWizardExportApp::tr("Ask me about it &before exporting disk as custom image"));
1005 m_exportModeButtons.value(CloudExportMode_ExportThenAsk)->setText(UIWizardExportApp::tr("Ask me about it &after exporting disk as custom image"));
1006
1007 /* Translate file selector's tooltip: */
1008 if (m_pFileSelector)
1009 m_pFileSelector->setToolTip(UIWizardExportApp::tr("Holds the path of the file selected for export."));
1010
1011 /* Adjust label widths: */
1012 QList<QWidget*> labels;
1013 labels << m_pFormatComboBoxLabel;
1014 labels << m_pFileSelectorLabel;
1015 labels << m_pMACComboBoxLabel;
1016 labels << m_pAdditionalLabel;
1017 labels << m_pProfileLabel;
1018 labels << m_pExportModeLabel;
1019 int iMaxWidth = 0;
1020 foreach (QWidget *pLabel, labels)
1021 iMaxWidth = qMax(iMaxWidth, pLabel->minimumSizeHint().width());
1022 m_pFormatLayout->setColumnMinimumWidth(0, iMaxWidth);
1023 m_pSettingsLayout1->setColumnMinimumWidth(0, iMaxWidth);
1024 m_pSettingsLayout2->setColumnMinimumWidth(0, iMaxWidth);
1025
1026 /* Update tool-tips: */
1027 updateFormatComboToolTip(m_pFormatComboBox);
1028 updateMACAddressExportPolicyComboToolTip(m_pMACComboBox);
1029}
1030
1031void UIWizardExportAppPageFormat::initializePage()
1032{
1033 /* Populate formats: */
1034 populateFormats(m_pFormatComboBox, wizard()->notificationCenter(), m_fExportToOCIByDefault);
1035 /* Populate MAC address policies: */
1036 populateMACAddressPolicies(m_pMACComboBox);
1037 /* Translate page: */
1038 retranslateUi();
1039
1040 /* Choose initially focused widget: */
1041 if (wizard()->isFormatCloudOne())
1042 m_pProfileComboBox->setFocus();
1043 else
1044 m_pFileSelector->setFocus();
1045
1046 /* Fetch it, asynchronously: */
1047 QMetaObject::invokeMethod(this, "sltHandleFormatComboChange", Qt::QueuedConnection);
1048}
1049
1050bool UIWizardExportAppPageFormat::isComplete() const
1051{
1052 /* Initial result: */
1053 bool fResult = true;
1054
1055 /* Check whether there was cloud target selected: */
1056 if (wizard()->isFormatCloudOne())
1057 fResult = m_comCloudProfile.isNotNull();
1058 else
1059 fResult = UICommon::hasAllowedExtension(wizard()->path().toLower(), OVFFileExts);
1060
1061 /* Return result: */
1062 return fResult;
1063}
1064
1065bool UIWizardExportAppPageFormat::validatePage()
1066{
1067 /* Initial result: */
1068 bool fResult = true;
1069
1070 /* Check whether there was cloud target selected: */
1071 if (wizard()->isFormatCloudOne())
1072 {
1073 /* Update cloud stuff: */
1074 updateCloudStuff();
1075 /* Which is required to continue to the next page: */
1076 fResult = wizard()->cloudAppliance().isNotNull()
1077 && wizard()->cloudClient().isNotNull()
1078 && wizard()->vsd().isNotNull()
1079 && wizard()->vsdExportForm().isNotNull();
1080 }
1081 else
1082 {
1083 /* Update local stuff: */
1084 updateLocalStuff();
1085 /* Which is required to continue to the next page: */
1086 fResult = wizard()->localAppliance().isNotNull();
1087 }
1088
1089 /* Return result: */
1090 return fResult;
1091}
1092
1093void UIWizardExportAppPageFormat::sltHandleFormatComboChange()
1094{
1095 /* Update combo tool-tip: */
1096 updateFormatComboToolTip(m_pFormatComboBox);
1097
1098 /* Update wizard fields: */
1099 wizard()->setFormat(format(m_pFormatComboBox));
1100 wizard()->setFormatCloudOne(isFormatCloudOne(m_pFormatComboBox));
1101
1102 /* Refresh settings widget state: */
1103 refreshStackedWidget(m_pSettingsWidget1, wizard()->isFormatCloudOne());
1104
1105 /* Update export settings: */
1106 refreshFileSelectorExtension(m_strFileSelectorExt, m_pFileSelector, wizard()->isFormatCloudOne());
1107 refreshFileSelectorPath(m_pFileSelector, m_strFileSelectorName, m_strFileSelectorExt, wizard()->isFormatCloudOne());
1108 refreshManifestCheckBoxAccess(m_pManifestCheckbox, wizard()->isFormatCloudOne());
1109 refreshIncludeISOsCheckBoxAccess(m_pIncludeISOsCheckbox, wizard()->isFormatCloudOne());
1110 refreshProfileCombo(m_pProfileComboBox, wizard()->notificationCenter(), wizard()->format(), wizard()->isFormatCloudOne());
1111 refreshCloudExportMode(m_exportModeButtons, wizard()->isFormatCloudOne());
1112
1113 /* Update profile: */
1114 sltHandleProfileComboChange();
1115
1116 /* Notify about changes: */
1117 emit completeChanged();
1118}
1119
1120void UIWizardExportAppPageFormat::sltHandleFileSelectorChange()
1121{
1122 /* Skip empty paths: */
1123 if (m_pFileSelector->path().isEmpty())
1124 return;
1125
1126 m_strFileSelectorName = QFileInfo(m_pFileSelector->path()).completeBaseName();
1127 wizard()->setPath(m_pFileSelector->path());
1128 emit completeChanged();
1129}
1130
1131void UIWizardExportAppPageFormat::sltHandleMACAddressExportPolicyComboChange()
1132{
1133 updateMACAddressExportPolicyComboToolTip(m_pMACComboBox);
1134 wizard()->setMACAddressExportPolicy(m_pMACComboBox->currentData().value<MACAddressExportPolicy>());
1135 emit completeChanged();
1136}
1137
1138void UIWizardExportAppPageFormat::sltHandleManifestCheckBoxChange()
1139{
1140 wizard()->setManifestSelected(m_pManifestCheckbox->isChecked());
1141 emit completeChanged();
1142}
1143
1144void UIWizardExportAppPageFormat::sltHandleIncludeISOsCheckBoxChange()
1145{
1146 wizard()->setIncludeISOsSelected(m_pIncludeISOsCheckbox->isChecked());
1147 emit completeChanged();
1148}
1149
1150void UIWizardExportAppPageFormat::sltHandleProfileComboChange()
1151{
1152 /* Update wizard fields: */
1153 wizard()->setProfileName(profileName(m_pProfileComboBox));
1154
1155 /* Update export settings: */
1156 refreshCloudProfile(m_comCloudProfile,
1157 wizard()->notificationCenter(),
1158 wizard()->format(),
1159 wizard()->profileName(),
1160 wizard()->isFormatCloudOne());
1161
1162 /* Notify about changes: */
1163 emit completeChanged();
1164}
1165
1166void UIWizardExportAppPageFormat::sltHandleRadioButtonToggled(QAbstractButton *pButton, bool fToggled)
1167{
1168 /* Handle checked buttons only: */
1169 if (!fToggled)
1170 return;
1171
1172 /* Update cloud export mode field value: */
1173 wizard()->setCloudExportMode(m_exportModeButtons.key(pButton));
1174 emit completeChanged();
1175}
1176
1177void UIWizardExportAppPageFormat::sltHandleProfileButtonClick()
1178{
1179 /* Open Cloud Profile Manager: */
1180 if (gpManager)
1181 gpManager->openCloudProfileManager();
1182}
1183
1184void UIWizardExportAppPageFormat::updateLocalStuff()
1185{
1186 /* Create appliance: */
1187 CAppliance comAppliance;
1188 refreshLocalStuff(comAppliance, wizard(), wizard()->machineIDs(), wizard()->uri());
1189 wizard()->setLocalAppliance(comAppliance);
1190}
1191
1192void UIWizardExportAppPageFormat::updateCloudStuff()
1193{
1194 /* Create appliance, client, VSD and VSD export form: */
1195 CAppliance comAppliance;
1196 CCloudClient comClient;
1197 CVirtualSystemDescription comDescription;
1198 CVirtualSystemDescriptionForm comForm;
1199 wizard()->wizardButton(WizardButtonType_Expert)->setEnabled(false);
1200 refreshCloudStuff(comAppliance,
1201 comClient,
1202 comDescription,
1203 comForm,
1204 wizard(),
1205 m_comCloudProfile,
1206 wizard()->machineIDs(),
1207 wizard()->uri(),
1208 wizard()->cloudExportMode());
1209 wizard()->wizardButton(WizardButtonType_Expert)->setEnabled(true);
1210 wizard()->setCloudAppliance(comAppliance);
1211 wizard()->setCloudClient(comClient);
1212 wizard()->setVsd(comDescription);
1213 wizard()->setVsdExportForm(comForm);
1214}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette