1 | /* $Id: UIChooserView.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIChooserView class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2024 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_chooser_UIChooserView_h
|
---|
29 | #define FEQT_INCLUDED_SRC_manager_chooser_UIChooserView_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "QIGraphicsView.h"
|
---|
36 |
|
---|
37 | /* Forward declarations: */
|
---|
38 | class UIChooserModel;
|
---|
39 | class UIChooserSearchWidget;
|
---|
40 |
|
---|
41 | /** QIGraphicsView extension used as VM chooser pane view. */
|
---|
42 | class UIChooserView : public QIGraphicsView
|
---|
43 | {
|
---|
44 | Q_OBJECT;
|
---|
45 |
|
---|
46 | signals:
|
---|
47 |
|
---|
48 | /** Notifies listeners about resize. */
|
---|
49 | void sigResized();
|
---|
50 |
|
---|
51 | /** Notifies listeners about search widget visibility changed to @a fVisible. */
|
---|
52 | void sigSearchWidgetVisibilityChanged(bool fVisible);
|
---|
53 |
|
---|
54 | public:
|
---|
55 |
|
---|
56 | /** Constructs a Chooser-view passing @a pParent to the base-class. */
|
---|
57 | UIChooserView(QWidget *pParent);
|
---|
58 |
|
---|
59 | /** @name General stuff.
|
---|
60 | * @{ */
|
---|
61 | /** Defines @a pChooserModel reference. */
|
---|
62 | void setModel(UIChooserModel *pChooserModel);
|
---|
63 | /** Returns Chooser-model reference. */
|
---|
64 | UIChooserModel *model() const;
|
---|
65 | /** @} */
|
---|
66 |
|
---|
67 | /** @name Search stuff.
|
---|
68 | * @{ */
|
---|
69 | /** Returns whether search widget visible. */
|
---|
70 | bool isSearchWidgetVisible() const;
|
---|
71 | /** Makes search widget @a fVisible. */
|
---|
72 | void setSearchWidgetVisible(bool fVisible);
|
---|
73 |
|
---|
74 | /** Updates search widget's results count.
|
---|
75 | * @param iTotalMatchCount Brings total search results count.
|
---|
76 | * @param iCurrentlyScrolledItemIndex Brings the item index search currently scrolled to. */
|
---|
77 | void setSearchResultsCount(int iTotalMatchCount, int iCurrentlyScrolledItemIndex);
|
---|
78 | /** Forwards @a strSearchText to the search widget which in
|
---|
79 | * turn appends it to the current (if any) search term. */
|
---|
80 | void appendToSearchString(const QString &strSearchText);
|
---|
81 | /** Repeats the last search again. */
|
---|
82 | void redoSearch();
|
---|
83 | /** @} */
|
---|
84 |
|
---|
85 | public slots:
|
---|
86 |
|
---|
87 | /** @name Layout stuff.
|
---|
88 | * @{ */
|
---|
89 | /** Handles minimum width @a iHint change. */
|
---|
90 | void sltMinimumWidthHintChanged(int iHint);
|
---|
91 | /** @} */
|
---|
92 |
|
---|
93 | protected:
|
---|
94 |
|
---|
95 | /** @name Event handling stuff.
|
---|
96 | * @{ */
|
---|
97 | /** Handles resize @a pEvent. */
|
---|
98 | virtual void resizeEvent(QResizeEvent *pEvent) RT_OVERRIDE;
|
---|
99 | /** @} */
|
---|
100 |
|
---|
101 | private slots:
|
---|
102 |
|
---|
103 | /** @name Theme stuff stuff.
|
---|
104 | * @{ */
|
---|
105 | /** Updates palette. */
|
---|
106 | void sltUpdatePalette() { preparePalette(); }
|
---|
107 | /** @} */
|
---|
108 |
|
---|
109 | /** @name Search stuff.
|
---|
110 | * @{ */
|
---|
111 | /** Handles request for a new search.
|
---|
112 | * @param strSearchTerm Brings the search term.
|
---|
113 | * @param iSearchFlags Brings the item search flags. */
|
---|
114 | void sltRedoSearch(const QString &strSearchTerm, int iSearchFlags);
|
---|
115 | /** Handles request to scroll to @a fNext search result. */
|
---|
116 | void sltHandleScrollToSearchResult(bool fNext);
|
---|
117 | /** Handles request to scroll to make search widget @a fVisible. */
|
---|
118 | void sltHandleSearchWidgetVisibilityToggle(bool fVisible);
|
---|
119 | /** @} */
|
---|
120 |
|
---|
121 | /** @name Event handling stuff.
|
---|
122 | * @{ */
|
---|
123 | /** Handles translation event. */
|
---|
124 | void sltRetranslateUI();
|
---|
125 | /** @} */
|
---|
126 |
|
---|
127 | private:
|
---|
128 |
|
---|
129 | /** @name Prepare/Cleanup cascade.
|
---|
130 | * @{ */
|
---|
131 | /** Prepares all. */
|
---|
132 | void prepare();
|
---|
133 | /** Prepares this. */
|
---|
134 | void prepareThis();
|
---|
135 | /** Prepares palette. */
|
---|
136 | void preparePalette();
|
---|
137 | /** Prepares widgets. */
|
---|
138 | void prepareWidget();
|
---|
139 | /** @} */
|
---|
140 |
|
---|
141 | /** @name General stuff.
|
---|
142 | * @{ */
|
---|
143 | /** Updates scene rectangle. */
|
---|
144 | void updateSceneRect();
|
---|
145 | /** @} */
|
---|
146 |
|
---|
147 | /** @name Search stuff.
|
---|
148 | * @{ */
|
---|
149 | /** Updates search widget's geometry. */
|
---|
150 | void updateSearchWidgetGeometry();
|
---|
151 | /** @} */
|
---|
152 |
|
---|
153 | /** @name General stuff.
|
---|
154 | * @{ */
|
---|
155 | /** Holds the Chooser-model reference. */
|
---|
156 | UIChooserModel *m_pChooserModel;
|
---|
157 | /** @} */
|
---|
158 |
|
---|
159 | /** @name Search stuff.
|
---|
160 | * @{ */
|
---|
161 | /** Holds the search widget instance. */
|
---|
162 | UIChooserSearchWidget *m_pSearchWidget;
|
---|
163 | /** @} */
|
---|
164 |
|
---|
165 | /** @name Layout stuff.
|
---|
166 | * @{ */
|
---|
167 | /** Holds the minimum width hint. */
|
---|
168 | int m_iMinimumWidthHint;
|
---|
169 | /** @} */
|
---|
170 | };
|
---|
171 |
|
---|
172 | #endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserView_h */
|
---|