VirtualBox

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

Last change on this file was 105819, checked in by vboxsync, 4 weeks ago

FE/Qt: A bit of NLS fixes for Message-center and Notification-center, same context.

  • 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 105819 2024-08-22 14:20:59Z 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::warnAboutClipboardError(const QString &strMsg)
152{
153 createMessage(
154 QApplication::translate("UIMessageCenter", "Shared clipboard error ..."),
155 strMsg.toUtf8().constData());
156}
157
158#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
159/* static */
160void UINotificationMessage::showUpdateNotFound()
161{
162 createMessage(
163 QApplication::translate("UIMessageCenter", "Nothing to update ..."),
164 QApplication::translate("UIMessageCenter", "You are already running the most recent version of VirtualBox."));
165}
166
167/* static */
168void UINotificationMessage::showUpdateSuccess(const QString &strVersion, const QString &strLink)
169{
170 createMessage(
171 QApplication::translate("UIMessageCenter", "New version found ..."),
172 QApplication::translate("UIMessageCenter", "<p>A new version of VirtualBox has been released! Version <b>%1</b> is available "
173 "at <a href=\"https://www.virtualbox.org/\">virtualbox.org</a>.</p>"
174 "<p>You can download this version using the link:</p>"
175 "<p><a href=%2>%3</a></p>").arg(strVersion, strLink, strLink));
176}
177
178/* static */
179void UINotificationMessage::askUserToDownloadExtensionPack(const QString &strExtPackName,
180 const QString &strExtPackVersion,
181 const QString &strVBoxVersion)
182{
183 createMessage(
184 QApplication::translate("UIMessageCenter", "Update is required ..."),
185 QApplication::translate("UIMessageCenter", "<p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p>"
186 "<p>You should download and install version %3 of this extension pack from "
187 "Oracle!</p>").arg(strExtPackVersion, strExtPackName, strVBoxVersion));
188}
189
190/* static */
191void UINotificationMessage::cannotValidateGuestAdditionsSHA256Sum(const QString &strUrl,
192 const QString &strSrc)
193{
194 createMessage(
195 QApplication::translate("UIMessageCenter", "Unable to validate guest additions image ..."),
196 QApplication::translate("UIMessageCenter", "<p>The <b>VirtualBox Guest Additions</b> disk image file has been "
197 "successfully downloaded from <nobr><a href=\"%1\">%1</a></nobr> and saved "
198 "locally as <nobr><b>%2</b>, </nobr>but the SHA-256 checksum verification "
199 "failed.</p><p>Please do the download, installation and verification "
200 "manually.</p>").arg(strUrl, strSrc));
201}
202
203/* static */
204void UINotificationMessage::warnAboutUserManualDownloaded(const QString &strUrl, const QString &strTarget)
205{
206 createMessage(
207 QApplication::translate("UIMessageCenter", "User guide downloaded ..."),
208 QApplication::translate("UIMessageCenter", "<p>The VirtualBox User Guide has been successfully downloaded from "
209 "<nobr><a href=\"%1\">%1</a></nobr> and saved locally as "
210 "<nobr><b>%2</b>.</nobr></p>").arg(strUrl, strTarget));
211}
212
213/* static */
214void UINotificationMessage::cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName,
215 const QString &strFrom,
216 const QString &strTo)
217{
218 createMessage(
219 QApplication::translate("UIMessageCenter", "Unable to validate extension pack ..."),
220 QApplication::translate("UIMessageCenter", "<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
221 "from <nobr><a href=\"%2\">%2</a></nobr> and saved locally as "
222 "<nobr><b>%3</b>, </nobr>but the SHA-256 checksum verification failed.</p>"
223 "<p>Please do the download, installation and verification manually.</p>")
224 .arg(strExtPackName, strFrom, strTo));
225}
226#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
227
228/* static */
229void UINotificationMessage::cannotCreateMachineFolder(const QString &strPath,
230 UINotificationCenter *pParent /* = 0 */)
231{
232 createMessage(
233 QApplication::translate("UIMessageCenter", "Can't create machine folder ..."),
234 QApplication::translate("UIMessageCenter", "Failed to create machine folder at <nobr><b>%1</b></nobr>.")
235 .arg(strPath),
236 QString(), QString(), pParent);
237}
238
239/* static */
240void UINotificationMessage::cannotOverwriteMachineFolder(const QString &strPath,
241 UINotificationCenter *pParent /* = 0 */)
242{
243 createMessage(
244 QApplication::translate("UIMessageCenter", "Can't overwrite machine folder ..."),
245 QApplication::translate("UIMessageCenter", "Failed to overwrite machine folder at <nobr><b>%1</b></nobr>.")
246 .arg(strPath),
247 QString(), QString(), pParent);
248}
249
250/* static */
251void UINotificationMessage::cannotRemoveMachineFolder(const QString &strPath,
252 UINotificationCenter *pParent /* = 0 */)
253{
254 createMessage(
255 QApplication::translate("UIMessageCenter", "Can't remove machine folder ..."),
256 QApplication::translate("UIMessageCenter", "Failed to remove machine folder at <nobr><b>%1</b></nobr>.")
257 .arg(strPath),
258 QString(), QString(), pParent);
259}
260
261/* static */
262void UINotificationMessage::cannotReregisterExistingMachine(const QString &strName, const QString &strLocation)
263{
264 createMessage(
265 QApplication::translate("UIMessageCenter", "Can't add machine ..."),
266 QApplication::translate("UIMessageCenter", "Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its "
267 "already present.")
268 .arg(strName, strLocation));
269}
270
271/* static */
272void UINotificationMessage::cannotResolveCollisionAutomatically(const QString &strCollisionName, const QString &strGroupName)
273{
274 createMessage(
275 QApplication::translate("UIMessageCenter", "Can't resolve collision ..."),
276 QApplication::translate("UIMessageCenter", "<p>You are trying to move machine <nobr><b>%1</b></nobr> to group "
277 "<nobr><b>%2</b></nobr> which already have another item with the same "
278 "name.</p><p>Please resolve this name conflict and try again.</p>")
279 .arg(strCollisionName, strGroupName));
280}
281
282/* static */
283void UINotificationMessage::cannotAcquireCloudMachineSettings(const QString &strErrorDetails)
284{
285 createMessage(
286 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
287 QApplication::translate("UIMessageCenter", "Failed to acquire cloud machine settings.") +
288 strErrorDetails);
289}
290
291/* static */
292void UINotificationMessage::cannotCreateMediumStorageInFAT(const QString &strPath,
293 UINotificationCenter *pParent /* = 0 */)
294{
295 createMessage(
296 QApplication::translate("UIMessageCenter", "Can't create medium ..."),
297 QApplication::translate("UIMessageCenter", "Failed to create medium storage at <nobr><b>%1</b></nobr>.")
298 .arg(strPath),
299 QString(), QString(), pParent);
300}
301
302/* static */
303void UINotificationMessage::cannotOverwriteMediumStorage(const QString &strPath,
304 UINotificationCenter *pParent /* = 0 */)
305{
306 createMessage(
307 QApplication::translate("UIMessageCenter", "Can't overwrite medium ..."),
308 QApplication::translate("UIMessageCenter", "Failed to overwrite medium storage at <nobr><b>%1</b></nobr>.")
309 .arg(strPath),
310 QString(), QString(), pParent);
311}
312
313/* static */
314void UINotificationMessage::cannotOpenLicenseFile(const QString &strPath)
315{
316 createMessage(
317 QApplication::translate("UIMessageCenter", "Can't open license file ..."),
318 QApplication::translate("UIMessageCenter", "Failed to open the license file <nobr><b>%1</b></nobr>. Check file "
319 "permissions.").arg(strPath));
320}
321
322/* static */
323void UINotificationMessage::warnAboutPublicKeyFilePathIsEmpty()
324{
325 createMessage(
326 QApplication::translate("UIMessageCenter", "Public key missing ..."),
327 QApplication::translate("UIMessageCenter", "Public key file path is empty."));
328}
329
330/* static */
331void UINotificationMessage::warnAboutPublicKeyFileDoesntExist(const QString &strPath)
332{
333 createMessage(
334 QApplication::translate("UIMessageCenter", "Public key missing ..."),
335 QApplication::translate("UIMessageCenter", "Failed to open the public key file <nobr><b>%1</b></nobr>. "
336 "File doesn't exist.").arg(strPath));
337}
338
339/* static */
340void UINotificationMessage::warnAboutPublicKeyFileIsOfTooLargeSize(const QString &strPath)
341{
342 createMessage(
343 QApplication::translate("UIMessageCenter", "Public key too large ..."),
344 QApplication::translate("UIMessageCenter", "Failed to open the public key file <nobr><b>%1</b></nobr>. File is too "
345 "large for the key.").arg(strPath));
346}
347
348/* static */
349void UINotificationMessage::warnAboutPublicKeyFileIsntReadable(const QString &strPath)
350{
351 createMessage(
352 QApplication::translate("UIMessageCenter", "Public key isn't readable ..."),
353 QApplication::translate("UIMessageCenter", "Failed to open the public key file <nobr><b>%1</b></nobr>. Check file "
354 "permissions.").arg(strPath));
355}
356
357/* static */
358void UINotificationMessage::warnAboutDHCPServerIsNotEnabled(const QString &strName)
359{
360 createMessage(
361 QApplication::translate("UIMessageCenter", "DHCP server isn't enabled ..."),
362 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> is set to obtain the address "
363 "automatically but the corresponding DHCP server is not enabled.")
364 .arg(strName));
365}
366
367/* static */
368void UINotificationMessage::warnAboutInvalidIPv4Address(const QString &strName)
369{
370 createMessage(
371 QApplication::translate("UIMessageCenter", "Invalid IPv4 address ..."),
372 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
373 "currently have a valid IPv4 address.")
374 .arg(strName));
375}
376
377/* static */
378void UINotificationMessage::warnAboutInvalidIPv4Mask(const QString &strName)
379{
380 createMessage(
381 QApplication::translate("UIMessageCenter", "Invalid IPv4 mask ..."),
382 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
383 "currently have a valid IPv4 mask.")
384 .arg(strName));
385}
386
387/* static */
388void UINotificationMessage::warnAboutInvalidIPv6Address(const QString &strName)
389{
390 createMessage(
391 QApplication::translate("UIMessageCenter", "Invalid IPv6 address ..."),
392 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
393 "currently have a valid IPv6 address.")
394 .arg(strName));
395}
396
397/* static */
398void UINotificationMessage::warnAboutInvalidIPv6PrefixLength(const QString &strName)
399{
400 createMessage(
401 QApplication::translate("UIMessageCenter", "Invalid IPv6 prefix length ..."),
402 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
403 "currently have a valid IPv6 prefix length.")
404 .arg(strName));
405}
406
407/* static */
408void UINotificationMessage::warnAboutInvalidDHCPServerAddress(const QString &strName)
409{
410 createMessage(
411 QApplication::translate("UIMessageCenter", "Invalid DHCP server address ..."),
412 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
413 "currently have a valid DHCP server address.")
414 .arg(strName));
415}
416
417/* static */
418void UINotificationMessage::warnAboutInvalidDHCPServerMask(const QString &strName)
419{
420 createMessage(
421 QApplication::translate("UIMessageCenter", "Invalid DHCP server mask ..."),
422 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
423 "currently have a valid DHCP server mask.")
424 .arg(strName));
425}
426
427/* static */
428void UINotificationMessage::warnAboutInvalidDHCPServerLowerAddress(const QString &strName)
429{
430 createMessage(
431 QApplication::translate("UIMessageCenter", "Invalid DHCP lower address ..."),
432 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
433 "currently have a valid DHCP server lower address bound.")
434 .arg(strName));
435}
436
437/* static */
438void UINotificationMessage::warnAboutInvalidDHCPServerUpperAddress(const QString &strName)
439{
440 createMessage(
441 QApplication::translate("UIMessageCenter", "Invalid DHCP upper address ..."),
442 QApplication::translate("UIMessageCenter", "Network <nobr><b>%1</b></nobr> does not "
443 "currently have a valid DHCP server upper address bound.")
444 .arg(strName));
445}
446
447/* static */
448void UINotificationMessage::warnAboutNoNameSpecified(const QString &strName)
449{
450 createMessage(
451 QApplication::translate("UIMessageCenter", "No name specified ..."),
452 QApplication::translate("UIMessageCenter", "No new name specified for the network previously called <b>%1</b>.")
453 .arg(strName));
454}
455
456/* static */
457void UINotificationMessage::warnAboutNameAlreadyBusy(const QString &strName)
458{
459 createMessage(
460 QApplication::translate("UIMessageCenter", "Name already busy ..."),
461 QApplication::translate("UIMessageCenter", "The name <b>%1</b> is being used for several networks.")
462 .arg(strName));
463}
464
465/* static */
466void UINotificationMessage::warnAboutNoIPv4PrefixSpecified(const QString &strName)
467{
468 createMessage(
469 QApplication::translate("UIMessageCenter", "No IPv4 prefix specified ..."),
470 QApplication::translate("UIMessageCenter", "No IPv4 prefix specified for the NAT network <b>%1</b>.")
471 .arg(strName));
472}
473
474/* static */
475void UINotificationMessage::warnAboutNoIPv6PrefixSpecified(const QString &strName)
476{
477 createMessage(
478 QApplication::translate("UIMessageCenter", "No IPv6 prefix specified ..."),
479 QApplication::translate("UIMessageCenter", "No IPv6 prefix specified for the NAT network <b>%1</b>.")
480 .arg(strName));
481}
482
483/* static */
484void UINotificationMessage::cannotMountImage(const QString &strMachineName, const QString &strMediumName)
485{
486 createMessage(
487 QApplication::translate("UIMessageCenter", "Can't mount image ..."),
488 QApplication::translate("UIMessageCenter", "<p>Could not insert the <b>%1</b> disk image file into the virtual machine "
489 "<b>%2</b>, as the machine has no optical drives. Please add a drive using "
490 "the storage page of the virtual machine settings window.</p>")
491 .arg(strMediumName, strMachineName));
492}
493
494/* static */
495void UINotificationMessage::cannotSendACPIToMachine()
496{
497 createMessage(
498 QApplication::translate("UIMessageCenter", "Can't send ACPI shutdown ..."),
499 QApplication::translate("UIMessageCenter", "You are trying to shut down the guest with the ACPI power button. "
500 "This is currently not possible because the guest does not support "
501 "software shutdown."));
502}
503
504/* static */
505void UINotificationMessage::remindAboutAutoCapture()
506{
507 createMessage(
508 QApplication::translate("UIMessageCenter", "Auto capture keyboard ..."),
509 QApplication::translate("UIMessageCenter", "<p>You have the <b>Auto capture keyboard</b> option turned on. "
510 "This will cause the Virtual Machine to automatically <b>capture</b> "
511 "the keyboard every time the VM window is activated and make it "
512 "unavailable to other applications running on your host machine: "
513 "when the keyboard is captured, all keystrokes (including system ones "
514 "like Alt-Tab) will be directed to the VM.</p>"
515 "<p>You can press the <b>host key combo</b> at any time to <b>uncapture</b> the "
516 "keyboard and mouse (if it is captured) and return them to normal "
517 "operation. The currently assigned host key combo is shown on the status bar "
518 "at the bottom of the Virtual Machine window. This icon, together "
519 "with the mouse icon placed nearby, indicate the current keyboard "
520 "and mouse capture state.</p>") +
521 QApplication::translate("UIMessageCenter", "<p>The host key combo is currently defined as <b>%1</b>.</p>",
522 "additional message box paragraph")
523 .arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
524 "remindAboutAutoCapture");
525}
526
527/* static */
528void UINotificationMessage::remindAboutGuestAdditionsAreNotActive()
529{
530 createMessage(
531 QApplication::translate("UIMessageCenter", "Guest additions inactive ..."),
532 QApplication::translate("UIMessageCenter", "<p>The VirtualBox Guest Additions do not appear to be available on this "
533 "virtual machine, and shared folders cannot be used without them. To use "
534 "shared folders inside the virtual machine, please install the Guest "
535 "Additions if they are not installed, or re-install them if they are not "
536 "working correctly, by selecting <b>Insert Guest Additions CD image</b> from "
537 "the <b>Devices</b> menu. If they are installed but the machine is not yet "
538 "fully started then shared folders will be available once it is.</p>"),
539 "remindAboutGuestAdditionsAreNotActive");
540}
541
542/* static */
543void UINotificationMessage::remindAboutMouseIntegration(bool fSupportsAbsolute)
544{
545 if (fSupportsAbsolute)
546 {
547 createMessage(
548 QApplication::translate("UIMessageCenter", "Mouse integration ..."),
549 QApplication::translate("UIMessageCenter", "<p>The Virtual Machine reports that the guest OS supports <b>mouse "
550 "pointer integration</b>. This means that you do not need to "
551 "<i>capture</i> the mouse pointer to be able to use it in your guest "
552 "OS -- all mouse actions you perform when the mouse pointer is over the "
553 "Virtual Machine's display are directly sent to the guest OS. If the "
554 "mouse is currently captured, it will be automatically uncaptured.</p>"
555 "<p>The mouse icon on the status bar will look "
556 "like&nbsp;<img src=:/mouse_seamless_16px.png/>&nbsp;to inform you that "
557 "mouse pointer integration is supported by the guest OS and is currently "
558 "turned on.</p><p><b>Note</b>: Some applications may behave incorrectly "
559 "in mouse pointer integration mode. You can always disable it for the "
560 "current session (and enable it again) by selecting the corresponding "
561 "action from the menu bar.</p>"),
562 "remindAboutMouseIntegration");
563 }
564 else
565 {
566 createMessage(
567 QApplication::translate("UIMessageCenter", "Mouse integration ..."),
568 QApplication::translate("UIMessageCenter", "<p>The Virtual Machine reports that the guest OS does not support "
569 "<b>mouse pointer integration</b> in the current video mode. You need to "
570 "capture the mouse (by clicking over the VM display or pressing the host "
571 "key) in order to use the mouse inside the guest OS.</p>"),
572 "remindAboutMouseIntegration");
573 }
574}
575
576/* static */
577void UINotificationMessage::remindAboutPausedVMInput()
578{
579 createMessage(
580 QApplication::translate("UIMessageCenter", "Paused VM input ..."),
581 QApplication::translate("UIMessageCenter", "<p>The Virtual Machine is currently in the <b>Paused</b> state and not able "
582 "to see any keyboard or mouse input. If you want to continue to work inside "
583 "the VM, you need to resume it by selecting the corresponding action from the "
584 "menu bar.</p>"),
585 "remindAboutPausedVMInput");
586}
587
588/* static */
589void UINotificationMessage::forgetAboutPausedVMInput()
590{
591 destroyMessage("remindAboutPausedVMInput");
592}
593
594/* static */
595void UINotificationMessage::remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP)
596{
597 createMessage(
598 QApplication::translate("UIMessageCenter", "Wrong color depth ..."),
599 QApplication::translate("UIMessageCenter", "<p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. "
600 "For better performance please change this to <b>%2&nbsp;bit</b>. This can "
601 "usually be done from the <b>Display</b> section of the guest operating "
602 "system's Control Panel or System Settings.</p>")
603 .arg(uRealBPP).arg(uWantedBPP),
604 "remindAboutWrongColorDepth");
605}
606
607/* static */
608void UINotificationMessage::forgetAboutWrongColorDepth()
609{
610 destroyMessage("remindAboutWrongColorDepth");
611}
612
613/* static */
614void UINotificationMessage::cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox,
615 UINotificationCenter *pParent /* = 0 */)
616{
617 createMessage(
618 QApplication::translate("UIMessageCenter", "VirtualBox failure ..."),
619 QApplication::translate("UIMessageCenter", "Failed to acquire VirtualBox parameter.") +
620 UIErrorString::formatErrorInfo(comVBox),
621 QString(), QString(), pParent);
622}
623
624/* static */
625void UINotificationMessage::cannotAcquireApplianceParameter(const CAppliance &comAppliance,
626 UINotificationCenter *pParent /* = 0 */)
627{
628 createMessage(
629 QApplication::translate("UIMessageCenter", "Appliance failure ..."),
630 QApplication::translate("UIMessageCenter", "Failed to acquire appliance parameter.") +
631 UIErrorString::formatErrorInfo(comAppliance),
632 QString(), QString(), pParent);
633}
634
635/* static */
636void UINotificationMessage::cannotAcquirePlatformParameter(const CPlatform &comPlatform)
637{
638 createMessage(
639 QApplication::translate("UIMessageCenter", "Platform failure ..."),
640 QApplication::translate("UIMessageCenter", "Failed to acquire platform parameter.") +
641 UIErrorString::formatErrorInfo(comPlatform));
642}
643
644/* static */
645void UINotificationMessage::cannotAcquirePlatformPropertiesParameter(const CPlatformProperties &comProperties)
646{
647 createMessage(
648 QApplication::translate("UIMessageCenter", "Platform properties failure ..."),
649 QApplication::translate("UIMessageCenter", "Failed to acquire platform properties parameter.") +
650 UIErrorString::formatErrorInfo(comProperties));
651}
652
653/* static */
654void UINotificationMessage::cannotAcquireSystemPropertiesParameter(const CSystemProperties &comProperties)
655{
656 createMessage(
657 QApplication::translate("UIMessageCenter", "System properties failure ..."),
658 QApplication::translate("UIMessageCenter", "Failed to acquire system properties parameter.") +
659 UIErrorString::formatErrorInfo(comProperties));
660}
661
662/* static */
663void UINotificationMessage::cannotAcquireExtensionPackManagerParameter(const CExtPackManager &comEPManager)
664{
665 createMessage(
666 QApplication::translate("UIMessageCenter", "Extension Pack failure ..."),
667 QApplication::translate("UIMessageCenter", "Failed to acquire Extension Pack Manager parameter.") +
668 UIErrorString::formatErrorInfo(comEPManager));
669}
670
671/* static */
672void UINotificationMessage::cannotAcquireExtensionPackParameter(const CExtPack &comPackage)
673{
674 createMessage(
675 QApplication::translate("UIMessageCenter", "Extension Pack failure ..."),
676 QApplication::translate("UIMessageCenter", "Failed to acquire Extension Pack parameter.") +
677 UIErrorString::formatErrorInfo(comPackage));
678}
679
680/* static */
681void UINotificationMessage::cannotAcquireHostParameter(const CHost &comHost)
682{
683 createMessage(
684 QApplication::translate("UIMessageCenter", "Host failure ..."),
685 QApplication::translate("UIMessageCenter", "Failed to acquire host parameter.") +
686 UIErrorString::formatErrorInfo(comHost));
687}
688
689/* static */
690void UINotificationMessage::cannotAcquireStorageControllerParameter(const CStorageController &comStorageController)
691{
692 createMessage(
693 QApplication::translate("UIMessageCenter", "Storage controller failure ..."),
694 QApplication::translate("UIMessageCenter", "Failed to acquire storage controller parameter.") +
695 UIErrorString::formatErrorInfo(comStorageController));
696}
697
698/* static */
699void UINotificationMessage::cannotAcquireMediumAttachmentParameter(const CMediumAttachment &comMediumAttachment)
700{
701 createMessage(
702 QApplication::translate("UIMessageCenter", "Medium attachment failure ..."),
703 QApplication::translate("UIMessageCenter", "Failed to acquire medium attachment parameter.") +
704 UIErrorString::formatErrorInfo(comMediumAttachment));
705}
706
707/* static */
708void UINotificationMessage::cannotAcquireMediumParameter(const CMedium &comMedium)
709{
710 createMessage(
711 QApplication::translate("UIMessageCenter", "Medium failure ..."),
712 QApplication::translate("UIMessageCenter", "Failed to acquire medium parameter.") +
713 UIErrorString::formatErrorInfo(comMedium));
714}
715
716/* static */
717void UINotificationMessage::cannotAcquireSessionParameter(const CSession &comSession)
718{
719 createMessage(
720 QApplication::translate("UIMessageCenter", "Session failure ..."),
721 QApplication::translate("UIMessageCenter", "Failed to acquire session parameter.") +
722 UIErrorString::formatErrorInfo(comSession));
723}
724
725/* static */
726void UINotificationMessage::cannotAcquireMachineParameter(const CMachine &comMachine)
727{
728 createMessage(
729 QApplication::translate("UIMessageCenter", "Machine failure ..."),
730 QApplication::translate("UIMessageCenter", "Failed to acquire machine parameter.") +
731 UIErrorString::formatErrorInfo(comMachine));
732}
733
734/* static */
735void UINotificationMessage::cannotAcquireMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger)
736{
737 createMessage(
738 QApplication::translate("UIMessageCenter", "Debugger failure ..."),
739 QApplication::translate("UIMessageCenter", "Failed to acquire machine debugger parameter.") +
740 UIErrorString::formatErrorInfo(comMachineDebugger));
741}
742
743/* static */
744void UINotificationMessage::cannotAcquireGraphicsAdapterParameter(const CGraphicsAdapter &comAdapter)
745{
746 createMessage(
747 QApplication::translate("UIMessageCenter", "Graphics adapter failure ..."),
748 QApplication::translate("UIMessageCenter", "Failed to acquire graphics adapter parameter.") +
749 UIErrorString::formatErrorInfo(comAdapter));
750}
751
752/* static */
753void UINotificationMessage::cannotAcquireAudioSettingsParameter(const CAudioSettings &comSettings)
754{
755 createMessage(
756 QApplication::translate("UIMessageCenter", "Audio settings failure ..."),
757 QApplication::translate("UIMessageCenter", "Failed to acquire audio settings parameter.") +
758 UIErrorString::formatErrorInfo(comSettings));
759}
760
761/* static */
762void UINotificationMessage::cannotAcquireAudioAdapterParameter(const CAudioAdapter &comAdapter)
763{
764 createMessage(
765 QApplication::translate("UIMessageCenter", "Audio adapter failure ..."),
766 QApplication::translate("UIMessageCenter", "Failed to acquire audio adapter parameter.") +
767 UIErrorString::formatErrorInfo(comAdapter));
768}
769
770/* static */
771void UINotificationMessage::cannotAcquireNetworkAdapterParameter(const CNetworkAdapter &comAdapter)
772{
773 createMessage(
774 QApplication::translate("UIMessageCenter", "Network adapter failure ..."),
775 QApplication::translate("UIMessageCenter", "Failed to acquire network adapter parameter.") +
776 UIErrorString::formatErrorInfo(comAdapter));
777}
778
779/* static */
780void UINotificationMessage::cannotAcquireConsoleParameter(const CConsole &comConsole)
781{
782 createMessage(
783 QApplication::translate("UIMessageCenter", "Console failure ..."),
784 QApplication::translate("UIMessageCenter", "Failed to acquire console parameter.") +
785 UIErrorString::formatErrorInfo(comConsole));
786}
787
788/* static */
789void UINotificationMessage::cannotAcquireGuestParameter(const CGuest &comGuest)
790{
791 createMessage(
792 QApplication::translate("UIMessageCenter", "Guest failure ..."),
793 QApplication::translate("UIMessageCenter", "Failed to acquire guest parameter.") +
794 UIErrorString::formatErrorInfo(comGuest));
795}
796
797/* static */
798void UINotificationMessage::cannotAcquireGuestOSTypeParameter(const CGuestOSType &comGuestOSType)
799{
800 createMessage(
801 QApplication::translate("UIMessageCenter", "Guest OS type failure ..."),
802 QApplication::translate("UIMessageCenter", "Failed to acquire guest OS type parameter.") +
803 UIErrorString::formatErrorInfo(comGuestOSType));
804}
805
806/* static */
807void UINotificationMessage::cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot)
808{
809 createMessage(
810 QApplication::translate("UIMessageCenter", "Snapshot failure ..."),
811 QApplication::translate("UIMessageCenter", "Failed to acquire snapshot parameter.") +
812 UIErrorString::formatErrorInfo(comSnapshot));
813}
814
815/* static */
816void UINotificationMessage::cannotAcquireDHCPServerParameter(const CDHCPServer &comServer)
817{
818 createMessage(
819 QApplication::translate("UIMessageCenter", "DHCP server failure ..."),
820 QApplication::translate("UIMessageCenter", "Failed to acquire DHCP server parameter.") +
821 UIErrorString::formatErrorInfo(comServer));
822}
823
824/* static */
825void UINotificationMessage::cannotAcquireCloudNetworkParameter(const CCloudNetwork &comNetwork)
826{
827 createMessage(
828 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
829 QApplication::translate("UIMessageCenter", "Failed to acquire cloud network parameter.") +
830 UIErrorString::formatErrorInfo(comNetwork));
831}
832
833/* static */
834void UINotificationMessage::cannotAcquireHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface)
835{
836 createMessage(
837 QApplication::translate("UIMessageCenter", "Host network interface failure ..."),
838 QApplication::translate("UIMessageCenter", "Failed to acquire host network interface parameter.") +
839 UIErrorString::formatErrorInfo(comInterface));
840}
841
842/* static */
843void UINotificationMessage::cannotAcquireHostOnlyNetworkParameter(const CHostOnlyNetwork &comNetwork)
844{
845 createMessage(
846 QApplication::translate("UIMessageCenter", "Host only network failure ..."),
847 QApplication::translate("UIMessageCenter", "Failed to acquire host only network parameter.") +
848 UIErrorString::formatErrorInfo(comNetwork));
849}
850
851/* static */
852void UINotificationMessage::cannotAcquireNATNetworkParameter(const CNATNetwork &comNetwork)
853{
854 createMessage(
855 QApplication::translate("UIMessageCenter", "NAT network failure ..."),
856 QApplication::translate("UIMessageCenter", "Failed to acquire NAT network parameter.") +
857 UIErrorString::formatErrorInfo(comNetwork));
858}
859
860/* static */
861void UINotificationMessage::cannotAcquireDisplayParameter(const CDisplay &comDisplay)
862{
863 createMessage(
864 QApplication::translate("UIMessageCenter", "Display failure ..."),
865 QApplication::translate("UIMessageCenter", "Failed to acquire display parameter.") +
866 UIErrorString::formatErrorInfo(comDisplay));
867}
868
869/* static */
870void UINotificationMessage::cannotAcquireUpdateAgentParameter(const CUpdateAgent &comAgent)
871{
872 createMessage(
873 QApplication::translate("UIMessageCenter", "Update failure ..."),
874 QApplication::translate("UIMessageCenter", "Failed to acquire update agent parameter.") +
875 UIErrorString::formatErrorInfo(comAgent));
876}
877
878/* static */
879void UINotificationMessage::cannotAcquireMouseParameter(const CMouse &comMouse)
880{
881 createMessage(
882 QApplication::translate("UIMessageCenter", "Mouse failure ..."),
883 QApplication::translate("UIMessageCenter", "Failed to acquire mouse parameter.") +
884 UIErrorString::formatErrorInfo(comMouse));
885}
886
887/* static */
888void UINotificationMessage::cannotAcquireEmulatedUSBParameter(const CEmulatedUSB &comDispatcher)
889{
890 createMessage(
891 QApplication::translate("UIMessageCenter", "Emulated USB failure ..."),
892 QApplication::translate("UIMessageCenter", "Failed to acquire emulated USB parameter.") +
893 UIErrorString::formatErrorInfo(comDispatcher));
894}
895
896/* static */
897void UINotificationMessage::cannotAcquireRecordingSettingsParameter(const CRecordingSettings &comSettings)
898{
899 createMessage(
900 QApplication::translate("UIMessageCenter", "Recording settings failure ..."),
901 QApplication::translate("UIMessageCenter", "Failed to acquire recording settings parameter.") +
902 UIErrorString::formatErrorInfo(comSettings));
903}
904
905/* static */
906void UINotificationMessage::cannotAcquireVRDEServerParameter(const CVRDEServer &comServer)
907{
908 createMessage(
909 QApplication::translate("UIMessageCenter", "VRDE server failure ..."),
910 QApplication::translate("UIMessageCenter", "Failed to acquire VRDE server parameter.") +
911 UIErrorString::formatErrorInfo(comServer));
912}
913
914/* static */
915void UINotificationMessage::cannotAcquireVRDEServerInfoParameter(const CVRDEServerInfo &comServerInfo)
916{
917 createMessage(
918 QApplication::translate("UIMessageCenter", "VRDE server info failure ..."),
919 QApplication::translate("UIMessageCenter", "Failed to acquire VRDE server info parameter.") +
920 UIErrorString::formatErrorInfo(comServerInfo));
921}
922
923/* static */
924void UINotificationMessage::cannotAcquireVirtualSystemDescriptionParameter(const CVirtualSystemDescription &comVsd,
925 UINotificationCenter *pParent /* = 0 */)
926{
927 createMessage(
928 QApplication::translate("UIMessageCenter", "VSD failure ..."),
929 QApplication::translate("UIMessageCenter", "Failed to acquire VSD parameter.") +
930 UIErrorString::formatErrorInfo(comVsd),
931 QString(), QString(), pParent);
932}
933
934/* static */
935void UINotificationMessage::cannotAcquireVirtualSystemDescriptionFormParameter(const CVirtualSystemDescriptionForm &comVsdForm,
936 UINotificationCenter *pParent /* = 0 */)
937{
938 createMessage(
939 QApplication::translate("UIMessageCenter", "VSD form failure ..."),
940 QApplication::translate("UIMessageCenter", "Failed to acquire VSD form parameter.") +
941 UIErrorString::formatErrorInfo(comVsdForm),
942 QString(), QString(), pParent);
943}
944
945/* static */
946void UINotificationMessage::cannotAcquireCloudProviderManagerParameter(const CCloudProviderManager &comCloudProviderManager,
947 UINotificationCenter *pParent /* = 0 */)
948{
949 createMessage(
950 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
951 QApplication::translate("UIMessageCenter", "Failed to acquire cloud provider manager parameter.") +
952 UIErrorString::formatErrorInfo(comCloudProviderManager),
953 QString(), QString(), pParent);
954}
955
956/* static */
957void UINotificationMessage::cannotAcquireCloudProviderParameter(const CCloudProvider &comCloudProvider,
958 UINotificationCenter *pParent /* = 0 */)
959{
960 createMessage(
961 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
962 QApplication::translate("UIMessageCenter", "Failed to acquire cloud provider parameter.") +
963 UIErrorString::formatErrorInfo(comCloudProvider),
964 QString(), QString(), pParent);
965}
966
967/* static */
968void UINotificationMessage::cannotAcquireCloudProfileParameter(const CCloudProfile &comCloudProfile,
969 UINotificationCenter *pParent /* = 0 */)
970{
971 createMessage(
972 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
973 QApplication::translate("UIMessageCenter", "Failed to acquire cloud profile parameter.") +
974 UIErrorString::formatErrorInfo(comCloudProfile),
975 QString(), QString(), pParent);
976}
977
978/* static */
979void UINotificationMessage::cannotAcquireCloudMachineParameter(const CCloudMachine &comCloudMachine,
980 UINotificationCenter *pParent /* = 0 */)
981{
982 createMessage(
983 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
984 QApplication::translate("UIMessageCenter", "Failed to acquire cloud machine parameter.") +
985 UIErrorString::formatErrorInfo(comCloudMachine),
986 QString(), QString(), pParent);
987}
988
989/* static */
990void UINotificationMessage::cannotChangeMediumParameter(const CMedium &comMedium)
991{
992 createMessage(
993 QApplication::translate("UIMessageCenter", "Medium failure ..."),
994 QApplication::translate("UIMessageCenter", "Failed to change the parameter of the medium <b>%1</b>.")
995 .arg(CMedium(comMedium).GetLocation()) +
996 UIErrorString::formatErrorInfo(comMedium));
997}
998
999/* static */
1000void UINotificationMessage::cannotChangeMachineParameter(const CMachine &comMachine)
1001{
1002 createMessage(
1003 QApplication::translate("UIMessageCenter", "Machine failure ..."),
1004 QApplication::translate("UIMessageCenter", "Failed to change the parameter of the virtual machine <b>%1</b>.")
1005 .arg(CMachine(comMachine).GetName()) +
1006 UIErrorString::formatErrorInfo(comMachine));
1007}
1008
1009/* static */
1010void UINotificationMessage::cannotChangeMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger)
1011{
1012 createMessage(
1013 QApplication::translate("UIMessageCenter", "Debugger failure ..."),
1014 QApplication::translate("UIMessageCenter", "Failed to change machine debugger parameter.") +
1015 UIErrorString::formatErrorInfo(comMachineDebugger));
1016}
1017
1018/* static */
1019void UINotificationMessage::cannotChangeGraphicsAdapterParameter(const CGraphicsAdapter &comAdapter)
1020{
1021 createMessage(
1022 QApplication::translate("UIMessageCenter", "Graphics adapter failure ..."),
1023 QApplication::translate("UIMessageCenter", "Failed to change graphics adapter parameter.") +
1024 UIErrorString::formatErrorInfo(comAdapter));
1025}
1026
1027/* static */
1028void UINotificationMessage::cannotChangeAudioAdapterParameter(const CAudioAdapter &comAdapter)
1029{
1030 createMessage(
1031 QApplication::translate("UIMessageCenter", "Audio adapter failure ..."),
1032 QApplication::translate("UIMessageCenter", "Failed to change audio adapter parameter.") +
1033 UIErrorString::formatErrorInfo(comAdapter));
1034}
1035
1036/* static */
1037void UINotificationMessage::cannotChangeNetworkAdapterParameter(const CNetworkAdapter &comAdapter)
1038{
1039 createMessage(
1040 QApplication::translate("UIMessageCenter", "Network adapter failure ..."),
1041 QApplication::translate("UIMessageCenter", "Failed to change network adapter parameter.") +
1042 UIErrorString::formatErrorInfo(comAdapter));
1043}
1044
1045/* static */
1046void UINotificationMessage::cannotChangeDHCPServerParameter(const CDHCPServer &comServer)
1047{
1048 createMessage(
1049 QApplication::translate("UIMessageCenter", "DHCP server failure ..."),
1050 QApplication::translate("UIMessageCenter", "Failed to change DHCP server parameter.") +
1051 UIErrorString::formatErrorInfo(comServer));
1052}
1053
1054/* static */
1055void UINotificationMessage::cannotChangeCloudNetworkParameter(const CCloudNetwork &comNetwork)
1056{
1057 createMessage(
1058 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
1059 QApplication::translate("UIMessageCenter", "Failed to change cloud network parameter.") +
1060 UIErrorString::formatErrorInfo(comNetwork));
1061}
1062
1063/* static */
1064void UINotificationMessage::cannotChangeHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface)
1065{
1066 createMessage(
1067 QApplication::translate("UIMessageCenter", "Host network interface failure ..."),
1068 QApplication::translate("UIMessageCenter", "Failed to change host network interface parameter.") +
1069 UIErrorString::formatErrorInfo(comInterface));
1070}
1071
1072/* static */
1073void UINotificationMessage::cannotChangeHostOnlyNetworkParameter(const CHostOnlyNetwork &comNetwork)
1074{
1075 createMessage(
1076 QApplication::translate("UIMessageCenter", "Host only network failure ..."),
1077 QApplication::translate("UIMessageCenter", "Failed to change host only network parameter.") +
1078 UIErrorString::formatErrorInfo(comNetwork));
1079}
1080
1081/* static */
1082void UINotificationMessage::cannotChangeNATNetworkParameter(const CNATNetwork &comNetwork)
1083{
1084 createMessage(
1085 QApplication::translate("UIMessageCenter", "NAT network failure ..."),
1086 QApplication::translate("UIMessageCenter", "Failed to change NAT network parameter.") +
1087 UIErrorString::formatErrorInfo(comNetwork));
1088}
1089
1090/* static */
1091void UINotificationMessage::cannotChangeDisplayParameter(const CDisplay &comDisplay)
1092{
1093 createMessage(
1094 QApplication::translate("UIMessageCenter", "Display failure ..."),
1095 QApplication::translate("UIMessageCenter", "Failed to change display parameter.") +
1096 UIErrorString::formatErrorInfo(comDisplay));
1097}
1098
1099/* static */
1100void UINotificationMessage::cannotChangeCloudProfileParameter(const CCloudProfile &comProfile)
1101{
1102 createMessage(
1103 QApplication::translate("UIMessageCenter", "Cloud failure ..."),
1104 QApplication::translate("UIMessageCenter", "Failed to change cloud profile parameter.") +
1105 UIErrorString::formatErrorInfo(comProfile));
1106}
1107
1108/* static */
1109void UINotificationMessage::cannotChangeUpdateAgentParameter(const CUpdateAgent &comAgent)
1110{
1111 createMessage(
1112 QApplication::translate("UIMessageCenter", "Update failure ..."),
1113 QApplication::translate("UIMessageCenter", "Failed to change update agent parameter.") +
1114 UIErrorString::formatErrorInfo(comAgent));
1115}
1116
1117/* static */
1118void UINotificationMessage::cannotChangeKeyboardParameter(const CKeyboard &comKeyboard)
1119{
1120 createMessage(
1121 QApplication::translate("UIMessageCenter", "Keyboard failure ..."),
1122 QApplication::translate("UIMessageCenter", "Failed to change keyboard parameter.") +
1123 UIErrorString::formatErrorInfo(comKeyboard));
1124}
1125
1126/* static */
1127void UINotificationMessage::cannotChangeMouseParameter(const CMouse &comMouse)
1128{
1129 createMessage(
1130 QApplication::translate("UIMessageCenter", "Mouse failure ..."),
1131 QApplication::translate("UIMessageCenter", "Failed to change mouse parameter.") +
1132 UIErrorString::formatErrorInfo(comMouse));
1133}
1134
1135/* static */
1136void UINotificationMessage::cannotChangeVirtualSystemDescriptionParameter(const CVirtualSystemDescription &comVsd,
1137 UINotificationCenter *pParent /* = 0 */)
1138{
1139 createMessage(
1140 QApplication::translate("UIMessageCenter", "VSD failure ..."),
1141 QApplication::translate("UIMessageCenter", "Failed to change VSD parameter.") +
1142 UIErrorString::formatErrorInfo(comVsd),
1143 QString(), QString(), pParent);
1144}
1145
1146/* static */
1147void UINotificationMessage::cannotEnumerateHostUSBDevices(const CHost &comHost)
1148{
1149 /* Refer users to manual's trouble shooting section depending on the host platform: */
1150 QString strHelpKeyword;
1151#if defined(RT_OS_LINUX)
1152 strHelpKeyword = "ts_usb-linux";
1153#elif defined(RT_OS_WINDOWS)
1154 strHelpKeyword = "ts_win-guests";
1155#elif defined(RT_OS_SOLARIS)
1156 strHelpKeyword = "ts_sol-guests";
1157#elif defined(RT_OS_DARWIN)
1158#endif
1159
1160 createMessage(
1161 QApplication::translate("UIMessageCenter", "Can't enumerate USB devices ..."),
1162 QApplication::translate("UIMessageCenter", "Failed to enumerate host USB devices.") +
1163 UIErrorString::formatErrorInfo(comHost),
1164 "cannotEnumerateHostUSBDevices",
1165 strHelpKeyword);
1166}
1167
1168/* static */
1169void UINotificationMessage::cannotOpenMedium(const CVirtualBox &comVBox,
1170 const QString &strLocation,
1171 UINotificationCenter *pParent /* = 0 */)
1172{
1173 createMessage(
1174 QApplication::translate("UIMessageCenter", "Can't open medium ..."),
1175 QApplication::translate("UIMessageCenter", "Failed to open the disk image file <nobr><b>%1</b></nobr>.")
1176 .arg(strLocation) +
1177 UIErrorString::formatErrorInfo(comVBox),
1178 QString(), QString(), pParent);
1179}
1180
1181/* static */
1182void UINotificationMessage::cannotPauseMachine(const CConsole &comConsole)
1183{
1184 createMessage(
1185 QApplication::translate("UIMessageCenter", "Can't pause machine ..."),
1186 QApplication::translate("UIMessageCenter", "Failed to pause the execution of the virtual machine <b>%1</b>.")
1187 .arg(CConsole(comConsole).GetMachine().GetName()) +
1188 UIErrorString::formatErrorInfo(comConsole));
1189}
1190
1191/* static */
1192void UINotificationMessage::cannotResumeMachine(const CConsole &comConsole)
1193{
1194 createMessage(
1195 QApplication::translate("UIMessageCenter", "Can't resume machine ..."),
1196 QApplication::translate("UIMessageCenter", "Failed to resume the execution of the virtual machine <b>%1</b>.")
1197 .arg(CConsole(comConsole).GetMachine().GetName()) +
1198 UIErrorString::formatErrorInfo(comConsole));
1199}
1200
1201/* static */
1202void UINotificationMessage::cannotACPIShutdownMachine(const CConsole &comConsole)
1203{
1204 createMessage(
1205 QApplication::translate("UIMessageCenter", "Can't shutdown machine ..."),
1206 QApplication::translate("UIMessageCenter", "Failed to send the ACPI Power Button press event to the virtual machine "
1207 "<b>%1</b>.").arg(CConsole(comConsole).GetMachine().GetName()) +
1208 UIErrorString::formatErrorInfo(comConsole));
1209}
1210
1211/* static */
1212void UINotificationMessage::cannotResetMachine(const CConsole &comConsole)
1213{
1214 createMessage(
1215 QApplication::translate("UIMessageCenter", "Can't reset machine ..."),
1216 QApplication::translate("UIMessageCenter", "Failed to reset the virtual machine "
1217 "<b>%1</b>.").arg(CConsole(comConsole).GetMachine().GetName()) +
1218 UIErrorString::formatErrorInfo(comConsole));
1219}
1220
1221/* static */
1222void UINotificationMessage::cannotCreateAppliance(const CVirtualBox &comVBox,
1223 UINotificationCenter *pParent /* = 0 */)
1224{
1225 createMessage(
1226 QApplication::translate("UIMessageCenter", "Can't create appliance ..."),
1227 QApplication::translate("UIMessageCenter", "Failed to create appliance.") +
1228 UIErrorString::formatErrorInfo(comVBox),
1229 QString(), QString(), pParent);
1230}
1231
1232/* static */
1233void UINotificationMessage::cannotRegisterMachine(const CVirtualBox &comVBox,
1234 const QString &strName,
1235 UINotificationCenter *pParent /* = 0 */)
1236{
1237 createMessage(
1238 QApplication::translate("UIMessageCenter", "Can't register machine ..."),
1239 QApplication::translate("UIMessageCenter", "Failed to register machine <b>%1</b>.")
1240 .arg(strName) +
1241 UIErrorString::formatErrorInfo(comVBox),
1242 QString(), QString(), pParent);
1243}
1244
1245/* static */
1246void UINotificationMessage::cannotCreateMachine(const CVirtualBox &comVBox,
1247 UINotificationCenter *pParent /* = 0 */)
1248{
1249 createMessage(
1250 QApplication::translate("UIMessageCenter", "Can't create machine ..."),
1251 QApplication::translate("UIMessageCenter", "Failed to create machine.") +
1252 UIErrorString::formatErrorInfo(comVBox),
1253 QString(), QString(), pParent);
1254}
1255
1256/* static */
1257void UINotificationMessage::cannotFindMachineById(const CVirtualBox &comVBox,
1258 const QUuid &uMachineId,
1259 UINotificationCenter *pParent /* = 0 */)
1260{
1261 createMessage(
1262 QApplication::translate("UIMessageCenter", "Can't find machine ..."),
1263 QApplication::translate("UIMessageCenter", "Failed to find the machine with following ID: <nobr><b>%1</b></nobr>.")
1264 .arg(uMachineId.toString()) +
1265 UIErrorString::formatErrorInfo(comVBox),
1266 QString(), QString(), pParent);
1267}
1268
1269/* static */
1270void UINotificationMessage::cannotOpenMachine(const CVirtualBox &comVBox, const QString &strLocation)
1271{
1272 createMessage(
1273 QApplication::translate("UIMessageCenter", "Can't open machine ..."),
1274 QApplication::translate("UIMessageCenter", "Failed to open virtual machine located in %1.")
1275 .arg(strLocation) +
1276 UIErrorString::formatErrorInfo(comVBox));
1277}
1278
1279/* static */
1280void UINotificationMessage::cannotCreateMediumStorage(const CVirtualBox &comVBox,
1281 const QString &strPath,
1282 UINotificationCenter *pParent /* = 0 */)
1283{
1284 createMessage(
1285 QApplication::translate("UIMessageCenter", "Can't create medium storage ..."),
1286 QApplication::translate("UIMessageCenter", "Failed to create medium storage at <nobr><b>%1</b></nobr>.")
1287 .arg(strPath) +
1288 UIErrorString::formatErrorInfo(comVBox),
1289 QString(), QString(), pParent);
1290}
1291
1292/* static */
1293void UINotificationMessage::cannotGetExtensionPackManager(const CVirtualBox &comVBox)
1294{
1295 createMessage(
1296 QApplication::translate("UIMessageCenter", "Can't get Extension Pack Manager ..."),
1297 QApplication::translate("UIMessageCenter", "Failed to acquire Extension Pack Manager.") +
1298 UIErrorString::formatErrorInfo(comVBox));
1299}
1300
1301/* static */
1302void UINotificationMessage::cannotCreateVfsExplorer(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
1303{
1304 createMessage(
1305 QApplication::translate("UIMessageCenter", "Can't create VFS explorer ..."),
1306 QApplication::translate("UIMessageCenter", "Failed to create VFS explorer to check files.") +
1307 UIErrorString::formatErrorInfo(comAppliance),
1308 QString(), QString(), pParent);
1309}
1310
1311/* static */
1312void UINotificationMessage::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
1313{
1314 createMessage(
1315 QApplication::translate("UIMessageCenter", "Bad password ..."),
1316 QApplication::translate("UIMessageCenter", "Bad password or authentication failure.") +
1317 UIErrorString::formatErrorInfo(comAppliance),
1318 QString(), QString(), pParent);
1319}
1320
1321/* static */
1322void UINotificationMessage::cannotInterpretAppliance(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
1323{
1324 createMessage(
1325 QApplication::translate("UIMessageCenter", "Can't interpret appliance ..."),
1326 QApplication::translate("UIMessageCenter", "Failed to interpret appliance being imported.") +
1327 UIErrorString::formatErrorInfo(comAppliance),
1328 QString(), QString(), pParent);
1329}
1330
1331/* static */
1332void UINotificationMessage::cannotCreateVirtualSystemDescription(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
1333{
1334 createMessage(
1335 QApplication::translate("UIMessageCenter", "Can't create VSD ..."),
1336 QApplication::translate("UIMessageCenter", "Failed to create VSD.") +
1337 UIErrorString::formatErrorInfo(comAppliance),
1338 QString(), QString(), pParent);
1339}
1340
1341/* static */
1342void UINotificationMessage::cannotOpenExtPack(const CExtPackManager &comExtPackManager, const QString &strFilename)
1343{
1344 createMessage(
1345 QApplication::translate("UIMessageCenter", "Can't open extension pack ..."),
1346 QApplication::translate("UIMessageCenter", "Failed to open the Extension Pack <b>%1</b>.")
1347 .arg(strFilename) +
1348 UIErrorString::formatErrorInfo(comExtPackManager));
1349}
1350
1351/* static */
1352void UINotificationMessage::cannotReadExtPack(const CExtPackFile &comExtPackFile, const QString &strFilename)
1353{
1354 createMessage(
1355 QApplication::translate("UIMessageCenter", "Can't read extension pack ..."),
1356 QApplication::translate("UIMessageCenter", "Failed to read the Extension Pack <b>%1</b>.")
1357 .arg(strFilename) +
1358 comExtPackFile.GetWhyUnusable());
1359}
1360
1361/* static */
1362void UINotificationMessage::cannotFindCloudNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1363{
1364 createMessage(
1365 QApplication::translate("UIMessageCenter", "Can't find cloud network ..."),
1366 QApplication::translate("UIMessageCenter", "Unable to find the cloud network <b>%1</b>.")
1367 .arg(strNetworkName) +
1368 UIErrorString::formatErrorInfo(comVBox));
1369}
1370
1371/* static */
1372void UINotificationMessage::cannotFindHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName)
1373{
1374 createMessage(
1375 QApplication::translate("UIMessageCenter", "Can't find host network interface ..."),
1376 QApplication::translate("UIMessageCenter", "Unable to find the host network interface <b>%1</b>.")
1377 .arg(strInterfaceName) +
1378 UIErrorString::formatErrorInfo(comHost));
1379}
1380
1381/* static */
1382void UINotificationMessage::cannotFindHostOnlyNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1383{
1384 createMessage(
1385 QApplication::translate("UIMessageCenter", "Can't find host only network ..."),
1386 QApplication::translate("UIMessageCenter", "Unable to find the host only network <b>%1</b>.")
1387 .arg(strNetworkName) +
1388 UIErrorString::formatErrorInfo(comVBox));
1389}
1390
1391/* static */
1392void UINotificationMessage::cannotFindNATNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1393{
1394 createMessage(
1395 QApplication::translate("UIMessageCenter", "Can't find NAT network ..."),
1396 QApplication::translate("UIMessageCenter", "Unable to find the NAT network <b>%1</b>.")
1397 .arg(strNetworkName) +
1398 UIErrorString::formatErrorInfo(comVBox));
1399}
1400
1401/* static */
1402void UINotificationMessage::cannotCreateDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName)
1403{
1404 createMessage(
1405 QApplication::translate("UIMessageCenter", "Can't create DHCP server ..."),
1406 QApplication::translate("UIMessageCenter", "Failed to create a DHCP server for the network interface <b>%1</b>.")
1407 .arg(strInterfaceName) +
1408 UIErrorString::formatErrorInfo(comVBox));
1409}
1410
1411/* static */
1412void UINotificationMessage::cannotRemoveDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName)
1413{
1414 createMessage(
1415 QApplication::translate("UIMessageCenter", "Can't remove DHCP server ..."),
1416 QApplication::translate("UIMessageCenter", "Failed to remove the DHCP server for the network interface <b>%1</b>.")
1417 .arg(strInterfaceName) +
1418 UIErrorString::formatErrorInfo(comVBox));
1419}
1420
1421/* static */
1422void UINotificationMessage::cannotCreateCloudNetwork(const CVirtualBox &comVBox)
1423{
1424 createMessage(
1425 QApplication::translate("UIMessageCenter", "Can't create cloud network ..."),
1426 QApplication::translate("UIMessageCenter", "Failed to create a cloud network.") +
1427 UIErrorString::formatErrorInfo(comVBox));
1428}
1429
1430/* static */
1431void UINotificationMessage::cannotRemoveCloudNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1432{
1433 createMessage(
1434 QApplication::translate("UIMessageCenter", "Can't remove cloud network ..."),
1435 QApplication::translate("UIMessageCenter", "Failed to remove the cloud network <b>%1</b>.")
1436 .arg(strNetworkName) +
1437 UIErrorString::formatErrorInfo(comVBox));
1438}
1439
1440/* static */
1441void UINotificationMessage::cannotCreateHostOnlyNetwork(const CVirtualBox &comVBox)
1442{
1443 createMessage(
1444 QApplication::translate("UIMessageCenter", "Can't create host only network ..."),
1445 QApplication::translate("UIMessageCenter", "Failed to create a host only network.") +
1446 UIErrorString::formatErrorInfo(comVBox));
1447}
1448
1449/* static */
1450void UINotificationMessage::cannotRemoveHostOnlyNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1451{
1452 createMessage(
1453 QApplication::translate("UIMessageCenter", "Can't remove host only network ..."),
1454 QApplication::translate("UIMessageCenter", "Failed to remove the host only network <b>%1</b>.")
1455 .arg(strNetworkName) +
1456 UIErrorString::formatErrorInfo(comVBox));
1457}
1458
1459/* static */
1460void UINotificationMessage::cannotCreateNATNetwork(const CVirtualBox &comVBox)
1461{
1462 createMessage(
1463 QApplication::translate("UIMessageCenter", "Can't create NAT network ..."),
1464 QApplication::translate("UIMessageCenter", "Failed to create a NAT network.") +
1465 UIErrorString::formatErrorInfo(comVBox));
1466}
1467
1468/* static */
1469void UINotificationMessage::cannotRemoveNATNetwork(const CVirtualBox &comVBox, const QString &strNetworkName)
1470{
1471 createMessage(
1472 QApplication::translate("UIMessageCenter", "Can't remove NAT network ..."),
1473 QApplication::translate("UIMessageCenter", "Failed to remove the NAT network <b>%1</b>.")
1474 .arg(strNetworkName) +
1475 UIErrorString::formatErrorInfo(comVBox));
1476}
1477
1478/* static */
1479void UINotificationMessage::cannotCreateCloudProfile(const CCloudProvider &comProvider)
1480{
1481 createMessage(
1482 QApplication::translate("UIMessageCenter", "Can't create cloud profile ..."),
1483 QApplication::translate("UIMessageCenter", "Failed to create cloud profile.") +
1484 UIErrorString::formatErrorInfo(comProvider));
1485}
1486
1487/* static */
1488void UINotificationMessage::cannotRemoveCloudProfile(const CCloudProfile &comProfile)
1489{
1490 createMessage(
1491 QApplication::translate("UIMessageCenter", "Can't remove cloud profile ..."),
1492 QApplication::translate("UIMessageCenter", "Failed to remove cloud profile.") +
1493 UIErrorString::formatErrorInfo(comProfile));
1494}
1495
1496/* static */
1497void UINotificationMessage::cannotSaveCloudProfiles(const CCloudProvider &comProvider)
1498{
1499 createMessage(
1500 QApplication::translate("UIMessageCenter", "Can't save cloud profiles ..."),
1501 QApplication::translate("UIMessageCenter", "Failed to save cloud profiles.") +
1502 UIErrorString::formatErrorInfo(comProvider));
1503}
1504
1505/* static */
1506void UINotificationMessage::cannotImportCloudProfiles(const CCloudProvider &comProvider)
1507{
1508 createMessage(
1509 QApplication::translate("UIMessageCenter", "Can't import cloud profiles ..."),
1510 QApplication::translate("UIMessageCenter", "Failed to import cloud profiles.") +
1511 UIErrorString::formatErrorInfo(comProvider));
1512}
1513
1514/* static */
1515void UINotificationMessage::cannotRefreshCloudMachine(const CCloudMachine &comMachine)
1516{
1517 createMessage(
1518 QApplication::translate("UIMessageCenter", "Can't refresh cloud machine ..."),
1519 QApplication::translate("UIMessageCenter", "Failed to refresh cloud machine.") +
1520 UIErrorString::formatErrorInfo(comMachine));
1521}
1522
1523/* static */
1524void UINotificationMessage::cannotRefreshCloudMachine(const CProgress &comProgress)
1525{
1526 createMessage(
1527 QApplication::translate("UIMessageCenter", "Can't refresh cloud machine ..."),
1528 QApplication::translate("UIMessageCenter", "Failed to refresh cloud machine.") +
1529 UIErrorString::formatErrorInfo(comProgress));
1530}
1531
1532/* static */
1533void UINotificationMessage::cannotCreateCloudClient(const CCloudProfile &comProfile, UINotificationCenter *pParent /* = 0 */)
1534{
1535 createMessage(
1536 QApplication::translate("UIMessageCenter", "Can't create cloud client ..."),
1537 QApplication::translate("UIMessageCenter", "Failed to create cloud client.") +
1538 UIErrorString::formatErrorInfo(comProfile),
1539 QString(), QString(), pParent);
1540}
1541
1542/* static */
1543void UINotificationMessage::cannotCloseMedium(const CMedium &comMedium)
1544{
1545 /* Show the error: */
1546 createMessage(
1547 QApplication::translate("UIMessageCenter", "Can't close medium ..."),
1548 QApplication::translate("UIMessageCenter", "Failed to close the disk image file <nobr><b>%1</b></nobr>.")
1549 .arg(CMedium(comMedium).GetLocation()) +
1550 UIErrorString::formatErrorInfo(comMedium));
1551}
1552
1553/* static */
1554void UINotificationMessage::cannotDiscardSavedState(const CMachine &comMachine)
1555{
1556 createMessage(
1557 QApplication::translate("UIMessageCenter", "Can't discard saved state ..."),
1558 QApplication::translate("UIMessageCenter", "Failed to discard the saved state of the virtual machine <b>%1</b>.")
1559 .arg(CMachine(comMachine).GetName()) +
1560 UIErrorString::formatErrorInfo(comMachine));
1561}
1562
1563/* static */
1564void UINotificationMessage::cannotRemoveMachine(const CMachine &comMachine, UINotificationCenter *pParent /* = 0 */)
1565{
1566 createMessage(
1567 QApplication::translate("UIMessageCenter", "Can't remove machine ..."),
1568 QApplication::translate("UIMessageCenter", "Failed to remove the virtual machine <b>%1</b>.")
1569 .arg(CMachine(comMachine).GetName()) +
1570 UIErrorString::formatErrorInfo(comMachine),
1571 QString(), QString(), pParent);
1572}
1573
1574/* static */
1575void UINotificationMessage::cannotExportMachine(const CMachine &comMachine, UINotificationCenter *pParent /* = 0 */)
1576{
1577 createMessage(
1578 QApplication::translate("UIMessageCenter", "Can't export machine ..."),
1579 QApplication::translate("UIMessageCenter", "Failed to export virtual machine <b>%1</b>.")
1580 .arg(CMachine(comMachine).GetName()) +
1581 UIErrorString::formatErrorInfo(comMachine),
1582 QString(), QString(), pParent);
1583}
1584
1585/* static */
1586void UINotificationMessage::cannotAttachDevice(const CMachine &comMachine,
1587 UIMediumDeviceType enmType,
1588 const QString &strLocation,
1589 const StorageSlot &storageSlot,
1590 UINotificationCenter *pParent /* = 0 */)
1591{
1592 QString strMessage;
1593 switch (enmType)
1594 {
1595 case UIMediumDeviceType_HardDisk:
1596 {
1597 strMessage = QApplication::translate("UIMessageCenter", "Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to "
1598 "the slot <i>%2</i> of the machine <b>%3</b>.")
1599 .arg(strLocation)
1600 .arg(gpConverter->toString(storageSlot))
1601 .arg(CMachine(comMachine).GetName());
1602 break;
1603 }
1604 case UIMediumDeviceType_DVD:
1605 {
1606 strMessage = QApplication::translate("UIMessageCenter", "Failed to attach the optical drive (<nobr><b>%1</b></nobr>) "
1607 "to the slot <i>%2</i> of the machine <b>%3</b>.")
1608 .arg(strLocation)
1609 .arg(gpConverter->toString(storageSlot))
1610 .arg(CMachine(comMachine).GetName());
1611 break;
1612 }
1613 case UIMediumDeviceType_Floppy:
1614 {
1615 strMessage = QApplication::translate("UIMessageCenter", "Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) "
1616 "to the slot <i>%2</i> of the machine <b>%3</b>.")
1617 .arg(strLocation)
1618 .arg(gpConverter->toString(storageSlot))
1619 .arg(CMachine(comMachine).GetName());
1620 break;
1621 }
1622 default:
1623 break;
1624 }
1625 createMessage(
1626 QApplication::translate("UIMessageCenter", "Can't attach device ..."),
1627 strMessage + UIErrorString::formatErrorInfo(comMachine),
1628 QString(), QString(), pParent);
1629}
1630
1631/* static */
1632void UINotificationMessage::cannotFindSnapshotById(const CMachine &comMachine, const QUuid &uId)
1633{
1634 createMessage(
1635 QApplication::translate("UIMessageCenter", "Can't find snapshot ..."),
1636 QApplication::translate("UIMessageCenter", "Failed to find snapshot with ID=<b>%1</b>.")
1637 .arg(uId.toString()) +
1638 UIErrorString::formatErrorInfo(comMachine));
1639}
1640
1641/* static */
1642void UINotificationMessage::cannotFindSnapshotByName(const CMachine &comMachine,
1643 const QString &strName,
1644 UINotificationCenter *pParent /* = 0 */)
1645{
1646 createMessage(
1647 QApplication::translate("UIMessageCenter", "Can't find snapshot ..."),
1648 QApplication::translate("UIMessageCenter", "Failed to find snapshot with name=<b>%1</b>.")
1649 .arg(strName) +
1650 UIErrorString::formatErrorInfo(comMachine),
1651 QString(), QString(), pParent);
1652}
1653
1654/* static */
1655void UINotificationMessage::cannotChangeSnapshot(const CSnapshot &comSnapshot,
1656 const QString &strSnapshotName,
1657 const QString &strMachineName)
1658{
1659 createMessage(
1660 QApplication::translate("UIMessageCenter", "Can't change snapshot ..."),
1661 QApplication::translate("UIMessageCenter", "Failed to change the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
1662 .arg(strSnapshotName, strMachineName) +
1663 UIErrorString::formatErrorInfo(comSnapshot));
1664}
1665
1666/* static */
1667void UINotificationMessage::cannotRunUnattendedGuestInstall(const CUnattended &comUnattended)
1668{
1669 createMessage(
1670 QApplication::translate("UIMessageCenter", "Can't run guest install ..."),
1671 QApplication::translate("UIMessageCenter", "Failed to run unattended guest installation.") +
1672 UIErrorString::formatErrorInfo(comUnattended));
1673}
1674
1675/* static */
1676void UINotificationMessage::cannotAttachUSBDevice(const CConsole &comConsole, const QString &strDevice)
1677{
1678 createMessage(
1679 QApplication::translate("UIMessageCenter", "Can't attach USB device ..."),
1680 QApplication::translate("UIMessageCenter", "Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
1681 .arg(strDevice, CConsole(comConsole).GetMachine().GetName()) +
1682 UIErrorString::formatErrorInfo(comConsole));
1683}
1684
1685/* static */
1686void UINotificationMessage::cannotAttachUSBDevice(const CVirtualBoxErrorInfo &comErrorInfo,
1687 const QString &strDevice, const QString &strMachineName)
1688{
1689 createMessage(
1690 QApplication::translate("UIMessageCenter", "Can't attach USB device ..."),
1691 QApplication::translate("UIMessageCenter", "Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.")
1692 .arg(strDevice, strMachineName) +
1693 UIErrorString::formatErrorInfo(comErrorInfo));
1694}
1695
1696/* static */
1697void UINotificationMessage::cannotDetachUSBDevice(const CConsole &comConsole, const QString &strDevice)
1698{
1699 createMessage(
1700 QApplication::translate("UIMessageCenter", "Can't detach USB device ..."),
1701 QApplication::translate("UIMessageCenter", "Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
1702 .arg(strDevice, CConsole(comConsole).GetMachine().GetName()) +
1703 UIErrorString::formatErrorInfo(comConsole));
1704}
1705
1706/* static */
1707void UINotificationMessage::cannotDetachUSBDevice(const CVirtualBoxErrorInfo &comErrorInfo,
1708 const QString &strDevice, const QString &strMachineName)
1709{
1710 createMessage(
1711 QApplication::translate("UIMessageCenter", "Can't detach USB device ..."),
1712 QApplication::translate("UIMessageCenter", "Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.")
1713 .arg(strDevice, strMachineName) +
1714 UIErrorString::formatErrorInfo(comErrorInfo));
1715}
1716
1717/* static */
1718void UINotificationMessage::cannotAttachWebCam(const CEmulatedUSB &comDispatcher,
1719 const QString &strWebCamName, const QString &strMachineName)
1720{
1721 createMessage(
1722 QApplication::translate("UIMessageCenter", "Can't attach webcam ..."),
1723 QApplication::translate("UIMessageCenter", "Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.")
1724 .arg(strWebCamName, strMachineName) +
1725 UIErrorString::formatErrorInfo(comDispatcher));
1726}
1727
1728/* static */
1729void UINotificationMessage::cannotDetachWebCam(const CEmulatedUSB &comDispatcher,
1730 const QString &strWebCamName, const QString &strMachineName)
1731{
1732 createMessage(
1733 QApplication::translate("UIMessageCenter", "Can't detach webcam ..."),
1734 QApplication::translate("UIMessageCenter", "Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.")
1735 .arg(strWebCamName, strMachineName) +
1736 UIErrorString::formatErrorInfo(comDispatcher));
1737}
1738
1739/* static */
1740void UINotificationMessage::cannotSaveMachineSettings(const CMachine &comMachine, UINotificationCenter *pParent /* = 0 */)
1741{
1742 createMessage(
1743 QApplication::translate("UIMessageCenter", "Can't save machine settings ..."),
1744 QApplication::translate("UIMessageCenter", "Failed to save the settings of the virtual machine <b>%1</b> to "
1745 "<b><nobr>%2</nobr></b>.")
1746 .arg(CMachine(comMachine).GetName(),
1747 CMachine(comMachine).GetSettingsFilePath()) +
1748 UIErrorString::formatErrorInfo(comMachine),
1749 QString(), QString(), pParent);
1750}
1751
1752/* static */
1753void UINotificationMessage::cannotToggleAudioInput(const CAudioAdapter &comAdapter,
1754 const QString &strMachineName, bool fEnable)
1755{
1756 createMessage(
1757 QApplication::translate("UIMessageCenter", "Can't toggle audio input ..."),
1758 ( fEnable
1759 ? QApplication::translate("UIMessageCenter", "Failed to enable the audio adapter input for the virtual machine <b>%1</b>.")
1760 .arg(strMachineName)
1761 : QApplication::translate("UIMessageCenter", "Failed to disable the audio adapter input for the virtual machine <b>%1</b>.")
1762 .arg(strMachineName)) +
1763 UIErrorString::formatErrorInfo(comAdapter));
1764}
1765
1766/* static */
1767void UINotificationMessage::cannotToggleAudioOutput(const CAudioAdapter &comAdapter,
1768 const QString &strMachineName, bool fEnable)
1769{
1770 createMessage(
1771 QApplication::translate("UIMessageCenter", "Can't toggle audio output ..."),
1772 ( fEnable
1773 ? QApplication::translate("UIMessageCenter", "Failed to enable the audio adapter output for the virtual machine <b>%1</b>.")
1774 .arg(strMachineName)
1775 : QApplication::translate("UIMessageCenter", "Failed to disable the audio adapter output for the virtual machine <b>%1</b>.")
1776 .arg(strMachineName)) +
1777 UIErrorString::formatErrorInfo(comAdapter));
1778}
1779
1780/* static */
1781void UINotificationMessage::cannotToggleNetworkCable(const CNetworkAdapter &comAdapter,
1782 const QString &strMachineName, bool fConnect)
1783{
1784 createMessage(
1785 QApplication::translate("UIMessageCenter", "Can't toggle network cable ..."),
1786 ( fConnect
1787 ? QApplication::translate("UIMessageCenter", "Failed to connect the network adapter cable of the virtual machine <b>%1</b>.")
1788 .arg(strMachineName)
1789 : QApplication::translate("UIMessageCenter", "Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.")
1790 .arg(strMachineName)) +
1791 UIErrorString::formatErrorInfo(comAdapter));
1792}
1793
1794/* static */
1795void UINotificationMessage::cannotToggleRecording(const CRecordingSettings &comRecording, const QString &strMachineName, bool fEnable)
1796{
1797 createMessage(
1798 QApplication::translate("UIMessageCenter", "Can't toggle recording ..."),
1799 ( fEnable
1800 ? QApplication::translate("UIMessageCenter", "Failed to enable recording for the virtual machine <b>%1</b>.")
1801 .arg(strMachineName)
1802 : QApplication::translate("UIMessageCenter", "Failed to disable recording for the virtual machine <b>%1</b>.")
1803 .arg(strMachineName)) +
1804 UIErrorString::formatErrorInfo(comRecording));
1805}
1806
1807/* static */
1808void UINotificationMessage::cannotToggleVRDEServer(const CVRDEServer &comServer,
1809 const QString &strMachineName, bool fEnable)
1810{
1811 createMessage(
1812 QApplication::translate("UIMessageCenter", "Can't toggle VRDE server ..."),
1813 ( fEnable
1814 ? QApplication::translate("UIMessageCenter", "Failed to enable the remote desktop server for the virtual machine <b>%1</b>.")
1815 .arg(strMachineName)
1816 : QApplication::translate("UIMessageCenter", "Failed to disable the remote desktop server for the virtual machine <b>%1</b>.")
1817 .arg(strMachineName)) +
1818 UIErrorString::formatErrorInfo(comServer));
1819}
1820
1821UINotificationMessage::UINotificationMessage(const QString &strName,
1822 const QString &strDetails,
1823 const QString &strInternalName,
1824 const QString &strHelpKeyword)
1825 : UINotificationSimple(strName,
1826 strDetails,
1827 strInternalName,
1828 strHelpKeyword)
1829{
1830}
1831
1832UINotificationMessage::~UINotificationMessage()
1833{
1834 /* Remove message from known: */
1835 m_messages.remove(m_strInternalName);
1836}
1837
1838/* static */
1839void UINotificationMessage::createMessage(const QString &strName,
1840 const QString &strDetails,
1841 const QString &strInternalName /* = QString() */,
1842 const QString &strHelpKeyword /* = QString() */,
1843 UINotificationCenter *pParent /* = 0 */)
1844{
1845 /* Check if message suppressed: */
1846 if (isSuppressed(strInternalName))
1847 return;
1848 /* Check if message already exists: */
1849 if ( !strInternalName.isEmpty()
1850 && m_messages.contains(strInternalName))
1851 return;
1852
1853 /* Choose effective parent: */
1854 UINotificationCenter *pEffectiveParent = pParent ? pParent : gpNotificationCenter;
1855
1856 /* Create message finally: */
1857 const QUuid uId = pEffectiveParent->append(new UINotificationMessage(strName,
1858 strDetails,
1859 strInternalName,
1860 strHelpKeyword));
1861 if (!strInternalName.isEmpty())
1862 m_messages[strInternalName] = uId;
1863}
1864
1865/* static */
1866void UINotificationMessage::destroyMessage(const QString &strInternalName,
1867 UINotificationCenter *pParent /* = 0 */)
1868{
1869 /* Check if message really exists: */
1870 if (!m_messages.contains(strInternalName))
1871 return;
1872
1873 /* Choose effective parent: */
1874 UINotificationCenter *pEffectiveParent = pParent ? pParent : gpNotificationCenter;
1875
1876 /* Destroy message finally: */
1877 pEffectiveParent->revoke(m_messages.value(strInternalName));
1878 m_messages.remove(strInternalName);
1879}
1880
1881
1882/*********************************************************************************************************************************
1883* Class UINotificationProgressMediumCreate implementation. *
1884*********************************************************************************************************************************/
1885
1886UINotificationProgressMediumCreate::UINotificationProgressMediumCreate(const CMedium &comTarget,
1887 qulonglong uSize,
1888 const QVector<KMediumVariant> &variants)
1889 : m_comTarget(comTarget)
1890 , m_uSize(uSize)
1891 , m_variants(variants)
1892{
1893 connect(this, &UINotificationProgress::sigProgressFinished,
1894 this, &UINotificationProgressMediumCreate::sltHandleProgressFinished);
1895}
1896
1897QString UINotificationProgressMediumCreate::name() const
1898{
1899 return UINotificationProgress::tr("Creating medium ...");
1900}
1901
1902QString UINotificationProgressMediumCreate::details() const
1903{
1904 return UINotificationProgress::tr("<b>Location:</b> %1<br><b>Size:</b> %2").arg(m_strLocation, UITranslator::formatSize(m_uSize));
1905}
1906
1907CProgress UINotificationProgressMediumCreate::createProgress(COMResult &comResult)
1908{
1909 /* Acquire location: */
1910 m_strLocation = m_comTarget.GetLocation();
1911 if (!m_comTarget.isOk())
1912 {
1913 /* Store COM result: */
1914 comResult = m_comTarget;
1915 /* Return progress-wrapper: */
1916 return CProgress();
1917 }
1918
1919 /* Initialize progress-wrapper: */
1920 CProgress comProgress = m_comTarget.CreateBaseStorage(m_uSize, m_variants);
1921 /* Store COM result: */
1922 comResult = m_comTarget;
1923 /* Return progress-wrapper: */
1924 return comProgress;
1925}
1926
1927void UINotificationProgressMediumCreate::sltHandleProgressFinished()
1928{
1929 if (m_comTarget.isNotNull() && !m_comTarget.GetId().isNull())
1930 emit sigMediumCreated(m_comTarget);
1931}
1932
1933
1934/*********************************************************************************************************************************
1935* Class UINotificationProgressMediumCopy implementation. *
1936*********************************************************************************************************************************/
1937
1938UINotificationProgressMediumCopy::UINotificationProgressMediumCopy(const CMedium &comSource,
1939 const CMedium &comTarget,
1940 const QVector<KMediumVariant> &variants,
1941 qulonglong uMediumSize)
1942 : m_comSource(comSource)
1943 , m_comTarget(comTarget)
1944 , m_variants(variants)
1945 , m_uMediumSize(uMediumSize)
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.ResizeAndCloneTo(m_comTarget, m_uMediumSize, 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 Guide ...");
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.

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