VirtualBox

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

Last change on this file was 104313, checked in by vboxsync, 6 weeks ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in the settings related GUI classes.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use