VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp@ 103977

Last change on this file since 103977 was 103781, checked in by vboxsync, 9 months ago

FE/Qt: UICommon: Move extension pack related functionality to UIExtension namespace; Rework all listeners to listen for global VBox events (signals) instead of UICommon.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 186.2 KB
Line 
1/* $Id: UINotificationObjects.cpp 103781 2024-03-11 17:23:02Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Various UINotificationObjects implementations.
4 */
5
6/*
7 * Copyright (C) 2021-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 <QDir>
30#include <QFileInfo>
31
32/* GUI includes: */
33#include "UICommon.h"
34#include "UIConverter.h"
35#include "UIErrorString.h"
36#include "UIExtraDataManager.h"
37#include "UIGlobalSession.h"
38#include "UIHostComboEditor.h"
39#include "UINotificationCenter.h"
40#include "UINotificationObjects.h"
41#include "UITranslator.h"
42#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
43# include "UIDownloaderExtensionPack.h"
44# include "UIDownloaderGuestAdditions.h"
45# include "UIDownloaderUserManual.h"
46# include "UINewVersionChecker.h"
47#endif
48
49/* COM includes: */
50#include "CAudioAdapter.h"
51#include "CAudioSettings.h"
52#include "CBooleanFormValue.h"
53#include "CChoiceFormValue.h"
54#include "CCloudNetwork.h"
55#include "CCloudProfile.h"
56#include "CCloudProvider.h"
57#include "CCloudProviderManager.h"
58#include "CConsole.h"
59#include "CDHCPServer.h"
60#include "CDisplay.h"
61#include "CEmulatedUSB.h"
62#include "CExtPack.h"
63#include "CGraphicsAdapter.h"
64#include "CGuestOSType.h"
65#include "CHostNetworkInterface.h"
66#include "CHostOnlyNetwork.h"
67#include "CKeyboard.h"
68#include "CMachineDebugger.h"
69#include "CMediumAttachment.h"
70#include "CMouse.h"
71#include "CNATNetwork.h"
72#include "CNetworkAdapter.h"
73#include "CPlatform.h"
74#include "CPlatformProperties.h"
75#include "CRangedIntegerFormValue.h"
76#include "CRangedInteger64FormValue.h"
77#include "CRecordingSettings.h"
78#include "CStringFormValue.h"
79#include "CStorageController.h"
80#include "CSystemProperties.h"
81#include "CUnattended.h"
82#include "CUpdateAgent.h"
83#include "CVRDEServer.h"
84#include "CVRDEServerInfo.h"
85
86/* Other VBox stuff: */
87#ifdef VBOX_WS_NIX
88# include <iprt/env.h>
89#endif
90
91/* VirtualBox interface declarations: */
92#include <VBox/com/VirtualBox.h>
93
94
95/*********************************************************************************************************************************
96* Class UINotificationMessage implementation. *
97*********************************************************************************************************************************/
98
99/* static */
100QMap<QString, QUuid> UINotificationMessage::m_messages = QMap<QString, QUuid>();
101
102/* static */
103void UINotificationMessage::cannotFindHelpFile(const QString &strLocation)
104{
105 createMessage(
106 QApplication::translate("UIMessageCenter", "Can't find help file ..."),
107 QApplication::translate("UIMessageCenter", "Failed to find the following help file: <b>%1</b>")
108 .arg(strLocation));
109}
110
111/* static */
112void UINotificationMessage::cannotOpenURL(const QString &strUrl)
113{
114 createMessage(
115 QApplication::translate("UIMessageCenter", "Can't open URL ..."),
116 QApplication::translate("UIMessageCenter", "Failed to open <tt>%1</tt>. "
117 "Make sure your desktop environment can properly handle URLs of this type.")
118 .arg(strUrl));
119}
120
121/* static */
122void UINotificationMessage::remindAboutBetaBuild()
123{
124 createMessage(
125 QApplication::translate("UIMessageCenter", "BETA build warning!"),
126 QApplication::translate("UIMessageCenter", "You are running a prerelease version of VirtualBox. "
127 "This version is not suitable for production use."));
128}
129
130/* static */
131void UINotificationMessage::remindAboutExperimentalBuild()
132{
133 createMessage(
134 QApplication::translate("UIMessageCenter", "Experimental build warning!"),
135 QApplication::translate("UIMessageCenter", "You are running an EXPERIMENTAL build of VirtualBox. "
136 "This version is not suitable for production use."));
137}
138
139/* static */
140void UINotificationMessage::warnAboutInvalidEncryptionPassword(const QString &strPasswordId)
141{
142 createMessage(
143 QApplication::translate("UIMessageCenter", "Invalid Password ..."),
144 QApplication::translate("UIMessageCenter", "Encryption password for <nobr>ID = '%1'</nobr> is invalid.")
145 .arg(strPasswordId));
146}
147
148/* static */
149void UINotificationMessage::showClipboardError(QString strId, QString strMsg, long rcError)
150{
151 RT_NOREF(strId, rcError);
152
153 UINotificationMessage::createMessage(
154 QApplication::translate("UIMessageCenter", "Shared Clipboard Error"),
155 QApplication::translate("UIMessageCenter", strMsg.toUtf8().constData()));
156}
157
158#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
159/* static */
160void UINotificationMessage::showUpdateNotFound()
161{
162 createMessage(
163 QApplication::translate("UIMessageCenter", "Nothing to update ..."),
164 QApplication::translate("UIMessageCenter", "You are already running the most recent version of VirtualBox."));
165}
166
167/* static */
168void UINotificationMessage::showUpdateSuccess(const QString &strVersion, const QString &strLink)
169{
170 createMessage(
171 QApplication::translate("UIMessageCenter", "New version found ..."),
172 QApplication::translate("UIMessageCenter", "<p>A new version of VirtualBox has been released! Version <b>%1</b> is available "
173 "at <a href=\"https://www.virtualbox.org/\">virtualbox.org</a>.</p>"
174 "<p>You can download this version using the link:</p>"
175 "<p><a href=%2>%3</a></p>").arg(strVersion, strLink, strLink));
176}
177
178/* static */
179void UINotificationMessage::askUserToDownloadExtensionPack(const QString &strExtPackName,
180 const QString &strExtPackVersion,
181 const QString &strVBoxVersion)
182{
183 createMessage(
184 QApplication::translate("UIMessageCenter", "Update is required ..."),
185 QApplication::translate("UIMessageCenter", "<p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p>"
186 "<p>You should download and install version %3 of this extension pack from "
187 "Oracle!</p>").arg(strExtPackVersion, strExtPackName, strVBoxVersion));
188}
189
190/* static */
191void UINotificationMessage::cannotValidateGuestAdditionsSHA256Sum(const QString &strUrl,
192 const QString &strSrc)
193{
194 createMessage(
195 QApplication::translate("UIMessageCenter", "Unable to validate guest additions image ..."),
196 QApplication::translate("UIMessageCenter", "<p>The <b>VirtualBox Guest Additions</b> disk image file has been "
197 "successfully downloaded from <nobr><a href=\"%1\">%1</a></nobr> and saved "
198 "locally as <nobr><b>%2</b>, </nobr>but the SHA-256 checksum verification "
199 "failed.</p><p>Please do the download, installation and verification "
200 "manually.</p>").arg(strUrl, strSrc));
201}
202
203/* static */
204void UINotificationMessage::warnAboutUserManualDownloaded(const QString &strUrl, const QString &strTarget)
205{
206 createMessage(
207 QApplication::translate("UIMessageCenter", "User manual downloaded ..."),
208 QApplication::translate("UIMessageCenter", "<p>The VirtualBox User Manual has been successfully downloaded from "
209 "<nobr><a href=\"%1\">%1</a></nobr> and saved locally as "
210 "<nobr><b>%2</b>.</nobr></p>").arg(strUrl, strTarget));
211}
212
213/* static */
214void UINotificationMessage::cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName,
215 const QString &strFrom,
216 const QString &strTo)
217{
218 createMessage(
219 QApplication::translate("UIMessageCenter", "Unable to validate extension pack ..."),
220 QApplication::translate("UIMessageCenter", "<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
221 "from <nobr><a href=\"%2\">%2</a></nobr> and saved locally as "
222 "<nobr><b>%3</b>, </nobr>but the SHA-256 checksum verification failed.</p>"
223 "<p>Please do the download, installation and verification manually.</p>")
224 .arg(strExtPackName, strFrom, strTo));
225}
226#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
227
228/* static */
229void UINotificationMessage::cannotCreateMachineFolder(const QString &strPath,
230 UINotificationCenter *pParent /* = 0 */)
231{
232 createMessage(
233 QApplication::translate("UIMessageCenter", "Can't create machine folder ..."),
234 QApplication::translate("UIMessageCenter", "Failed to create machine folder at <nobr><b>%1</b></nobr>.")
235 .arg(strPath),
236 QString(), QString(), pParent);
237}
238
239/* static */
240void UINotificationMessage::cannotOverwriteMachineFolder(const QString &strPath,
241 UINotificationCenter *pParent /* = 0 */)
242{
243 createMessage(
244 QApplication::translate("UIMessageCenter", "Can't overwrite machine folder ..."),
245 QApplication::translate("UIMessageCenter", "Failed to overwrite machine folder at <nobr><b>%1</b></nobr>.")
246 .arg(strPath),
247 QString(), QString(), pParent);
248}
249
250/* static */
251void UINotificationMessage::cannotRemoveMachineFolder(const QString &strPath,
252 UINotificationCenter *pParent /* = 0 */)
253{
254 createMessage(
255 QApplication::translate("UIMessageCenter", "Can't remove machine folder ..."),
256 QApplication::translate("UIMessageCenter", "Failed to remove machine folder at <nobr><b>%1</b></nobr>.")
257 .arg(strPath),
258 QString(), QString(), pParent);
259}
260
261/* static */
262void UINotificationMessage::cannotReregisterExistingMachine(const QString &strName, const QString &strLocation)
263{
264 createMessage(
265 QApplication::translate("UIMessageCenter", "Can't add machine ..."),
266 QApplication::translate("UIMessageCenter", "Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its "
267 "already present.")
268 .arg(strName, strLocation));
269}
270
271/* static */
272void UINotificationMessage::cannotResolveCollisionAutomatically(const QString &strCollisionName, const QString &strGroupName)
273{
274 createMessage(
275 QApplication::translate("UIMessageCenter", "Can't resolve collision ..."),
276 QApplication::translate("UIMessageCenter", "<p>You are trying to move machine <nobr><b>%1</b></nobr> to group "
277 "<nobr><b>%2</b></nobr> which already have another item with the same "
278 "name.</p><p>Please resolve this name conflict and try again.</p>")
279 .arg(strCollisionName, strGroupName));
280}
281
282/* static */
283void UINotificationMessage::cannotAcquireCloudMachineSettings(const QString &strErrorDetails)
284{
285 createMessage(
286 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
287 QApplication::translate("UIMessageCenter", "Failed to acquire cloud machine settings.") +
288 strErrorDetails);
289}
290
291/* static */
292void UINotificationMessage::cannotCreateMediumStorageInFAT(const QString &strPath,
293 UINotificationCenter *pParent /* = 0 */)
294{
295 createMessage(
296 QApplication::translate("UIMessageCenter", "Can't create medium ..."),
297 QApplication::translate("UIMessageCenter", "Failed to create medium storage at <nobr><b>%1</b></nobr>.")
298 .arg(strPath),
299 QString(), QString(), pParent);
300}
301
302/* static */
303void UINotificationMessage::cannotOverwriteMediumStorage(const QString &strPath,
304 UINotificationCenter *pParent /* = 0 */)
305{
306 createMessage(
307 QApplication::translate("UIMessageCenter", "Can't overwrite medium ..."),
308 QApplication::translate("UIMessageCenter", "Failed to overwrite medium storage at <nobr><b>%1</b></nobr>.")
309 .arg(strPath),
310 QString(), QString(), pParent);
311}
312
313/* static */
314void UINotificationMessage::cannotOpenLicenseFile(const QString &strPath)
315{
316 createMessage(
317 QApplication::translate("UIMessageCenter", "Can't open license file ..."),
318 QApplication::translate("UIMessageCenter", "Failed to open the license file <nobr><b>%1</b></nobr>. Check file "
319 "permissions.").arg(strPath));
320}
321
322/* static */
323void UINotificationMessage::warnAboutPublicKeyFilePathIsEmpty()
324{
325 createMessage(
326 QApplication::translate("UIMessageCenter", "Public key missing ..."),
327 QApplication::translate("UIMessageCenter", "Public key file path is empty."));
328}
329
330/* static */
331void UINotificationMessage::warnAboutPublicKeyFileDoesntExist(const QString &strPath)
332{
333 createMessage(
334 QApplication::translate("UIMessageCenter", "Public key missing ..."),
335 QApplication::translate("UIMessageCenter", "Failed to open the public key file <nobr><b>%1</b></nobr>. "
336 "File doesn't exist.").arg(strPath));
337}
338
339/* static */
340void UINotificationMessage::warnAboutPublicKeyFileIsOfTooLargeSize(const QString &strPath)
341{
342 createMessage(
343 QApplication::translate("UIMessageCenter", "Public key too large ..."),
344 QApplication::translate("UIMessageCenter", "Failed to open the public key file <nobr><b>%1</b></nobr>. File is too "
345 "large for the key.").arg(strPath));
346}
347
348/* static */
349void UINotificationMessage::warnAboutPublicKeyFileIsntReadable(const QString &strPath)
350{
351 createMessage(
352 QApplication::translate("UIMessageCenter", "Public key isn't readable ..."),
353 QApplication::translate("UIMessageCenter", "Failed to open the public key file <nobr><b>%1</b></nobr>. Check file "
354 "permissions.").arg(strPath));
355}
356
357/* static */
358void UINotificationMessage::warnAboutDHCPServerIsNotEnabled(const QString &strName)
359{
360 createMessage(
361 QApplication::translate("UIMessageCenter", "DHCP server isn't enabled ..."),
362 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> is set to obtain the address "
363 "automatically but the corresponding DHCP server is not enabled.")
364 .arg(strName));
365}
366
367/* static */
368void UINotificationMessage::warnAboutInvalidIPv4Address(const QString &strName)
369{
370 createMessage(
371 QApplication::translate("UIMessageCenter", "Invalid IPv4 address ..."),
372 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
373 "currently have a valid IPv4 address.")
374 .arg(strName));
375}
376
377/* static */
378void UINotificationMessage::warnAboutInvalidIPv4Mask(const QString &strName)
379{
380 createMessage(
381 QApplication::translate("UIMessageCenter", "Invalid IPv4 mask ..."),
382 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
383 "currently have a valid IPv4 mask.")
384 .arg(strName));
385}
386
387/* static */
388void UINotificationMessage::warnAboutInvalidIPv6Address(const QString &strName)
389{
390 createMessage(
391 QApplication::translate("UIMessageCenter", "Invalid IPv6 address ..."),
392 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
393 "currently have a valid IPv6 address.")
394 .arg(strName));
395}
396
397/* static */
398void UINotificationMessage::warnAboutInvalidIPv6PrefixLength(const QString &strName)
399{
400 createMessage(
401 QApplication::translate("UIMessageCenter", "Invalid IPv6 prefix length ..."),
402 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
403 "currently have a valid IPv6 prefix length.")
404 .arg(strName));
405}
406
407/* static */
408void UINotificationMessage::warnAboutInvalidDHCPServerAddress(const QString &strName)
409{
410 createMessage(
411 QApplication::translate("UIMessageCenter", "Invalid DHCP server address ..."),
412 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
413 "currently have a valid DHCP server address.")
414 .arg(strName));
415}
416
417/* static */
418void UINotificationMessage::warnAboutInvalidDHCPServerMask(const QString &strName)
419{
420 createMessage(
421 QApplication::translate("UIMessageCenter", "Invalid DHCP server mask ..."),
422 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
423 "currently have a valid DHCP server mask.")
424 .arg(strName));
425}
426
427/* static */
428void UINotificationMessage::warnAboutInvalidDHCPServerLowerAddress(const QString &strName)
429{
430 createMessage(
431 QApplication::translate("UIMessageCenter", "Invalid DHCP lower address ..."),
432 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
433 "currently have a valid DHCP server lower address bound.")
434 .arg(strName));
435}
436
437/* static */
438void UINotificationMessage::warnAboutInvalidDHCPServerUpperAddress(const QString &strName)
439{
440 createMessage(
441 QApplication::translate("UIMessageCenter", "Invalid DHCP upper address ..."),
442 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
443 "currently have a valid DHCP server upper address bound.")
444 .arg(strName));
445}
446
447/* static */
448void UINotificationMessage::warnAboutNoNameSpecified(const QString &strName)
449{
450 createMessage(
451 QApplication::translate("UIMessageCenter", "No name specified ..."),
452 QApplication::translate("UIMessageCenter", "No new name specified for the network previously called <b>%1</b>.")
453 .arg(strName));
454}
455
456/* static */
457void UINotificationMessage::warnAboutNameAlreadyBusy(const QString &strName)
458{
459 createMessage(
460 QApplication::translate("UIMessageCenter", "Name already busy ..."),
461 QApplication::translate("UIMessageCenter", "The name <b>%1</b> is being used for several networks.")
462 .arg(strName));
463}
464
465/* static */
466void UINotificationMessage::warnAboutNoIPv4PrefixSpecified(const QString &strName)
467{
468 createMessage(
469 QApplication::translate("UIMessageCenter", "No IPv4 prefix specified ..."),
470 QApplication::translate("UIMessageCenter", "No IPv4 prefix specified for the NAT network <b>%1</b>.")
471 .arg(strName));
472}
473
474/* static */
475void UINotificationMessage::warnAboutNoIPv6PrefixSpecified(const QString &strName)
476{
477 createMessage(
478 QApplication::translate("UIMessageCenter", "No IPv6 prefix specified ..."),
479 QApplication::translate("UIMessageCenter", "No IPv6 prefix specified for the NAT network <b>%1</b>.")
480 .arg(strName));
481}
482
483/* static */
484void UINotificationMessage::cannotMountImage(const QString &strMachineName, const QString &strMediumName)
485{
486 createMessage(
487 QApplication::translate("UIMessageCenter", "Can't mount image ..."),
488 QApplication::translate("UIMessageCenter", "<p>Could not insert the <b>%1</b> disk image file into the virtual machine "
489 "<b>%2</b>, as the machine has no optical drives. Please add a drive using "
490 "the storage page of the virtual machine settings window.</p>")
491 .arg(strMediumName, strMachineName));
492}
493
494/* static */
495void UINotificationMessage::cannotSendACPIToMachine()
496{
497 createMessage(
498 QApplication::translate("UIMessageCenter", "Can't send ACPI shutdown ..."),
499 QApplication::translate("UIMessageCenter", "You are trying to shut down the guest with the ACPI power button. "
500 "This is currently not possible because the guest does not support "
501 "software shutdown."));
502}
503
504/* static */
505void UINotificationMessage::remindAboutAutoCapture()
506{
507 createMessage(
508 QApplication::translate("UIMessageCenter", "Auto capture keyboard ..."),
509 QApplication::translate("UIMessageCenter", "<p>You have the <b>Auto capture keyboard</b> option turned on. "
510 "This will cause the Virtual Machine to automatically <b>capture</b> "
511 "the keyboard every time the VM window is activated and make it "
512 "unavailable to other applications running on your host machine: "
513 "when the keyboard is captured, all keystrokes (including system ones "
514 "like Alt-Tab) will be directed to the VM.</p>"
515 "<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the "
516 "keyboard and mouse (if it is captured) and return them to normal "
517 "operation. The currently assigned host key is shown on the status bar "
518 "at the bottom of the Virtual Machine window. This icon, together "
519 "with the mouse icon placed nearby, indicate the current keyboard "
520 "and mouse capture state.</p>") +
521 QApplication::translate("UIMessageCenter", "<p>The host key is currently defined as <b>%1</b>.</p>",
522 "additional message box paragraph")
523 .arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
524 "remindAboutAutoCapture");
525}
526
527/* static */
528void UINotificationMessage::remindAboutGuestAdditionsAreNotActive()
529{
530 createMessage(
531 QApplication::translate("UIMessageCenter", "Guest additions inactive ..."),
532 QApplication::translate("UIMessageCenter", "<p>The VirtualBox Guest Additions do not appear to be available on this "
533 "virtual machine, and shared folders cannot be used without them. To use "
534 "shared folders inside the virtual machine, please install the Guest "
535 "Additions if they are not installed, or re-install them if they are not "
536 "working correctly, by selecting <b>Insert Guest Additions CD image</b> from "
537 "the <b>Devices</b> menu. If they are installed but the machine is not yet "
538 "fully started then shared folders will be available once it is.</p>"),
539 "remindAboutGuestAdditionsAreNotActive");
540}
541
542/* static */
543void UINotificationMessage::remindAboutMouseIntegration(bool fSupportsAbsolute)
544{
545 if (fSupportsAbsolute)
546 {
547 createMessage(
548 QApplication::translate("UIMessageCenter", "Mouse integration ..."),
549 QApplication::translate("UIMessageCenter", "<p>The Virtual Machine reports that the guest OS supports <b>mouse "
550 "pointer integration</b>. This means that you do not need to "
551 "<i>capture</i> the mouse pointer to be able to use it in your guest "
552 "OS -- all mouse actions you perform when the mouse pointer is over the "
553 "Virtual Machine's display are directly sent to the guest OS. If the "
554 "mouse is currently captured, it will be automatically uncaptured.</p>"
555 "<p>The mouse icon on the status bar will look "
556 "like&nbsp;<img src=:/mouse_seamless_16px.png/>&nbsp;to inform you that "
557 "mouse pointer integration is supported by the guest OS and is currently "
558 "turned on.</p><p><b>Note</b>: Some applications may behave incorrectly "
559 "in mouse pointer integration mode. You can always disable it for the "
560 "current session (and enable it again) by selecting the corresponding "
561 "action from the menu bar.</p>"),
562 "remindAboutMouseIntegration");
563 }
564 else
565 {
566 createMessage(
567 QApplication::translate("UIMessageCenter", "Mouse integration ..."),
568 QApplication::translate("UIMessageCenter", "<p>The Virtual Machine reports that the guest OS does not support "
569 "<b>mouse pointer integration</b> in the current video mode. You need to "
570 "capture the mouse (by clicking over the VM display or pressing the host "
571 "key) in order to use the mouse inside the guest OS.</p>"),
572 "remindAboutMouseIntegration");
573 }
574}
575
576/* static */
577void UINotificationMessage::remindAboutPausedVMInput()
578{
579 createMessage(
580 QApplication::translate("UIMessageCenter", "Paused VM input ..."),
581 QApplication::translate("UIMessageCenter", "<p>The Virtual Machine is currently in the <b>Paused</b> state and not able "
582 "to see any keyboard or mouse input. If you want to continue to work inside "
583 "the VM, you need to resume it by selecting the corresponding action from the "
584 "menu bar.</p>"),
585 "remindAboutPausedVMInput");
586}
587
588/* static */
589void UINotificationMessage::forgetAboutPausedVMInput()
590{
591 destroyMessage("remindAboutPausedVMInput");
592}
593
594/* static */
595void UINotificationMessage::remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP)
596{
597 createMessage(
598 QApplication::translate("UIMessageCenter", "Wrong color depth ..."),
599 QApplication::translate("UIMessageCenter", "<p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. "
600 "For better performance please change this to <b>%2&nbsp;bit</b>. This can "
601 "usually be done from the <b>Display</b> section of the guest operating "
602 "system's Control Panel or System Settings.</p>")
603 .arg(uRealBPP).arg(uWantedBPP),
604 "remindAboutWrongColorDepth");
605}
606
607/* static */
608void UINotificationMessage::forgetAboutWrongColorDepth()
609{
610 destroyMessage("remindAboutWrongColorDepth");
611}
612
613/* static */
614void UINotificationMessage::cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox,
615 UINotificationCenter *pParent /* = 0 */)
616{
617 createMessage(
618 QApplication::translate("UIMessageCenter", "VirtualBox failure ..."),
619 QApplication::translate("UIMessageCenter", "Failed to acquire VirtualBox parameter.") +
620 UIErrorString::formatErrorInfo(comVBox),
621 QString(), QString(), pParent);
622}
623
624/* static */
625void UINotificationMessage::cannotAcquireApplianceParameter(const CAppliance &comAppliance,
626 UINotificationCenter *pParent /* = 0 */)
627{
628 createMessage(
629 QApplication::translate("UIMessageCenter", "Appliance failure ..."),
630 QApplication::translate("UIMessageCenter", "Failed to acquire appliance parameter.") +
631 UIErrorString::formatErrorInfo(comAppliance),
632 QString(), QString(), pParent);
633}
634
635/* static */
636void UINotificationMessage::cannotAcquirePlatformParameter(const CPlatform &comPlatform)
637{
638 createMessage(
639 QApplication::translate("UIMessageCenter", "Platform failure ..."),
640 QApplication::translate("UIMessageCenter", "Failed to acquire platform parameter.") +
641 UIErrorString::formatErrorInfo(comPlatform));
642}
643
644/* static */
645void UINotificationMessage::cannotAcquirePlatformPropertiesParameter(const CPlatformProperties &comProperties)
646{
647 createMessage(
648 QApplication::translate("UIMessageCenter", "Platform properties failure ..."),
649 QApplication::translate("UIMessageCenter", "Failed to acquire platform properties parameter.") +
650 UIErrorString::formatErrorInfo(comProperties));
651}
652
653/* static */
654void UINotificationMessage::cannotAcquireSystemPropertiesParameter(const CSystemProperties &comProperties)
655{
656 createMessage(
657 QApplication::translate("UIMessageCenter", "System properties failure ..."),
658 QApplication::translate("UIMessageCenter", "Failed to acquire system properties parameter.") +
659 UIErrorString::formatErrorInfo(comProperties));
660}
661
662/* static */
663void UINotificationMessage::cannotAcquireExtensionPackManagerParameter(const CExtPackManager &comEPManager)
664{
665 createMessage(
666 QApplication::translate("UIMessageCenter", "Extension Pack failure ..."),
667 QApplication::translate("UIMessageCenter", "Failed to acquire Extension Pack Manager parameter.") +
668 UIErrorString::formatErrorInfo(comEPManager));
669}
670
671/* static */
672void UINotificationMessage::cannotAcquireExtensionPackParameter(const CExtPack &comPackage)
673{
674 createMessage(
675 QApplication::translate("UIMessageCenter", "Extension Pack failure ..."),
676 QApplication::translate("UIMessageCenter", "Failed to acquire Extension Pack parameter.") +
677 UIErrorString::formatErrorInfo(comPackage));
678}
679
680/* static */
681void UINotificationMessage::cannotAcquireHostParameter(const CHost &comHost)
682{
683 createMessage(
684 QApplication::translate("UIMessageCenter", "Host failure ..."),
685 QApplication::translate("UIMessageCenter", "Failed to acquire host parameter.") +
686 UIErrorString::formatErrorInfo(comHost));
687}
688
689/* static */
690void UINotificationMessage::cannotAcquireStorageControllerParameter(const CStorageController &comStorageController)
691{
692 createMessage(
693 QApplication::translate("UIMessageCenter", "Storage controller failure ..."),
694 QApplication::translate("UIMessageCenter", "Failed to acquire storage controller parameter.") +
695 UIErrorString::formatErrorInfo(comStorageController));
696}
697
698/* static */
699void UINotificationMessage::cannotAcquireMediumAttachmentParameter(const CMediumAttachment &comMediumAttachment)
700{
701 createMessage(
702 QApplication::translate("UIMessageCenter", "Medium attachment failure ..."),
703 QApplication::translate("UIMessageCenter", "Failed to acquire medium attachment parameter.") +
704 UIErrorString::formatErrorInfo(comMediumAttachment));
705}
706
707/* static */
708void UINotificationMessage::cannotAcquireMediumParameter(const CMedium &comMedium)
709{
710 createMessage(
711 QApplication::translate("UIMessageCenter", "Medium failure ..."),
712 QApplication::translate("UIMessageCenter", "Failed to acquire medium parameter.") +
713 UIErrorString::formatErrorInfo(comMedium));
714}
715
716/* static */
717void UINotificationMessage::cannotAcquireSessionParameter(const CSession &comSession)
718{
719 createMessage(
720 QApplication::translate("UIMessageCenter", "Session failure ..."),
721 QApplication::translate("UIMessageCenter", "Failed to acquire session parameter.") +
722 UIErrorString::formatErrorInfo(comSession));
723}
724
725/* static */
726void UINotificationMessage::cannotAcquireMachineParameter(const CMachine &comMachine)
727{
728 createMessage(
729 QApplication::translate("UIMessageCenter", "Machine failure ..."),
730 QApplication::translate("UIMessageCenter", "Failed to acquire machine parameter.") +
731 UIErrorString::formatErrorInfo(comMachine));
732}
733
734/* static */
735void UINotificationMessage::cannotAcquireMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger)
736{
737 createMessage(
738 QApplication::translate("UIMessageCenter", "Debugger failure ..."),
739 QApplication::translate("UIMessageCenter", "Failed to acquire machine debugger parameter.") +
740 UIErrorString::formatErrorInfo(comMachineDebugger));
741}
742
743/* static */
744void UINotificationMessage::cannotAcquireGraphicsAdapterParameter(const CGraphicsAdapter &comAdapter)
745{
746 createMessage(
747 QApplication::translate("UIMessageCenter", "Graphics adapter failure ..."),
748 QApplication::translate("UIMessageCenter", "Failed to acquire graphics adapter parameter.") +
749 UIErrorString::formatErrorInfo(comAdapter));
750}
751
752/* static */
753void UINotificationMessage::cannotAcquireAudioSettingsParameter(const CAudioSettings &comSettings)
754{
755 createMessage(
756 QApplication::translate("UIMessageCenter", "Audio settings failure ..."),
757 QApplication::translate("UIMessageCenter", "Failed to acquire audio settings parameter.") +
758 UIErrorString::formatErrorInfo(comSettings));
759}
760
761/* static */
762void UINotificationMessage::cannotAcquireAudioAdapterParameter(const CAudioAdapter &comAdapter)
763{
764 createMessage(
765 QApplication::translate("UIMessageCenter", "Audio adapter failure ..."),
766 QApplication::translate("UIMessageCenter", "Failed to acquire audio adapter parameter.") +
767 UIErrorString::formatErrorInfo(comAdapter));
768}
769
770/* static */
771void UINotificationMessage::cannotAcquireNetworkAdapterParameter(const CNetworkAdapter &comAdapter)
772{
773 createMessage(
774 QApplication::translate("UIMessageCenter", "Network adapter failure ..."),
775 QApplication::translate("UIMessageCenter", "Failed to acquire network adapter parameter.") +
776 UIErrorString::formatErrorInfo(comAdapter));
777}
778
779/* static */
780void UINotificationMessage::cannotAcquireConsoleParameter(const CConsole &comConsole)
781{
782 createMessage(
783 QApplication::translate("UIMessageCenter", "Console failure ..."),
784 QApplication::translate("UIMessageCenter", "Failed to acquire console parameter.") +
785 UIErrorString::formatErrorInfo(comConsole));
786}
787
788/* static */
789void UINotificationMessage::cannotAcquireGuestParameter(const CGuest &comGuest)
790{
791 createMessage(
792 QApplication::translate("UIMessageCenter", "Guest failure ..."),
793 QApplication::translate("UIMessageCenter", "Failed to acquire guest parameter.") +
794 UIErrorString::formatErrorInfo(comGuest));
795}
796
797/* static */
798void UINotificationMessage::cannotAcquireGuestOSTypeParameter(const CGuestOSType &comGuestOSType)
799{
800 createMessage(
801 QApplication::translate("UIMessageCenter", "Guest OS type failure ..."),
802 QApplication::translate("UIMessageCenter", "Failed to acquire guest OS type parameter.") +
803 UIErrorString::formatErrorInfo(comGuestOSType));
804}
805
806/* static */
807void UINotificationMessage::cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot)
808{
809 createMessage(
810 QApplication::translate("UIMessageCenter", "Snapshot failure ..."),
811 QApplication::translate("UIMessageCenter", "Failed to acquire snapshot parameter.") +
812 UIErrorString::formatErrorInfo(comSnapshot));
813}
814
815/* static */
816void UINotificationMessage::cannotAcquireDHCPServerParameter(const CDHCPServer &comServer)
817{
818 createMessage(
819 QApplication::translate("UIMessageCenter", "DHCP server failure ..."),
820 QApplication::translate("UIMessageCenter", "Failed to acquire DHCP server parameter.") +
821 UIErrorString::formatErrorInfo(comServer));
822}
823
824/* static */
825void UINotificationMessage::cannotAcquireCloudNetworkParameter(const CCloudNetwork &comNetwork)
826{
827 createMessage(
828 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
829 QApplication::translate("UIMessageCenter", "Failed to acquire cloud network parameter.") +
830 UIErrorString::formatErrorInfo(comNetwork));
831}
832
833/* static */
834void UINotificationMessage::cannotAcquireHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface)
835{
836 createMessage(
837 QApplication::translate("UIMessageCenter", "Host network interface failure ..."),
838 QApplication::translate("UIMessageCenter", "Failed to acquire host network interface parameter.") +
839 UIErrorString::formatErrorInfo(comInterface));
840}
841
842/* static */
843void UINotificationMessage::cannotAcquireHostOnlyNetworkParameter(const CHostOnlyNetwork &comNetwork)
844{
845 createMessage(
846 QApplication::translate("UIMessageCenter", "Host only network failure ..."),
847 QApplication::translate("UIMessageCenter", "Failed to acquire host only network parameter.") +
848 UIErrorString::formatErrorInfo(comNetwork));
849}
850
851/* static */
852void UINotificationMessage::cannotAcquireNATNetworkParameter(const CNATNetwork &comNetwork)
853{
854 createMessage(
855 QApplication::translate("UIMessageCenter", "NAT network failure ..."),
856 QApplication::translate("UIMessageCenter", "Failed to acquire NAT network parameter.") +
857 UIErrorString::formatErrorInfo(comNetwork));
858}
859
860/* static */
861void UINotificationMessage::cannotAcquireDisplayParameter(const CDisplay &comDisplay)
862{
863 createMessage(
864 QApplication::translate("UIMessageCenter", "Display failure ..."),
865 QApplication::translate("UIMessageCenter", "Failed to acquire display parameter.") +
866 UIErrorString::formatErrorInfo(comDisplay));
867}
868
869/* static */
870void UINotificationMessage::cannotAcquireUpdateAgentParameter(const CUpdateAgent &comAgent)
871{
872 createMessage(
873 QApplication::translate("UIMessageCenter", "Update failure ..."),
874 QApplication::translate("UIMessageCenter", "Failed to acquire update agent parameter.") +
875 UIErrorString::formatErrorInfo(comAgent));
876}
877
878/* static */
879void UINotificationMessage::cannotAcquireMouseParameter(const CMouse &comMouse)
880{
881 createMessage(
882 QApplication::translate("UIMessageCenter", "Mouse failure ..."),
883 QApplication::translate("UIMessageCenter", "Failed to acquire mouse parameter.") +
884 UIErrorString::formatErrorInfo(comMouse));
885}
886
887/* static */
888void UINotificationMessage::cannotAcquireEmulatedUSBParameter(const CEmulatedUSB &comDispatcher)
889{
890 createMessage(
891 QApplication::translate("UIMessageCenter", "Emulated USB failure ..."),
892 QApplication::translate("UIMessageCenter", "Failed to acquire emulated USB parameter.") +
893 UIErrorString::formatErrorInfo(comDispatcher));
894}
895
896/* static */
897void UINotificationMessage::cannotAcquireRecordingSettingsParameter(const CRecordingSettings &comSettings)
898{
899 createMessage(
900 QApplication::translate("UIMessageCenter", "Recording settings failure ..."),
901 QApplication::translate("UIMessageCenter", "Failed to acquire recording settings parameter.") +
902 UIErrorString::formatErrorInfo(comSettings));
903}
904
905/* static */
906void UINotificationMessage::cannotAcquireVRDEServerParameter(const CVRDEServer &comServer)
907{
908 createMessage(
909 QApplication::translate("UIMessageCenter", "VRDE server failure ..."),
910 QApplication::translate("UIMessageCenter", "Failed to acquire VRDE server parameter.") +
911 UIErrorString::formatErrorInfo(comServer));
912}
913
914/* static */
915void UINotificationMessage::cannotAcquireVRDEServerInfoParameter(const CVRDEServerInfo &comServerInfo)
916{
917 createMessage(
918 QApplication::translate("UIMessageCenter", "VRDE server info failure ..."),
919 QApplication::translate("UIMessageCenter", "Failed to acquire VRDE server info parameter.") +
920 UIErrorString::formatErrorInfo(comServerInfo));
921}
922
923/* static */
924void UINotificationMessage::cannotAcquireVirtualSystemDescriptionParameter(const CVirtualSystemDescription &comVsd,
925 UINotificationCenter *pParent /* = 0 */)
926{
927 createMessage(
928 QApplication::translate("UIMessageCenter", "VSD failure ..."),
929 QApplication::translate("UIMessageCenter", "Failed to acquire VSD parameter.") +
930 UIErrorString::formatErrorInfo(comVsd),
931 QString(), QString(), pParent);
932}
933
934/* static */
935void UINotificationMessage::cannotAcquireVirtualSystemDescriptionFormParameter(const CVirtualSystemDescriptionForm &comVsdForm,
936 UINotificationCenter *pParent /* = 0 */)
937{
938 createMessage(
939 QApplication::translate("UIMessageCenter", "VSD form failure ..."),
940 QApplication::translate("UIMessageCenter", "Failed to acquire VSD form parameter.") +
941 UIErrorString::formatErrorInfo(comVsdForm),
942 QString(), QString(), pParent);
943}
944
945/* static */
946void UINotificationMessage::cannotAcquireCloudProviderManagerParameter(const CCloudProviderManager &comCloudProviderManager,
947 UINotificationCenter *pParent /* = 0 */)
948{
949 createMessage(
950 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
951 QApplication::translate("UIMessageCenter", "Failed to acquire cloud provider manager parameter.") +
952 UIErrorString::formatErrorInfo(comCloudProviderManager),
953 QString(), QString(), pParent);
954}
955
956/* static */
957void UINotificationMessage::cannotAcquireCloudProviderParameter(const CCloudProvider &comCloudProvider,
958 UINotificationCenter *pParent /* = 0 */)
959{
960 createMessage(
961 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
962 QApplication::translate("UIMessageCenter", "Failed to acquire cloud provider parameter.") +
963 UIErrorString::formatErrorInfo(comCloudProvider),
964 QString(), QString(), pParent);
965}
966
967/* static */
968void UINotificationMessage::cannotAcquireCloudProfileParameter(const CCloudProfile &comCloudProfile,
969 UINotificationCenter *pParent /* = 0 */)
970{
971 createMessage(
972 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
973 QApplication::translate("UIMessageCenter", "Failed to acquire cloud profile parameter.") +
974 UIErrorString::formatErrorInfo(comCloudProfile),
975 QString(), QString(), pParent);
976}
977
978/* static */
979void UINotificationMessage::cannotAcquireCloudMachineParameter(const CCloudMachine &comCloudMachine,
980 UINotificationCenter *pParent /* = 0 */)
981{
982 createMessage(
983 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
984 QApplication::translate("UIMessageCenter", "Failed to acquire cloud machine parameter.") +
985 UIErrorString::formatErrorInfo(comCloudMachine),
986 QString(), QString(), pParent);
987}
988
989/* static */
990void UINotificationMessage::cannotChangeMediumParameter(const CMedium &comMedium)
991{
992 createMessage(
993 QApplication::translate("UIMessageCenter", "Medium failure ..."),
994 QApplication::translate("UIMessageCenter", "Failed to change the parameter of the medium <b>%1</b>.")
995 .arg(CMedium(comMedium).GetLocation()) +
996 UIErrorString::formatErrorInfo(comMedium));
997}
998
999/* static */
1000void UINotificationMessage::cannotChangeMachineParameter(const CMachine &comMachine)
1001{
1002 createMessage(
1003 QApplication::translate("UIMessageCenter", "Machine failure ..."),
1004 QApplication::translate("UIMessageCenter", "Failed to change the parameter of the virtual machine <b>%1</b>.")
1005 .arg(CMachine(comMachine).GetName()) +
1006 UIErrorString::formatErrorInfo(comMachine));
1007}
1008
1009/* static */
1010void UINotificationMessage::cannotChangeMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger)
1011{
1012 createMessage(
1013 QApplication::translate("UIMessageCenter", "Debugger failure ..."),
1014 QApplication::translate("UIMessageCenter", "Failed to change the parameter of machine debugger.") +
1015 UIErrorString::formatErrorInfo(comMachineDebugger));
1016}
1017
1018/* static */
1019void UINotificationMessage::cannotChangeGraphicsAdapterParameter(const CGraphicsAdapter &comAdapter)
1020{
1021 createMessage(
1022 QApplication::translate("UIMessageCenter", "Graphics adapter failure ..."),
1023 QApplication::translate("UIMessageCenter", "Failed to change graphics adapter parameter.") +
1024 UIErrorString::formatErrorInfo(comAdapter));
1025}
1026
1027/* static */
1028void UINotificationMessage::cannotChangeAudioAdapterParameter(const CAudioAdapter &comAdapter)
1029{
1030 createMessage(
1031 QApplication::translate("UIMessageCenter", "Audio adapter failure ..."),
1032 QApplication::translate("UIMessageCenter", "Failed to change audio adapter parameter.") +
1033 UIErrorString::formatErrorInfo(comAdapter));
1034}
1035
1036/* static */
1037void UINotificationMessage::cannotChangeNetworkAdapterParameter(const CNetworkAdapter &comAdapter)
1038{
1039 createMessage(
1040 QApplication::translate("UIMessageCenter", "Network adapter failure ..."),
1041 QApplication::translate("UIMessageCenter", "Failed to change network adapter parameter.") +
1042 UIErrorString::formatErrorInfo(comAdapter));
1043}
1044
1045/* static */
1046void UINotificationMessage::cannotChangeDHCPServerParameter(const CDHCPServer &comServer)
1047{
1048 createMessage(
1049 QApplication::translate("UIMessageCenter", "DHCP server failure ..."),
1050 QApplication::translate("UIMessageCenter", "Failed to change DHCP server parameter.") +
1051 UIErrorString::formatErrorInfo(comServer));
1052}
1053
1054/* static */
1055void UINotificationMessage::cannotChangeCloudNetworkParameter(const CCloudNetwork &comNetwork)
1056{
1057 createMessage(
1058 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
1059 QApplication::translate("UIMessageCenter", "Failed to change cloud network parameter.") +
1060 UIErrorString::formatErrorInfo(comNetwork));
1061}
1062
1063/* static */
1064void UINotificationMessage::cannotChangeHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface)
1065{
1066 createMessage(
1067 QApplication::translate("UIMessageCenter", "Host network interface failure ..."),
1068 QApplication::translate("UIMessageCenter", "Failed to change host network interface parameter.") +
1069 UIErrorString::formatErrorInfo(comInterface));
1070}
1071
1072/* static */
1073void UINotificationMessage::cannotChangeHostOnlyNetworkParameter(const CHostOnlyNetwork &comNetwork)
1074{
1075 createMessage(
1076 QApplication::translate("UIMessageCenter", "Host only network failure ..."),
1077 QApplication::translate("UIMessageCenter", "Failed to change host only network parameter.") +
1078 UIErrorString::formatErrorInfo(comNetwork));
1079}
1080
1081/* static */
1082void UINotificationMessage::cannotChangeNATNetworkParameter(const CNATNetwork &comNetwork)
1083{
1084 createMessage(
1085 QApplication::translate("UIMessageCenter", "NAT network failure ..."),
1086 QApplication::translate("UIMessageCenter", "Failed to change NAT network parameter.") +
1087 UIErrorString::formatErrorInfo(comNetwork));
1088}
1089
1090/* static */
1091void UINotificationMessage::cannotChangeDisplayParameter(const CDisplay &comDisplay)
1092{
1093 createMessage(
1094 QApplication::translate("UIMessageCenter", "Display failure ..."),
1095 QApplication::translate("UIMessageCenter", "Failed to change display parameter.") +
1096 UIErrorString::formatErrorInfo(comDisplay));
1097}
1098
1099/* static */
1100void UINotificationMessage::cannotChangeCloudProfileParameter(const CCloudProfile &comProfile)
1101{
1102 createMessage(
1103 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
1104 QApplication::translate("UIMessageCenter", "Failed to assign cloud profile parameter.") +
1105 UIErrorString::formatErrorInfo(comProfile));
1106}
1107
1108/* static */
1109void UINotificationMessage::cannotChangeUpdateAgentParameter(const CUpdateAgent &comAgent)
1110{
1111 createMessage(
1112 QApplication::translate("UIMessageCenter", "Update failure ..."),
1113 QApplication::translate("UIMessageCenter", "Failed to assign update agent parameter.") +
1114 UIErrorString::formatErrorInfo(comAgent));
1115}
1116
1117/* static */
1118void UINotificationMessage::cannotChangeKeyboardParameter(const CKeyboard &comKeyboard)
1119{
1120 createMessage(
1121 QApplication::translate("UIMessageCenter", "Keyboard failure ..."),
1122 QApplication::translate("UIMessageCenter", "Failed to assign keyboard parameter.") +
1123 UIErrorString::formatErrorInfo(comKeyboard));
1124}
1125
1126/* static */
1127void UINotificationMessage::cannotChangeMouseParameter(const CMouse &comMouse)
1128{
1129 createMessage(
1130 QApplication::translate("UIMessageCenter", "Mouse failure ..."),
1131 QApplication::translate("UIMessageCenter", "Failed to assign mouse parameter.") +
1132 UIErrorString::formatErrorInfo(comMouse));
1133}
1134
1135/* static */
1136void UINotificationMessage::cannotChangeVirtualSystemDescriptionParameter(const CVirtualSystemDescription &comVsd,
1137 UINotificationCenter *pParent /* = 0 */)
1138{
1139 createMessage(
1140 QApplication::translate("UIMessageCenter", "VSD failure ..."),
1141 QApplication::translate("UIMessageCenter", "Failed to assign VSD parameter.") +
1142 UIErrorString::formatErrorInfo(comVsd),
1143 QString(), QString(), pParent);
1144}
1145
1146/* static */
1147void UINotificationMessage::cannotEnumerateHostUSBDevices(const CHost &comHost)
1148{
1149 /* Refer users to manual's trouble shooting section depending on the host platform: */
1150 QString strHelpKeyword;
1151#if defined(RT_OS_LINUX)
1152 strHelpKeyword = "ts_usb-linux";
1153#elif defined(RT_OS_WINDOWS)
1154 strHelpKeyword = "ts_win-guests";
1155#elif defined(RT_OS_SOLARIS)
1156 strHelpKeyword = "ts_sol-guests";
1157#elif defined(RT_OS_DARWIN)
1158#endif
1159
1160 createMessage(
1161 QApplication::translate("UIMessageCenter", "Can't enumerate USB devices ..."),
1162 QApplication::translate("UIMessageCenter", "Failed to enumerate host USB devices.") +
1163 UIErrorString::formatErrorInfo(comHost),
1164 "cannotEnumerateHostUSBDevices",
1165 strHelpKeyword);
1166}
1167
1168/* static */
1169void UINotificationMessage::cannotOpenMedium(const CVirtualBox &comVBox,
1170 const QString &strLocation,
1171 UINotificationCenter *pParent /* = 0 */)
1172{
1173 createMessage(
1174 QApplication::translate("UIMessageCenter", "Can't open medium ..."),
1175 QApplication::translate("UIMessageCenter", "Failed to open the disk image file <nobr><b>%1</b></nobr>.")
1176 .arg(strLocation) +
1177 UIErrorString::formatErrorInfo(comVBox),
1178 QString(), QString(), pParent);
1179}
1180
1181/* static */
1182void UINotificationMessage::cannotPauseMachine(const CConsole &comConsole)
1183{
1184 createMessage(
1185 QApplication::translate("UIMessageCenter", "Can't pause machine ..."),
1186 QApplication::translate("UIMessageCenter", "Failed to pause the execution of the virtual machine <b>%1</b>.")
1187 .arg(CConsole(comConsole).GetMachine().GetName()) +
1188 UIErrorString::formatErrorInfo(comConsole));
1189}
1190
1191/* static */
1192void UINotificationMessage::cannotResumeMachine(const CConsole &comConsole)
1193{
1194 createMessage(
1195 QApplication::translate("UIMessageCenter", "Can't resume machine ..."),
1196 QApplication::translate("UIMessageCenter", "Failed to resume the execution of the virtual machine <b>%1</b>.")
1197 .arg(CConsole(comConsole).GetMachine().GetName()) +
1198 UIErrorString::formatErrorInfo(comConsole));
1199}
1200
1201/* static */
1202void UINotificationMessage::cannotACPIShutdownMachine(const CConsole &comConsole)
1203{
1204 createMessage(
1205 QApplication::translate("UIMessageCenter", "Can't shutdown machine ..."),
1206 QApplication::translate("UIMessageCenter", "Failed to send the ACPI Power Button press event to the virtual machine "
1207 "<b>%1</b>.").arg(CConsole(comConsole).GetMachine().GetName()) +
1208 UIErrorString::formatErrorInfo(comConsole));
1209}
1210
1211/* static */
1212void UINotificationMessage::cannotResetMachine(const CConsole &comConsole)
1213{
1214 createMessage(
1215 QApplication::translate("UIMessageCenter", "Can't reset machine ..."),
1216 QApplication::translate("UIMessageCenter", "Failed to reset the virtual machine "
1217 "<b>%1</b>.").arg(CConsole(comConsole).GetMachine().GetName()) +
1218 UIErrorString::formatErrorInfo(comConsole));
1219}
1220
1221/* static */
1222void UINotificationMessage::cannotCreateAppliance(const CVirtualBox &comVBox,
1223 UINotificationCenter *pParent /* = 0 */)
1224{
1225 createMessage(
1226 QApplication::translate("UIMessageCenter", "Can't create appliance ..."),
1227 QApplication::translate("UIMessageCenter", "Failed to create appliance.") +
1228 UIErrorString::formatErrorInfo(comVBox),
1229 QString(), QString(), pParent);
1230}
1231
1232/* static */
1233void UINotificationMessage::cannotRegisterMachine(const CVirtualBox &comVBox,
1234 const QString &strName,
1235 UINotificationCenter *pParent /* = 0 */)
1236{
1237 createMessage(
1238 QApplication::translate("UIMessageCenter", "Can't register machine ..."),
1239 QApplication::translate("UIMessageCenter", "Failed to register machine <b>%1</b>.")
1240 .arg(strName) +
1241 UIErrorString::formatErrorInfo(comVBox),
1242 QString(), QString(), pParent);
1243}
1244
1245/* static */
1246void UINotificationMessage::cannotCreateMachine(const CVirtualBox &comVBox,
1247 UINotificationCenter *pParent /* = 0 */)
1248{
1249 createMessage(
1250 QApplication::translate("UIMessageCenter", "Can't create machine ..."),
1251 QApplication::translate("UIMessageCenter", "Failed to create machine.") +
1252 UIErrorString::formatErrorInfo(comVBox),
1253 QString(), QString(), pParent);
1254}
1255
1256/* static */
1257void UINotificationMessage::cannotFindMachineById(const CVirtualBox &comVBox,
1258 const QUuid &uMachineId,
1259 UINotificationCenter *pParent /* = 0 */)
1260{
1261 createMessage(
1262 QApplication::translate("UIMessageCenter", "Can't find machine ..."),
1263 QApplication::translate("UIMessageCenter", "Failed to find the machine with following ID: <nobr><b>%1</b></nobr>.")
1264 .arg(uMachineId.toString()) +
1265 UIErrorString::formatErrorInfo(comVBox),
1266 QString(), QString(), pParent);
1267}
1268
1269/* static */
1270void UINotificationMessage::cannotOpenMachine(const CVirtualBox &comVBox, const QString &strLocation)
1271{
1272 createMessage(
1273 QApplication::translate("UIMessageCenter", "Can't open machine ..."),
1274 QApplication::translate("UIMessageCenter", "Failed to open virtual machine located in %1.")
1275 .arg(strLocation) +
1276 UIErrorString::formatErrorInfo(comVBox));
1277}
1278
1279/* static */
1280void UINotificationMessage::cannotCreateMediumStorage(const CVirtualBox &comVBox,
1281 const QString &strPath,
1282 UINotificationCenter *pParent /* = 0 */)
1283{
1284 createMessage(
1285 QApplication::translate("UIMessageCenter", "Can't create medium storage ..."),
1286 QApplication::translate("UIMessageCenter", "Failed to create medium storage at <nobr><b>%1</b></nobr>.")
1287 .arg(strPath) +
1288 UIErrorString::formatErrorInfo(comVBox),
1289 QString(), QString(), pParent);
1290}
1291
1292/* static */
1293void UINotificationMessage::cannotGetExtensionPackManager(const CVirtualBox &comVBox)
1294{
1295 createMessage(
1296 QApplication::translate("UIMessageCenter", "Can't get Extension Pack Manager ..."),
1297 QApplication::translate("UIMessageCenter", "Failed to acquire Extension Pack Manager.") +
1298 UIErrorString::formatErrorInfo(comVBox));
1299}
1300
1301/* static */
1302void UINotificationMessage::cannotCreateVfsExplorer(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
1303{
1304 createMessage(
1305 QApplication::translate("UIMessageCenter", "Can't create VFS explorer ..."),
1306 QApplication::translate("UIMessageCenter", "Failed to create VFS explorer to check files.") +
1307 UIErrorString::formatErrorInfo(comAppliance),
1308 QString(), QString(), pParent);
1309}
1310
1311/* static */
1312void UINotificationMessage::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
1313{
1314 createMessage(
1315 QApplication::translate("UIMessageCenter", "Bad password ..."),
1316 QApplication::translate("UIMessageCenter", "Bad password or authentication failure.") +
1317 UIErrorString::formatErrorInfo(comAppliance),
1318 QString(), QString(), pParent);
1319}
1320
1321/* static */
1322void UINotificationMessage::cannotInterpretAppliance(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
1323{
1324 createMessage(
1325 QApplication::translate("UIMessageCenter", "Can't interpret appliance ..."),
1326 QApplication::translate("UIMessageCenter", "Failed to interpret appliance being imported.") +
1327 UIErrorString::formatErrorInfo(comAppliance),
1328 QString(), QString(), pParent);
1329}
1330
1331/* static */
1332void UINotificationMessage::cannotCreateVirtualSystemDescription(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
1333{
1334 createMessage(
1335 QApplication::translate("UIMessageCenter", "Can't create VSD ..."),
1336 QApplication::translate("UIMessageCenter", "Failed to create VSD.") +
1337 UIErrorString::formatErrorInfo(comAppliance),
1338 QString(), QString(), pParent);
1339}
1340
1341/* static */
1342void UINotificationMessage::cannotOpenExtPack(const CExtPackManager &comExtPackManager, const QString &strFilename)
1343{
1344 createMessage(
1345 QApplication::translate("UIMessageCenter", "Can't open extension pack ..."),
1346 QApplication::translate("UIMessageCenter", "Failed to open the Extension Pack <b>%1</b>.")
1347 .arg(strFilename) +
1348 UIErrorString::formatErrorInfo(comExtPackManager));
1349}
1350
1351/* static */
1352void UINotificationMessage::cannotReadExtPack(const CExtPackFile &comExtPackFile, const QString &strFilename)
1353{
1354 createMessage(
1355 QApplication::translate("UIMessageCenter", "Can't read extension pack ..."),
1356 QApplication::translate("UIMessageCenter", "Failed to read the Extension Pack <b>%1</b>.")
1357 .arg(strFilename) +
1358 comExtPackFile.GetWhyUnusable());
1359}
1360
1361/* static */
1362void UINotificationMessage::cannotFindCloudNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1363{
1364 createMessage(
1365 QApplication::translate("UIMessageCenter", "Can't find cloud network ..."),
1366 QApplication::translate("UIMessageCenter", "Unable to find the cloud network <b>%1</b>.")
1367 .arg(strNetworkName) +
1368 UIErrorString::formatErrorInfo(comVBox));
1369}
1370
1371/* static */
1372void UINotificationMessage::cannotFindHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName)
1373{
1374 createMessage(
1375 QApplication::translate("UIMessageCenter", "Can't find host network interface ..."),
1376 QApplication::translate("UIMessageCenter", "Unable to find the host network interface <b>%1</b>.")
1377 .arg(strInterfaceName) +
1378 UIErrorString::formatErrorInfo(comHost));
1379}
1380
1381/* static */
1382void UINotificationMessage::cannotFindHostOnlyNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1383{
1384 createMessage(
1385 QApplication::translate("UIMessageCenter", "Can't find host only network ..."),
1386 QApplication::translate("UIMessageCenter", "Unable to find the host only network <b>%1</b>.")
1387 .arg(strNetworkName) +
1388 UIErrorString::formatErrorInfo(comVBox));
1389}
1390
1391/* static */
1392void UINotificationMessage::cannotFindNATNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1393{
1394 createMessage(
1395 QApplication::translate("UIMessageCenter", "Can't find NAT network ..."),
1396 QApplication::translate("UIMessageCenter", "Unable to find the NAT network <b>%1</b>.")
1397 .arg(strNetworkName) +
1398 UIErrorString::formatErrorInfo(comVBox));
1399}
1400
1401/* static */
1402void UINotificationMessage::cannotCreateDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName)
1403{
1404 createMessage(
1405 QApplication::translate("UIMessageCenter", "Can't create DHCP server ..."),
1406 QApplication::translate("UIMessageCenter", "Failed to create a DHCP server for the network interface <b>%1</b>.")
1407 .arg(strInterfaceName) +
1408 UIErrorString::formatErrorInfo(comVBox));
1409}
1410
1411/* static */
1412void UINotificationMessage::cannotRemoveDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName)
1413{
1414 createMessage(
1415 QApplication::translate("UIMessageCenter", "Can't remove DHCP server ..."),
1416 QApplication::translate("UIMessageCenter", "Failed to remove the DHCP server for the network interface <b>%1</b>.")
1417 .arg(strInterfaceName) +
1418 UIErrorString::formatErrorInfo(comVBox));
1419}
1420
1421/* static */
1422void UINotificationMessage::cannotCreateCloudNetwork(const CVirtualBox &comVBox)
1423{
1424 createMessage(
1425 QApplication::translate("UIMessageCenter", "Can't create cloud network ..."),
1426 QApplication::translate("UIMessageCenter", "Failed to create a cloud network.") +
1427 UIErrorString::formatErrorInfo(comVBox));
1428}
1429
1430/* static */
1431void UINotificationMessage::cannotRemoveCloudNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1432{
1433 createMessage(
1434 QApplication::translate("UIMessageCenter", "Can't remove cloud network ..."),
1435 QApplication::translate("UIMessageCenter", "Failed to remove the cloud network <b>%1</b>.")
1436 .arg(strNetworkName) +
1437 UIErrorString::formatErrorInfo(comVBox));
1438}
1439
1440/* static */
1441void UINotificationMessage::cannotCreateHostOnlyNetwork(const CVirtualBox &comVBox)
1442{
1443 createMessage(
1444 QApplication::translate("UIMessageCenter", "Can't create host only network ..."),
1445 QApplication::translate("UIMessageCenter", "Failed to create a host only network.") +
1446 UIErrorString::formatErrorInfo(comVBox));
1447}
1448
1449/* static */
1450void UINotificationMessage::cannotRemoveHostOnlyNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1451{
1452 createMessage(
1453 QApplication::translate("UIMessageCenter", "Can't remove host only network ..."),
1454 QApplication::translate("UIMessageCenter", "Failed to remove the host only network <b>%1</b>.")
1455 .arg(strNetworkName) +
1456 UIErrorString::formatErrorInfo(comVBox));
1457}
1458
1459/* static */
1460void UINotificationMessage::cannotCreateNATNetwork(const CVirtualBox &comVBox)
1461{
1462 createMessage(
1463 QApplication::translate("UIMessageCenter", "Can't create NAT network ..."),
1464 QApplication::translate("UIMessageCenter", "Failed to create a NAT network.") +
1465 UIErrorString::formatErrorInfo(comVBox));
1466}
1467
1468/* static */
1469void UINotificationMessage::cannotRemoveNATNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1470{
1471 createMessage(
1472 QApplication::translate("UIMessageCenter", "Can't remove NAT network ..."),
1473 QApplication::translate("UIMessageCenter", "Failed to remove the NAT network <b>%1</b>.")
1474 .arg(strNetworkName) +
1475 UIErrorString::formatErrorInfo(comVBox));
1476}
1477
1478/* static */
1479void UINotificationMessage::cannotCreateCloudProfile(const CCloudProvider &comProvider)
1480{
1481 createMessage(
1482 QApplication::translate("UIMessageCenter", "Can't create cloud profile ..."),
1483 QApplication::translate("UIMessageCenter", "Failed to create cloud profile.") +
1484 UIErrorString::formatErrorInfo(comProvider));
1485}
1486
1487/* static */
1488void UINotificationMessage::cannotRemoveCloudProfile(const CCloudProfile &comProfile)
1489{
1490 createMessage(
1491 QApplication::translate("UIMessageCenter", "Can't remove cloud profile ..."),
1492 QApplication::translate("UIMessageCenter", "Failed to remove cloud profile.") +
1493 UIErrorString::formatErrorInfo(comProfile));
1494}
1495
1496/* static */
1497void UINotificationMessage::cannotSaveCloudProfiles(const CCloudProvider &comProvider)
1498{
1499 createMessage(
1500 QApplication::translate("UIMessageCenter", "Can't save cloud profiles ..."),
1501 QApplication::translate("UIMessageCenter", "Failed to save cloud profiles.") +
1502 UIErrorString::formatErrorInfo(comProvider));
1503}
1504
1505/* static */
1506void UINotificationMessage::cannotImportCloudProfiles(const CCloudProvider &comProvider)
1507{
1508 createMessage(
1509 QApplication::translate("UIMessageCenter", "Can't import cloud profiles ..."),
1510 QApplication::translate("UIMessageCenter", "Failed to import cloud profiles.") +
1511 UIErrorString::formatErrorInfo(comProvider));
1512}
1513
1514/* static */
1515void UINotificationMessage::cannotRefreshCloudMachine(const CCloudMachine &comMachine)
1516{
1517 createMessage(
1518 QApplication::translate("UIMessageCenter", "Can't refresh cloud machine ..."),
1519 QApplication::translate("UIMessageCenter", "Failed to refresh cloud machine.") +
1520 UIErrorString::formatErrorInfo(comMachine));
1521}
1522
1523/* static */
1524void UINotificationMessage::cannotRefreshCloudMachine(const CProgress &comProgress)
1525{
1526 createMessage(
1527 QApplication::translate("UIMessageCenter", "Can't refresh cloud machine ..."),
1528 QApplication::translate("UIMessageCenter", "Failed to refresh cloud machine.") +
1529 UIErrorString::formatErrorInfo(comProgress));
1530}
1531
1532/* static */
1533void UINotificationMessage::cannotCreateCloudClient(const CCloudProfile &comProfile, UINotificationCenter *pParent /* = 0 */)
1534{
1535 createMessage(
1536 QApplication::translate("UIMessageCenter", "Can't create cloud client ..."),
1537 QApplication::translate("UIMessageCenter", "Failed to create cloud client.") +
1538 UIErrorString::formatErrorInfo(comProfile),
1539 QString(), QString(), pParent);
1540}
1541
1542/* static */
1543void UINotificationMessage::cannotCloseMedium(const CMedium &comMedium)
1544{
1545 /* Show the error: */
1546 createMessage(
1547 QApplication::translate("UIMessageCenter", "Can't close medium ..."),
1548 QApplication::translate("UIMessageCenter", "Failed to close the disk image file <nobr><b>%1</b></nobr>.")
1549 .arg(CMedium(comMedium).GetLocation()) +
1550 UIErrorString::formatErrorInfo(comMedium));
1551}
1552
1553/* static */
1554void UINotificationMessage::cannotDiscardSavedState(const CMachine &comMachine)
1555{
1556 createMessage(
1557 QApplication::translate("UIMessageCenter", "Can't discard saved state ..."),
1558 QApplication::translate("UIMessageCenter", "Failed to discard the saved state of the virtual machine <b>%1</b>.")
1559 .arg(CMachine(comMachine).GetName()) +
1560 UIErrorString::formatErrorInfo(comMachine));
1561}
1562
1563/* static */
1564void UINotificationMessage::cannotRemoveMachine(const CMachine &comMachine, UINotificationCenter *pParent /* = 0 */)
1565{
1566 createMessage(
1567 QApplication::translate("UIMessageCenter", "Can't remove machine ..."),
1568 QApplication::translate("UIMessageCenter", "Failed to remove the virtual machine <b>%1</b>.")
1569 .arg(CMachine(comMachine).GetName()) +
1570 UIErrorString::formatErrorInfo(comMachine),
1571 QString(), QString(), pParent);
1572}
1573
1574/* static */
1575void UINotificationMessage::cannotExportMachine(const CMachine &comMachine, UINotificationCenter *pParent /* = 0 */)
1576{
1577 createMessage(
1578 QApplication::translate("UIMessageCenter", "Can't export machine ..."),
1579 QApplication::translate("UIMessageCenter", "Failed to export virtual machine <b>%1</b>.")
1580 .arg(CMachine(comMachine).GetName()) +
1581 UIErrorString::formatErrorInfo(comMachine),
1582 QString(), QString(), pParent);
1583}
1584
1585/* static */
1586void UINotificationMessage::cannotAttachDevice(const CMachine &comMachine,
1587 UIMediumDeviceType enmType,
1588 const QString &strLocation,
1589 const StorageSlot &storageSlot,
1590 UINotificationCenter *pParent /* = 0 */)
1591{
1592 QString strMessage;
1593 switch (enmType)
1594 {
1595 case UIMediumDeviceType_HardDisk:
1596 {
1597 strMessage = QApplication::translate("UIMessageCenter", "Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to "
1598 "the slot <i>%2</i> of the machine <b>%3</b>.")
1599 .arg(strLocation)
1600 .arg(gpConverter->toString(storageSlot))
1601 .arg(CMachine(comMachine).GetName());
1602 break;
1603 }
1604 case UIMediumDeviceType_DVD:
1605 {
1606 strMessage = QApplication::translate("UIMessageCenter", "Failed to attach the optical drive (<nobr><b>%1</b></nobr>) "
1607 "to the slot <i>%2</i> of the machine <b>%3</b>.")
1608 .arg(strLocation)
1609 .arg(gpConverter->toString(storageSlot))
1610 .arg(CMachine(comMachine).GetName());
1611 break;
1612 }
1613 case UIMediumDeviceType_Floppy:
1614 {
1615 strMessage = QApplication::translate("UIMessageCenter", "Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) "
1616 "to the slot <i>%2</i> of the machine <b>%3</b>.")
1617 .arg(strLocation)
1618 .arg(gpConverter->toString(storageSlot))
1619 .arg(CMachine(comMachine).GetName());
1620 break;
1621 }
1622 default:
1623 break;
1624 }
1625 createMessage(
1626 QApplication::translate("UIMessageCenter", "Can't attach device ..."),
1627 strMessage + UIErrorString::formatErrorInfo(comMachine),
1628 QString(), QString(), pParent);
1629}
1630
1631/* static */
1632void UINotificationMessage::cannotFindSnapshotById(const CMachine &comMachine, const QUuid &uId)
1633{
1634 createMessage(
1635 QApplication::translate("UIMessageCenter", "Can't find snapshot ..."),
1636 QApplication::translate("UIMessageCenter", "Failed to find snapshot with ID=<b>%1</b>.")
1637 .arg(uId.toString()) +
1638 UIErrorString::formatErrorInfo(comMachine));
1639}
1640
1641/* static */
1642void UINotificationMessage::cannotFindSnapshotByName(const CMachine &comMachine,
1643 const QString &strName,
1644 UINotificationCenter *pParent /* = 0 */)
1645{
1646 createMessage(
1647 QApplication::translate("UIMessageCenter", "Can't find snapshot ..."),
1648 QApplication::translate("UIMessageCenter", "Failed to find snapshot with name=<b>%1</b>.")
1649 .arg(strName) +
1650 UIErrorString::formatErrorInfo(comMachine),
1651 QString(), QString(), pParent);
1652}
1653
1654/* static */
1655void UINotificationMessage::cannotChangeSnapshot(const CSnapshot &comSnapshot,
1656 const QString &strSnapshotName,
1657 const QString &strMachineName)
1658{
1659 createMessage(
1660 QApplication::translate("UIMessageCenter", "Can't change snapshot ..."),
1661 QApplication::translate("UIMessageCenter", "Failed to change the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
1662 .arg(strSnapshotName, strMachineName) +
1663 UIErrorString::formatErrorInfo(comSnapshot));
1664}
1665
1666/* static */
1667void UINotificationMessage::cannotRunUnattendedGuestInstall(const CUnattended &comUnattended)
1668{
1669 createMessage(
1670 QApplication::translate("UIMessageCenter", "Can't run guest install ..."),
1671 QApplication::translate("UIMessageCenter", "Failed to run unattended guest installation.") +
1672 UIErrorString::formatErrorInfo(comUnattended));
1673}
1674
1675/* static */
1676void UINotificationMessage::cannotAttachUSBDevice(const CConsole &comConsole, const QString &strDevice)
1677{
1678 createMessage(
1679 QApplication::translate("UIMessageCenter", "Can't attach USB device ..."),
1680 QApplication::translate("UIMessageCenter", "Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
1681 .arg(strDevice, CConsole(comConsole).GetMachine().GetName()) +
1682 UIErrorString::formatErrorInfo(comConsole));
1683}
1684
1685/* static */
1686void UINotificationMessage::cannotAttachUSBDevice(const CVirtualBoxErrorInfo &comErrorInfo,
1687 const QString &strDevice, const QString &strMachineName)
1688{
1689 createMessage(
1690 QApplication::translate("UIMessageCenter", "Can't attach USB device ..."),
1691 QApplication::translate("UIMessageCenter", "Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
1692 .arg(strDevice, strMachineName) +
1693 UIErrorString::formatErrorInfo(comErrorInfo));
1694}
1695
1696/* static */
1697void UINotificationMessage::cannotDetachUSBDevice(const CConsole &comConsole, const QString &strDevice)
1698{
1699 createMessage(
1700 QApplication::translate("UIMessageCenter", "Can't detach USB device ..."),
1701 QApplication::translate("UIMessageCenter", "Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
1702 .arg(strDevice, CConsole(comConsole).GetMachine().GetName()) +
1703 UIErrorString::formatErrorInfo(comConsole));
1704}
1705
1706/* static */
1707void UINotificationMessage::cannotDetachUSBDevice(const CVirtualBoxErrorInfo &comErrorInfo,
1708 const QString &strDevice, const QString &strMachineName)
1709{
1710 createMessage(
1711 QApplication::translate("UIMessageCenter", "Can't detach USB device ..."),
1712 QApplication::translate("UIMessageCenter", "Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
1713 .arg(strDevice, strMachineName) +
1714 UIErrorString::formatErrorInfo(comErrorInfo));
1715}
1716
1717/* static */
1718void UINotificationMessage::cannotAttachWebCam(const CEmulatedUSB &comDispatcher,
1719 const QString &strWebCamName, const QString &strMachineName)
1720{
1721 createMessage(
1722 QApplication::translate("UIMessageCenter", "Can't attach webcam ..."),
1723 QApplication::translate("UIMessageCenter", "Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.")
1724 .arg(strWebCamName, strMachineName) +
1725 UIErrorString::formatErrorInfo(comDispatcher));
1726}
1727
1728/* static */
1729void UINotificationMessage::cannotDetachWebCam(const CEmulatedUSB &comDispatcher,
1730 const QString &strWebCamName, const QString &strMachineName)
1731{
1732 createMessage(
1733 QApplication::translate("UIMessageCenter", "Can't detach webcam ..."),
1734 QApplication::translate("UIMessageCenter", "Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.")
1735 .arg(strWebCamName, strMachineName) +
1736 UIErrorString::formatErrorInfo(comDispatcher));
1737}
1738
1739/* static */
1740void UINotificationMessage::cannotSaveMachineSettings(const CMachine &comMachine, UINotificationCenter *pParent /* = 0 */)
1741{
1742 createMessage(
1743 QApplication::translate("UIMessageCenter", "Can't save machine settings ..."),
1744 QApplication::translate("UIMessageCenter", "Failed to save the settings of the virtual machine <b>%1</b> to "
1745 "<b><nobr>%2</nobr></b>.")
1746 .arg(CMachine(comMachine).GetName(),
1747 CMachine(comMachine).GetSettingsFilePath()) +
1748 UIErrorString::formatErrorInfo(comMachine),
1749 QString(), QString(), pParent);
1750}
1751
1752/* static */
1753void UINotificationMessage::cannotToggleAudioInput(const CAudioAdapter &comAdapter,
1754 const QString &strMachineName, bool fEnable)
1755{
1756 createMessage(
1757 QApplication::translate("UIMessageCenter", "Can't toggle audio input ..."),
1758 ( fEnable
1759 ? QApplication::translate("UIMessageCenter", "Failed to enable the audio adapter input for the virtual machine <b>%1</b>.")
1760 .arg(strMachineName)
1761 : QApplication::translate("UIMessageCenter", "Failed to disable the audio adapter input for the virtual machine <b>%1</b>.")
1762 .arg(strMachineName)) +
1763 UIErrorString::formatErrorInfo(comAdapter));
1764}
1765
1766/* static */
1767void UINotificationMessage::cannotToggleAudioOutput(const CAudioAdapter &comAdapter,
1768 const QString &strMachineName, bool fEnable)
1769{
1770 createMessage(
1771 QApplication::translate("UIMessageCenter", "Can't toggle audio output ..."),
1772 ( fEnable
1773 ? QApplication::translate("UIMessageCenter", "Failed to enable the audio adapter output for the virtual machine <b>%1</b>.")
1774 .arg(strMachineName)
1775 : QApplication::translate("UIMessageCenter", "Failed to disable the audio adapter output for the virtual machine <b>%1</b>.")
1776 .arg(strMachineName)) +
1777 UIErrorString::formatErrorInfo(comAdapter));
1778}
1779
1780/* static */
1781void UINotificationMessage::cannotToggleNetworkCable(const CNetworkAdapter &comAdapter,
1782 const QString &strMachineName, bool fConnect)
1783{
1784 createMessage(
1785 QApplication::translate("UIMessageCenter", "Can't toggle network cable ..."),
1786 ( fConnect
1787 ? QApplication::translate("UIMessageCenter", "Failed to connect the network adapter cable of the virtual machine <b>%1</b>.")
1788 .arg(strMachineName)
1789 : QApplication::translate("UIMessageCenter", "Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.")
1790 .arg(strMachineName)) +
1791 UIErrorString::formatErrorInfo(comAdapter));
1792}
1793
1794/* static */
1795void UINotificationMessage::cannotToggleRecording(const CRecordingSettings &comRecording, const QString &strMachineName, bool fEnable)
1796{
1797 createMessage(
1798 QApplication::translate("UIMessageCenter", "Can't toggle recording ..."),
1799 ( fEnable
1800 ? QApplication::translate("UIMessageCenter", "Failed to enable recording for the virtual machine <b>%1</b>.")
1801 .arg(strMachineName)
1802 : QApplication::translate("UIMessageCenter", "Failed to disable recording for the virtual machine <b>%1</b>.")
1803 .arg(strMachineName)) +
1804 UIErrorString::formatErrorInfo(comRecording));
1805}
1806
1807/* static */
1808void UINotificationMessage::cannotToggleVRDEServer(const CVRDEServer &comServer,
1809 const QString &strMachineName, bool fEnable)
1810{
1811 createMessage(
1812 QApplication::translate("UIMessageCenter", "Can't toggle VRDE server ..."),
1813 ( fEnable
1814 ? QApplication::translate("UIMessageCenter", "Failed to enable the remote desktop server for the virtual machine <b>%1</b>.")
1815 .arg(strMachineName)
1816 : QApplication::translate("UIMessageCenter", "Failed to disable the remote desktop server for the virtual machine <b>%1</b>.")
1817 .arg(strMachineName)) +
1818 UIErrorString::formatErrorInfo(comServer));
1819}
1820
1821UINotificationMessage::UINotificationMessage(const QString &strName,
1822 const QString &strDetails,
1823 const QString &strInternalName,
1824 const QString &strHelpKeyword)
1825 : UINotificationSimple(strName,
1826 strDetails,
1827 strInternalName,
1828 strHelpKeyword)
1829{
1830}
1831
1832UINotificationMessage::~UINotificationMessage()
1833{
1834 /* Remove message from known: */
1835 m_messages.remove(m_strInternalName);
1836}
1837
1838/* static */
1839void UINotificationMessage::createMessage(const QString &strName,
1840 const QString &strDetails,
1841 const QString &strInternalName /* = QString() */,
1842 const QString &strHelpKeyword /* = QString() */,
1843 UINotificationCenter *pParent /* = 0 */)
1844{
1845 /* Check if message suppressed: */
1846 if (isSuppressed(strInternalName))
1847 return;
1848 /* Check if message already exists: */
1849 if ( !strInternalName.isEmpty()
1850 && m_messages.contains(strInternalName))
1851 return;
1852
1853 /* Choose effective parent: */
1854 UINotificationCenter *pEffectiveParent = pParent ? pParent : gpNotificationCenter;
1855
1856 /* Create message finally: */
1857 const QUuid uId = pEffectiveParent->append(new UINotificationMessage(strName,
1858 strDetails,
1859 strInternalName,
1860 strHelpKeyword));
1861 if (!strInternalName.isEmpty())
1862 m_messages[strInternalName] = uId;
1863}
1864
1865/* static */
1866void UINotificationMessage::destroyMessage(const QString &strInternalName,
1867 UINotificationCenter *pParent /* = 0 */)
1868{
1869 /* Check if message really exists: */
1870 if (!m_messages.contains(strInternalName))
1871 return;
1872
1873 /* Choose effective parent: */
1874 UINotificationCenter *pEffectiveParent = pParent ? pParent : gpNotificationCenter;
1875
1876 /* Destroy message finally: */
1877 pEffectiveParent->revoke(m_messages.value(strInternalName));
1878 m_messages.remove(strInternalName);
1879}
1880
1881
1882/*********************************************************************************************************************************
1883* Class UINotificationProgressMediumCreate implementation. *
1884*********************************************************************************************************************************/
1885
1886UINotificationProgressMediumCreate::UINotificationProgressMediumCreate(const CMedium &comTarget,
1887 qulonglong uSize,
1888 const QVector<KMediumVariant> &variants)
1889 : m_comTarget(comTarget)
1890 , m_uSize(uSize)
1891 , m_variants(variants)
1892{
1893 connect(this, &UINotificationProgress::sigProgressFinished,
1894 this, &UINotificationProgressMediumCreate::sltHandleProgressFinished);
1895}
1896
1897QString UINotificationProgressMediumCreate::name() const
1898{
1899 return UINotificationProgress::tr("Creating medium ...");
1900}
1901
1902QString UINotificationProgressMediumCreate::details() const
1903{
1904 return UINotificationProgress::tr("<b>Location:</b> %1<br><b>Size:</b> %2").arg(m_strLocation, UITranslator::formatSize(m_uSize));
1905}
1906
1907CProgress UINotificationProgressMediumCreate::createProgress(COMResult &comResult)
1908{
1909 /* Acquire location: */
1910 m_strLocation = m_comTarget.GetLocation();
1911 if (!m_comTarget.isOk())
1912 {
1913 /* Store COM result: */
1914 comResult = m_comTarget;
1915 /* Return progress-wrapper: */
1916 return CProgress();
1917 }
1918
1919 /* Initialize progress-wrapper: */
1920 CProgress comProgress = m_comTarget.CreateBaseStorage(m_uSize, m_variants);
1921 /* Store COM result: */
1922 comResult = m_comTarget;
1923 /* Return progress-wrapper: */
1924 return comProgress;
1925}
1926
1927void UINotificationProgressMediumCreate::sltHandleProgressFinished()
1928{
1929 if (m_comTarget.isNotNull() && !m_comTarget.GetId().isNull())
1930 emit sigMediumCreated(m_comTarget);
1931}
1932
1933
1934/*********************************************************************************************************************************
1935* Class UINotificationProgressMediumCopy implementation. *
1936*********************************************************************************************************************************/
1937
1938UINotificationProgressMediumCopy::UINotificationProgressMediumCopy(const CMedium &comSource,
1939 const CMedium &comTarget,
1940 const QVector<KMediumVariant> &variants)
1941 : m_comSource(comSource)
1942 , m_comTarget(comTarget)
1943 , m_variants(variants)
1944{
1945 connect(this, &UINotificationProgress::sigProgressFinished,
1946 this, &UINotificationProgressMediumCopy::sltHandleProgressFinished);
1947}
1948
1949QString UINotificationProgressMediumCopy::name() const
1950{
1951 return UINotificationProgress::tr("Copying medium ...");
1952}
1953
1954QString UINotificationProgressMediumCopy::details() const
1955{
1956 return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2").arg(m_strSourceLocation, m_strTargetLocation);
1957}
1958
1959CProgress UINotificationProgressMediumCopy::createProgress(COMResult &comResult)
1960{
1961 /* Acquire locations: */
1962 m_strSourceLocation = m_comSource.GetLocation();
1963 if (!m_comSource.isOk())
1964 {
1965 /* Store COM result: */
1966 comResult = m_comSource;
1967 /* Return progress-wrapper: */
1968 return CProgress();
1969 }
1970 m_strTargetLocation = m_comTarget.GetLocation();
1971 if (!m_comTarget.isOk())
1972 {
1973 /* Store COM result: */
1974 comResult = m_comTarget;
1975 /* Return progress-wrapper: */
1976 return CProgress();
1977 }
1978
1979 /* Initialize progress-wrapper: */
1980 CProgress comProgress = m_comSource.CloneTo(m_comTarget, m_variants, CMedium());
1981 /* Store COM result: */
1982 comResult = m_comSource;
1983 /* Return progress-wrapper: */
1984 return comProgress;
1985}
1986
1987void UINotificationProgressMediumCopy::sltHandleProgressFinished()
1988{
1989 if (m_comTarget.isNotNull() && !m_comTarget.GetId().isNull())
1990 emit sigMediumCopied(m_comTarget);
1991}
1992
1993
1994/*********************************************************************************************************************************
1995* Class UINotificationProgressMediumMove implementation. *
1996*********************************************************************************************************************************/
1997
1998UINotificationProgressMediumMove::UINotificationProgressMediumMove(const CMedium &comMedium,
1999 const QString &strLocation)
2000 : m_comMedium(comMedium)
2001 , m_strTo(strLocation)
2002{
2003}
2004
2005QString UINotificationProgressMediumMove::name() const
2006{
2007 return UINotificationProgress::tr("Moving medium ...");
2008}
2009
2010QString UINotificationProgressMediumMove::details() const
2011{
2012 return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2").arg(m_strFrom, m_strTo);
2013}
2014
2015CProgress UINotificationProgressMediumMove::createProgress(COMResult &comResult)
2016{
2017 /* Acquire location: */
2018 m_strFrom = m_comMedium.GetLocation();
2019 if (!m_comMedium.isOk())
2020 {
2021 /* Store COM result: */
2022 comResult = m_comMedium;
2023 /* Return progress-wrapper: */
2024 return CProgress();
2025 }
2026
2027 /* Initialize progress-wrapper: */
2028 CProgress comProgress = m_comMedium.MoveTo(m_strTo);
2029 /* Store COM result: */
2030 comResult = m_comMedium;
2031 /* Return progress-wrapper: */
2032 return comProgress;
2033}
2034
2035
2036/*********************************************************************************************************************************
2037* Class UINotificationProgressMediumResize implementation. *
2038*********************************************************************************************************************************/
2039
2040UINotificationProgressMediumResize::UINotificationProgressMediumResize(const CMedium &comMedium,
2041 qulonglong uSize)
2042 : m_comMedium(comMedium)
2043 , m_uTo(uSize)
2044{
2045}
2046
2047QString UINotificationProgressMediumResize::name() const
2048{
2049 return UINotificationProgress::tr("Resizing medium ...");
2050}
2051
2052QString UINotificationProgressMediumResize::details() const
2053{
2054 return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2")
2055 .arg(UITranslator::formatSize(m_uFrom),
2056 UITranslator::formatSize(m_uTo));
2057}
2058
2059CProgress UINotificationProgressMediumResize::createProgress(COMResult &comResult)
2060{
2061 /* Acquire size: */
2062 m_uFrom = m_comMedium.GetLogicalSize();
2063 if (!m_comMedium.isOk())
2064 {
2065 /* Store COM result: */
2066 comResult = m_comMedium;
2067 /* Return progress-wrapper: */
2068 return CProgress();
2069 }
2070
2071 /* Initialize progress-wrapper: */
2072 CProgress comProgress = m_comMedium.Resize(m_uTo);
2073 /* Store COM result: */
2074 comResult = m_comMedium;
2075 /* Return progress-wrapper: */
2076 return comProgress;
2077}
2078
2079
2080/*********************************************************************************************************************************
2081* Class UINotificationProgressMediumDeletingStorage implementation. *
2082*********************************************************************************************************************************/
2083
2084UINotificationProgressMediumDeletingStorage::UINotificationProgressMediumDeletingStorage(const CMedium &comMedium)
2085 : m_comMedium(comMedium)
2086{
2087 connect(this, &UINotificationProgress::sigProgressFinished,
2088 this, &UINotificationProgressMediumDeletingStorage::sltHandleProgressFinished);
2089}
2090
2091QString UINotificationProgressMediumDeletingStorage::name() const
2092{
2093 return UINotificationProgress::tr("Deleting medium storage ...");
2094}
2095
2096QString UINotificationProgressMediumDeletingStorage::details() const
2097{
2098 return UINotificationProgress::tr("<b>Location:</b> %1").arg(m_strLocation);
2099}
2100
2101CProgress UINotificationProgressMediumDeletingStorage::createProgress(COMResult &comResult)
2102{
2103 /* Acquire location: */
2104 m_strLocation = m_comMedium.GetLocation();
2105 if (!m_comMedium.isOk())
2106 {
2107 /* Store COM result: */
2108 comResult = m_comMedium;
2109 /* Return progress-wrapper: */
2110 return CProgress();
2111 }
2112
2113 /* Initialize progress-wrapper: */
2114 CProgress comProgress = m_comMedium.DeleteStorage();
2115 /* Store COM result: */
2116 comResult = m_comMedium;
2117 /* Return progress-wrapper: */
2118 return comProgress;
2119}
2120
2121void UINotificationProgressMediumDeletingStorage::sltHandleProgressFinished()
2122{
2123 if (!error().isEmpty())
2124 emit sigMediumStorageDeleted(m_comMedium);
2125}
2126
2127
2128/*********************************************************************************************************************************
2129* Class UINotificationProgressMachineCopy implementation. *
2130*********************************************************************************************************************************/
2131
2132UINotificationProgressMachineCopy::UINotificationProgressMachineCopy(const CMachine &comSource,
2133 const CMachine &comTarget,
2134 const KCloneMode &enmCloneMode,
2135 const QVector<KCloneOptions> &options)
2136 : m_comSource(comSource)
2137 , m_comTarget(comTarget)
2138 , m_enmCloneMode(enmCloneMode)
2139 , m_options(options)
2140{
2141 connect(this, &UINotificationProgress::sigProgressFinished,
2142 this, &UINotificationProgressMachineCopy::sltHandleProgressFinished);
2143}
2144
2145QString UINotificationProgressMachineCopy::name() const
2146{
2147 return UINotificationProgress::tr("Copying machine ...");
2148}
2149
2150QString UINotificationProgressMachineCopy::details() const
2151{
2152 return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2").arg(m_strSourceName, m_strTargetName);
2153}
2154
2155CProgress UINotificationProgressMachineCopy::createProgress(COMResult &comResult)
2156{
2157 /* Acquire names: */
2158 m_strSourceName = m_comSource.GetName();
2159 if (!m_comSource.isOk())
2160 {
2161 /* Store COM result: */
2162 comResult = m_comSource;
2163 /* Return progress-wrapper: */
2164 return CProgress();
2165 }
2166 m_strTargetName = m_comTarget.GetName();
2167 if (!m_comTarget.isOk())
2168 {
2169 /* Store COM result: */
2170 comResult = m_comTarget;
2171 /* Return progress-wrapper: */
2172 return CProgress();
2173 }
2174
2175 /* Initialize progress-wrapper: */
2176 CProgress comProgress = m_comSource.CloneTo(m_comTarget, m_enmCloneMode, m_options);
2177 /* Store COM result: */
2178 comResult = m_comSource;
2179 /* Return progress-wrapper: */
2180 return comProgress;
2181}
2182
2183void UINotificationProgressMachineCopy::sltHandleProgressFinished()
2184{
2185 if (m_comTarget.isNotNull() && !m_comTarget.GetId().isNull())
2186 emit sigMachineCopied(m_comTarget);
2187}
2188
2189
2190/*********************************************************************************************************************************
2191* Class UINotificationProgressMachinePowerUp implementation. *
2192*********************************************************************************************************************************/
2193
2194UINotificationProgressMachinePowerUp::UINotificationProgressMachinePowerUp(const CMachine &comMachine, UILaunchMode enmLaunchMode)
2195 : m_comMachine(comMachine)
2196 , m_enmLaunchMode(enmLaunchMode)
2197{
2198 connect(this, &UINotificationProgress::sigProgressFinished,
2199 this, &UINotificationProgressMachinePowerUp::sltHandleProgressFinished);
2200}
2201
2202QString UINotificationProgressMachinePowerUp::name() const
2203{
2204 return UINotificationProgress::tr("Powering VM up ...");
2205}
2206
2207QString UINotificationProgressMachinePowerUp::details() const
2208{
2209 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
2210}
2211
2212CProgress UINotificationProgressMachinePowerUp::createProgress(COMResult &comResult)
2213{
2214 /* Acquire VM name: */
2215 m_strName = m_comMachine.GetName();
2216 if (!m_comMachine.isOk())
2217 {
2218 comResult = m_comMachine;
2219 return CProgress();
2220 }
2221
2222 /* Open a session thru which we will modify the machine: */
2223 m_comSession.createInstance(CLSID_Session);
2224 if (m_comSession.isNull())
2225 {
2226 comResult = m_comSession;
2227 return CProgress();
2228 }
2229
2230 /* Configure environment: */
2231 QVector<QString> astrEnv;
2232#ifdef VBOX_WS_WIN
2233 /* Allow started VM process to be foreground window: */
2234 AllowSetForegroundWindow(ASFW_ANY);
2235#endif
2236#ifdef VBOX_WS_NIX
2237 /* Make sure VM process will start on the same
2238 * display as the VirtualBox Manager: */
2239 const char *pDisplay = RTEnvGet("DISPLAY");
2240 if (pDisplay)
2241 astrEnv.append(QString("DISPLAY=%1").arg(pDisplay));
2242 const char *pXauth = RTEnvGet("XAUTHORITY");
2243 if (pXauth)
2244 astrEnv.append(QString("XAUTHORITY=%1").arg(pXauth));
2245#endif
2246 QString strType;
2247 switch (m_enmLaunchMode)
2248 {
2249 case UILaunchMode_Default: strType = ""; break;
2250 case UILaunchMode_Separate: strType = "separate"; break;
2251 case UILaunchMode_Headless: strType = "headless"; break;
2252 default: AssertFailedReturn(CProgress());
2253 }
2254
2255 /* Initialize progress-wrapper: */
2256 CProgress comProgress = m_comMachine.LaunchVMProcess(m_comSession, strType, astrEnv);
2257// /* If the VM is started separately and the VM process is already running, then it is OK. */
2258// if (m_enmLaunchMode == UILaunchMode_Separate)
2259// {
2260// const KMachineState enmState = comMachine.GetState();
2261// if ( enmState >= KMachineState_FirstOnline
2262// && enmState <= KMachineState_LastOnline)
2263// {
2264// /* Already running: */
2265// return;
2266// }
2267// }
2268 /* Store COM result: */
2269 comResult = m_comMachine;
2270 /* Return progress-wrapper: */
2271 return comProgress;
2272}
2273
2274void UINotificationProgressMachinePowerUp::sltHandleProgressFinished()
2275{
2276 /* Unlock session finally: */
2277 m_comSession.UnlockMachine();
2278}
2279
2280
2281/*********************************************************************************************************************************
2282* Class UINotificationProgressMachineMove implementation. *
2283*********************************************************************************************************************************/
2284
2285UINotificationProgressMachineMove::UINotificationProgressMachineMove(const QUuid &uId,
2286 const QString &strDestination,
2287 const QString &strType)
2288 : m_uId(uId)
2289 , m_strDestination(QDir::toNativeSeparators(strDestination))
2290 , m_strType(strType)
2291{
2292 connect(this, &UINotificationProgress::sigProgressFinished,
2293 this, &UINotificationProgressMachineMove::sltHandleProgressFinished);
2294}
2295
2296QString UINotificationProgressMachineMove::name() const
2297{
2298 return UINotificationProgress::tr("Moving machine ...");
2299}
2300
2301QString UINotificationProgressMachineMove::details() const
2302{
2303 return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2").arg(m_strSource, m_strDestination);
2304}
2305
2306CProgress UINotificationProgressMachineMove::createProgress(COMResult &comResult)
2307{
2308 /* Open a session thru which we will modify the machine: */
2309 m_comSession = uiCommon().openSession(m_uId, KLockType_Write);
2310 if (m_comSession.isNull())
2311 return CProgress();
2312
2313 /* Get session machine: */
2314 CMachine comMachine = m_comSession.GetMachine();
2315 if (!m_comSession.isOk())
2316 {
2317 comResult = m_comSession;
2318 m_comSession.UnlockMachine();
2319 return CProgress();
2320 }
2321
2322 /* Acquire VM source: */
2323 const QString strSettingFilePath = comMachine.GetSettingsFilePath();
2324 if (!comMachine.isOk())
2325 {
2326 comResult = comMachine;
2327 m_comSession.UnlockMachine();
2328 return CProgress();
2329 }
2330 QDir parentDir = QFileInfo(strSettingFilePath).absoluteDir();
2331 parentDir.cdUp();
2332 m_strSource = QDir::toNativeSeparators(parentDir.absolutePath());
2333
2334 /* Initialize progress-wrapper: */
2335 CProgress comProgress = comMachine.MoveTo(m_strDestination, m_strType);
2336 /* Store COM result: */
2337 comResult = comMachine;
2338 /* Return progress-wrapper: */
2339 return comProgress;
2340}
2341
2342void UINotificationProgressMachineMove::sltHandleProgressFinished()
2343{
2344 /* Unlock session finally: */
2345 m_comSession.UnlockMachine();
2346}
2347
2348
2349/*********************************************************************************************************************************
2350* Class UINotificationProgressMachineSaveState implementation. *
2351*********************************************************************************************************************************/
2352
2353UINotificationProgressMachineSaveState::UINotificationProgressMachineSaveState(const CMachine &comMachine)
2354 : m_comMachine(comMachine)
2355{
2356 connect(this, &UINotificationProgress::sigProgressFinished,
2357 this, &UINotificationProgressMachineSaveState::sltHandleProgressFinished);
2358}
2359
2360QString UINotificationProgressMachineSaveState::name() const
2361{
2362 return UINotificationProgress::tr("Saving VM state ...");
2363}
2364
2365QString UINotificationProgressMachineSaveState::details() const
2366{
2367 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
2368}
2369
2370CProgress UINotificationProgressMachineSaveState::createProgress(COMResult &comResult)
2371{
2372 /* Acquire VM id: */
2373 const QUuid uId = m_comMachine.GetId();
2374 if (!m_comMachine.isOk())
2375 {
2376 comResult = m_comMachine;
2377 return CProgress();
2378 }
2379
2380 /* Acquire VM name: */
2381 m_strName = m_comMachine.GetName();
2382 if (!m_comMachine.isOk())
2383 {
2384 comResult = m_comMachine;
2385 return CProgress();
2386 }
2387
2388 /* Prepare machine to save: */
2389 CMachine comMachine = m_comMachine;
2390
2391 /* For Manager UI: */
2392 switch (uiCommon().uiType())
2393 {
2394 case UIType_ManagerUI:
2395 {
2396 /* Open a session thru which we will modify the machine: */
2397 m_comSession = uiCommon().openExistingSession(uId);
2398 if (m_comSession.isNull())
2399 return CProgress();
2400
2401 /* Get session machine: */
2402 comMachine = m_comSession.GetMachine();
2403 if (!m_comSession.isOk())
2404 {
2405 comResult = m_comSession;
2406 m_comSession.UnlockMachine();
2407 return CProgress();
2408 }
2409
2410 /* Get machine state: */
2411 const KMachineState enmState = comMachine.GetState();
2412 if (!comMachine.isOk())
2413 {
2414 comResult = comMachine;
2415 m_comSession.UnlockMachine();
2416 return CProgress();
2417 }
2418
2419 /* If VM isn't yet paused: */
2420 if (enmState != KMachineState_Paused)
2421 {
2422 /* Get session console: */
2423 CConsole comConsole = m_comSession.GetConsole();
2424 if (!m_comSession.isOk())
2425 {
2426 comResult = m_comSession;
2427 m_comSession.UnlockMachine();
2428 return CProgress();
2429 }
2430
2431 /* Pause VM first: */
2432 comConsole.Pause();
2433 if (!comConsole.isOk())
2434 {
2435 comResult = comConsole;
2436 m_comSession.UnlockMachine();
2437 return CProgress();
2438 }
2439 }
2440
2441 break;
2442 }
2443 default:
2444 break;
2445 }
2446
2447 /* Initialize progress-wrapper: */
2448 CProgress comProgress = comMachine.SaveState();
2449 /* Store COM result: */
2450 comResult = comMachine;
2451 /* Return progress-wrapper: */
2452 return comProgress;
2453}
2454
2455void UINotificationProgressMachineSaveState::sltHandleProgressFinished()
2456{
2457 /* Unlock session finally: */
2458 if (m_comSession.isNotNull())
2459 m_comSession.UnlockMachine();
2460
2461 /* Notifies listeners: */
2462 emit sigMachineStateSaved(error().isEmpty());
2463}
2464
2465
2466/*********************************************************************************************************************************
2467* Class UINotificationProgressMachinePowerOff implementation. *
2468*********************************************************************************************************************************/
2469
2470UINotificationProgressMachinePowerOff::UINotificationProgressMachinePowerOff(const CMachine &comMachine,
2471 const CConsole &comConsole /* = CConsole() */,
2472 bool fIncludingDiscard /* = false */)
2473 : m_comMachine(comMachine)
2474 , m_comConsole(comConsole)
2475 , m_fIncludingDiscard(fIncludingDiscard)
2476{
2477 connect(this, &UINotificationProgress::sigProgressFinished,
2478 this, &UINotificationProgressMachinePowerOff::sltHandleProgressFinished);
2479}
2480
2481QString UINotificationProgressMachinePowerOff::name() const
2482{
2483 return UINotificationProgress::tr("Powering VM off ...");
2484}
2485
2486QString UINotificationProgressMachinePowerOff::details() const
2487{
2488 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
2489}
2490
2491CProgress UINotificationProgressMachinePowerOff::createProgress(COMResult &comResult)
2492{
2493 /* Prepare machine to power off: */
2494 CMachine comMachine = m_comMachine;
2495 /* Prepare console to power off: */
2496 CConsole comConsole = m_comConsole;
2497
2498 /* For Manager UI: */
2499 switch (uiCommon().uiType())
2500 {
2501 case UIType_ManagerUI:
2502 {
2503 /* Acquire VM id: */
2504 const QUuid uId = comMachine.GetId();
2505 if (!comMachine.isOk())
2506 {
2507 comResult = comMachine;
2508 return CProgress();
2509 }
2510
2511 /* Open a session thru which we will modify the machine: */
2512 m_comSession = uiCommon().openExistingSession(uId);
2513 if (m_comSession.isNull())
2514 return CProgress();
2515
2516 /* Get session machine: */
2517 comMachine = m_comSession.GetMachine();
2518 if (!m_comSession.isOk())
2519 {
2520 comResult = m_comSession;
2521 m_comSession.UnlockMachine();
2522 return CProgress();
2523 }
2524
2525 /* Get session console: */
2526 comConsole = m_comSession.GetConsole();
2527 if (!m_comSession.isOk())
2528 {
2529 comResult = m_comSession;
2530 m_comSession.UnlockMachine();
2531 return CProgress();
2532 }
2533
2534 break;
2535 }
2536 default:
2537 break;
2538 }
2539
2540 /* Initialize progress-wrapper: */
2541 CProgress comProgress = comConsole.PowerDown();
2542
2543 /* For Runtime UI: */
2544 switch (uiCommon().uiType())
2545 {
2546 case UIType_RuntimeUI:
2547 {
2548 /* Check the console state, it might be already gone: */
2549 if (!comConsole.isNull())
2550 {
2551 /* This can happen if VBoxSVC is not running: */
2552 COMResult res(comConsole);
2553 if (FAILED_DEAD_INTERFACE(res.rc()))
2554 return CProgress();
2555 }
2556
2557 break;
2558 }
2559 default:
2560 break;
2561 }
2562
2563 /* Store COM result: */
2564 comResult = comConsole;
2565
2566 /* Acquire VM name, no error checks, too late: */
2567 m_strName = comMachine.GetName();
2568
2569 /* Return progress-wrapper: */
2570 return comProgress;
2571}
2572
2573void UINotificationProgressMachinePowerOff::sltHandleProgressFinished()
2574{
2575 /* Unlock session finally: */
2576 if (m_comSession.isNotNull())
2577 m_comSession.UnlockMachine();
2578
2579 /* Notifies listeners: */
2580 emit sigMachinePoweredOff(error().isEmpty(), m_fIncludingDiscard);
2581}
2582
2583
2584/*********************************************************************************************************************************
2585* Class UINotificationProgressMachineMediaRemove implementation. *
2586*********************************************************************************************************************************/
2587
2588UINotificationProgressMachineMediaRemove::UINotificationProgressMachineMediaRemove(const CMachine &comMachine,
2589 const CMediumVector &media)
2590 : m_comMachine(comMachine)
2591 , m_media(media)
2592{
2593}
2594
2595QString UINotificationProgressMachineMediaRemove::name() const
2596{
2597 return UINotificationProgress::tr("Removing machine media ...");
2598}
2599
2600QString UINotificationProgressMachineMediaRemove::details() const
2601{
2602 return UINotificationProgress::tr("<b>Machine Name:</b> %1").arg(m_strName);
2603}
2604
2605CProgress UINotificationProgressMachineMediaRemove::createProgress(COMResult &comResult)
2606{
2607 /* Acquire names: */
2608 m_strName = m_comMachine.GetName();
2609 if (!m_comMachine.isOk())
2610 {
2611 /* Store COM result: */
2612 comResult = m_comMachine;
2613 /* Return progress-wrapper: */
2614 return CProgress();
2615 }
2616
2617 /* Initialize progress-wrapper: */
2618 CProgress comProgress = m_comMachine.DeleteConfig(m_media);
2619 /* Store COM result: */
2620 comResult = m_comMachine;
2621 /* Return progress-wrapper: */
2622 return comProgress;
2623}
2624
2625
2626/*********************************************************************************************************************************
2627* Class UINotificationProgressVFSExplorerUpdate implementation. *
2628*********************************************************************************************************************************/
2629
2630UINotificationProgressVFSExplorerUpdate::UINotificationProgressVFSExplorerUpdate(const CVFSExplorer &comExplorer)
2631 : m_comExplorer(comExplorer)
2632{
2633}
2634
2635QString UINotificationProgressVFSExplorerUpdate::name() const
2636{
2637 return UINotificationProgress::tr("Updating VFS explorer ...");
2638}
2639
2640QString UINotificationProgressVFSExplorerUpdate::details() const
2641{
2642 return UINotificationProgress::tr("<b>Path:</b> %1").arg(m_strPath);
2643}
2644
2645CProgress UINotificationProgressVFSExplorerUpdate::createProgress(COMResult &comResult)
2646{
2647 /* Acquire path: */
2648 m_strPath = m_comExplorer.GetPath();
2649 if (!m_comExplorer.isOk())
2650 {
2651 /* Store COM result: */
2652 comResult = m_comExplorer;
2653 /* Return progress-wrapper: */
2654 return CProgress();
2655 }
2656
2657 /* Initialize progress-wrapper: */
2658 CProgress comProgress = m_comExplorer.Update();
2659 /* Store COM result: */
2660 comResult = m_comExplorer;
2661 /* Return progress-wrapper: */
2662 return comProgress;
2663}
2664
2665
2666/*********************************************************************************************************************************
2667* Class UINotificationProgressVFSExplorerFilesRemove implementation. *
2668*********************************************************************************************************************************/
2669
2670UINotificationProgressVFSExplorerFilesRemove::UINotificationProgressVFSExplorerFilesRemove(const CVFSExplorer &comExplorer,
2671 const QVector<QString> &files)
2672 : m_comExplorer(comExplorer)
2673 , m_files(files)
2674{
2675}
2676
2677QString UINotificationProgressVFSExplorerFilesRemove::name() const
2678{
2679 return UINotificationProgress::tr("Removing VFS explorer files ...");
2680}
2681
2682QString UINotificationProgressVFSExplorerFilesRemove::details() const
2683{
2684 return UINotificationProgress::tr("<b>Path:</b> %1<br><b>Files:</b> %2")
2685 .arg(m_strPath)
2686 .arg(QStringList(m_files.toList()).join(", "));
2687}
2688
2689CProgress UINotificationProgressVFSExplorerFilesRemove::createProgress(COMResult &comResult)
2690{
2691 /* Acquire path: */
2692 m_strPath = m_comExplorer.GetPath();
2693 if (!m_comExplorer.isOk())
2694 {
2695 /* Store COM result: */
2696 comResult = m_comExplorer;
2697 /* Return progress-wrapper: */
2698 return CProgress();
2699 }
2700
2701 /* Initialize progress-wrapper: */
2702 CProgress comProgress = m_comExplorer.Remove(m_files);
2703 /* Store COM result: */
2704 comResult = m_comExplorer;
2705 /* Return progress-wrapper: */
2706 return comProgress;
2707}
2708
2709
2710/*********************************************************************************************************************************
2711* Class UINotificationProgressSubnetSelectionVSDFormCreate implementation. *
2712*********************************************************************************************************************************/
2713
2714UINotificationProgressSubnetSelectionVSDFormCreate::UINotificationProgressSubnetSelectionVSDFormCreate(const CCloudClient &comClient,
2715 const CVirtualSystemDescription &comVSD,
2716 const QString &strProviderShortName,
2717 const QString &strProfileName)
2718 : m_comClient(comClient)
2719 , m_comVSD(comVSD)
2720 , m_strProviderShortName(strProviderShortName)
2721 , m_strProfileName(strProfileName)
2722{
2723 connect(this, &UINotificationProgress::sigProgressFinished,
2724 this, &UINotificationProgressSubnetSelectionVSDFormCreate::sltHandleProgressFinished);
2725}
2726
2727QString UINotificationProgressSubnetSelectionVSDFormCreate::name() const
2728{
2729 return UINotificationProgress::tr("Creating subnet selection VSD form ...");
2730}
2731
2732QString UINotificationProgressSubnetSelectionVSDFormCreate::details() const
2733{
2734 return UINotificationProgress::tr("<b>Provider:</b> %1<br><b>Profile:</b> %2")
2735 .arg(m_strProviderShortName, m_strProfileName);
2736}
2737
2738CProgress UINotificationProgressSubnetSelectionVSDFormCreate::createProgress(COMResult &comResult)
2739{
2740 /* Initialize progress-wrapper: */
2741 CProgress comProgress = m_comClient.GetSubnetSelectionForm(m_comVSD, m_comVSDForm);
2742 /* Store COM result: */
2743 comResult = m_comClient;
2744 /* Return progress-wrapper: */
2745 return comProgress;
2746}
2747
2748void UINotificationProgressSubnetSelectionVSDFormCreate::sltHandleProgressFinished()
2749{
2750 if (m_comVSDForm.isNotNull())
2751 emit sigVSDFormCreated(m_comVSDForm);
2752}
2753
2754
2755/*********************************************************************************************************************************
2756* Class UINotificationProgressLaunchVSDFormCreate implementation. *
2757*********************************************************************************************************************************/
2758
2759UINotificationProgressLaunchVSDFormCreate::UINotificationProgressLaunchVSDFormCreate(const CCloudClient &comClient,
2760 const CVirtualSystemDescription &comVSD,
2761 const QString &strProviderShortName,
2762 const QString &strProfileName)
2763 : m_comClient(comClient)
2764 , m_comVSD(comVSD)
2765 , m_strProviderShortName(strProviderShortName)
2766 , m_strProfileName(strProfileName)
2767{
2768 connect(this, &UINotificationProgress::sigProgressFinished,
2769 this, &UINotificationProgressLaunchVSDFormCreate::sltHandleProgressFinished);
2770}
2771
2772QString UINotificationProgressLaunchVSDFormCreate::name() const
2773{
2774 return UINotificationProgress::tr("Creating launch VSD form ...");
2775}
2776
2777QString UINotificationProgressLaunchVSDFormCreate::details() const
2778{
2779 return UINotificationProgress::tr("<b>Provider:</b> %1<br><b>Profile:</b> %2")
2780 .arg(m_strProviderShortName, m_strProfileName);
2781}
2782
2783CProgress UINotificationProgressLaunchVSDFormCreate::createProgress(COMResult &comResult)
2784{
2785 /* Initialize progress-wrapper: */
2786 CProgress comProgress = m_comClient.GetLaunchDescriptionForm(m_comVSD, m_comVSDForm);
2787 /* Store COM result: */
2788 comResult = m_comClient;
2789 /* Return progress-wrapper: */
2790 return comProgress;
2791}
2792
2793void UINotificationProgressLaunchVSDFormCreate::sltHandleProgressFinished()
2794{
2795 if (m_comVSDForm.isNotNull())
2796 emit sigVSDFormCreated(m_comVSDForm);
2797}
2798
2799
2800/*********************************************************************************************************************************
2801* Class UINotificationProgressExportVSDFormCreate implementation. *
2802*********************************************************************************************************************************/
2803
2804UINotificationProgressExportVSDFormCreate::UINotificationProgressExportVSDFormCreate(const CCloudClient &comClient,
2805 const CVirtualSystemDescription &comVSD)
2806 : m_comClient(comClient)
2807 , m_comVSD(comVSD)
2808{
2809 connect(this, &UINotificationProgress::sigProgressFinished,
2810 this, &UINotificationProgressExportVSDFormCreate::sltHandleProgressFinished);
2811}
2812
2813QString UINotificationProgressExportVSDFormCreate::name() const
2814{
2815 return UINotificationProgress::tr("Creating export VSD form ...");
2816}
2817
2818QString UINotificationProgressExportVSDFormCreate::details() const
2819{
2820 return QString();
2821}
2822
2823CProgress UINotificationProgressExportVSDFormCreate::createProgress(COMResult &comResult)
2824{
2825 /* Initialize progress-wrapper: */
2826 CProgress comProgress = m_comClient.GetExportDescriptionForm(m_comVSD, m_comVSDForm);
2827 /* Store COM result: */
2828 comResult = m_comClient;
2829 /* Return progress-wrapper: */
2830 return comProgress;
2831}
2832
2833void UINotificationProgressExportVSDFormCreate::sltHandleProgressFinished()
2834{
2835 if (m_comVSDForm.isNotNull())
2836 emit sigVSDFormCreated(QVariant::fromValue(m_comVSDForm));
2837}
2838
2839
2840/*********************************************************************************************************************************
2841* Class UINotificationProgressImportVSDFormCreate implementation. *
2842*********************************************************************************************************************************/
2843
2844UINotificationProgressImportVSDFormCreate::UINotificationProgressImportVSDFormCreate(const CCloudClient &comClient,
2845 const CVirtualSystemDescription &comVSD)
2846 : m_comClient(comClient)
2847 , m_comVSD(comVSD)
2848{
2849 connect(this, &UINotificationProgress::sigProgressFinished,
2850 this, &UINotificationProgressImportVSDFormCreate::sltHandleProgressFinished);
2851}
2852
2853QString UINotificationProgressImportVSDFormCreate::name() const
2854{
2855 return UINotificationProgress::tr("Creating import VSD form ...");
2856}
2857
2858QString UINotificationProgressImportVSDFormCreate::details() const
2859{
2860 return QString();
2861}
2862
2863CProgress UINotificationProgressImportVSDFormCreate::createProgress(COMResult &comResult)
2864{
2865 /* Initialize progress-wrapper: */
2866 CProgress comProgress = m_comClient.GetImportDescriptionForm(m_comVSD, m_comVSDForm);
2867 /* Store COM result: */
2868 comResult = m_comClient;
2869 /* Return progress-wrapper: */
2870 return comProgress;
2871}
2872
2873void UINotificationProgressImportVSDFormCreate::sltHandleProgressFinished()
2874{
2875 if (m_comVSDForm.isNotNull())
2876 emit sigVSDFormCreated(QVariant::fromValue(m_comVSDForm));
2877}
2878
2879
2880/*********************************************************************************************************************************
2881* Class UINotificationProgressCloudImageList implementation. *
2882*********************************************************************************************************************************/
2883
2884UINotificationProgressCloudImageList::UINotificationProgressCloudImageList(const CCloudClient &comClient,
2885 const QVector<KCloudImageState> &cloudImageStates)
2886 : m_comClient(comClient)
2887 , m_cloudImageStates(cloudImageStates)
2888{
2889 connect(this, &UINotificationProgress::sigProgressFinished,
2890 this, &UINotificationProgressCloudImageList::sltHandleProgressFinished);
2891}
2892
2893QString UINotificationProgressCloudImageList::name() const
2894{
2895 return UINotificationProgress::tr("Listing cloud images ...");
2896}
2897
2898QString UINotificationProgressCloudImageList::details() const
2899{
2900 return QString();
2901}
2902
2903CProgress UINotificationProgressCloudImageList::createProgress(COMResult &comResult)
2904{
2905 /* Initialize progress-wrapper: */
2906 CProgress comProgress = m_comClient.ListImages(m_cloudImageStates, m_comNames, m_comIds);
2907 /* Store COM result: */
2908 comResult = m_comClient;
2909 /* Return progress-wrapper: */
2910 return comProgress;
2911}
2912
2913void UINotificationProgressCloudImageList::sltHandleProgressFinished()
2914{
2915 if (m_comNames.isNotNull() && m_comIds.isNotNull())
2916 {
2917 emit sigImageNamesReceived(QVariant::fromValue(m_comNames));
2918 emit sigImageIdsReceived(QVariant::fromValue(m_comIds));
2919 }
2920}
2921
2922
2923/*********************************************************************************************************************************
2924* Class UINotificationProgressCloudSourceBootVolumeList implementation. *
2925*********************************************************************************************************************************/
2926
2927UINotificationProgressCloudSourceBootVolumeList::UINotificationProgressCloudSourceBootVolumeList(const CCloudClient &comClient)
2928 : m_comClient(comClient)
2929{
2930 connect(this, &UINotificationProgress::sigProgressFinished,
2931 this, &UINotificationProgressCloudSourceBootVolumeList::sltHandleProgressFinished);
2932}
2933
2934QString UINotificationProgressCloudSourceBootVolumeList::name() const
2935{
2936 return UINotificationProgress::tr("Listing cloud source boot volumes ...");
2937}
2938
2939QString UINotificationProgressCloudSourceBootVolumeList::details() const
2940{
2941 return QString();
2942}
2943
2944CProgress UINotificationProgressCloudSourceBootVolumeList::createProgress(COMResult &comResult)
2945{
2946 /* Initialize progress-wrapper: */
2947 CProgress comProgress = m_comClient.ListSourceBootVolumes(m_comNames, m_comIds);
2948 /* Store COM result: */
2949 comResult = m_comClient;
2950 /* Return progress-wrapper: */
2951 return comProgress;
2952}
2953
2954void UINotificationProgressCloudSourceBootVolumeList::sltHandleProgressFinished()
2955{
2956 if (m_comNames.isNotNull() && m_comIds.isNotNull())
2957 {
2958 emit sigImageNamesReceived(QVariant::fromValue(m_comNames));
2959 emit sigImageIdsReceived(QVariant::fromValue(m_comIds));
2960 }
2961}
2962
2963
2964/*********************************************************************************************************************************
2965* Class UINotificationProgressCloudInstanceList implementation. *
2966*********************************************************************************************************************************/
2967
2968UINotificationProgressCloudInstanceList::UINotificationProgressCloudInstanceList(const CCloudClient &comClient)
2969 : m_comClient(comClient)
2970{
2971 connect(this, &UINotificationProgress::sigProgressFinished,
2972 this, &UINotificationProgressCloudInstanceList::sltHandleProgressFinished);
2973}
2974
2975QString UINotificationProgressCloudInstanceList::name() const
2976{
2977 return UINotificationProgress::tr("Listing cloud instances ...");
2978}
2979
2980QString UINotificationProgressCloudInstanceList::details() const
2981{
2982 return QString();
2983}
2984
2985CProgress UINotificationProgressCloudInstanceList::createProgress(COMResult &comResult)
2986{
2987 /* Currently we are interested in Running and Stopped VMs only: */
2988 const QVector<KCloudMachineState> cloudMachineStates = QVector<KCloudMachineState>()
2989 << KCloudMachineState_Running
2990 << KCloudMachineState_Stopped;
2991
2992 /* Initialize progress-wrapper: */
2993 CProgress comProgress = m_comClient.ListInstances(cloudMachineStates, m_comNames, m_comIds);
2994 /* Store COM result: */
2995 comResult = m_comClient;
2996 /* Return progress-wrapper: */
2997 return comProgress;
2998}
2999
3000void UINotificationProgressCloudInstanceList::sltHandleProgressFinished()
3001{
3002 if (m_comNames.isNotNull() && m_comIds.isNotNull())
3003 {
3004 emit sigImageNamesReceived(QVariant::fromValue(m_comNames));
3005 emit sigImageIdsReceived(QVariant::fromValue(m_comIds));
3006 }
3007}
3008
3009
3010/*********************************************************************************************************************************
3011* Class UINotificationProgressCloudSourceInstanceList implementation. *
3012*********************************************************************************************************************************/
3013
3014UINotificationProgressCloudSourceInstanceList::UINotificationProgressCloudSourceInstanceList(const CCloudClient &comClient)
3015 : m_comClient(comClient)
3016{
3017 connect(this, &UINotificationProgress::sigProgressFinished,
3018 this, &UINotificationProgressCloudSourceInstanceList::sltHandleProgressFinished);
3019}
3020
3021QString UINotificationProgressCloudSourceInstanceList::name() const
3022{
3023 return UINotificationProgress::tr("Listing cloud source instances ...");
3024}
3025
3026QString UINotificationProgressCloudSourceInstanceList::details() const
3027{
3028 return QString();
3029}
3030
3031CProgress UINotificationProgressCloudSourceInstanceList::createProgress(COMResult &comResult)
3032{
3033 /* Initialize progress-wrapper: */
3034 CProgress comProgress = m_comClient.ListSourceInstances(m_comNames, m_comIds);
3035 /* Store COM result: */
3036 comResult = m_comClient;
3037 /* Return progress-wrapper: */
3038 return comProgress;
3039}
3040
3041void UINotificationProgressCloudSourceInstanceList::sltHandleProgressFinished()
3042{
3043 if (m_comNames.isNotNull() && m_comIds.isNotNull())
3044 {
3045 emit sigImageNamesReceived(QVariant::fromValue(m_comNames));
3046 emit sigImageIdsReceived(QVariant::fromValue(m_comIds));
3047 }
3048}
3049
3050
3051/*********************************************************************************************************************************
3052* Class UINotificationProgressCloudMachineAdd implementation. *
3053*********************************************************************************************************************************/
3054
3055UINotificationProgressCloudMachineAdd::UINotificationProgressCloudMachineAdd(const CCloudClient &comClient,
3056 const CCloudMachine &comMachine,
3057 const QString &strInstanceName,
3058 const QString &strProviderShortName,
3059 const QString &strProfileName)
3060 : m_comClient(comClient)
3061 , m_comMachine(comMachine)
3062 , m_strInstanceName(strInstanceName)
3063 , m_strProviderShortName(strProviderShortName)
3064 , m_strProfileName(strProfileName)
3065{
3066 connect(this, &UINotificationProgress::sigProgressFinished,
3067 this, &UINotificationProgressCloudMachineAdd::sltHandleProgressFinished);
3068}
3069
3070QString UINotificationProgressCloudMachineAdd::name() const
3071{
3072 return UINotificationProgress::tr("Adding cloud VM ...");
3073}
3074
3075QString UINotificationProgressCloudMachineAdd::details() const
3076{
3077 return UINotificationProgress::tr("<b>Provider:</b> %1<br><b>Profile:</b> %2<br><b>Instance Name:</b> %3")
3078 .arg(m_strProviderShortName, m_strProfileName, m_strInstanceName);
3079}
3080
3081CProgress UINotificationProgressCloudMachineAdd::createProgress(COMResult &comResult)
3082{
3083 /* Initialize progress-wrapper: */
3084 CProgress comProgress = m_comClient.AddCloudMachine(m_strInstanceName, m_comMachine);
3085 /* Store COM result: */
3086 comResult = m_comClient;
3087 /* Return progress-wrapper: */
3088 return comProgress;
3089}
3090
3091void UINotificationProgressCloudMachineAdd::sltHandleProgressFinished()
3092{
3093 if (m_comMachine.isNotNull() && !m_comMachine.GetId().isNull())
3094 emit sigCloudMachineAdded(m_strProviderShortName, m_strProfileName, m_comMachine);
3095}
3096
3097
3098/*********************************************************************************************************************************
3099* Class UINotificationProgressCloudMachineCreate implementation. *
3100*********************************************************************************************************************************/
3101
3102UINotificationProgressCloudMachineCreate::UINotificationProgressCloudMachineCreate(const CCloudClient &comClient,
3103 const CCloudMachine &comMachine,
3104 const CVirtualSystemDescription &comVSD,
3105 const QString &strProviderShortName,
3106 const QString &strProfileName)
3107 : m_comClient(comClient)
3108 , m_comMachine(comMachine)
3109 , m_comVSD(comVSD)
3110 , m_strProviderShortName(strProviderShortName)
3111 , m_strProfileName(strProfileName)
3112{
3113 connect(this, &UINotificationProgress::sigProgressFinished,
3114 this, &UINotificationProgressCloudMachineCreate::sltHandleProgressFinished);
3115}
3116
3117QString UINotificationProgressCloudMachineCreate::name() const
3118{
3119 return UINotificationProgress::tr("Creating cloud VM ...");
3120}
3121
3122QString UINotificationProgressCloudMachineCreate::details() const
3123{
3124 return UINotificationProgress::tr("<b>Provider:</b> %1<br><b>Profile:</b> %2<br><b>VM Name:</b> %3")
3125 .arg(m_strProviderShortName, m_strProfileName, m_strName);
3126}
3127
3128CProgress UINotificationProgressCloudMachineCreate::createProgress(COMResult &comResult)
3129{
3130 /* Parse cloud VM name: */
3131 QVector<KVirtualSystemDescriptionType> types;
3132 QVector<QString> refs, origValues, configValues, extraConfigValues;
3133 m_comVSD.GetDescriptionByType(KVirtualSystemDescriptionType_Name, types,
3134 refs, origValues, configValues, extraConfigValues);
3135 if (!origValues.isEmpty())
3136 m_strName = origValues.first();
3137
3138 /* Initialize progress-wrapper: */
3139 CProgress comProgress = m_comClient.CreateCloudMachine(m_comVSD, m_comMachine);
3140 /* Store COM result: */
3141 comResult = m_comClient;
3142 /* Return progress-wrapper: */
3143 return comProgress;
3144}
3145
3146void UINotificationProgressCloudMachineCreate::sltHandleProgressFinished()
3147{
3148 if (m_comMachine.isNotNull() && !m_comMachine.GetId().isNull())
3149 emit sigCloudMachineCreated(m_strProviderShortName, m_strProfileName, m_comMachine);
3150}
3151
3152
3153/*********************************************************************************************************************************
3154* Class UINotificationProgressCloudMachineRemove implementation. *
3155*********************************************************************************************************************************/
3156
3157UINotificationProgressCloudMachineRemove::UINotificationProgressCloudMachineRemove(const CCloudMachine &comMachine,
3158 bool fFullRemoval,
3159 const QString &strProviderShortName,
3160 const QString &strProfileName)
3161 : m_comMachine(comMachine)
3162 , m_fFullRemoval(fFullRemoval)
3163 , m_strProviderShortName(strProviderShortName)
3164 , m_strProfileName(strProfileName)
3165{
3166 connect(this, &UINotificationProgress::sigProgressFinished,
3167 this, &UINotificationProgressCloudMachineRemove::sltHandleProgressFinished);
3168}
3169
3170QString UINotificationProgressCloudMachineRemove::name() const
3171{
3172 return m_fFullRemoval
3173 ? UINotificationProgress::tr("Deleting cloud VM files ...")
3174 : UINotificationProgress::tr("Removing cloud VM ...");
3175}
3176
3177QString UINotificationProgressCloudMachineRemove::details() const
3178{
3179 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
3180}
3181
3182CProgress UINotificationProgressCloudMachineRemove::createProgress(COMResult &comResult)
3183{
3184 /* Acquire cloud VM name: */
3185 m_strName = m_comMachine.GetName();
3186 if (!m_comMachine.isOk())
3187 {
3188 /* Store COM result: */
3189 comResult = m_comMachine;
3190 /* Return progress-wrapper: */
3191 return CProgress();
3192 }
3193
3194 /* Initialize progress-wrapper: */
3195 CProgress comProgress = m_fFullRemoval
3196 ? m_comMachine.Remove()
3197 : m_comMachine.Unregister();
3198 /* Store COM result: */
3199 comResult = m_comMachine;
3200 /* Return progress-wrapper: */
3201 return comProgress;
3202}
3203
3204void UINotificationProgressCloudMachineRemove::sltHandleProgressFinished()
3205{
3206 if (error().isEmpty())
3207 emit sigCloudMachineRemoved(m_strProviderShortName, m_strProfileName, m_strName);
3208}
3209
3210
3211/*********************************************************************************************************************************
3212* Class UINotificationProgressCloudMachineClone implementation. *
3213*********************************************************************************************************************************/
3214
3215UINotificationProgressCloudMachineClone::UINotificationProgressCloudMachineClone(const CCloudClient &comClient,
3216 const CCloudMachine &comMachine,
3217 const QString &strCloneName)
3218 : m_comClient(comClient)
3219 , m_comMachine(comMachine)
3220 , m_strCloneName(strCloneName)
3221{
3222}
3223
3224QString UINotificationProgressCloudMachineClone::name() const
3225{
3226 return UINotificationProgress::tr("Cloning cloud VM ...");
3227}
3228
3229QString UINotificationProgressCloudMachineClone::details() const
3230{
3231 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
3232}
3233
3234CProgress UINotificationProgressCloudMachineClone::createProgress(COMResult &comResult)
3235{
3236 /* Acquire cloud VM internal id: */
3237 m_strId = m_comMachine.GetCloudId();
3238 if (!m_comMachine.isOk())
3239 {
3240 /* Store COM result: */
3241 comResult = m_comMachine;
3242 /* Return progress-wrapper: */
3243 return CProgress();
3244 }
3245 /* Acquire cloud VM name: */
3246 m_strName = m_comMachine.GetName();
3247 if (!m_comMachine.isOk())
3248 {
3249 /* Store COM result: */
3250 comResult = m_comMachine;
3251 /* Return progress-wrapper: */
3252 return CProgress();
3253 }
3254
3255 /* Initialize progress-wrapper: */
3256 CCloudMachine comCloneMachine;
3257 CProgress comProgress = m_comClient.CloneInstance(m_strId, m_strCloneName, comCloneMachine);
3258 /* Store COM result: */
3259 comResult = m_comMachine;
3260 /* Return progress-wrapper: */
3261 return comProgress;
3262}
3263
3264
3265/*********************************************************************************************************************************
3266* Class UINotificationProgressCloudMachineReset implementation. *
3267*********************************************************************************************************************************/
3268
3269UINotificationProgressCloudMachineReset::UINotificationProgressCloudMachineReset(const CCloudMachine &comMachine)
3270 : m_comMachine(comMachine)
3271{
3272}
3273
3274QString UINotificationProgressCloudMachineReset::name() const
3275{
3276 return UINotificationProgress::tr("Resetting cloud VM ...");
3277}
3278
3279QString UINotificationProgressCloudMachineReset::details() const
3280{
3281 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
3282}
3283
3284CProgress UINotificationProgressCloudMachineReset::createProgress(COMResult &comResult)
3285{
3286 /* Acquire cloud VM name: */
3287 m_strName = m_comMachine.GetName();
3288 if (!m_comMachine.isOk())
3289 {
3290 /* Store COM result: */
3291 comResult = m_comMachine;
3292 /* Return progress-wrapper: */
3293 return CProgress();
3294 }
3295
3296 /* Initialize progress-wrapper: */
3297 CProgress comProgress = m_comMachine.Reset();
3298 /* Store COM result: */
3299 comResult = m_comMachine;
3300 /* Return progress-wrapper: */
3301 return comProgress;
3302}
3303
3304
3305/*********************************************************************************************************************************
3306* Class UINotificationProgressCloudMachinePowerUp implementation. *
3307*********************************************************************************************************************************/
3308
3309UINotificationProgressCloudMachinePowerUp::UINotificationProgressCloudMachinePowerUp(const CCloudMachine &comMachine)
3310 : m_comMachine(comMachine)
3311{
3312}
3313
3314QString UINotificationProgressCloudMachinePowerUp::name() const
3315{
3316 return UINotificationProgress::tr("Powering cloud VM up ...");
3317}
3318
3319QString UINotificationProgressCloudMachinePowerUp::details() const
3320{
3321 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
3322}
3323
3324CProgress UINotificationProgressCloudMachinePowerUp::createProgress(COMResult &comResult)
3325{
3326 /* Acquire cloud VM name: */
3327 m_strName = m_comMachine.GetName();
3328 if (!m_comMachine.isOk())
3329 {
3330 /* Store COM result: */
3331 comResult = m_comMachine;
3332 /* Return progress-wrapper: */
3333 return CProgress();
3334 }
3335
3336 /* Initialize progress-wrapper: */
3337 CProgress comProgress = m_comMachine.PowerUp();
3338 /* Store COM result: */
3339 comResult = m_comMachine;
3340 /* Return progress-wrapper: */
3341 return comProgress;
3342}
3343
3344
3345/*********************************************************************************************************************************
3346* Class UINotificationProgressCloudMachinePowerOff implementation. *
3347*********************************************************************************************************************************/
3348
3349UINotificationProgressCloudMachinePowerOff::UINotificationProgressCloudMachinePowerOff(const CCloudMachine &comMachine)
3350 : m_comMachine(comMachine)
3351{
3352}
3353
3354QString UINotificationProgressCloudMachinePowerOff::name() const
3355{
3356 return UINotificationProgress::tr("Powering cloud VM off ...");
3357}
3358
3359QString UINotificationProgressCloudMachinePowerOff::details() const
3360{
3361 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
3362}
3363
3364CProgress UINotificationProgressCloudMachinePowerOff::createProgress(COMResult &comResult)
3365{
3366 /* Acquire cloud VM name: */
3367 m_strName = m_comMachine.GetName();
3368 if (!m_comMachine.isOk())
3369 {
3370 /* Store COM result: */
3371 comResult = m_comMachine;
3372 /* Return progress-wrapper: */
3373 return CProgress();
3374 }
3375
3376 /* Initialize progress-wrapper: */
3377 CProgress comProgress = m_comMachine.PowerDown();
3378 /* Store COM result: */
3379 comResult = m_comMachine;
3380 /* Return progress-wrapper: */
3381 return comProgress;
3382}
3383
3384
3385/*********************************************************************************************************************************
3386* Class UINotificationProgressCloudMachineShutdown implementation. *
3387*********************************************************************************************************************************/
3388
3389UINotificationProgressCloudMachineShutdown::UINotificationProgressCloudMachineShutdown(const CCloudMachine &comMachine)
3390 : m_comMachine(comMachine)
3391{
3392}
3393
3394QString UINotificationProgressCloudMachineShutdown::name() const
3395{
3396 return UINotificationProgress::tr("Shutting cloud VM down ...");
3397}
3398
3399QString UINotificationProgressCloudMachineShutdown::details() const
3400{
3401 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
3402}
3403
3404CProgress UINotificationProgressCloudMachineShutdown::createProgress(COMResult &comResult)
3405{
3406 /* Acquire cloud VM name: */
3407 m_strName = m_comMachine.GetName();
3408 if (!m_comMachine.isOk())
3409 {
3410 /* Store COM result: */
3411 comResult = m_comMachine;
3412 /* Return progress-wrapper: */
3413 return CProgress();
3414 }
3415
3416 /* Initialize progress-wrapper: */
3417 CProgress comProgress = m_comMachine.Shutdown();
3418 /* Store COM result: */
3419 comResult = m_comMachine;
3420 /* Return progress-wrapper: */
3421 return comProgress;
3422}
3423
3424
3425/*********************************************************************************************************************************
3426* Class UINotificationProgressCloudMachineTerminate implementation. *
3427*********************************************************************************************************************************/
3428
3429UINotificationProgressCloudMachineTerminate::UINotificationProgressCloudMachineTerminate(const CCloudMachine &comMachine)
3430 : m_comMachine(comMachine)
3431{
3432}
3433
3434QString UINotificationProgressCloudMachineTerminate::name() const
3435{
3436 return UINotificationProgress::tr("Terminating cloud VM ...");
3437}
3438
3439QString UINotificationProgressCloudMachineTerminate::details() const
3440{
3441 return UINotificationProgress::tr("<b>VM Name:</b> %1").arg(m_strName);
3442}
3443
3444CProgress UINotificationProgressCloudMachineTerminate::createProgress(COMResult &comResult)
3445{
3446 /* Acquire cloud VM name: */
3447 m_strName = m_comMachine.GetName();
3448 if (!m_comMachine.isOk())
3449 {
3450 /* Store COM result: */
3451 comResult = m_comMachine;
3452 /* Return progress-wrapper: */
3453 return CProgress();
3454 }
3455
3456 /* Initialize progress-wrapper: */
3457 CProgress comProgress = m_comMachine.Terminate();
3458 /* Store COM result: */
3459 comResult = m_comMachine;
3460 /* Return progress-wrapper: */
3461 return comProgress;
3462}
3463
3464
3465/*********************************************************************************************************************************
3466* Class UINotificationProgressCloudMachineSettingsFormCreate implementation. *
3467*********************************************************************************************************************************/
3468
3469UINotificationProgressCloudMachineSettingsFormCreate::UINotificationProgressCloudMachineSettingsFormCreate(const CCloudMachine &comMachine,
3470 const QString &strMachineName)
3471 : m_comMachine(comMachine)
3472 , m_strMachineName(strMachineName)
3473{
3474 connect(this, &UINotificationProgress::sigProgressFinished,
3475 this, &UINotificationProgressCloudMachineSettingsFormCreate::sltHandleProgressFinished);
3476}
3477
3478QString UINotificationProgressCloudMachineSettingsFormCreate::name() const
3479{
3480 return UINotificationProgress::tr("Creating cloud VM settings form ...");
3481}
3482
3483QString UINotificationProgressCloudMachineSettingsFormCreate::details() const
3484{
3485 return UINotificationProgress::tr("<b>Cloud VM Name:</b> %1").arg(m_strMachineName);
3486}
3487
3488CProgress UINotificationProgressCloudMachineSettingsFormCreate::createProgress(COMResult &comResult)
3489{
3490 /* Initialize progress-wrapper: */
3491 CProgress comProgress = m_comMachine.GetSettingsForm(m_comForm);
3492 /* Store COM result: */
3493 comResult = m_comMachine;
3494 /* Return progress-wrapper: */
3495 return comProgress;
3496}
3497
3498void UINotificationProgressCloudMachineSettingsFormCreate::sltHandleProgressFinished()
3499{
3500 if (m_comForm.isNotNull())
3501 emit sigSettingsFormCreated(QVariant::fromValue(m_comForm));
3502}
3503
3504
3505/*********************************************************************************************************************************
3506* Class UINotificationProgressCloudMachineSettingsFormApply implementation. *
3507*********************************************************************************************************************************/
3508
3509UINotificationProgressCloudMachineSettingsFormApply::UINotificationProgressCloudMachineSettingsFormApply(const CForm &comForm,
3510 const QString &strMachineName)
3511 : m_comForm(comForm)
3512 , m_strMachineName(strMachineName)
3513{
3514}
3515
3516QString UINotificationProgressCloudMachineSettingsFormApply::name() const
3517{
3518 return UINotificationProgress::tr("Applying cloud VM settings form ...");
3519}
3520
3521QString UINotificationProgressCloudMachineSettingsFormApply::details() const
3522{
3523 return UINotificationProgress::tr("<b>Cloud VM Name:</b> %1").arg(m_strMachineName);
3524}
3525
3526CProgress UINotificationProgressCloudMachineSettingsFormApply::createProgress(COMResult &comResult)
3527{
3528 /* Initialize progress-wrapper: */
3529 CProgress comProgress = m_comForm.Apply();
3530 /* Store COM result: */
3531 comResult = m_comForm;
3532 /* Return progress-wrapper: */
3533 return comProgress;
3534}
3535
3536
3537/*********************************************************************************************************************************
3538* Class UINotificationProgressCloudConsoleConnectionCreate implementation. *
3539*********************************************************************************************************************************/
3540
3541UINotificationProgressCloudConsoleConnectionCreate::UINotificationProgressCloudConsoleConnectionCreate(const CCloudMachine &comMachine,
3542 const QString &strPublicKey)
3543 : m_comMachine(comMachine)
3544 , m_strPublicKey(strPublicKey)
3545{
3546}
3547
3548QString UINotificationProgressCloudConsoleConnectionCreate::name() const
3549{
3550 return UINotificationProgress::tr("Creating cloud console connection ...");
3551}
3552
3553QString UINotificationProgressCloudConsoleConnectionCreate::details() const
3554{
3555 return UINotificationProgress::tr("<b>Cloud VM Name:</b> %1").arg(m_strName);
3556}
3557
3558CProgress UINotificationProgressCloudConsoleConnectionCreate::createProgress(COMResult &comResult)
3559{
3560 /* Acquire cloud VM name: */
3561 m_strName = m_comMachine.GetName();
3562 if (!m_comMachine.isOk())
3563 {
3564 comResult = m_comMachine;
3565 return CProgress();
3566 }
3567
3568 /* Initialize progress-wrapper: */
3569 CProgress comProgress = m_comMachine.CreateConsoleConnection(m_strPublicKey);
3570 /* Store COM result: */
3571 comResult = m_comMachine;
3572 /* Return progress-wrapper: */
3573 return comProgress;
3574}
3575
3576
3577/*********************************************************************************************************************************
3578* Class UINotificationProgressCloudConsoleConnectionDelete implementation. *
3579*********************************************************************************************************************************/
3580
3581UINotificationProgressCloudConsoleConnectionDelete::UINotificationProgressCloudConsoleConnectionDelete(const CCloudMachine &comMachine)
3582 : m_comMachine(comMachine)
3583{
3584}
3585
3586QString UINotificationProgressCloudConsoleConnectionDelete::name() const
3587{
3588 return UINotificationProgress::tr("Deleting cloud console connection ...");
3589}
3590
3591QString UINotificationProgressCloudConsoleConnectionDelete::details() const
3592{
3593 return UINotificationProgress::tr("<b>Cloud VM Name:</b> %1").arg(m_strName);
3594}
3595
3596CProgress UINotificationProgressCloudConsoleConnectionDelete::createProgress(COMResult &comResult)
3597{
3598 /* Acquire cloud VM name: */
3599 m_strName = m_comMachine.GetName();
3600 if (!m_comMachine.isOk())
3601 {
3602 comResult = m_comMachine;
3603 return CProgress();
3604 }
3605
3606 /* Initialize progress-wrapper: */
3607 CProgress comProgress = m_comMachine.DeleteConsoleConnection();
3608 /* Store COM result: */
3609 comResult = m_comMachine;
3610 /* Return progress-wrapper: */
3611 return comProgress;
3612}
3613
3614
3615/*********************************************************************************************************************************
3616* Class UINotificationProgressCloudConsoleLogAcquire implementation. *
3617*********************************************************************************************************************************/
3618
3619UINotificationProgressCloudConsoleLogAcquire::UINotificationProgressCloudConsoleLogAcquire(const CCloudMachine &comMachine)
3620 : m_comMachine(comMachine)
3621{
3622 connect(this, &UINotificationProgress::sigProgressFinished,
3623 this, &UINotificationProgressCloudConsoleLogAcquire::sltHandleProgressFinished);
3624}
3625
3626QString UINotificationProgressCloudConsoleLogAcquire::name() const
3627{
3628 return UINotificationProgress::tr("Acquire cloud console log ...");
3629}
3630
3631QString UINotificationProgressCloudConsoleLogAcquire::details() const
3632{
3633 return UINotificationProgress::tr("<b>Cloud VM Name:</b> %1").arg(m_strName);
3634}
3635
3636CProgress UINotificationProgressCloudConsoleLogAcquire::createProgress(COMResult &comResult)
3637{
3638 /* Acquire cloud VM name: */
3639 m_strName = m_comMachine.GetName();
3640 if (!m_comMachine.isOk())
3641 {
3642 comResult = m_comMachine;
3643 return CProgress();
3644 }
3645
3646 /* Initialize progress-wrapper: */
3647 CProgress comProgress = m_comMachine.GetConsoleHistory(m_comStream);
3648 /* Store COM result: */
3649 comResult = m_comMachine;
3650 /* Return progress-wrapper: */
3651 return comProgress;
3652}
3653
3654void UINotificationProgressCloudConsoleLogAcquire::sltHandleProgressFinished()
3655{
3656 /* Read the byte array: */
3657 QVector<BYTE> byteArray;
3658 while (true)
3659 {
3660 const QVector<BYTE> byteChunk = m_comStream.Read(64 * _1K, 0);
3661 if (byteChunk.size() == 0)
3662 break;
3663 byteArray += byteChunk;
3664 }
3665 if (byteArray.size() == 0)
3666 return;
3667
3668 /* Convert it to string and send away: */
3669 const QString strLog = QString::fromUtf8(reinterpret_cast<const char *>(byteArray.data()), byteArray.size());
3670 emit sigLogRead(m_strName, strLog);
3671}
3672
3673
3674/*********************************************************************************************************************************
3675* Class UINotificationProgressSnapshotTake implementation. *
3676*********************************************************************************************************************************/
3677
3678UINotificationProgressSnapshotTake::UINotificationProgressSnapshotTake(const CMachine &comMachine,
3679 const QString &strSnapshotName,
3680 const QString &strSnapshotDescription)
3681 : m_comMachine(comMachine)
3682 , m_strSnapshotName(strSnapshotName)
3683 , m_strSnapshotDescription(strSnapshotDescription)
3684{
3685 connect(this, &UINotificationProgress::sigProgressFinished,
3686 this, &UINotificationProgressSnapshotTake::sltHandleProgressFinished);
3687}
3688
3689QString UINotificationProgressSnapshotTake::name() const
3690{
3691 return UINotificationProgress::tr("Taking snapshot ...");
3692}
3693
3694QString UINotificationProgressSnapshotTake::details() const
3695{
3696 return UINotificationProgress::tr("<b>VM Name:</b> %1<br><b>Snapshot Name:</b> %2").arg(m_strMachineName, m_strSnapshotName);
3697}
3698
3699CProgress UINotificationProgressSnapshotTake::createProgress(COMResult &comResult)
3700{
3701 /* Acquire VM id: */
3702 const QUuid uId = m_comMachine.GetId();
3703 if (!m_comMachine.isOk())
3704 {
3705 comResult = m_comMachine;
3706 return CProgress();
3707 }
3708
3709 /* Acquire VM name: */
3710 m_strMachineName = m_comMachine.GetName();
3711 if (!m_comMachine.isOk())
3712 {
3713 comResult = m_comMachine;
3714 return CProgress();
3715 }
3716
3717 /* Get session machine: */
3718 CMachine comMachine;
3719
3720 /* For Manager UI: */
3721 switch (uiCommon().uiType())
3722 {
3723 case UIType_ManagerUI:
3724 {
3725 /* Acquire session state: */
3726 const KSessionState enmSessionState = m_comMachine.GetSessionState();
3727 if (!m_comMachine.isOk())
3728 {
3729 comResult = m_comMachine;
3730 return CProgress();
3731 }
3732
3733 /* Open a session thru which we will modify the machine: */
3734 if (enmSessionState != KSessionState_Unlocked)
3735 m_comSession = uiCommon().openExistingSession(uId);
3736 else
3737 m_comSession = uiCommon().openSession(uId);
3738 if (m_comSession.isNull())
3739 return CProgress();
3740
3741 /* Get session machine: */
3742 comMachine = m_comSession.GetMachine();
3743 if (!m_comSession.isOk())
3744 {
3745 comResult = m_comSession;
3746 m_comSession.UnlockMachine();
3747 return CProgress();
3748 }
3749
3750 break;
3751 }
3752 case UIType_RuntimeUI:
3753 {
3754 /* Get passed machine: */
3755 comMachine = m_comMachine;
3756
3757 break;
3758 }
3759 }
3760
3761 /* Initialize progress-wrapper: */
3762 CProgress comProgress = comMachine.TakeSnapshot(m_strSnapshotName,
3763 m_strSnapshotDescription,
3764 true, m_uSnapshotId);
3765 /* Store COM result: */
3766 comResult = m_comMachine;
3767 /* Return progress-wrapper: */
3768 return comProgress;
3769}
3770
3771void UINotificationProgressSnapshotTake::sltHandleProgressFinished()
3772{
3773 if (m_comSession.isNotNull())
3774 m_comSession.UnlockMachine();
3775
3776 if (!m_uSnapshotId.isNull())
3777 emit sigSnapshotTaken(QVariant::fromValue(m_uSnapshotId));
3778}
3779
3780
3781/*********************************************************************************************************************************
3782* Class UINotificationProgressSnapshotRestore implementation. *
3783*********************************************************************************************************************************/
3784
3785UINotificationProgressSnapshotRestore::UINotificationProgressSnapshotRestore(const QUuid &uMachineId,
3786 const CSnapshot &comSnapshot /* = CSnapshot() */)
3787 : m_uMachineId(uMachineId)
3788 , m_comSnapshot(comSnapshot)
3789{
3790 connect(this, &UINotificationProgress::sigProgressFinished,
3791 this, &UINotificationProgressSnapshotRestore::sltHandleProgressFinished);
3792}
3793
3794UINotificationProgressSnapshotRestore::UINotificationProgressSnapshotRestore(const CMachine &comMachine,
3795 const CSnapshot &comSnapshot /* = CSnapshot() */)
3796 : m_comMachine(comMachine)
3797 , m_comSnapshot(comSnapshot)
3798{
3799 connect(this, &UINotificationProgress::sigProgressFinished,
3800 this, &UINotificationProgressSnapshotRestore::sltHandleProgressFinished);
3801}
3802
3803QString UINotificationProgressSnapshotRestore::name() const
3804{
3805 return UINotificationProgress::tr("Restoring snapshot ...");
3806}
3807
3808QString UINotificationProgressSnapshotRestore::details() const
3809{
3810 return UINotificationProgress::tr("<b>VM Name:</b> %1<br><b>Snapshot Name:</b> %2").arg(m_strMachineName, m_strSnapshotName);
3811}
3812
3813CProgress UINotificationProgressSnapshotRestore::createProgress(COMResult &comResult)
3814{
3815 /* Make sure machine ID defined: */
3816 if (m_uMachineId.isNull())
3817 {
3818 /* Acquire VM id: */
3819 AssertReturn(m_comMachine.isNotNull(), CProgress());
3820 m_uMachineId = m_comMachine.GetId();
3821 if (!m_comMachine.isOk())
3822 {
3823 comResult = m_comMachine;
3824 return CProgress();
3825 }
3826 }
3827
3828 /* Make sure machine defined: */
3829 if (m_comMachine.isNull())
3830 {
3831 /* Acquire VM: */
3832 AssertReturn(!m_uMachineId.isNull(), CProgress());
3833 CVirtualBox comVBox = gpGlobalSession->virtualBox();
3834 m_comMachine = comVBox.FindMachine(m_uMachineId.toString());
3835 if (!comVBox.isOk())
3836 {
3837 comResult = comVBox;
3838 return CProgress();
3839 }
3840 }
3841
3842 /* Make sure snapshot is defined: */
3843 if (m_comSnapshot.isNull())
3844 m_comSnapshot = m_comMachine.GetCurrentSnapshot();
3845
3846 /* Acquire snapshot name: */
3847 m_strSnapshotName = m_comSnapshot.GetName();
3848 if (!m_comSnapshot.isOk())
3849 {
3850 comResult = m_comSnapshot;
3851 return CProgress();
3852 }
3853
3854 /* Acquire session state: */
3855 const KSessionState enmSessionState = m_comMachine.GetSessionState();
3856 if (!m_comMachine.isOk())
3857 {
3858 comResult = m_comMachine;
3859 return CProgress();
3860 }
3861
3862 /* Open a session thru which we will modify the machine: */
3863 if (enmSessionState != KSessionState_Unlocked)
3864 m_comSession = uiCommon().openExistingSession(m_uMachineId);
3865 else
3866 m_comSession = uiCommon().openSession(m_uMachineId);
3867 if (m_comSession.isNull())
3868 return CProgress();
3869
3870 /* Get session machine: */
3871 CMachine comMachine = m_comSession.GetMachine();
3872 if (!m_comSession.isOk())
3873 {
3874 comResult = m_comSession;
3875 m_comSession.UnlockMachine();
3876 return CProgress();
3877 }
3878
3879 /* Acquire VM name: */
3880 m_strMachineName = comMachine.GetName();
3881 if (!comMachine.isOk())
3882 {
3883 comResult = comMachine;
3884 m_comSession.UnlockMachine();
3885 return CProgress();
3886 }
3887
3888 /* Initialize progress-wrapper: */
3889 CProgress comProgress = comMachine.RestoreSnapshot(m_comSnapshot);
3890 /* Store COM result: */
3891 comResult = comMachine;
3892 /* Return progress-wrapper: */
3893 return comProgress;
3894}
3895
3896void UINotificationProgressSnapshotRestore::sltHandleProgressFinished()
3897{
3898 /* Unlock session finally: */
3899 m_comSession.UnlockMachine();
3900
3901 /* Notifies listeners: */
3902 emit sigSnapshotRestored(error().isEmpty());
3903}
3904
3905
3906/*********************************************************************************************************************************
3907* Class UINotificationProgressSnapshotDelete implementation. *
3908*********************************************************************************************************************************/
3909
3910UINotificationProgressSnapshotDelete::UINotificationProgressSnapshotDelete(const CMachine &comMachine,
3911 const QUuid &uSnapshotId)
3912 : m_comMachine(comMachine)
3913 , m_uSnapshotId(uSnapshotId)
3914{
3915 connect(this, &UINotificationProgress::sigProgressFinished,
3916 this, &UINotificationProgressSnapshotDelete::sltHandleProgressFinished);
3917}
3918
3919QString UINotificationProgressSnapshotDelete::name() const
3920{
3921 return UINotificationProgress::tr("Deleting snapshot ...");
3922}
3923
3924QString UINotificationProgressSnapshotDelete::details() const
3925{
3926 return UINotificationProgress::tr("<b>VM Name:</b> %1<br><b>Snapshot Name:</b> %2").arg(m_strMachineName, m_strSnapshotName);
3927}
3928
3929CProgress UINotificationProgressSnapshotDelete::createProgress(COMResult &comResult)
3930{
3931 /* Acquire VM id: */
3932 const QUuid uId = m_comMachine.GetId();
3933 if (!m_comMachine.isOk())
3934 {
3935 comResult = m_comMachine;
3936 return CProgress();
3937 }
3938
3939 /* Acquire VM name: */
3940 m_strMachineName = m_comMachine.GetName();
3941 if (!m_comMachine.isOk())
3942 {
3943 comResult = m_comMachine;
3944 return CProgress();
3945 }
3946
3947 /* Acquire snapshot: */
3948 CSnapshot comSnapshot = m_comMachine.FindSnapshot(m_uSnapshotId.toString());
3949 if (!m_comMachine.isOk())
3950 {
3951 comResult = m_comMachine;
3952 return CProgress();
3953 }
3954
3955 /* Acquire snapshot name: */
3956 m_strSnapshotName = comSnapshot.GetName();
3957 if (!comSnapshot.isOk())
3958 {
3959 comResult = comSnapshot;
3960 return CProgress();
3961 }
3962
3963 /* Acquire session state: */
3964 const KSessionState enmSessionState = m_comMachine.GetSessionState();
3965 if (!m_comMachine.isOk())
3966 {
3967 comResult = m_comMachine;
3968 return CProgress();
3969 }
3970
3971 /* Open a session thru which we will modify the machine: */
3972 if (enmSessionState != KSessionState_Unlocked)
3973 m_comSession = uiCommon().openExistingSession(uId);
3974 else
3975 m_comSession = uiCommon().openSession(uId);
3976 if (m_comSession.isNull())
3977 return CProgress();
3978
3979 /* Get session machine: */
3980 CMachine comMachine = m_comSession.GetMachine();
3981 if (!m_comSession.isOk())
3982 {
3983 comResult = m_comSession;
3984 m_comSession.UnlockMachine();
3985 return CProgress();
3986 }
3987
3988 /* Initialize progress-wrapper: */
3989 CProgress comProgress = comMachine.DeleteSnapshot(m_uSnapshotId);
3990 /* Store COM result: */
3991 comResult = m_comMachine;
3992 /* Return progress-wrapper: */
3993 return comProgress;
3994}
3995
3996void UINotificationProgressSnapshotDelete::sltHandleProgressFinished()
3997{
3998 m_comSession.UnlockMachine();
3999}
4000
4001
4002/*********************************************************************************************************************************
4003* Class UINotificationProgressApplianceWrite implementation. *
4004*********************************************************************************************************************************/
4005
4006UINotificationProgressApplianceWrite::UINotificationProgressApplianceWrite(const CAppliance &comAppliance,
4007 const QString &strFormat,
4008 const QVector<KExportOptions> &options,
4009 const QString &strPath)
4010 : m_comAppliance(comAppliance)
4011 , m_strFormat(strFormat)
4012 , m_options(options)
4013 , m_strPath(strPath)
4014{
4015}
4016
4017QString UINotificationProgressApplianceWrite::name() const
4018{
4019 return UINotificationProgress::tr("Writing appliance ...");
4020}
4021
4022QString UINotificationProgressApplianceWrite::details() const
4023{
4024 return UINotificationProgress::tr("<b>To:</b> %1").arg(m_strPath);
4025}
4026
4027CProgress UINotificationProgressApplianceWrite::createProgress(COMResult &comResult)
4028{
4029 /* Initialize progress-wrapper: */
4030 CProgress comProgress = m_comAppliance.Write(m_strFormat, m_options, m_strPath);
4031 /* Store COM result: */
4032 comResult = m_comAppliance;
4033 /* Return progress-wrapper: */
4034 return comProgress;
4035}
4036
4037
4038/*********************************************************************************************************************************
4039* Class UINotificationProgressApplianceRead implementation. *
4040*********************************************************************************************************************************/
4041
4042UINotificationProgressApplianceRead::UINotificationProgressApplianceRead(const CAppliance &comAppliance,
4043 const QString &strPath)
4044 : m_comAppliance(comAppliance)
4045 , m_strPath(strPath)
4046{
4047}
4048
4049QString UINotificationProgressApplianceRead::name() const
4050{
4051 return UINotificationProgress::tr("Reading appliance ...");
4052}
4053
4054QString UINotificationProgressApplianceRead::details() const
4055{
4056 return UINotificationProgress::tr("<b>From:</b> %1").arg(m_strPath);
4057}
4058
4059CProgress UINotificationProgressApplianceRead::createProgress(COMResult &comResult)
4060{
4061 /* Initialize progress-wrapper: */
4062 CProgress comProgress = m_comAppliance.Read(m_strPath);
4063 /* Store COM result: */
4064 comResult = m_comAppliance;
4065 /* Return progress-wrapper: */
4066 return comProgress;
4067}
4068
4069
4070/*********************************************************************************************************************************
4071* Class UINotificationProgressApplianceImport implementation. *
4072*********************************************************************************************************************************/
4073
4074UINotificationProgressApplianceImport::UINotificationProgressApplianceImport(const CAppliance &comAppliance,
4075 const QVector<KImportOptions> &options)
4076 : m_comAppliance(comAppliance)
4077 , m_options(options)
4078{
4079}
4080
4081QString UINotificationProgressApplianceImport::name() const
4082{
4083 return UINotificationProgress::tr("Importing appliance ...");
4084}
4085
4086QString UINotificationProgressApplianceImport::details() const
4087{
4088 return UINotificationProgress::tr("<b>From:</b> %1").arg(m_comAppliance.GetPath());
4089}
4090
4091CProgress UINotificationProgressApplianceImport::createProgress(COMResult &comResult)
4092{
4093 /* Initialize progress-wrapper: */
4094 CProgress comProgress = m_comAppliance.ImportMachines(m_options);
4095 /* Store COM result: */
4096 comResult = m_comAppliance;
4097 /* Return progress-wrapper: */
4098 return comProgress;
4099}
4100
4101
4102/*********************************************************************************************************************************
4103* Class UINotificationProgressExtensionPackInstall implementation. *
4104*********************************************************************************************************************************/
4105
4106UINotificationProgressExtensionPackInstall::UINotificationProgressExtensionPackInstall(const CExtPackFile &comExtPackFile,
4107 bool fReplace,
4108 const QString &strExtensionPackName,
4109 const QString &strDisplayInfo)
4110 : m_comExtPackFile(comExtPackFile)
4111 , m_fReplace(fReplace)
4112 , m_strExtensionPackName(strExtensionPackName)
4113 , m_strDisplayInfo(strDisplayInfo)
4114{
4115}
4116
4117QString UINotificationProgressExtensionPackInstall::name() const
4118{
4119 return UINotificationProgress::tr("Installing package ...");
4120}
4121
4122QString UINotificationProgressExtensionPackInstall::details() const
4123{
4124 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strExtensionPackName);
4125}
4126
4127CProgress UINotificationProgressExtensionPackInstall::createProgress(COMResult &comResult)
4128{
4129 /* Initialize progress-wrapper: */
4130 CProgress comProgress = m_comExtPackFile.Install(m_fReplace, m_strDisplayInfo);
4131 /* Store COM result: */
4132 comResult = m_comExtPackFile;
4133 /* Return progress-wrapper: */
4134 return comProgress;
4135}
4136
4137
4138/*********************************************************************************************************************************
4139* Class UINotificationProgressExtensionPackUninstall implementation. *
4140*********************************************************************************************************************************/
4141
4142UINotificationProgressExtensionPackUninstall::UINotificationProgressExtensionPackUninstall(const CExtPackManager &comExtPackManager,
4143 const QString &strExtensionPackName,
4144 const QString &strDisplayInfo)
4145 : m_comExtPackManager(comExtPackManager)
4146 , m_strExtensionPackName(strExtensionPackName)
4147 , m_strDisplayInfo(strDisplayInfo)
4148{
4149}
4150
4151QString UINotificationProgressExtensionPackUninstall::name() const
4152{
4153 return UINotificationProgress::tr("Uninstalling package ...");
4154}
4155
4156QString UINotificationProgressExtensionPackUninstall::details() const
4157{
4158 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strExtensionPackName);
4159}
4160
4161CProgress UINotificationProgressExtensionPackUninstall::createProgress(COMResult &comResult)
4162{
4163 /* Initialize progress-wrapper: */
4164 CProgress comProgress = m_comExtPackManager.Uninstall(m_strExtensionPackName,
4165 false /* forced removal? */,
4166 m_strDisplayInfo);
4167 /* Store COM result: */
4168 comResult = m_comExtPackManager;
4169 /* Return progress-wrapper: */
4170 return comProgress;
4171}
4172
4173
4174/*********************************************************************************************************************************
4175* Class UINotificationProgressGuestAdditionsInstall implementation. *
4176*********************************************************************************************************************************/
4177
4178UINotificationProgressGuestAdditionsInstall::UINotificationProgressGuestAdditionsInstall(const CGuest &comGuest,
4179 const QString &strSource)
4180 : m_comGuest(comGuest)
4181 , m_strSource(strSource)
4182{
4183 connect(this, &UINotificationProgress::sigProgressFinished,
4184 this, &UINotificationProgressGuestAdditionsInstall::sltHandleProgressFinished);
4185}
4186
4187QString UINotificationProgressGuestAdditionsInstall::name() const
4188{
4189 return UINotificationProgress::tr("Installing image ...");
4190}
4191
4192QString UINotificationProgressGuestAdditionsInstall::details() const
4193{
4194 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strSource);
4195}
4196
4197CProgress UINotificationProgressGuestAdditionsInstall::createProgress(COMResult &comResult)
4198{
4199 /* Initialize progress-wrapper: */
4200 QVector<QString> args;
4201 QVector<KAdditionsUpdateFlag> flags;
4202 CProgress comProgress = m_comGuest.UpdateGuestAdditions(m_strSource, args, flags);
4203 /* Store COM result: */
4204 comResult = m_comGuest;
4205 /* Return progress-wrapper: */
4206 return comProgress;
4207}
4208
4209void UINotificationProgressGuestAdditionsInstall::sltHandleProgressFinished()
4210{
4211 if (!error().isEmpty())
4212 emit sigGuestAdditionsInstallationFailed(m_strSource);
4213}
4214
4215
4216/*********************************************************************************************************************************
4217* Class UINotificationProgressHostOnlyNetworkInterfaceCreate implementation. *
4218*********************************************************************************************************************************/
4219
4220UINotificationProgressHostOnlyNetworkInterfaceCreate::UINotificationProgressHostOnlyNetworkInterfaceCreate(const CHost &comHost,
4221 const CHostNetworkInterface &comInterface)
4222 : m_comHost(comHost)
4223 , m_comInterface(comInterface)
4224{
4225 connect(this, &UINotificationProgress::sigProgressFinished,
4226 this, &UINotificationProgressHostOnlyNetworkInterfaceCreate::sltHandleProgressFinished);
4227}
4228
4229QString UINotificationProgressHostOnlyNetworkInterfaceCreate::name() const
4230{
4231 return UINotificationProgress::tr("Creating Host-only Network Interface ...");
4232}
4233
4234QString UINotificationProgressHostOnlyNetworkInterfaceCreate::details() const
4235{
4236 return UINotificationProgress::tr("<b>Name:</b> %1").arg("TBD");
4237}
4238
4239CProgress UINotificationProgressHostOnlyNetworkInterfaceCreate::createProgress(COMResult &comResult)
4240{
4241 /* Initialize progress-wrapper: */
4242 CProgress comProgress = m_comHost.CreateHostOnlyNetworkInterface(m_comInterface);
4243 /* Store COM result: */
4244 comResult = m_comHost;
4245 /* Return progress-wrapper: */
4246 return comProgress;
4247}
4248
4249void UINotificationProgressHostOnlyNetworkInterfaceCreate::sltHandleProgressFinished()
4250{
4251 if (error().isEmpty())
4252 emit sigHostOnlyNetworkInterfaceCreated(m_comInterface);
4253}
4254
4255
4256/*********************************************************************************************************************************
4257* Class UINotificationProgressHostOnlyNetworkInterfaceRemove implementation. *
4258*********************************************************************************************************************************/
4259
4260UINotificationProgressHostOnlyNetworkInterfaceRemove::UINotificationProgressHostOnlyNetworkInterfaceRemove(const CHost &comHost,
4261 const QUuid &uInterfaceId)
4262 : m_comHost(comHost)
4263 , m_uInterfaceId(uInterfaceId)
4264{
4265 connect(this, &UINotificationProgress::sigProgressFinished,
4266 this, &UINotificationProgressHostOnlyNetworkInterfaceRemove::sltHandleProgressFinished);
4267}
4268
4269QString UINotificationProgressHostOnlyNetworkInterfaceRemove::name() const
4270{
4271 return UINotificationProgress::tr("Removing Host-only Network Interface ...");
4272}
4273
4274QString UINotificationProgressHostOnlyNetworkInterfaceRemove::details() const
4275{
4276 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strInterfaceName);
4277}
4278
4279CProgress UINotificationProgressHostOnlyNetworkInterfaceRemove::createProgress(COMResult &comResult)
4280{
4281 /* Acquire interface: */
4282 CHostNetworkInterface comInterface = m_comHost.FindHostNetworkInterfaceById(m_uInterfaceId);
4283 if (!m_comHost.isOk())
4284 {
4285 comResult = m_comHost;
4286 return CProgress();
4287 }
4288
4289 /* Acquire interface name: */
4290 m_strInterfaceName = comInterface.GetName();
4291 if (!comInterface.isOk())
4292 {
4293 comResult = comInterface;
4294 return CProgress();
4295 }
4296
4297 /* Initialize progress-wrapper: */
4298 CProgress comProgress = m_comHost.RemoveHostOnlyNetworkInterface(m_uInterfaceId);
4299 /* Store COM result: */
4300 comResult = m_comHost;
4301 /* Return progress-wrapper: */
4302 return comProgress;
4303}
4304
4305void UINotificationProgressHostOnlyNetworkInterfaceRemove::sltHandleProgressFinished()
4306{
4307 if (error().isEmpty())
4308 emit sigHostOnlyNetworkInterfaceRemoved(m_strInterfaceName);
4309}
4310
4311
4312/*********************************************************************************************************************************
4313* Class UINotificationProgressVsdFormValueSet implementation. *
4314*********************************************************************************************************************************/
4315
4316UINotificationProgressVsdFormValueSet::UINotificationProgressVsdFormValueSet(const CBooleanFormValue &comValue,
4317 bool fBool)
4318 : m_enmType(KFormValueType_Boolean)
4319 , m_comValue(comValue)
4320 , m_fBool(fBool)
4321{
4322}
4323
4324UINotificationProgressVsdFormValueSet::UINotificationProgressVsdFormValueSet(const CStringFormValue &comValue,
4325 const QString &strString)
4326 : m_enmType(KFormValueType_String)
4327 , m_comValue(comValue)
4328 , m_strString(strString)
4329{
4330}
4331
4332UINotificationProgressVsdFormValueSet::UINotificationProgressVsdFormValueSet(const CChoiceFormValue &comValue,
4333 int iChoice)
4334 : m_enmType(KFormValueType_Choice)
4335 , m_comValue(comValue)
4336 , m_iChoice(iChoice)
4337{
4338}
4339
4340UINotificationProgressVsdFormValueSet::UINotificationProgressVsdFormValueSet(const CRangedIntegerFormValue &comValue,
4341 int iInteger)
4342 : m_enmType(KFormValueType_RangedInteger)
4343 , m_comValue(comValue)
4344 , m_iInteger(iInteger)
4345{
4346}
4347
4348UINotificationProgressVsdFormValueSet::UINotificationProgressVsdFormValueSet(const CRangedInteger64FormValue &comValue,
4349 qlonglong iInteger64)
4350 : m_enmType(KFormValueType_RangedInteger64)
4351 , m_comValue(comValue)
4352 , m_iInteger64(iInteger64)
4353{
4354}
4355
4356QString UINotificationProgressVsdFormValueSet::name() const
4357{
4358 return UINotificationProgress::tr("Set VSD form value ...");
4359}
4360
4361QString UINotificationProgressVsdFormValueSet::details() const
4362{
4363 /* Handle known types: */
4364 switch (m_enmType)
4365 {
4366 case KFormValueType_Boolean: return UINotificationProgress::tr("<b>Value:</b> %1").arg(m_fBool);
4367 case KFormValueType_String: return UINotificationProgress::tr("<b>Value:</b> %1").arg(m_strString);
4368 case KFormValueType_Choice: return UINotificationProgress::tr("<b>Value:</b> %1").arg(m_iChoice);
4369 case KFormValueType_RangedInteger: return UINotificationProgress::tr("<b>Value:</b> %1").arg(m_iInteger);
4370 case KFormValueType_RangedInteger64: return UINotificationProgress::tr("<b>Value:</b> %1").arg(m_iInteger64);
4371 default: break;
4372 }
4373 /* Null-string by default: */
4374 return QString();
4375}
4376
4377CProgress UINotificationProgressVsdFormValueSet::createProgress(COMResult &comResult)
4378{
4379 /* Initialize progress-wrapper: */
4380 CProgress comProgress;
4381
4382 /* Handle known types: */
4383 switch (m_enmType)
4384 {
4385 case KFormValueType_Boolean:
4386 {
4387 /* Set value: */
4388 CBooleanFormValue comValue(m_comValue);
4389 comProgress = comValue.SetSelected(m_fBool);
4390 /* Store COM result: */
4391 comResult = comValue;
4392 break;
4393 }
4394 case KFormValueType_String:
4395 {
4396 /* Set value: */
4397 CStringFormValue comValue(m_comValue);
4398 comProgress = comValue.SetString(m_strString);
4399 /* Store COM result: */
4400 comResult = comValue;
4401 break;
4402 }
4403 case KFormValueType_Choice:
4404 {
4405 /* Set value: */
4406 CChoiceFormValue comValue(m_comValue);
4407 comProgress = comValue.SetSelectedIndex(m_iChoice);
4408 /* Store COM result: */
4409 comResult = comValue;
4410 break;
4411 }
4412 case KFormValueType_RangedInteger:
4413 {
4414 /* Set value: */
4415 CRangedIntegerFormValue comValue(m_comValue);
4416 comProgress = comValue.SetInteger(m_iInteger);
4417 /* Store COM result: */
4418 comResult = comValue;
4419 break;
4420 }
4421 case KFormValueType_RangedInteger64:
4422 {
4423 /* Set value: */
4424 CRangedInteger64FormValue comValue(m_comValue);
4425 comProgress = comValue.SetInteger(m_iInteger64);
4426 /* Store COM result: */
4427 comResult = comValue;
4428 break;
4429 }
4430 default:
4431 break;
4432 }
4433
4434 /* Return progress-wrapper: */
4435 return comProgress;
4436}
4437
4438
4439#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
4440
4441
4442/*********************************************************************************************************************************
4443* Class UINotificationDownloaderExtensionPack implementation. *
4444*********************************************************************************************************************************/
4445
4446/* static */
4447UINotificationDownloaderExtensionPack *UINotificationDownloaderExtensionPack::s_pInstance = 0;
4448
4449/* static */
4450UINotificationDownloaderExtensionPack *UINotificationDownloaderExtensionPack::instance(const QString &strPackName)
4451{
4452 if (!s_pInstance)
4453 new UINotificationDownloaderExtensionPack(strPackName);
4454 return s_pInstance;
4455}
4456
4457/* static */
4458bool UINotificationDownloaderExtensionPack::exists()
4459{
4460 return !!s_pInstance;
4461}
4462
4463UINotificationDownloaderExtensionPack::UINotificationDownloaderExtensionPack(const QString &strPackName)
4464 : m_strPackName(strPackName)
4465{
4466 s_pInstance = this;
4467}
4468
4469UINotificationDownloaderExtensionPack::~UINotificationDownloaderExtensionPack()
4470{
4471 s_pInstance = 0;
4472}
4473
4474QString UINotificationDownloaderExtensionPack::name() const
4475{
4476 return UINotificationDownloader::tr("Downloading Extension Pack ...");
4477}
4478
4479QString UINotificationDownloaderExtensionPack::details() const
4480{
4481 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strPackName);
4482}
4483
4484UIDownloader *UINotificationDownloaderExtensionPack::createDownloader()
4485{
4486 /* Create and configure the Extension Pack downloader: */
4487 UIDownloaderExtensionPack *pDownloader = new UIDownloaderExtensionPack;
4488 if (pDownloader)
4489 {
4490 connect(pDownloader, &UIDownloaderExtensionPack::sigDownloadFinished,
4491 this, &UINotificationDownloaderExtensionPack::sigExtensionPackDownloaded);
4492 return pDownloader;
4493 }
4494 return 0;
4495}
4496
4497
4498/*********************************************************************************************************************************
4499* Class UINotificationDownloaderGuestAdditions implementation. *
4500*********************************************************************************************************************************/
4501
4502/* static */
4503UINotificationDownloaderGuestAdditions *UINotificationDownloaderGuestAdditions::s_pInstance = 0;
4504
4505/* static */
4506UINotificationDownloaderGuestAdditions *UINotificationDownloaderGuestAdditions::instance(const QString &strFileName)
4507{
4508 if (!s_pInstance)
4509 new UINotificationDownloaderGuestAdditions(strFileName);
4510 return s_pInstance;
4511}
4512
4513/* static */
4514bool UINotificationDownloaderGuestAdditions::exists()
4515{
4516 return !!s_pInstance;
4517}
4518
4519UINotificationDownloaderGuestAdditions::UINotificationDownloaderGuestAdditions(const QString &strFileName)
4520 : m_strFileName(strFileName)
4521{
4522 s_pInstance = this;
4523}
4524
4525UINotificationDownloaderGuestAdditions::~UINotificationDownloaderGuestAdditions()
4526{
4527 s_pInstance = 0;
4528}
4529
4530QString UINotificationDownloaderGuestAdditions::name() const
4531{
4532 return UINotificationDownloader::tr("Downloading Guest Additions ...");
4533}
4534
4535QString UINotificationDownloaderGuestAdditions::details() const
4536{
4537 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strFileName);
4538}
4539
4540UIDownloader *UINotificationDownloaderGuestAdditions::createDownloader()
4541{
4542 /* Create and configure the User Manual downloader: */
4543 UIDownloaderGuestAdditions *pDownloader = new UIDownloaderGuestAdditions;
4544 if (pDownloader)
4545 {
4546 connect(pDownloader, &UIDownloaderGuestAdditions::sigDownloadFinished,
4547 this, &UINotificationDownloaderGuestAdditions::sigGuestAdditionsDownloaded);
4548 return pDownloader;
4549 }
4550 return 0;
4551}
4552
4553
4554/*********************************************************************************************************************************
4555* Class UINotificationDownloaderUserManual implementation. *
4556*********************************************************************************************************************************/
4557
4558/* static */
4559UINotificationDownloaderUserManual *UINotificationDownloaderUserManual::s_pInstance = 0;
4560
4561/* static */
4562UINotificationDownloaderUserManual *UINotificationDownloaderUserManual::instance(const QString &strFileName)
4563{
4564 if (!s_pInstance)
4565 new UINotificationDownloaderUserManual(strFileName);
4566 return s_pInstance;
4567}
4568
4569/* static */
4570bool UINotificationDownloaderUserManual::exists()
4571{
4572 return !!s_pInstance;
4573}
4574
4575UINotificationDownloaderUserManual::UINotificationDownloaderUserManual(const QString &strFileName)
4576 : m_strFileName(strFileName)
4577{
4578 s_pInstance = this;
4579}
4580
4581UINotificationDownloaderUserManual::~UINotificationDownloaderUserManual()
4582{
4583 s_pInstance = 0;
4584}
4585
4586QString UINotificationDownloaderUserManual::name() const
4587{
4588 return UINotificationDownloader::tr("Downloading User Manual ...");
4589}
4590
4591QString UINotificationDownloaderUserManual::details() const
4592{
4593 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strFileName);
4594}
4595
4596UIDownloader *UINotificationDownloaderUserManual::createDownloader()
4597{
4598 /* Create and configure the User Manual downloader: */
4599 UIDownloaderUserManual *pDownloader = new UIDownloaderUserManual;
4600 if (pDownloader)
4601 {
4602 connect(pDownloader, &UIDownloaderUserManual::sigDownloadFinished,
4603 this, &UINotificationDownloaderUserManual::sigUserManualDownloaded);
4604 return pDownloader;
4605 }
4606 return 0;
4607}
4608
4609
4610/*********************************************************************************************************************************
4611* Class UINotificationProgressNewVersionChecker implementation. *
4612*********************************************************************************************************************************/
4613
4614UINotificationProgressNewVersionChecker::UINotificationProgressNewVersionChecker(bool fForcedCall)
4615 : m_fForcedCall(fForcedCall)
4616{
4617 connect(this, &UINotificationProgress::sigProgressFinished,
4618 this, &UINotificationProgressNewVersionChecker::sltHandleProgressFinished);
4619
4620#ifdef VBOX_WITH_UPDATE_AGENT
4621 CHost comHost = gpGlobalSession->host();
4622 if (!comHost.isNull())
4623 m_comUpdateHost = comHost.GetUpdateHost();
4624#endif /* VBOX_WITH_UPDATE_AGENT */
4625}
4626
4627QString UINotificationProgressNewVersionChecker::name() const
4628{
4629#ifdef VBOX_WITH_UPDATE_AGENT
4630 if (m_comUpdateHost.isOk())
4631 return UINotificationProgress::tr("Checking for new version of %1 ...").arg(m_comUpdateHost.GetName().toLocal8Bit().data());
4632#endif /* VBOX_WITH_UPDATE_AGENT */
4633 return UINotificationProgress::tr("Checking for new version ...");
4634}
4635
4636QString UINotificationProgressNewVersionChecker::details() const
4637{
4638 return QString();
4639}
4640
4641CProgress UINotificationProgressNewVersionChecker::createProgress(COMResult &comResult)
4642{
4643#ifdef VBOX_WITH_UPDATE_AGENT
4644 if (!m_comUpdateHost.isOk())
4645 return CProgress();
4646
4647 CProgress comProgress = m_comUpdateHost.CheckFor();
4648 comResult = m_comUpdateHost;
4649
4650 return comProgress;
4651#else
4652 return CProgress();
4653#endif /* VBOX_WITH_UPDATE_AGENT */
4654}
4655
4656void UINotificationProgressNewVersionChecker::sltHandleProgressFinished()
4657{
4658#ifdef VBOX_WITH_UPDATE_AGENT
4659 if (m_comUpdateHost.isNull() && !m_comUpdateHost.isOk())
4660 return;
4661
4662 bool const fUpdateAvailable = m_comUpdateHost.GetState() == KUpdateState_Available; /** @todo Handle other states. */
4663 if (!m_comUpdateHost.isOk())
4664 return;
4665
4666 if (fUpdateAvailable)
4667 {
4668 QString strVersion = m_comUpdateHost.GetVersion();
4669 if (!m_comUpdateHost.isOk())
4670 return;
4671
4672 QString strURL = m_comUpdateHost.GetDownloadUrl();
4673 if (!m_comUpdateHost.isOk())
4674 return;
4675
4676 UINotificationMessage::showUpdateSuccess(strVersion, strURL);
4677 }
4678 else
4679 {
4680 if (m_fForcedCall)
4681 UINotificationMessage::showUpdateNotFound();
4682 }
4683#endif /* VBOX_WITH_UPDATE_AGENT */
4684}
4685
4686#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
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