VirtualBox

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

Last change on this file since 100347 was 100064, checked in by vboxsync, 20 months ago

FE/Qt: bugref:10421. Replacing VBOX_WS_X11 with VBOX_WS_NIX.

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