1 | /* $Id: UICloudMachineManager.cpp 105152 2024-07-04 18:42:00Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UICloudMachineManager class implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2024 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 |
|
---|
30 | /* GUI includes: */
|
---|
31 | #include "UICloudMachineManager.h"
|
---|
32 |
|
---|
33 | /* COM includes: */
|
---|
34 | #include "CCloudMachine.h"
|
---|
35 |
|
---|
36 | /* Other VBox includes: */
|
---|
37 |
|
---|
38 | /* External includes: */
|
---|
39 |
|
---|
40 |
|
---|
41 | /* static */
|
---|
42 | UICloudMachineManager *UICloudMachineManager::s_pInstance = 0;
|
---|
43 |
|
---|
44 | /* static */
|
---|
45 | void UICloudMachineManager::create()
|
---|
46 | {
|
---|
47 | /* Make sure instance is NOT created yet: */
|
---|
48 | AssertReturnVoid(!s_pInstance);
|
---|
49 |
|
---|
50 | /* Create instance: */
|
---|
51 | new UICloudMachineManager;
|
---|
52 | /* Prepare instance: */
|
---|
53 | s_pInstance->prepare();
|
---|
54 | }
|
---|
55 |
|
---|
56 | /* static */
|
---|
57 | void UICloudMachineManager::destroy()
|
---|
58 | {
|
---|
59 | /* Make sure instance is NOT destroyed yet: */
|
---|
60 | AssertPtrReturnVoid(s_pInstance);
|
---|
61 |
|
---|
62 | s_pInstance->cleanup();
|
---|
63 | /* Destroy instance: */
|
---|
64 | delete s_pInstance;
|
---|
65 | }
|
---|
66 |
|
---|
67 | UICloudMachineManager::UICloudMachineManager()
|
---|
68 | {
|
---|
69 | /* Assign instance: */
|
---|
70 | s_pInstance = this;
|
---|
71 | }
|
---|
72 |
|
---|
73 | UICloudMachineManager::~UICloudMachineManager()
|
---|
74 | {
|
---|
75 | /* Unassign instance: */
|
---|
76 | s_pInstance = 0;
|
---|
77 | }
|
---|
78 |
|
---|
79 | void UICloudMachineManager::prepare()
|
---|
80 | {
|
---|
81 | }
|
---|
82 |
|
---|
83 | void UICloudMachineManager::cleanup()
|
---|
84 | {
|
---|
85 | }
|
---|
86 |
|
---|
87 | void UICloudMachineManager::notifyCloudMachineUnregistered(const QString &strProviderShortName,
|
---|
88 | const QString &strProfileName,
|
---|
89 | const QUuid &uId)
|
---|
90 | {
|
---|
91 | emit sigCloudMachineUnregistered(strProviderShortName, strProfileName, uId);
|
---|
92 | }
|
---|
93 |
|
---|
94 | void UICloudMachineManager::notifyCloudMachineRegistered(const QString &strProviderShortName,
|
---|
95 | const QString &strProfileName,
|
---|
96 | const CCloudMachine &comMachine)
|
---|
97 | {
|
---|
98 | emit sigCloudMachineRegistered(strProviderShortName, strProfileName, comMachine);
|
---|
99 | }
|
---|
100 |
|
---|
101 | void UICloudMachineManager::sltHandleCloudMachineAdded(const QString &strProviderShortName,
|
---|
102 | const QString &strProfileName,
|
---|
103 | const CCloudMachine &comMachine)
|
---|
104 | {
|
---|
105 | /* Make sure we cached added cloud VM in GUI: */
|
---|
106 | notifyCloudMachineRegistered(strProviderShortName,
|
---|
107 | strProfileName,
|
---|
108 | comMachine);
|
---|
109 | }
|
---|