VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h

Last change on this file was 104251, checked in by vboxsync, 2 months ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in the manager UI classes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mergeinfo set to (toggle deleted branches)
    /branches/VBox-3.0/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h58652,​70973
    /branches/VBox-3.2/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h66309,​66318
    /branches/VBox-4.0/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h70873
    /branches/VBox-4.1/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h74233
    /branches/VBox-4.2/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h91503-91504,​91506-91508,​91510,​91514-91515,​91521
    /branches/VBox-4.3/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h91223
    /branches/VBox-4.3/trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h91223
    /branches/dsen/gui/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h79076-79078,​79089,​79109-79110,​79112-79113,​79127-79130,​79134,​79141,​79151,​79155,​79157-79159,​79193,​79197
    /branches/dsen/gui2/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h79565-79569,​79572-79573,​79578,​79581-79582,​79590-79591,​79598-79599,​79602-79603,​79605-79606,​79632,​79635,​79637,​79644
    /branches/dsen/gui3/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h79645-79692
    /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h79225,​79271
File size: 18.3 KB
Line 
1/* $Id: UIDetailsElements.h 104251 2024-04-09 12:36:47Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIDetailsElement[Name] classes declaration.
4 */
5
6/*
7 * Copyright (C) 2012-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_manager_details_UIDetailsElements_h
29#define FEQT_INCLUDED_SRC_manager_details_UIDetailsElements_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QMutex>
36
37/* GUI includes: */
38#include "UIDetailsElement.h"
39#include "UILibraryDefs.h"
40#include "UITask.h"
41
42/* COM includes: */
43#include "CCloudMachine.h"
44#include "CMachine.h"
45
46/* Forward declarations: */
47class UIMachinePreview;
48class CNetworkAdapter;
49
50
51/** UITask extension used as update task for the details-element. */
52class UIDetailsUpdateTask : public UITask
53{
54 Q_OBJECT;
55
56public:
57
58 /** Constructs update task taking @a comMachine as data. */
59 UIDetailsUpdateTask(const CMachine &comMachine);
60 /** Constructs update task taking @a comCloudMachine as data. */
61 UIDetailsUpdateTask(const CCloudMachine &comCloudMachine);
62
63 /** Returns the machine. */
64 CMachine machine() const;
65 /** Returns the cloud machine. */
66 CCloudMachine cloudMachine() const;
67
68 /** Returns the table. */
69 UITextTable table() const;
70 /** Defines the @a guiTable. */
71 void setTable(const UITextTable &guiTable);
72
73private:
74
75 /** Holds the mutex to access m_comMachine and m_comCloudMachine members. */
76 mutable QMutex m_machineMutex;
77 /** Holds the machine being processed. */
78 CMachine m_comMachine;
79 /** Holds the cloud machine being processed. */
80 CCloudMachine m_comCloudMachine;
81
82 /** Holds the mutex to access m_guiTable member. */
83 mutable QMutex m_tableMutex;
84 /** Holds the machine being filled. */
85 UITextTable m_guiTable;
86};
87
88/** UIDetailsElement extension used as a wrapping interface to
89 * extend base-class with async functionality performed by the COM worker-threads. */
90class UIDetailsElementInterface : public UIDetailsElement
91{
92 Q_OBJECT;
93
94public:
95
96 /** Constructs details-element interface for passed @a pParent set.
97 * @param type brings the details-element type this element belongs to.
98 * @param fOpened brings whether the details-element should be visually opened. */
99 UIDetailsElementInterface(UIDetailsSet *pParent, DetailsElementType type, bool fOpened);
100
101protected:
102
103 /** Updates appearance. */
104 virtual void updateAppearance() RT_OVERRIDE;
105
106 /** Creates update task. */
107 virtual UITask *createUpdateTask() = 0;
108
109private slots:
110
111 /** Handles the signal about update @a pTask is finished. */
112 virtual void sltUpdateAppearanceFinished(UITask *pTask);
113
114 /** Performs translation. */
115 void sltRetranslateUI();
116
117private:
118
119 /** Holds the instance of the update task. */
120 UITask *m_pTask;
121};
122
123
124/** UIDetailsElementInterface extension for the details-element type 'Preview'. */
125class UIDetailsElementPreview : public UIDetailsElement
126{
127 Q_OBJECT;
128
129public:
130
131 /** Constructs details-element interface for passed @a pParent set.
132 * @param fOpened brings whether the details-element should be opened. */
133 UIDetailsElementPreview(UIDetailsSet *pParent, bool fOpened);
134
135 /** Updates layout. */
136 virtual void updateLayout() RT_OVERRIDE;
137
138private slots:
139
140 /** Handles preview size-hint changes. */
141 void sltPreviewSizeHintChanged();
142
143 /** Performs translation. */
144 void sltRetranslateUI();
145
146private:
147
148 /** Returns minimum width hint. */
149 int minimumWidthHint() const RT_OVERRIDE;
150 /** Returns minimum height hint.
151 * @param fClosed allows to specify whether the hint should
152 * be calculated for the closed element. */
153 int minimumHeightHintForElement(bool fClosed) const RT_OVERRIDE;
154
155 /** Updates appearance. */
156 void updateAppearance() RT_OVERRIDE;
157
158 /** Holds the instance of VM preview. */
159 UIMachinePreview *m_pPreview;
160};
161
162
163/** UITask extension used as update task for the details-element type 'General'. */
164class UIDetailsUpdateTaskGeneral : public UIDetailsUpdateTask
165{
166 Q_OBJECT;
167
168public:
169
170 /** Constructs update task passing @a comMachine to the base-class. */
171 UIDetailsUpdateTaskGeneral(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral fOptions)
172 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
173
174private:
175
176 /** Contains update task body. */
177 void run() RT_OVERRIDE RT_FINAL;
178
179 /** Holds the options. */
180 UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral m_fOptions;
181};
182
183/** UITask extension used as update task for the details-element type 'General' of cloud VM. */
184class UIDetailsUpdateTaskGeneralCloud : public UIDetailsUpdateTask
185{
186 Q_OBJECT;
187
188public:
189
190 /** Constructs update task passing @a comCloudMachine to the base-class. */
191 UIDetailsUpdateTaskGeneralCloud(const CCloudMachine &comCloudMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral fOptions)
192 : UIDetailsUpdateTask(comCloudMachine), m_fOptions(fOptions) {}
193
194private:
195
196 /** Contains update task body. */
197 void run() RT_OVERRIDE RT_FINAL;
198
199 /** Holds the options. */
200 UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral m_fOptions;
201};
202
203/** UIDetailsElementInterface extension for the details-element type 'General'. */
204class UIDetailsElementGeneral : public UIDetailsElementInterface
205{
206 Q_OBJECT;
207
208public:
209
210 /** Constructs details-element object for passed @a pParent set.
211 * @param fOpened brings whether the details-element should be visually opened. */
212 UIDetailsElementGeneral(UIDetailsSet *pParent, bool fOpened)
213 : UIDetailsElementInterface(pParent, DetailsElementType_General, fOpened) {}
214
215private:
216
217 /** Creates update task for this element. */
218 virtual UITask *createUpdateTask() RT_OVERRIDE;
219};
220
221
222/** UITask extension used as update task for the details-element type 'System'. */
223class UIDetailsUpdateTaskSystem : public UIDetailsUpdateTask
224{
225 Q_OBJECT;
226
227public:
228
229 /** Constructs update task passing @a comMachine to the base-class. */
230 UIDetailsUpdateTaskSystem(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeSystem fOptions)
231 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
232
233private:
234
235 /** Contains update task body. */
236 void run() RT_OVERRIDE RT_FINAL;
237
238 /** Holds the options. */
239 UIExtraDataMetaDefs::DetailsElementOptionTypeSystem m_fOptions;
240};
241
242/** UIDetailsElementInterface extension for the details-element type 'System'. */
243class UIDetailsElementSystem : public UIDetailsElementInterface
244{
245 Q_OBJECT;
246
247public:
248
249 /** Constructs details-element object for passed @a pParent set.
250 * @param fOpened brings whether the details-element should be visually opened. */
251 UIDetailsElementSystem(UIDetailsSet *pParent, bool fOpened)
252 : UIDetailsElementInterface(pParent, DetailsElementType_System, fOpened) {}
253
254private:
255
256 /** Creates update task for this element. */
257 virtual UITask *createUpdateTask() RT_OVERRIDE;
258};
259
260
261/** UITask extension used as update task for the details-element type 'Display'. */
262class UIDetailsUpdateTaskDisplay : public UIDetailsUpdateTask
263{
264 Q_OBJECT;
265
266public:
267
268 /** Constructs update task passing @a comMachine to the base-class. */
269 UIDetailsUpdateTaskDisplay(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay fOptions)
270 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
271
272private:
273
274 /** Contains update task body. */
275 void run() RT_OVERRIDE RT_FINAL;
276
277 /** Holds the options. */
278 UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay m_fOptions;
279};
280
281/** UIDetailsElementInterface extension for the details-element type 'Display'. */
282class UIDetailsElementDisplay : public UIDetailsElementInterface
283{
284 Q_OBJECT;
285
286public:
287
288 /** Constructs details-element object for passed @a pParent set.
289 * @param fOpened brings whether the details-element should be visually opened. */
290 UIDetailsElementDisplay(UIDetailsSet *pParent, bool fOpened)
291 : UIDetailsElementInterface(pParent, DetailsElementType_Display, fOpened) {}
292
293private:
294
295 /** Creates update task for this element. */
296 virtual UITask *createUpdateTask() RT_OVERRIDE;
297};
298
299
300/** UITask extension used as update task for the details-element type 'Storage'. */
301class UIDetailsUpdateTaskStorage : public UIDetailsUpdateTask
302{
303 Q_OBJECT;
304
305public:
306
307 /** Constructs update task passing @a comMachine to the base-class. */
308 UIDetailsUpdateTaskStorage(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeStorage fOptions)
309 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
310
311private:
312
313 /** Contains update task body. */
314 void run() RT_OVERRIDE RT_FINAL;
315
316 /** Holds the options. */
317 UIExtraDataMetaDefs::DetailsElementOptionTypeStorage m_fOptions;
318};
319
320/** UIDetailsElementInterface extension for the details-element type 'Storage'. */
321class UIDetailsElementStorage : public UIDetailsElementInterface
322{
323 Q_OBJECT;
324
325public:
326
327 /** Constructs details-element object for passed @a pParent set.
328 * @param fOpened brings whether the details-element should be visually opened. */
329 UIDetailsElementStorage(UIDetailsSet *pParent, bool fOpened)
330 : UIDetailsElementInterface(pParent, DetailsElementType_Storage, fOpened) {}
331
332private:
333
334 /** Creates update task for this element. */
335 virtual UITask *createUpdateTask() RT_OVERRIDE;
336};
337
338
339/** UITask extension used as update task for the details-element type 'Audio'. */
340class UIDetailsUpdateTaskAudio : public UIDetailsUpdateTask
341{
342 Q_OBJECT;
343
344public:
345
346 /** Constructs update task passing @a comMachine to the base-class. */
347 UIDetailsUpdateTaskAudio(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeAudio fOptions)
348 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
349
350private:
351
352 /** Contains update task body. */
353 void run() RT_OVERRIDE RT_FINAL;
354
355 /** Holds the options. */
356 UIExtraDataMetaDefs::DetailsElementOptionTypeAudio m_fOptions;
357};
358
359/** UIDetailsElementInterface extension for the details-element type 'Audio'. */
360class UIDetailsElementAudio : public UIDetailsElementInterface
361{
362 Q_OBJECT;
363
364public:
365
366 /** Constructs details-element object for passed @a pParent set.
367 * @param fOpened brings whether the details-element should be visually opened. */
368 UIDetailsElementAudio(UIDetailsSet *pParent, bool fOpened)
369 : UIDetailsElementInterface(pParent, DetailsElementType_Audio, fOpened) {}
370
371private:
372
373 /** Creates update task for this element. */
374 virtual UITask *createUpdateTask() RT_OVERRIDE;
375};
376
377
378/** UITask extension used as update task for the details-element type 'Network'. */
379class UIDetailsUpdateTaskNetwork : public UIDetailsUpdateTask
380{
381 Q_OBJECT;
382
383public:
384
385 /** Constructs update task passing @a comMachine to the base-class. */
386 UIDetailsUpdateTaskNetwork(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork fOptions)
387 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
388
389private:
390
391 /** Contains update task body. */
392 void run() RT_OVERRIDE RT_FINAL;
393
394 /** Holds the options. */
395 UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork m_fOptions;
396};
397
398/** UIDetailsElementInterface extension for the details-element type 'Network'. */
399class UIDetailsElementNetwork : public UIDetailsElementInterface
400{
401 Q_OBJECT;
402
403public:
404
405 /** Constructs details-element object for passed @a pParent set.
406 * @param fOpened brings whether the details-element should be visually opened. */
407 UIDetailsElementNetwork(UIDetailsSet *pParent, bool fOpened)
408 : UIDetailsElementInterface(pParent, DetailsElementType_Network, fOpened) {}
409
410private:
411
412 /** Creates update task for this element. */
413 virtual UITask *createUpdateTask() RT_OVERRIDE;
414};
415
416
417/** UITask extension used as update task for the details-element type 'Serial'. */
418class UIDetailsUpdateTaskSerial : public UIDetailsUpdateTask
419{
420 Q_OBJECT;
421
422public:
423
424 /** Constructs update task passing @a comMachine to the base-class. */
425 UIDetailsUpdateTaskSerial(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeSerial fOptions)
426 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
427
428private:
429
430 /** Contains update task body. */
431 void run() RT_OVERRIDE RT_FINAL;
432
433 /** Holds the options. */
434 UIExtraDataMetaDefs::DetailsElementOptionTypeSerial m_fOptions;
435};
436
437/** UIDetailsElementInterface extension for the details-element type 'Serial'. */
438class UIDetailsElementSerial : public UIDetailsElementInterface
439{
440 Q_OBJECT;
441
442public:
443
444 /** Constructs details-element object for passed @a pParent set.
445 * @param fOpened brings whether the details-element should be visually opened. */
446 UIDetailsElementSerial(UIDetailsSet *pParent, bool fOpened)
447 : UIDetailsElementInterface(pParent, DetailsElementType_Serial, fOpened) {}
448
449private:
450
451 /** Creates update task for this element. */
452 virtual UITask *createUpdateTask() RT_OVERRIDE;
453};
454
455
456/** UITask extension used as update task for the details-element type 'USB'. */
457class UIDetailsUpdateTaskUSB : public UIDetailsUpdateTask
458{
459 Q_OBJECT;
460
461public:
462
463 /** Constructs update task passing @a comMachine to the base-class. */
464 UIDetailsUpdateTaskUSB(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeUsb fOptions)
465 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
466
467private:
468
469 /** Contains update task body. */
470 void run() RT_OVERRIDE RT_FINAL;
471
472 /** Holds the options. */
473 UIExtraDataMetaDefs::DetailsElementOptionTypeUsb m_fOptions;
474};
475
476/** UIDetailsElementInterface extension for the details-element type 'USB'. */
477class UIDetailsElementUSB : public UIDetailsElementInterface
478{
479 Q_OBJECT;
480
481public:
482
483 /** Constructs details-element object for passed @a pParent set.
484 * @param fOpened brings whether the details-element should be visually opened. */
485 UIDetailsElementUSB(UIDetailsSet *pParent, bool fOpened)
486 : UIDetailsElementInterface(pParent, DetailsElementType_USB, fOpened) {}
487
488private:
489
490 /** Creates update task for this element. */
491 virtual UITask *createUpdateTask() RT_OVERRIDE;
492};
493
494
495/** UITask extension used as update task for the details-element type 'SF'. */
496class UIDetailsUpdateTaskSF : public UIDetailsUpdateTask
497{
498 Q_OBJECT;
499
500public:
501
502 /** Constructs update task passing @a comMachine to the base-class. */
503 UIDetailsUpdateTaskSF(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders fOptions)
504 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
505
506private:
507
508 /** Contains update task body. */
509 void run() RT_OVERRIDE RT_FINAL;
510
511 /** Holds the options. */
512 UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders m_fOptions;
513};
514
515/** UIDetailsElementInterface extension for the details-element type 'SF'. */
516class UIDetailsElementSF : public UIDetailsElementInterface
517{
518 Q_OBJECT;
519
520public:
521
522 /** Constructs details-element object for passed @a pParent set.
523 * @param fOpened brings whether the details-element should be visually opened. */
524 UIDetailsElementSF(UIDetailsSet *pParent, bool fOpened)
525 : UIDetailsElementInterface(pParent, DetailsElementType_SF, fOpened) {}
526
527private:
528
529 /** Creates update task for this element. */
530 virtual UITask *createUpdateTask() RT_OVERRIDE;
531};
532
533
534/** UITask extension used as update task for the details-element type 'UI'. */
535class UIDetailsUpdateTaskUI : public UIDetailsUpdateTask
536{
537 Q_OBJECT;
538
539public:
540
541 /** Constructs update task passing @a comMachine to the base-class. */
542 UIDetailsUpdateTaskUI(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface fOptions)
543 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
544
545private:
546
547 /** Contains update task body. */
548 void run() RT_OVERRIDE RT_FINAL;
549
550 /** Holds the options. */
551 UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface m_fOptions;
552};
553
554/** UIDetailsElementInterface extension for the details-element type 'UI'. */
555class UIDetailsElementUI : public UIDetailsElementInterface
556{
557 Q_OBJECT;
558
559public:
560
561 /** Constructs details-element object for passed @a pParent set.
562 * @param fOpened brings whether the details-element should be visually opened. */
563 UIDetailsElementUI(UIDetailsSet *pParent, bool fOpened)
564 : UIDetailsElementInterface(pParent, DetailsElementType_UI, fOpened) {}
565
566private:
567
568 /** Creates update task for this element. */
569 virtual UITask *createUpdateTask() RT_OVERRIDE;
570};
571
572
573/** UITask extension used as update task for the details-element type 'Description'. */
574class UIDetailsUpdateTaskDescription : public UIDetailsUpdateTask
575{
576 Q_OBJECT;
577
578public:
579
580 /** Constructs update task passing @a comMachine to the base-class. */
581 UIDetailsUpdateTaskDescription(const CMachine &comMachine, UIExtraDataMetaDefs::DetailsElementOptionTypeDescription fOptions)
582 : UIDetailsUpdateTask(comMachine), m_fOptions(fOptions) {}
583
584private:
585
586 /** Contains update task body. */
587 void run() RT_OVERRIDE RT_FINAL;
588
589 /** Holds the options. */
590 UIExtraDataMetaDefs::DetailsElementOptionTypeDescription m_fOptions;
591};
592
593/** UIDetailsElementInterface extension for the details-element type 'Description'. */
594class UIDetailsElementDescription : public UIDetailsElementInterface
595{
596 Q_OBJECT;
597
598public:
599
600 /** Constructs details-element object for passed @a pParent set.
601 * @param fOpened brings whether the details-element should be visually opened. */
602 UIDetailsElementDescription(UIDetailsSet *pParent, bool fOpened)
603 : UIDetailsElementInterface(pParent, DetailsElementType_Description, fOpened) {}
604
605private:
606
607 /** Creates update task for this element. */
608 virtual UITask *createUpdateTask() RT_OVERRIDE;
609};
610
611#endif /* !FEQT_INCLUDED_SRC_manager_details_UIDetailsElements_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use