VirtualBox

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

Last change on this file was 104245, checked in by vboxsync, 6 weeks ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in the extenion pack manager and notification center classes.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use