1 | /* $Id: UIMediumTools.h 104915 2024-06-13 13:18:04Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIMediumTools class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2024 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 | #ifndef FEQT_INCLUDED_SRC_medium_UIMediumTools_h
|
---|
29 | #define FEQT_INCLUDED_SRC_medium_UIMediumTools_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QUuid>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UILibraryDefs.h"
|
---|
39 | #include "UIMediumDefs.h"
|
---|
40 |
|
---|
41 | /* Forward declarations: */
|
---|
42 | class QMenu;
|
---|
43 | class QObject;
|
---|
44 | class QString;
|
---|
45 | class QWidget;
|
---|
46 | class UIActionPool;
|
---|
47 | class CMachine;
|
---|
48 | class CMedium;
|
---|
49 |
|
---|
50 | /** UIMediumTools namespace. */
|
---|
51 | namespace UIMediumTools
|
---|
52 | {
|
---|
53 | /** Generates details for passed @a comMedium.
|
---|
54 | * @param fPredictDiff Brings whether medium will be marked differencing on attaching.
|
---|
55 | * @param fUseHtml Brings whether HTML subsets should be used in the generated output. */
|
---|
56 | SHARED_LIBRARY_STUFF QString storageDetails(const CMedium &comMedium,
|
---|
57 | bool fPredictDiff,
|
---|
58 | bool fUseHtml = true);
|
---|
59 |
|
---|
60 | /** Calculates @a cAmount of immutable images used by @a comMachine specified. */
|
---|
61 | SHARED_LIBRARY_STUFF bool acquireAmountOfImmutableImages(const CMachine &comMachine,
|
---|
62 | ulong &cAmount);
|
---|
63 |
|
---|
64 | /** Searches extra data for the recently used folder path which corresponds to @a enmMediumType.
|
---|
65 | * When that search fails it looks for recent folder extra data for other medium types.
|
---|
66 | * As the last resort returns default vm folder path.
|
---|
67 | * @param enmMediumType Passes the medium type. */
|
---|
68 | SHARED_LIBRARY_STUFF QString defaultFolderPathForType(UIMediumDeviceType enmMediumType);
|
---|
69 |
|
---|
70 | /** Opens external medium from passed @a strMediumLocation.
|
---|
71 | * @param enmMediumType Brings the medium type.
|
---|
72 | * @param strMediumLocation Brings the file path to load medium from.
|
---|
73 | * @param pParent Brings the error dialog parent. */
|
---|
74 | SHARED_LIBRARY_STUFF QUuid openMedium(UIMediumDeviceType enmMediumType,
|
---|
75 | const QString &strMediumLocation,
|
---|
76 | QWidget *pParent = 0);
|
---|
77 |
|
---|
78 | /** Opens external medium using file-open dialog.
|
---|
79 | * @param enmMediumType Brings the medium type.
|
---|
80 | * @param pParent Brings the dialog parent.
|
---|
81 | * @param strDefaultFolder Brings the folder to browse for medium.
|
---|
82 | * @param fUseLastFolder Brings whether we should propose to use last used folder. */
|
---|
83 | SHARED_LIBRARY_STUFF QUuid openMediumWithFileOpenDialog(UIMediumDeviceType enmMediumType,
|
---|
84 | QWidget *pParent = 0,
|
---|
85 | const QString &strDefaultFolder = QString(),
|
---|
86 | bool fUseLastFolder = false);
|
---|
87 |
|
---|
88 | /** Creates and shows a dialog (wizard) to create a medium of type @a enmMediumType.
|
---|
89 | * @param pActionPool Brings the action-pool.
|
---|
90 | * @param pParent Brings the parent of the dialog,
|
---|
91 | * @param enmMediumType Brings the medium type,
|
---|
92 | * @param strMachineFolder Brings the machine folder,
|
---|
93 | * @param strMachineName Brings the name of the machine,
|
---|
94 | * @param strMachineGuestOSTypeId Brings the type ID of machine's guest os,
|
---|
95 | * returns QUuid of the new medium. */
|
---|
96 | SHARED_LIBRARY_STUFF QUuid openMediumCreatorDialog(UIActionPool *pActionPool,
|
---|
97 | QWidget *pParent,
|
---|
98 | UIMediumDeviceType enmMediumType,
|
---|
99 | const QString &strMachineFolder = QString(),
|
---|
100 | const QString &strMachineName = QString(),
|
---|
101 | const QString &strMachineGuestOSTypeId = QString());
|
---|
102 |
|
---|
103 | /** Prepares storage menu according passed parameters.
|
---|
104 | * @param pMenu Brings the #QMenu to be prepared.
|
---|
105 | * @param pListener Brings the listener #QObject, this @a menu being prepared for.
|
---|
106 | * @param pszSlotName Brings the name of the SLOT in the @a pListener above, this menu will be handled with.
|
---|
107 | * @param comMachine Brings the #CMachine object, this @a menu being prepared for.
|
---|
108 | * @param strControllerName Brings the name of the #CStorageController in the @a machine above.
|
---|
109 | * @param storageSlot Brings the #StorageSlot of the storage controller with @a strControllerName above. */
|
---|
110 | SHARED_LIBRARY_STUFF void prepareStorageMenu(QMenu *pMenu,
|
---|
111 | QObject *pListener,
|
---|
112 | const char *pszSlotName,
|
---|
113 | const CMachine &comMachine,
|
---|
114 | const QString &strControllerName,
|
---|
115 | const StorageSlot &storageSlot);
|
---|
116 |
|
---|
117 | /** Updates @a comConstMachine storage with data described by @a target.
|
---|
118 | * @param comConstMachine Brings the machine to update.
|
---|
119 | * @param target Brings the medium target to update machine with.
|
---|
120 | * @param pActionPool Brings the action-pool. */
|
---|
121 | SHARED_LIBRARY_STUFF void updateMachineStorage(const CMachine &comConstMachine,
|
---|
122 | const UIMediumTarget &target,
|
---|
123 | UIActionPool *pActionPool);
|
---|
124 | }
|
---|
125 | /* Using this namespace globally: */
|
---|
126 | using namespace UIMediumTools;
|
---|
127 |
|
---|
128 | #endif /* !FEQT_INCLUDED_SRC_medium_UIMediumTools_h */
|
---|