VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/manager/UITaskCloudGetSettingsForm.cpp@ 103977

Last change on this file since 103977 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: UITaskCloudGetSettingsForm.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UITaskCloudGetSettingsForm class implementation.
4 */
5
6/*
7 * Copyright (C) 2020-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 <QWidget>
30
31/* GUI includes: */
32#include "UICommon.h"
33#include "UICloudNetworkingStuff.h"
34#include "UINotificationCenter.h"
35#include "UITaskCloudGetSettingsForm.h"
36#include "UIThreadPool.h"
37
38
39/*********************************************************************************************************************************
40* Class UITaskCloudGetSettingsForm implementation. *
41*********************************************************************************************************************************/
42
43UITaskCloudGetSettingsForm::UITaskCloudGetSettingsForm(const CCloudMachine &comCloudMachine)
44 : UITask(Type_CloudGetSettingsForm)
45 , m_comCloudMachine(comCloudMachine)
46{
47}
48
49CForm UITaskCloudGetSettingsForm::result() const
50{
51 m_mutex.lock();
52 const CForm comResult = m_comResult;
53 m_mutex.unlock();
54 return comResult;
55}
56
57QString UITaskCloudGetSettingsForm::errorInfo() const
58{
59 m_mutex.lock();
60 QString strErrorInfo = m_strErrorInfo;
61 m_mutex.unlock();
62 return strErrorInfo;
63}
64
65void UITaskCloudGetSettingsForm::run()
66{
67 m_mutex.lock();
68 cloudMachineSettingsForm(m_comCloudMachine, m_comResult, m_strErrorInfo);
69 m_mutex.unlock();
70}
71
72
73/*********************************************************************************************************************************
74* Class UIReceiverCloudGetSettingsForm implementation. *
75*********************************************************************************************************************************/
76
77UIReceiverCloudGetSettingsForm::UIReceiverCloudGetSettingsForm(QWidget *pParent)
78 : QObject(pParent)
79 , m_pParent(pParent)
80{
81 /* Connect receiver: */
82 connect(uiCommon().threadPoolCloud(), &UIThreadPool::sigTaskComplete,
83 this, &UIReceiverCloudGetSettingsForm::sltHandleTaskComplete);
84}
85
86void UIReceiverCloudGetSettingsForm::sltHandleTaskComplete(UITask *pTask)
87{
88 /* Skip unrelated tasks: */
89 if (!pTask || pTask->type() != UITask::Type_CloudGetSettingsForm)
90 return;
91
92 /* Cast task to corresponding sub-class: */
93 UITaskCloudGetSettingsForm *pSettingsTask = static_cast<UITaskCloudGetSettingsForm*>(pTask);
94
95 /* Redirect to another listeners: */
96 if (pSettingsTask->errorInfo().isNull())
97 emit sigTaskComplete(pSettingsTask->result());
98 else
99 {
100 UINotificationMessage::cannotAcquireCloudMachineSettings(pSettingsTask->errorInfo());
101 emit sigTaskFailed(pSettingsTask->errorInfo());
102 }
103}
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