1 | /* $Id: UITaskCloudListMachines.cpp 86609 2020-10-16 14:30:20Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UITaskCloudListMachines class implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /* GUI includes: */
|
---|
19 | #include "UICloudNetworkingStuff.h"
|
---|
20 | #include "UITaskCloudListMachines.h"
|
---|
21 |
|
---|
22 | /* COM includes: */
|
---|
23 | #include "CCloudClient.h"
|
---|
24 |
|
---|
25 |
|
---|
26 | UITaskCloudListMachines::UITaskCloudListMachines(const QString &strProviderShortName,
|
---|
27 | const QString &strProfileName,
|
---|
28 | bool fWithRefresh)
|
---|
29 | : UITask(Type_CloudListMachines)
|
---|
30 | , m_strProviderShortName(strProviderShortName)
|
---|
31 | , m_strProfileName(strProfileName)
|
---|
32 | , m_fWithRefresh(fWithRefresh)
|
---|
33 | {
|
---|
34 | }
|
---|
35 |
|
---|
36 | QVector<CCloudMachine> UITaskCloudListMachines::result() const
|
---|
37 | {
|
---|
38 | m_mutex.lock();
|
---|
39 | const QVector<CCloudMachine> resultVector = m_result;
|
---|
40 | m_mutex.unlock();
|
---|
41 | return resultVector;
|
---|
42 | }
|
---|
43 |
|
---|
44 | QString UITaskCloudListMachines::errorInfo() const
|
---|
45 | {
|
---|
46 | m_mutex.lock();
|
---|
47 | QString strErrorInfo = m_strErrorInfo;
|
---|
48 | m_mutex.unlock();
|
---|
49 | return strErrorInfo;
|
---|
50 | }
|
---|
51 |
|
---|
52 | void UITaskCloudListMachines::run()
|
---|
53 | {
|
---|
54 | m_mutex.lock();
|
---|
55 | CCloudClient comCloudClient = cloudClientByName(m_strProviderShortName, m_strProfileName, m_strErrorInfo);
|
---|
56 | if (m_strErrorInfo.isNull())
|
---|
57 | m_result = m_fWithRefresh
|
---|
58 | ? listCloudMachines(comCloudClient, m_strErrorInfo)
|
---|
59 | : listCloudMachineStubs(comCloudClient, m_strErrorInfo);
|
---|
60 | m_mutex.unlock();
|
---|
61 | }
|
---|