VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVM.cpp

Last change on this file was 103961, checked in by vboxsync, 2 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: 4.0 KB
Line 
1/* $Id: UIWizardAddCloudVM.cpp 103961 2024-03-20 14:34:36Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIWizardAddCloudVM 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 "UIWizardAddCloudVM.h"
32#include "UIWizardAddCloudVMPageExpert.h"
33#include "UIWizardAddCloudVMPageSource.h"
34
35/* COM includes: */
36#include "CCloudMachine.h"
37
38
39UIWizardAddCloudVM::UIWizardAddCloudVM(QWidget *pParent,
40 const QString &strFullGroupName /* = QString() */)
41 : UINativeWizard(pParent, WizardType_AddCloudVM)
42{
43#ifndef VBOX_WS_MAC
44 /* Assign watermark: */
45 setPixmapName(":/wizard_new_cloud_vm.png");
46#else
47 /* Assign background image: */
48 setPixmapName(":/wizard_new_cloud_vm_bg.png");
49#endif
50
51 /* Parse passed full group name: */
52 const QString strProviderShortName = strFullGroupName.section('/', 1, 1);
53 const QString strProfileName = strFullGroupName.section('/', 2, 2);
54 if (!strProviderShortName.isEmpty() && !strProfileName.isEmpty())
55 {
56 m_strProviderShortName = strProviderShortName;
57 m_strProfileName = strProfileName;
58 }
59}
60
61bool UIWizardAddCloudVM::addCloudVMs()
62{
63 /* Prepare result: */
64 bool fResult = false;
65
66 /* Acquire prepared client: */
67 CCloudClient comClient = client();
68 AssertReturn(comClient.isNotNull(), fResult);
69
70 /* For each cloud instance name we have: */
71 foreach (const QString &strInstanceName, instanceIds())
72 {
73 /* Initiate cloud VM add procedure: */
74 CCloudMachine comMachine;
75
76 /* Add cloud VM: */
77 UINotificationProgressCloudMachineAdd *pNotification = new UINotificationProgressCloudMachineAdd(comClient,
78 comMachine,
79 strInstanceName,
80 providerShortName(),
81 profileName());
82 connect(pNotification, &UINotificationProgressCloudMachineAdd::sigCloudMachineAdded,
83 &uiCommon(), &UICommon::sltHandleCloudMachineAdded);
84 gpNotificationCenter->append(pNotification);
85
86 /* Positive: */
87 fResult = true;
88 }
89
90 /* Return result: */
91 return fResult;
92}
93
94void UIWizardAddCloudVM::populatePages()
95{
96 /* Create corresponding pages: */
97 switch (mode())
98 {
99 case WizardMode_Basic:
100 {
101 addPage(new UIWizardAddCloudVMPageSource);
102 break;
103 }
104 case WizardMode_Expert:
105 {
106 addPage(new UIWizardAddCloudVMPageExpert);
107 break;
108 }
109 default:
110 {
111 AssertMsgFailed(("Invalid mode: %d", mode()));
112 break;
113 }
114 }
115}
116
117void UIWizardAddCloudVM::sltRetranslateUI()
118{
119 /* Call to base-class: */
120 UINativeWizard::sltRetranslateUI();
121
122 /* Translate wizard: */
123 setWindowTitle(tr("Add Cloud Virtual Machine"));
124 /// @todo implement this?
125 //setButtonText(QWizard::FinishButton, tr("Add"));
126}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use