VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensionpackmanager/UIExtensionPackManager.h@ 102493

Last change on this file since 102493 was 98103, checked in by vboxsync, 21 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
Line 
1/* $Id: UIExtensionPackManager.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIExtensionPackManager class declaration.
4 */
5
6/*
7 * Copyright (C) 2009-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_extensionpackmanager_UIExtensionPackManager_h
29#define FEQT_INCLUDED_SRC_extensionpackmanager_UIExtensionPackManager_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* GUI includes: */
35#include "QIManagerDialog.h"
36#include "QIWithRetranslateUI.h"
37
38/* Forward declarations: */
39class QIToolBar;
40class QITreeWidget;
41class UIActionPool;
42struct UIDataExtensionPack;
43class CExtPack;
44
45
46/** QWidget extension providing GUI with the pane to control extension pack related functionality. */
47class UIExtensionPackManagerWidget : public QIWithRetranslateUI<QWidget>
48{
49 Q_OBJECT;
50
51public:
52
53 /** Constructs Extension Pack Manager widget.
54 * @param enmEmbedding Brings the type of widget embedding.
55 * @param pActionPool Brings the action-pool reference.
56 * @param fShowToolbar Brings whether we should create/show toolbar. */
57 UIExtensionPackManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
58 bool fShowToolbar = true, QWidget *pParent = 0);
59
60 /** Returns the menu. */
61 QMenu *menu() const;
62
63#ifdef VBOX_WS_MAC
64 /** Returns the toolbar. */
65 QIToolBar *toolbar() const { return m_pToolBar; }
66#endif
67
68protected:
69
70 /** @name Event-handling stuff.
71 * @{ */
72 /** Handles translation event. */
73 virtual void retranslateUi() RT_OVERRIDE;
74 /** @} */
75
76private slots:
77
78 /** @name Menu/action stuff.
79 * @{ */
80 /** Handles command to install extension pack. */
81 void sltInstallExtensionPack();
82 /** Handles command to uninstall extension pack. */
83 void sltUninstallExtensionPack();
84 /** @} */
85
86 /** @name Tree-widget stuff.
87 * @{ */
88 /** Handles command to adjust tree-widget. */
89 void sltAdjustTreeWidget();
90
91 /** Handles tree-widget current item change. */
92 void sltHandleCurrentItemChange();
93 /** Handles context-menu request for tree-widget @a position. */
94 void sltHandleContextMenuRequest(const QPoint &position);
95
96 /** Handles signal about extension pack @a strName installed. */
97 void sltHandleExtensionPackInstalled(const QString &strName);
98 /** Handles signal about extension pack @a strName uninstalled. */
99 void sltHandleExtensionPackUninstalled(const QString &strName);
100 /** @} */
101
102private:
103
104 /** @name Prepare/cleanup cascade.
105 * @{ */
106 /** Prepares all. */
107 void prepare();
108 /** Prepares actions. */
109 void prepareActions();
110 /** Prepares widgets. */
111 void prepareWidgets();
112 /** Prepares toolbar. */
113 void prepareToolBar();
114 /** Prepares tree-widget. */
115 void prepareTreeWidget();
116 /** @} */
117
118 /** @name Loading stuff.
119 * @{ */
120 /** Loads extension pack stuff. */
121 void loadExtensionPacks();
122 /** Loads extention @a comPackage data to passed @a extensionPackData container. */
123 void loadExtensionPack(const CExtPack &comPackage, UIDataExtensionPack &extensionPackData);
124 /** @} */
125
126 /** @name Tree-widget stuff.
127 * @{ */
128 /** Creates a new tree-widget item
129 * on the basis of passed @a extensionPackData, @a fChooseItem if requested. */
130 void createItemForExtensionPack(const UIDataExtensionPack &extensionPackData, bool fChooseItem);
131 /** @} */
132
133 /** @name General variables.
134 * @{ */
135 /** Holds the widget embedding type. */
136 const EmbedTo m_enmEmbedding;
137 /** Holds the action-pool reference. */
138 UIActionPool *m_pActionPool;
139 /** Holds whether we should create/show toolbar. */
140 const bool m_fShowToolbar;
141 /** @} */
142
143 /** @name Toolbar and menu variables.
144 * @{ */
145 /** Holds the toolbar instance. */
146 QIToolBar *m_pToolBar;
147 /** @} */
148
149 /** @name Widget variables.
150 * @{ */
151 /** Holds the tree-widget instance. */
152 QITreeWidget *m_pTreeWidget;
153 /** @} */
154};
155
156
157/** QIManagerDialogFactory extension used as a factory for Extension Pack Manager dialog. */
158class UIExtensionPackManagerFactory : public QIManagerDialogFactory
159{
160public:
161
162 /** Constructs Extension Pack Manager factory acquiring additional arguments.
163 * @param pActionPool Brings the action-pool reference. */
164 UIExtensionPackManagerFactory(UIActionPool *pActionPool = 0);
165
166protected:
167
168 /** Creates derived @a pDialog instance.
169 * @param pCenterWidget Brings the widget reference to center according to. */
170 virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) RT_OVERRIDE;
171
172 /** Holds the action-pool reference. */
173 UIActionPool *m_pActionPool;
174};
175
176
177/** QIManagerDialog extension providing GUI with the dialog to control extension pack related functionality. */
178class UIExtensionPackManager : public QIWithRetranslateUI<QIManagerDialog>
179{
180 Q_OBJECT;
181
182private:
183
184 /** Constructs Extension Pack Manager dialog.
185 * @param pCenterWidget Brings the widget reference to center according to.
186 * @param pActionPool Brings the action-pool reference. */
187 UIExtensionPackManager(QWidget *pCenterWidget, UIActionPool *pActionPool);
188
189 /** @name Event-handling stuff.
190 * @{ */
191 /** Handles translation event. */
192 virtual void retranslateUi() RT_OVERRIDE;
193 /** @} */
194
195 /** @name Prepare/cleanup cascade.
196 * @{ */
197 /** Configures all. */
198 virtual void configure() RT_OVERRIDE;
199 /** Configures central-widget. */
200 virtual void configureCentralWidget() RT_OVERRIDE;
201 /** Perform final preparations. */
202 virtual void finalize() RT_OVERRIDE;
203 /** @} */
204
205 /** @name Widget stuff.
206 * @{ */
207 /** Returns the widget. */
208 virtual UIExtensionPackManagerWidget *widget() RT_OVERRIDE;
209 /** @} */
210
211 /** @name Action related variables.
212 * @{ */
213 /** Holds the action-pool reference. */
214 UIActionPool *m_pActionPool;
215 /** @} */
216
217 /** Allow factory access to private/protected members: */
218 friend class UIExtensionPackManagerFactory;
219};
220
221#endif /* !FEQT_INCLUDED_SRC_extensionpackmanager_UIExtensionPackManager_h */
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