1 | /* $Id: UIMachineSettingsSF.h 101072 2023-09-08 15:03:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIMachineSettingsSF class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-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 | #ifndef FEQT_INCLUDED_SRC_settings_machine_UIMachineSettingsSF_h
|
---|
29 | #define FEQT_INCLUDED_SRC_settings_machine_UIMachineSettingsSF_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UISettingsPage.h"
|
---|
36 |
|
---|
37 | /* COM includes: */
|
---|
38 | #include "CSharedFolder.h"
|
---|
39 |
|
---|
40 | /* Forward declarations: */
|
---|
41 | class UISharedFoldersEditor;
|
---|
42 |
|
---|
43 | struct UIDataSettingsSharedFolder;
|
---|
44 | struct UIDataSettingsSharedFolders;
|
---|
45 | typedef UISettingsCache<UIDataSettingsSharedFolder> UISettingsCacheSharedFolder;
|
---|
46 | typedef UISettingsCachePool<UIDataSettingsSharedFolders, UISettingsCacheSharedFolder> UISettingsCacheSharedFolders;
|
---|
47 |
|
---|
48 |
|
---|
49 | /** Machine settings: Shared Folders page. */
|
---|
50 | class SHARED_LIBRARY_STUFF UIMachineSettingsSF : public UISettingsPageMachine
|
---|
51 | {
|
---|
52 | Q_OBJECT;
|
---|
53 |
|
---|
54 | public:
|
---|
55 |
|
---|
56 | /** Constructs Shared Folders settings page. */
|
---|
57 | UIMachineSettingsSF();
|
---|
58 | /** Destructs Shared Folders settings page. */
|
---|
59 | virtual ~UIMachineSettingsSF() RT_OVERRIDE;
|
---|
60 |
|
---|
61 | protected:
|
---|
62 |
|
---|
63 | /** Returns whether the page content was changed. */
|
---|
64 | virtual bool changed() const RT_OVERRIDE;
|
---|
65 |
|
---|
66 | /** Loads settings from external object(s) packed inside @a data to cache.
|
---|
67 | * @note This task WILL be performed in other than the GUI thread, no widget interactions! */
|
---|
68 | virtual void loadToCacheFrom(QVariant &data) RT_OVERRIDE;
|
---|
69 | /** Loads data from cache to corresponding widgets.
|
---|
70 | * @note This task WILL be performed in the GUI thread only, all widget interactions here! */
|
---|
71 | virtual void getFromCache() RT_OVERRIDE;
|
---|
72 |
|
---|
73 | /** Saves data from corresponding widgets to cache.
|
---|
74 | * @note This task WILL be performed in the GUI thread only, all widget interactions here! */
|
---|
75 | virtual void putToCache() RT_OVERRIDE;
|
---|
76 | /** Saves settings from cache to external object(s) packed inside @a data.
|
---|
77 | * @note This task WILL be performed in other than the GUI thread, no widget interactions! */
|
---|
78 | virtual void saveFromCacheTo(QVariant &data) RT_OVERRIDE;
|
---|
79 |
|
---|
80 | /** Handles translation event. */
|
---|
81 | virtual void retranslateUi() RT_OVERRIDE;
|
---|
82 |
|
---|
83 | /** Performs final page polishing. */
|
---|
84 | virtual void polishPage() RT_OVERRIDE;
|
---|
85 |
|
---|
86 | private:
|
---|
87 |
|
---|
88 | /** Prepares all. */
|
---|
89 | void prepare();
|
---|
90 | /** Prepares widgets. */
|
---|
91 | void prepareWidgets();
|
---|
92 | /** Prepares connections. */
|
---|
93 | void prepareConnections();
|
---|
94 | /** Cleanups all. */
|
---|
95 | void cleanup();
|
---|
96 |
|
---|
97 | /** Returns whether the corresponding @a enmFoldersType supported. */
|
---|
98 | bool isSharedFolderTypeSupported(UISharedFolderType enmFoldersType) const;
|
---|
99 |
|
---|
100 | /** Gathers a vector of shared folders of the passed @a enmFoldersType. */
|
---|
101 | CSharedFolderVector getSharedFolders(UISharedFolderType enmFoldersType);
|
---|
102 | /** Gathers a vector of shared folders of the passed @a enmFoldersType. */
|
---|
103 | bool getSharedFolders(UISharedFolderType enmFoldersType, CSharedFolderVector &folders);
|
---|
104 | /** Look for a folder with the the passed @a strFolderName. */
|
---|
105 | bool getSharedFolder(const QString &strFolderName, const CSharedFolderVector &folders, CSharedFolder &comFolder);
|
---|
106 |
|
---|
107 | /** Saves existing data from cache. */
|
---|
108 | bool saveData();
|
---|
109 | /** Removes shared folder defined by a @a folderCache. */
|
---|
110 | bool removeSharedFolder(const UISettingsCacheSharedFolder &folderCache);
|
---|
111 | /** Creates shared folder defined by a @a folderCache. */
|
---|
112 | bool createSharedFolder(const UISettingsCacheSharedFolder &folderCache);
|
---|
113 |
|
---|
114 | /** Holds the page data cache instance. */
|
---|
115 | UISettingsCacheSharedFolders *m_pCache;
|
---|
116 |
|
---|
117 | /** @name Widgets
|
---|
118 | * @{ */
|
---|
119 | /** Holds the shared folders editor instance. */
|
---|
120 | UISharedFoldersEditor *m_pEditorSharedFolders;
|
---|
121 | /** @} */
|
---|
122 | };
|
---|
123 |
|
---|
124 | #endif /* !FEQT_INCLUDED_SRC_settings_machine_UIMachineSettingsSF_h */
|
---|