VirtualBox

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

Last change on this file since 104158 was 103781, checked in by vboxsync, 9 months ago

FE/Qt: UICommon: Move extension pack related functionality to UIExtension namespace; Rework all listeners to listen for global VBox events (signals) instead of UICommon.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 KB
Line 
1/* $Id: UIExtensionPackManager.h 103781 2024-03-11 17:23:02Z 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 /** Prepare connections: */
117 void prepareConnections();
118 /** @} */
119
120 /** @name Loading stuff.
121 * @{ */
122 /** Loads extension pack stuff. */
123 void loadExtensionPacks();
124 /** Loads extention @a comPackage data to passed @a extensionPackData container. */
125 void loadExtensionPack(const CExtPack &comPackage, UIDataExtensionPack &extensionPackData);
126 /** @} */
127
128 /** @name Tree-widget stuff.
129 * @{ */
130 /** Creates a new tree-widget item
131 * on the basis of passed @a extensionPackData, @a fChooseItem if requested. */
132 void createItemForExtensionPack(const UIDataExtensionPack &extensionPackData, bool fChooseItem);
133 /** @} */
134
135 /** @name General variables.
136 * @{ */
137 /** Holds the widget embedding type. */
138 const EmbedTo m_enmEmbedding;
139 /** Holds the action-pool reference. */
140 UIActionPool *m_pActionPool;
141 /** Holds whether we should create/show toolbar. */
142 const bool m_fShowToolbar;
143 /** @} */
144
145 /** @name Toolbar and menu variables.
146 * @{ */
147 /** Holds the toolbar instance. */
148 QIToolBar *m_pToolBar;
149 /** @} */
150
151 /** @name Widget variables.
152 * @{ */
153 /** Holds the tree-widget instance. */
154 QITreeWidget *m_pTreeWidget;
155 /** @} */
156};
157
158
159/** QIManagerDialogFactory extension used as a factory for Extension Pack Manager dialog. */
160class UIExtensionPackManagerFactory : public QIManagerDialogFactory
161{
162public:
163
164 /** Constructs Extension Pack Manager factory acquiring additional arguments.
165 * @param pActionPool Brings the action-pool reference. */
166 UIExtensionPackManagerFactory(UIActionPool *pActionPool = 0);
167
168protected:
169
170 /** Creates derived @a pDialog instance.
171 * @param pCenterWidget Brings the widget reference to center according to. */
172 virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) RT_OVERRIDE;
173
174 /** Holds the action-pool reference. */
175 UIActionPool *m_pActionPool;
176};
177
178
179/** QIManagerDialog extension providing GUI with the dialog to control extension pack related functionality. */
180class UIExtensionPackManager : public QIWithRetranslateUI<QIManagerDialog>
181{
182 Q_OBJECT;
183
184private:
185
186 /** Constructs Extension Pack Manager dialog.
187 * @param pCenterWidget Brings the widget reference to center according to.
188 * @param pActionPool Brings the action-pool reference. */
189 UIExtensionPackManager(QWidget *pCenterWidget, UIActionPool *pActionPool);
190
191 /** @name Event-handling stuff.
192 * @{ */
193 /** Handles translation event. */
194 virtual void retranslateUi() RT_OVERRIDE;
195 /** @} */
196
197 /** @name Prepare/cleanup cascade.
198 * @{ */
199 /** Configures all. */
200 virtual void configure() RT_OVERRIDE;
201 /** Configures central-widget. */
202 virtual void configureCentralWidget() RT_OVERRIDE;
203 /** Perform final preparations. */
204 virtual void finalize() RT_OVERRIDE;
205 /** @} */
206
207 /** @name Widget stuff.
208 * @{ */
209 /** Returns the widget. */
210 virtual UIExtensionPackManagerWidget *widget() RT_OVERRIDE;
211 /** @} */
212
213 /** @name Action related variables.
214 * @{ */
215 /** Holds the action-pool reference. */
216 UIActionPool *m_pActionPool;
217 /** @} */
218
219 /** Allow factory access to private/protected members: */
220 friend class UIExtensionPackManagerFactory;
221};
222
223#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