VirtualBox

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

Last change on this file since 105266 was 105081, checked in by vboxsync, 9 months ago

FE/Qt: Moving local machine related stuff from UICommon to new UILocalMachineStuff namespace; Reworking GUI to use it accordingly; Dependencies and includes cleanup.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette