VirtualBox

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

Last change on this file since 103131 was 102600, checked in by vboxsync, 14 months ago

FE/Qt: bugref:10543: UISession: Checking CPlatform for API errors as usual.

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