VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.cpp@ 104158

Last change on this file since 104158 was 103961, checked in by vboxsync, 10 months ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in wizard class hierarchy.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1/* $Id: UIWizardNewCloudVM.cpp 103961 2024-03-20 14:34:36Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIWizardNewCloudVM 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/* GUI includes: */
29#include "UICommon.h"
30#include "UINotificationCenter.h"
31#include "UIWizardNewCloudVM.h"
32#include "UIWizardNewCloudVMPageSource.h"
33#include "UIWizardNewCloudVMPageProperties.h"
34#include "UIWizardNewCloudVMPageExpert.h"
35
36/* COM includes: */
37#include "CCloudMachine.h"
38
39
40UIWizardNewCloudVM::UIWizardNewCloudVM(QWidget *pParent,
41 const QString &strFullGroupName /* = QString() */)
42 : UINativeWizard(pParent, WizardType_NewCloudVM)
43{
44#ifndef VBOX_WS_MAC
45 /* Assign watermark: */
46 setPixmapName(":/wizard_new_cloud_vm.png");
47#else
48 /* Assign background image: */
49 setPixmapName(":/wizard_new_cloud_vm_bg.png");
50#endif
51
52 /* Parse passed full group name: */
53 const QString strProviderShortName = strFullGroupName.section('/', 1, 1);
54 const QString strProfileName = strFullGroupName.section('/', 2, 2);
55 if (!strProviderShortName.isEmpty() && !strProfileName.isEmpty())
56 {
57 m_strProviderShortName = strProviderShortName;
58 m_strProfileName = strProfileName;
59 }
60}
61
62void UIWizardNewCloudVM::createVSDForm()
63{
64 /* Acquire prepared client and description: */
65 CCloudClient comClient = client();
66 CVirtualSystemDescription comVSD = vsd();
67 AssertReturnVoid(comClient.isNotNull() && comVSD.isNotNull());
68
69 /* Create launch VSD form: */
70 UINotificationProgressLaunchVSDFormCreate *pNotification = new UINotificationProgressLaunchVSDFormCreate(comClient,
71 comVSD,
72 providerShortName(),
73 profileName());
74 connect(pNotification, &UINotificationProgressLaunchVSDFormCreate::sigVSDFormCreated,
75 this, &UIWizardNewCloudVM::setVSDForm);
76 handleNotificationProgressNow(pNotification);
77}
78
79bool UIWizardNewCloudVM::createCloudVM()
80{
81 /* Prepare result: */
82 bool fResult = false;
83
84 /* Acquire prepared client and description: */
85 CCloudClient comClient = client();
86 CVirtualSystemDescription comVSD = vsd();
87 AssertReturn(comClient.isNotNull() && comVSD.isNotNull(), false);
88
89 /* Initiate cloud VM creation procedure: */
90 CCloudMachine comMachine;
91
92 /* Create cloud VM: */
93 UINotificationProgressCloudMachineCreate *pNotification = new UINotificationProgressCloudMachineCreate(comClient,
94 comMachine,
95 comVSD,
96 providerShortName(),
97 profileName());
98 connect(pNotification, &UINotificationProgressCloudMachineCreate::sigCloudMachineCreated,
99 &uiCommon(), &UICommon::sltHandleCloudMachineAdded);
100 gpNotificationCenter->append(pNotification);
101
102 /* Positive: */
103 fResult = true;
104
105 /* Return result: */
106 return fResult;
107}
108
109void UIWizardNewCloudVM::populatePages()
110{
111 /* Create corresponding pages: */
112 switch (mode())
113 {
114 case WizardMode_Basic:
115 {
116 addPage(new UIWizardNewCloudVMPageSource);
117 addPage(new UIWizardNewCloudVMPageProperties);
118 break;
119 }
120 case WizardMode_Expert:
121 {
122 addPage(new UIWizardNewCloudVMPageExpert);
123 break;
124 }
125 default:
126 {
127 AssertMsgFailed(("Invalid mode: %d", mode()));
128 break;
129 }
130 }
131}
132
133void UIWizardNewCloudVM::sltRetranslateUI()
134{
135 /* Call to base-class: */
136 UINativeWizard::sltRetranslateUI();
137
138 /* Translate wizard: */
139 setWindowTitle(tr("Create Cloud Virtual Machine"));
140 /// @todo implement this?
141 //setButtonText(QWizard::FinishButton, tr("Create"));
142}
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