VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.h@ 82781

Last change on this file since 82781 was 78323, checked in by vboxsync, 5 years ago

FE/Qt: bugref:9438: Adding Try Oracle Cloud for Free button to Cloud Profile Manager.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.0 KB
Line 
1/* $Id: UICloudProfileManager.h 78323 2019-04-26 13:07:58Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UICloudProfileManager class declaration.
4 */
5
6/*
7 * Copyright (C) 2009-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef FEQT_INCLUDED_SRC_cloud_UICloudProfileManager_h
19#define FEQT_INCLUDED_SRC_cloud_UICloudProfileManager_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* GUI includes: */
25#include "QIManagerDialog.h"
26#include "QIWithRetranslateUI.h"
27
28/* Forward declarations: */
29class QAbstractButton;
30class QTreeWidgetItem;
31class QITreeWidget;
32class UIActionPool;
33class UICloudProfileDetailsWidget;
34class UIItemCloudProfile;
35class UIItemCloudProvider;
36class UIToolBar;
37struct UIDataCloudProfile;
38struct UIDataCloudProvider;
39class CCloudProfile;
40class CCloudProvider;
41
42
43/** QWidget extension providing GUI with the pane to control cloud profile related functionality. */
44class UICloudProfileManagerWidget : public QIWithRetranslateUI<QWidget>
45{
46 Q_OBJECT;
47
48signals:
49
50 /** Notifies listeners about dialog change. */
51 void sigChange();
52
53 /** Notifies listeners about cloud profile details-widget @a fVisible. */
54 void sigCloudProfileDetailsVisibilityChanged(bool fVisible);
55 /** Notifies listeners about cloud profile details data @a fDiffers. */
56 void sigCloudProfileDetailsDataChanged(bool fDiffers);
57
58public:
59
60 /** Constructs Cloud Profile Manager widget.
61 * @param enmEmbedding Brings the type of widget embedding.
62 * @param pActionPool Brings the action-pool reference.
63 * @param fShowToolbar Brings whether we should create/show toolbar. */
64 UICloudProfileManagerWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
65 bool fShowToolbar = true, QWidget *pParent = 0);
66
67 /** Returns the menu. */
68 QMenu *menu() const;
69
70#ifdef VBOX_WS_MAC
71 /** Returns the toolbar. */
72 UIToolBar *toolbar() const { return m_pToolBar; }
73#endif
74
75protected:
76
77 /** @name Event-handling stuff.
78 * @{ */
79 /** Handles translation event. */
80 virtual void retranslateUi() /* override */;
81 /** @} */
82
83public slots:
84
85 /** @name Details-widget stuff.
86 * @{ */
87 /** Handles command to reset cloud profile details changes. */
88 void sltResetCloudProfileDetailsChanges();
89 /** Handles command to apply cloud profile details changes. */
90 void sltApplyCloudProfileDetailsChanges();
91 /** @} */
92
93private slots:
94
95 /** @name Menu/action stuff.
96 * @{ */
97 /** Handles command to create cloud profile. */
98 void sltAddCloudProfile();
99 /** Handles command to import cloud profiles. */
100 void sltImportCloudProfiles();
101 /** Handles command to remove cloud profile. */
102 void sltRemoveCloudProfile();
103 /** Handles command to make cloud profile details @a fVisible. */
104 void sltToggleCloudProfileDetailsVisibility(bool fVisible);
105 /** Handles command to show cloud profile help. */
106 void sltShowCloudProfileTryPage();
107 /** Handles command to show cloud profile help. */
108 void sltShowCloudProfileHelp();
109 /** @} */
110
111 /** @name Tree-widget stuff.
112 * @{ */
113 /** Handles tree-widget current item change. */
114 void sltHandleCurrentItemChange();
115 /** Handles context menu request for tree-widget @a position. */
116 void sltHandleContextMenuRequest(const QPoint &position);
117 /** @} */
118
119private:
120
121 /** @name Prepare/cleanup cascade.
122 * @{ */
123 /** Prepares all. */
124 void prepare();
125 /** Prepares actions. */
126 void prepareActions();
127 /** Prepares widgets. */
128 void prepareWidgets();
129 /** Prepares toolbar. */
130 void prepareToolBar();
131 /** Prepares tree-widget. */
132 void prepareTreeWidget();
133 /** Prepares details-widget. */
134 void prepareDetailsWidget();
135 /** Load settings: */
136 void loadSettings();
137 /** @} */
138
139 /** @name Loading stuff.
140 * @{ */
141 /** Loads cloud stuff. */
142 void loadCloudStuff();
143 /** Loads cloud @a comProvider data to passed @a data container. */
144 void loadCloudProvider(const CCloudProvider &comProvider, UIDataCloudProvider &data);
145 /** Loads cloud @a comProfile data to passed @a profileData container, using @a providerData as hint. */
146 void loadCloudProfile(const CCloudProfile &comProfile, const UIDataCloudProvider &providerData, UIDataCloudProfile &profileData);
147 /** @} */
148
149 /** @name Tree-widget stuff.
150 * @{ */
151 /** Seearches a provider item with specified @a uuid. */
152 UIItemCloudProvider *searchItem(const QUuid &uuid) const;
153
154 /** Creates a new tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */
155 void createItemForCloudProvider(const UIDataCloudProvider &data, bool fChooseItem);
156
157 /** Creates a new tree-widget item as a child of certain @a pParent, on the basis of passed @a data, @a fChooseItem if requested. */
158 void createItemForCloudProfile(QTreeWidgetItem *pParent, const UIDataCloudProfile &data, bool fChooseItem);
159 /** Updates the passed tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */
160 void updateItemForCloudProfile(const UIDataCloudProfile &data, bool fChooseItem, UIItemCloudProfile *pItem);
161 /** @} */
162
163 /** @name General variables.
164 * @{ */
165 /** Holds the widget embedding type. */
166 const EmbedTo m_enmEmbedding;
167 /** Holds the action-pool reference. */
168 UIActionPool *m_pActionPool;
169 /** Holds whether we should create/show toolbar. */
170 const bool m_fShowToolbar;
171 /** @} */
172
173 /** @name Toolbar and menu variables.
174 * @{ */
175 /** Holds the toolbar instance. */
176 UIToolBar *m_pToolBar;
177 /** @} */
178
179 /** @name Splitter variables.
180 * @{ */
181 /** Holds the tree-widget instance. */
182 QITreeWidget *m_pTreeWidget;
183 /** Holds the details-widget instance. */
184 UICloudProfileDetailsWidget *m_pDetailsWidget;
185 /** @} */
186};
187
188
189/** QIManagerDialogFactory extension used as a factory for Cloud Profile Manager dialog. */
190class UICloudProfileManagerFactory : public QIManagerDialogFactory
191{
192public:
193
194 /** Constructs Cloud Profile Manager factory acquiring additional arguments.
195 * @param pActionPool Brings the action-pool reference. */
196 UICloudProfileManagerFactory(UIActionPool *pActionPool = 0);
197
198protected:
199
200 /** Creates derived @a pDialog instance.
201 * @param pCenterWidget Brings the widget reference to center according to. */
202 virtual void create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) /* override */;
203
204 /** Holds the action-pool reference. */
205 UIActionPool *m_pActionPool;
206};
207
208
209/** QIManagerDialog extension providing GUI with the dialog to control cloud profile related functionality. */
210class UICloudProfileManager : public QIWithRetranslateUI<QIManagerDialog>
211{
212 Q_OBJECT;
213
214signals:
215
216 /** Notifies listeners about data change rejected and should be reseted. */
217 void sigDataChangeRejected();
218 /** Notifies listeners about data change accepted and should be applied. */
219 void sigDataChangeAccepted();
220
221private slots:
222
223 /** @name Button-box stuff.
224 * @{ */
225 /** Handles button-box button click. */
226 void sltHandleButtonBoxClick(QAbstractButton *pButton);
227 /** @} */
228
229private:
230
231 /** Constructs Cloud Profile Manager dialog.
232 * @param pCenterWidget Brings the widget reference to center according to.
233 * @param pActionPool Brings the action-pool reference. */
234 UICloudProfileManager(QWidget *pCenterWidget, UIActionPool *pActionPool);
235
236 /** @name Event-handling stuff.
237 * @{ */
238 /** Handles translation event. */
239 virtual void retranslateUi() /* override */;
240 /** @} */
241
242 /** @name Prepare/cleanup cascade.
243 * @{ */
244 /** Configures all. */
245 virtual void configure() /* override */;
246 /** Configures central-widget. */
247 virtual void configureCentralWidget() /* override */;
248 /** Configures button-box. */
249 virtual void configureButtonBox() /* override */;
250 /** Perform final preparations. */
251 virtual void finalize() /* override */;
252 /** @} */
253
254 /** @name Widget stuff.
255 * @{ */
256 /** Returns the widget. */
257 virtual UICloudProfileManagerWidget *widget() /* override */;
258 /** @} */
259
260 /** @name Action related variables.
261 * @{ */
262 /** Holds the action-pool reference. */
263 UIActionPool *m_pActionPool;
264 /** @} */
265
266 /** Allow factory access to private/protected members: */
267 friend class UICloudProfileManagerFactory;
268};
269
270#endif /* !FEQT_INCLUDED_SRC_cloud_UICloudProfileManager_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use