1 | /* $Id: UIDetailsContextMenu.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIDetailsContextMenu class 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_UIDetailsContextMenu_h
|
---|
29 | #define FEQT_INCLUDED_SRC_manager_details_UIDetailsContextMenu_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "QIWithRetranslateUI.h"
|
---|
36 | #include "UIExtraDataDefs.h"
|
---|
37 |
|
---|
38 | /* Forward declaration: */
|
---|
39 | class QListWidget;
|
---|
40 | class QListWidgetItem;
|
---|
41 | class UIDetailsModel;
|
---|
42 |
|
---|
43 | /** QWidget subclass used as Details pane context menu. */
|
---|
44 | class UIDetailsContextMenu : public QIWithRetranslateUI2<QWidget>
|
---|
45 | {
|
---|
46 | Q_OBJECT;
|
---|
47 |
|
---|
48 | public:
|
---|
49 |
|
---|
50 | /** Context menu data fields. */
|
---|
51 | enum DataField
|
---|
52 | {
|
---|
53 | DataField_Type = Qt::UserRole + 1,
|
---|
54 | DataField_Name = Qt::UserRole + 2,
|
---|
55 | };
|
---|
56 |
|
---|
57 | /** Constructs context-menu.
|
---|
58 | * @param pModel Brings model object reference. */
|
---|
59 | UIDetailsContextMenu(UIDetailsModel *pModel);
|
---|
60 |
|
---|
61 | /** Updates category check-states. */
|
---|
62 | void updateCategoryStates();
|
---|
63 | /** Updates option check-states for certain @a enmRequiredCategoryType. */
|
---|
64 | void updateOptionStates(DetailsElementType enmRequiredCategoryType = DetailsElementType_Invalid);
|
---|
65 |
|
---|
66 | protected:
|
---|
67 |
|
---|
68 | /** Handles translation event. */
|
---|
69 | virtual void retranslateUi() RT_OVERRIDE;
|
---|
70 |
|
---|
71 | /** Handles translation event for categories list. */
|
---|
72 | void retranslateCategories();
|
---|
73 | /** Handles translation event for options list. */
|
---|
74 | void retranslateOptions();
|
---|
75 |
|
---|
76 | private slots:
|
---|
77 |
|
---|
78 | /** Handles signal about category list-widget @a pItem hovered. */
|
---|
79 | void sltCategoryItemEntered(QListWidgetItem *pItem);
|
---|
80 | /** Handles signal about category list-widget @a pItem clicked. */
|
---|
81 | void sltCategoryItemClicked(QListWidgetItem *pItem);
|
---|
82 | /** Handles signal about current category list-widget @a pItem hovered. */
|
---|
83 | void sltCategoryItemChanged(QListWidgetItem *pCurrent, QListWidgetItem *pPrevious);
|
---|
84 |
|
---|
85 | /** Handles signal about option list-widget @a pItem hovered. */
|
---|
86 | void sltOptionItemEntered(QListWidgetItem *pItem);
|
---|
87 | /** Handles signal about option list-widget @a pItem clicked. */
|
---|
88 | void sltOptionItemClicked(QListWidgetItem *pItem);
|
---|
89 |
|
---|
90 | private:
|
---|
91 |
|
---|
92 | /** Prepares all. */
|
---|
93 | void prepare();
|
---|
94 |
|
---|
95 | /** (Re)populates categories. */
|
---|
96 | void populateCategories();
|
---|
97 | /** (Re)populates options. */
|
---|
98 | void populateOptions();
|
---|
99 |
|
---|
100 | /** Adjusts both list widgets. */
|
---|
101 | void adjustListWidgets();
|
---|
102 |
|
---|
103 | /** Creates category list item with specified @a icon. */
|
---|
104 | QListWidgetItem *createCategoryItem(const QIcon &icon);
|
---|
105 | /** Creates option list item. */
|
---|
106 | QListWidgetItem *createOptionItem();
|
---|
107 |
|
---|
108 | /** Holds the model reference. */
|
---|
109 | UIDetailsModel *m_pModel;
|
---|
110 |
|
---|
111 | /** Holds the categories list instance. */
|
---|
112 | QListWidget *m_pListWidgetCategories;
|
---|
113 | /** Holds the options list instance. */
|
---|
114 | QListWidget *m_pListWidgetOptions;
|
---|
115 | };
|
---|
116 |
|
---|
117 | #endif /* !FEQT_INCLUDED_SRC_manager_details_UIDetailsContextMenu_h */
|
---|